Rigify: store advanced options in armature instead of window manager.
[blender-addons.git] / oscurart_tools / __init__.py
blob22fcc1d398b22aa3f6d73048fe434348b27ca197
1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
19 # <pep8 compliant>
21 bl_info = {
22 "name": "Oscurart Tools",
23 "author": "Oscurart",
24 "version": (4, 0, 0),
25 "blender": (2, 80, 0),
26 "location": "View3D > Context Menu > Object/Edit Modes",
27 "description": "Tools for objects, render, shapes, and files.",
28 "warning": "",
29 "wiki_url": "https://www.oscurart.com.ar",
30 "category": "Object",
34 import bpy
35 from bpy.app.handlers import persistent
36 from bpy.types import Menu
37 from oscurart_tools.files import reload_images
38 from oscurart_tools.files import save_incremental
39 from oscurart_tools.files import collect_images
40 from oscurart_tools.mesh import overlap_uvs
41 from oscurart_tools.mesh import overlap_island
42 from oscurart_tools.mesh import select_doubles
43 from oscurart_tools.mesh import shapes_to_objects
44 from oscurart_tools.mesh import remove_modifiers
45 from oscurart_tools.mesh import vertex_color_id
46 from oscurart_tools.object import distribute
47 from oscurart_tools.object import selection
48 from oscurart_tools.object import search_and_select
49 from oscurart_tools.mesh import apply_linked_meshes
50 from oscurart_tools.render import render_tokens
51 from oscurart_tools.render import batch_maker
52 from oscurart_tools.render import material_overrides
53 from oscurart_tools.mesh import flipped_uvs
55 from bpy.types import (
56 AddonPreferences,
57 Panel,
58 PropertyGroup,
60 from bpy.props import (
61 StringProperty,
62 BoolProperty,
63 IntProperty,
64 PointerProperty,
65 CollectionProperty,
68 # mesh
69 class VIEW3D_MT_edit_mesh_oscurarttools(Menu):
70 bl_label = "OscurartTools"
72 def draw(self, context):
73 layout = self.layout
75 layout.operator("mesh.uv_island_copy")
76 layout.operator("mesh.uv_island_paste")
77 layout.operator("mesh.select_doubles")
78 layout.separator()
79 layout.operator("image.reload_images_osc")
80 layout.operator("file.save_incremental_backup")
81 layout.operator("file.collect_all_images")
82 layout.operator("file.create_batch_maker_osc")
84 def menu_funcMesh(self, context):
85 self.layout.menu("VIEW3D_MT_edit_mesh_oscurarttools")
86 self.layout.separator()
88 # image
89 class IMAGE_MT_uvs_oscurarttools(Menu):
90 bl_label = "OscurartTools"
92 def draw(self, context):
93 layout = self.layout
95 layout.operator("mesh.uv_island_copy")
96 layout.operator("mesh.uv_island_paste")
97 layout.operator("mesh.overlap_uv_faces")
98 layout.operator("mesh.select_flipped_uvs")
99 layout.separator()
100 layout.operator("image.reload_images_osc")
101 layout.operator("file.save_incremental_backup")
102 layout.operator("file.collect_all_images")
103 layout.operator("file.create_batch_maker_osc")
106 def menu_funcImage(self, context):
107 self.layout.menu("IMAGE_MT_uvs_oscurarttools")
108 self.layout.separator()
111 # object
112 class VIEW3D_MT_object_oscurarttools(Menu):
113 bl_label = "OscurartTools"
115 def draw(self, context):
116 layout = self.layout
118 layout.operator("mesh.vertex_color_mask")
119 layout.operator("object.distribute_osc")
120 layout.operator("mesh.remove_modifiers")
121 layout.operator("object.search_and_select_osc")
122 layout.operator("object.shape_key_to_objects_osc")
123 layout.operator("mesh.apply_linked_meshes")
124 layout.separator()
125 layout.operator("image.reload_images_osc")
126 layout.operator("file.save_incremental_backup")
127 layout.operator("file.collect_all_images")
128 layout.operator("file.create_batch_maker_osc")
130 def menu_funcObject(self, context):
131 self.layout.menu("VIEW3D_MT_object_oscurarttools")
132 self.layout.separator()
134 # ========================= End of Scripts =========================
137 classes = (
138 VIEW3D_MT_edit_mesh_oscurarttools,
139 IMAGE_MT_uvs_oscurarttools,
140 VIEW3D_MT_object_oscurarttools,
141 reload_images.reloadImages,
142 overlap_uvs.CopyUvIsland,
143 overlap_uvs.PasteUvIsland,
144 distribute.DistributeOsc,
145 selection.OSSELECTION_HT_OscSelection,
146 save_incremental.saveIncrementalBackup,
147 collect_images.collectImagesOsc,
148 overlap_island.OscOverlapUv,
149 select_doubles.SelectDoubles,
150 shapes_to_objects.ShapeToObjects,
151 search_and_select.SearchAndSelectOt,
152 apply_linked_meshes.ApplyLRT,
153 batch_maker.oscBatchMaker,
154 remove_modifiers.RemoveModifiers,
155 vertex_color_id.createVCMask,
156 material_overrides.OVERRIDES_PT_OscOverridesGUI,
157 material_overrides.OscTransferOverrides,
158 material_overrides.OscAddOverridesSlot,
159 material_overrides.OscRemoveOverridesSlot,
160 material_overrides.OscOverridesUp,
161 material_overrides.OscOverridesDown,
162 material_overrides.OscOverridesKill,
163 flipped_uvs.selectFlippedUvs
166 def register():
167 from bpy.types import Scene
168 Scene.multimeshedit = StringProperty()
169 bpy.types.VIEW3D_MT_edit_mesh_context_menu.prepend(menu_funcMesh)
170 bpy.types.IMAGE_MT_uvs_context_menu.prepend(menu_funcImage)
171 bpy.types.VIEW3D_MT_object_context_menu.prepend(menu_funcObject)
172 bpy.app.handlers.render_init.append(render_tokens.replaceTokens)
173 bpy.app.handlers.render_cancel.append(render_tokens.restoreTokens)
174 bpy.app.handlers.render_complete.append(render_tokens.restoreTokens)
175 bpy.app.handlers.render_pre.append(material_overrides.ApplyOverrides)
176 bpy.app.handlers.render_cancel.append(material_overrides.RestoreOverrides)
177 bpy.app.handlers.render_post.append(material_overrides.RestoreOverrides)
179 from bpy.utils import register_class
180 for cls in classes:
181 register_class(cls)
184 def unregister():
185 bpy.types.VIEW3D_MT_edit_mesh_context_menu.remove(menu_funcMesh)
186 bpy.types.IMAGE_MT_uvs_context_menu.remove(menu_funcImage)
187 bpy.types.VIEW3D_MT_object_context_menu.remove(menu_funcObject)
189 from bpy.utils import unregister_class
190 for cls in reversed(classes):
191 unregister_class(cls)
194 if __name__ == "__main__":
195 register()