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

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormifth <paulgeraskin@gmail.com>2017-05-11 23:50:03 +0300
committermifth <paulgeraskin@gmail.com>2017-05-11 23:50:03 +0300
commitd9e259cd94194c74387ff445a1623119a48505e8 (patch)
tree64b592c1cde8083f7103a7b6c99d37f370022f49 /uv_texture_atlas.py
parentc65d49dd969bf13fb0828d895f59aaec7d7ba5d2 (diff)
[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
Diffstat (limited to 'uv_texture_atlas.py')
-rw-r--r--uv_texture_atlas.py40
1 files changed, 31 insertions, 9 deletions
diff --git a/uv_texture_atlas.py b/uv_texture_atlas.py
index a97168f2..14db2e87 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'}