diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-06-10 08:10:25 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-06-10 08:10:25 +0400 |
commit | 22e6e836fa26a8d8124f6022445694a457eaa064 (patch) | |
tree | 43929a20ed227ec212372e5c8d6b8737f5549e85 | |
parent | 4d2cbdb038da1bf011786ca07731d6df53ff5c12 (diff) |
bugfix for [#6818] object_find.py assumes active uv layer is set
was assuming meshes had UVs
-rw-r--r-- | release/scripts/object_find.py | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/release/scripts/object_find.py b/release/scripts/object_find.py index 4ce93998f00..0cfd6ad1d92 100644 --- a/release/scripts/object_find.py +++ b/release/scripts/object_find.py @@ -41,20 +41,27 @@ import BPyMessages def get_object_images(ob): # Could optimize this - if ob.type == 'Mesh': - unique_images = {} - me = ob.getData(mesh=1) - orig_uvlayer = me.activeUVLayer - - for uvlayer in me.getUVLayerNames(): - me.activeUVLayer = uvlayer - for f in me.faces: - i = f.image - if i: unique_images[i.name] = i - - me.activeUVLayer = orig_uvlayer - - return unique_images.values() + if ob.type != 'Mesh': + return [] + + me = ob.getData(mesh=1) + + if not me.faceUV: + return [] + + unique_images = {} + + orig_uvlayer = me.activeUVLayer + + for uvlayer in me.getUVLayerNames(): + me.activeUVLayer = uvlayer + for f in me.faces: + i = f.image + if i: unique_images[i.name] = i + + me.activeUVLayer = orig_uvlayer + + return unique_images.values() # Todo, support other object types, materials return [] |