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>2013-12-13 13:06:20 +0400
committermifth <paulgeraskin@gmail.com>2013-12-13 13:06:20 +0400
commit0e06695fd9071a7f5ccab998dc470ca634674b80 (patch)
tree470825b6ba0bd4cb21d5f97b74c44e61fdfbc1ae /uv_texture_atlas.py
parent9e229d64ae8513712bb589f4a3935102c2d95915 (diff)
[TextureAtlas Script] Classes renaming just not to get the same names as in different addons. Fix for ManualUnwrap hidden faces. Version 0.2.1
Diffstat (limited to 'uv_texture_atlas.py')
-rw-r--r--uv_texture_atlas.py117
1 files changed, 41 insertions, 76 deletions
diff --git a/uv_texture_atlas.py b/uv_texture_atlas.py
index 92838402..005477f5 100644
--- a/uv_texture_atlas.py
+++ b/uv_texture_atlas.py
@@ -20,7 +20,7 @@
bl_info = {
"name": "Texture Atlas",
"author": "Andreas Esau, Paul Geraskin, Campbell Barton",
- "version": (0, 2, 0),
+ "version": (0, 2, 1),
"blender": (2, 67, 0),
"location": "Properties > Render",
"description": "A simple Texture Atlas for unwrapping many objects. It creates additional UV",
@@ -74,7 +74,7 @@ def check_group_exist(self, context, use_report=True):
return False
-class TextureAtlas(Panel):
+class TexAtl_Main(Panel):
bl_label = "Texture Atlas"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -128,7 +128,7 @@ class TextureAtlas(Panel):
"object.ms_run_remove", text="FinshManualUnwrap", icon="LAMP_SPOT")
-class RunAuto(Operator):
+class TexAtl_RunAuto(Operator):
bl_idname = "object.ms_auto"
bl_label = "Auto Unwrapping"
bl_description = "Auto Unwrapping"
@@ -167,7 +167,7 @@ class RunAuto(Operator):
return{'FINISHED'}
-class RunStart(Operator):
+class TexAtl_RunStart(Operator):
bl_idname = "object.ms_run"
bl_label = "Make Manual Unwrapping Object"
bl_description = "Makes Manual Unwrapping Object"
@@ -205,7 +205,7 @@ class RunStart(Operator):
return{'FINISHED'}
-class RunFinish(Operator):
+class TexAtl_RunFinish(Operator):
bl_idname = "object.ms_run_remove"
bl_label = "Remove Manual Unwrapping Object"
bl_description = "Removes Manual Unwrapping Object"
@@ -238,19 +238,19 @@ class RunFinish(Operator):
return{'FINISHED'}
-class MSUVLayers(PropertyGroup):
+class TexAtl_UVLayers(PropertyGroup):
name = StringProperty(default="")
-class MSVertexGroups(PropertyGroup):
+class TexAtl_VertexGroups(PropertyGroup):
name = StringProperty(default="")
-class MSGroups(PropertyGroup):
+class TexAtl_Groups(PropertyGroup):
name = StringProperty(default="")
-class MSLightmapGroups(PropertyGroup):
+class TexAtl_MSLightmapGroups(PropertyGroup):
name = StringProperty(default="")
bake = BoolProperty(default=True)
@@ -279,16 +279,16 @@ class MSLightmapGroups(PropertyGroup):
)
-class MSMergedObjects(PropertyGroup):
+class TexAtl_MergedObjects(PropertyGroup):
name = StringProperty()
vertex_groups = CollectionProperty(
- type=MSVertexGroups,
+ type=TexAtl_VertexGroups,
)
- groups = CollectionProperty(type=MSGroups)
- uv_layers = CollectionProperty(type=MSUVLayers)
+ groups = CollectionProperty(type=TexAtl_Groups)
+ uv_layers = CollectionProperty(type=TexAtl_UVLayers)
-class AddSelectedToGroup(Operator):
+class TexAtl_AddSelectedToGroup(Operator):
bl_idname = "scene.ms_add_selected_to_group"
bl_label = "Add to Group"
bl_description = "Adds selected Objects to current Group"
@@ -314,7 +314,7 @@ class AddSelectedToGroup(Operator):
return {'FINISHED'}
-class SelectGroup(Operator):
+class TexAtl_SelectGroup(Operator):
bl_idname = "scene.ms_select_group"
bl_label = "sel Group"
bl_description = "Selected Objects of current Group"
@@ -338,7 +338,7 @@ class SelectGroup(Operator):
return {'FINISHED'}
-class RemoveFromGroup(Operator):
+class TexAtl_RemoveFromGroup(Operator):
bl_idname = "scene.ms_remove_selected"
bl_label = "del Selected"
bl_description = "Remove Selected Group and UVs"
@@ -378,7 +378,7 @@ class RemoveFromGroup(Operator):
return {'FINISHED'}
-class RemoveOtherUVs(Operator):
+class TexAtl_RemoveOtherUVs(Operator):
bl_idname = "scene.ms_remove_other_uv"
bl_label = "remOther"
bl_description = "Remove Other UVs from Selected"
@@ -418,7 +418,7 @@ class RemoveOtherUVs(Operator):
return {'FINISHED'}
-class AddLightmapGroup(Operator):
+class TexAtl_AddLightmapGroup(Operator):
bl_idname = "scene.ms_add_lightmap_group"
bl_label = "add Lightmap"
bl_description = "Adds a new Lightmap Group"
@@ -446,7 +446,7 @@ class AddLightmapGroup(Operator):
return wm.invoke_props_dialog(self)
-class DelLightmapGroup(Operator):
+class TexAtl_DelLightmapGroup(Operator):
bl_idname = "scene.ms_del_lightmap_group"
bl_label = "delete Lightmap"
bl_description = "Deletes active Lightmap Group"
@@ -477,7 +477,7 @@ class DelLightmapGroup(Operator):
return {'FINISHED'}
-class CreateLightmap(Operator):
+class TexAtl_CreateLightmap(Operator):
bl_idname = "object.ms_create_lightmap"
bl_label = "TextureAtlas - Generate Lightmap"
bl_description = "Generates a Lightmap"
@@ -537,9 +537,9 @@ class CreateLightmap(Operator):
return{'FINISHED'}
-class MergeObjects(Operator):
+class TexAtl_MergeObjects(Operator):
bl_idname = "object.ms_merge_objects"
- bl_label = "TextureAtlas - MergeObjects"
+ bl_label = "TextureAtlas - TexAtl_MergeObjects"
bl_description = "Merges Objects and stores Origins"
group_name = StringProperty(default='')
@@ -640,13 +640,17 @@ class MergeObjects(Operator):
ob_merge.select = True
scene.objects.active = ob_merge
+ # Unfide all faces
+ bpy.ops.object.mode_set(mode='EDIT')
+ bpy.ops.mesh.reveal()
+ bpy.ops.mesh.select_all(action='SELECT')
+ bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+
if self.unwrap is True:
unwrapType = scene.ms_lightmap_groups[self.group_name].unwrap_type
if unwrapType == '0' or unwrapType == '1':
bpy.ops.object.mode_set(mode='EDIT')
- bpy.ops.mesh.reveal()
- bpy.ops.mesh.select_all(action='SELECT')
if unwrapType == '0':
bpy.ops.uv.smart_project(
@@ -660,7 +664,7 @@ class MergeObjects(Operator):
return{'FINISHED'}
-class SeparateObjects(Operator):
+class TexAtl_SeparateObjects(Operator):
bl_idname = "object.ms_separate_objects"
bl_label = "TextureAtlas - Separate Objects"
bl_description = "Separates Objects and restores Origin"
@@ -683,6 +687,7 @@ class SeparateObjects(Operator):
groupSeparate.objects.link(ob_merged)
ob_merged.select = False
+ doUnhidePolygons = False
for ms_obj in ob_merged.ms_merged_objects:
# select vertex groups and separate group from merged
# object
@@ -691,7 +696,11 @@ class SeparateObjects(Operator):
scene.objects.active = ob_merged
bpy.ops.object.mode_set(mode='EDIT')
- bpy.ops.mesh.reveal()
+ if doUnhidePolygons == False:
+ # Unhide Polygons only once
+ bpy.ops.mesh.reveal()
+ doUnhidePolygons = True
+
bpy.ops.mesh.select_all(action='DESELECT')
ob_merged.vertex_groups.active_index = ob_merged.vertex_groups[
ms_obj.name].index
@@ -735,62 +744,18 @@ class SeparateObjects(Operator):
def register():
- bpy.utils.register_class(TextureAtlas)
-
- bpy.utils.register_class(AddLightmapGroup)
- bpy.utils.register_class(DelLightmapGroup)
- bpy.utils.register_class(AddSelectedToGroup)
- bpy.utils.register_class(SelectGroup)
- bpy.utils.register_class(RemoveFromGroup)
- bpy.utils.register_class(RemoveOtherUVs)
-
- bpy.utils.register_class(RunAuto)
- bpy.utils.register_class(RunStart)
- bpy.utils.register_class(RunFinish)
- bpy.utils.register_class(MergeObjects)
- bpy.utils.register_class(SeparateObjects)
- bpy.utils.register_class(CreateLightmap)
-
- # types
- bpy.utils.register_class(MSUVLayers)
- bpy.utils.register_class(MSVertexGroups)
- bpy.utils.register_class(MSGroups)
-
- bpy.utils.register_class(MSMergedObjects)
+ bpy.utils.register_module(__name__)
+
bpy.types.Object.ms_merged_objects = CollectionProperty(
- type=MSMergedObjects)
+ type=TexAtl_MergedObjects)
- bpy.utils.register_class(MSLightmapGroups)
bpy.types.Scene.ms_lightmap_groups = CollectionProperty(
- type=MSLightmapGroups)
- bpy.types.Scene.ms_lightmap_groups_index = IntProperty()
+ type=TexAtl_MSLightmapGroups)
+ bpy.types.Scene.ms_lightmap_groups_index = IntProperty()
def unregister():
- bpy.utils.unregister_class(TextureAtlas)
-
- bpy.utils.unregister_class(AddLightmapGroup)
- bpy.utils.unregister_class(DelLightmapGroup)
- bpy.utils.unregister_class(AddSelectedToGroup)
- bpy.utils.unregister_class(SelectGroup)
- bpy.utils.unregister_class(RemoveFromGroup)
- bpy.utils.unregister_class(RemoveOtherUVs)
-
- bpy.utils.unregister_class(RunAuto)
- bpy.utils.unregister_class(RunStart)
- bpy.utils.unregister_class(RunFinish)
- bpy.utils.unregister_class(MergeObjects)
- bpy.utils.unregister_class(SeparateObjects)
- bpy.utils.unregister_class(CreateLightmap)
-
- # types
- bpy.utils.unregister_class(MSUVLayers)
- bpy.utils.unregister_class(MSVertexGroups)
- bpy.utils.unregister_class(MSGroups)
-
- bpy.utils.unregister_class(MSMergedObjects)
-
- bpy.utils.unregister_class(MSLightmapGroups)
+ bpy.utils.unregister_module(__name__)
if __name__ == "__main__":