1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
# ##### 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 #####
# <pep8 compliant>
bl_info = {
"name": "Oscurart Tools",
"author": "Oscurart",
"version": (4, 0, 0),
"blender": (2, 80, 0),
"location": "View3D > Toolbar and View3D > Specials (W-key)",
"description": "Tools for objects, render, shapes, and files.",
"warning": "",
"wiki_url": "https://www.oscurart.com.ar",
"category": "Object",
}
import bpy
from bpy.app.handlers import persistent
from bpy.types import Menu
from oscurart_tools.files import reload_images
from oscurart_tools.files import save_incremental
from oscurart_tools.files import collect_images
from oscurart_tools.mesh import overlap_uvs
from oscurart_tools.mesh import overlap_island
from oscurart_tools.mesh import select_doubles
from oscurart_tools.mesh import shapes_to_objects
from oscurart_tools.mesh import remove_modifiers
from oscurart_tools.mesh import vertex_color_id
from oscurart_tools.object import distribute
from oscurart_tools.object import selection
from oscurart_tools.object import search_and_select
from oscurart_tools.mesh import apply_linked_meshes
from oscurart_tools.render import render_tokens
from oscurart_tools.render import batch_maker
from oscurart_tools.render import material_overrides
from bpy.types import (
AddonPreferences,
Panel,
PropertyGroup,
)
from bpy.props import (
StringProperty,
BoolProperty,
IntProperty,
PointerProperty,
CollectionProperty,
)
# mesh
class VIEW3D_MT_edit_mesh_oscurarttools(Menu):
bl_label = "OscurartTools"
def draw(self, context):
layout = self.layout
layout.operator("mesh.uv_island_copy")
layout.operator("mesh.uv_island_paste")
layout.operator("mesh.select_doubles")
layout.separator()
layout.operator("image.reload_images_osc")
layout.operator("file.save_incremental_backup")
layout.operator("file.collect_all_images")
layout.operator("file.create_batch_maker_osc")
def menu_funcMesh(self, context):
self.layout.menu("VIEW3D_MT_edit_mesh_oscurarttools")
self.layout.separator()
# image
class IMAGE_MT_uvs_oscurarttools(Menu):
bl_label = "OscurartTools"
def draw(self, context):
layout = self.layout
layout.operator("mesh.uv_island_copy")
layout.operator("mesh.uv_island_paste")
layout.operator("mesh.overlap_uv_faces")
layout.separator()
layout.operator("image.reload_images_osc")
layout.operator("file.save_incremental_backup")
layout.operator("file.collect_all_images")
layout.operator("file.create_batch_maker_osc")
def menu_funcImage(self, context):
self.layout.menu("IMAGE_MT_uvs_oscurarttools")
self.layout.separator()
# object
class VIEW3D_MT_object_oscurarttools(Menu):
bl_label = "OscurartTools"
def draw(self, context):
layout = self.layout
layout.operator("mesh.vertex_color_mask")
layout.operator("object.distribute_osc")
layout.operator("mesh.remove_modifiers")
layout.operator("object.search_and_select_osc")
layout.operator("object.shape_key_to_objects_osc")
layout.operator("mesh.apply_linked_meshes")
layout.separator()
layout.operator("image.reload_images_osc")
layout.operator("file.save_incremental_backup")
layout.operator("file.collect_all_images")
layout.operator("file.create_batch_maker_osc")
def menu_funcObject(self, context):
self.layout.menu("VIEW3D_MT_object_oscurarttools")
self.layout.separator()
# ========================= End of Scripts =========================
classes = (
VIEW3D_MT_edit_mesh_oscurarttools,
IMAGE_MT_uvs_oscurarttools,
VIEW3D_MT_object_oscurarttools,
reload_images.reloadImages,
overlap_uvs.CopyUvIsland,
overlap_uvs.PasteUvIsland,
distribute.DistributeOsc,
selection.OscSelection,
save_incremental.saveIncrementalBackup,
collect_images.collectImagesOsc,
overlap_island.OscOverlapUv,
select_doubles.SelectDoubles,
shapes_to_objects.ShapeToObjects,
search_and_select.SearchAndSelectOt,
apply_linked_meshes.ApplyLRT,
batch_maker.oscBatchMaker,
remove_modifiers.RemoveModifiers,
vertex_color_id.createVCMask,
material_overrides.OscOverridesGUI,
material_overrides.OscTransferOverrides,
material_overrides.OscAddOverridesSlot,
material_overrides.OscRemoveOverridesSlot,
material_overrides.OscOverridesUp,
material_overrides.OscOverridesDown,
material_overrides.OscOverridesKill
)
def register():
from bpy.types import Scene
Scene.multimeshedit = StringProperty()
bpy.types.VIEW3D_MT_edit_mesh_specials.prepend(menu_funcMesh)
bpy.types.IMAGE_MT_uvs_specials.prepend(menu_funcImage)
bpy.types.VIEW3D_MT_object_specials.prepend(menu_funcObject)
bpy.app.handlers.render_pre.append(render_tokens.replaceTokens)
bpy.app.handlers.render_cancel.append(render_tokens.restoreTokens)
bpy.app.handlers.render_post.append(render_tokens.restoreTokens)
bpy.app.handlers.render_pre.append(material_overrides.ApplyOverrides)
bpy.app.handlers.render_cancel.append(material_overrides.RestoreOverrides)
bpy.app.handlers.render_post.append(material_overrides.RestoreOverrides)
from bpy.utils import register_class
for cls in classes:
register_class(cls)
def unregister():
bpy.types.VIEW3D_MT_edit_mesh_specials.remove(menu_funcMesh)
bpy.types.IMAGE_MT_uvs_specials.remove(menu_funcImage)
bpy.types.VIEW3D_MT_object_specials.remove(menu_funcObject)
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)
if __name__ == "__main__":
register()
|