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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Letwory <nathan@letworyinteractive.com>2010-10-22 15:51:10 +0400
committerNathan Letwory <nathan@letworyinteractive.com>2010-10-22 15:51:10 +0400
commit7b573e0f265496e4fe02c4e29253913ec6a15da0 (patch)
tree4621d88c0e7dad5a810c9dbff08bb74cd321c7e0
parentd3ac70909ef88eb3a76ab9f875491bbb62ed2bf0 (diff)
Export UV Layout to PNG would fail if original mesh didn't have materials assigned.
Reported in #blender.fi by Mats Holmberg
-rw-r--r--release/scripts/op/uv.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py
index 8fea37ef420..5ab1507a6a6 100644
--- a/release/scripts/op/uv.py
+++ b/release/scripts/op/uv.py
@@ -166,8 +166,13 @@ def write_png(fw, mesh_source, image_width, image_height, face_iter):
# 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