[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4796] trunk/py/scripts/addons/ uv_texture_atlas.py: replace inline poll with real poll().

Campbell Barton ideasman42 at gmail.com
Sun Oct 13 16:21:39 CEST 2013


Revision: 4796
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4796
Author:   campbellbarton
Date:     2013-10-13 14:21:39 +0000 (Sun, 13 Oct 2013)
Log Message:
-----------
replace inline poll with real poll().

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-10-12 17:02:41 UTC (rev 4795)
+++ trunk/py/scripts/addons/uv_texture_atlas.py	2013-10-13 14:21:39 UTC (rev 4796)
@@ -144,7 +144,7 @@
         group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
         context.area.type = 'VIEW_3D'
 
-        if context.mode is not 'OBJECT' and scene.objects.active is not None:
+        if bpy.ops.object.mode_set.poll():
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
 
         if group.bake is True and bpy.data.groups[group.name].objects:
@@ -183,7 +183,7 @@
         context.area.type = 'VIEW_3D'
         group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
 
-        if context.mode is not 'OBJECT' and scene.objects.active is not None:
+        if bpy.ops.object.mode_set.poll():
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
 
         if group.bake is True and bpy.data.groups[group.name].objects and bpy.data.objects.get(group.name + "_mergedObject") is None:
@@ -221,7 +221,7 @@
         group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
         context.area.type = 'VIEW_3D'
 
-        if context.mode is not 'OBJECT' and scene.objects.active is not None:
+        if bpy.ops.object.mode_set.poll():
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
 
         if group.bake is True and bpy.data.groups[group.name].objects:
@@ -304,7 +304,7 @@
             obj_group = bpy.data.groups.new(group_name)
 
         # Add objects to  a group
-        if context.mode is not 'OBJECT' and scene.objects.active is not None:
+        if bpy.ops.object.mode_set.poll():
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
 
         for object in context.selected_objects:
@@ -328,7 +328,7 @@
         if check_group_exist(self, context) is False:
             return {'CANCELLED'}
 
-        if context.mode is not 'OBJECT' and scene.objects.active is not None:
+        if bpy.ops.object.mode_set.poll():
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
 
         bpy.ops.object.select_all(action='DESELECT')
@@ -354,7 +354,7 @@
         if check_group_exist(self, context) is False:
             return {'CANCELLED'}
 
-        if context.mode is not 'OBJECT' and scene.objects.active is not None:
+        if bpy.ops.object.mode_set.poll():
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
 
         for group in scene.ms_lightmap_groups:
@@ -392,7 +392,7 @@
         if check_group_exist(self, context) is False:
             return {'CANCELLED'}
 
-        if context.mode is not 'OBJECT' and scene.objects.active is not None:
+        if bpy.ops.object.mode_set.poll():
             bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
         # bpy.ops.object.select_all(action='DESELECT')
 



More information about the Bf-extensions-cvs mailing list