[Bf-extensions-cvs] [2e41fe16] master: uv_texture_atlas.py: move to contrib: T63750
meta-androcto
noreply at git.blender.org
Fri May 24 11:18:54 CEST 2019
Commit: 2e41fe16c593346c9fa35028125aed5f1e3793d7
Author: meta-androcto
Date: Fri May 24 19:18:31 2019 +1000
Branches: master
https://developer.blender.org/rBA2e41fe16c593346c9fa35028125aed5f1e3793d7
uv_texture_atlas.py: move to contrib: T63750
===================================================================
D uv_texture_atlas.py
===================================================================
diff --git a/uv_texture_atlas.py b/uv_texture_atlas.py
deleted file mode 100644
index 50adb3c8..00000000
--- a/uv_texture_atlas.py
+++ /dev/null
@@ -1,831 +0,0 @@
-# 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
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# 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 #####
-
-
-bl_info = {
- "name": "Texture Atlas",
- "author": "Andreas Esau, Paul Geraskin, Campbell Barton",
- "version": (0, 2, 1),
- "blender": (2, 67, 0),
- "location": "Properties > Render",
- "description": "A simple Texture Atlas for unwrapping many objects. It creates additional UV",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
- "Scripts/UV/TextureAtlas",
- "category": "UV",
-}
-
-import bpy
-from bpy.types import (
- Operator,
- Panel,
- PropertyGroup,
- )
-from bpy.props import (
- BoolProperty,
- CollectionProperty,
- EnumProperty,
- FloatProperty,
- IntProperty,
- StringProperty,
- )
-import mathutils
-
-
-def check_all_objects_visible(self, context):
- scene = context.scene
- group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
- isAllObjectsVisible = True
- bpy.ops.object.select_all(action='DESELECT')
- for thisObject in bpy.data.collections[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
- return isAllObjectsVisible
-
-
-def check_group_exist(self, context, use_report=True):
- scene = context.scene
- group = scene.ms_lightmap_groups[scene.ms_lightmap_groups_index]
-
- if group.name in bpy.data.collections:
- return True
- else:
- if use_report:
- self.report({'INFO'}, "No Such Group %r!" % group.name)
- return False
-
-
-class TexAtl_Main(Panel):
- bl_idname = "UVTEX_ATLAS_PT_main"
- bl_label = "Texture Atlas"
- bl_space_type = 'PROPERTIES'
- bl_region_type = 'WINDOW'
- bl_context = "render"
- bl_options = {'DEFAULT_CLOSED'}
-
- def draw(self, context):
- scene = context.scene
- ob = context.object
-
- col = self.layout.column()
- 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)
- col = row.column(align=True)
- col.operator("scene.ms_add_lightmap_group", icon='ADD', text="")
- col.operator("scene.ms_del_lightmap_group", icon='REMOVE', 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.label(text="Resolution:")
- row.prop(group, 'resolutionX', text='')
- row.prop(group, 'resolutionY', text='')
- row = self.layout.row()
- #self.layout.separator()
-
- row = self.layout.row()
- row.operator("scene.ms_remove_other_uv",
- text="RemoveOtherUVs", icon="GROUP")
- row.operator("scene.ms_remove_selected",
- text="RemoveSelected", icon="GROUP")
- #self.layout.separator()
-
- row = self.layout.row()
- row.operator("scene.ms_add_selected_to_group",
- text="AddSelected", icon="GROUP")
- row.operator("scene.ms_select_group",
- text="SelectGroup", icon="GROUP")
-
- #self.layout.separator()
- self.layout.label(text="Auto Unwrap:")
- self.layout.prop(group, 'unwrap_type', text='Lightmap', expand=True)
- row = self.layout.row()
- row.operator(
- "object.ms_auto", text="Auto Unwrap", icon="LIGHT_SPOT")
- row.prop(group, 'autoUnwrapPrecision', text='')
-
- self.layout.label(text="Manual Unwrap:")
- row = self.layout.row()
- row.operator(
- "object.ms_run", text="StartManualUnwrap", icon="LIGHT_SPOT")
- row.operator(
- "object.ms_run_remove", text="FinishManualUnwrap", icon="LIGHT_SPOT")
-
-
-class TexAtl_RunAuto(Operator):
- bl_idname = "object.ms_auto"
- bl_label = "Auto Unwrapping"
- bl_description = "Auto Unwrapping"
-
- def execute(self, context):
- scene = context.scene
-
- # 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]
- if context.area:
- context.area.type = 'VIEW_3D'
-
- if bpy.ops.object.mode_set.poll():
- bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-
- if group.bake is True and bpy.data.collections[group.name].objects:
-
- # Check if objects are all on the visible Layers.
- isAllObjVisible = check_all_objects_visible(self, context)
-
- if isAllObjVisible is True:
- resX = int(group.resolutionX)
- resY = int(group.resolutionY)
- bpy.ops.object.ms_create_lightmap(
- group_name=group.name, resolutionX=resX, resolutionY=resY)
- 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!!!")
-
- # set old context back
- if context.area:
- context.area.type = old_context
-
- return{'FINISHED'}
-
-
-class TexAtl_RunStart(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
-
- # 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'}
-
- 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():
- bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-
- if group.bake is True and bpy.data.collections[group.name].objects:
-
- # Check if objects are all on the visible Layers.
- isAllObjVisible = check_all_objects_visible(self, context)
-
- if bpy.data.objects.get(group.name + "_mergedObject") is not None:
- self.report({'INFO'}, "Old Merged Object Exists!!!")
- elif isAllObjVisible is False:
- self.report({'INFO'}, "Not All Objects Are Visible!!!")
- else:
- resX = int(group.resolutionX)
- resY = int(group.resolutionY)
- bpy.ops.object.ms_create_lightmap(
- group_name=group.name, resolutionX=resX, resolutionY=resY)
- bpy.ops.object.ms_merge_objects(
- group_name=group.name, unwrap=False)
-
- # set old context back
- if context.area:
- context.area.type = old_context
-
- return{'FINISHED'}
-
-
-class TexAtl_RunFinish(Operator):
- bl_idname = "object.ms_run_remove"
- bl_label = "Remove Manual Unwrapping Object"
- bl_description = "Removes Manual Unwrapping Object"
-
- def execute(self, context):
- scene = context.scene
-
- # 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]
- if context.area:
- context.area.type = 'VIEW_3D'
-
- if bpy.ops.object.mode_set.poll():
- bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
-
- if group.bake is True and bpy.data.collections[group.name].objects:
-
- # Check if objects are all on the visible Layers.
- isAllObjVisible = check_all_objects_visible(self, context)
-
- if isAllObjVisible is True:
- bpy.ops.object.ms_separate_objects(group_name=group.name)
- else:
- self.report({'INFO'}, "Not All Objects Are Visible!!!")
-
- # set old context back
- if context.area:
- context.area.type = old_context
-
- return{'FINISHED'}
-
-
-class TexAtl_UVLayers(PropertyGroup):
- name: StringProperty(default="")
-
-
-class TexAtl_VertexGroups(PropertyGroup):
- name: StringProperty(default="")
-
-
-class TexAtl_Groups(PropertyGroup):
- name: StringProperty(def
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list