4 class ObjectButtonsPanel(bpy.types.Panel):
5 __space_type__ = "BUTTONS_WINDOW"
6 __region_type__ = "WINDOW"
9 class OBJECT_PT_context_object(ObjectButtonsPanel):
10 __idname__ = "OBJECT_PT_context_object"
13 def draw(self, context):
17 split = layout.split(percentage=0.06)
18 split.itemL(text="", icon="ICON_OBJECT_DATA")
19 split.itemR(ob, "name", text="")
21 class OBJECT_PT_transform(ObjectButtonsPanel):
22 __idname__ = "OBJECT_PT_transform"
23 __label__ = "Transform"
25 def draw(self, context):
30 row.column().itemR(ob, "location")
31 row.column().itemR(ob, "rotation")
32 row.column().itemR(ob, "scale")
34 class OBJECT_PT_relations(ObjectButtonsPanel):
35 __idname__ = "OBJECT_PT_relations"
36 __label__ = "Relations"
38 def draw(self, context):
42 split = layout.split()
44 col.itemR(ob, "layers")
46 col.itemR(ob, "pass_index")
49 col.itemL(text="Parent:")
50 col.itemR(ob, "parent", text="")
53 sub.itemR(ob, "parent_type", text="Type")
55 if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
56 sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="")
57 sub.active = parent != None
59 class OBJECT_PT_groups(ObjectButtonsPanel):
60 __idname__ = "OBJECT_PT_groups"
63 def draw(self, context):
67 split = layout.split()
68 split.item_menu_enumO("OBJECT_OT_group_add", "group", text="Add to Group")
71 for group in bpy.data.groups:
72 if ob.name in group.objects:
73 col = layout.column(align=True)
75 col.set_context_pointer("group", group)
78 row.itemR(group, "name", text="")
79 row.itemO("OBJECT_OT_group_remove", text="", icon="VICON_X")
81 split = col.box().split()
82 split.column().itemR(group, "layer", text="Dupli")
83 split.column().itemR(group, "dupli_offset", text="")
85 class OBJECT_PT_display(ObjectButtonsPanel):
86 __idname__ = "OBJECT_PT_display"
89 def draw(self, context):
94 row.itemR(ob, "max_draw_type", text="Type")
95 row.itemR(ob, "draw_bounds_type", text="Bounds")
97 flow = layout.column_flow()
98 flow.itemR(ob, "draw_name", text="Name")
99 flow.itemR(ob, "draw_axis", text="Axis")
100 flow.itemR(ob, "draw_wire", text="Wire")
101 flow.itemR(ob, "draw_texture_space", text="Texture Space")
102 flow.itemR(ob, "x_ray", text="X-Ray")
103 flow.itemR(ob, "draw_transparent", text="Transparency")
105 class OBJECT_PT_duplication(ObjectButtonsPanel):
106 __idname__ = "OBJECT_PT_duplication"
107 __label__ = "Duplication"
109 def draw(self, context):
113 layout.itemR(ob, "dupli_type", expand=True)
115 if ob.dupli_type == 'FRAMES':
116 split = layout.split()
118 sub = split.column(align=True)
119 sub.itemR(ob, "dupli_frames_start", text="Start")
120 sub.itemR(ob, "dupli_frames_end", text="End")
122 sub = split.column(align=True)
123 sub.itemR(ob, "dupli_frames_on", text="On")
124 sub.itemR(ob, "dupli_frames_off", text="Off")
126 layout.itemR(ob, "dupli_frames_no_speed", text="No Speed")
128 elif ob.dupli_type == 'VERTS':
129 layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
131 elif ob.dupli_type == 'FACES':
133 row.itemR(ob, "dupli_faces_scale", text="Scale")
134 row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
136 elif ob.dupli_type == 'GROUP':
137 layout.itemR(ob, "dupli_group", text="Group")
139 class OBJECT_PT_animation(ObjectButtonsPanel):
140 __idname__ = "OBJECT_PT_animation"
141 __label__ = "Animation"
143 def draw(self, context):
147 split = layout.split()
150 sub.itemL(text="Time Offset:")
151 sub.itemR(ob, "time_offset_edit", text="Edit")
153 row.itemR(ob, "time_offset_particle", text="Particle")
154 row.active = len(ob.particle_systems) != 0
156 row.itemR(ob, "time_offset_parent", text="Parent")
157 row.active = ob.parent != None
159 row.itemR(ob, "slow_parent")
160 row.active = ob.parent != None
161 sub.itemR(ob, "time_offset", text="Offset")
164 sub.itemL(text="Tracking:")
165 sub.itemR(ob, "track", text="")
166 sub.itemR(ob, "track_axis", text="Axis")
167 sub.itemR(ob, "up_axis", text="Up Axis")
169 row.itemR(ob, "track_override_parent", text="Override Parent")
170 row.active = ob.parent != None
172 bpy.types.register(OBJECT_PT_context_object)
173 bpy.types.register(OBJECT_PT_transform)
174 bpy.types.register(OBJECT_PT_relations)
175 bpy.types.register(OBJECT_PT_groups)
176 bpy.types.register(OBJECT_PT_display)
177 bpy.types.register(OBJECT_PT_duplication)
178 bpy.types.register(OBJECT_PT_animation)