feat: Add VRM Blender addon with complete import/export functionality
- 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
This commit is contained in:
36
common/convert_any.py
Normal file
36
common/convert_any.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# SPDX-License-Identifier: MIT OR GPL-3.0-or-later
|
||||
"""A module provides a function to convert a variable of type Any to a concrete type.
|
||||
|
||||
Inevitably, variables of type Any may occur, and such variables cannot be handled
|
||||
in type checkers in strict mode. Any is allowed only in the module here.
|
||||
"""
|
||||
|
||||
import sys
|
||||
from collections.abc import Iterator
|
||||
from typing import (
|
||||
Any, # Any is allowed only in the module here.
|
||||
Optional,
|
||||
)
|
||||
|
||||
|
||||
def to_object( # type: ignore[explicit-any]
|
||||
any_object: Any, # noqa: ANN401 # Any is allowed only in the module here.
|
||||
) -> object:
|
||||
# Interpret Unknown as object
|
||||
# https://github.com/microsoft/pyright/issues/3650
|
||||
if not isinstance(any_object, object):
|
||||
if sys.version_info >= (3, 11):
|
||||
from typing import assert_never
|
||||
|
||||
assert_never(any_object)
|
||||
raise TypeError
|
||||
return any_object
|
||||
|
||||
|
||||
def iterator_to_object_iterator( # type: ignore[explicit-any]
|
||||
any_iterator: Any, # noqa: ANN401 # Any is allowed only in the module here.
|
||||
) -> Optional[Iterator[object]]:
|
||||
any_iterator_without_partial_type_narrowing = any_iterator
|
||||
if not isinstance(any_iterator, Iterator):
|
||||
return None
|
||||
return map(to_object, any_iterator_without_partial_type_narrowing)
|
||||
Reference in New Issue
Block a user