Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //***********************************************************************************
- // CM3D.MaidVoicePitch.Plugin 0.1.8 で本体に組み込まれました。
- // 0.1.8以降はこのコードを組み込む必要はありません。
- //***********************************************************************************
- // EyeScaleRotate : 目のサイズと角度変更する CM3D.MaidVoicePitch.Plugin.cs の追加メソッド
- // CM3D.MaidVoicePitch.Plugin を適用し #WIDESLIDER# を有効にした状態で、メイドのフリーコメント欄に、
- // #EYESCL=1.0,1.0# の記述で縦・横拡大が有効。表記順は、幅,高さ。
- // #EYEANG=0,0,0# の記述で回転が有効。表記順は、回転(度),横位置補正,縦位置補正。
- //※注意
- // EYEANGは現状仕様上の不具合があって、一度有効にすると上方向に目の基準位置がずれる。
- // EYEANG有効中は補正してあるけど、無効にしたら目のズレだけが残る。(#EYEANG=0,0,0#でとりあえず有効にしておけば補正は効く)
- // 一度発生したズレを解消したい場合は、ゲームを再起動するか、
- // 一回エディット画面抜けて、別のメイドのエディット呼び出して、再度ズレたメイドを呼び出す必要がある。
- //1.
- //以下を CM3D.MaidVoicePich.Plugin.cs の public class MaidVoicePitch {...} の任意の場所に挿入
- void EyeScaleRotate(Maid maid, string freeComment)
- {
- Match scl = Regex.Match(freeComment, @"#EYESCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
- Match ang = Regex.Match(freeComment, @"#EYEANG=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
- if (scl.Groups.Count < 3 && ang.Groups.Count < 4) return;
- Transform tL = null;
- Transform tR = null;
- for (int i=0; i<maid.body0.bonemorph.bones.Count; i++)
- {
- if(maid.body0.bonemorph.bones[i].linkT == null) continue;
- if(maid.body0.bonemorph.bones[i].linkT.name == "Eyepos_L") tL = maid.body0.bonemorph.bones[i].linkT;
- if(maid.body0.bonemorph.bones[i].linkT.name == "Eyepos_R") tR = maid.body0.bonemorph.bones[i].linkT;
- }
- if (tL == null || tR == null) return;
- if (scl.Groups.Count >= 3)
- {
- Vector3 sclrvs = new Vector3(1.00f, Helper.FloatTryParse(scl.Groups[2].Value), Helper.FloatTryParse(scl.Groups[1].Value));
- tL.localScale = Vector3.Scale(tL.localScale, sclrvs);
- tR.localScale = Vector3.Scale(tR.localScale, sclrvs);
- }
- if (ang.Groups.Count >= 4)
- {
- Vector3 pv = new Vector3(-1, 0f, 0f);
- Vector3 ry_d = new Vector3(0f, -0.0125f, 0f);
- float ra = Helper.FloatTryParse(ang.Groups[1].Value);
- float rx = Helper.FloatTryParse(ang.Groups[2].Value);
- float ry = Helper.FloatTryParse(ang.Groups[3].Value);
- tL.localRotation = Quaternion.AngleAxis(ra,pv);
- tR.localRotation = Quaternion.AngleAxis(-180f-ra,pv);
- tL.localPosition += ry_d;
- tR.localPosition += ry_d;
- if (rx != 0 || ry != 0)
- {
- Vector3 posrvsL = new Vector3(0f, ry/1000f, rx/1000f);
- Vector3 posrvsR = new Vector3(0f, ry/1000f, -rx/1000f);
- tL.localPosition += posrvsL;
- tR.localPosition += posrvsR;
- }
- }
- }
- //2.
- //CM3D.MaidVoicePitch.Plugin.cs の void MaidUpdate(Maid maid, bool bEditUpdate) {...} の
- //WideSlider(maid, freeComment); 以降で EyeScaleRotate 呼び出しを記述
- //example (+行が追加箇所)
- void MaidUpdate(Maid maid, bool bEditUpdate)
- {
- (...中略...)
- Pitch(maid, freeComment);
- Mabataki(maid, freeComment);
- WideSlider(maid, freeComment);
- EyeBall(maid, freeComment);
- + EyeScaleRotate(maid, freeComment);
- TestMabatakiSpeed(maid, freeComment, bEditUpdate);
- TestPelvis(maid, freeComment);
- TestLipSync(maid, freeComment);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement