4 class ObjectButtonsPanel(bpy.types.Panel):
5 __space_type__ = 'PROPERTIES'
6 __region_type__ = 'WINDOW'
9 class OBJECT_PT_context_object(ObjectButtonsPanel):
10 __show_header__ = False
12 def draw(self, context):
18 row.itemL(text="", icon='ICON_OBJECT_DATA')
19 row.itemR(ob, "name", text="")
21 class OBJECT_PT_transform(ObjectButtonsPanel):
22 __label__ = "Transform"
24 def draw(self, context):
33 row.column().itemR(ob, "location")
34 if ob.rotation_mode == 'QUATERNION':
35 row.column().itemR(ob, "rotation_quaternion", text="Rotation")
36 elif ob.rotation_mode == 'AXIS_ANGLE':
37 #row.column().itemL(text="Rotation")
38 #row.column().itemR(pchan, "rotation_angle", text="Angle")
39 #row.column().itemR(pchan, "rotation_axis", text="Axis")
40 row.column().itemR(ob, "rotation_axis_angle", text="Rotation")
42 row.column().itemR(ob, "rotation_euler", text="Rotation")
44 row.column().itemR(ob, "scale")
46 layout.itemR(ob, "rotation_mode")
48 class OBJECT_PT_transform_locks(ObjectButtonsPanel):
49 __label__ = "Transform Locks"
50 __default_closed__ = True
52 def draw(self, context):
60 col.itemR(ob, "lock_location")
63 if ob.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'):
64 col.itemR(ob, "lock_rotations_4d", text="Lock Rotation")
65 if ob.lock_rotations_4d:
66 col.itemR(ob, "lock_rotation_w", text="W")
67 col.itemR(ob, "lock_rotation", text="")
69 col.itemR(ob, "lock_rotation", text="Rotation")
71 row.column().itemR(ob, "lock_scale")
73 class OBJECT_PT_relations(ObjectButtonsPanel):
74 __label__ = "Relations"
76 def draw(self, context):
81 split = layout.split()
84 col.itemR(ob, "layers")
86 col.itemR(ob, "pass_index")
89 col.itemL(text="Parent:")
90 col.itemR(ob, "parent", text="")
93 split = sub.split(percentage=0.3)
94 split.itemL(text="Type:")
95 split.itemR(ob, "parent_type", text="")
97 if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
98 sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="")
99 sub.active = parent != None
101 class OBJECT_PT_groups(ObjectButtonsPanel):
104 def draw(self, context):
109 split = layout.split()
110 split.item_menu_enumO("object.group_add", "group", text="Add to Group")
113 for group in bpy.data.groups:
114 if ob.name in group.objects:
115 col = layout.column(align=True)
117 col.set_context_pointer("group", group)
119 row = col.box().row()
120 row.itemR(group, "name", text="")
121 row.itemO("object.group_remove", text="", icon='VICON_X')
123 split = col.box().split()
124 split.column().itemR(group, "layer", text="Dupli")
125 split.column().itemR(group, "dupli_offset", text="")
127 class OBJECT_PT_display(ObjectButtonsPanel):
128 __label__ = "Display"
130 def draw(self, context):
135 split = layout.split()
137 col.itemR(ob, "max_draw_type", text="Type")
140 row.itemR(ob, "draw_bounds", text="Bounds")
141 row.itemR(ob, "draw_bounds_type", text="")
143 flow = layout.column_flow()
144 flow.itemR(ob, "draw_name", text="Name")
145 flow.itemR(ob, "draw_axis", text="Axis")
146 flow.itemR(ob, "draw_wire", text="Wire")
147 flow.itemR(ob, "draw_texture_space", text="Texture Space")
148 flow.itemR(ob, "x_ray", text="X-Ray")
149 flow.itemR(ob, "draw_transparent", text="Transparency")
151 class OBJECT_PT_duplication(ObjectButtonsPanel):
152 __label__ = "Duplication"
154 def draw(self, context):
159 layout.itemR(ob, "dupli_type", expand=True)
161 if ob.dupli_type == 'FRAMES':
162 split = layout.split()
164 col = split.column(align=True)
165 col.itemR(ob, "dupli_frames_start", text="Start")
166 col.itemR(ob, "dupli_frames_end", text="End")
168 col = split.column(align=True)
169 col.itemR(ob, "dupli_frames_on", text="On")
170 col.itemR(ob, "dupli_frames_off", text="Off")
172 layout.itemR(ob, "dupli_frames_no_speed", text="No Speed")
174 elif ob.dupli_type == 'VERTS':
175 layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
177 elif ob.dupli_type == 'FACES':
179 row.itemR(ob, "dupli_faces_scale", text="Scale")
180 row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
182 elif ob.dupli_type == 'GROUP':
183 layout.itemR(ob, "dupli_group", text="Group")
185 class OBJECT_PT_animation(ObjectButtonsPanel):
186 __label__ = "Animation"
188 def draw(self, context):
193 split = layout.split()
196 col.itemL(text="Time Offset:")
197 col.itemR(ob, "time_offset_edit", text="Edit")
199 row.itemR(ob, "time_offset_particle", text="Particle")
200 row.active = len(ob.particle_systems) != 0
202 row.itemR(ob, "time_offset_parent", text="Parent")
203 row.active = ob.parent != None
205 row.itemR(ob, "slow_parent")
206 row.active = ob.parent != None
207 col.itemR(ob, "time_offset", text="Offset")
210 col.itemL(text="Track:")
211 col.itemR(ob, "track", text="")
212 col.itemR(ob, "track_axis", text="Axis")
213 col.itemR(ob, "up_axis", text="Up Axis")
215 row.itemR(ob, "track_override_parent", text="Override Parent")
216 row.active = ob.parent != None
218 bpy.types.register(OBJECT_PT_context_object)
219 bpy.types.register(OBJECT_PT_transform)
220 bpy.types.register(OBJECT_PT_transform_locks)
221 bpy.types.register(OBJECT_PT_relations)
222 bpy.types.register(OBJECT_PT_groups)
223 bpy.types.register(OBJECT_PT_display)
224 bpy.types.register(OBJECT_PT_duplication)
225 bpy.types.register(OBJECT_PT_animation)