1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # ##### END GPL LICENSE BLOCK #####
25 class ObjectButtonsPanel(bpy.types.Panel):
26 bl_space_type = 'PROPERTIES'
27 bl_region_type = 'WINDOW'
31 class OBJECT_PT_context_object(ObjectButtonsPanel):
33 bl_show_header = False
35 def draw(self, context):
41 row.itemL(text="", icon='ICON_OBJECT_DATA')
42 row.itemR(ob, "name", text="")
45 class OBJECT_PT_transform(ObjectButtonsPanel):
46 bl_label = "Transform"
48 def draw(self, context):
52 col2 = context.region.width > narrowui
57 row.column().itemR(ob, "location")
58 if ob.rotation_mode == 'QUATERNION':
59 row.column().itemR(ob, "rotation_quaternion", text="Rotation")
60 elif ob.rotation_mode == 'AXIS_ANGLE':
61 #row.column().itemL(text="Rotation")
62 #row.column().itemR(pchan, "rotation_angle", text="Angle")
63 #row.column().itemR(pchan, "rotation_axis", text="Axis")
64 row.column().itemR(ob, "rotation_axis_angle", text="Rotation")
66 row.column().itemR(ob, "rotation_euler", text="Rotation")
68 row.column().itemR(ob, "scale")
70 layout.itemR(ob, "rotation_mode")
73 col.itemR(ob, "location")
74 col.itemL(text="Rotation:")
75 col.itemR(ob, "rotation_mode", text="")
76 if ob.rotation_mode == 'QUATERNION':
77 col.itemR(ob, "rotation_quaternion", text="")
78 elif ob.rotation_mode == 'AXIS_ANGLE':
79 col.itemR(ob, "rotation_axis_angle", text="")
81 col.itemR(ob, "rotation_euler", text="")
82 col.itemR(ob, "scale")
85 class OBJECT_PT_transform_locks(ObjectButtonsPanel):
86 bl_label = "Transform Locks"
87 bl_default_closed = True
89 def draw(self, context):
93 # col2 = context.region.width > narrowui
98 col.itemR(ob, "lock_location", text="Location")
101 if ob.rotation_mode in ('QUATERNION', 'AXIS_ANGLE'):
102 col.itemR(ob, "lock_rotations_4d", text="Rotation")
103 if ob.lock_rotations_4d:
104 col.itemR(ob, "lock_rotation_w", text="W")
105 col.itemR(ob, "lock_rotation", text="")
107 col.itemR(ob, "lock_rotation", text="Rotation")
109 row.column().itemR(ob, "lock_scale", text="Scale")
112 class OBJECT_PT_relations(ObjectButtonsPanel):
113 bl_label = "Relations"
115 def draw(self, context):
119 col2 = context.region.width > narrowui
121 split = layout.split()
124 col.itemR(ob, "layers")
126 col.itemR(ob, "pass_index")
130 col.itemL(text="Parent:")
131 col.itemR(ob, "parent", text="")
134 sub.itemR(ob, "parent_type", text="")
136 if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
137 sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="")
138 sub.active = parent != None
141 class OBJECT_PT_groups(ObjectButtonsPanel):
144 def draw(self, context):
148 col2 = context.region.width > narrowui
151 split = layout.split()
152 split.item_menu_enumO("object.group_add", "group", text="Add to Group")
155 layout.item_menu_enumO("object.group_add", "group", text="Add to Group")
157 for group in bpy.data.groups:
158 if ob.name in group.objects:
159 col = layout.column(align=True)
161 col.set_context_pointer("group", group)
163 row = col.box().row()
164 row.itemR(group, "name", text="")
165 row.itemO("object.group_remove", text="", icon='VICON_X')
167 split = col.box().split()
170 col.itemR(group, "layer", text="Dupli")
174 col.itemR(group, "dupli_offset", text="")
177 class OBJECT_PT_display(ObjectButtonsPanel):
180 def draw(self, context):
184 col2 = context.region.width > narrowui
186 split = layout.split()
188 col.itemR(ob, "max_draw_type", text="Type")
193 row.itemR(ob, "draw_bounds", text="Bounds")
195 sub.active = ob.draw_bounds
196 sub.itemR(ob, "draw_bounds_type", text="")
198 split = layout.split()
201 col.itemR(ob, "draw_name", text="Name")
202 col.itemR(ob, "draw_axis", text="Axis")
203 col.itemR(ob, "draw_wire", text="Wire")
207 col.itemR(ob, "draw_texture_space", text="Texture Space")
208 col.itemR(ob, "x_ray", text="X-Ray")
209 col.itemR(ob, "draw_transparent", text="Transparency")
212 class OBJECT_PT_duplication(ObjectButtonsPanel):
213 bl_label = "Duplication"
215 def draw(self, context):
219 col2 = context.region.width > narrowui
222 layout.itemR(ob, "dupli_type", expand=True)
224 layout.itemR(ob, "dupli_type", text="")
226 if ob.dupli_type == 'FRAMES':
227 split = layout.split()
229 col = split.column(align=True)
230 col.itemR(ob, "dupli_frames_start", text="Start")
231 col.itemR(ob, "dupli_frames_end", text="End")
234 col = split.column(align=True)
235 col.itemR(ob, "dupli_frames_on", text="On")
236 col.itemR(ob, "dupli_frames_off", text="Off")
238 layout.itemR(ob, "dupli_frames_no_speed", text="No Speed")
240 elif ob.dupli_type == 'VERTS':
241 layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
243 elif ob.dupli_type == 'FACES':
244 split = layout.split()
247 col.itemR(ob, "dupli_faces_scale", text="Scale")
251 col.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
253 elif ob.dupli_type == 'GROUP':
255 layout.itemR(ob, "dupli_group", text="Group")
257 layout.itemR(ob, "dupli_group", text="")
260 class OBJECT_PT_animation(ObjectButtonsPanel):
261 bl_label = "Animation"
263 def draw(self, context):
267 col2 = context.region.width > narrowui
269 split = layout.split()
272 col.itemL(text="Time Offset:")
273 col.itemR(ob, "time_offset_edit", text="Edit")
275 row.itemR(ob, "time_offset_particle", text="Particle")
276 row.active = len(ob.particle_systems) != 0
278 row.itemR(ob, "time_offset_parent", text="Parent")
279 row.active = ob.parent != None
281 row.itemR(ob, "slow_parent")
282 row.active = ob.parent != None
283 col.itemR(ob, "time_offset", text="Offset")
287 col.itemL(text="Track:")
288 col.itemR(ob, "track", text="")
289 col.itemR(ob, "track_axis", text="Axis")
290 col.itemR(ob, "up_axis", text="Up Axis")
292 row.itemR(ob, "track_override_parent", text="Override Parent")
293 row.active = ob.parent != None
296 class OBJECT_PT_properties(ObjectButtonsPanel):
297 bl_label = "Properties"
298 bl_default_closed = True
300 def draw(self, context):
302 # reload(rna_prop_ui)
304 rna_prop_ui.draw(self.layout, context, "object")
306 bpy.types.register(OBJECT_PT_context_object)
307 bpy.types.register(OBJECT_PT_transform)
308 bpy.types.register(OBJECT_PT_transform_locks)
309 bpy.types.register(OBJECT_PT_relations)
310 bpy.types.register(OBJECT_PT_groups)
311 bpy.types.register(OBJECT_PT_display)
312 bpy.types.register(OBJECT_PT_duplication)
313 bpy.types.register(OBJECT_PT_animation)
314 bpy.types.register(OBJECT_PT_properties)