-
Notifications
You must be signed in to change notification settings - Fork 0
/
gui.py
305 lines (267 loc) · 13.9 KB
/
gui.py
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
import bpy
#draw panel
class call_menu_tpqz(bpy.types.Operator):
"""Tooltip"""
bl_idname = "object.call_menu_tpqz"
bl_label = "call_menu_tpqz"
bl_options = {'REGISTER', "UNDO"}
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
#main(context)
print("custom menu")
bpy.ops.wm.call_menu(name=custom_menu_tpqz_sculpt.bl_idname)
return {'FINISHED'}
class bbpSculptViewPanelObject(bpy.types.Panel):
"""Creates the Create Object Panel"""
bl_label = "TPQZ sculpt"
bl_idname = "UI_PT_TpqzSculpt"
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "TPQZ"
def draw(self, context):
# usefull variables
scene = context.scene
obj = context.object
brush = context.tool_settings.sculpt.brush
layout = self.layout
box = layout.box()
col = box.column(align = True)
row = col.row()
row.label(text="view:")
row = col.row()
buttonFocal35 = row.operator("object.bbp_focal_view", text="35",icon="RESTRICT_RENDER_ON").value = "35"
buttonFocal50 = row.operator("object.bbp_focal_view", text="50",icon="RESTRICT_RENDER_ON").value = "50"
buttonFocal80 = row.operator("object.bbp_focal_view", text="80",icon="RESTRICT_RENDER_ON").value = "80"
buttonFocal80 = row.operator("object.bbp_focal_view", text="90",icon="RESTRICT_RENDER_ON").value = "90"
row = col.row()
row.operator("object.bbp_sculpt_fade", text="Fade",icon="GHOST_ENABLED").value = "fade"
row.operator("object.bbp_sculpt_fade", text="Unfade",icon="OUTLINER_OB_LIGHT").value = "unfade"
#-------------------------------------------------------------------------------------
# pivot
#-------------------------------------------------------------------------------------
layout = self.layout
box = layout.box()
col = box.column(align = True)
row = col.row()
row.label(text="pivot:")
row = col.row()
row.operator("object.bbp_sculpt_restore_x", text="sym",icon="ORIENTATION_GIMBAL")
row.operator("sculpt.set_pivot_position", text="unmask",icon="ORIENTATION_LOCAL").mode='UNMASKED'
row.operator("object.bbp_sculpt_unmasked_center", text="center",icon="ORIENTATION_VIEW")
row.operator("sculpt.set_pivot_position", text="origin",icon="ORIENTATION_GLOBAL").mode='ORIGIN'
#-------------------------------------------------------------------------------------
# create
#-------------------------------------------------------------------------------------
layout = self.layout
box = layout.box()
col = box.column(align = True)
row = col.row()
row.label(text="create:")
row = col.row()
row.operator("object.bbp_sculpt", text="Xtract & Solidify",icon="OUTLINER_OB_VOLUME")
row.operator("object.bbp_copy_face_set", text="Xtract faceset",icon="MESH_CUBE")
row = col.row()
row.operator("object.bbp_duplicate", text="mesh duplicate",icon="DUPLICATE")
row = col.row()
#"object:")
row.separator(factor=2)
row = col.row()
row.operator("object.bbp_insert_object", text="cube",icon="MESH_CUBE").value="cube"
row.operator("object.bbp_insert_object", text="sphere",icon="MESH_UVSPHERE").value="sphere"
row.operator("object.bbp_insert_object", text="cylinder",icon="MESH_CYLINDER").value="cylinder"
row = col.row()
row.operator("object.bbp_insert_object", text="torus",icon="MESH_TORUS").value="torus"
row.operator("object.bbp_insert_object", text="cone",icon="MESH_CONE").value="cone"
row.operator("object.bbp_insert_object", text="plane",icon="MESH_PLANE").value="plane"
#-------------------------------------------------------------------------------------
# face set
#-------------------------------------------------------------------------------------
layout = self.layout
row = layout.row(align=True)
col.separator()
row = col.row()
row.label(text="face set :")
row = col.row()
row.operator("sculpt.face_sets_create", text="visible",icon="FACE_MAPS").mode='VISIBLE'
row.operator("sculpt.face_sets_init", text="loose",icon="FACE_MAPS").mode="LOOSE_PARTS"
row = col.row()
row.operator("sculpt.face_sets_create", text="masked",icon="FACE_MAPS").mode="MASKED"
row.operator("object.bbp_mask_hidden_face_set", text="mask hidden",icon="FACE_MAPS")
# layout = self.layout
# row = layout.row(align=True)
# row = col.row()
# row.label(text="Automasking :")
# row = col.row()
# col = row.column()
# col.prop(brush, 'use_frontface', text="front")
# col = row.column()
# col.prop(brush, 'use_automasking_face_sets', text="faces set")
# col = row.column()
# col.prop(brush, 'use_automasking_topology', text="topo")
#-------------------------------------------------------------------------------------
# split
#-------------------------------------------------------------------------------------
layout = self.layout
box = layout.box()
col = box.column(align = True)
row = col.row()
row.label(text="split:")
row = col.row()
row.operator("object.bbp_mask_new_object", text="from mask",icon="ADD")
row.operator("object.bbp_split_hiddenpg", text="hidden",icon="MOD_PHYSICS")
row.operator("object.bbp_split_group", text="loose",icon="OUTLINER_OB_POINTCLOUD")
#srow.operator("object.bbp_split_face_set", text="face set",icon="OUTLINER_OB_POINTCLOUD")
#-------------------------------------------------------------------------------------
# Remesh
#-------------------------------------------------------------------------------------
layout = self.layout
box = layout.box()
col = box.column(align = True)
col.separator()
row = col.row()
row.label(text="remesh:")
row = col.row()
row.operator("object.bbp_remesh", text="1").value = "1"
row.operator("object.bbp_remesh", text=".2").value = "0.2"
row.operator("object.bbp_remesh", text=".07").value = "0.07"
row.operator("object.bbp_remesh", text=".05").value = "0.05"
row.operator("object.bbp_remesh", text=".03").value = "0.03"
row.operator("object.bbp_remesh", text=".01").value = "0.01"
#-------------------------------------------------------------------------------------
# mesh ops
#-------------------------------------------------------------------------------------
##layout = self.layout
#box = layout.box()
#col = box.column(align = True)
row = col.row()
row.label(text="mesh ops:")
row = col.row()
row.operator("object.bbp_close_hole", text="close holes")
row.operator("object.bbp_mask_subdivide", text="mask subdivide")
row = col.row()
row.operator("object.bbp_spherize", text="sb-sphere")
row = col.row()
col = row.column()
col.prop(scene, 'solidify_float', text="val")
col = row.column()
col.operator("object.bbp_sculpt_solidify", text="Solidify")
col = row.column()
col.prop(scene,"solidify_bool", text="Apply")
#-------------------------------------------------------------------------------------
# delete
#-------------------------------------------------------------------------------------
layout = self.layout
box = layout.box()
col = box.column(align = True)
row = col.row()
row = col.row()
row.label(text="delete:")
row = col.row()
row.operator("object.bbp_delete_mesh", text="mesh",icon="CANCEL")
row.operator("object.bbp_delete_hiddenpg", text="hidden face set",icon="CANCEL")
row = col.row()
row.operator("object.bbp_delete_masked", text="masked",icon="CANCEL")
row.operator("mesh.paint_mask_slice", text="masked&close",icon="CANCEL").new_object=False
row = col.row()
row.operator("object.bbp_delete_by_symetry", text="byX",icon="CANCEL").value = "X"
row.operator("object.bbp_delete_by_symetry", text="byY",icon="CANCEL").value = "Y"
row.operator("object.bbp_delete_by_symetry", text="byZ",icon="CANCEL").value = "Z"
row = col.row()
# bpy.ops.sculpt.expand(target='FACE_SETS', falloff_type='GEODESIC', invert=False, use_modify_active=False)
#-------------------------------------------------------------------------------------
# join
#-------------------------------------------------------------------------------------
layout = self.layout
box = layout.box()
col = box.column(align = True)
row = col.row()
row.label(text="join:")
row = col.row()
row.operator("object.bbp_join_meshes", text="join from outliner",icon="LINKED")
row = layout.row()
col = row.column()
col.prop(scene, "list_chosen_object",text="Target",icon="LINKED")
col = row.column()
row.operator("object.bbp_join_choosed_object", text="join",icon="LINKED")
# New row
row = layout.row()
# Bool diff button
col = row.column()
col.operator('object.bbp_boolean', text='Difference', icon='MOD_BOOLEAN').value="DIFFERENCE"
# Bool union button
col = row.column()
col.operator('object.bbp_boolean', text='Union', icon='MOD_BOOLEAN').value="UNION"
# Bool union button
col = row.column()
col.operator('object.bbp_boolean', text='Intersect', icon='MOD_BOOLEAN').value="INTERSECT"
#-------------------------------------------------------------------------------------
# boolean
#-------------------------------------------------------------------------------------
#-------------------------------------------------------------------------------------
# symmetry
#-------------------------------------------------------------------------------------
layout = self.layout
box = layout.box()
col = box.column(align = True)
row = col.row()
row.label(text="Flip/Sim/Slice:")
row = layout.row()
row.operator('object.bbp_mirror', text='FlipX', icon='MOD_MIRROR').value ="X"
row.operator('object.bbp_mirror', text='FlipY', icon='MOD_MIRROR').value ="Y" # todo
row.operator('object.bbp_mirror', text='FlipZ', icon='MOD_MIRROR').value ="Z" # todo
# mirror
"""row = layout.row()
row.label(text="Symmetry:")
row = layout.row()
row.operator('object.mirror', text='Mirror', icon='MOD_MIRROR')"""
# symmetrize negative
row = layout.row()
split = row.split(factor=0.33)
col = split.column()
col.operator('object.sym', text="SymX", icon='MOD_MESHDEFORM').sym_axis = "NEGATIVE_X"
col = split.column()
col.operator('object.sym', text="SymY", icon='MOD_MESHDEFORM').sym_axis = "NEGATIVE_Y"
col = split.column()
col.operator('object.sym', text="SymZ", icon='MOD_MESHDEFORM').sym_axis = "NEGATIVE_Z"
row = layout.row()
row.operator('object.bbp_split_by_symetry', text='SliceX', icon='MOD_MIRROR').value ="X"
row.operator('object.bbp_split_by_symetry', text='SliceY', icon='MOD_MIRROR').value ="Y"
row.operator('object.bbp_split_by_symetry', text='SliceZ', icon='MOD_MIRROR').value ="Z"
#-------------------------------------------------------------------------------------
# test
#-------------------------------------------------------------------------------------
class CustomMenuTpqz(bpy.types.Menu):
bl_label = "CustomMenuTpqz"
bl_idname = "OBJECT_MT_CustomMenuTpqz"
def draw(self, context):
brush = context.tool_settings.sculpt.brush
layout = self.layout
layout.label(text="Automasking :")
layout.prop(brush, 'use_frontface', text="front")
layout.prop(brush, 'use_automasking_face_sets', text="faces set")
layout.prop(brush, 'use_automasking_topology', text="topo")
layout.label(text="pivot :")
layout.operator("object.bbp_sculpt_restore_x", text="sym",icon="ORIENTATION_GIMBAL")
layout.operator("sculpt.set_pivot_position", text="unmask",icon="ORIENTATION_LOCAL").mode='UNMASKED'
layout.operator("object.bbp_sculpt_unmasked_center", text="center",icon="ORIENTATION_VIEW")
layout.operator("sculpt.set_pivot_position", text="origin",icon="ORIENTATION_GLOBAL").mode='ORIGIN'
class custom_menu_tpqz_sculpt(bpy.types.Menu):
bl_label = "TPQZ Custom Menu"
bl_idname = "OBJECT_MT_custom_menu_tpqz"
def draw(self, context):
brush = context.tool_settings.sculpt.brush
layout = self.layout
scene = context.scene
layout.prop(brush, 'use_frontface', text="front")
layout.prop(brush, 'use_automasking_face_sets', text="faces set")
layout.prop(brush, 'use_automasking_topology', text="topo")
layout.operator("object.bbp_sculpt_restore_x", text="sym",icon="ORIENTATION_GIMBAL")
layout.operator("sculpt.set_pivot_position", text="unmask",icon="ORIENTATION_LOCAL").mode='UNMASKED'
layout.operator("object.bbp_sculpt_unmasked_center", text="center",icon="ORIENTATION_VIEW")
layout.operator("sculpt.set_pivot_position", text="origin",icon="ORIENTATION_GLOBAL").mode='ORIGIN'
layout.prop(scene, 'tpqz_force_symmetry', text="force Sym")
def draw_item(self, context):
layout = self.layout
layout.menu(CustomMenuTpqz.bl_idname)