added multiple material sets to addon

This commit is contained in:
Jack Andersen 2015-08-15 12:57:29 -10:00
parent a71b01d4a2
commit 4c6a934ada
2 changed files with 13 additions and 2 deletions

View File

@ -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():

@ -1 +1 @@
Subproject commit 3c5b5fd39a015e0f30768576040677d416bce875
Subproject commit 0da7ab7e01a305f0ecb7ec71d843b652002845f2