|
|
|
@@ -221,6 +221,28 @@ class MVAssignMaterials(bpy.types.Operator): |
|
|
|
bm.free() |
|
|
|
print("OK") |
|
|
|
bpy.ops.object.mode_set(mode = 'OBJECT') |
|
|
|
elif context.scene.mv_material_mode == 'OBJECT_NAMES': |
|
|
|
while len(object.material_slots) > 0: |
|
|
|
bpy.ops.object.material_slot_remove({'object': object}) |
|
|
|
|
|
|
|
light_choices = context.scene.mv_material_names_light.split(",") |
|
|
|
medium_choices = context.scene.mv_material_names_medium.split(",") |
|
|
|
|
|
|
|
bpy.ops.object.material_slot_add({'object': object}) |
|
|
|
missing_idx = len(object.material_slots) - 1 |
|
|
|
|
|
|
|
chosen = 'dark' |
|
|
|
|
|
|
|
if any([choice in object.name for choice in medium_choices]): |
|
|
|
chosen = 'medium' |
|
|
|
if any([choice in object.name for choice in light_choices]): |
|
|
|
chosen = 'light' |
|
|
|
|
|
|
|
object.material_slots[0].material = bpy.data.materials[chosen] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {'FINISHED'} |
|
|
|
|
|
|
|
|