merged from trunk 20741:20848
[blender.git] / release / ui / buttons_objects.py
1
2 import bpy
3
4 class ObjectButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "object"
8
9         def poll(self, context):
10                 return (context.object != None)
11
12 class OBJECT_PT_transform(ObjectButtonsPanel):
13         __idname__ = "OBJECT_PT_transform"
14         __label__ = "Transform"
15
16         def draw(self, context):
17                 ob = context.object
18                 layout = self.layout
19
20                 row = layout.row()
21                 row.column().itemR(ob, "location")
22                 row.column().itemR(ob, "rotation")
23                 row.column().itemR(ob, "scale")
24
25 class OBJECT_PT_groups(ObjectButtonsPanel):
26         __idname__ = "OBJECT_PT_groups"
27         __label__ = "Groups"
28
29         def draw(self, context):
30                 ob = context.object
31                 layout = self.layout
32
33                 row = layout.row()
34                 row.itemR(ob, "pass_index")
35                 row.itemR(ob, "parent")
36
37                 # layout.left_right()
38                 # layout.itemO("OBJECT_OT_add_group");
39
40                 for group in bpy.data.groups:
41                         if ob in group.objects:
42                                 col = layout.column(align=True)
43
44                                 row = col.box().row()
45                                 row.itemR(group, "name", text="")
46                                 #row.itemO("OBJECT_OT_remove_group")
47
48                                 split = col.box().split()
49                                 split.column().itemR(group, "layer")
50                                 split.column().itemR(group, "dupli_offset")
51
52 class OBJECT_PT_display(ObjectButtonsPanel):
53         __idname__ = "OBJECT_PT_display"
54         __label__ = "Display"
55
56         def draw(self, context):
57                 ob = context.object
58                 layout = self.layout
59                         
60                 row = layout.row()
61                 row.itemR(ob, "max_draw_type", text="Type")
62                 row.itemR(ob, "draw_bounds_type", text="Bounds")
63
64                 flow = layout.column_flow()
65                 flow.itemR(ob, "draw_name", text="Name")
66                 flow.itemR(ob, "draw_axis", text="Axis")
67                 flow.itemR(ob, "draw_wire", text="Wire")
68                 flow.itemR(ob, "draw_texture_space", text="Texture Space")
69                 flow.itemR(ob, "x_ray", text="X-Ray")
70                 flow.itemR(ob, "draw_transparent", text="Transparency")
71
72 class OBJECT_PT_duplication(ObjectButtonsPanel):
73         __idname__ = "OBJECT_PT_duplication"
74         __label__ = "Duplication"
75
76         def draw(self, context):
77                 ob = context.object
78                 layout = self.layout
79
80                 layout.itemR(ob, "dupli_type", expand=True)
81
82                 if ob.dupli_type == 'FRAMES':
83                         split = layout.split()
84                         
85                         sub = split.column(align=True)
86                         sub.itemR(ob, "dupli_frames_start", text="Start")
87                         sub.itemR(ob, "dupli_frames_end", text="End")
88                         
89                         sub = split.column(align=True)
90                         sub.itemR(ob, "dupli_frames_on", text="On")
91                         sub.itemR(ob, "dupli_frames_off", text="Off")
92                         
93                         layout.itemR(ob, "dupli_frames_no_speed", text="No Speed")
94
95                 elif ob.dupli_type == 'VERTS':
96                         layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
97
98                 elif ob.dupli_type == 'FACES':
99                         row = layout.row()
100                         row.itemR(ob, "dupli_faces_scale", text="Scale")
101                         row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
102
103                 elif ob.dupli_type == 'GROUP':
104                         layout.itemR(ob, "dupli_group", text="Group")
105
106 class OBJECT_PT_animation(ObjectButtonsPanel):
107         __idname__ = "OBJECT_PT_animation"
108         __label__ = "Animation"
109
110         def draw(self, context):
111                 ob = context.object
112                 layout = self.layout
113                 
114                 split = layout.split()
115                 
116                 sub = split.column()
117                 sub.itemL(text="Time Offset:")
118                 sub.itemR(ob, "time_offset_edit", text="Edit")
119                 sub.itemR(ob, "time_offset_particle", text="Particle")
120                 sub.itemR(ob, "time_offset_parent", text="Parent")
121                 sub.itemR(ob, "slow_parent")
122                 sub.itemR(ob, "time_offset", text="Offset")
123                 
124                 sub = split.column()
125                 sub.itemL(text="Tracking:")
126                 sub.itemR(ob, "track_axis", text="Axis")
127                 sub.itemR(ob, "up_axis", text="Up Axis")
128                 sub.itemR(ob, "track_rotation", text="Rotation")
129
130 bpy.types.register(OBJECT_PT_transform)
131 bpy.types.register(OBJECT_PT_groups)
132 bpy.types.register(OBJECT_PT_display)
133 bpy.types.register(OBJECT_PT_duplication)
134 bpy.types.register(OBJECT_PT_animation)
135