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
|
# This software is distributable under the terms of the GNU
# General Public License (GPL) v2, the text of which can be found at
# http://www.gnu.org/copyleft/gpl.html. Installing, importing or otherwise
# using this module constitutes acceptance of the terms of this License.
# <pep8 compliant>
import bpy
class ObjectButtonsPanel(bpy.types.Panel):
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
class OBJECT_PT_context_object(ObjectButtonsPanel):
bl_label = ""
bl_show_header = False
def draw(self, context):
layout = self.layout
ob = context.object
row = layout.row()
row.itemL(text="", icon='ICON_OBJECT_DATA')
row.itemR(ob, "name", text="")
class OBJECT_PT_transform(ObjectButtonsPanel):
bl_label = "Transform"
def draw(self, context):
layout = self.layout
ob = context.object
row = layout.row()
row.column().itemR(ob, "location")
if ob.rotation_mode == 'QUATERNION':
row.column().itemR(ob, "rotation_quaternion", text="Rotation")
elif ob.rotation_mode == 'AXIS_ANGLE':
#row.column().itemL(text="Rotation")
#row.column().itemR(pchan, "rotation_angle", text="Angle")
#row.column().itemR(pchan, "rotation_axis", text="Axis")
row.column().itemR(ob, "rotation_axis_angle", text="Rotation")
else:
row.column().itemR(ob, "rotation_euler", text="Rotation")
row.column().itemR(ob, "scale")
layout.itemR(ob, "rotation_mode")
class OBJECT_PT_transform_locks(ObjectButtonsPanel):
bl_label = "Transform Locks"
bl_default_closed = True
def draw(self, context):
layout = self.layout
ob = context.object
row = layout.row()
col = row.column()
col.itemR(ob, "lock_location")
col = row.column()
if ob.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'):
col.itemR(ob, "lock_rotations_4d", text="Lock Rotation")
if ob.lock_rotations_4d:
col.itemR(ob, "lock_rotation_w", text="W")
col.itemR(ob, "lock_rotation", text="")
else:
col.itemR(ob, "lock_rotation", text="Rotation")
row.column().itemR(ob, "lock_scale")
class OBJECT_PT_relations(ObjectButtonsPanel):
bl_label = "Relations"
def draw(self, context):
layout = self.layout
ob = context.object
split = layout.split()
col = split.column()
col.itemR(ob, "layers")
col.itemS()
col.itemR(ob, "pass_index")
col = split.column()
col.itemL(text="Parent:")
col.itemR(ob, "parent", text="")
sub = col.column()
split = sub.split(percentage=0.3)
split.itemL(text="Type:")
split.itemR(ob, "parent_type", text="")
parent = ob.parent
if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="")
sub.active = parent != None
class OBJECT_PT_groups(ObjectButtonsPanel):
bl_label = "Groups"
def draw(self, context):
layout = self.layout
ob = context.object
split = layout.split()
split.item_menu_enumO("object.group_add", "group", text="Add to Group")
split.itemL()
for group in bpy.data.groups:
if ob.name in group.objects:
col = layout.column(align=True)
col.set_context_pointer("group", group)
row = col.box().row()
row.itemR(group, "name", text="")
row.itemO("object.group_remove", text="", icon='VICON_X')
split = col.box().split()
split.column().itemR(group, "layer", text="Dupli")
split.column().itemR(group, "dupli_offset", text="")
class OBJECT_PT_display(ObjectButtonsPanel):
bl_label = "Display"
def draw(self, context):
layout = self.layout
ob = context.object
split = layout.split()
col = split.column()
col.itemR(ob, "max_draw_type", text="Type")
col = split.column()
row = col.row()
row.itemR(ob, "draw_bounds", text="Bounds")
sub = row.row()
sub.active = ob.draw_bounds
sub.itemR(ob, "draw_bounds_type", text="")
flow = layout.column_flow()
flow.itemR(ob, "draw_name", text="Name")
flow.itemR(ob, "draw_axis", text="Axis")
flow.itemR(ob, "draw_wire", text="Wire")
flow.itemR(ob, "draw_texture_space", text="Texture Space")
flow.itemR(ob, "x_ray", text="X-Ray")
flow.itemR(ob, "draw_transparent", text="Transparency")
class OBJECT_PT_duplication(ObjectButtonsPanel):
bl_label = "Duplication"
def draw(self, context):
layout = self.layout
ob = context.object
layout.itemR(ob, "dupli_type", expand=True)
if ob.dupli_type == 'FRAMES':
split = layout.split()
col = split.column(align=True)
col.itemR(ob, "dupli_frames_start", text="Start")
col.itemR(ob, "dupli_frames_end", text="End")
col = split.column(align=True)
col.itemR(ob, "dupli_frames_on", text="On")
col.itemR(ob, "dupli_frames_off", text="Off")
layout.itemR(ob, "dupli_frames_no_speed", text="No Speed")
elif ob.dupli_type == 'VERTS':
layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
elif ob.dupli_type == 'FACES':
row = layout.row()
row.itemR(ob, "dupli_faces_scale", text="Scale")
row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
elif ob.dupli_type == 'GROUP':
layout.itemR(ob, "dupli_group", text="Group")
class OBJECT_PT_animation(ObjectButtonsPanel):
bl_label = "Animation"
def draw(self, context):
layout = self.layout
ob = context.object
split = layout.split()
col = split.column()
col.itemL(text="Time Offset:")
col.itemR(ob, "time_offset_edit", text="Edit")
row = col.row()
row.itemR(ob, "time_offset_particle", text="Particle")
row.active = len(ob.particle_systems) != 0
row = col.row()
row.itemR(ob, "time_offset_parent", text="Parent")
row.active = ob.parent != None
row = col.row()
row.itemR(ob, "slow_parent")
row.active = ob.parent != None
col.itemR(ob, "time_offset", text="Offset")
col = split.column()
col.itemL(text="Track:")
col.itemR(ob, "track", text="")
col.itemR(ob, "track_axis", text="Axis")
col.itemR(ob, "up_axis", text="Up Axis")
row = col.row()
row.itemR(ob, "track_override_parent", text="Override Parent")
row.active = ob.parent != None
bpy.types.register(OBJECT_PT_context_object)
bpy.types.register(OBJECT_PT_transform)
bpy.types.register(OBJECT_PT_transform_locks)
bpy.types.register(OBJECT_PT_relations)
bpy.types.register(OBJECT_PT_groups)
bpy.types.register(OBJECT_PT_display)
bpy.types.register(OBJECT_PT_duplication)
bpy.types.register(OBJECT_PT_animation)
|