Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SpineScale : 胴のサイズを調整する CM3D.MaidVoicePitch.Plugin.cs の追加メソッド
- // CM3D.MaidVoicePitch.Plugin を適用し#WIDESLIDER# を有効にした状態で、メイドのフリーコメント欄に、
- // #SPISCL=1.0,1.0,1.0# の記述で下腹部周辺のサイズ調整。表記順は、幅,奥行き,高さ。
- // #S0ASCL=1.0,1.0,1.0# の記述で腹部周辺のサイズ調整。表記順は、幅,奥行き,高さ。
- // #S1_SCL=1.0,1.0,1.0# の記述でみぞおち周辺のサイズ調整。表記順は、幅,奥行き,高さ。
- // #S1ASCL=1.0,1.0,1.0# の記述で首・肋骨周辺のサイズ調整。表記順は、幅,奥行き,高さ。
- //1.
- //以下を CM3D.MaidVoicePitch.Plugin.cs の public class MaidVoicePitch {...} の任意の場所に挿入
- void SpineScale(Maid maid, string freeComment)
- {
- Match sclspi = Regex.Match(freeComment, @"#SPISCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
- Match scls0a = Regex.Match(freeComment, @"#S0ASCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
- Match scls1_ = Regex.Match(freeComment, @"#S1_SCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
- Match scls1a = Regex.Match(freeComment, @"#S1ASCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
- if (sclspi.Groups.Count < 4 && scls0a.Groups.Count < 4 && scls1_.Groups.Count < 4 && scls1a.Groups.Count < 4) return;
- BoneMorph_ bm_ = maid.body0.bonemorph;
- // 胴(下腹部周辺)
- if (sclspi.Groups.Count >= 4)
- {
- List<Transform> tListS = new List<Transform>();
- for (int i=0; i<bm_.bones.Count; i++)
- {
- if (bm_.bones[i].linkT == null) continue;
- if (bm_.bones[i].linkT.name == "Bip01 Spine_SCL_") tListS.Add(bm_.bones[i].linkT);
- }
- if(tListS.Count >= 1)
- {
- float mw = Helper.FloatTryParse(sclspi.Groups[1].Value);
- float md = Helper.FloatTryParse(sclspi.Groups[2].Value);
- float mh = Helper.FloatTryParse(sclspi.Groups[3].Value);
- Vector3 scl = new Vector3(mh, md, mw);
- foreach (Transform t in tListS) t.localScale = Vector3.Scale(t.localScale, scl);
- }
- }
- // 胴0a(腹部周辺)
- if (scls0a.Groups.Count >= 4)
- {
- List<Transform> tListS = new List<Transform>();
- for (int i=0; i<bm_.bones.Count; i++)
- {
- if (bm_.bones[i].linkT == null) continue;
- if (bm_.bones[i].linkT.name == "Bip01 Spine0a_SCL_") tListS.Add(bm_.bones[i].linkT);
- }
- if(tListS.Count >= 1)
- {
- float mw = Helper.FloatTryParse(scls0a.Groups[1].Value);
- float md = Helper.FloatTryParse(scls0a.Groups[2].Value);
- float mh = Helper.FloatTryParse(scls0a.Groups[3].Value);
- Vector3 scl = new Vector3(mh, md, mw);
- foreach (Transform t in tListS) t.localScale = Vector3.Scale(t.localScale, scl);
- }
- }
- // 胴1_(みぞおち周辺)
- if (scls1_.Groups.Count >= 4)
- {
- List<Transform> tListS = new List<Transform>();
- for (int i=0; i<bm_.bones.Count; i++)
- {
- if (bm_.bones[i].linkT == null) continue;
- if (bm_.bones[i].linkT.name == "Bip01 Spine1_SCL_") tListS.Add(bm_.bones[i].linkT);
- }
- if(tListS.Count >= 1)
- {
- float mw = Helper.FloatTryParse(scls1_.Groups[1].Value);
- float md = Helper.FloatTryParse(scls1_.Groups[2].Value);
- float mh = Helper.FloatTryParse(scls1_.Groups[3].Value);
- Vector3 scl = new Vector3(mh, md, mw);
- foreach (Transform t in tListS) t.localScale = Vector3.Scale(t.localScale, scl);
- }
- }
- // 胴1a(首・肋骨周辺)
- if (scls1a.Groups.Count >= 4)
- {
- List<Transform> tListS = new List<Transform>();
- for (int i=0; i<bm_.bones.Count; i++)
- {
- if (bm_.bones[i].linkT == null) continue;
- if (bm_.bones[i].linkT.name == "Bip01 Spine1a_SCL_") tListS.Add(bm_.bones[i].linkT);
- }
- if(tListS.Count >= 1)
- {
- float mw = Helper.FloatTryParse(scls1a.Groups[1].Value);
- float md = Helper.FloatTryParse(scls1a.Groups[2].Value);
- float mh = Helper.FloatTryParse(scls1a.Groups[3].Value);
- Vector3 scl = new Vector3(mh, md, mw);
- foreach (Transform t in tListS) t.localScale = Vector3.Scale(t.localScale, scl);
- }
- }
- }
- //2.
- //CM3D.MaidVoicePitch.Plugin.cs の void MaidUpdate(Maid maid, bool bEditUpdate) {...} の
- //WideSlider(maid, freeComment); 以降で SpineScale 呼び出しを記述
- //example (+行が追加箇所)
- void MaidUpdate(Maid maid, bool bEditUpdate)
- {
- (...中略...)
- Pitch(maid, freeComment);
- Mabataki(maid, freeComment);
- WideSlider(maid, freeComment);
- EyeBall(maid, freeComment);
- LowerBodyScale(maid, freeComment);
- EyeScaleRotate(maid, freeComment);
- + SpineScale(maid, freeComment);
- TestMabatakiSpeed(maid, freeComment, bEditUpdate);
- TestPelvis(maid, freeComment);
- TestLipSync(maid, freeComment);
- TestSliderTemplate(maid, freeComment);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement