diff --git a/hecl/blender/addon/hmdl/__init__.py b/hecl/blender/addon/hmdl/__init__.py index 5f69cf4a2..6740e258b 100644 --- a/hecl/blender/addon/hmdl/__init__.py +++ b/hecl/blender/addon/hmdl/__init__.py @@ -291,8 +291,17 @@ def draw(layout, context): layout.prop(obj.data, 'hecl_active_material') layout.prop(obj.data, 'hecl_material_count') +# Material update +def material_update(self, context): + target_idx = self.hecl_active_material + if target_idx >= self.hecl_material_count or target_idx < 0: + return + slot_count = len(self.materials) + for mat_idx in range(slot_count): + for mat in bpy.data.materials: + if mat.name.endswith('_%u_%u' % (target_idx, mat_idx)): + self.materials[mat_idx] = mat -# Debug register operators import bpy def register(): bpy.types.Scene.hecl_mesh_obj = bpy.props.StringProperty( @@ -301,6 +310,8 @@ def register(): bpy.types.Scene.hecl_actor_obj = bpy.props.StringProperty( name='HECL Actor Object', description='Blender Empty Object to export during HECL\'s cook process') + bpy.types.Mesh.hecl_material_count = bpy.props.IntProperty(name='HECL Material Count', default=0, min=0) + bpy.types.Mesh.hecl_active_material = bpy.props.IntProperty(name='HECL Active Material', default=0, min=0, update=material_update) bpy.utils.register_class(HMDLShader.hecl_shader_operator) pass def unregister(): diff --git a/hecl/extern/RetroCommon b/hecl/extern/RetroCommon index 3c5b5fd39..0da7ab7e0 160000 --- a/hecl/extern/RetroCommon +++ b/hecl/extern/RetroCommon @@ -1 +1 @@ -Subproject commit 3c5b5fd39a015e0f30768576040677d416bce875 +Subproject commit 0da7ab7e01a305f0ecb7ec71d843b652002845f2