BoneMorph_.cs 21 KB

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