MeidoDragPointManager.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace COM3D2.MeidoPhotoStudio.Plugin
  5. {
  6. internal enum AttachPoint
  7. {
  8. None, Head, Neck, UpperArmL, UpperArmR, ForearmL, ForearmR, MuneL, MuneR, HandL, HandR,
  9. Pelvis, ThighL, ThighR, CalfL, CalfR, FootL, FootR
  10. }
  11. internal class MeidoDragPointManager
  12. {
  13. private enum Bone
  14. {
  15. Head, HeadNub, ClavicleL, ClavicleR,
  16. UpperArmL, UpperArmR, ForearmL, ForearmR,
  17. HandL, HandR, IKHandL, IKHandR,
  18. MuneL, MuneSubL, MuneR, MuneSubR,
  19. Neck, Spine, Spine0a, Spine1, Spine1a, ThighL, ThighR,
  20. Pelvis, Hip,
  21. CalfL, CalfR, FootL, FootR,
  22. // Dragpoint specific
  23. Cube, Body, Torso,
  24. // Fingers
  25. Finger0L, Finger01L, Finger02L, Finger0NubL,
  26. Finger1L, Finger11L, Finger12L, Finger1NubL,
  27. Finger2L, Finger21L, Finger22L, Finger2NubL,
  28. Finger3L, Finger31L, Finger32L, Finger3NubL,
  29. Finger4L, Finger41L, Finger42L, Finger4NubL,
  30. Finger0R, Finger01R, Finger02R, Finger0NubR,
  31. Finger1R, Finger11R, Finger12R, Finger1NubR,
  32. Finger2R, Finger21R, Finger22R, Finger2NubR,
  33. Finger3R, Finger31R, Finger32R, Finger3NubR,
  34. Finger4R, Finger41R, Finger42R, Finger4NubR,
  35. // Toes
  36. Toe0L, Toe01L, Toe0NubL,
  37. Toe1L, Toe11L, Toe1NubL,
  38. Toe2L, Toe21L, Toe2NubL,
  39. Toe0R, Toe01R, Toe0NubR,
  40. Toe1R, Toe11R, Toe1NubR,
  41. Toe2R, Toe21R, Toe2NubR
  42. }
  43. private static readonly Dictionary<AttachPoint, Bone> PointToBone = new Dictionary<AttachPoint, Bone>()
  44. {
  45. [AttachPoint.Head] = Bone.Head,
  46. [AttachPoint.Neck] = Bone.HeadNub,
  47. [AttachPoint.UpperArmL] = Bone.UpperArmL,
  48. [AttachPoint.UpperArmR] = Bone.UpperArmR,
  49. [AttachPoint.ForearmL] = Bone.ForearmL,
  50. [AttachPoint.ForearmR] = Bone.ForearmR,
  51. [AttachPoint.MuneL] = Bone.MuneL,
  52. [AttachPoint.MuneR] = Bone.MuneR,
  53. [AttachPoint.HandL] = Bone.HandL,
  54. [AttachPoint.HandR] = Bone.HandR,
  55. [AttachPoint.Pelvis] = Bone.Pelvis,
  56. [AttachPoint.ThighL] = Bone.ThighL,
  57. [AttachPoint.ThighR] = Bone.ThighR,
  58. [AttachPoint.CalfL] = Bone.CalfL,
  59. [AttachPoint.CalfR] = Bone.CalfR,
  60. [AttachPoint.FootL] = Bone.FootL,
  61. [AttachPoint.FootR] = Bone.FootR,
  62. };
  63. private static bool cubeActive;
  64. public static bool CubeActive
  65. {
  66. get => cubeActive;
  67. set
  68. {
  69. if (value != cubeActive)
  70. {
  71. cubeActive = value;
  72. CubeActiveChange?.Invoke(null, EventArgs.Empty);
  73. }
  74. }
  75. }
  76. private static bool cubeSmall = false;
  77. public static bool CubeSmall
  78. {
  79. get => cubeSmall;
  80. set
  81. {
  82. if (value != cubeSmall)
  83. {
  84. cubeSmall = value;
  85. CubeSmallChange?.Invoke(null, EventArgs.Empty);
  86. }
  87. }
  88. }
  89. private static EventHandler CubeActiveChange;
  90. private static EventHandler CubeSmallChange;
  91. private Meido meido;
  92. private Maid maid;
  93. private Dictionary<Bone, Transform> BoneTransform;
  94. private Dictionary<Bone, DragPointMeido> DragPoints;
  95. private DragPointBody dragBody;
  96. private DragPointBody dragCube;
  97. public event EventHandler<MeidoUpdateEventArgs> SelectMaid;
  98. private bool isBone = false;
  99. public bool IsBone
  100. {
  101. get => isBone;
  102. set
  103. {
  104. if (isBone != value)
  105. {
  106. isBone = value;
  107. foreach (DragPointMeido dragPoint in DragPoints.Values)
  108. {
  109. dragPoint.IsBone = isBone;
  110. }
  111. }
  112. }
  113. }
  114. private bool active = true;
  115. public bool Active
  116. {
  117. get => active;
  118. set
  119. {
  120. if (active != value)
  121. {
  122. active = value;
  123. foreach (DragPointMeido dragPoint in DragPoints.Values)
  124. {
  125. dragPoint.gameObject.SetActive(active);
  126. }
  127. DragPointHead head = (DragPointHead)DragPoints[Bone.Head];
  128. head.gameObject.SetActive(true);
  129. head.IsIK = !active;
  130. }
  131. }
  132. }
  133. public MeidoDragPointManager(Meido meido)
  134. {
  135. this.meido = meido;
  136. this.maid = meido.Maid;
  137. this.meido.BodyLoad += Initialize;
  138. }
  139. public Transform GetAttachPointTransform(AttachPoint point)
  140. {
  141. if (point == AttachPoint.None) return null;
  142. return BoneTransform[PointToBone[point]];
  143. }
  144. public void Destroy()
  145. {
  146. foreach (DragPointMeido dragPoint in DragPoints.Values)
  147. {
  148. GameObject.Destroy(dragPoint.gameObject);
  149. }
  150. GameObject.Destroy(dragCube.gameObject);
  151. GameObject.Destroy(dragBody.gameObject);
  152. BoneTransform.Clear();
  153. DragPoints.Clear();
  154. CubeActiveChange -= OnCubeActive;
  155. CubeSmallChange -= OnCubeSmall;
  156. }
  157. private void Initialize(object sender, EventArgs args)
  158. {
  159. meido.BodyLoad -= Initialize;
  160. CubeActiveChange += OnCubeActive;
  161. CubeSmallChange += OnCubeSmall;
  162. InitializeBones();
  163. InitializeDragPoints();
  164. }
  165. private void InitializeDragPoints()
  166. {
  167. DragPoints = new Dictionary<Bone, DragPointMeido>();
  168. dragCube = DragPoint.Make<DragPointBody>(
  169. PrimitiveType.Cube, Vector3.one * 0.12f, DragPoint.Blue
  170. );
  171. dragCube.Initialize(() => maid.transform.position, () => Vector3.zero);
  172. dragCube.Set(maid.transform);
  173. dragCube.IsCube = true;
  174. dragCube.ConstantScale = true;
  175. dragCube.Select += OnSelectBody;
  176. dragCube.EndScale += OnSetDragPointScale;
  177. dragCube.gameObject.SetActive(CubeActive);
  178. dragBody = DragPoint.Make<DragPointBody>(
  179. PrimitiveType.Capsule, new Vector3(0.2f, 0.3f, 0.24f), DragPoint.LightBlue
  180. );
  181. dragBody.Initialize(
  182. () => new Vector3(
  183. (BoneTransform[Bone.Hip].position.x + BoneTransform[Bone.Spine0a].position.x) / 2f,
  184. (BoneTransform[Bone.Spine1].position.y + BoneTransform[Bone.Spine0a].position.y) / 2f,
  185. (BoneTransform[Bone.Spine0a].position.z + BoneTransform[Bone.Hip].position.z) / 2f
  186. ),
  187. () => new Vector3(
  188. BoneTransform[Bone.Spine0a].eulerAngles.x,
  189. BoneTransform[Bone.Spine0a].eulerAngles.y,
  190. BoneTransform[Bone.Spine0a].eulerAngles.z + 90f
  191. )
  192. );
  193. dragBody.Set(maid.transform);
  194. dragBody.Select += OnSelectBody;
  195. dragBody.EndScale += OnSetDragPointScale;
  196. // Head Dragpoint
  197. DragPointHead dragHead = DragPoint.Make<DragPointHead>(
  198. PrimitiveType.Sphere, new Vector3(0.2f, 0.24f, 0.2f), DragPoint.LightBlue
  199. );
  200. dragHead.Initialize(meido,
  201. () => new Vector3(
  202. BoneTransform[Bone.Head].position.x,
  203. (BoneTransform[Bone.Head].position.y * 1.2f + BoneTransform[Bone.HeadNub].position.y * 0.8f) / 2f,
  204. BoneTransform[Bone.Head].position.z
  205. ),
  206. () => new Vector3(
  207. BoneTransform[Bone.Head].eulerAngles.x,
  208. BoneTransform[Bone.Head].eulerAngles.y,
  209. BoneTransform[Bone.Head].eulerAngles.z + 90f
  210. )
  211. );
  212. dragHead.Set(BoneTransform[Bone.Neck]);
  213. dragHead.Select += OnSelectFace;
  214. DragPoints[Bone.Head] = dragHead;
  215. // Torso Dragpoint
  216. Transform spineTrans1 = BoneTransform[Bone.Spine1];
  217. Transform spineTrans2 = BoneTransform[Bone.Spine1a];
  218. DragPointTorso dragTorso = DragPoint.Make<DragPointTorso>(
  219. PrimitiveType.Capsule, new Vector3(0.2f, 0.19f, 0.24f), DragPoint.LightBlue
  220. );
  221. dragTorso.Initialize(meido,
  222. () => new Vector3(
  223. spineTrans1.position.x,
  224. spineTrans2.position.y,
  225. spineTrans1.position.z - 0.05f
  226. ),
  227. () => new Vector3(
  228. spineTrans1.eulerAngles.x,
  229. spineTrans1.eulerAngles.y,
  230. spineTrans1.eulerAngles.z + 90f
  231. )
  232. );
  233. dragTorso.Set(BoneTransform[Bone.Spine1a]);
  234. DragPoints[Bone.Torso] = dragTorso;
  235. // Pelvis Dragpoint
  236. Transform pelvisTrans = BoneTransform[Bone.Pelvis];
  237. Transform spineTrans = BoneTransform[Bone.Spine];
  238. DragPointPelvis dragPelvis = DragPoint.Make<DragPointPelvis>(
  239. PrimitiveType.Capsule, new Vector3(0.2f, 0.15f, 0.24f), DragPoint.LightBlue
  240. );
  241. dragPelvis.Initialize(meido,
  242. () => new Vector3(
  243. pelvisTrans.position.x,
  244. (pelvisTrans.position.y + spineTrans.position.y) / 2f,
  245. pelvisTrans.position.z
  246. ),
  247. () => new Vector3(
  248. pelvisTrans.eulerAngles.x + 90f,
  249. pelvisTrans.eulerAngles.y + 90f,
  250. pelvisTrans.eulerAngles.z
  251. )
  252. );
  253. dragPelvis.Set(BoneTransform[Bone.Pelvis]);
  254. DragPoints[Bone.Pelvis] = dragPelvis;
  255. InitializeMuneDragPoint(left: true);
  256. InitializeMuneDragPoint(left: false);
  257. DragPointChain[] armDragPointL = MakeIKChain(BoneTransform[Bone.HandL]);
  258. DragPoints[Bone.UpperArmL] = armDragPointL[0];
  259. DragPoints[Bone.ForearmL] = armDragPointL[1];
  260. DragPoints[Bone.HandL] = armDragPointL[2];
  261. DragPointChain[] armDragPointR = MakeIKChain(BoneTransform[Bone.HandR]);
  262. DragPoints[Bone.UpperArmR] = armDragPointR[0];
  263. DragPoints[Bone.ForearmR] = armDragPointR[1];
  264. DragPoints[Bone.HandR] = armDragPointR[2];
  265. DragPointChain[] legDragPointL = MakeIKChain(BoneTransform[Bone.FootL]);
  266. DragPoints[Bone.CalfL] = legDragPointL[0];
  267. DragPoints[Bone.FootL] = legDragPointL[1];
  268. DragPointChain[] legDragPointR = MakeIKChain(BoneTransform[Bone.FootR]);
  269. DragPoints[Bone.CalfR] = legDragPointR[0];
  270. DragPoints[Bone.FootR] = legDragPointR[1];
  271. InitializeSpineDragPoint(
  272. Bone.Neck, Bone.Spine, Bone.Spine0a, Bone.Spine1, Bone.Spine1a, Bone.Hip, Bone.ThighL, Bone.ThighR
  273. );
  274. InitializeFingerDragPoint(Bone.Finger0L, Bone.Finger4R);
  275. InitializeFingerDragPoint(Bone.Toe0L, Bone.Toe2R);
  276. }
  277. private void InitializeMuneDragPoint(bool left)
  278. {
  279. Bone mune = left ? Bone.MuneL : Bone.MuneR;
  280. Bone sub = left ? Bone.MuneSubL : Bone.MuneSubR;
  281. DragPointChain muneDragPoint = DragPoint.Make<DragPointChain>(
  282. PrimitiveType.Sphere, Vector3.one * 0.12f, DragPoint.LightBlue
  283. );
  284. muneDragPoint.Initialize(meido,
  285. () => (BoneTransform[mune].position + BoneTransform[sub].position) / 2f,
  286. () => Vector3.zero
  287. );
  288. muneDragPoint.Set(BoneTransform[sub]);
  289. DragPoints[mune] = muneDragPoint;
  290. }
  291. private DragPointChain[] MakeIKChain(Transform lower)
  292. {
  293. Vector3 limbDragPointSize = Vector3.one * 0.12f;
  294. // Ignore Thigh transform when making a leg IK chain
  295. bool isLeg = lower.name.EndsWith("Foot");
  296. DragPointChain[] dragPoints = new DragPointChain[isLeg ? 2 : 3];
  297. for (int i = dragPoints.Length - 1; i >= 0; i--)
  298. {
  299. Transform joint = lower;
  300. dragPoints[i] = DragPoint.Make<DragPointChain>(
  301. PrimitiveType.Sphere, limbDragPointSize, DragPoint.LightBlue
  302. );
  303. dragPoints[i].Initialize(meido, () => joint.position, () => Vector3.zero);
  304. dragPoints[i].Set(joint);
  305. dragPoints[i].AddGizmo();
  306. lower = lower.parent;
  307. }
  308. return dragPoints;
  309. }
  310. private void InitializeFingerDragPoint(Bone start, Bone end)
  311. {
  312. Vector3 fingerDragPointSize = Vector3.one * 0.015f;
  313. int joints = BoneTransform[start].name.Split(' ')[2].StartsWith("Finger") ? 4 : 3;
  314. for (Bone bone = start; bone <= end; bone += joints)
  315. {
  316. for (int i = 1; i < joints; i++)
  317. {
  318. Transform trans = BoneTransform[bone + i];
  319. DragPointFinger chain = DragPoint.Make<DragPointFinger>(
  320. PrimitiveType.Sphere, fingerDragPointSize, DragPoint.Blue
  321. );
  322. chain.Initialize(meido, () => trans.position, () => Vector3.zero);
  323. chain.Set(trans);
  324. DragPoints[bone + i] = chain;
  325. }
  326. }
  327. }
  328. private void InitializeSpineDragPoint(params Bone[] bones)
  329. {
  330. Vector3 spineDragPointSize = Vector3.one * 0.045f;
  331. foreach (Bone bone in bones)
  332. {
  333. Transform spine = BoneTransform[bone];
  334. PrimitiveType primitive = bone == Bone.Hip ? PrimitiveType.Cube : PrimitiveType.Sphere;
  335. DragPointSpine dragPoint = DragPoint.Make<DragPointSpine>(
  336. primitive, spineDragPointSize, DragPoint.LightBlue
  337. );
  338. dragPoint.Initialize(meido,
  339. () => spine.position,
  340. () => Vector3.zero
  341. );
  342. dragPoint.Set(spine);
  343. dragPoint.AddGizmo();
  344. DragPoints[bone] = dragPoint;
  345. }
  346. }
  347. private void OnCubeActive(object sender, EventArgs args)
  348. {
  349. dragCube.gameObject.SetActive(CubeActive);
  350. }
  351. private void OnCubeSmall(object sender, EventArgs args)
  352. {
  353. dragCube.DragPointScale = CubeSmall ? DragPointGeneral.smallCube : 1f;
  354. }
  355. private void OnSetDragPointScale(object sender, EventArgs args)
  356. {
  357. this.SetDragPointScale(maid.transform.localScale.x);
  358. }
  359. private void OnSelectBody(object sender, EventArgs args)
  360. {
  361. SelectMaid?.Invoke(this, new MeidoUpdateEventArgs(meido.ActiveSlot, fromMaid: true, isBody: true));
  362. }
  363. private void OnSelectFace(object sender, EventArgs args)
  364. {
  365. SelectMaid?.Invoke(this, new MeidoUpdateEventArgs(meido.ActiveSlot, fromMaid: true, isBody: false));
  366. }
  367. private void SetDragPointScale(float scale)
  368. {
  369. foreach (DragPointMeido dragPoint in DragPoints.Values)
  370. {
  371. dragPoint.DragPointScale = scale;
  372. }
  373. dragBody.DragPointScale = scale;
  374. }
  375. private void InitializeBones()
  376. {
  377. // TODO: Move to external file somehow
  378. Transform transform = maid.body0.m_Bones.transform;
  379. BoneTransform = new Dictionary<Bone, Transform>()
  380. {
  381. [Bone.Head] = CMT.SearchObjName(transform, "Bip01 Head"),
  382. [Bone.Neck] = CMT.SearchObjName(transform, "Bip01 Neck"),
  383. [Bone.HeadNub] = CMT.SearchObjName(transform, "Bip01 HeadNub"),
  384. [Bone.IKHandL] = CMT.SearchObjName(transform, "_IK_handL"),
  385. [Bone.IKHandR] = CMT.SearchObjName(transform, "_IK_handR"),
  386. [Bone.MuneL] = CMT.SearchObjName(transform, "Mune_L"),
  387. [Bone.MuneSubL] = CMT.SearchObjName(transform, "Mune_L_sub"),
  388. [Bone.MuneR] = CMT.SearchObjName(transform, "Mune_R"),
  389. [Bone.MuneSubR] = CMT.SearchObjName(transform, "Mune_R_sub"),
  390. [Bone.Pelvis] = CMT.SearchObjName(transform, "Bip01 Pelvis"),
  391. [Bone.Hip] = CMT.SearchObjName(transform, "Bip01"),
  392. [Bone.Spine] = CMT.SearchObjName(transform, "Bip01 Spine"),
  393. [Bone.Spine0a] = CMT.SearchObjName(transform, "Bip01 Spine0a"),
  394. [Bone.Spine1] = CMT.SearchObjName(transform, "Bip01 Spine1"),
  395. [Bone.Spine1a] = CMT.SearchObjName(transform, "Bip01 Spine1a"),
  396. [Bone.ClavicleL] = CMT.SearchObjName(transform, "Bip01 L Clavicle"),
  397. [Bone.ClavicleR] = CMT.SearchObjName(transform, "Bip01 R Clavicle"),
  398. [Bone.UpperArmL] = CMT.SearchObjName(transform, "Bip01 L UpperArm"),
  399. [Bone.ForearmL] = CMT.SearchObjName(transform, "Bip01 L Forearm"),
  400. [Bone.HandL] = CMT.SearchObjName(transform, "Bip01 L Hand"),
  401. [Bone.UpperArmR] = CMT.SearchObjName(transform, "Bip01 R UpperArm"),
  402. [Bone.ForearmR] = CMT.SearchObjName(transform, "Bip01 R Forearm"),
  403. [Bone.HandR] = CMT.SearchObjName(transform, "Bip01 R Hand"),
  404. [Bone.ThighL] = CMT.SearchObjName(transform, "Bip01 L Thigh"),
  405. [Bone.CalfL] = CMT.SearchObjName(transform, "Bip01 L Calf"),
  406. [Bone.FootL] = CMT.SearchObjName(transform, "Bip01 L Foot"),
  407. [Bone.ThighR] = CMT.SearchObjName(transform, "Bip01 R Thigh"),
  408. [Bone.CalfR] = CMT.SearchObjName(transform, "Bip01 R Calf"),
  409. [Bone.FootR] = CMT.SearchObjName(transform, "Bip01 R Foot"),
  410. // fingers
  411. [Bone.Finger0L] = CMT.SearchObjName(transform, "Bip01 L Finger0"),
  412. [Bone.Finger01L] = CMT.SearchObjName(transform, "Bip01 L Finger01"),
  413. [Bone.Finger02L] = CMT.SearchObjName(transform, "Bip01 L Finger02"),
  414. [Bone.Finger0NubL] = CMT.SearchObjName(transform, "Bip01 L Finger0Nub"),
  415. [Bone.Finger1L] = CMT.SearchObjName(transform, "Bip01 L Finger1"),
  416. [Bone.Finger11L] = CMT.SearchObjName(transform, "Bip01 L Finger11"),
  417. [Bone.Finger12L] = CMT.SearchObjName(transform, "Bip01 L Finger12"),
  418. [Bone.Finger1NubL] = CMT.SearchObjName(transform, "Bip01 L Finger1Nub"),
  419. [Bone.Finger2L] = CMT.SearchObjName(transform, "Bip01 L Finger2"),
  420. [Bone.Finger21L] = CMT.SearchObjName(transform, "Bip01 L Finger21"),
  421. [Bone.Finger22L] = CMT.SearchObjName(transform, "Bip01 L Finger22"),
  422. [Bone.Finger2NubL] = CMT.SearchObjName(transform, "Bip01 L Finger2Nub"),
  423. [Bone.Finger3L] = CMT.SearchObjName(transform, "Bip01 L Finger3"),
  424. [Bone.Finger31L] = CMT.SearchObjName(transform, "Bip01 L Finger31"),
  425. [Bone.Finger32L] = CMT.SearchObjName(transform, "Bip01 L Finger32"),
  426. [Bone.Finger3NubL] = CMT.SearchObjName(transform, "Bip01 L Finger3Nub"),
  427. [Bone.Finger4L] = CMT.SearchObjName(transform, "Bip01 L Finger4"),
  428. [Bone.Finger41L] = CMT.SearchObjName(transform, "Bip01 L Finger41"),
  429. [Bone.Finger42L] = CMT.SearchObjName(transform, "Bip01 L Finger42"),
  430. [Bone.Finger4NubL] = CMT.SearchObjName(transform, "Bip01 L Finger4Nub"),
  431. [Bone.Finger0R] = CMT.SearchObjName(transform, "Bip01 R Finger0"),
  432. [Bone.Finger01R] = CMT.SearchObjName(transform, "Bip01 R Finger01"),
  433. [Bone.Finger02R] = CMT.SearchObjName(transform, "Bip01 R Finger02"),
  434. [Bone.Finger0NubR] = CMT.SearchObjName(transform, "Bip01 R Finger0Nub"),
  435. [Bone.Finger1R] = CMT.SearchObjName(transform, "Bip01 R Finger1"),
  436. [Bone.Finger11R] = CMT.SearchObjName(transform, "Bip01 R Finger11"),
  437. [Bone.Finger12R] = CMT.SearchObjName(transform, "Bip01 R Finger12"),
  438. [Bone.Finger1NubR] = CMT.SearchObjName(transform, "Bip01 R Finger1Nub"),
  439. [Bone.Finger2R] = CMT.SearchObjName(transform, "Bip01 R Finger2"),
  440. [Bone.Finger21R] = CMT.SearchObjName(transform, "Bip01 R Finger21"),
  441. [Bone.Finger22R] = CMT.SearchObjName(transform, "Bip01 R Finger22"),
  442. [Bone.Finger2NubR] = CMT.SearchObjName(transform, "Bip01 R Finger2Nub"),
  443. [Bone.Finger3R] = CMT.SearchObjName(transform, "Bip01 R Finger3"),
  444. [Bone.Finger31R] = CMT.SearchObjName(transform, "Bip01 R Finger31"),
  445. [Bone.Finger32R] = CMT.SearchObjName(transform, "Bip01 R Finger32"),
  446. [Bone.Finger3NubR] = CMT.SearchObjName(transform, "Bip01 R Finger3Nub"),
  447. [Bone.Finger4R] = CMT.SearchObjName(transform, "Bip01 R Finger4"),
  448. [Bone.Finger41R] = CMT.SearchObjName(transform, "Bip01 R Finger41"),
  449. [Bone.Finger42R] = CMT.SearchObjName(transform, "Bip01 R Finger42"),
  450. [Bone.Finger4NubR] = CMT.SearchObjName(transform, "Bip01 R Finger4Nub"),
  451. // Toes
  452. [Bone.Toe0L] = CMT.SearchObjName(transform, "Bip01 L Toe0"),
  453. [Bone.Toe01L] = CMT.SearchObjName(transform, "Bip01 L Toe01"),
  454. [Bone.Toe0NubL] = CMT.SearchObjName(transform, "Bip01 L Toe0Nub"),
  455. [Bone.Toe1L] = CMT.SearchObjName(transform, "Bip01 L Toe1"),
  456. [Bone.Toe11L] = CMT.SearchObjName(transform, "Bip01 L Toe11"),
  457. [Bone.Toe1NubL] = CMT.SearchObjName(transform, "Bip01 L Toe1Nub"),
  458. [Bone.Toe2L] = CMT.SearchObjName(transform, "Bip01 L Toe2"),
  459. [Bone.Toe21L] = CMT.SearchObjName(transform, "Bip01 L Toe21"),
  460. [Bone.Toe2NubL] = CMT.SearchObjName(transform, "Bip01 L Toe2Nub"),
  461. [Bone.Toe0R] = CMT.SearchObjName(transform, "Bip01 R Toe0"),
  462. [Bone.Toe01R] = CMT.SearchObjName(transform, "Bip01 R Toe01"),
  463. [Bone.Toe0NubR] = CMT.SearchObjName(transform, "Bip01 R Toe0Nub"),
  464. [Bone.Toe1R] = CMT.SearchObjName(transform, "Bip01 R Toe1"),
  465. [Bone.Toe11R] = CMT.SearchObjName(transform, "Bip01 R Toe11"),
  466. [Bone.Toe1NubR] = CMT.SearchObjName(transform, "Bip01 R Toe1Nub"),
  467. [Bone.Toe2R] = CMT.SearchObjName(transform, "Bip01 R Toe2"),
  468. [Bone.Toe21R] = CMT.SearchObjName(transform, "Bip01 R Toe21"),
  469. [Bone.Toe2NubR] = CMT.SearchObjName(transform, "Bip01 R Toe2Nub")
  470. };
  471. }
  472. }
  473. internal struct AttachPointInfo
  474. {
  475. public AttachPoint AttachPoint { get; }
  476. public string MaidGuid { get; }
  477. public int MaidIndex { get; }
  478. public static AttachPointInfo Empty
  479. {
  480. get => new AttachPointInfo(AttachPoint.None, String.Empty, -1);
  481. }
  482. public AttachPointInfo(AttachPoint attachPoint, string maidGuid, int maidIndex)
  483. {
  484. this.AttachPoint = attachPoint;
  485. this.MaidGuid = maidGuid;
  486. this.MaidIndex = maidIndex;
  487. }
  488. }
  489. }