@volter/blender-engine 0.1.148 → 0.1.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +4 -11
  3. package/browser/addons/vrm/LICENSE_(OPTION1)_MIT.txt +22 -0
  4. package/browser/addons/vrm/LICENSE_(OPTION2)_GPL-3_0.txt +674 -0
  5. package/browser/addons/vrm/LICENSE_MAIN.txt +1 -0
  6. package/browser/addons/vrm/README.txt +3 -0
  7. package/browser/addons/vrm/__init__.py +41 -0
  8. package/browser/addons/vrm/blender_manifest.toml +16 -0
  9. package/browser/addons/vrm/common/__init__.py +1 -0
  10. package/browser/addons/vrm/common/animation.py +58 -0
  11. package/browser/addons/vrm/common/blender_manifest.py +82 -0
  12. package/browser/addons/vrm/common/char.py +16 -0
  13. package/browser/addons/vrm/common/convert.py +287 -0
  14. package/browser/addons/vrm/common/convert_any.py +48 -0
  15. package/browser/addons/vrm/common/debug.py +40 -0
  16. package/browser/addons/vrm/common/deep.py +162 -0
  17. package/browser/addons/vrm/common/error_dialog.py +274 -0
  18. package/browser/addons/vrm/common/fs.py +71 -0
  19. package/browser/addons/vrm/common/gl.py +20 -0
  20. package/browser/addons/vrm/common/gltf.py +1149 -0
  21. package/browser/addons/vrm/common/human_bone_mapper/__init__.py +1 -0
  22. package/browser/addons/vrm/common/human_bone_mapper/biped_mapping.py +84 -0
  23. package/browser/addons/vrm/common/human_bone_mapper/cats_blender_plugin_fix_model_mapping.py +63 -0
  24. package/browser/addons/vrm/common/human_bone_mapper/human_bone_mapper.py +203 -0
  25. package/browser/addons/vrm/common/human_bone_mapper/microsoft_rocketbox_mapping.py +69 -0
  26. package/browser/addons/vrm/common/human_bone_mapper/mixamo_mapping.py +62 -0
  27. package/browser/addons/vrm/common/human_bone_mapper/mmd_mapping.py +115 -0
  28. package/browser/addons/vrm/common/human_bone_mapper/mpfb_mapping.py +120 -0
  29. package/browser/addons/vrm/common/human_bone_mapper/ready_player_me_mapping.py +65 -0
  30. package/browser/addons/vrm/common/human_bone_mapper/reallusion_mapping.py +94 -0
  31. package/browser/addons/vrm/common/human_bone_mapper/rigify_meta_rig_mapping.py +65 -0
  32. package/browser/addons/vrm/common/human_bone_mapper/structure_based_mapping.py +891 -0
  33. package/browser/addons/vrm/common/human_bone_mapper/unreal_mapping.py +62 -0
  34. package/browser/addons/vrm/common/human_bone_mapper/vrm_addon_mapping.py +112 -0
  35. package/browser/addons/vrm/common/human_bone_mapper/vroid_mapping.py +89 -0
  36. package/browser/addons/vrm/common/legacy_gltf.py +16 -0
  37. package/browser/addons/vrm/common/logger.py +84 -0
  38. package/browser/addons/vrm/common/mtoon0.blend +0 -0
  39. package/browser/addons/vrm/common/mtoon1.blend +0 -0
  40. package/browser/addons/vrm/common/mtoon1_outline.blend +0 -0
  41. package/browser/addons/vrm/common/mtoon_auto_setup.blend +0 -0
  42. package/browser/addons/vrm/common/mtoon_unversioned.py +62 -0
  43. package/browser/addons/vrm/common/ops/__init__.py +10 -0
  44. package/browser/addons/vrm/common/ops/export_scene.py +67 -0
  45. package/browser/addons/vrm/common/ops/icyp.py +53 -0
  46. package/browser/addons/vrm/common/ops/import_scene.py +57 -0
  47. package/browser/addons/vrm/common/ops/vrm.py +2380 -0
  48. package/browser/addons/vrm/common/ops/wm.py +167 -0
  49. package/browser/addons/vrm/common/preferences.py +362 -0
  50. package/browser/addons/vrm/common/progress.py +87 -0
  51. package/browser/addons/vrm/common/rotation.py +89 -0
  52. package/browser/addons/vrm/common/safe_removal.py +46 -0
  53. package/browser/addons/vrm/common/scene_watcher.py +230 -0
  54. package/browser/addons/vrm/common/shader.py +2243 -0
  55. package/browser/addons/vrm/common/shape_key_mapper/__init__.py +1 -0
  56. package/browser/addons/vrm/common/shape_key_mapper/arkit_mapping.py +168 -0
  57. package/browser/addons/vrm/common/shape_key_mapper/mmd_mapping.py +62 -0
  58. package/browser/addons/vrm/common/shape_key_mapper/ready_player_me_mapping.py +52 -0
  59. package/browser/addons/vrm/common/shape_key_mapper/vrchat_mapping.py +17 -0
  60. package/browser/addons/vrm/common/third_party_user_extension.py +214 -0
  61. package/browser/addons/vrm/common/transparent_z_write.blend +0 -0
  62. package/browser/addons/vrm/common/version.py +161 -0
  63. package/browser/addons/vrm/common/vrm0/__init__.py +1 -0
  64. package/browser/addons/vrm/common/vrm0/human_bone.py +662 -0
  65. package/browser/addons/vrm/common/vrm0/material_property.py +346 -0
  66. package/browser/addons/vrm/common/vrm1/__init__.py +1 -0
  67. package/browser/addons/vrm/common/vrm1/expression_preset.py +207 -0
  68. package/browser/addons/vrm/common/vrm1/human_bone.py +822 -0
  69. package/browser/addons/vrm/common/workspace.py +227 -0
  70. package/browser/addons/vrm/common/writable_context.py +77 -0
  71. package/browser/addons/vrm/documentation/en-us/animation/index.md +63 -0
  72. package/browser/addons/vrm/documentation/en-us/create-humanoid-vrm-from-scratch/index.md +131 -0
  73. package/browser/addons/vrm/documentation/en-us/create-simple-vrm-from-scratch/index.md +30 -0
  74. package/browser/addons/vrm/documentation/en-us/development/index.md +136 -0
  75. package/browser/addons/vrm/documentation/en-us/index.md +41 -0
  76. package/browser/addons/vrm/documentation/en-us/installation/index.md +152 -0
  77. package/browser/addons/vrm/documentation/en-us/material-mtoon/index.md +122 -0
  78. package/browser/addons/vrm/documentation/en-us/material-pbr/index.md +94 -0
  79. package/browser/addons/vrm/documentation/en-us/scripting-api/index.md +391 -0
  80. package/browser/addons/vrm/documentation/en-us/ui/export_scene.vrm/index.md +57 -0
  81. package/browser/addons/vrm/documentation/en-us/ui/export_scene.vrma/index.md +17 -0
  82. package/browser/addons/vrm/documentation/en-us/ui/import_scene.vrm/index.md +61 -0
  83. package/browser/addons/vrm/documentation/en-us/ui/import_scene.vrma/index.md +13 -0
  84. package/browser/addons/vrm/documentation/ja-jp/animation/index.md +57 -0
  85. package/browser/addons/vrm/documentation/ja-jp/create-humanoid-vrm-from-scratch/index.md +129 -0
  86. package/browser/addons/vrm/documentation/ja-jp/create-simple-vrm-from-scratch/index.md +29 -0
  87. package/browser/addons/vrm/documentation/ja-jp/development/index.md +137 -0
  88. package/browser/addons/vrm/documentation/ja-jp/index.md +37 -0
  89. package/browser/addons/vrm/documentation/ja-jp/installation/index.md +150 -0
  90. package/browser/addons/vrm/documentation/ja-jp/material-mtoon/index.md +113 -0
  91. package/browser/addons/vrm/documentation/ja-jp/material-pbr/index.md +90 -0
  92. package/browser/addons/vrm/documentation/ja-jp/scripting-api/index.md +389 -0
  93. package/browser/addons/vrm/documentation/ja-jp/ui/export_scene.vrm/index.md +55 -0
  94. package/browser/addons/vrm/documentation/ja-jp/ui/export_scene.vrma/index.md +19 -0
  95. package/browser/addons/vrm/documentation/ja-jp/ui/import_scene.vrm/index.md +56 -0
  96. package/browser/addons/vrm/documentation/ja-jp/ui/import_scene.vrma/index.md +14 -0
  97. package/browser/addons/vrm/editor/__init__.py +1 -0
  98. package/browser/addons/vrm/editor/extension.py +425 -0
  99. package/browser/addons/vrm/editor/extension_accessor.py +75 -0
  100. package/browser/addons/vrm/editor/handler.py +84 -0
  101. package/browser/addons/vrm/editor/khr_character/__init__.py +1 -0
  102. package/browser/addons/vrm/editor/khr_character/panel.py +69 -0
  103. package/browser/addons/vrm/editor/khr_character/property_group.py +27 -0
  104. package/browser/addons/vrm/editor/khr_xmp_json_ld/__init__.py +1 -0
  105. package/browser/addons/vrm/editor/khr_xmp_json_ld/ops.py +464 -0
  106. package/browser/addons/vrm/editor/khr_xmp_json_ld/panel.py +136 -0
  107. package/browser/addons/vrm/editor/khr_xmp_json_ld/property_group.py +83 -0
  108. package/browser/addons/vrm/editor/khr_xmp_json_ld/ui_list.py +198 -0
  109. package/browser/addons/vrm/editor/make_armature.py +709 -0
  110. package/browser/addons/vrm/editor/menu.py +147 -0
  111. package/browser/addons/vrm/editor/migration.py +297 -0
  112. package/browser/addons/vrm/editor/mtoon1/__init__.py +1 -0
  113. package/browser/addons/vrm/editor/mtoon1/handler.py +20 -0
  114. package/browser/addons/vrm/editor/mtoon1/migration.py +536 -0
  115. package/browser/addons/vrm/editor/mtoon1/ops.py +304 -0
  116. package/browser/addons/vrm/editor/mtoon1/panel.py +442 -0
  117. package/browser/addons/vrm/editor/mtoon1/property_group.py +4977 -0
  118. package/browser/addons/vrm/editor/mtoon1/scene_watcher.py +381 -0
  119. package/browser/addons/vrm/editor/node_constraint1/__init__.py +1 -0
  120. package/browser/addons/vrm/editor/node_constraint1/panel.py +317 -0
  121. package/browser/addons/vrm/editor/node_constraint1/property_group.py +25 -0
  122. package/browser/addons/vrm/editor/ops.py +471 -0
  123. package/browser/addons/vrm/editor/panel.py +315 -0
  124. package/browser/addons/vrm/editor/property_group.py +888 -0
  125. package/browser/addons/vrm/editor/search.py +682 -0
  126. package/browser/addons/vrm/editor/spring_bone1/__init__.py +1 -0
  127. package/browser/addons/vrm/editor/spring_bone1/handler.py +994 -0
  128. package/browser/addons/vrm/editor/spring_bone1/menu.py +246 -0
  129. package/browser/addons/vrm/editor/spring_bone1/migration.py +86 -0
  130. package/browser/addons/vrm/editor/spring_bone1/ops.py +1679 -0
  131. package/browser/addons/vrm/editor/spring_bone1/panel.py +605 -0
  132. package/browser/addons/vrm/editor/spring_bone1/property_group.py +1457 -0
  133. package/browser/addons/vrm/editor/spring_bone1/ui_list.py +408 -0
  134. package/browser/addons/vrm/editor/subscription.py +123 -0
  135. package/browser/addons/vrm/editor/t_pose.py +713 -0
  136. package/browser/addons/vrm/editor/validation.py +1271 -0
  137. package/browser/addons/vrm/editor/vrm0/__init__.py +1 -0
  138. package/browser/addons/vrm/editor/vrm0/gizmo_group.py +63 -0
  139. package/browser/addons/vrm/editor/vrm0/handler.py +23 -0
  140. package/browser/addons/vrm/editor/vrm0/menu.py +145 -0
  141. package/browser/addons/vrm/editor/vrm0/migration.py +761 -0
  142. package/browser/addons/vrm/editor/vrm0/ops.py +2145 -0
  143. package/browser/addons/vrm/editor/vrm0/panel.py +1333 -0
  144. package/browser/addons/vrm/editor/vrm0/property_group.py +1818 -0
  145. package/browser/addons/vrm/editor/vrm0/ui_list.py +688 -0
  146. package/browser/addons/vrm/editor/vrm1/__init__.py +1 -0
  147. package/browser/addons/vrm/editor/vrm1/handler.py +28 -0
  148. package/browser/addons/vrm/editor/vrm1/menu.py +76 -0
  149. package/browser/addons/vrm/editor/vrm1/migration.py +321 -0
  150. package/browser/addons/vrm/editor/vrm1/ops.py +2679 -0
  151. package/browser/addons/vrm/editor/vrm1/panel.py +1243 -0
  152. package/browser/addons/vrm/editor/vrm1/property_group.py +2087 -0
  153. package/browser/addons/vrm/editor/vrm1/scene_watcher.py +90 -0
  154. package/browser/addons/vrm/editor/vrm1/ui_list.py +533 -0
  155. package/browser/addons/vrm/exporter/__init__.py +1 -0
  156. package/browser/addons/vrm/exporter/abstract_base_vrm_exporter.py +628 -0
  157. package/browser/addons/vrm/exporter/export_scene.py +930 -0
  158. package/browser/addons/vrm/exporter/gltf2_export_user_extension.py +45 -0
  159. package/browser/addons/vrm/exporter/khr_character_exporter.py +34 -0
  160. package/browser/addons/vrm/exporter/vrm0_exporter.py +4020 -0
  161. package/browser/addons/vrm/exporter/vrm1_exporter.py +3682 -0
  162. package/browser/addons/vrm/exporter/vrm_animation_exporter.py +1035 -0
  163. package/browser/addons/vrm/external/__init__.py +1 -0
  164. package/browser/addons/vrm/external/auto_rig_pro_support.py +3 -0
  165. package/browser/addons/vrm/external/io_scene_gltf2_support.py +418 -0
  166. package/browser/addons/vrm/external/rigify_support.py +1 -0
  167. package/browser/addons/vrm/importer/__init__.py +1 -0
  168. package/browser/addons/vrm/importer/abstract_base_vrm_importer.py +1548 -0
  169. package/browser/addons/vrm/importer/file_handler.py +34 -0
  170. package/browser/addons/vrm/importer/gltf2_import_user_extension.py +268 -0
  171. package/browser/addons/vrm/importer/import_scene.py +646 -0
  172. package/browser/addons/vrm/importer/license_validation.py +198 -0
  173. package/browser/addons/vrm/importer/vrm0_importer.py +1723 -0
  174. package/browser/addons/vrm/importer/vrm1_importer.py +2014 -0
  175. package/browser/addons/vrm/importer/vrm_animation_importer.py +763 -0
  176. package/browser/addons/vrm/importer/vrm_diff.py +316 -0
  177. package/browser/addons/vrm/locale/__init__.py +1 -0
  178. package/browser/addons/vrm/locale/ja_jp.py +826 -0
  179. package/browser/addons/vrm/locale/ruff.toml +8 -0
  180. package/browser/addons/vrm/locale/translation_dictionary.py +10 -0
  181. package/browser/addons/vrm/locale/zh_hans.py +928 -0
  182. package/browser/addons/vrm/registration.py +670 -0
  183. package/browser/addons/vrm.json +18 -0
  184. package/browser/blender-emscripten-engine.mts +60 -128
  185. package/browser/blender-engine.mts +20 -186
  186. package/browser/blender-wali-engine.mts +35 -81
  187. package/browser/describe-thrown.mts +3 -6
  188. package/browser/document-chunks.mts +4 -16
  189. package/browser/gltf_export.py +3161 -0
  190. package/browser/heap-growth.mts +23 -0
  191. package/browser/index.ts +2 -0
  192. package/browser/protocol.ts +119 -35
  193. package/browser/pull-job.mts +2 -10
  194. package/browser/rna.ts +190 -73
  195. package/browser/runtime.ts +197 -82
  196. package/browser/session-addons.mts +33 -0
  197. package/browser/session-frame.mts +5 -24
  198. package/browser/session.py +1338 -1427
  199. package/browser/three/attach-presenter.ts +11 -39
  200. package/browser/three/blender-base64.ts +1 -36
  201. package/browser/three/blender-corner-normals.ts +1 -23
  202. package/browser/three/blender-display-shaders.json +1 -1
  203. package/browser/three/blender-display-shaders.lut +0 -0
  204. package/browser/three/blender-display-transform.ts +2 -1
  205. package/browser/three/blender-frame-columns.ts +5 -13
  206. package/browser/three/blender-graph-material.ts +18 -3
  207. package/browser/three/blender-node-graph.ts +10 -34
  208. package/browser/three/blender-physical-material.ts +2 -31
  209. package/browser/three/blender-runtime-armature.ts +7 -60
  210. package/browser/three/blender-runtime-frame.ts +9 -23
  211. package/browser/three/blender-runtime-geometry.ts +22 -26
  212. package/browser/three/blender-runtime-lighting.ts +48 -178
  213. package/browser/three/blender-runtime-shadows.ts +187 -1
  214. package/browser/three/blender-runtime-skeleton.ts +53 -1
  215. package/browser/three/blender-runtime-view.ts +505 -283
  216. package/browser/three/blender-runtime-weights.ts +9 -72
  217. package/browser/three/blender-sky.ts +13 -33
  218. package/browser/three/blender-triangulate.ts +7 -35
  219. package/browser/three/blender-viewport-sampling.ts +235 -0
  220. package/browser/three/blender-workbench-material.ts +25 -29
  221. package/browser/three/blender-workbench-outline.ts +199 -0
  222. package/browser/three/blender-world-volume.ts +62 -10
  223. package/browser/three/presenter.ts +10 -26
  224. package/browser/three/release.ts +5 -21
  225. package/browser/three/sky-precompute-worker.ts +1 -18
  226. package/browser/three/sky-worker.ts +5 -23
  227. package/browser/three/world-field-sampler.ts +12 -26
  228. package/browser/volter_three.py +9 -105
  229. package/browser/worker.ts +156 -151
  230. package/package.json +5 -2
  231. package/wasm/BUNDLE.json +17 -17
  232. package/wasm/DEPENDENCY-LICENSES.txt +14 -0
  233. package/wasm/blender_browser.data.br +0 -0
  234. package/wasm/blender_browser.js +1 -1
  235. package/wasm/blender_browser.wasm.br +0 -0
  236. package/browser/frame-transfer.mts +0 -19
  237. package/browser/three/agx-base-srgb.lut +0 -0
  238. package/browser/three/agx-look-medium-high-contrast.lut +0 -0
  239. package/browser/three/agx-look-punchy.lut +0 -0
  240. package/browser/three/blender-agx.ts +0 -235
  241. package/browser/three/blender-display-lut.ts +0 -145
  242. package/browser/three/blender-filmic.ts +0 -49
  243. package/browser/three/blender-standard.ts +0 -68
  244. package/browser/three/blender-world-visibility.ts +0 -278
  245. package/browser/three/filmic-srgb.lut +0 -0
@@ -0,0 +1,822 @@
1
+ # SPDX-License-Identifier: MIT OR GPL-3.0-or-later
2
+ # SPDX-FileCopyrightText: 2018 iCyP
3
+
4
+ import re
5
+ from collections.abc import Mapping
6
+ from dataclasses import dataclass
7
+ from enum import Enum
8
+ from functools import cached_property
9
+ from typing import ClassVar, Final, Optional
10
+
11
+ from ..vrm0.human_bone import HumanBoneName as Vrm0HumanBoneName
12
+ from ..vrm0.human_bone import HumanBoneSpecification as Vrm0HumanBoneSpecification
13
+ from ..vrm0.human_bone import HumanBoneSpecifications as Vrm0HumanBoneSpecifications
14
+
15
+
16
+ # https://github.com/vrm-c/vrm-specification/blob/6a996eb151770149ea4534b1edb70d913bb4014e/specification/VRMC_vrm-1.0-beta/humanoid.md#list-of-humanoid-bones
17
+ class HumanBoneName(Enum):
18
+ # Torso
19
+ HIPS = "hips"
20
+ SPINE = "spine"
21
+ CHEST = "chest"
22
+ UPPER_CHEST = "upperChest"
23
+ NECK = "neck"
24
+
25
+ # Head
26
+ HEAD = "head"
27
+ LEFT_EYE = "leftEye"
28
+ RIGHT_EYE = "rightEye"
29
+ JAW = "jaw"
30
+
31
+ # Leg
32
+ LEFT_UPPER_LEG = "leftUpperLeg"
33
+ LEFT_LOWER_LEG = "leftLowerLeg"
34
+ LEFT_FOOT = "leftFoot"
35
+ LEFT_TOES = "leftToes"
36
+ RIGHT_UPPER_LEG = "rightUpperLeg"
37
+ RIGHT_LOWER_LEG = "rightLowerLeg"
38
+ RIGHT_FOOT = "rightFoot"
39
+ RIGHT_TOES = "rightToes"
40
+
41
+ # Arm
42
+ LEFT_SHOULDER = "leftShoulder"
43
+ LEFT_UPPER_ARM = "leftUpperArm"
44
+ LEFT_LOWER_ARM = "leftLowerArm"
45
+ LEFT_HAND = "leftHand"
46
+ RIGHT_SHOULDER = "rightShoulder"
47
+ RIGHT_UPPER_ARM = "rightUpperArm"
48
+ RIGHT_LOWER_ARM = "rightLowerArm"
49
+ RIGHT_HAND = "rightHand"
50
+
51
+ # Finger
52
+ LEFT_THUMB_METACARPAL = "leftThumbMetacarpal"
53
+ LEFT_THUMB_PROXIMAL = "leftThumbProximal"
54
+ LEFT_THUMB_DISTAL = "leftThumbDistal"
55
+ LEFT_INDEX_PROXIMAL = "leftIndexProximal"
56
+ LEFT_INDEX_INTERMEDIATE = "leftIndexIntermediate"
57
+ LEFT_INDEX_DISTAL = "leftIndexDistal"
58
+ LEFT_MIDDLE_PROXIMAL = "leftMiddleProximal"
59
+ LEFT_MIDDLE_INTERMEDIATE = "leftMiddleIntermediate"
60
+ LEFT_MIDDLE_DISTAL = "leftMiddleDistal"
61
+ LEFT_RING_PROXIMAL = "leftRingProximal"
62
+ LEFT_RING_INTERMEDIATE = "leftRingIntermediate"
63
+ LEFT_RING_DISTAL = "leftRingDistal"
64
+ LEFT_LITTLE_PROXIMAL = "leftLittleProximal"
65
+ LEFT_LITTLE_INTERMEDIATE = "leftLittleIntermediate"
66
+ LEFT_LITTLE_DISTAL = "leftLittleDistal"
67
+ RIGHT_THUMB_METACARPAL = "rightThumbMetacarpal"
68
+ RIGHT_THUMB_PROXIMAL = "rightThumbProximal"
69
+ RIGHT_THUMB_DISTAL = "rightThumbDistal"
70
+ RIGHT_INDEX_PROXIMAL = "rightIndexProximal"
71
+ RIGHT_INDEX_INTERMEDIATE = "rightIndexIntermediate"
72
+ RIGHT_INDEX_DISTAL = "rightIndexDistal"
73
+ RIGHT_MIDDLE_PROXIMAL = "rightMiddleProximal"
74
+ RIGHT_MIDDLE_INTERMEDIATE = "rightMiddleIntermediate"
75
+ RIGHT_MIDDLE_DISTAL = "rightMiddleDistal"
76
+ RIGHT_RING_PROXIMAL = "rightRingProximal"
77
+ RIGHT_RING_INTERMEDIATE = "rightRingIntermediate"
78
+ RIGHT_RING_DISTAL = "rightRingDistal"
79
+ RIGHT_LITTLE_PROXIMAL = "rightLittleProximal"
80
+ RIGHT_LITTLE_INTERMEDIATE = "rightLittleIntermediate"
81
+ RIGHT_LITTLE_DISTAL = "rightLittleDistal"
82
+
83
+ @staticmethod
84
+ def from_str(human_bone_name_str: str) -> Optional["HumanBoneName"]:
85
+ try:
86
+ return HumanBoneName(human_bone_name_str)
87
+ except ValueError:
88
+ return None
89
+
90
+
91
+ # https://github.com/vrm-c/vrm-specification/blob/6fb6baaf9b9095a84fb82c8384db36e1afeb3558/specification/VRMC_vrm-1.0-beta/humanoid.md#humanoid-bone-parent-child-relationship
92
+ HumanBoneStructure = Mapping[HumanBoneName, "HumanBoneStructure"]
93
+ HUMAN_BONE_STRUCTURE: Final[HumanBoneStructure] = {
94
+ HumanBoneName.HIPS: {
95
+ HumanBoneName.SPINE: {
96
+ HumanBoneName.CHEST: {
97
+ HumanBoneName.UPPER_CHEST: {
98
+ HumanBoneName.NECK: {
99
+ HumanBoneName.HEAD: {
100
+ HumanBoneName.LEFT_EYE: {},
101
+ HumanBoneName.RIGHT_EYE: {},
102
+ HumanBoneName.JAW: {},
103
+ }
104
+ },
105
+ HumanBoneName.LEFT_SHOULDER: {
106
+ HumanBoneName.LEFT_UPPER_ARM: {
107
+ HumanBoneName.LEFT_LOWER_ARM: {
108
+ HumanBoneName.LEFT_HAND: {
109
+ HumanBoneName.LEFT_THUMB_METACARPAL: {
110
+ HumanBoneName.LEFT_THUMB_PROXIMAL: {
111
+ HumanBoneName.LEFT_THUMB_DISTAL: {}
112
+ }
113
+ },
114
+ HumanBoneName.LEFT_INDEX_PROXIMAL: {
115
+ HumanBoneName.LEFT_INDEX_INTERMEDIATE: {
116
+ HumanBoneName.LEFT_INDEX_DISTAL: {}
117
+ }
118
+ },
119
+ HumanBoneName.LEFT_MIDDLE_PROXIMAL: {
120
+ HumanBoneName.LEFT_MIDDLE_INTERMEDIATE: {
121
+ HumanBoneName.LEFT_MIDDLE_DISTAL: {}
122
+ }
123
+ },
124
+ HumanBoneName.LEFT_RING_PROXIMAL: {
125
+ HumanBoneName.LEFT_RING_INTERMEDIATE: {
126
+ HumanBoneName.LEFT_RING_DISTAL: {}
127
+ }
128
+ },
129
+ HumanBoneName.LEFT_LITTLE_PROXIMAL: {
130
+ HumanBoneName.LEFT_LITTLE_INTERMEDIATE: {
131
+ HumanBoneName.LEFT_LITTLE_DISTAL: {}
132
+ }
133
+ },
134
+ }
135
+ }
136
+ }
137
+ },
138
+ HumanBoneName.RIGHT_SHOULDER: {
139
+ HumanBoneName.RIGHT_UPPER_ARM: {
140
+ HumanBoneName.RIGHT_LOWER_ARM: {
141
+ HumanBoneName.RIGHT_HAND: {
142
+ HumanBoneName.RIGHT_THUMB_METACARPAL: {
143
+ HumanBoneName.RIGHT_THUMB_PROXIMAL: {
144
+ HumanBoneName.RIGHT_THUMB_DISTAL: {}
145
+ }
146
+ },
147
+ HumanBoneName.RIGHT_INDEX_PROXIMAL: {
148
+ HumanBoneName.RIGHT_INDEX_INTERMEDIATE: {
149
+ HumanBoneName.RIGHT_INDEX_DISTAL: {}
150
+ }
151
+ },
152
+ HumanBoneName.RIGHT_MIDDLE_PROXIMAL: {
153
+ HumanBoneName.RIGHT_MIDDLE_INTERMEDIATE: {
154
+ HumanBoneName.RIGHT_MIDDLE_DISTAL: {}
155
+ }
156
+ },
157
+ HumanBoneName.RIGHT_RING_PROXIMAL: {
158
+ HumanBoneName.RIGHT_RING_INTERMEDIATE: {
159
+ HumanBoneName.RIGHT_RING_DISTAL: {}
160
+ }
161
+ },
162
+ HumanBoneName.RIGHT_LITTLE_PROXIMAL: {
163
+ HumanBoneName.RIGHT_LITTLE_INTERMEDIATE: {
164
+ HumanBoneName.RIGHT_LITTLE_DISTAL: {}
165
+ }
166
+ },
167
+ }
168
+ }
169
+ }
170
+ },
171
+ }
172
+ }
173
+ },
174
+ HumanBoneName.LEFT_UPPER_LEG: {
175
+ HumanBoneName.LEFT_LOWER_LEG: {
176
+ HumanBoneName.LEFT_FOOT: {HumanBoneName.LEFT_TOES: {}}
177
+ }
178
+ },
179
+ HumanBoneName.RIGHT_UPPER_LEG: {
180
+ HumanBoneName.RIGHT_LOWER_LEG: {
181
+ HumanBoneName.RIGHT_FOOT: {HumanBoneName.RIGHT_TOES: {}}
182
+ }
183
+ },
184
+ }
185
+ }
186
+
187
+
188
+ @dataclass(frozen=True)
189
+ class HumanBoneSpecification:
190
+ name: HumanBoneName
191
+ icon: str
192
+ title: str
193
+ label: str
194
+ label_no_left_right: str
195
+ requirement: bool
196
+ parent_requirement: bool
197
+ parent_name: Optional[HumanBoneName]
198
+ children_names: tuple[HumanBoneName, ...]
199
+ vrm0_name: Vrm0HumanBoneName
200
+
201
+ @cached_property
202
+ def parent(self) -> Optional["HumanBoneSpecification"]:
203
+ if self.parent_name is None:
204
+ return None
205
+ return HumanBoneSpecifications.get(self.parent_name)
206
+
207
+ @cached_property
208
+ def children(self) -> tuple["HumanBoneSpecification", ...]:
209
+ return tuple(map(HumanBoneSpecifications.get, self.children_names))
210
+
211
+ @cached_property
212
+ def required_children(self) -> tuple["HumanBoneSpecification", ...]:
213
+ required_children = list["HumanBoneSpecification"]()
214
+ for child in self.children:
215
+ if child.requirement:
216
+ required_children.append(child)
217
+ else:
218
+ required_children.extend(child.required_children)
219
+ return tuple(required_children)
220
+
221
+ @cached_property
222
+ def descendants(self) -> tuple["HumanBoneSpecification", ...]:
223
+ result: list[HumanBoneSpecification] = []
224
+ searching_children = list(self.children)
225
+ while searching_children:
226
+ child = searching_children.pop()
227
+ result.append(child)
228
+ searching_children.extend(child.children)
229
+ return tuple(result)
230
+
231
+ @cached_property
232
+ def recursive_requirement_len(self) -> int:
233
+ return int(self.requirement) + sum(
234
+ int(descendant.requirement) for descendant in self.descendants
235
+ )
236
+
237
+ @staticmethod
238
+ def create(
239
+ human_bone_name: HumanBoneName,
240
+ vrm0_human_bone_specification: Vrm0HumanBoneSpecification,
241
+ *,
242
+ requirement: bool,
243
+ parent_requirement: bool,
244
+ icon: str,
245
+ ) -> "HumanBoneSpecification":
246
+ # https://stackoverflow.com/a/1176023
247
+ words = re.sub(r"(?<!^)(?=[A-Z])", "#", human_bone_name.value).split("#")
248
+ title = " ".join(word.capitalize() for word in words)
249
+ label = title + ":"
250
+ label_no_left_right = re.sub(r"Right ", "", re.sub(r"^Left ", "", label))
251
+
252
+ return HumanBoneSpecification(
253
+ name=human_bone_name,
254
+ icon=icon,
255
+ title=title,
256
+ label=label,
257
+ label_no_left_right=label_no_left_right,
258
+ requirement=requirement,
259
+ parent_requirement=parent_requirement,
260
+ parent_name=HumanBoneSpecification._find_parent_human_bone_name(
261
+ human_bone_name, None, HUMAN_BONE_STRUCTURE
262
+ ),
263
+ children_names=HumanBoneSpecification._find_children_human_bone_names(
264
+ human_bone_name, HUMAN_BONE_STRUCTURE
265
+ ),
266
+ vrm0_name=vrm0_human_bone_specification.name,
267
+ )
268
+
269
+ @staticmethod
270
+ def _find_parent_human_bone_name(
271
+ child_human_bone_name: HumanBoneName,
272
+ parent_human_bone_name: Optional[HumanBoneName],
273
+ human_bone_structure: HumanBoneStructure,
274
+ ) -> Optional[HumanBoneName]:
275
+ for (
276
+ next_human_bone_name,
277
+ next_human_bone_structure,
278
+ ) in human_bone_structure.items():
279
+ if child_human_bone_name == next_human_bone_name:
280
+ return parent_human_bone_name
281
+
282
+ name = HumanBoneSpecification._find_parent_human_bone_name(
283
+ child_human_bone_name, next_human_bone_name, next_human_bone_structure
284
+ )
285
+ if name:
286
+ return name
287
+
288
+ return None
289
+
290
+ @staticmethod
291
+ def _find_children_human_bone_names(
292
+ human_bone_name: HumanBoneName,
293
+ human_bone_structure: HumanBoneStructure,
294
+ ) -> tuple[HumanBoneName, ...]:
295
+ for (
296
+ next_human_bone_name,
297
+ next_human_bone_structure,
298
+ ) in human_bone_structure.items():
299
+ if human_bone_name == next_human_bone_name:
300
+ return tuple(next_human_bone_structure.keys())
301
+
302
+ children = HumanBoneSpecification._find_children_human_bone_names(
303
+ human_bone_name, next_human_bone_structure
304
+ )
305
+ if children:
306
+ return children
307
+
308
+ return ()
309
+
310
+ def is_ancestor_of(
311
+ self, human_bone_specification: "HumanBoneSpecification"
312
+ ) -> bool:
313
+ parent = human_bone_specification.parent
314
+ while parent:
315
+ if parent == self:
316
+ return True
317
+ parent = parent.parent
318
+ return False
319
+
320
+
321
+ def _create_and_append_human_bone_specification(
322
+ human_bone_specifications: list[HumanBoneSpecification],
323
+ human_bone_name: HumanBoneName,
324
+ vrm0_human_bone_specification: Vrm0HumanBoneSpecification,
325
+ *,
326
+ requirement: bool,
327
+ parent_requirement: bool,
328
+ icon: str,
329
+ ) -> HumanBoneSpecification:
330
+ human_bone_specification = HumanBoneSpecification.create(
331
+ human_bone_name,
332
+ vrm0_human_bone_specification,
333
+ requirement=requirement,
334
+ parent_requirement=parent_requirement,
335
+ icon=icon,
336
+ )
337
+ human_bone_specifications.append(human_bone_specification)
338
+ return human_bone_specification
339
+
340
+
341
+ class HumanBoneSpecifications:
342
+ all_human_bones: ClassVar[list[HumanBoneSpecification]] = []
343
+
344
+ # https://github.com/vrm-c/vrm-specification/blob/6a996eb151770149ea4534b1edb70d913bb4014e/specification/VRMC_vrm-1.0-beta/humanoid.md#list-of-humanoid-bones
345
+ # Torso
346
+ HIPS = _create_and_append_human_bone_specification(
347
+ all_human_bones,
348
+ HumanBoneName.HIPS,
349
+ Vrm0HumanBoneSpecifications.HIPS,
350
+ requirement=True,
351
+ parent_requirement=False,
352
+ icon="USER",
353
+ )
354
+ SPINE = _create_and_append_human_bone_specification(
355
+ all_human_bones,
356
+ HumanBoneName.SPINE,
357
+ Vrm0HumanBoneSpecifications.SPINE,
358
+ requirement=True,
359
+ parent_requirement=False,
360
+ icon="USER",
361
+ )
362
+ CHEST = _create_and_append_human_bone_specification(
363
+ all_human_bones,
364
+ HumanBoneName.CHEST,
365
+ Vrm0HumanBoneSpecifications.CHEST,
366
+ requirement=False,
367
+ parent_requirement=False,
368
+ icon="USER",
369
+ )
370
+ UPPER_CHEST = _create_and_append_human_bone_specification(
371
+ all_human_bones,
372
+ HumanBoneName.UPPER_CHEST,
373
+ Vrm0HumanBoneSpecifications.UPPER_CHEST,
374
+ requirement=False,
375
+ parent_requirement=True,
376
+ icon="USER",
377
+ )
378
+ NECK = _create_and_append_human_bone_specification(
379
+ all_human_bones,
380
+ HumanBoneName.NECK,
381
+ Vrm0HumanBoneSpecifications.NECK,
382
+ requirement=False,
383
+ parent_requirement=False,
384
+ icon="USER",
385
+ )
386
+
387
+ # Head
388
+ HEAD = _create_and_append_human_bone_specification(
389
+ all_human_bones,
390
+ HumanBoneName.HEAD,
391
+ Vrm0HumanBoneSpecifications.HEAD,
392
+ requirement=True,
393
+ parent_requirement=False,
394
+ icon="USER",
395
+ )
396
+ LEFT_EYE = _create_and_append_human_bone_specification(
397
+ all_human_bones,
398
+ HumanBoneName.LEFT_EYE,
399
+ Vrm0HumanBoneSpecifications.LEFT_EYE,
400
+ requirement=False,
401
+ parent_requirement=False,
402
+ icon="HIDE_OFF",
403
+ )
404
+ RIGHT_EYE = _create_and_append_human_bone_specification(
405
+ all_human_bones,
406
+ HumanBoneName.RIGHT_EYE,
407
+ Vrm0HumanBoneSpecifications.RIGHT_EYE,
408
+ requirement=False,
409
+ parent_requirement=False,
410
+ icon="HIDE_OFF",
411
+ )
412
+ JAW = _create_and_append_human_bone_specification(
413
+ all_human_bones,
414
+ HumanBoneName.JAW,
415
+ Vrm0HumanBoneSpecifications.JAW,
416
+ requirement=False,
417
+ parent_requirement=False,
418
+ icon="USER",
419
+ )
420
+
421
+ # Leg
422
+ LEFT_UPPER_LEG = _create_and_append_human_bone_specification(
423
+ all_human_bones,
424
+ HumanBoneName.LEFT_UPPER_LEG,
425
+ Vrm0HumanBoneSpecifications.LEFT_UPPER_LEG,
426
+ requirement=True,
427
+ parent_requirement=False,
428
+ icon="MOD_DYNAMICPAINT",
429
+ )
430
+ LEFT_LOWER_LEG = _create_and_append_human_bone_specification(
431
+ all_human_bones,
432
+ HumanBoneName.LEFT_LOWER_LEG,
433
+ Vrm0HumanBoneSpecifications.LEFT_LOWER_LEG,
434
+ requirement=True,
435
+ parent_requirement=False,
436
+ icon="MOD_DYNAMICPAINT",
437
+ )
438
+ LEFT_FOOT = _create_and_append_human_bone_specification(
439
+ all_human_bones,
440
+ HumanBoneName.LEFT_FOOT,
441
+ Vrm0HumanBoneSpecifications.LEFT_FOOT,
442
+ requirement=True,
443
+ parent_requirement=False,
444
+ icon="MOD_DYNAMICPAINT",
445
+ )
446
+ LEFT_TOES = _create_and_append_human_bone_specification(
447
+ all_human_bones,
448
+ HumanBoneName.LEFT_TOES,
449
+ Vrm0HumanBoneSpecifications.LEFT_TOES,
450
+ requirement=False,
451
+ parent_requirement=False,
452
+ icon="MOD_DYNAMICPAINT",
453
+ )
454
+ RIGHT_UPPER_LEG = _create_and_append_human_bone_specification(
455
+ all_human_bones,
456
+ HumanBoneName.RIGHT_UPPER_LEG,
457
+ Vrm0HumanBoneSpecifications.RIGHT_UPPER_LEG,
458
+ requirement=True,
459
+ parent_requirement=False,
460
+ icon="MOD_DYNAMICPAINT",
461
+ )
462
+ RIGHT_LOWER_LEG = _create_and_append_human_bone_specification(
463
+ all_human_bones,
464
+ HumanBoneName.RIGHT_LOWER_LEG,
465
+ Vrm0HumanBoneSpecifications.RIGHT_LOWER_LEG,
466
+ requirement=True,
467
+ parent_requirement=False,
468
+ icon="MOD_DYNAMICPAINT",
469
+ )
470
+ RIGHT_FOOT = _create_and_append_human_bone_specification(
471
+ all_human_bones,
472
+ HumanBoneName.RIGHT_FOOT,
473
+ Vrm0HumanBoneSpecifications.RIGHT_FOOT,
474
+ requirement=True,
475
+ parent_requirement=False,
476
+ icon="MOD_DYNAMICPAINT",
477
+ )
478
+ RIGHT_TOES = _create_and_append_human_bone_specification(
479
+ all_human_bones,
480
+ HumanBoneName.RIGHT_TOES,
481
+ Vrm0HumanBoneSpecifications.RIGHT_TOES,
482
+ requirement=False,
483
+ parent_requirement=False,
484
+ icon="MOD_DYNAMICPAINT",
485
+ )
486
+
487
+ # Arm
488
+ LEFT_SHOULDER = _create_and_append_human_bone_specification(
489
+ all_human_bones,
490
+ HumanBoneName.LEFT_SHOULDER,
491
+ Vrm0HumanBoneSpecifications.LEFT_SHOULDER,
492
+ requirement=False,
493
+ parent_requirement=False,
494
+ icon="VIEW_PAN",
495
+ )
496
+ LEFT_UPPER_ARM = _create_and_append_human_bone_specification(
497
+ all_human_bones,
498
+ HumanBoneName.LEFT_UPPER_ARM,
499
+ Vrm0HumanBoneSpecifications.LEFT_UPPER_ARM,
500
+ requirement=True,
501
+ parent_requirement=False,
502
+ icon="VIEW_PAN",
503
+ )
504
+ LEFT_LOWER_ARM = _create_and_append_human_bone_specification(
505
+ all_human_bones,
506
+ HumanBoneName.LEFT_LOWER_ARM,
507
+ Vrm0HumanBoneSpecifications.LEFT_LOWER_ARM,
508
+ requirement=True,
509
+ parent_requirement=False,
510
+ icon="VIEW_PAN",
511
+ )
512
+ LEFT_HAND = _create_and_append_human_bone_specification(
513
+ all_human_bones,
514
+ HumanBoneName.LEFT_HAND,
515
+ Vrm0HumanBoneSpecifications.LEFT_HAND,
516
+ requirement=True,
517
+ parent_requirement=False,
518
+ icon="VIEW_PAN",
519
+ )
520
+ RIGHT_SHOULDER = _create_and_append_human_bone_specification(
521
+ all_human_bones,
522
+ HumanBoneName.RIGHT_SHOULDER,
523
+ Vrm0HumanBoneSpecifications.RIGHT_SHOULDER,
524
+ requirement=False,
525
+ parent_requirement=False,
526
+ icon="VIEW_PAN",
527
+ )
528
+ RIGHT_UPPER_ARM = _create_and_append_human_bone_specification(
529
+ all_human_bones,
530
+ HumanBoneName.RIGHT_UPPER_ARM,
531
+ Vrm0HumanBoneSpecifications.RIGHT_UPPER_ARM,
532
+ requirement=True,
533
+ parent_requirement=False,
534
+ icon="VIEW_PAN",
535
+ )
536
+ RIGHT_LOWER_ARM = _create_and_append_human_bone_specification(
537
+ all_human_bones,
538
+ HumanBoneName.RIGHT_LOWER_ARM,
539
+ Vrm0HumanBoneSpecifications.RIGHT_LOWER_ARM,
540
+ requirement=True,
541
+ parent_requirement=False,
542
+ icon="VIEW_PAN",
543
+ )
544
+ RIGHT_HAND = _create_and_append_human_bone_specification(
545
+ all_human_bones,
546
+ HumanBoneName.RIGHT_HAND,
547
+ Vrm0HumanBoneSpecifications.RIGHT_HAND,
548
+ requirement=True,
549
+ parent_requirement=False,
550
+ icon="VIEW_PAN",
551
+ )
552
+
553
+ # Finger
554
+ LEFT_THUMB_METACARPAL = _create_and_append_human_bone_specification(
555
+ all_human_bones,
556
+ HumanBoneName.LEFT_THUMB_METACARPAL,
557
+ Vrm0HumanBoneSpecifications.LEFT_THUMB_PROXIMAL,
558
+ requirement=False,
559
+ parent_requirement=False,
560
+ icon="VIEW_PAN",
561
+ )
562
+ LEFT_THUMB_PROXIMAL = _create_and_append_human_bone_specification(
563
+ all_human_bones,
564
+ HumanBoneName.LEFT_THUMB_PROXIMAL,
565
+ Vrm0HumanBoneSpecifications.LEFT_THUMB_INTERMEDIATE,
566
+ requirement=False,
567
+ parent_requirement=True,
568
+ icon="VIEW_PAN",
569
+ )
570
+ LEFT_THUMB_DISTAL = _create_and_append_human_bone_specification(
571
+ all_human_bones,
572
+ HumanBoneName.LEFT_THUMB_DISTAL,
573
+ Vrm0HumanBoneSpecifications.LEFT_THUMB_DISTAL,
574
+ requirement=False,
575
+ parent_requirement=True,
576
+ icon="VIEW_PAN",
577
+ )
578
+ LEFT_INDEX_PROXIMAL = _create_and_append_human_bone_specification(
579
+ all_human_bones,
580
+ HumanBoneName.LEFT_INDEX_PROXIMAL,
581
+ Vrm0HumanBoneSpecifications.LEFT_INDEX_PROXIMAL,
582
+ requirement=False,
583
+ parent_requirement=False,
584
+ icon="VIEW_PAN",
585
+ )
586
+ LEFT_INDEX_INTERMEDIATE = _create_and_append_human_bone_specification(
587
+ all_human_bones,
588
+ HumanBoneName.LEFT_INDEX_INTERMEDIATE,
589
+ Vrm0HumanBoneSpecifications.LEFT_INDEX_INTERMEDIATE,
590
+ requirement=False,
591
+ parent_requirement=True,
592
+ icon="VIEW_PAN",
593
+ )
594
+ LEFT_INDEX_DISTAL = _create_and_append_human_bone_specification(
595
+ all_human_bones,
596
+ HumanBoneName.LEFT_INDEX_DISTAL,
597
+ Vrm0HumanBoneSpecifications.LEFT_INDEX_DISTAL,
598
+ requirement=False,
599
+ parent_requirement=True,
600
+ icon="VIEW_PAN",
601
+ )
602
+ LEFT_MIDDLE_PROXIMAL = _create_and_append_human_bone_specification(
603
+ all_human_bones,
604
+ HumanBoneName.LEFT_MIDDLE_PROXIMAL,
605
+ Vrm0HumanBoneSpecifications.LEFT_MIDDLE_PROXIMAL,
606
+ requirement=False,
607
+ parent_requirement=False,
608
+ icon="VIEW_PAN",
609
+ )
610
+ LEFT_MIDDLE_INTERMEDIATE = _create_and_append_human_bone_specification(
611
+ all_human_bones,
612
+ HumanBoneName.LEFT_MIDDLE_INTERMEDIATE,
613
+ Vrm0HumanBoneSpecifications.LEFT_MIDDLE_INTERMEDIATE,
614
+ requirement=False,
615
+ parent_requirement=True,
616
+ icon="VIEW_PAN",
617
+ )
618
+ LEFT_MIDDLE_DISTAL = _create_and_append_human_bone_specification(
619
+ all_human_bones,
620
+ HumanBoneName.LEFT_MIDDLE_DISTAL,
621
+ Vrm0HumanBoneSpecifications.LEFT_MIDDLE_DISTAL,
622
+ requirement=False,
623
+ parent_requirement=True,
624
+ icon="VIEW_PAN",
625
+ )
626
+ LEFT_RING_PROXIMAL = _create_and_append_human_bone_specification(
627
+ all_human_bones,
628
+ HumanBoneName.LEFT_RING_PROXIMAL,
629
+ Vrm0HumanBoneSpecifications.LEFT_RING_PROXIMAL,
630
+ requirement=False,
631
+ parent_requirement=False,
632
+ icon="VIEW_PAN",
633
+ )
634
+ LEFT_RING_INTERMEDIATE = _create_and_append_human_bone_specification(
635
+ all_human_bones,
636
+ HumanBoneName.LEFT_RING_INTERMEDIATE,
637
+ Vrm0HumanBoneSpecifications.LEFT_RING_INTERMEDIATE,
638
+ requirement=False,
639
+ parent_requirement=True,
640
+ icon="VIEW_PAN",
641
+ )
642
+ LEFT_RING_DISTAL = _create_and_append_human_bone_specification(
643
+ all_human_bones,
644
+ HumanBoneName.LEFT_RING_DISTAL,
645
+ Vrm0HumanBoneSpecifications.LEFT_RING_DISTAL,
646
+ requirement=False,
647
+ parent_requirement=True,
648
+ icon="VIEW_PAN",
649
+ )
650
+ LEFT_LITTLE_PROXIMAL = _create_and_append_human_bone_specification(
651
+ all_human_bones,
652
+ HumanBoneName.LEFT_LITTLE_PROXIMAL,
653
+ Vrm0HumanBoneSpecifications.LEFT_LITTLE_PROXIMAL,
654
+ requirement=False,
655
+ parent_requirement=False,
656
+ icon="VIEW_PAN",
657
+ )
658
+ LEFT_LITTLE_INTERMEDIATE = _create_and_append_human_bone_specification(
659
+ all_human_bones,
660
+ HumanBoneName.LEFT_LITTLE_INTERMEDIATE,
661
+ Vrm0HumanBoneSpecifications.LEFT_LITTLE_INTERMEDIATE,
662
+ requirement=False,
663
+ parent_requirement=True,
664
+ icon="VIEW_PAN",
665
+ )
666
+ LEFT_LITTLE_DISTAL = _create_and_append_human_bone_specification(
667
+ all_human_bones,
668
+ HumanBoneName.LEFT_LITTLE_DISTAL,
669
+ Vrm0HumanBoneSpecifications.LEFT_LITTLE_DISTAL,
670
+ requirement=False,
671
+ parent_requirement=True,
672
+ icon="VIEW_PAN",
673
+ )
674
+ RIGHT_THUMB_METACARPAL = _create_and_append_human_bone_specification(
675
+ all_human_bones,
676
+ HumanBoneName.RIGHT_THUMB_METACARPAL,
677
+ Vrm0HumanBoneSpecifications.RIGHT_THUMB_PROXIMAL,
678
+ requirement=False,
679
+ parent_requirement=False,
680
+ icon="VIEW_PAN",
681
+ )
682
+ RIGHT_THUMB_PROXIMAL = _create_and_append_human_bone_specification(
683
+ all_human_bones,
684
+ HumanBoneName.RIGHT_THUMB_PROXIMAL,
685
+ Vrm0HumanBoneSpecifications.RIGHT_THUMB_INTERMEDIATE,
686
+ requirement=False,
687
+ parent_requirement=True,
688
+ icon="VIEW_PAN",
689
+ )
690
+ RIGHT_THUMB_DISTAL = _create_and_append_human_bone_specification(
691
+ all_human_bones,
692
+ HumanBoneName.RIGHT_THUMB_DISTAL,
693
+ Vrm0HumanBoneSpecifications.RIGHT_THUMB_DISTAL,
694
+ requirement=False,
695
+ parent_requirement=True,
696
+ icon="VIEW_PAN",
697
+ )
698
+ RIGHT_INDEX_PROXIMAL = _create_and_append_human_bone_specification(
699
+ all_human_bones,
700
+ HumanBoneName.RIGHT_INDEX_PROXIMAL,
701
+ Vrm0HumanBoneSpecifications.RIGHT_INDEX_PROXIMAL,
702
+ requirement=False,
703
+ parent_requirement=False,
704
+ icon="VIEW_PAN",
705
+ )
706
+ RIGHT_INDEX_INTERMEDIATE = _create_and_append_human_bone_specification(
707
+ all_human_bones,
708
+ HumanBoneName.RIGHT_INDEX_INTERMEDIATE,
709
+ Vrm0HumanBoneSpecifications.RIGHT_INDEX_INTERMEDIATE,
710
+ requirement=False,
711
+ parent_requirement=True,
712
+ icon="VIEW_PAN",
713
+ )
714
+ RIGHT_INDEX_DISTAL = _create_and_append_human_bone_specification(
715
+ all_human_bones,
716
+ HumanBoneName.RIGHT_INDEX_DISTAL,
717
+ Vrm0HumanBoneSpecifications.RIGHT_INDEX_DISTAL,
718
+ requirement=False,
719
+ parent_requirement=True,
720
+ icon="VIEW_PAN",
721
+ )
722
+ RIGHT_MIDDLE_PROXIMAL = _create_and_append_human_bone_specification(
723
+ all_human_bones,
724
+ HumanBoneName.RIGHT_MIDDLE_PROXIMAL,
725
+ Vrm0HumanBoneSpecifications.RIGHT_MIDDLE_PROXIMAL,
726
+ requirement=False,
727
+ parent_requirement=False,
728
+ icon="VIEW_PAN",
729
+ )
730
+ RIGHT_MIDDLE_INTERMEDIATE = _create_and_append_human_bone_specification(
731
+ all_human_bones,
732
+ HumanBoneName.RIGHT_MIDDLE_INTERMEDIATE,
733
+ Vrm0HumanBoneSpecifications.RIGHT_MIDDLE_INTERMEDIATE,
734
+ requirement=False,
735
+ parent_requirement=True,
736
+ icon="VIEW_PAN",
737
+ )
738
+ RIGHT_MIDDLE_DISTAL = _create_and_append_human_bone_specification(
739
+ all_human_bones,
740
+ HumanBoneName.RIGHT_MIDDLE_DISTAL,
741
+ Vrm0HumanBoneSpecifications.RIGHT_MIDDLE_DISTAL,
742
+ requirement=False,
743
+ parent_requirement=True,
744
+ icon="VIEW_PAN",
745
+ )
746
+ RIGHT_RING_PROXIMAL = _create_and_append_human_bone_specification(
747
+ all_human_bones,
748
+ HumanBoneName.RIGHT_RING_PROXIMAL,
749
+ Vrm0HumanBoneSpecifications.RIGHT_RING_PROXIMAL,
750
+ requirement=False,
751
+ parent_requirement=False,
752
+ icon="VIEW_PAN",
753
+ )
754
+ RIGHT_RING_INTERMEDIATE = _create_and_append_human_bone_specification(
755
+ all_human_bones,
756
+ HumanBoneName.RIGHT_RING_INTERMEDIATE,
757
+ Vrm0HumanBoneSpecifications.RIGHT_RING_INTERMEDIATE,
758
+ requirement=False,
759
+ parent_requirement=True,
760
+ icon="VIEW_PAN",
761
+ )
762
+ RIGHT_RING_DISTAL = _create_and_append_human_bone_specification(
763
+ all_human_bones,
764
+ HumanBoneName.RIGHT_RING_DISTAL,
765
+ Vrm0HumanBoneSpecifications.RIGHT_RING_DISTAL,
766
+ requirement=False,
767
+ parent_requirement=True,
768
+ icon="VIEW_PAN",
769
+ )
770
+ RIGHT_LITTLE_PROXIMAL = _create_and_append_human_bone_specification(
771
+ all_human_bones,
772
+ HumanBoneName.RIGHT_LITTLE_PROXIMAL,
773
+ Vrm0HumanBoneSpecifications.RIGHT_LITTLE_PROXIMAL,
774
+ requirement=False,
775
+ parent_requirement=False,
776
+ icon="VIEW_PAN",
777
+ )
778
+ RIGHT_LITTLE_INTERMEDIATE = _create_and_append_human_bone_specification(
779
+ all_human_bones,
780
+ HumanBoneName.RIGHT_LITTLE_INTERMEDIATE,
781
+ Vrm0HumanBoneSpecifications.RIGHT_LITTLE_INTERMEDIATE,
782
+ requirement=False,
783
+ parent_requirement=True,
784
+ icon="VIEW_PAN",
785
+ )
786
+ RIGHT_LITTLE_DISTAL = _create_and_append_human_bone_specification(
787
+ all_human_bones,
788
+ HumanBoneName.RIGHT_LITTLE_DISTAL,
789
+ Vrm0HumanBoneSpecifications.RIGHT_LITTLE_DISTAL,
790
+ requirement=False,
791
+ parent_requirement=True,
792
+ icon="VIEW_PAN",
793
+ )
794
+
795
+ human_bone_name_to_human_bone: Mapping[HumanBoneName, HumanBoneSpecification] = {
796
+ human_bone.name: human_bone for human_bone in all_human_bones
797
+ }
798
+
799
+ all_names: tuple[str, ...] = tuple(b.name.value for b in all_human_bones)
800
+
801
+ @staticmethod
802
+ def get(name: HumanBoneName) -> HumanBoneSpecification:
803
+ return HumanBoneSpecifications.human_bone_name_to_human_bone[name]
804
+
805
+ @staticmethod
806
+ def from_name_str(name_str: str) -> Optional[HumanBoneSpecification]:
807
+ human_bone_name = HumanBoneName.from_str(name_str)
808
+ if human_bone_name is None:
809
+ return None
810
+ return HumanBoneSpecifications.get(human_bone_name)
811
+
812
+ @staticmethod
813
+ def from_vrm0_name_str(
814
+ vrm0_name_str: str,
815
+ ) -> Optional[HumanBoneSpecification]:
816
+ vrm0_name = Vrm0HumanBoneName.from_str(vrm0_name_str)
817
+ if vrm0_name is None:
818
+ return None
819
+ for human_bone in HumanBoneSpecifications.all_human_bones:
820
+ if human_bone.vrm0_name == vrm0_name:
821
+ return human_bone
822
+ return None