Advertisement
cm3d2-01

SpineScale

Aug 18th, 2015
1,503
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.99 KB | None | 0 0
  1. // SpineScale : 胴のサイズを調整する CM3D.MaidVoicePitch.Plugin.cs の追加メソッド
  2.  
  3. // CM3D.MaidVoicePitch.Plugin を適用し#WIDESLIDER# を有効にした状態で、メイドのフリーコメント欄に、
  4. // #SPISCL=1.0,1.0,1.0# の記述で下腹部周辺のサイズ調整。表記順は、幅,奥行き,高さ。
  5. // #S0ASCL=1.0,1.0,1.0# の記述で腹部周辺のサイズ調整。表記順は、幅,奥行き,高さ。
  6. // #S1_SCL=1.0,1.0,1.0# の記述でみぞおち周辺のサイズ調整。表記順は、幅,奥行き,高さ。
  7. // #S1ASCL=1.0,1.0,1.0# の記述で首・肋骨周辺のサイズ調整。表記順は、幅,奥行き,高さ。
  8.  
  9. //1.
  10. //以下を CM3D.MaidVoicePitch.Plugin.cs の public class MaidVoicePitch {...} の任意の場所に挿入
  11.  
  12.         void SpineScale(Maid maid, string freeComment)
  13.         {
  14.             Match sclspi = Regex.Match(freeComment, @"#SPISCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
  15.             Match scls0a = Regex.Match(freeComment, @"#S0ASCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
  16.             Match scls1_ = Regex.Match(freeComment, @"#S1_SCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
  17.             Match scls1a = Regex.Match(freeComment, @"#S1ASCL=([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+),([-+]?[0-9]*\.?[0-9]+)#");
  18.             if (sclspi.Groups.Count < 4 && scls0a.Groups.Count < 4 && scls1_.Groups.Count < 4 && scls1a.Groups.Count < 4) return;
  19.  
  20.             BoneMorph_ bm_ = maid.body0.bonemorph;
  21.  
  22.             // 胴(下腹部周辺)
  23.             if (sclspi.Groups.Count >= 4)
  24.             {
  25.                 List<Transform> tListS = new List<Transform>();
  26.  
  27.                 for (int i=0; i<bm_.bones.Count; i++)
  28.                 {
  29.                     if (bm_.bones[i].linkT == null) continue;
  30.                     if (bm_.bones[i].linkT.name == "Bip01 Spine_SCL_") tListS.Add(bm_.bones[i].linkT);
  31.                 }
  32.  
  33.                 if(tListS.Count >= 1)
  34.                 {
  35.                     float mw = Helper.FloatTryParse(sclspi.Groups[1].Value);
  36.                     float md = Helper.FloatTryParse(sclspi.Groups[2].Value);
  37.                     float mh = Helper.FloatTryParse(sclspi.Groups[3].Value);
  38.    
  39.                     Vector3 scl = new Vector3(mh, md, mw);
  40.                     foreach (Transform t in tListS) t.localScale = Vector3.Scale(t.localScale, scl);
  41.                 }
  42.             }
  43.             // 胴0a(腹部周辺)
  44.             if (scls0a.Groups.Count >= 4)
  45.             {
  46.                 List<Transform> tListS = new List<Transform>();
  47.  
  48.                 for (int i=0; i<bm_.bones.Count; i++)
  49.                 {
  50.                     if (bm_.bones[i].linkT == null) continue;
  51.                     if (bm_.bones[i].linkT.name == "Bip01 Spine0a_SCL_") tListS.Add(bm_.bones[i].linkT);
  52.                 }
  53.  
  54.                 if(tListS.Count >= 1)
  55.                 {
  56.                     float mw = Helper.FloatTryParse(scls0a.Groups[1].Value);
  57.                     float md = Helper.FloatTryParse(scls0a.Groups[2].Value);
  58.                     float mh = Helper.FloatTryParse(scls0a.Groups[3].Value);
  59.    
  60.                     Vector3 scl = new Vector3(mh, md, mw);
  61.                     foreach (Transform t in tListS) t.localScale = Vector3.Scale(t.localScale, scl);
  62.                 }
  63.             }
  64.             // 胴1_(みぞおち周辺)
  65.             if (scls1_.Groups.Count >= 4)
  66.             {
  67.                  List<Transform> tListS = new List<Transform>();
  68.  
  69.                 for (int i=0; i<bm_.bones.Count; i++)
  70.                 {
  71.                     if (bm_.bones[i].linkT == null) continue;
  72.                     if (bm_.bones[i].linkT.name == "Bip01 Spine1_SCL_") tListS.Add(bm_.bones[i].linkT);
  73.                 }
  74.  
  75.                 if(tListS.Count >= 1)
  76.                 {
  77.                     float mw = Helper.FloatTryParse(scls1_.Groups[1].Value);
  78.                     float md = Helper.FloatTryParse(scls1_.Groups[2].Value);
  79.                     float mh = Helper.FloatTryParse(scls1_.Groups[3].Value);
  80.    
  81.                     Vector3 scl = new Vector3(mh, md, mw);
  82.                     foreach (Transform t in tListS) t.localScale = Vector3.Scale(t.localScale, scl);
  83.                 }
  84.             }
  85.             // 胴1a(首・肋骨周辺)
  86.             if (scls1a.Groups.Count >= 4)
  87.             {
  88.                 List<Transform> tListS = new List<Transform>();
  89.  
  90.                 for (int i=0; i<bm_.bones.Count; i++)
  91.                 {
  92.                     if (bm_.bones[i].linkT == null) continue;
  93.                     if (bm_.bones[i].linkT.name == "Bip01 Spine1a_SCL_") tListS.Add(bm_.bones[i].linkT);
  94.                 }
  95.  
  96.                 if(tListS.Count >= 1)
  97.                 {
  98.                     float mw = Helper.FloatTryParse(scls1a.Groups[1].Value);
  99.                     float md = Helper.FloatTryParse(scls1a.Groups[2].Value);
  100.                     float mh = Helper.FloatTryParse(scls1a.Groups[3].Value);
  101.    
  102.                     Vector3 scl = new Vector3(mh, md, mw);
  103.                     foreach (Transform t in tListS) t.localScale = Vector3.Scale(t.localScale, scl);
  104.                 }
  105.             }
  106.         }
  107.  
  108.  
  109. //2.
  110. //CM3D.MaidVoicePitch.Plugin.cs の void MaidUpdate(Maid maid, bool bEditUpdate) {...} の
  111. //WideSlider(maid, freeComment); 以降で SpineScale 呼び出しを記述
  112.  
  113. //example (+行が追加箇所)
  114.  
  115.         void MaidUpdate(Maid maid, bool bEditUpdate)
  116.         {
  117.  
  118.             (...中略...)
  119.  
  120.             Pitch(maid, freeComment);
  121.             Mabataki(maid, freeComment);
  122.             WideSlider(maid, freeComment);
  123.             EyeBall(maid, freeComment);
  124.             LowerBodyScale(maid, freeComment);
  125.             EyeScaleRotate(maid, freeComment);
  126. +           SpineScale(maid, freeComment);
  127.             TestMabatakiSpeed(maid, freeComment, bEditUpdate);
  128.             TestPelvis(maid, freeComment);
  129.             TestLipSync(maid, freeComment);
  130.             TestSliderTemplate(maid, freeComment);
  131.        }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement