Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //***********************************************************************************
- // CM3D.MaidVoicePitch.Plugin 0.1.9 で本体に組み込まれました。
- // 0.1.9以降はこのコードを組み込む必要はありません。
- //***********************************************************************************
- // LowerBodyScale : 下半身の大きさを調整する CM3D.MaidVoicePitch.Plugin.cs の追加メソッド
- // ReiPatcherで CM3D2.PreLBS.Patcher (http://pastebin.com/VDZVUQED) を適用し、
- // CM3D.MaidVoicePitch.Plugin を適用し #WIDESLIDER# を有効にした状態で、メイドのフリーコメント欄に、
- // #PELSCL=1.0,1.0,1.0# の記述で骨盤周りのサイズ調整。表記順は、幅,奥行き,高さ。
- // #THISCL=1.0,1.0# の記述で足全体のサイズ調整。表記順は、幅,奥行き。
- // #THIPOS=1.0,1.0# の記述で足全体の位置調整。表記順は、左右,前後。
- //1.
- //以下を CM3D.MaidVoicePitch.Plugin.cs の public class MaidVoicePitch {...} の任意の場所に挿入
- // 下半身の大きさを調整する
- void LowerBodyScale(Maid maid, string freeComment)
- {
- Match pscl = Regex.Match(freeComment, @"#PELSCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
- Match tscl = Regex.Match(freeComment, @"#THISCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
- Match tpos = Regex.Match(freeComment, @"#THIPOS=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
- if (pscl.Groups.Count < 4 && tscl.Groups.Count < 3 && tpos.Groups.Count < 3) return;
- BoneMorph_ bm_ = maid.body0.bonemorph;
- List<Transform> tListP = new List<Transform>();
- List<Transform> tListHL = new List<Transform>();
- List<Transform> tListHR = new List<Transform>();
- List<Transform> tListTL = new List<Transform>();
- List<Transform> tListTR = new List<Transform>();
- if (pscl.Groups.Count >= 4)
- {
- for (int i=0; i<bm_.bones.Count; i++)
- {
- if(bm_.bones[i].linkT == null) continue;
- if(bm_.bones[i].linkT.name == "Bip01 Pelvis_SCL_") tListP.Add(bm_.bones[i].linkT);
- if(bm_.bones[i].linkT.name == "Hip_L") tListHL.Add(bm_.bones[i].linkT);
- if(bm_.bones[i].linkT.name == "Hip_R") tListHR.Add(bm_.bones[i].linkT);
- }
- if (tListP.Count < 1 || tListHL.Count < 1 || tListHR.Count < 1) return;
- float mw = Helper.FloatTryParse(pscl.Groups[1].Value);
- float md = Helper.FloatTryParse(pscl.Groups[2].Value);
- float mh = Helper.FloatTryParse(pscl.Groups[3].Value);
- Vector3 sclrvs = new Vector3(mh, md, mw);
- foreach(Transform t in tListP) t.localScale = Vector3.Scale(t.localScale, sclrvs);
- foreach(Transform t in tListHL) t.localScale = Vector3.Scale(t.localScale, sclrvs);
- foreach(Transform t in tListHR) t.localScale = Vector3.Scale(t.localScale, sclrvs);
- }
- if (tscl.Groups.Count >= 3)
- {
- for (int i=0; i<bm_.bones.Count; i++)
- {
- if(bm_.bones[i].linkT.name == "Bip01 L Thigh") tListTL.Add(bm_.bones[i].linkT);
- if(bm_.bones[i].linkT.name == "Bip01 R Thigh") tListTR.Add(bm_.bones[i].linkT);
- }
- if (tListTL.Count < 1 || tListTR.Count < 1) return;
- float mw = Helper.FloatTryParse(tscl.Groups[1].Value);
- float md = Helper.FloatTryParse(tscl.Groups[2].Value);
- float mh = 1.0f;
- Vector3 sclrvs = new Vector3(mh, md, mw);
- foreach(Transform t in tListTL) t.localScale = Vector3.Scale(t.localScale, sclrvs);
- foreach(Transform t in tListTR) t.localScale = Vector3.Scale(t.localScale, sclrvs);
- }
- if (tpos.Groups.Count >= 3)
- {
- for (int i=0; i<bm_.bones.Count; i++)
- {
- if(bm_.bones[i].linkT == null) continue;
- if(bm_.bones[i].linkT.name == "Hip_L") tListHL.Add(bm_.bones[i].linkT);
- if(bm_.bones[i].linkT.name == "Hip_R") tListHR.Add(bm_.bones[i].linkT);
- if(bm_.bones[i].linkT.name == "Bip01 L Thigh") tListTL.Add(bm_.bones[i].linkT);
- if(bm_.bones[i].linkT.name == "Bip01 R Thigh") tListTR.Add(bm_.bones[i].linkT);
- }
- if (tListHL.Count < 1 || tListHR.Count < 1 || tListTL.Count < 1 || tListTR.Count < 1) return;
- float dx = Helper.FloatTryParse(tpos.Groups[1].Value);
- float dz = Helper.FloatTryParse(tpos.Groups[2].Value);
- float dy = 0.0f;
- Vector3 posrvsL = new Vector3(dy, dz/1000f, -dx/1000f);
- Vector3 posrvsR = new Vector3(dy, dz/1000f, dx/1000f);
- foreach(Transform t in tListTL) t.localPosition += posrvsL;
- foreach(Transform t in tListTR) t.localPosition += posrvsR;
- foreach(Transform t in tListHL) t.localPosition += posrvsL;
- foreach(Transform t in tListHR) t.localPosition += posrvsR;
- }
- }
- //2.
- //CM3D.MaidVoicePitch.Plugin.cs の void MaidUpdate(Maid maid, bool bEditUpdate) {...} の
- //WideSlider(maid, freeComment); 以降で LowerBodyScale 呼び出しを記述
- //example (+行が追加箇所)
- void MaidUpdate(Maid maid, bool bEditUpdate)
- {
- (...中略...)
- Pitch(maid, freeComment);
- Mabataki(maid, freeComment);
- WideSlider(maid, freeComment);
- EyeBall(maid, freeComment);
- + LowerBodyScale(maid, freeComment);
- TestMabatakiSpeed(maid, freeComment, bEditUpdate);
- TestPelvis(maid, freeComment);
- TestLipSync(maid, freeComment);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement