[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4641] trunk/py/scripts/addons/ uv_texture_atlas.py: [TextureAtlas] add a material if there are no slots at all for temoporary object.
paul geraskin
paul_geraskin at mail.ru
Tue Jul 30 12:04:34 CEST 2013
Revision: 4641
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4641
Author: mifth
Date: 2013-07-30 10:04:33 +0000 (Tue, 30 Jul 2013)
Log Message:
-----------
[TextureAtlas] add a material if there are no slots at all for temoporary object.
Modified Paths:
--------------
trunk/py/scripts/addons/uv_texture_atlas.py
Modified: trunk/py/scripts/addons/uv_texture_atlas.py
===================================================================
--- trunk/py/scripts/addons/uv_texture_atlas.py 2013-07-29 19:44:32 UTC (rev 4640)
+++ trunk/py/scripts/addons/uv_texture_atlas.py 2013-07-30 10:04:33 UTC (rev 4641)
@@ -615,6 +615,18 @@
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 @@
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'}
More information about the Bf-extensions-cvs
mailing list