@volter/blender-engine 0.1.147 → 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,2145 @@
1
+ # SPDX-License-Identifier: MIT OR GPL-3.0-or-later
2
+ import uuid
3
+ from typing import TYPE_CHECKING, ClassVar
4
+
5
+ from bpy.app.translations import pgettext
6
+ from bpy.props import IntProperty, StringProperty
7
+ from bpy.types import Armature, Context, Event, Object, Operator, UILayout
8
+
9
+ from ...common.human_bone_mapper.human_bone_mapper import create_human_bone_mapping
10
+ from ...common.logger import get_logger
11
+ from ...common.vrm0.human_bone import (
12
+ HumanBoneName,
13
+ HumanBoneSpecification,
14
+ HumanBoneSpecifications,
15
+ )
16
+ from ..extension_accessor import get_armature_extension
17
+ from ..menu import VRM_MT_bone_assignment
18
+ from ..ops import VRM_OT_open_url_in_web_browser, layout_operator
19
+ from ..property_group import HumanoidStructureBonePropertyGroup
20
+ from .property_group import (
21
+ Vrm0HumanoidPropertyGroup,
22
+ Vrm0SecondaryAnimationColliderGroupReferencePropertyGroup,
23
+ reset_blend_shape_material_value_binds,
24
+ )
25
+
26
+ logger = get_logger(__name__)
27
+
28
+
29
+ class VRM_OT_add_vrm0_first_person_mesh_annotation(Operator):
30
+ bl_idname = "vrm.add_vrm0_first_person_mesh_annotation"
31
+ bl_label = "Add Mesh Annotation"
32
+ bl_description = "Add VRM 0.x First Person Mesh Annotation"
33
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
34
+
35
+ armature_object_name: StringProperty( # type: ignore[valid-type]
36
+ options={"HIDDEN"},
37
+ )
38
+
39
+ def execute(self, context: Context) -> set[str]:
40
+ armature = context.blend_data.objects.get(self.armature_object_name)
41
+ if armature is None or armature.type != "ARMATURE":
42
+ return {"CANCELLED"}
43
+ armature_data = armature.data
44
+ if not isinstance(armature_data, Armature):
45
+ return {"CANCELLED"}
46
+ first_person = get_armature_extension(armature_data).vrm0.first_person
47
+ first_person.mesh_annotations.add()
48
+ first_person.active_mesh_annotation_index = (
49
+ len(first_person.mesh_annotations) - 1
50
+ )
51
+ return {"FINISHED"}
52
+
53
+ if TYPE_CHECKING:
54
+ # This code is auto generated.
55
+ # To regenerate, run the `uv run tools/property_typing.py` command.
56
+ armature_object_name: str # type: ignore[no-redef]
57
+
58
+
59
+ class VRM_OT_remove_vrm0_first_person_mesh_annotation(Operator):
60
+ bl_idname = "vrm.remove_vrm0_first_person_mesh_annotation"
61
+ bl_label = "Remove Mesh Annotation"
62
+ bl_description = "Remove VRM 0.x First Person Mesh Annotation"
63
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
64
+
65
+ armature_object_name: StringProperty( # type: ignore[valid-type]
66
+ options={"HIDDEN"},
67
+ )
68
+
69
+ mesh_annotation_index: IntProperty( # type: ignore[valid-type]
70
+ min=0,
71
+ options={"HIDDEN"},
72
+ )
73
+
74
+ def execute(self, context: Context) -> set[str]:
75
+ armature = context.blend_data.objects.get(self.armature_object_name)
76
+ if armature is None or armature.type != "ARMATURE":
77
+ return {"CANCELLED"}
78
+ armature_data = armature.data
79
+ if not isinstance(armature_data, Armature):
80
+ return {"CANCELLED"}
81
+ first_person = get_armature_extension(armature_data).vrm0.first_person
82
+ if len(first_person.mesh_annotations) <= self.mesh_annotation_index:
83
+ return {"CANCELLED"}
84
+ first_person.mesh_annotations.remove(self.mesh_annotation_index)
85
+ first_person.active_mesh_annotation_index = min(
86
+ first_person.active_mesh_annotation_index,
87
+ max(0, len(first_person.mesh_annotations) - 1),
88
+ )
89
+ return {"FINISHED"}
90
+
91
+ if TYPE_CHECKING:
92
+ # This code is auto generated.
93
+ # To regenerate, run the `uv run tools/property_typing.py` command.
94
+ armature_object_name: str # type: ignore[no-redef]
95
+ mesh_annotation_index: int # type: ignore[no-redef]
96
+
97
+
98
+ class VRM_OT_move_up_vrm0_first_person_mesh_annotation(Operator):
99
+ bl_idname = "vrm.move_up_vrm0_first_person_mesh_annotation"
100
+ bl_label = "Move Up Mesh Annotation"
101
+ bl_description = "Move Up VRM 0.x First Person Mesh Annotation"
102
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
103
+
104
+ armature_object_name: StringProperty( # type: ignore[valid-type]
105
+ options={"HIDDEN"},
106
+ )
107
+
108
+ mesh_annotation_index: IntProperty( # type: ignore[valid-type]
109
+ min=0,
110
+ options={"HIDDEN"},
111
+ )
112
+
113
+ def execute(self, context: Context) -> set[str]:
114
+ armature = context.blend_data.objects.get(self.armature_object_name)
115
+ if armature is None or armature.type != "ARMATURE":
116
+ return {"CANCELLED"}
117
+ armature_data = armature.data
118
+ if not isinstance(armature_data, Armature):
119
+ return {"CANCELLED"}
120
+ first_person = get_armature_extension(armature_data).vrm0.first_person
121
+ if len(first_person.mesh_annotations) <= self.mesh_annotation_index:
122
+ return {"CANCELLED"}
123
+ if len(first_person.mesh_annotations) <= self.mesh_annotation_index:
124
+ return {"CANCELLED"}
125
+ new_index = (first_person.active_mesh_annotation_index - 1) % len(
126
+ first_person.mesh_annotations
127
+ )
128
+ first_person.mesh_annotations.move(self.mesh_annotation_index, new_index)
129
+ first_person.active_mesh_annotation_index = new_index
130
+ return {"FINISHED"}
131
+
132
+ if TYPE_CHECKING:
133
+ # This code is auto generated.
134
+ # To regenerate, run the `uv run tools/property_typing.py` command.
135
+ armature_object_name: str # type: ignore[no-redef]
136
+ mesh_annotation_index: int # type: ignore[no-redef]
137
+
138
+
139
+ class VRM_OT_move_down_vrm0_first_person_mesh_annotation(Operator):
140
+ bl_idname = "vrm.move_down_vrm0_first_person_mesh_annotation"
141
+ bl_label = "Move Down Mesh Annotation"
142
+ bl_description = "Move Down VRM 0.x First Person Mesh Annotation"
143
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
144
+
145
+ armature_object_name: StringProperty( # type: ignore[valid-type]
146
+ options={"HIDDEN"},
147
+ )
148
+
149
+ mesh_annotation_index: IntProperty( # type: ignore[valid-type]
150
+ min=0,
151
+ options={"HIDDEN"},
152
+ )
153
+
154
+ def execute(self, context: Context) -> set[str]:
155
+ armature = context.blend_data.objects.get(self.armature_object_name)
156
+ if armature is None or armature.type != "ARMATURE":
157
+ return {"CANCELLED"}
158
+ armature_data = armature.data
159
+ if not isinstance(armature_data, Armature):
160
+ return {"CANCELLED"}
161
+ first_person = get_armature_extension(armature_data).vrm0.first_person
162
+ if len(first_person.mesh_annotations) <= self.mesh_annotation_index:
163
+ return {"CANCELLED"}
164
+ new_index = (first_person.active_mesh_annotation_index + 1) % len(
165
+ first_person.mesh_annotations
166
+ )
167
+ first_person.mesh_annotations.move(self.mesh_annotation_index, new_index)
168
+ first_person.active_mesh_annotation_index = new_index
169
+ return {"FINISHED"}
170
+
171
+ if TYPE_CHECKING:
172
+ # This code is auto generated.
173
+ # To regenerate, run the `uv run tools/property_typing.py` command.
174
+ armature_object_name: str # type: ignore[no-redef]
175
+ mesh_annotation_index: int # type: ignore[no-redef]
176
+
177
+
178
+ class VRM_OT_add_vrm0_material_value_bind(Operator):
179
+ bl_idname = "vrm.add_vrm0_material_value_bind"
180
+ bl_label = "Add Material Value Bind"
181
+ bl_description = "Add VRM 0.x Blend Shape Material Value Bind"
182
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
183
+
184
+ armature_object_name: StringProperty( # type: ignore[valid-type]
185
+ options={"HIDDEN"},
186
+ )
187
+
188
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
189
+ min=0,
190
+ options={"HIDDEN"},
191
+ )
192
+
193
+ def execute(self, context: Context) -> set[str]:
194
+ armature = context.blend_data.objects.get(self.armature_object_name)
195
+ if armature is None or armature.type != "ARMATURE":
196
+ return {"CANCELLED"}
197
+ armature_data = armature.data
198
+ if not isinstance(armature_data, Armature):
199
+ return {"CANCELLED"}
200
+ blend_shape_groups = get_armature_extension(
201
+ armature_data
202
+ ).vrm0.blend_shape_master.blend_shape_groups
203
+ if len(blend_shape_groups) <= self.blend_shape_group_index:
204
+ return {"CANCELLED"}
205
+ blend_shape_group = blend_shape_groups[self.blend_shape_group_index]
206
+ blend_shape_group.material_values.add()
207
+ blend_shape_group.active_material_value_index = (
208
+ len(blend_shape_group.material_values) - 1
209
+ )
210
+ return {"FINISHED"}
211
+
212
+ if TYPE_CHECKING:
213
+ # This code is auto generated.
214
+ # To regenerate, run the `uv run tools/property_typing.py` command.
215
+ armature_object_name: str # type: ignore[no-redef]
216
+ blend_shape_group_index: int # type: ignore[no-redef]
217
+
218
+
219
+ class VRM_OT_remove_vrm0_material_value_bind(Operator):
220
+ bl_idname = "vrm.remove_vrm0_material_value_bind"
221
+ bl_label = "Remove Material Value Bind"
222
+ bl_description = "Remove VRM 0.x Blend Shape Material Value Bind"
223
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
224
+
225
+ armature_object_name: StringProperty( # type: ignore[valid-type]
226
+ options={"HIDDEN"},
227
+ )
228
+
229
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
230
+ min=0,
231
+ options={"HIDDEN"},
232
+ )
233
+ material_value_index: IntProperty( # type: ignore[valid-type]
234
+ min=0,
235
+ options={"HIDDEN"},
236
+ )
237
+
238
+ def execute(self, context: Context) -> set[str]:
239
+ armature = context.blend_data.objects.get(self.armature_object_name)
240
+ if armature is None or armature.type != "ARMATURE":
241
+ return {"CANCELLED"}
242
+ armature_data = armature.data
243
+ if not isinstance(armature_data, Armature):
244
+ return {"CANCELLED"}
245
+ blend_shape_groups = get_armature_extension(
246
+ armature_data
247
+ ).vrm0.blend_shape_master.blend_shape_groups
248
+ if len(blend_shape_groups) <= self.blend_shape_group_index:
249
+ return {"CANCELLED"}
250
+ blend_shape_group = blend_shape_groups[self.blend_shape_group_index]
251
+ if len(blend_shape_group.material_values) <= self.material_value_index:
252
+ return {"CANCELLED"}
253
+ blend_shape_group.material_values.remove(self.material_value_index)
254
+ blend_shape_group.active_material_value_index = min(
255
+ blend_shape_group.active_material_value_index,
256
+ max(0, len(blend_shape_group.material_values) - 1),
257
+ )
258
+ reset_blend_shape_material_value_binds(context)
259
+ return {"FINISHED"}
260
+
261
+ if TYPE_CHECKING:
262
+ # This code is auto generated.
263
+ # To regenerate, run the `uv run tools/property_typing.py` command.
264
+ armature_object_name: str # type: ignore[no-redef]
265
+ blend_shape_group_index: int # type: ignore[no-redef]
266
+ material_value_index: int # type: ignore[no-redef]
267
+
268
+
269
+ class VRM_OT_move_up_vrm0_material_value_bind(Operator):
270
+ bl_idname = "vrm.move_up_vrm0_material_value_bind"
271
+ bl_label = "Move Up Material Value Bind"
272
+ bl_description = "Move Up VRM 0.x Blend Shape Material Value Bind"
273
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
274
+
275
+ armature_object_name: StringProperty( # type: ignore[valid-type]
276
+ options={"HIDDEN"},
277
+ )
278
+
279
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
280
+ min=0,
281
+ options={"HIDDEN"},
282
+ )
283
+ material_value_index: IntProperty( # type: ignore[valid-type]
284
+ min=0,
285
+ options={"HIDDEN"},
286
+ )
287
+
288
+ def execute(self, context: Context) -> set[str]:
289
+ armature = context.blend_data.objects.get(self.armature_object_name)
290
+ if armature is None or armature.type != "ARMATURE":
291
+ return {"CANCELLED"}
292
+ armature_data = armature.data
293
+ if not isinstance(armature_data, Armature):
294
+ return {"CANCELLED"}
295
+ blend_shape_groups = get_armature_extension(
296
+ armature_data
297
+ ).vrm0.blend_shape_master.blend_shape_groups
298
+ if len(blend_shape_groups) <= self.blend_shape_group_index:
299
+ return {"CANCELLED"}
300
+ blend_shape_group = blend_shape_groups[self.blend_shape_group_index]
301
+ if len(blend_shape_group.material_values) <= self.material_value_index:
302
+ return {"CANCELLED"}
303
+ new_index = (self.material_value_index - 1) % len(
304
+ blend_shape_group.material_values
305
+ )
306
+ blend_shape_group.material_values.move(self.material_value_index, new_index)
307
+ blend_shape_group.active_material_value_index = new_index
308
+ return {"FINISHED"}
309
+
310
+ if TYPE_CHECKING:
311
+ # This code is auto generated.
312
+ # To regenerate, run the `uv run tools/property_typing.py` command.
313
+ armature_object_name: str # type: ignore[no-redef]
314
+ blend_shape_group_index: int # type: ignore[no-redef]
315
+ material_value_index: int # type: ignore[no-redef]
316
+
317
+
318
+ class VRM_OT_move_down_vrm0_material_value_bind(Operator):
319
+ bl_idname = "vrm.move_down_vrm0_material_value_bind"
320
+ bl_label = "Move Down Material Value Bind"
321
+ bl_description = "Move Down VRM 0.x Blend Shape Material Value Bind"
322
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
323
+
324
+ armature_object_name: StringProperty( # type: ignore[valid-type]
325
+ options={"HIDDEN"},
326
+ )
327
+
328
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
329
+ min=0,
330
+ options={"HIDDEN"},
331
+ )
332
+ material_value_index: IntProperty( # type: ignore[valid-type]
333
+ min=0,
334
+ options={"HIDDEN"},
335
+ )
336
+
337
+ def execute(self, context: Context) -> set[str]:
338
+ armature = context.blend_data.objects.get(self.armature_object_name)
339
+ if armature is None or armature.type != "ARMATURE":
340
+ return {"CANCELLED"}
341
+ armature_data = armature.data
342
+ if not isinstance(armature_data, Armature):
343
+ return {"CANCELLED"}
344
+ blend_shape_groups = get_armature_extension(
345
+ armature_data
346
+ ).vrm0.blend_shape_master.blend_shape_groups
347
+ if len(blend_shape_groups) <= self.blend_shape_group_index:
348
+ return {"CANCELLED"}
349
+ blend_shape_group = blend_shape_groups[self.blend_shape_group_index]
350
+ if len(blend_shape_group.material_values) <= self.material_value_index:
351
+ return {"CANCELLED"}
352
+ new_index = (self.material_value_index + 1) % len(
353
+ blend_shape_group.material_values
354
+ )
355
+ blend_shape_group.material_values.move(self.material_value_index, new_index)
356
+ blend_shape_group.active_material_value_index = new_index
357
+ return {"FINISHED"}
358
+
359
+ if TYPE_CHECKING:
360
+ # This code is auto generated.
361
+ # To regenerate, run the `uv run tools/property_typing.py` command.
362
+ armature_object_name: str # type: ignore[no-redef]
363
+ blend_shape_group_index: int # type: ignore[no-redef]
364
+ material_value_index: int # type: ignore[no-redef]
365
+
366
+
367
+ class VRM_OT_add_vrm0_material_value_bind_target_value(Operator):
368
+ bl_idname = "vrm.add_vrm0_material_value_bind_target_value"
369
+ bl_label = "Add Value"
370
+ bl_description = "Add VRM 0.x Blend Shape Material Value Bind"
371
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
372
+
373
+ armature_object_name: StringProperty( # type: ignore[valid-type]
374
+ options={"HIDDEN"},
375
+ )
376
+
377
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
378
+ min=0,
379
+ options={"HIDDEN"},
380
+ )
381
+ material_value_index: IntProperty( # type: ignore[valid-type]
382
+ min=0,
383
+ options={"HIDDEN"},
384
+ )
385
+
386
+ def execute(self, context: Context) -> set[str]:
387
+ armature = context.blend_data.objects.get(self.armature_object_name)
388
+ if armature is None or armature.type != "ARMATURE":
389
+ return {"CANCELLED"}
390
+ armature_data = armature.data
391
+ if not isinstance(armature_data, Armature):
392
+ return {"CANCELLED"}
393
+ blend_shape_groups = get_armature_extension(
394
+ armature_data
395
+ ).vrm0.blend_shape_master.blend_shape_groups
396
+ if len(blend_shape_groups) <= self.blend_shape_group_index:
397
+ return {"CANCELLED"}
398
+ material_values = blend_shape_groups[
399
+ self.blend_shape_group_index
400
+ ].material_values
401
+ if len(material_values) <= self.material_value_index:
402
+ return {"CANCELLED"}
403
+ material_values[self.material_value_index].target_value.add()
404
+ return {"FINISHED"}
405
+
406
+ if TYPE_CHECKING:
407
+ # This code is auto generated.
408
+ # To regenerate, run the `uv run tools/property_typing.py` command.
409
+ armature_object_name: str # type: ignore[no-redef]
410
+ blend_shape_group_index: int # type: ignore[no-redef]
411
+ material_value_index: int # type: ignore[no-redef]
412
+
413
+
414
+ class VRM_OT_remove_vrm0_material_value_bind_target_value(Operator):
415
+ bl_idname = "vrm.remove_vrm0_material_value_bind_target_value"
416
+ bl_label = "Remove Value"
417
+ bl_description = "Remove VRM 0.x Blend Shape Material Value Bind"
418
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
419
+
420
+ armature_object_name: StringProperty( # type: ignore[valid-type]
421
+ options={"HIDDEN"},
422
+ )
423
+
424
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
425
+ min=0,
426
+ options={"HIDDEN"},
427
+ )
428
+ material_value_index: IntProperty( # type: ignore[valid-type]
429
+ min=0,
430
+ options={"HIDDEN"},
431
+ )
432
+ target_value_index: IntProperty( # type: ignore[valid-type]
433
+ min=0,
434
+ options={"HIDDEN"},
435
+ )
436
+
437
+ def execute(self, context: Context) -> set[str]:
438
+ armature = context.blend_data.objects.get(self.armature_object_name)
439
+ if armature is None or armature.type != "ARMATURE":
440
+ return {"CANCELLED"}
441
+ armature_data = armature.data
442
+ if not isinstance(armature_data, Armature):
443
+ return {"CANCELLED"}
444
+ blend_shape_groups = get_armature_extension(
445
+ armature_data
446
+ ).vrm0.blend_shape_master.blend_shape_groups
447
+ if len(blend_shape_groups) <= self.blend_shape_group_index:
448
+ return {"CANCELLED"}
449
+ material_values = blend_shape_groups[
450
+ self.blend_shape_group_index
451
+ ].material_values
452
+ if len(material_values) <= self.material_value_index:
453
+ return {"CANCELLED"}
454
+ target_value = material_values[self.material_value_index].target_value
455
+ if len(target_value) <= self.target_value_index:
456
+ return {"CANCELLED"}
457
+ target_value.remove(self.target_value_index)
458
+ return {"FINISHED"}
459
+
460
+ if TYPE_CHECKING:
461
+ # This code is auto generated.
462
+ # To regenerate, run the `uv run tools/property_typing.py` command.
463
+ armature_object_name: str # type: ignore[no-redef]
464
+ blend_shape_group_index: int # type: ignore[no-redef]
465
+ material_value_index: int # type: ignore[no-redef]
466
+ target_value_index: int # type: ignore[no-redef]
467
+
468
+
469
+ class VRM_OT_add_vrm0_blend_shape_bind(Operator):
470
+ bl_idname = "vrm.add_vrm0_blend_shape_bind"
471
+ bl_label = "Add Blend Shape Bind"
472
+ bl_description = "Add VRM 0.x Blend Shape Bind"
473
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
474
+
475
+ armature_object_name: StringProperty( # type: ignore[valid-type]
476
+ options={"HIDDEN"},
477
+ )
478
+
479
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
480
+ min=0,
481
+ options={"HIDDEN"},
482
+ )
483
+
484
+ def execute(self, context: Context) -> set[str]:
485
+ armature = context.blend_data.objects.get(self.armature_object_name)
486
+ if armature is None or armature.type != "ARMATURE":
487
+ return {"CANCELLED"}
488
+ armature_data = armature.data
489
+ if not isinstance(armature_data, Armature):
490
+ return {"CANCELLED"}
491
+ blend_shape_groups = get_armature_extension(
492
+ armature_data
493
+ ).vrm0.blend_shape_master.blend_shape_groups
494
+ if len(blend_shape_groups) <= self.blend_shape_group_index:
495
+ return {"CANCELLED"}
496
+ blend_shape_group = blend_shape_groups[self.blend_shape_group_index]
497
+ blend_shape_group.binds.add()
498
+ blend_shape_group.active_bind_index = len(blend_shape_group.binds) - 1
499
+ return {"FINISHED"}
500
+
501
+ if TYPE_CHECKING:
502
+ # This code is auto generated.
503
+ # To regenerate, run the `uv run tools/property_typing.py` command.
504
+ armature_object_name: str # type: ignore[no-redef]
505
+ blend_shape_group_index: int # type: ignore[no-redef]
506
+
507
+
508
+ class VRM_OT_remove_vrm0_blend_shape_bind(Operator):
509
+ bl_idname = "vrm.remove_vrm0_blend_shape_bind"
510
+ bl_label = "Remove Blend Shape Bind"
511
+ bl_description = "Remove VRM 0.x Blend Shape Bind"
512
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
513
+
514
+ armature_object_name: StringProperty( # type: ignore[valid-type]
515
+ options={"HIDDEN"},
516
+ )
517
+
518
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
519
+ min=0,
520
+ options={"HIDDEN"},
521
+ )
522
+ bind_index: IntProperty( # type: ignore[valid-type]
523
+ min=0,
524
+ options={"HIDDEN"},
525
+ )
526
+
527
+ def execute(self, context: Context) -> set[str]:
528
+ armature = context.blend_data.objects.get(self.armature_object_name)
529
+ if armature is None or armature.type != "ARMATURE":
530
+ return {"CANCELLED"}
531
+ armature_data = armature.data
532
+ if not isinstance(armature_data, Armature):
533
+ return {"CANCELLED"}
534
+ blend_shape_groups = get_armature_extension(
535
+ armature_data
536
+ ).vrm0.blend_shape_master.blend_shape_groups
537
+ if len(blend_shape_groups) <= self.blend_shape_group_index:
538
+ return {"CANCELLED"}
539
+ blend_shape_group = blend_shape_groups[self.blend_shape_group_index]
540
+ if len(blend_shape_group.binds) <= self.bind_index:
541
+ return {"CANCELLED"}
542
+ blend_shape_group.binds.remove(self.bind_index)
543
+ blend_shape_group.active_bind_index = min(
544
+ blend_shape_group.active_bind_index,
545
+ max(0, len(blend_shape_group.binds) - 1),
546
+ )
547
+ return {"FINISHED"}
548
+
549
+ if TYPE_CHECKING:
550
+ # This code is auto generated.
551
+ # To regenerate, run the `uv run tools/property_typing.py` command.
552
+ armature_object_name: str # type: ignore[no-redef]
553
+ blend_shape_group_index: int # type: ignore[no-redef]
554
+ bind_index: int # type: ignore[no-redef]
555
+
556
+
557
+ class VRM_OT_move_up_vrm0_blend_shape_bind(Operator):
558
+ bl_idname = "vrm.move_up_vrm0_blend_shape_bind"
559
+ bl_label = "Move Up Blend Shape Bind"
560
+ bl_description = "Move Up VRM 0.x Blend Shape Bind"
561
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
562
+
563
+ armature_object_name: StringProperty( # type: ignore[valid-type]
564
+ options={"HIDDEN"},
565
+ )
566
+
567
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
568
+ min=0,
569
+ options={"HIDDEN"},
570
+ )
571
+ bind_index: IntProperty( # type: ignore[valid-type]
572
+ min=0,
573
+ options={"HIDDEN"},
574
+ )
575
+
576
+ def execute(self, context: Context) -> set[str]:
577
+ armature = context.blend_data.objects.get(self.armature_object_name)
578
+ if armature is None or armature.type != "ARMATURE":
579
+ return {"CANCELLED"}
580
+ armature_data = armature.data
581
+ if not isinstance(armature_data, Armature):
582
+ return {"CANCELLED"}
583
+ blend_shape_groups = get_armature_extension(
584
+ armature_data
585
+ ).vrm0.blend_shape_master.blend_shape_groups
586
+ if len(blend_shape_groups) <= self.blend_shape_group_index:
587
+ return {"CANCELLED"}
588
+ blend_shape_group = blend_shape_groups[self.blend_shape_group_index]
589
+ if len(blend_shape_group.binds) <= self.bind_index:
590
+ return {"CANCELLED"}
591
+ new_index = (self.bind_index - 1) % len(blend_shape_group.binds)
592
+ blend_shape_group.binds.move(self.bind_index, new_index)
593
+ blend_shape_group.active_bind_index = new_index
594
+ return {"FINISHED"}
595
+
596
+ if TYPE_CHECKING:
597
+ # This code is auto generated.
598
+ # To regenerate, run the `uv run tools/property_typing.py` command.
599
+ armature_object_name: str # type: ignore[no-redef]
600
+ blend_shape_group_index: int # type: ignore[no-redef]
601
+ bind_index: int # type: ignore[no-redef]
602
+
603
+
604
+ class VRM_OT_move_down_vrm0_blend_shape_bind(Operator):
605
+ bl_idname = "vrm.move_down_vrm0_blend_shape_bind"
606
+ bl_label = "Move Down Blend Shape Bind"
607
+ bl_description = "Move Up VRM 0.x Blend Shape Bind"
608
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
609
+
610
+ armature_object_name: StringProperty( # type: ignore[valid-type]
611
+ options={"HIDDEN"},
612
+ )
613
+
614
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
615
+ min=0,
616
+ options={"HIDDEN"},
617
+ )
618
+ bind_index: IntProperty( # type: ignore[valid-type]
619
+ min=0,
620
+ options={"HIDDEN"},
621
+ )
622
+
623
+ def execute(self, context: Context) -> set[str]:
624
+ armature = context.blend_data.objects.get(self.armature_object_name)
625
+ if armature is None or armature.type != "ARMATURE":
626
+ return {"CANCELLED"}
627
+ armature_data = armature.data
628
+ if not isinstance(armature_data, Armature):
629
+ return {"CANCELLED"}
630
+ blend_shape_groups = get_armature_extension(
631
+ armature_data
632
+ ).vrm0.blend_shape_master.blend_shape_groups
633
+ if len(blend_shape_groups) <= self.blend_shape_group_index:
634
+ return {"CANCELLED"}
635
+ blend_shape_group = blend_shape_groups[self.blend_shape_group_index]
636
+ if len(blend_shape_group.binds) <= self.bind_index:
637
+ return {"CANCELLED"}
638
+ new_index = (self.bind_index + 1) % len(blend_shape_group.binds)
639
+ blend_shape_group.binds.move(self.bind_index, new_index)
640
+ blend_shape_group.active_bind_index = new_index
641
+ return {"FINISHED"}
642
+
643
+ if TYPE_CHECKING:
644
+ # This code is auto generated.
645
+ # To regenerate, run the `uv run tools/property_typing.py` command.
646
+ armature_object_name: str # type: ignore[no-redef]
647
+ blend_shape_group_index: int # type: ignore[no-redef]
648
+ bind_index: int # type: ignore[no-redef]
649
+
650
+
651
+ class VRM_OT_restore_vrm0_blend_shape_group_bind_object(Operator):
652
+ bl_idname = "vrm.restore_vrm0_blend_shape_group_bind_object"
653
+ bl_label = "Restore Shape Key Assignments"
654
+ bl_description = "Restore VRM 0.x Blend Shape Group Bind Object Assignments"
655
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
656
+
657
+ armature_object_name: StringProperty( # type: ignore[valid-type]
658
+ options={"HIDDEN"},
659
+ )
660
+
661
+ def execute(self, context: Context) -> set[str]:
662
+ armature = context.blend_data.objects.get(self.armature_object_name)
663
+ if armature is None or armature.type != "ARMATURE":
664
+ return {"CANCELLED"}
665
+ armature_data = armature.data
666
+ if not isinstance(armature_data, Armature):
667
+ return {"CANCELLED"}
668
+ blend_shape_master = get_armature_extension(
669
+ armature_data
670
+ ).vrm0.blend_shape_master
671
+ blend_shape_master.restore_blend_shape_group_bind_object_assignments(context)
672
+ return {"FINISHED"}
673
+
674
+ if TYPE_CHECKING:
675
+ # This code is auto generated.
676
+ # To regenerate, run the `uv run tools/property_typing.py` command.
677
+ armature_object_name: str # type: ignore[no-redef]
678
+
679
+
680
+ class VRM_OT_add_vrm0_secondary_animation_collider_group_collider(Operator):
681
+ bl_idname = "vrm.add_vrm0_secondary_animation_collider_group_collider"
682
+ bl_label = "Add Collider"
683
+ bl_description = "Add VRM 0.x Collider"
684
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
685
+
686
+ armature_object_name: StringProperty( # type: ignore[valid-type]
687
+ options={"HIDDEN"},
688
+ )
689
+
690
+ collider_group_index: IntProperty( # type: ignore[valid-type]
691
+ min=0,
692
+ options={"HIDDEN"},
693
+ )
694
+ bone_name: StringProperty( # type: ignore[valid-type]
695
+ options={"HIDDEN"}
696
+ )
697
+
698
+ def execute(self, context: Context) -> set[str]:
699
+ armature = context.blend_data.objects.get(self.armature_object_name)
700
+ if armature is None or armature.type != "ARMATURE":
701
+ return {"CANCELLED"}
702
+ armature_data = armature.data
703
+ if not isinstance(armature_data, Armature):
704
+ return {"CANCELLED"}
705
+ collider_groups = get_armature_extension(
706
+ armature_data
707
+ ).vrm0.secondary_animation.collider_groups
708
+ if len(collider_groups) <= self.collider_group_index:
709
+ return {"CANCELLED"}
710
+ collider_group = collider_groups[self.collider_group_index]
711
+ collider = collider_group.colliders.add()
712
+
713
+ bone_name = self.bone_name
714
+ if not bone_name:
715
+ bone_name = collider_group.node.bone_name
716
+ if bone_name:
717
+ collider_name = f"{bone_name}_collider"
718
+ else:
719
+ collider_name = f"{self.armature_object_name}_collider"
720
+
721
+ obj = context.blend_data.objects.new(name=collider_name, object_data=None)
722
+ collider.bpy_object = obj
723
+ obj.parent = armature
724
+ obj.empty_display_type = "SPHERE"
725
+ obj.empty_display_size = 0.25
726
+ if bone_name:
727
+ obj.parent_type = "BONE"
728
+ obj.parent_bone = bone_name
729
+ else:
730
+ obj.parent_type = "OBJECT"
731
+ context.scene.collection.objects.link(obj)
732
+ collider_group.active_collider_index = len(collider_group.colliders) - 1
733
+ return {"FINISHED"}
734
+
735
+ if TYPE_CHECKING:
736
+ # This code is auto generated.
737
+ # To regenerate, run the `uv run tools/property_typing.py` command.
738
+ armature_object_name: str # type: ignore[no-redef]
739
+ collider_group_index: int # type: ignore[no-redef]
740
+ bone_name: str # type: ignore[no-redef]
741
+
742
+
743
+ class VRM_OT_remove_vrm0_secondary_animation_collider_group_collider(Operator):
744
+ bl_idname = "vrm.remove_vrm0_secondary_animation_collider_group_collider"
745
+ bl_label = "Remove Collider"
746
+ bl_description = "Remove VRM 0.x Collider"
747
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
748
+
749
+ armature_object_name: StringProperty( # type: ignore[valid-type]
750
+ options={"HIDDEN"},
751
+ )
752
+
753
+ collider_group_index: IntProperty( # type: ignore[valid-type]
754
+ min=0,
755
+ options={"HIDDEN"},
756
+ )
757
+ collider_index: IntProperty( # type: ignore[valid-type]
758
+ min=0,
759
+ options={"HIDDEN"},
760
+ )
761
+
762
+ def execute(self, context: Context) -> set[str]:
763
+ armature = context.blend_data.objects.get(self.armature_object_name)
764
+ if armature is None or armature.type != "ARMATURE":
765
+ return {"CANCELLED"}
766
+ armature_data = armature.data
767
+ if not isinstance(armature_data, Armature):
768
+ return {"CANCELLED"}
769
+ collider_groups = get_armature_extension(
770
+ armature_data
771
+ ).vrm0.secondary_animation.collider_groups
772
+ if len(collider_groups) <= self.collider_group_index:
773
+ return {"CANCELLED"}
774
+ collider_group = collider_groups[self.collider_group_index]
775
+ if len(collider_group.colliders) <= self.collider_index:
776
+ return {"CANCELLED"}
777
+ bpy_object = collider_group.colliders[self.collider_index].bpy_object
778
+ if bpy_object and bpy_object.name in context.scene.collection.objects:
779
+ bpy_object.parent_type = "OBJECT"
780
+ context.scene.collection.objects.unlink(bpy_object)
781
+ collider_group.colliders.remove(self.collider_index)
782
+ collider_group.active_collider_index = min(
783
+ collider_group.active_collider_index,
784
+ max(0, len(collider_group.colliders) - 1),
785
+ )
786
+ return {"FINISHED"}
787
+
788
+ if TYPE_CHECKING:
789
+ # This code is auto generated.
790
+ # To regenerate, run the `uv run tools/property_typing.py` command.
791
+ armature_object_name: str # type: ignore[no-redef]
792
+ collider_group_index: int # type: ignore[no-redef]
793
+ collider_index: int # type: ignore[no-redef]
794
+
795
+
796
+ class VRM_OT_move_up_vrm0_secondary_animation_collider_group_collider(Operator):
797
+ bl_idname = "vrm.move_up_vrm0_secondary_animation_collider_group_coll"
798
+ bl_label = "Move Up Collider"
799
+ bl_description = "Move Up VRM 0.x Collider"
800
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
801
+
802
+ armature_object_name: StringProperty( # type: ignore[valid-type]
803
+ options={"HIDDEN"},
804
+ )
805
+
806
+ collider_group_index: IntProperty( # type: ignore[valid-type]
807
+ min=0,
808
+ options={"HIDDEN"},
809
+ )
810
+ collider_index: IntProperty( # type: ignore[valid-type]
811
+ min=0,
812
+ options={"HIDDEN"},
813
+ )
814
+
815
+ def execute(self, context: Context) -> set[str]:
816
+ armature = context.blend_data.objects.get(self.armature_object_name)
817
+ if armature is None or armature.type != "ARMATURE":
818
+ return {"CANCELLED"}
819
+ armature_data = armature.data
820
+ if not isinstance(armature_data, Armature):
821
+ return {"CANCELLED"}
822
+ collider_groups = get_armature_extension(
823
+ armature_data
824
+ ).vrm0.secondary_animation.collider_groups
825
+ if len(collider_groups) <= self.collider_group_index:
826
+ return {"CANCELLED"}
827
+ collider_group = collider_groups[self.collider_group_index]
828
+ if len(collider_group.colliders) <= self.collider_index:
829
+ return {"CANCELLED"}
830
+ new_index = (self.collider_index - 1) % len(collider_group.colliders)
831
+ collider_group.colliders.move(self.collider_index, new_index)
832
+ collider_group.active_collider_index = new_index
833
+ return {"FINISHED"}
834
+
835
+ if TYPE_CHECKING:
836
+ # This code is auto generated.
837
+ # To regenerate, run the `uv run tools/property_typing.py` command.
838
+ armature_object_name: str # type: ignore[no-redef]
839
+ collider_group_index: int # type: ignore[no-redef]
840
+ collider_index: int # type: ignore[no-redef]
841
+
842
+
843
+ class VRM_OT_move_down_vrm0_secondary_animation_collider_group_collider(Operator):
844
+ bl_idname = "vrm.move_down_vrm0_secondary_animation_collider_group_coll"
845
+ bl_label = "Move Down Collider"
846
+ bl_description = "Move Down VRM 0.x Collider"
847
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
848
+
849
+ armature_object_name: StringProperty( # type: ignore[valid-type]
850
+ options={"HIDDEN"},
851
+ )
852
+
853
+ collider_group_index: IntProperty( # type: ignore[valid-type]
854
+ min=0,
855
+ options={"HIDDEN"},
856
+ )
857
+ collider_index: IntProperty( # type: ignore[valid-type]
858
+ min=0,
859
+ options={"HIDDEN"},
860
+ )
861
+
862
+ def execute(self, context: Context) -> set[str]:
863
+ armature = context.blend_data.objects.get(self.armature_object_name)
864
+ if armature is None or armature.type != "ARMATURE":
865
+ return {"CANCELLED"}
866
+ armature_data = armature.data
867
+ if not isinstance(armature_data, Armature):
868
+ return {"CANCELLED"}
869
+ collider_groups = get_armature_extension(
870
+ armature_data
871
+ ).vrm0.secondary_animation.collider_groups
872
+ if len(collider_groups) <= self.collider_group_index:
873
+ return {"CANCELLED"}
874
+ collider_group = collider_groups[self.collider_group_index]
875
+ if len(collider_group.colliders) <= self.collider_index:
876
+ return {"CANCELLED"}
877
+ new_index = (self.collider_index + 1) % len(collider_group.colliders)
878
+ collider_group.colliders.move(self.collider_index, new_index)
879
+ collider_group.active_collider_index = new_index
880
+ return {"FINISHED"}
881
+
882
+ if TYPE_CHECKING:
883
+ # This code is auto generated.
884
+ # To regenerate, run the `uv run tools/property_typing.py` command.
885
+ armature_object_name: str # type: ignore[no-redef]
886
+ collider_group_index: int # type: ignore[no-redef]
887
+ collider_index: int # type: ignore[no-redef]
888
+
889
+
890
+ class VRM_OT_add_vrm0_secondary_animation_group_bone(Operator):
891
+ bl_idname = "vrm.add_vrm0_secondary_animation_group_bone"
892
+ bl_label = "Add Bone"
893
+ bl_description = "Add VRM 0.x Secondary Animation Group Bone"
894
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
895
+
896
+ armature_object_name: StringProperty( # type: ignore[valid-type]
897
+ options={"HIDDEN"},
898
+ )
899
+
900
+ bone_group_index: IntProperty( # type: ignore[valid-type]
901
+ min=0,
902
+ options={"HIDDEN"},
903
+ )
904
+
905
+ def execute(self, context: Context) -> set[str]:
906
+ armature = context.blend_data.objects.get(self.armature_object_name)
907
+ if armature is None or armature.type != "ARMATURE":
908
+ return {"CANCELLED"}
909
+ armature_data = armature.data
910
+ if not isinstance(armature_data, Armature):
911
+ return {"CANCELLED"}
912
+ bone_groups = get_armature_extension(
913
+ armature_data
914
+ ).vrm0.secondary_animation.bone_groups
915
+ if len(bone_groups) <= self.bone_group_index:
916
+ return {"CANCELLED"}
917
+ bone_group = bone_groups[self.bone_group_index]
918
+ bone_group.bones.add()
919
+ bone_group.active_bone_index = len(bone_group.bones) - 1
920
+ return {"FINISHED"}
921
+
922
+ if TYPE_CHECKING:
923
+ # This code is auto generated.
924
+ # To regenerate, run the `uv run tools/property_typing.py` command.
925
+ armature_object_name: str # type: ignore[no-redef]
926
+ bone_group_index: int # type: ignore[no-redef]
927
+
928
+
929
+ class VRM_OT_remove_vrm0_secondary_animation_group_bone(Operator):
930
+ bl_idname = "vrm.remove_vrm0_secondary_animation_group_bone"
931
+ bl_label = "Remove Bone"
932
+ bl_description = "Remove VRM 0.x Secondary Animation Group Bone"
933
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
934
+
935
+ armature_object_name: StringProperty( # type: ignore[valid-type]
936
+ options={"HIDDEN"},
937
+ )
938
+
939
+ bone_group_index: IntProperty( # type: ignore[valid-type]
940
+ min=0,
941
+ options={"HIDDEN"},
942
+ )
943
+ bone_index: IntProperty( # type: ignore[valid-type]
944
+ min=0,
945
+ options={"HIDDEN"},
946
+ )
947
+
948
+ def execute(self, context: Context) -> set[str]:
949
+ armature = context.blend_data.objects.get(self.armature_object_name)
950
+ if armature is None or armature.type != "ARMATURE":
951
+ return {"CANCELLED"}
952
+ armature_data = armature.data
953
+ if not isinstance(armature_data, Armature):
954
+ return {"CANCELLED"}
955
+ bone_groups = get_armature_extension(
956
+ armature_data
957
+ ).vrm0.secondary_animation.bone_groups
958
+ if len(bone_groups) <= self.bone_group_index:
959
+ return {"CANCELLED"}
960
+ bone_group = bone_groups[self.bone_group_index]
961
+ if len(bone_group.bones) <= self.bone_index:
962
+ return {"CANCELLED"}
963
+ bone_group.bones.remove(self.bone_index)
964
+ bone_group.active_bone_index = min(
965
+ bone_group.active_bone_index, max(0, len(bone_group.bones) - 1)
966
+ )
967
+ return {"FINISHED"}
968
+
969
+ if TYPE_CHECKING:
970
+ # This code is auto generated.
971
+ # To regenerate, run the `uv run tools/property_typing.py` command.
972
+ armature_object_name: str # type: ignore[no-redef]
973
+ bone_group_index: int # type: ignore[no-redef]
974
+ bone_index: int # type: ignore[no-redef]
975
+
976
+
977
+ class VRM_OT_move_up_vrm0_secondary_animation_group_bone(Operator):
978
+ bl_idname = "vrm.move_up_vrm0_secondary_animation_group_bone"
979
+ bl_label = "Move Up Bone"
980
+ bl_description = "Move Up VRM 0.x Secondary Animation Group Bone"
981
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
982
+
983
+ armature_object_name: StringProperty( # type: ignore[valid-type]
984
+ options={"HIDDEN"},
985
+ )
986
+
987
+ bone_group_index: IntProperty( # type: ignore[valid-type]
988
+ min=0,
989
+ options={"HIDDEN"},
990
+ )
991
+ bone_index: IntProperty( # type: ignore[valid-type]
992
+ min=0,
993
+ options={"HIDDEN"},
994
+ )
995
+
996
+ def execute(self, context: Context) -> set[str]:
997
+ armature = context.blend_data.objects.get(self.armature_object_name)
998
+ if armature is None or armature.type != "ARMATURE":
999
+ return {"CANCELLED"}
1000
+ armature_data = armature.data
1001
+ if not isinstance(armature_data, Armature):
1002
+ return {"CANCELLED"}
1003
+ bone_groups = get_armature_extension(
1004
+ armature_data
1005
+ ).vrm0.secondary_animation.bone_groups
1006
+ if len(bone_groups) <= self.bone_group_index:
1007
+ return {"CANCELLED"}
1008
+ bone_group = bone_groups[self.bone_group_index]
1009
+ if len(bone_group.bones) <= self.bone_index:
1010
+ return {"CANCELLED"}
1011
+ new_index = (self.bone_index - 1) % len(bone_group.bones)
1012
+ bone_group.bones.move(self.bone_index, new_index)
1013
+ bone_group.active_bone_index = new_index
1014
+ return {"FINISHED"}
1015
+
1016
+ if TYPE_CHECKING:
1017
+ # This code is auto generated.
1018
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1019
+ armature_object_name: str # type: ignore[no-redef]
1020
+ bone_group_index: int # type: ignore[no-redef]
1021
+ bone_index: int # type: ignore[no-redef]
1022
+
1023
+
1024
+ class VRM_OT_move_down_vrm0_secondary_animation_group_bone(Operator):
1025
+ bl_idname = "vrm.move_down_vrm0_secondary_animation_group_bone"
1026
+ bl_label = "Move Down Bone"
1027
+ bl_description = "Move Down VRM 0.x Secondary Animation Group Bone"
1028
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1029
+
1030
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1031
+ options={"HIDDEN"},
1032
+ )
1033
+
1034
+ bone_group_index: IntProperty( # type: ignore[valid-type]
1035
+ min=0,
1036
+ options={"HIDDEN"},
1037
+ )
1038
+ bone_index: IntProperty( # type: ignore[valid-type]
1039
+ min=0,
1040
+ options={"HIDDEN"},
1041
+ )
1042
+
1043
+ def execute(self, context: Context) -> set[str]:
1044
+ armature = context.blend_data.objects.get(self.armature_object_name)
1045
+ if armature is None or armature.type != "ARMATURE":
1046
+ return {"CANCELLED"}
1047
+ armature_data = armature.data
1048
+ if not isinstance(armature_data, Armature):
1049
+ return {"CANCELLED"}
1050
+ bone_groups = get_armature_extension(
1051
+ armature_data
1052
+ ).vrm0.secondary_animation.bone_groups
1053
+ if len(bone_groups) <= self.bone_group_index:
1054
+ return {"CANCELLED"}
1055
+ bone_group = bone_groups[self.bone_group_index]
1056
+ if len(bone_group.bones) <= self.bone_index:
1057
+ return {"CANCELLED"}
1058
+ new_index = (self.bone_index + 1) % len(bone_group.bones)
1059
+ bone_group.bones.move(self.bone_index, new_index)
1060
+ bone_group.active_bone_index = new_index
1061
+ return {"FINISHED"}
1062
+
1063
+ if TYPE_CHECKING:
1064
+ # This code is auto generated.
1065
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1066
+ armature_object_name: str # type: ignore[no-redef]
1067
+ bone_group_index: int # type: ignore[no-redef]
1068
+ bone_index: int # type: ignore[no-redef]
1069
+
1070
+
1071
+ class VRM_OT_add_vrm0_secondary_animation_group_collider_group(Operator):
1072
+ bl_idname = "vrm.add_vrm0_secondary_animation_group_collider_group"
1073
+ bl_label = "Add Collider Group"
1074
+ bl_description = "Add VRM 0.x Secondary Animation Group Collider Group"
1075
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1076
+
1077
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1078
+ options={"HIDDEN"},
1079
+ )
1080
+
1081
+ bone_group_index: IntProperty( # type: ignore[valid-type]
1082
+ min=0,
1083
+ options={"HIDDEN"},
1084
+ )
1085
+
1086
+ def execute(self, context: Context) -> set[str]:
1087
+ armature = context.blend_data.objects.get(self.armature_object_name)
1088
+ if armature is None or armature.type != "ARMATURE":
1089
+ return {"CANCELLED"}
1090
+ armature_data = armature.data
1091
+ if not isinstance(armature_data, Armature):
1092
+ return {"CANCELLED"}
1093
+ bone_groups = get_armature_extension(
1094
+ armature_data
1095
+ ).vrm0.secondary_animation.bone_groups
1096
+ if len(bone_groups) <= self.bone_group_index:
1097
+ return {"CANCELLED"}
1098
+ bone_group = bone_groups[self.bone_group_index]
1099
+ bone_group.collider_groups.add()
1100
+ bone_group.active_collider_group_index = len(bone_group.collider_groups) - 1
1101
+ return {"FINISHED"}
1102
+
1103
+ if TYPE_CHECKING:
1104
+ # This code is auto generated.
1105
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1106
+ armature_object_name: str # type: ignore[no-redef]
1107
+ bone_group_index: int # type: ignore[no-redef]
1108
+
1109
+
1110
+ class VRM_OT_assign_vrm0_secondary_animation_group_collider_group(Operator):
1111
+ bl_idname = "vrm.assign_vrm0_secondary_animation_group_collider_group"
1112
+ bl_label = "Assign Collider Group"
1113
+ bl_description = "Assign VRM 0.x Secondary Animation Group Collider Group"
1114
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1115
+
1116
+ armature_data_name: StringProperty( # type: ignore[valid-type]
1117
+ options={"HIDDEN"},
1118
+ )
1119
+ collider_group_reference_path: StringProperty( # type: ignore[valid-type]
1120
+ options={"HIDDEN"},
1121
+ )
1122
+ collider_group_uuid: StringProperty( # type: ignore[valid-type]
1123
+ options={"HIDDEN"},
1124
+ )
1125
+
1126
+ def execute(self, context: Context) -> set[str]:
1127
+ armature_data = context.blend_data.armatures.get(self.armature_data_name)
1128
+ if not isinstance(armature_data, Armature):
1129
+ return {"CANCELLED"}
1130
+
1131
+ collider_group_reference = armature_data.path_resolve(
1132
+ self.collider_group_reference_path,
1133
+ False,
1134
+ )
1135
+ if not isinstance(
1136
+ collider_group_reference,
1137
+ Vrm0SecondaryAnimationColliderGroupReferencePropertyGroup,
1138
+ ):
1139
+ return {"CANCELLED"}
1140
+
1141
+ if not self.collider_group_uuid:
1142
+ collider_group_reference.collider_group_uuid = ""
1143
+ return {"FINISHED"}
1144
+
1145
+ vrm0 = get_armature_extension(armature_data).vrm0
1146
+ secondary_animation = vrm0.secondary_animation
1147
+ for collider_group in secondary_animation.collider_groups:
1148
+ if collider_group.uuid != self.collider_group_uuid:
1149
+ continue
1150
+ collider_group_reference.collider_group_uuid = collider_group.uuid
1151
+ return {"FINISHED"}
1152
+
1153
+ return {"CANCELLED"}
1154
+
1155
+ if TYPE_CHECKING:
1156
+ # This code is auto generated.
1157
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1158
+ armature_data_name: str # type: ignore[no-redef]
1159
+ collider_group_reference_path: str # type: ignore[no-redef]
1160
+ collider_group_uuid: str # type: ignore[no-redef]
1161
+
1162
+
1163
+ class VRM_OT_unassign_vrm0_secondary_animation_group_collider_group(Operator):
1164
+ bl_idname = "vrm.unassign_vrm0_secondary_animation_group_collider_group"
1165
+ bl_label = "Unassign Collider Group"
1166
+ bl_description = "Unassign VRM 0.x Secondary Animation Group Collider Group"
1167
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1168
+
1169
+ armature_data_name: StringProperty( # type: ignore[valid-type]
1170
+ options={"HIDDEN"},
1171
+ )
1172
+ collider_group_reference_path: StringProperty( # type: ignore[valid-type]
1173
+ options={"HIDDEN"},
1174
+ )
1175
+
1176
+ def execute(self, context: Context) -> set[str]:
1177
+ armature_data = context.blend_data.armatures.get(self.armature_data_name)
1178
+ if not isinstance(armature_data, Armature):
1179
+ return {"CANCELLED"}
1180
+
1181
+ collider_group_reference = armature_data.path_resolve(
1182
+ self.collider_group_reference_path,
1183
+ False,
1184
+ )
1185
+ if not isinstance(
1186
+ collider_group_reference,
1187
+ Vrm0SecondaryAnimationColliderGroupReferencePropertyGroup,
1188
+ ):
1189
+ return {"CANCELLED"}
1190
+
1191
+ collider_group_reference.collider_group_uuid = ""
1192
+ return {"FINISHED"}
1193
+
1194
+ if TYPE_CHECKING:
1195
+ # This code is auto generated.
1196
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1197
+ armature_data_name: str # type: ignore[no-redef]
1198
+ collider_group_reference_path: str # type: ignore[no-redef]
1199
+
1200
+
1201
+ class VRM_OT_remove_vrm0_secondary_animation_group_collider_group(Operator):
1202
+ bl_idname = "vrm.remove_vrm0_secondary_animation_group_collider_group"
1203
+ bl_label = "Remove Collider Group"
1204
+ bl_description = "Remove VRM 0.x Secondary Animation Group Collider Group"
1205
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1206
+
1207
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1208
+ options={"HIDDEN"},
1209
+ )
1210
+
1211
+ bone_group_index: IntProperty( # type: ignore[valid-type]
1212
+ min=0,
1213
+ options={"HIDDEN"},
1214
+ )
1215
+ collider_group_index: IntProperty( # type: ignore[valid-type]
1216
+ min=0,
1217
+ options={"HIDDEN"},
1218
+ )
1219
+
1220
+ def execute(self, context: Context) -> set[str]:
1221
+ armature = context.blend_data.objects.get(self.armature_object_name)
1222
+ if armature is None or armature.type != "ARMATURE":
1223
+ return {"CANCELLED"}
1224
+ armature_data = armature.data
1225
+ if not isinstance(armature_data, Armature):
1226
+ return {"CANCELLED"}
1227
+ bone_groups = get_armature_extension(
1228
+ armature_data
1229
+ ).vrm0.secondary_animation.bone_groups
1230
+ if len(bone_groups) <= self.bone_group_index:
1231
+ return {"CANCELLED"}
1232
+ bone_group = bone_groups[self.bone_group_index]
1233
+ if len(bone_group.collider_groups) <= self.collider_group_index:
1234
+ return {"CANCELLED"}
1235
+ bone_group.collider_groups.remove(self.collider_group_index)
1236
+ bone_group.active_collider_group_index = min(
1237
+ bone_group.active_collider_group_index,
1238
+ max(0, len(bone_group.collider_groups) - 1),
1239
+ )
1240
+ return {"FINISHED"}
1241
+
1242
+ if TYPE_CHECKING:
1243
+ # This code is auto generated.
1244
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1245
+ armature_object_name: str # type: ignore[no-redef]
1246
+ bone_group_index: int # type: ignore[no-redef]
1247
+ collider_group_index: int # type: ignore[no-redef]
1248
+
1249
+
1250
+ class VRM_OT_move_up_vrm0_secondary_animation_group_collider_group(Operator):
1251
+ bl_idname = "vrm.move_up_vrm0_secondary_animation_group_collider_group"
1252
+ bl_label = "Move Up Collider Group"
1253
+ bl_description = "Move Up VRM 0.x Secondary Animation Group Collider Group"
1254
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1255
+
1256
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1257
+ options={"HIDDEN"},
1258
+ )
1259
+
1260
+ bone_group_index: IntProperty( # type: ignore[valid-type]
1261
+ min=0,
1262
+ options={"HIDDEN"},
1263
+ )
1264
+ collider_group_index: IntProperty( # type: ignore[valid-type]
1265
+ min=0,
1266
+ options={"HIDDEN"},
1267
+ )
1268
+
1269
+ def execute(self, context: Context) -> set[str]:
1270
+ armature = context.blend_data.objects.get(self.armature_object_name)
1271
+ if armature is None or armature.type != "ARMATURE":
1272
+ return {"CANCELLED"}
1273
+ armature_data = armature.data
1274
+ if not isinstance(armature_data, Armature):
1275
+ return {"CANCELLED"}
1276
+ bone_groups = get_armature_extension(
1277
+ armature_data
1278
+ ).vrm0.secondary_animation.bone_groups
1279
+ if len(bone_groups) <= self.bone_group_index:
1280
+ return {"CANCELLED"}
1281
+ bone_group = bone_groups[self.bone_group_index]
1282
+ if len(bone_group.collider_groups) <= self.collider_group_index:
1283
+ return {"CANCELLED"}
1284
+ new_index = (self.collider_group_index - 1) % len(bone_group.collider_groups)
1285
+ bone_group.collider_groups.move(self.collider_group_index, new_index)
1286
+ bone_group.active_collider_group_index = new_index
1287
+ return {"FINISHED"}
1288
+
1289
+ if TYPE_CHECKING:
1290
+ # This code is auto generated.
1291
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1292
+ armature_object_name: str # type: ignore[no-redef]
1293
+ bone_group_index: int # type: ignore[no-redef]
1294
+ collider_group_index: int # type: ignore[no-redef]
1295
+
1296
+
1297
+ class VRM_OT_move_down_vrm0_secondary_animation_group_collider_group(Operator):
1298
+ bl_idname = "vrm.move_down_vrm0_secondary_animation_group_collider_group"
1299
+ bl_label = "Move Down Collider Group"
1300
+ bl_description = "Move Down VRM 0.x Secondary Animation Group Collider Group"
1301
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1302
+
1303
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1304
+ options={"HIDDEN"},
1305
+ )
1306
+
1307
+ bone_group_index: IntProperty( # type: ignore[valid-type]
1308
+ min=0,
1309
+ options={"HIDDEN"},
1310
+ )
1311
+ collider_group_index: IntProperty( # type: ignore[valid-type]
1312
+ min=0,
1313
+ options={"HIDDEN"},
1314
+ )
1315
+
1316
+ def execute(self, context: Context) -> set[str]:
1317
+ armature = context.blend_data.objects.get(self.armature_object_name)
1318
+ if armature is None or armature.type != "ARMATURE":
1319
+ return {"CANCELLED"}
1320
+ armature_data = armature.data
1321
+ if not isinstance(armature_data, Armature):
1322
+ return {"CANCELLED"}
1323
+ bone_groups = get_armature_extension(
1324
+ armature_data
1325
+ ).vrm0.secondary_animation.bone_groups
1326
+ if len(bone_groups) <= self.bone_group_index:
1327
+ return {"CANCELLED"}
1328
+ bone_group = bone_groups[self.bone_group_index]
1329
+ if len(bone_group.collider_groups) <= self.collider_group_index:
1330
+ return {"CANCELLED"}
1331
+ new_index = (self.collider_group_index + 1) % len(bone_group.collider_groups)
1332
+ bone_group.collider_groups.move(self.collider_group_index, new_index)
1333
+ bone_group.active_collider_group_index = new_index
1334
+ return {"FINISHED"}
1335
+
1336
+ if TYPE_CHECKING:
1337
+ # This code is auto generated.
1338
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1339
+ armature_object_name: str # type: ignore[no-redef]
1340
+ bone_group_index: int # type: ignore[no-redef]
1341
+ collider_group_index: int # type: ignore[no-redef]
1342
+
1343
+
1344
+ class VRM_OT_add_vrm0_blend_shape_group(Operator):
1345
+ bl_idname = "vrm.add_vrm0_blend_shape_group"
1346
+ bl_label = "Add Blend Shape Group"
1347
+ bl_description = "Add VRM 0.x Blend Shape Group"
1348
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1349
+
1350
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1351
+ options={"HIDDEN"},
1352
+ )
1353
+
1354
+ name: StringProperty( # type: ignore[valid-type]
1355
+ options={"HIDDEN"}
1356
+ )
1357
+
1358
+ def execute(self, context: Context) -> set[str]:
1359
+ armature = context.blend_data.objects.get(self.armature_object_name)
1360
+ if armature is None or armature.type != "ARMATURE":
1361
+ return {"CANCELLED"}
1362
+ armature_data = armature.data
1363
+ if not isinstance(armature_data, Armature):
1364
+ return {"CANCELLED"}
1365
+ blend_shape_master = get_armature_extension(
1366
+ armature_data
1367
+ ).vrm0.blend_shape_master
1368
+ blend_shape_group = blend_shape_master.blend_shape_groups.add()
1369
+ blend_shape_group.name = self.name
1370
+ blend_shape_master.active_blend_shape_group_index = (
1371
+ len(blend_shape_master.blend_shape_groups) - 1
1372
+ )
1373
+ return {"FINISHED"}
1374
+
1375
+ if TYPE_CHECKING:
1376
+ # This code is auto generated.
1377
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1378
+ armature_object_name: str # type: ignore[no-redef]
1379
+ name: str # type: ignore[no-redef]
1380
+
1381
+
1382
+ class VRM_OT_remove_vrm0_blend_shape_group(Operator):
1383
+ bl_idname = "vrm.remove_vrm0_blend_shape_group"
1384
+ bl_label = "Remove Blend Shape Group"
1385
+ bl_description = "Remove VRM 0.x Blend Shape Group"
1386
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1387
+
1388
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1389
+ options={"HIDDEN"},
1390
+ )
1391
+
1392
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
1393
+ min=0,
1394
+ options={"HIDDEN"},
1395
+ )
1396
+
1397
+ def execute(self, context: Context) -> set[str]:
1398
+ armature = context.blend_data.objects.get(self.armature_object_name)
1399
+ if armature is None or armature.type != "ARMATURE":
1400
+ return {"CANCELLED"}
1401
+ armature_data = armature.data
1402
+ if not isinstance(armature_data, Armature):
1403
+ return {"CANCELLED"}
1404
+ blend_shape_master = get_armature_extension(
1405
+ armature_data
1406
+ ).vrm0.blend_shape_master
1407
+ if len(blend_shape_master.blend_shape_groups) <= self.blend_shape_group_index:
1408
+ return {"CANCELLED"}
1409
+ blend_shape_master.blend_shape_groups.remove(self.blend_shape_group_index)
1410
+ blend_shape_master.active_blend_shape_group_index = min(
1411
+ blend_shape_master.active_blend_shape_group_index,
1412
+ max(0, len(blend_shape_master.blend_shape_groups) - 1),
1413
+ )
1414
+ return {"FINISHED"}
1415
+
1416
+ if TYPE_CHECKING:
1417
+ # This code is auto generated.
1418
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1419
+ armature_object_name: str # type: ignore[no-redef]
1420
+ blend_shape_group_index: int # type: ignore[no-redef]
1421
+
1422
+
1423
+ class VRM_OT_move_up_vrm0_blend_shape_group(Operator):
1424
+ bl_idname = "vrm.move_up_vrm0_blend_shape_group"
1425
+ bl_label = "Move Up Blend Shape Group"
1426
+ bl_description = "Move Up VRM 0.x Blend Shape Group"
1427
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1428
+
1429
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1430
+ options={"HIDDEN"},
1431
+ )
1432
+
1433
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
1434
+ min=0,
1435
+ options={"HIDDEN"},
1436
+ )
1437
+
1438
+ def execute(self, context: Context) -> set[str]:
1439
+ armature = context.blend_data.objects.get(self.armature_object_name)
1440
+ if armature is None or armature.type != "ARMATURE":
1441
+ return {"CANCELLED"}
1442
+ armature_data = armature.data
1443
+ if not isinstance(armature_data, Armature):
1444
+ return {"CANCELLED"}
1445
+ blend_shape_master = get_armature_extension(
1446
+ armature_data
1447
+ ).vrm0.blend_shape_master
1448
+ if len(blend_shape_master.blend_shape_groups) <= self.blend_shape_group_index:
1449
+ return {"CANCELLED"}
1450
+ new_index = (self.blend_shape_group_index - 1) % len(
1451
+ blend_shape_master.blend_shape_groups
1452
+ )
1453
+ blend_shape_master.blend_shape_groups.move(
1454
+ self.blend_shape_group_index, new_index
1455
+ )
1456
+ blend_shape_master.active_blend_shape_group_index = new_index
1457
+ return {"FINISHED"}
1458
+
1459
+ if TYPE_CHECKING:
1460
+ # This code is auto generated.
1461
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1462
+ armature_object_name: str # type: ignore[no-redef]
1463
+ blend_shape_group_index: int # type: ignore[no-redef]
1464
+
1465
+
1466
+ class VRM_OT_move_down_vrm0_blend_shape_group(Operator):
1467
+ bl_idname = "vrm.move_down_vrm0_blend_shape_group"
1468
+ bl_label = "Move Down Blend Shape Group"
1469
+ bl_description = "Move Down VRM 0.x Blend Shape Group"
1470
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1471
+
1472
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1473
+ options={"HIDDEN"},
1474
+ )
1475
+
1476
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
1477
+ min=0,
1478
+ options={"HIDDEN"},
1479
+ )
1480
+
1481
+ def execute(self, context: Context) -> set[str]:
1482
+ armature = context.blend_data.objects.get(self.armature_object_name)
1483
+ if armature is None or armature.type != "ARMATURE":
1484
+ return {"CANCELLED"}
1485
+ armature_data = armature.data
1486
+ if not isinstance(armature_data, Armature):
1487
+ return {"CANCELLED"}
1488
+ blend_shape_master = get_armature_extension(
1489
+ armature_data
1490
+ ).vrm0.blend_shape_master
1491
+ if len(blend_shape_master.blend_shape_groups) <= self.blend_shape_group_index:
1492
+ return {"CANCELLED"}
1493
+ new_index = (self.blend_shape_group_index + 1) % len(
1494
+ blend_shape_master.blend_shape_groups
1495
+ )
1496
+ blend_shape_master.blend_shape_groups.move(
1497
+ self.blend_shape_group_index, new_index
1498
+ )
1499
+ blend_shape_master.active_blend_shape_group_index = new_index
1500
+ return {"FINISHED"}
1501
+
1502
+ if TYPE_CHECKING:
1503
+ # This code is auto generated.
1504
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1505
+ armature_object_name: str # type: ignore[no-redef]
1506
+ blend_shape_group_index: int # type: ignore[no-redef]
1507
+
1508
+
1509
+ class VRM_OT_add_vrm0_secondary_animation_group(Operator):
1510
+ bl_idname = "vrm.add_vrm0_secondary_animation_group"
1511
+ bl_label = "Add Spring Bone"
1512
+ bl_description = "Add VRM 0.x Secondary Animation Group"
1513
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1514
+
1515
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1516
+ options={"HIDDEN"},
1517
+ )
1518
+
1519
+ # Unnecessary property. Please do not use.
1520
+ blend_shape_group_index: IntProperty( # type: ignore[valid-type]
1521
+ min=0,
1522
+ options={"HIDDEN"},
1523
+ )
1524
+
1525
+ def execute(self, context: Context) -> set[str]:
1526
+ armature = context.blend_data.objects.get(self.armature_object_name)
1527
+ if armature is None or armature.type != "ARMATURE":
1528
+ return {"CANCELLED"}
1529
+ armature_data = armature.data
1530
+ if not isinstance(armature_data, Armature):
1531
+ return {"CANCELLED"}
1532
+ secondary_animation = get_armature_extension(
1533
+ armature_data
1534
+ ).vrm0.secondary_animation
1535
+ secondary_animation.bone_groups.add()
1536
+ secondary_animation.active_bone_group_index = (
1537
+ len(secondary_animation.bone_groups) - 1
1538
+ )
1539
+ return {"FINISHED"}
1540
+
1541
+ if TYPE_CHECKING:
1542
+ # This code is auto generated.
1543
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1544
+ armature_object_name: str # type: ignore[no-redef]
1545
+ blend_shape_group_index: int # type: ignore[no-redef]
1546
+
1547
+
1548
+ class VRM_OT_remove_vrm0_secondary_animation_group(Operator):
1549
+ bl_idname = "vrm.remove_vrm0_secondary_animation_group"
1550
+ bl_label = "Remove Spring Bone"
1551
+ bl_description = "Remove VRM 0.x Secondary Animation Group"
1552
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1553
+
1554
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1555
+ options={"HIDDEN"},
1556
+ )
1557
+
1558
+ bone_group_index: IntProperty( # type: ignore[valid-type]
1559
+ min=0,
1560
+ options={"HIDDEN"},
1561
+ )
1562
+
1563
+ def execute(self, context: Context) -> set[str]:
1564
+ armature = context.blend_data.objects.get(self.armature_object_name)
1565
+ if armature is None or armature.type != "ARMATURE":
1566
+ return {"CANCELLED"}
1567
+ armature_data = armature.data
1568
+ if not isinstance(armature_data, Armature):
1569
+ return {"CANCELLED"}
1570
+ secondary_animation = get_armature_extension(
1571
+ armature_data
1572
+ ).vrm0.secondary_animation
1573
+ if len(secondary_animation.bone_groups) <= self.bone_group_index:
1574
+ return {"CANCELLED"}
1575
+ secondary_animation.bone_groups.remove(self.bone_group_index)
1576
+ secondary_animation.active_bone_group_index = min(
1577
+ secondary_animation.active_bone_group_index,
1578
+ max(0, len(secondary_animation.bone_groups) - 1),
1579
+ )
1580
+ return {"FINISHED"}
1581
+
1582
+ if TYPE_CHECKING:
1583
+ # This code is auto generated.
1584
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1585
+ armature_object_name: str # type: ignore[no-redef]
1586
+ bone_group_index: int # type: ignore[no-redef]
1587
+
1588
+
1589
+ class VRM_OT_move_up_vrm0_secondary_animation_group(Operator):
1590
+ bl_idname = "vrm.move_up_vrm0_secondary_animation_group"
1591
+ bl_label = "Move Up Spring Bone"
1592
+ bl_description = "Move Up VRM 0.x Secondary Animation Group"
1593
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1594
+
1595
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1596
+ options={"HIDDEN"},
1597
+ )
1598
+
1599
+ bone_group_index: IntProperty( # type: ignore[valid-type]
1600
+ min=0,
1601
+ options={"HIDDEN"},
1602
+ )
1603
+
1604
+ def execute(self, context: Context) -> set[str]:
1605
+ armature = context.blend_data.objects.get(self.armature_object_name)
1606
+ if armature is None or armature.type != "ARMATURE":
1607
+ return {"CANCELLED"}
1608
+ armature_data = armature.data
1609
+ if not isinstance(armature_data, Armature):
1610
+ return {"CANCELLED"}
1611
+ secondary_animation = get_armature_extension(
1612
+ armature_data
1613
+ ).vrm0.secondary_animation
1614
+ if len(secondary_animation.bone_groups) <= self.bone_group_index:
1615
+ return {"CANCELLED"}
1616
+ new_index = (self.bone_group_index - 1) % len(secondary_animation.bone_groups)
1617
+ secondary_animation.bone_groups.move(self.bone_group_index, new_index)
1618
+ secondary_animation.active_bone_group_index = new_index
1619
+ return {"FINISHED"}
1620
+
1621
+ if TYPE_CHECKING:
1622
+ # This code is auto generated.
1623
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1624
+ armature_object_name: str # type: ignore[no-redef]
1625
+ bone_group_index: int # type: ignore[no-redef]
1626
+
1627
+
1628
+ class VRM_OT_move_down_vrm0_secondary_animation_group(Operator):
1629
+ bl_idname = "vrm.move_down_vrm0_secondary_animation_group"
1630
+ bl_label = "Move Down Spring Bone"
1631
+ bl_description = "Move Down VRM 0.x Secondary Animation Group"
1632
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1633
+
1634
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1635
+ options={"HIDDEN"},
1636
+ )
1637
+
1638
+ bone_group_index: IntProperty( # type: ignore[valid-type]
1639
+ min=0,
1640
+ options={"HIDDEN"},
1641
+ )
1642
+
1643
+ def execute(self, context: Context) -> set[str]:
1644
+ armature = context.blend_data.objects.get(self.armature_object_name)
1645
+ if armature is None or armature.type != "ARMATURE":
1646
+ return {"CANCELLED"}
1647
+ armature_data = armature.data
1648
+ if not isinstance(armature_data, Armature):
1649
+ return {"CANCELLED"}
1650
+ secondary_animation = get_armature_extension(
1651
+ armature_data
1652
+ ).vrm0.secondary_animation
1653
+ if len(secondary_animation.bone_groups) <= self.bone_group_index:
1654
+ return {"CANCELLED"}
1655
+ new_index = (self.bone_group_index + 1) % len(secondary_animation.bone_groups)
1656
+ secondary_animation.bone_groups.move(self.bone_group_index, new_index)
1657
+ secondary_animation.active_bone_group_index = new_index
1658
+ return {"FINISHED"}
1659
+
1660
+ if TYPE_CHECKING:
1661
+ # This code is auto generated.
1662
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1663
+ armature_object_name: str # type: ignore[no-redef]
1664
+ bone_group_index: int # type: ignore[no-redef]
1665
+
1666
+
1667
+ class VRM_OT_add_vrm0_secondary_animation_collider_group(Operator):
1668
+ bl_idname = "vrm.add_vrm0_secondary_animation_collider_group"
1669
+ bl_label = "Add Collider Group"
1670
+ bl_description = "Add VRM 0.x Secondary Animation Collider Group"
1671
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1672
+
1673
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1674
+ options={"HIDDEN"},
1675
+ )
1676
+
1677
+ def execute(self, context: Context) -> set[str]:
1678
+ armature = context.blend_data.objects.get(self.armature_object_name)
1679
+ if armature is None or armature.type != "ARMATURE":
1680
+ return {"CANCELLED"}
1681
+ armature_data = armature.data
1682
+ if not isinstance(armature_data, Armature):
1683
+ return {"CANCELLED"}
1684
+ ext = get_armature_extension(armature_data)
1685
+ secondary_animation = ext.vrm0.secondary_animation
1686
+ collider_group = secondary_animation.collider_groups.add()
1687
+ collider_group.uuid = uuid.uuid4().hex
1688
+ collider_group.fixup(armature)
1689
+ secondary_animation.active_collider_group_index = (
1690
+ len(secondary_animation.collider_groups) - 1
1691
+ )
1692
+ return {"FINISHED"}
1693
+
1694
+ if TYPE_CHECKING:
1695
+ # This code is auto generated.
1696
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1697
+ armature_object_name: str # type: ignore[no-redef]
1698
+
1699
+
1700
+ class VRM_OT_remove_vrm0_secondary_animation_collider_group(Operator):
1701
+ bl_idname = "vrm.remove_vrm0_secondary_animation_collider_group"
1702
+ bl_label = "Remove Collider Group"
1703
+ bl_description = "Remove VRM 0.x Secondary Animation Collider Group"
1704
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1705
+
1706
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1707
+ options={"HIDDEN"},
1708
+ )
1709
+
1710
+ collider_group_index: IntProperty( # type: ignore[valid-type]
1711
+ min=0,
1712
+ options={"HIDDEN"},
1713
+ )
1714
+
1715
+ def execute(self, context: Context) -> set[str]:
1716
+ armature = context.blend_data.objects.get(self.armature_object_name)
1717
+ if armature is None or armature.type != "ARMATURE":
1718
+ return {"CANCELLED"}
1719
+ armature_data = armature.data
1720
+ if not isinstance(armature_data, Armature):
1721
+ return {"CANCELLED"}
1722
+ secondary_animation = get_armature_extension(
1723
+ armature_data
1724
+ ).vrm0.secondary_animation
1725
+ if len(secondary_animation.collider_groups) <= self.collider_group_index:
1726
+ return {"CANCELLED"}
1727
+ secondary_animation.collider_groups.remove(self.collider_group_index)
1728
+
1729
+ for bone_group in secondary_animation.bone_groups:
1730
+ bone_group.fixup()
1731
+
1732
+ secondary_animation.active_collider_group_index = min(
1733
+ secondary_animation.active_collider_group_index,
1734
+ max(0, len(secondary_animation.collider_groups) - 1),
1735
+ )
1736
+ return {"FINISHED"}
1737
+
1738
+ if TYPE_CHECKING:
1739
+ # This code is auto generated.
1740
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1741
+ armature_object_name: str # type: ignore[no-redef]
1742
+ collider_group_index: int # type: ignore[no-redef]
1743
+
1744
+
1745
+ class VRM_OT_move_up_vrm0_secondary_animation_collider_group(Operator):
1746
+ bl_idname = "vrm.move_up_vrm0_secondary_animation_collider_group"
1747
+ bl_label = "Move Up Collider Group"
1748
+ bl_description = "Move Up VRM 0.x Secondary Animation Collider Group"
1749
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1750
+
1751
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1752
+ options={"HIDDEN"},
1753
+ )
1754
+
1755
+ collider_group_index: IntProperty( # type: ignore[valid-type]
1756
+ min=0,
1757
+ options={"HIDDEN"},
1758
+ )
1759
+
1760
+ def execute(self, context: Context) -> set[str]:
1761
+ armature = context.blend_data.objects.get(self.armature_object_name)
1762
+ if armature is None or armature.type != "ARMATURE":
1763
+ return {"CANCELLED"}
1764
+ armature_data = armature.data
1765
+ if not isinstance(armature_data, Armature):
1766
+ return {"CANCELLED"}
1767
+ secondary_animation = get_armature_extension(
1768
+ armature_data
1769
+ ).vrm0.secondary_animation
1770
+ if len(secondary_animation.collider_groups) <= self.collider_group_index:
1771
+ return {"CANCELLED"}
1772
+ new_index = (self.collider_group_index - 1) % len(
1773
+ secondary_animation.collider_groups
1774
+ )
1775
+ secondary_animation.collider_groups.move(self.collider_group_index, new_index)
1776
+ secondary_animation.active_collider_group_index = new_index
1777
+ return {"FINISHED"}
1778
+
1779
+ if TYPE_CHECKING:
1780
+ # This code is auto generated.
1781
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1782
+ armature_object_name: str # type: ignore[no-redef]
1783
+ collider_group_index: int # type: ignore[no-redef]
1784
+
1785
+
1786
+ class VRM_OT_move_down_vrm0_secondary_animation_collider_group(Operator):
1787
+ bl_idname = "vrm.move_down_vrm0_secondary_animation_collider_group"
1788
+ bl_label = "Move Down Collider Group"
1789
+ bl_description = "Move Down VRM 0.x Secondary Animation Collider Group"
1790
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1791
+
1792
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1793
+ options={"HIDDEN"},
1794
+ )
1795
+
1796
+ collider_group_index: IntProperty( # type: ignore[valid-type]
1797
+ min=0,
1798
+ options={"HIDDEN"},
1799
+ )
1800
+
1801
+ def execute(self, context: Context) -> set[str]:
1802
+ armature = context.blend_data.objects.get(self.armature_object_name)
1803
+ if armature is None or armature.type != "ARMATURE":
1804
+ return {"CANCELLED"}
1805
+ armature_data = armature.data
1806
+ if not isinstance(armature_data, Armature):
1807
+ return {"CANCELLED"}
1808
+ secondary_animation = get_armature_extension(
1809
+ armature_data
1810
+ ).vrm0.secondary_animation
1811
+ if len(secondary_animation.collider_groups) <= self.collider_group_index:
1812
+ return {"CANCELLED"}
1813
+ new_index = (self.collider_group_index + 1) % len(
1814
+ secondary_animation.collider_groups
1815
+ )
1816
+ secondary_animation.collider_groups.move(self.collider_group_index, new_index)
1817
+ secondary_animation.active_collider_group_index = new_index
1818
+ return {"FINISHED"}
1819
+
1820
+ if TYPE_CHECKING:
1821
+ # This code is auto generated.
1822
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1823
+ armature_object_name: str # type: ignore[no-redef]
1824
+ collider_group_index: int # type: ignore[no-redef]
1825
+
1826
+
1827
+ class VRM_OT_assign_vrm0_humanoid_human_bones_automatically(Operator):
1828
+ bl_idname = "vrm.assign_vrm0_humanoid_human_bones_automatically"
1829
+ bl_label = "Automatic Bone Assignment"
1830
+ bl_description = "Assign VRM 0.x Humanoid Human Bones"
1831
+ bl_options: ClassVar = {"REGISTER", "UNDO"}
1832
+
1833
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1834
+ options={"HIDDEN"},
1835
+ )
1836
+
1837
+ def execute(self, context: Context) -> set[str]:
1838
+ armature = context.blend_data.objects.get(self.armature_object_name)
1839
+ if not armature:
1840
+ return {"CANCELLED"}
1841
+ return assign_vrm0_humanoid_human_bones_automatically(context, armature)
1842
+
1843
+ if TYPE_CHECKING:
1844
+ # This code is auto generated.
1845
+ # To regenerate, run the `uv run tools/property_typing.py` command.
1846
+ armature_object_name: str # type: ignore[no-redef]
1847
+
1848
+
1849
+ def assign_vrm0_humanoid_human_bones_automatically(
1850
+ context: Context, armature: Object
1851
+ ) -> set[str]:
1852
+ if armature.type != "ARMATURE":
1853
+ return {"CANCELLED"}
1854
+ armature_data = armature.data
1855
+ if not isinstance(armature_data, Armature):
1856
+ return {"CANCELLED"}
1857
+ Vrm0HumanoidPropertyGroup.fixup_human_bones(armature)
1858
+ humanoid = get_armature_extension(armature_data).vrm0.humanoid
1859
+ bones = armature_data.bones
1860
+
1861
+ default_mapping = {
1862
+ bone_name: HumanBoneSpecifications.get(human_bone_name)
1863
+ for human_bone in humanoid.human_bones
1864
+ if (bone_name := human_bone.node.bone_name)
1865
+ and (human_bone_name := HumanBoneName.from_str(human_bone.bone))
1866
+ }
1867
+ default_requied_bone_count = sum(
1868
+ 1
1869
+ for human_bone_specification in default_mapping.values()
1870
+ if human_bone_specification.requirement
1871
+ )
1872
+
1873
+ generated_mapping = create_human_bone_mapping(armature)
1874
+ generated_required_bone_count = sum(
1875
+ 1
1876
+ for vrm1_human_bone_specification in generated_mapping.values()
1877
+ if HumanBoneSpecifications.get(
1878
+ vrm1_human_bone_specification.vrm0_name
1879
+ ).requirement
1880
+ )
1881
+
1882
+ if default_requied_bone_count > generated_required_bone_count:
1883
+ return {"CANCELLED"}
1884
+
1885
+ for human_bone in humanoid.human_bones:
1886
+ human_bone.node.bone_name = ""
1887
+
1888
+ for (
1889
+ bone_name,
1890
+ vrm1_specification,
1891
+ ) in generated_mapping.items():
1892
+ bone = bones.get(bone_name)
1893
+ if not bone:
1894
+ continue
1895
+ human_bone_name = vrm1_specification.vrm0_name
1896
+
1897
+ for human_bone in humanoid.human_bones:
1898
+ if (
1899
+ human_bone.bone != human_bone_name.value
1900
+ or human_bone.node.bone_name in human_bone.node.bone_name_candidates
1901
+ or bone_name not in human_bone.node.bone_name_candidates
1902
+ ):
1903
+ continue
1904
+ human_bone.node.bone_name = bone_name
1905
+ break
1906
+
1907
+ Vrm0HumanoidPropertyGroup.update_all_bone_name_candidates(
1908
+ context, armature_data.name, force=True
1909
+ )
1910
+ return {"FINISHED"}
1911
+
1912
+
1913
+ def draw_bone_prop_search(
1914
+ layout: UILayout,
1915
+ human_bone_specification: HumanBoneSpecification,
1916
+ armature: Object,
1917
+ *,
1918
+ show_diagnostics: bool = True,
1919
+ ) -> None:
1920
+ armature_data = armature.data
1921
+ if not isinstance(armature_data, Armature):
1922
+ return
1923
+
1924
+ humanoid = get_armature_extension(armature_data).vrm0.humanoid
1925
+
1926
+ human_bone = next(
1927
+ (
1928
+ human_bone
1929
+ for human_bone in humanoid.human_bones
1930
+ if human_bone.bone == human_bone_specification.name.value
1931
+ ),
1932
+ None,
1933
+ )
1934
+ if not human_bone:
1935
+ return
1936
+
1937
+ row = VRM_MT_bone_assignment.draw_input_layout(
1938
+ layout,
1939
+ human_bone.node,
1940
+ text="",
1941
+ icon=human_bone_specification.icon,
1942
+ simple=not humanoid.filter_by_human_bone_hierarchy,
1943
+ )
1944
+
1945
+ if not show_diagnostics:
1946
+ return
1947
+
1948
+ bone_name = human_bone.node.bone_name
1949
+ if humanoid.filter_by_human_bone_hierarchy:
1950
+ if bone_name and bone_name not in human_bone.node.bone_name_candidates:
1951
+ icon = "ERROR"
1952
+ row.alert = True
1953
+ else:
1954
+ icon = "VIEWZOOM"
1955
+ elif bone_name and any(
1956
+ it.node.bone_name == bone_name and it != human_bone
1957
+ for it in humanoid.human_bones
1958
+ ):
1959
+ icon = "ERROR"
1960
+ row.alert = True
1961
+ else:
1962
+ return
1963
+
1964
+ op = layout_operator(
1965
+ row,
1966
+ VRM_OT_show_vrm0_bone_assignment_diagnostics,
1967
+ text="",
1968
+ translate=False,
1969
+ icon=icon,
1970
+ )
1971
+ op.armature_object_name = armature.name
1972
+ op.human_bone_name = human_bone_specification.name.value
1973
+
1974
+
1975
+ class VRM_OT_show_vrm0_bone_assignment_diagnostics(Operator):
1976
+ bl_idname = "vrm.show_vrm0_bone_assignment_diagnostics"
1977
+ bl_label = "Bone Assignment Diagnostics"
1978
+ bl_description = (
1979
+ "Shows the cause of the bone assignment error"
1980
+ + " or the reason why none of the bone assignment candidates exist."
1981
+ )
1982
+
1983
+ def execute(self, _context: Context) -> set[str]:
1984
+ return {"FINISHED"}
1985
+
1986
+ armature_object_name: StringProperty( # type: ignore[valid-type]
1987
+ options={"HIDDEN"}
1988
+ )
1989
+
1990
+ human_bone_name: StringProperty( # type: ignore[valid-type]
1991
+ options={"HIDDEN"}
1992
+ )
1993
+
1994
+ def invoke(self, context: Context, _event: Event) -> set[str]:
1995
+ obj = context.blend_data.objects.get(self.armature_object_name)
1996
+ if not obj or obj.type != "ARMATURE":
1997
+ return {"CANCELLED"}
1998
+
1999
+ if not HumanBoneName.from_str(self.human_bone_name):
2000
+ return {"CANCELLED"}
2001
+
2002
+ return context.window_manager.invoke_props_dialog(self, width=800)
2003
+
2004
+ def draw(self, context: Context) -> None:
2005
+ armature = context.blend_data.objects.get(self.armature_object_name)
2006
+ if not armature:
2007
+ return
2008
+ armature_data = armature.data
2009
+ if not isinstance(armature_data, Armature):
2010
+ return
2011
+ human_bone_name = HumanBoneName.from_str(self.human_bone_name)
2012
+ if not human_bone_name:
2013
+ return
2014
+ human_bone_specification = HumanBoneSpecifications.get(human_bone_name)
2015
+
2016
+ layout = self.layout.box()
2017
+ head_row = layout.row()
2018
+ head_row.alignment = "LEFT"
2019
+ head_row.label(
2020
+ text=pgettext('Assignment of the VRM Human Bone "{vrm_human_bone}"').format(
2021
+ vrm_human_bone=human_bone_specification.title
2022
+ ),
2023
+ icon="ARMATURE_DATA",
2024
+ )
2025
+ draw_bone_prop_search(
2026
+ head_row, human_bone_specification, armature, show_diagnostics=False
2027
+ )
2028
+ help_op = layout_operator(
2029
+ head_row,
2030
+ VRM_OT_open_url_in_web_browser,
2031
+ icon="URL",
2032
+ text="Open help in a Web Browser",
2033
+ )
2034
+ help_op.url = pgettext(
2035
+ "https://github.com/vrm-c/vrm-specification/blob/c24d76d99a18738dd2c266be1c83f089064a7b5e/specification/VRMC_vrm-1.0/humanoid.md#humanoid-bone-parent-child-relationship"
2036
+ )
2037
+
2038
+ ext = get_armature_extension(armature_data)
2039
+ humanoid = ext.vrm0.humanoid
2040
+ human_bone = next(
2041
+ (
2042
+ human_bone
2043
+ for human_bone in humanoid.human_bones
2044
+ if human_bone.bone == human_bone_name.value
2045
+ ),
2046
+ None,
2047
+ )
2048
+ if not human_bone:
2049
+ return
2050
+
2051
+ if not humanoid.filter_by_human_bone_hierarchy:
2052
+ error_messages = humanoid.human_bone_duplication_error_messages()
2053
+ for bone_name, line in error_messages:
2054
+ if human_bone.node.bone_name == bone_name:
2055
+ layout.label(text=line, icon="ERROR", translate=False)
2056
+ if not error_messages and human_bone.node.bone_name:
2057
+ text = pgettext(
2058
+ 'The bone "{bone_name}" of the armature "{armature_object_name}"'
2059
+ + ' can be assigned to the VRM Human Bone "{human_bone_name}".'
2060
+ ).format(
2061
+ armature_object_name=self.armature_object_name,
2062
+ bone_name=human_bone.node.bone_name,
2063
+ human_bone_name=human_bone_specification.title,
2064
+ )
2065
+ layout.label(
2066
+ text=text,
2067
+ translate=False,
2068
+ icon="CHECKMARK",
2069
+ )
2070
+ return
2071
+
2072
+ bone_name = human_bone.node.bone_name
2073
+ if bone_name in human_bone.node.bone_name_candidates:
2074
+ layout.label(
2075
+ text=pgettext(
2076
+ 'The bone "{bone_name}" of the armature "{armature_object_name}"'
2077
+ + ' can be assigned to the VRM Human Bone "{human_bone_name}".'
2078
+ ).format(
2079
+ armature_object_name=self.armature_object_name,
2080
+ bone_name=bone_name,
2081
+ human_bone_name=human_bone_specification.title,
2082
+ ),
2083
+ translate=False,
2084
+ icon="CHECKMARK",
2085
+ )
2086
+ elif bone_name:
2087
+ layout.label(
2088
+ text=pgettext(
2089
+ 'The bone "{bone_name}" of the armature "{armature_object_name}"'
2090
+ + ' cannot be assigned to the VRM Human Bone "{human_bone_name}".'
2091
+ ).format(
2092
+ armature_object_name=self.armature_object_name,
2093
+ bone_name=bone_name,
2094
+ human_bone_name=human_bone_specification.title,
2095
+ ),
2096
+ translate=False,
2097
+ icon="ERROR",
2098
+ )
2099
+ elif not human_bone.node.bone_name_candidates:
2100
+ layout.label(
2101
+ text=pgettext(
2102
+ 'The armature "{armature_object_name}" does not have any bones'
2103
+ + ' that can be assigned to the VRM Human Bone "{human_bone_name}".'
2104
+ ).format(
2105
+ armature_object_name=self.armature_object_name,
2106
+ human_bone_name=human_bone_specification.title,
2107
+ ),
2108
+ translate=False,
2109
+ icon="ERROR",
2110
+ )
2111
+
2112
+ bpy_bone_name_to_human_bone_specification: dict[
2113
+ str, HumanBoneSpecification
2114
+ ] = {}
2115
+ error_bpy_bone_names = list[str]()
2116
+
2117
+ for human_bone in humanoid.human_bones:
2118
+ human_bone_name = HumanBoneName.from_str(human_bone.bone)
2119
+ if not human_bone_name:
2120
+ continue
2121
+ bpy_bone_name = human_bone.node.bone_name
2122
+ if not bpy_bone_name:
2123
+ continue
2124
+ if bpy_bone_name not in human_bone.node.bone_name_candidates:
2125
+ error_bpy_bone_names.append(bpy_bone_name)
2126
+ bpy_bone_name_to_human_bone_specification[bpy_bone_name] = (
2127
+ HumanBoneSpecifications.get(human_bone_name)
2128
+ )
2129
+
2130
+ Vrm0HumanoidPropertyGroup.update_all_bone_name_candidates(
2131
+ context, armature_data.name
2132
+ )
2133
+ HumanoidStructureBonePropertyGroup.find_bone_candidates(
2134
+ armature_data,
2135
+ human_bone_specification,
2136
+ bpy_bone_name_to_human_bone_specification,
2137
+ error_bpy_bone_names,
2138
+ layout,
2139
+ )
2140
+
2141
+ if TYPE_CHECKING:
2142
+ # This code is auto generated.
2143
+ # To regenerate, run the `uv run tools/property_typing.py` command.
2144
+ armature_object_name: str # type: ignore[no-redef]
2145
+ human_bone_name: str # type: ignore[no-redef]