- Add core VRM addon infrastructure with manifest and registration - Add common utilities module with file system, logging, and conversion helpers - Add human bone mapper with support for multiple rigging standards (Mixamo, MMD, Unreal, Rigify, etc.) - Add VRM 0.x and 1.x format support with property groups and handlers - Add editor UI panels for VRM metadata, spring bones, and MToon materials - Add exporter with glTF2 extension support for VRM format serialization - Add importer with scene reconstruction and armature generation - Add MToon shader support with auto-setup and material migration - Add spring bone physics simulation with constraint handling - Add node constraint editor for advanced rigging control - Add comprehensive validation and error handling with user dialogs - Add scene watcher for real-time property synchronization - Add workspace management and preference system - Include Python cache files and Blender manifest configuration - This is the initial commit establishing the complete VRM addon ecosystem for Blender
84 lines
2.4 KiB
Python
84 lines
2.4 KiB
Python
# SPDX-License-Identifier: MIT OR GPL-3.0-or-later
|
|
from typing import TYPE_CHECKING
|
|
|
|
from bpy.props import StringProperty
|
|
from bpy.types import Context, Event, FileHandler, Operator
|
|
|
|
from ..common import ops
|
|
|
|
|
|
class VRM_OT_import_vrm_via_file_handler(Operator):
|
|
bl_idname = "vrm.import_vrm_via_file_handler"
|
|
bl_label = "Import VRM via FileHandler"
|
|
|
|
filepath: StringProperty( # type: ignore[valid-type]
|
|
subtype="FILE_PATH",
|
|
options={"SKIP_SAVE"},
|
|
)
|
|
|
|
@classmethod
|
|
def poll(cls, _context: Context) -> bool:
|
|
return True
|
|
|
|
def execute(self, _context: Context) -> set[str]:
|
|
return ops.import_scene.vrm(filepath=self.filepath, use_addon_preferences=True)
|
|
|
|
def invoke(self, context: Context, _event: Event) -> set[str]:
|
|
return self.execute(context)
|
|
|
|
if TYPE_CHECKING:
|
|
# This code is auto generated.
|
|
# To regenerate, run the `uv run tools/property_typing.py` command.
|
|
filepath: str # type: ignore[no-redef]
|
|
|
|
|
|
class VRM_OT_import_vrma_via_file_handler(Operator):
|
|
bl_idname = "vrm.import_vrma_via_file_handler"
|
|
bl_label = "Import VRMA via FileHandler"
|
|
|
|
filepath: StringProperty( # type: ignore[valid-type]
|
|
subtype="FILE_PATH",
|
|
options={"SKIP_SAVE"},
|
|
)
|
|
|
|
@classmethod
|
|
def poll(cls, _context: Context) -> bool:
|
|
return True
|
|
|
|
def execute(self, _context: Context) -> set[str]:
|
|
return ops.import_scene.vrma(filepath=self.filepath)
|
|
|
|
def invoke(self, context: Context, _event: Event) -> set[str]:
|
|
return self.execute(context)
|
|
|
|
if TYPE_CHECKING:
|
|
# This code is auto generated.
|
|
# To regenerate, run the `uv run tools/property_typing.py` command.
|
|
filepath: str # type: ignore[no-redef]
|
|
|
|
|
|
class VRM_FH_vrm_import(FileHandler):
|
|
bl_idname = "VRM_FH_vrm_import"
|
|
bl_label = "Import VRM"
|
|
bl_import_operator = VRM_OT_import_vrm_via_file_handler.bl_idname
|
|
bl_export_operator = "export_scene.vrm"
|
|
bl_file_extensions = ".vrm"
|
|
|
|
@classmethod
|
|
def poll_drop(cls, context: Context) -> bool:
|
|
_ = context
|
|
return True
|
|
|
|
|
|
class VRM_FH_vrma_import(FileHandler):
|
|
bl_idname = "VRM_FH_vrma_import"
|
|
bl_label = "Import VRMA"
|
|
bl_import_operator = VRM_OT_import_vrma_via_file_handler.bl_idname
|
|
bl_export_operator = "export_scene.vrma"
|
|
bl_file_extensions = ".vrma"
|
|
|
|
@classmethod
|
|
def poll_drop(cls, context: Context) -> bool:
|
|
_ = context
|
|
return True
|