Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Geraskin <paul_geraskin@mail.ru>2013-07-30 14:04:33 +0400
committerPaul Geraskin <paul_geraskin@mail.ru>2013-07-30 14:04:33 +0400
commit0c72812d920ff02de10c11e0ba763cb0485d81e3 (patch)
tree2b4ea5767e55220ac3e4433230b58ba55a2a5c0a /uv_texture_atlas.py
parentca6cbf143821e314200016a2702144efc73e4fea (diff)
[TextureAtlas] add a material if there are no slots at all for temoporary object.
Diffstat (limited to 'uv_texture_atlas.py')
-rw-r--r--uv_texture_atlas.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/uv_texture_atlas.py b/uv_texture_atlas.py
index 271c1d89..3dbf8cb7 100644
--- a/uv_texture_atlas.py
+++ b/uv_texture_atlas.py
@@ -615,6 +615,18 @@ class MergeObjects(Operator):
item = ob_merge.ms_merged_objects.add()
item.name = object.name
+ # Add material to a tempObject if there are no materialSlots on the object
+ if len(activeNowObject.material_slots) == 0:
+ mat = None
+ matName = "zz_TextureAtlas_NO_Material"
+
+ if bpy.data.materials.get(matName) is None:
+ mat = bpy.data.materials.new(matName)
+ else:
+ mat = bpy.data.materials[matName]
+
+ activeNowObject.data.materials.append(mat)
+
# merge objects together
bpy.ops.object.select_all(action='DESELECT')
activeNowObject.select = True
@@ -640,10 +652,6 @@ class MergeObjects(Operator):
PREF_APPLY_IMAGE=False, PREF_IMG_PX_SIZE=1024, PREF_BOX_DIV=48, PREF_MARGIN_DIV=0.2)
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
- # remove all materials
- # for material in ob_merge.material_slots:
- # bpy.ops.object.material_slot_remove()
-
return{'FINISHED'}