[Bf-extensions-cvs] [d9e259c] master: [TextureAtlas] Small fix for console according to this report https://blenderartists.org/forum/showthread.php?265750-TextureAtlas-create-LightMaps-ShadowMaps-for-entire-scene&p=3181636&viewfull=1#post3181636
mifth
noreply at git.blender.org
Thu May 11 22:50:06 CEST 2017
Commit: d9e259cd94194c74387ff445a1623119a48505e8
Author: mifth
Date: Thu May 11 23:50:03 2017 +0300
Branches: master
https://developer.blender.org/rBAd9e259cd94194c74387ff445a1623119a48505e8
[TextureAtlas] Small fix for console according to this report https://blenderartists.org/forum/showthread.php?265750-TextureAtlas-create-LightMaps-ShadowMaps-for-entire-scene&p=3181636&viewfull=1#post3181636
===================================================================
M uv_texture_atlas.py
===================================================================
diff --git a/uv_texture_atlas.py b/uv_texture_atlas.py
index a97168f..14db2e8 100644
--- a/uv_texture_atlas.py
+++ b/uv_texture_atlas.py
@@ -144,14 +144,19 @@ class TexAtl_RunAuto(Operator):
def execute(self, context):
scene = context.scene
- old_context = context.area.type
+
+ # get old context
+ old_context = None
+ if context.area:
+ old_context = context.area.type
# Check if group exists
if check_group_exist(self, context) is False:
return {'CANCELLED'}
group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
- context.area.type = 'VIEW_3D'
+ if context.area:
+ context.area.type = 'VIEW_3D'
if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
@@ -172,7 +177,9 @@ class TexAtl_RunAuto(Operator):
else:
self.report({'INFO'}, "Not All Objects Are Visible!!!")
- context.area.type = old_context
+ # set old context back
+ if context.area:
+ context.area.type = old_context
return{'FINISHED'}
@@ -184,13 +191,18 @@ class TexAtl_RunStart(Operator):
def execute(self, context):
scene = context.scene
- old_context = context.area.type
+
+ # get old context
+ old_context = None
+ if context.area:
+ old_context = context.area.type
# Check if group exists
if check_group_exist(self, context) is False:
return {'CANCELLED'}
- context.area.type = 'VIEW_3D'
+ if context.area:
+ context.area.type = 'VIEW_3D'
group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
if bpy.ops.object.mode_set.poll():
@@ -213,7 +225,9 @@ class TexAtl_RunStart(Operator):
bpy.ops.object.ms_merge_objects(
group_name=group.name, unwrap=False)
- context.area.type = old_context
+ # set old context back
+ if context.area:
+ context.area.type = old_context
return{'FINISHED'}
@@ -225,14 +239,19 @@ class TexAtl_RunFinish(Operator):
def execute(self, context):
scene = context.scene
- old_context = context.area.type
+
+ # get old context
+ old_context = None
+ if context.area:
+ old_context = context.area.type
# Check if group exists
if check_group_exist(self, context) is False:
return {'CANCELLED'}
group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
- context.area.type = 'VIEW_3D'
+ if context.area:
+ context.area.type = 'VIEW_3D'
if bpy.ops.object.mode_set.poll():
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
@@ -247,7 +266,10 @@ class TexAtl_RunFinish(Operator):
else:
self.report({'INFO'}, "Not All Objects Are Visible!!!")
- context.area.type = old_context
+ # set old context back
+ if context.area:
+ context.area.type = old_context
+
return{'FINISHED'}
More information about the Bf-extensions-cvs
mailing list