BoneMorph_.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using UnityEngine;
  5. public class BoneMorph_
  6. {
  7. public void Init()
  8. {
  9. if (this.bones != null)
  10. {
  11. for (int i = this.bones.Count - 1; i >= 0; i--)
  12. {
  13. BoneMorphLocal boneMorphLocal = this.bones[i];
  14. if (boneMorphLocal.linkT != null)
  15. {
  16. boneMorphLocal.linkT.localPosition = boneMorphLocal.pos;
  17. }
  18. }
  19. }
  20. this.bones = new List<BoneMorphLocal>();
  21. }
  22. public void Uninit()
  23. {
  24. this.m_listBoneMorphPos.Clear();
  25. this.m_listBoneMorphScl.Clear();
  26. this.m_listBoneMorphRot.Clear();
  27. }
  28. public void InitBoneMorphEdit(Transform t, MPN f_mpn, TBody.SlotID f_slot)
  29. {
  30. TBodySkin slot = t.GetComponentsInParent<TBody>(true)[0].GetSlot((int)f_slot);
  31. this.InitBoneMorphEdit(t, f_mpn, f_slot, slot);
  32. }
  33. public void InitBoneMorphEdit(Transform t, MPN f_mpn, TBody.SlotID f_slot, TBodySkin tbskin)
  34. {
  35. this.m_tbSkin = tbskin;
  36. Func<string, Transform, BoneMorph_.BoneMorphPos> func = delegate(string propertyName, Transform boneTrans)
  37. {
  38. this.m_listBoneMorphPos.RemoveAll((BoneMorph_.BoneMorphPos f) => f.strPropName == propertyName);
  39. this.m_listBoneMorphPos.Add(new BoneMorph_.BoneMorphPos(propertyName, boneTrans));
  40. return this.m_listBoneMorphPos[this.m_listBoneMorphPos.Count - 1];
  41. };
  42. Func<string, Transform, BoneMorph_.BoneMorphRotatio> func2 = delegate(string propertyName, Transform boneTrans)
  43. {
  44. this.m_listBoneMorphRot.RemoveAll((BoneMorph_.BoneMorphRotatio f) => f.strPropName == propertyName);
  45. this.m_listBoneMorphRot.Add(new BoneMorph_.BoneMorphRotatio(propertyName, boneTrans));
  46. return this.m_listBoneMorphRot[this.m_listBoneMorphRot.Count - 1];
  47. };
  48. Func<string, Transform, BoneMorph_.BoneMorphScl> func3 = delegate(string propertyName, Transform boneTrans)
  49. {
  50. this.m_listBoneMorphScl.RemoveAll((BoneMorph_.BoneMorphScl f) => f.strPropName == propertyName);
  51. this.m_listBoneMorphScl.Add(new BoneMorph_.BoneMorphScl(propertyName, boneTrans));
  52. return this.m_listBoneMorphScl[this.m_listBoneMorphScl.Count - 1];
  53. };
  54. if (f_mpn == MPN.head && f_slot == TBody.SlotID.head)
  55. {
  56. Transform transform = CMT.SearchObjName(t, "Ear_L", false);
  57. bool flag = transform != null;
  58. if (flag)
  59. {
  60. this.m_listBoneMorphPos.RemoveAll((BoneMorph_.BoneMorphPos f) => f.strPropName == "MayuY");
  61. if (this.m_tbSkin.PartsVersion < 120)
  62. {
  63. HashSet<string> gp001AddPropNames = new HashSet<string>(new string[]
  64. {
  65. "MayuLongL",
  66. "MayuLongR"
  67. });
  68. this.m_listBoneMorphPos.RemoveAll((BoneMorph_.BoneMorphPos f) => gp001AddPropNames.Contains(f.strPropName));
  69. this.m_listBoneMorphRot.RemoveAll((BoneMorph_.BoneMorphRotatio f) => gp001AddPropNames.Contains(f.strPropName));
  70. this.m_listBoneMorphScl.RemoveAll((BoneMorph_.BoneMorphScl f) => gp001AddPropNames.Contains(f.strPropName));
  71. }
  72. }
  73. else
  74. {
  75. HashSet<string> gp001AddPropNames = new HashSet<string>(new string[]
  76. {
  77. "Earrot_L",
  78. "Earrot_R",
  79. "Earscl_L",
  80. "Earscl_R",
  81. "Nosepos",
  82. "Nosescl",
  83. "Mayupos_L",
  84. "Mayupos_R",
  85. "Mayurot_L",
  86. "Mayurot_R",
  87. "MayuLongL",
  88. "MayuLongR"
  89. });
  90. this.m_listBoneMorphPos.RemoveAll((BoneMorph_.BoneMorphPos f) => gp001AddPropNames.Contains(f.strPropName));
  91. this.m_listBoneMorphRot.RemoveAll((BoneMorph_.BoneMorphRotatio f) => gp001AddPropNames.Contains(f.strPropName));
  92. this.m_listBoneMorphScl.RemoveAll((BoneMorph_.BoneMorphScl f) => gp001AddPropNames.Contains(f.strPropName));
  93. }
  94. if (transform != null)
  95. {
  96. func2("Earrot_L", transform);
  97. func3("Earscl_L", transform);
  98. }
  99. Transform transform2 = CMT.SearchObjName(t, "Ear_R", false);
  100. if (transform2 != null)
  101. {
  102. func2("Earrot_R", transform2);
  103. func3("Earscl_R", transform2);
  104. }
  105. Transform transform3 = CMT.SearchObjName(t, "Nose", false);
  106. if (transform3 != null)
  107. {
  108. func("Nosepos", transform3);
  109. func3("Nosescl", transform3);
  110. }
  111. Transform transform4 = CMT.SearchObjName(t, "Mayupos", false);
  112. if (transform4 != null)
  113. {
  114. func("MayuY", transform4);
  115. }
  116. Transform transform5 = CMT.SearchObjName(t, "Mayupos_L", false);
  117. if (transform5 != null)
  118. {
  119. func("Mayupos_L", transform5);
  120. func2("Mayurot_L", transform5);
  121. }
  122. Transform transform6 = CMT.SearchObjName(t, "Mayupos_R", false);
  123. if (transform6 != null)
  124. {
  125. func("Mayupos_R", transform6);
  126. func2("Mayurot_R", transform6);
  127. }
  128. Transform transform7 = CMT.SearchObjName(t, "Eye_L", false);
  129. if (transform7 != null)
  130. {
  131. func("EyeBallPosXL", transform7);
  132. BoneMorph_.BoneMorphPos boneMorphPos = func("EyeBallPosYL", transform7);
  133. boneMorphPos.m_vAddMin += new Vector3(0.00325f, -0.005f, 0f);
  134. boneMorphPos.m_vAddMax += new Vector3(0f, 0.004f, 0f);
  135. BoneMorph_.BoneMorphScl boneMorphScl = func3("EyeBallSclXL", transform7);
  136. boneMorphScl.m_vAddMin += new Vector3(0f, -0.3f, -0.3f);
  137. boneMorphScl.m_vAddMax += new Vector3(0f, 0.1f, 0.1f);
  138. boneMorphScl = func3("EyeBallSclYL", transform7);
  139. boneMorphScl.m_vAddMin += new Vector3(0f, -0.3f, -0.3f);
  140. boneMorphScl.m_vAddMax += new Vector3(0f, 0.1f, 0.1f);
  141. }
  142. Transform transform8 = CMT.SearchObjName(t, "Eye_R", false);
  143. if (transform8 != null)
  144. {
  145. func("EyeBallPosXR", transform8);
  146. BoneMorph_.BoneMorphPos boneMorphPos2 = func("EyeBallPosYR", transform8);
  147. boneMorphPos2.m_vAddMin += new Vector3(0.00325f, 0.005f, 0f);
  148. boneMorphPos2.m_vAddMax += new Vector3(0f, -0.004f, 0f);
  149. BoneMorph_.BoneMorphScl boneMorphScl2 = func3("EyeBallSclXR", transform8);
  150. boneMorphScl2.m_vAddMin += new Vector3(0f, -0.3f, -0.3f);
  151. boneMorphScl2.m_vAddMax += new Vector3(0f, 0.1f, 0.1f);
  152. boneMorphScl2 = func3("EyeBallSclYR", transform8);
  153. boneMorphScl2.m_vAddMin += new Vector3(0f, -0.3f, -0.3f);
  154. boneMorphScl2.m_vAddMax += new Vector3(0f, 0.1f, 0.1f);
  155. }
  156. if (120 <= tbskin.PartsVersion)
  157. {
  158. Transform transform9 = CMT.SearchObjName(t, "Mayupos_L", false);
  159. Transform transform10 = CMT.SearchObjName(t, "Mayupos_R", false);
  160. if (transform9 != null && transform10 != null)
  161. {
  162. BoneMorph_.BoneMorphScl boneMorphScl3 = func3("MayuLongL", transform9);
  163. boneMorphScl3.m_vAddMin += new Vector3(0f, 0f, -0.25f);
  164. boneMorphScl3.m_vAddMax += new Vector3(0f, 0f, 0.25f);
  165. BoneMorph_.BoneMorphScl boneMorphScl4 = func3("MayuLongR", transform10);
  166. boneMorphScl4.m_vAddMin += new Vector3(0f, 0f, -0.25f);
  167. boneMorphScl4.m_vAddMax += new Vector3(0f, 0f, 0.25f);
  168. }
  169. }
  170. }
  171. }
  172. public void DelBoneMorphEdit(MPN f_mpn, TBody.SlotID f_slot)
  173. {
  174. if (f_mpn == MPN.head && f_slot == TBody.SlotID.head)
  175. {
  176. HashSet<string> removeTargetPropNames = new HashSet<string>(new string[]
  177. {
  178. "Earrot_L",
  179. "Earrot_R",
  180. "Earscl_L",
  181. "Earscl_R",
  182. "Nosepos",
  183. "Nosescl",
  184. "MayuY",
  185. "Mayupos_L",
  186. "Mayupos_R",
  187. "Mayurot_L",
  188. "Mayurot_R",
  189. "EyeBallPosXL",
  190. "EyeBallPosYL",
  191. "EyeBallSclXL",
  192. "EyeBallSclXR",
  193. "EyeBallPosXR",
  194. "EyeBallPosYR",
  195. "EyeBallSclYL",
  196. "EyeBallSclYR",
  197. "MayuLongL",
  198. "MayuLongR"
  199. });
  200. this.m_listBoneMorphPos.RemoveAll((BoneMorph_.BoneMorphPos f) => removeTargetPropNames.Contains(f.strPropName));
  201. this.m_listBoneMorphRot.RemoveAll((BoneMorph_.BoneMorphRotatio f) => removeTargetPropNames.Contains(f.strPropName));
  202. this.m_listBoneMorphScl.RemoveAll((BoneMorph_.BoneMorphScl f) => removeTargetPropNames.Contains(f.strPropName));
  203. }
  204. }
  205. private void AddRoot_lp(Transform t, int level = 0, float Kahanshin = 0f)
  206. {
  207. string name = t.name;
  208. if (name.Contains("Thigh"))
  209. {
  210. Kahanshin = 1f;
  211. }
  212. BoneMorphLocal boneMorphLocal = null;
  213. List<BoneMorph.BoneProp> list = null;
  214. if (BoneMorph.dic2.TryGetValue(name, out list))
  215. {
  216. for (int i = 0; i < list.Count; i++)
  217. {
  218. BoneMorph.BoneProp boneProp = list[i];
  219. if (boneMorphLocal == null)
  220. {
  221. boneMorphLocal = new BoneMorphLocal();
  222. boneMorphLocal.atr = 0L;
  223. boneMorphLocal.linkT = t;
  224. boneMorphLocal.pos = t.localPosition;
  225. boneMorphLocal.Kahanshin = Kahanshin;
  226. }
  227. int nIndex = boneProp.nIndex;
  228. if (boneProp.bExistM)
  229. {
  230. boneMorphLocal.atr |= 1L << nIndex;
  231. boneMorphLocal.vecs_min[nIndex] = boneProp.vMinM;
  232. boneMorphLocal.vecs_max[nIndex] = boneProp.vMaxM;
  233. }
  234. if (boneProp.bExistP)
  235. {
  236. boneMorphLocal.atr |= 1L << nIndex + 32;
  237. boneMorphLocal.vecs_min[nIndex + 32] = boneProp.vMinP;
  238. boneMorphLocal.vecs_max[nIndex + 32] = boneProp.vMaxP;
  239. }
  240. boneMorphLocal.props.Add(boneProp.strProp);
  241. }
  242. }
  243. if (boneMorphLocal != null)
  244. {
  245. this.bones.Add(boneMorphLocal);
  246. }
  247. for (int j = 0; j < t.childCount; j++)
  248. {
  249. this.AddRoot_lp(t.GetChild(j), level + 1, Kahanshin);
  250. }
  251. }
  252. public void AddRoot(Transform root)
  253. {
  254. this.AddRoot_lp(root, 0, 0f);
  255. }
  256. public void ChangeMorphPosValue(string strPropName, string f_strBoneName, Vector3 f_fAddMin, Vector3 f_fAddMax)
  257. {
  258. BoneMorph_.BoneMorphPos boneMorphPos = this.m_listBoneMorphPos.Find((BoneMorph_.BoneMorphPos f) => f.strPropName == strPropName && f.trBone.name == f_strBoneName);
  259. if (boneMorphPos != null)
  260. {
  261. boneMorphPos.m_vAddMin = boneMorphPos.trBone.localPosition + f_fAddMin;
  262. boneMorphPos.m_vAddMax = boneMorphPos.trBone.localPosition + f_fAddMax;
  263. }
  264. }
  265. public void ChangeMorphSclValue(string strPropName, string f_strBoneName, Vector3 f_fAddMin, Vector3 f_fAddMax)
  266. {
  267. BoneMorph_.BoneMorphScl boneMorphScl = this.m_listBoneMorphScl.Find((BoneMorph_.BoneMorphScl f) => f.strPropName == strPropName && f.trBone.name == f_strBoneName);
  268. if (boneMorphScl != null)
  269. {
  270. boneMorphScl.m_vAddMin = boneMorphScl.trBone.localScale + f_fAddMin;
  271. boneMorphScl.m_vAddMax = boneMorphScl.trBone.localScale + f_fAddMax;
  272. }
  273. }
  274. public void ChangeMorphRotatioValue(string strPropName, string f_strBoneName, Vector3 f_fAddMin, Vector3 f_fAddMax)
  275. {
  276. BoneMorph_.BoneMorphRotatio boneMorphRotatio = this.m_listBoneMorphRot.Find((BoneMorph_.BoneMorphRotatio f) => f.strPropName == strPropName && f.trBone.name == f_strBoneName);
  277. if (boneMorphRotatio != null)
  278. {
  279. boneMorphRotatio.m_vAddMin = boneMorphRotatio.m_vDefRotate * Quaternion.Euler(f_fAddMin);
  280. boneMorphRotatio.m_vAddMax = boneMorphRotatio.m_vDefRotate * Quaternion.Euler(f_fAddMax);
  281. }
  282. }
  283. public void Blend()
  284. {
  285. for (int i = this.bones.Count - 1; i >= 0; i--)
  286. {
  287. BoneMorphLocal boneMorphLocal = this.bones[i];
  288. Vector3 vector = new Vector3(1f, 1f, 1f);
  289. Vector3 vector2 = boneMorphLocal.pos;
  290. for (int j = 0; j < BoneMorph.PropNames.Length; j++)
  291. {
  292. float num = 1f;
  293. if (j == 0)
  294. {
  295. num = this.SCALE_Kubi;
  296. }
  297. if (j == 1)
  298. {
  299. num = this.SCALE_Ude;
  300. }
  301. if (j == 2)
  302. {
  303. num = this.SCALE_EyeX;
  304. }
  305. if (j == 3)
  306. {
  307. num = this.SCALE_EyeY;
  308. }
  309. if (j == 4)
  310. {
  311. num = this.Postion_EyeX * (0.5f + this.Postion_EyeY * 0.5f);
  312. }
  313. if (j == 5)
  314. {
  315. num = this.Postion_EyeY;
  316. }
  317. if (j == 6)
  318. {
  319. num = this.SCALE_HeadX;
  320. }
  321. if (j == 7)
  322. {
  323. num = this.SCALE_HeadY;
  324. }
  325. if (j == 8)
  326. {
  327. num = this.SCALE_DouPer;
  328. if (boneMorphLocal.Kahanshin == 0f)
  329. {
  330. num = 1f - num;
  331. }
  332. }
  333. if (j == 9)
  334. {
  335. num = this.SCALE_Sintyou;
  336. }
  337. if (j == 10)
  338. {
  339. num = this.SCALE_Koshi;
  340. }
  341. if (j == 11)
  342. {
  343. num = this.SCALE_Kata;
  344. }
  345. if (j == 12)
  346. {
  347. num = this.SCALE_West;
  348. }
  349. if ((boneMorphLocal.atr & 1L << j) != 0L)
  350. {
  351. vector = Vector3.Scale(vector, Vector3.Lerp(boneMorphLocal.vecs_min[j], boneMorphLocal.vecs_max[j], num));
  352. }
  353. if ((boneMorphLocal.atr & 1L << 32 + j) != 0L)
  354. {
  355. vector2 = Vector3.Scale(vector2, Vector3.Lerp(boneMorphLocal.vecs_min[j + 32], boneMorphLocal.vecs_max[j + 32], num));
  356. }
  357. }
  358. if (boneMorphLocal.linkT.name.Contains("Thigh_SCL_"))
  359. {
  360. this.SnityouOutScale = Mathf.Pow(vector.x, 0.9f);
  361. }
  362. boneMorphLocal.linkT.localPosition = vector2;
  363. boneMorphLocal.linkT.localScale = vector;
  364. }
  365. for (int k = 0; k < this.m_listBoneMorphPos.Count; k++)
  366. {
  367. BoneMorph_.BoneMorphPos boneMorphPos = this.m_listBoneMorphPos[k];
  368. if (boneMorphPos.strPropName == "Nosepos")
  369. {
  370. boneMorphPos.trBone.localPosition = boneMorphPos.Lerp(this.POS_Nose);
  371. }
  372. else if (boneMorphPos.strPropName == "MayuY")
  373. {
  374. boneMorphPos.trBone.localPosition = boneMorphPos.Lerp(this.POS_MayuY);
  375. }
  376. else if (boneMorphPos.strPropName == "Mayupos_L" || boneMorphPos.strPropName == "Mayupos_R")
  377. {
  378. Vector3 vector3 = boneMorphPos.Lerp(this.POS_MayuY);
  379. float x = boneMorphPos.m_vAddMin.x;
  380. boneMorphPos.m_vAddMin = new Vector3(boneMorphPos.m_vAddMax.x, boneMorphPos.m_vAddMin.y, boneMorphPos.m_vAddMin.z);
  381. boneMorphPos.m_vAddMax = new Vector3(x, boneMorphPos.m_vAddMax.y, boneMorphPos.m_vAddMax.z);
  382. Vector3 vector4 = boneMorphPos.Lerp(this.POS_MayuX);
  383. x = boneMorphPos.m_vAddMax.x;
  384. boneMorphPos.m_vAddMax = new Vector3(boneMorphPos.m_vAddMin.x, boneMorphPos.m_vAddMax.y, boneMorphPos.m_vAddMax.z);
  385. boneMorphPos.m_vAddMin = new Vector3(x, boneMorphPos.m_vAddMin.y, boneMorphPos.m_vAddMin.z);
  386. float x2 = vector4.x + vector3.x - boneMorphPos.m_vDefPos.x;
  387. boneMorphPos.trBone.localPosition = new Vector3(x2, vector3.y, vector4.z);
  388. }
  389. else if (boneMorphPos.strPropName == "EyeBallPosYL" || boneMorphPos.strPropName == "EyeBallPosYR")
  390. {
  391. boneMorphPos.trBone.localPosition = ((this.EyeBallPosY > 0.5f) ? Vector3.Lerp(boneMorphPos.m_vDefPos, boneMorphPos.m_vAddMax, (this.EyeBallPosY - 0.5f) / 0.5f) : Vector3.Lerp(boneMorphPos.m_vAddMin, boneMorphPos.m_vDefPos, this.EyeBallPosY / 0.5f));
  392. }
  393. }
  394. for (int l = 0; l < this.m_listBoneMorphScl.Count; l++)
  395. {
  396. BoneMorph_.BoneMorphScl boneMorphScl = this.m_listBoneMorphScl[l];
  397. if (boneMorphScl.strPropName == "Earscl_L" || boneMorphScl.strPropName == "Earscl_R")
  398. {
  399. boneMorphScl.trBone.localScale = boneMorphScl.Lerp(this.SCALE_Ear);
  400. }
  401. else if (boneMorphScl.strPropName == "Nosescl")
  402. {
  403. boneMorphScl.trBone.localScale = boneMorphScl.Lerp(this.SCALE_Nose);
  404. }
  405. else if (boneMorphScl.strPropName == "EyeBallSclXL" || boneMorphScl.strPropName == "EyeBallSclXR")
  406. {
  407. float z = (this.EyeBallSclX >= 0.5f) ? Mathf.Lerp(boneMorphScl.m_vDefScl.z, boneMorphScl.m_vAddMax.z, (this.EyeBallSclX - 0.5f) / 0.5f) : Mathf.Lerp(boneMorphScl.m_vAddMin.z, boneMorphScl.m_vDefScl.z, this.EyeBallSclX / 0.5f);
  408. Vector3 localScale = boneMorphScl.trBone.localScale;
  409. localScale.z = z;
  410. boneMorphScl.trBone.localScale = localScale;
  411. }
  412. else if (boneMorphScl.strPropName == "EyeBallSclYL" || boneMorphScl.strPropName == "EyeBallSclYR")
  413. {
  414. float y = (this.EyeBallSclY >= 0.5f) ? Mathf.Lerp(boneMorphScl.m_vDefScl.y, boneMorphScl.m_vAddMax.y, (this.EyeBallSclY - 0.5f) / 0.5f) : Mathf.Lerp(boneMorphScl.m_vAddMin.y, boneMorphScl.m_vDefScl.y, this.EyeBallSclY / 0.5f);
  415. Vector3 localScale2 = boneMorphScl.trBone.localScale;
  416. localScale2.y = y;
  417. boneMorphScl.trBone.localScale = localScale2;
  418. }
  419. else if (boneMorphScl.strPropName == "MayuLongL" || boneMorphScl.strPropName == "MayuLongR")
  420. {
  421. boneMorphScl.trBone.localScale = boneMorphScl.Lerp(this.MayuLong);
  422. }
  423. }
  424. foreach (BoneMorph_.BoneMorphRotatio boneMorphRotatio in this.m_listBoneMorphRot)
  425. {
  426. if (boneMorphRotatio.strPropName == "Earrot_L" || boneMorphRotatio.strPropName == "Earrot_R")
  427. {
  428. boneMorphRotatio.trBone.localRotation = boneMorphRotatio.Lerp(this.ROT_Ear);
  429. }
  430. if (boneMorphRotatio.strPropName == "Mayurot_L" || boneMorphRotatio.strPropName == "Mayurot_R")
  431. {
  432. boneMorphRotatio.trBone.localRotation = boneMorphRotatio.Lerp(this.ROT_Mayu);
  433. }
  434. }
  435. if (this.Yorime <= 0.5f)
  436. {
  437. this.m_tbSkin.body.m_editYorime = 2f * ((this.Yorime - 0.5f) / 0.5f);
  438. }
  439. else
  440. {
  441. this.m_tbSkin.body.m_editYorime = 5f * ((this.Yorime - 0.5f) / 0.5f);
  442. }
  443. }
  444. private TextAsset textUserDef1;
  445. public float SCALE_Sintyou = 1f;
  446. public float SCALE_Koshi = 1f;
  447. public float SCALE_DouPer;
  448. public float SCALE_Kata = 1f;
  449. public float SCALE_West = 1f;
  450. public float SCALE_EyeX = 1f;
  451. public float SCALE_EyeY = 1f;
  452. public float Postion_EyeX = 1f;
  453. public float Postion_EyeY = 1f;
  454. public float EyeBallPosX = 0.5f;
  455. public float EyeBallPosY = 0.5f;
  456. public float EyeBallSclX = 0.5f;
  457. public float EyeBallSclY = 0.5f;
  458. public float SCALE_Kubi = 1f;
  459. public float SCALE_Ude = 1f;
  460. public float SCALE_HeadX = 1f;
  461. public float SCALE_HeadY = 1f;
  462. public float POS_Nose = 0.5f;
  463. public float SCALE_Nose = 0.5f;
  464. public float ROT_Ear = 0.5f;
  465. public float SCALE_Ear = 0.5f;
  466. public float POS_MayuX = 0.5f;
  467. public float POS_MayuY = 0.5f;
  468. public float ROT_Mayu = 0.5f;
  469. public List<BoneMorphLocal> bones;
  470. public float SnityouOutScale = 1f;
  471. private bool m_bMayuOffs;
  472. public float MayuLong = 0.5f;
  473. public float Yorime = 0.5f;
  474. private List<BoneMorph_.BoneMorphPos> m_listBoneMorphPos = new List<BoneMorph_.BoneMorphPos>();
  475. private List<BoneMorph_.BoneMorphScl> m_listBoneMorphScl = new List<BoneMorph_.BoneMorphScl>();
  476. private List<BoneMorph_.BoneMorphRotatio> m_listBoneMorphRot = new List<BoneMorph_.BoneMorphRotatio>();
  477. private TBodySkin m_tbSkin;
  478. private static StringBuilder sbMinM = new StringBuilder(32);
  479. private static StringBuilder sbMinP = new StringBuilder(32);
  480. private static StringBuilder sbMaxM = new StringBuilder(32);
  481. private static StringBuilder sbMaxP = new StringBuilder(32);
  482. private class BoneMorphPos
  483. {
  484. public BoneMorphPos(string f_strPropName, Transform f_trBone)
  485. {
  486. this.strPropName = f_strPropName;
  487. this.trBone = f_trBone;
  488. this.m_vAddMin = (this.m_vAddMax = (this.m_vDefPos = f_trBone.localPosition));
  489. }
  490. public BoneMorphPos(string f_strPropName, Transform f_trBone, Vector3 f_vAddMin, Vector3 f_vAddMax)
  491. {
  492. this.strPropName = f_strPropName;
  493. this.trBone = f_trBone;
  494. this.m_vDefPos = f_trBone.localPosition;
  495. this.m_vAddMin = this.m_vDefPos + f_vAddMin;
  496. this.m_vAddMax = this.m_vDefPos + f_vAddMax;
  497. }
  498. public Vector3 Lerp(float t)
  499. {
  500. return BoneMorph_.BoneMorphPos.Lerp(this.m_vAddMin, this.m_vDefPos, this.m_vAddMax, t);
  501. }
  502. public static Vector3 Lerp(Vector3 min, Vector3 def, Vector3 max, float t)
  503. {
  504. float t2 = (t > 0.5f) ? ((t - 0.5f) / 0.5f) : (t / 0.5f);
  505. return (t > 0.5f) ? Vector3.Lerp(def, max, t2) : Vector3.Lerp(min, def, t2);
  506. }
  507. public static float Lerp(float min, float def, float max, float t)
  508. {
  509. float t2 = (t > 0.5f) ? ((t - 0.5f) / 0.5f) : (t / 0.5f);
  510. return (t > 0.5f) ? Mathf.Lerp(def, max, t2) : Mathf.Lerp(min, def, t2);
  511. }
  512. public string strPropName;
  513. public Transform trBone;
  514. public Vector3 m_vDefPos;
  515. public Vector3 m_vAddMin;
  516. public Vector3 m_vAddMax;
  517. }
  518. private class BoneMorphScl
  519. {
  520. public BoneMorphScl(string f_strPropName, Transform f_trBone)
  521. {
  522. this.strPropName = f_strPropName;
  523. this.trBone = f_trBone;
  524. this.m_vAddMin = (this.m_vAddMax = (this.m_vDefScl = f_trBone.localScale));
  525. }
  526. public BoneMorphScl(string f_strPropName, Transform f_trBone, Vector3 f_vAddMin, Vector3 f_vAddMax)
  527. {
  528. this.strPropName = f_strPropName;
  529. this.trBone = f_trBone;
  530. this.m_vDefScl = f_trBone.localScale;
  531. this.m_vAddMin = this.m_vDefScl + f_vAddMin;
  532. this.m_vAddMax = this.m_vDefScl + f_vAddMax;
  533. }
  534. public Vector3 Lerp(float t)
  535. {
  536. return BoneMorph_.BoneMorphPos.Lerp(this.m_vAddMin, this.m_vDefScl, this.m_vAddMax, t);
  537. }
  538. public string strPropName;
  539. public Transform trBone;
  540. public Vector3 m_vDefScl;
  541. public Vector3 m_vAddMin;
  542. public Vector3 m_vAddMax;
  543. }
  544. private class BoneMorphRotatio
  545. {
  546. public BoneMorphRotatio(string f_strPropName, Transform f_trBone)
  547. {
  548. this.strPropName = f_strPropName;
  549. this.trBone = f_trBone;
  550. this.m_vAddMin = (this.m_vAddMax = (this.m_vDefRotate = f_trBone.localRotation));
  551. }
  552. public BoneMorphRotatio(string f_strPropName, Transform f_trBone, Quaternion f_vAddMin, Quaternion f_vAddMax)
  553. {
  554. this.strPropName = f_strPropName;
  555. this.trBone = f_trBone;
  556. this.m_vDefRotate = f_trBone.localRotation;
  557. this.m_vAddMin = this.m_vDefRotate * f_vAddMin;
  558. this.m_vAddMax = this.m_vDefRotate * f_vAddMax;
  559. }
  560. public Quaternion Lerp(float t)
  561. {
  562. return BoneMorph_.BoneMorphRotatio.Lerp(this.m_vAddMin, this.m_vDefRotate, this.m_vAddMax, t);
  563. }
  564. public static Quaternion Lerp(Quaternion min, Quaternion def, Quaternion max, float t)
  565. {
  566. float t2 = (t > 0.5f) ? ((t - 0.5f) / 0.5f) : (t / 0.5f);
  567. return (t > 0.5f) ? Quaternion.Lerp(def, max, t2) : Quaternion.Lerp(min, def, t2);
  568. }
  569. public string strPropName;
  570. public Transform trBone;
  571. public Quaternion m_vDefRotate;
  572. public Quaternion m_vAddMin;
  573. public Quaternion m_vAddMax;
  574. }
  575. }