forked from mistajuliax/jmesh-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfc_selected_panel.py
110 lines (79 loc) · 3.68 KB
/
fc_selected_panel.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
import bpy
from bpy.types import Panel
from . fc_bevel_op import FC_BevelOperator
from . fc_unbevel_op import FC_UnBevelOperator
class FC_PT_Selected_Panel(Panel):
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_label = "Selected objects"
bl_category = "JMesh"
def has_bevel_modifier(self, obj):
if obj is None:
return False
for modifier in obj.modifiers:
if modifier.type == "BEVEL":
return True
return False
@classmethod
def poll(cls, context):
if context.object is None:
return False
return True
def draw(self, context):
layout = self.layout
if context.mode != "SCULPT":
if context.object is not None:
# Draw type
row = layout.row()
row.prop(context.object, "display_type", text="Display")
mode = context.object.mode
# Bevel button
row = layout.row()
col = row.column()
col.operator('object.bevel', text=FC_BevelOperator.get_display(context.object.mode), icon='MOD_BEVEL')
# Un-Bevel button
col = row.column()
col.operator('object.unbevel', text=FC_UnBevelOperator.get_display(context.object.mode), icon='MOD_BEVEL')
if(mode == "OBJECT"):
if self.has_bevel_modifier(context.active_object):
row = layout.row()
row.prop(context.object.modifiers["Bevel"], "width", text="Bevel width")
row = layout.row()
row.operator('object.union_selected_op', text='Union selected', icon='MOD_BOOLEAN')
# Array
row = layout.row()
col = row.column()
col.operator('object.fc_array_mode_op', text='Array', icon='MOD_ARRAY')
# Circular Array
col = row.column()
col.operator('object.fc_circle_array_mode_op', text='Circle Array', icon='MOD_ARRAY')
row = layout.row()
col = row.column()
col.operator('view3d.origin_active', text='Set Origin', icon='PIVOT_CURSOR')
col = row.column()
col.operator('view3d.snap_active', text='Cursor to Active', icon='PIVOT_CURSOR')
row = layout.row()
row.operator('view3d.curve_convert', text='Curve to mesh & fill', icon='LINENUMBERS_OFF')
row = layout.row()
row.operator('view3d.dissolve_edges', text='Dissolve edges', icon='LINENUMBERS_OFF')
# Mirror
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="to X", icon='MOD_MESHDEFORM').sym_axis = "NEGATIVE_X"
col = split.column()
col.operator('object.sym', text="to Y", icon='MOD_MESHDEFORM').sym_axis = "NEGATIVE_Y"
col = split.column()
col.operator('object.sym', text="to Z", icon='MOD_MESHDEFORM').sym_axis = "NEGATIVE_Z"
# symmetrize positive
row = layout.row()
split = row.split(factor=0.33)
col = split.column()
col.operator('object.sym', text="to -X", icon='MOD_MESHDEFORM').sym_axis = "POSITIVE_X"
col = split.column()
col.operator('object.sym', text="to -Y", icon='MOD_MESHDEFORM').sym_axis = "POSITIVE_Y"
col = split.column()
col.operator('object.sym', text="to -Z", icon='MOD_MESHDEFORM').sym_axis = "POSITIVE_Z"