[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4583] contrib/py/scripts/addons/ uv_texture_atlas.py: [TextureAtlas] format the script according to pep8.
paul geraskin
paul_geraskin at mail.ru
Wed Jun 19 15:21:48 CEST 2013
Revision: 4583
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4583
Author: mifth
Date: 2013-06-19 13:21:47 +0000 (Wed, 19 Jun 2013)
Log Message:
-----------
[TextureAtlas] format the script according to pep8. Thanks to autopep8. :)
Modified Paths:
--------------
contrib/py/scripts/addons/uv_texture_atlas.py
Modified: contrib/py/scripts/addons/uv_texture_atlas.py
===================================================================
--- contrib/py/scripts/addons/uv_texture_atlas.py 2013-06-19 10:07:29 UTC (rev 4582)
+++ contrib/py/scripts/addons/uv_texture_atlas.py 2013-06-19 13:21:47 UTC (rev 4583)
@@ -1,4 +1,4 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
+# BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -14,8 +14,9 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
-# ##### END GPL LICENSE BLOCK #####
+# END GPL LICENSE BLOCK #####
+
bl_info = {
"name": "Texture Atlas",
"author": "Andreas Esau, Paul Geraskin",
@@ -53,440 +54,448 @@
row = self.layout.row()
split = self.layout.split()
- row.template_list("UI_UL_list", "template_list_controls", scene, "ms_lightmap_groups", scene, "ms_lightmap_groups_index", rows=2, maxrows=5)
+ row.template_list("UI_UL_list", "template_list_controls", scene,
+ "ms_lightmap_groups", scene, "ms_lightmap_groups_index", rows=2, maxrows=5)
col = row.column(align=True)
col.operator("scene.ms_add_lightmap_group", icon='ZOOMIN', text="")
col.operator("scene.ms_del_lightmap_group", icon='ZOOMOUT', text="")
-
+
row = self.layout.row(align=True)
# Resolution and Unwrap types (only if Lightmap group is added)
if context.scene.ms_lightmap_groups:
group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
- row.prop(group, 'resolution', text='Resolution',expand=True)
+ row.prop(group, 'resolution', text='Resolution', expand=True)
row = self.layout.row()
- row.prop(group, 'unwrap_type', text='Lightmap',expand=True)
- row = self.layout.row()
+ row.prop(group, 'unwrap_type', text='Lightmap', expand=True)
+ row = self.layout.row()
row = self.layout.row()
- row.operator("scene.ms_remove_other_uv", text="Remove Other UVs",icon="GROUP")
- row.operator("scene.ms_remove_selected", text="Remove Selected Group and UVs",icon="GROUP")
+ row.operator("scene.ms_remove_other_uv",
+ text="Remove Other UVs", icon="GROUP")
+ row.operator("scene.ms_remove_selected",
+ text="Remove Selected Group and UVs", icon="GROUP")
row = self.layout.row()
row = self.layout.row()
row = self.layout.row()
- row.operator("scene.ms_add_selected_to_group", text="Add Selection To Current Group",icon="GROUP")
- row.operator("scene.ms_select_group", text="Select Current Group",icon="GROUP")
+ row.operator("scene.ms_add_selected_to_group",
+ text="Add Selection To Current Group", icon="GROUP")
+ row.operator("scene.ms_select_group",
+ text="Select Current Group", icon="GROUP")
row = self.layout.row()
- row.operator("object.ms_auto",text="Auto Unwrap",icon="LAMP_SPOT")
- row = self.layout.row()
- row.operator("object.ms_run",text="Start Manual Unwrap/Bake",icon="LAMP_SPOT")
- row.operator("object.ms_run_remove",text="Finsh Manual Unwrap/Bake",icon="LAMP_SPOT")
+ row.operator(
+ "object.ms_auto", text="Auto Unwrap", icon="LAMP_SPOT")
+ row = self.layout.row()
+ row.operator(
+ "object.ms_run", text="Start Manual Unwrap/Bake", icon="LAMP_SPOT")
+ row.operator(
+ "object.ms_run_remove", text="Finsh Manual Unwrap/Bake", icon="LAMP_SPOT")
class runAuto(bpy.types.Operator):
bl_idname = "object.ms_auto"
bl_label = "Auto Unwrapping"
bl_description = "Auto Unwrapping"
-
+
def execute(self, context):
scene = context.scene
old_context = context.area.type
-
group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
context.area.type = 'VIEW_3D'
if scene.objects.active is not None:
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-
- if group.bake == True and bpy.data.groups[group.name].objects:
-
-
- # Check if objects are all on the visible Layers.
- isAllObjectsVisible = True
- bpy.ops.object.select_all(action='DESELECT')
- for thisObject in bpy.data.groups[group.name].objects:
- isThisObjectVisible = False
- scene.objects.active = thisObject
- for thisLayerNumb in range(20):
- if thisObject.layers[thisLayerNumb] == True and scene.layers[thisLayerNumb] == True:
- isThisObjectVisible = True
- break
- # If Object is on an invisible Layer
- if isThisObjectVisible == False:
- isAllObjectsVisible = False
-
- if isAllObjectsVisible == True:
- res = int(scene.ms_lightmap_groups[group.name].resolution)
- bpy.ops.object.ms_create_lightmap(group_name=group.name, resolution=res)
- bpy.ops.object.ms_merge_objects(group_name=group.name, unwrap=True)
- bpy.ops.object.ms_separate_objects(group_name=group.name)
- else:
- self.report({'INFO'}, "Not All Objects Are Visible!!!!")
-
+
+ if group.bake is True and bpy.data.groups[group.name].objects:
+
+ # Check if objects are all on the visible Layers.
+ isAllObjectsVisible = True
+ bpy.ops.object.select_all(action='DESELECT')
+ for thisObject in bpy.data.groups[group.name].objects:
+ isThisObjectVisible = False
+ scene.objects.active = thisObject
+ for thisLayerNumb in range(20):
+ if thisObject.layers[thisLayerNumb] is True and scene.layers[thisLayerNumb] is True:
+ isThisObjectVisible = True
+ break
+ # If Object is on an invisible Layer
+ if isThisObjectVisible is False:
+ isAllObjectsVisible = False
+
+ if isAllObjectsVisible is True:
+ res = int(scene.ms_lightmap_groups[group.name].resolution)
+ bpy.ops.object.ms_create_lightmap(
+ group_name=group.name, resolution=res)
+ bpy.ops.object.ms_merge_objects(
+ group_name=group.name, unwrap=True)
+ bpy.ops.object.ms_separate_objects(group_name=group.name)
+ else:
+ self.report({'INFO'}, "Not All Objects Are Visible!!!!")
+
context.area.type = old_context
- return{'FINISHED'}
-
-
+ return{'FINISHED'}
+
+
class runStart(bpy.types.Operator):
bl_idname = "object.ms_run"
bl_label = "Make Manual Unwrapping Object"
bl_description = "Makes Manual Unwrapping Object"
-
+
def execute(self, context):
scene = context.scene
old_context = context.area.type
-
group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
context.area.type = 'VIEW_3D'
if scene.objects.active is not None:
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-
- if group.bake == True and bpy.data.groups[group.name].objects:
- # Check if objects are all on the visible Layers.
- isAllObjectsVisible = True
- bpy.ops.object.select_all(action='DESELECT')
- for thisObject in bpy.data.groups[group.name].objects:
- isThisObjectVisible = False
- scene.objects.active = thisObject
- for thisLayerNumb in range(20):
- if thisObject.layers[thisLayerNumb] == True and scene.layers[thisLayerNumb] == True:
- isThisObjectVisible = True
- break
- # If Object is on an invisible Layer
- if isThisObjectVisible == False:
- isAllObjectsVisible = False
-
- if isAllObjectsVisible == True:
- res = int(scene.ms_lightmap_groups[group.name].resolution)
- bpy.ops.object.ms_create_lightmap(group_name=group.name, resolution=res)
- bpy.ops.object.ms_merge_objects(group_name=group.name, unwrap=False)
- else:
- self.report({'INFO'}, "Not All Objects Are Visible!!!!")
+ if group.bake is True and bpy.data.groups[group.name].objects:
+ # Check if objects are all on the visible Layers.
+ isAllObjectsVisible = True
+ bpy.ops.object.select_all(action='DESELECT')
+ for thisObject in bpy.data.groups[group.name].objects:
+ isThisObjectVisible = False
+ scene.objects.active = thisObject
+ for thisLayerNumb in range(20):
+ if thisObject.layers[thisLayerNumb] is True and scene.layers[thisLayerNumb] is True:
+ isThisObjectVisible = True
+ break
+ # If Object is on an invisible Layer
+ if isThisObjectVisible is False:
+ isAllObjectsVisible = False
+
+ if isAllObjectsVisible is True:
+ res = int(scene.ms_lightmap_groups[group.name].resolution)
+ bpy.ops.object.ms_create_lightmap(
+ group_name=group.name, resolution=res)
+ bpy.ops.object.ms_merge_objects(
+ group_name=group.name, unwrap=False)
+ else:
+ self.report({'INFO'}, "Not All Objects Are Visible!!!!")
+
context.area.type = old_context
return{'FINISHED'}
-
+
class runFinish(bpy.types.Operator):
bl_idname = "object.ms_run_remove"
bl_label = "Remove Manual Unwrapping Object"
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list