Revision: 32652
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32652
Author:   jesterking
Date:     2010-10-22 13:51:10 +0200 (Fri, 22 Oct 2010)

Log Message:
-----------
Export UV Layout to PNG would fail if original mesh didn't have materials 
assigned.
Reported in #blender.fi by Mats Holmberg

Modified Paths:
--------------
    trunk/blender/release/scripts/op/uv.py

Modified: trunk/blender/release/scripts/op/uv.py
===================================================================
--- trunk/blender/release/scripts/op/uv.py      2010-10-22 11:38:10 UTC (rev 
32651)
+++ trunk/blender/release/scripts/op/uv.py      2010-10-22 11:51:10 UTC (rev 
32652)
@@ -166,8 +166,13 @@
     # place behind the wire
     obj_solid.location = 0, 0, -1
     
-    obj_wire.material_slots[0].link = 'OBJECT'
-    obj_wire.material_slots[0].material = material_wire
+    try:
+        obj_wire.material_slots[0].link = 'OBJECT'
+        obj_wire.material_slots[0].material = material_wire
+    except: # orig object didn't have material, add one here
+        obj_wire.data.materials.append(material_wire)
+        obj_wire.material_slots[0].link = 'OBJECT'
+        obj_wire.material_slots[0].material = material_wire
     
     
     # setup the camera


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to