UI:
[blender-staging.git] / release / ui / buttons_objects.py
1
2 class OBJECT_PT_transform(bpy.types.Panel):
3         __label__ = "Transform"
4         __context__ = "object"
5
6         def draw(self, context):
7                 ob = context.active_object
8                 layout = self.layout
9
10                 if not ob:
11                         return
12
13                 layout.template_column_flow(3)
14                 layout.itemR(ob, "location")
15                 layout.itemR(ob, "rotation")
16                 layout.itemR(ob, "scale")
17
18 class OBJECT_PT_groups(bpy.types.Panel):
19         __label__ = "Groups"
20         __context__ = "object"
21
22         def draw(self, context):
23                 ob = context.active_object
24                 layout = self.layout
25
26                 if not ob:
27                         return
28
29                 layout.template_column_flow(2)
30                 layout.itemR(ob, "pass_index")
31                 layout.itemR(ob, "parent")
32
33                 # layout.template_left_right()
34                 # layout.itemO("OBJECT_OT_add_group");
35
36                 for group in bpy.data.groups:
37                         if ob in group.objects:
38                                 sublayout = layout.template_stack()
39
40                                 sublayout.template_left_right()
41                                 sublayout.itemR(group, "name")
42                                 # sublayout.itemO("OBJECT_OT_remove_group")
43
44                                 sublayout.template_column_flow(2)
45                                 sublayout.itemR(group, "layer")
46                                 sublayout.itemR(group, "dupli_offset")
47
48 class OBJECT_PT_display(bpy.types.Panel):
49         __label__ = "Display"
50         __context__ = "object"
51
52         def draw(self, context):
53                 ob = context.active_object
54                 layout = self.layout
55
56                 if not ob:
57                         return
58
59                 layout.template_column_flow(2)
60                 layout.itemR(ob, "max_draw_type", text="Type")
61                 layout.itemR(ob, "draw_bounds_type", text="Bounds")
62
63                 layout.template_column_flow(2)
64                 layout.itemR(ob, "draw_name", text="Name")
65                 layout.itemR(ob, "draw_axis", text="Axis")
66                 layout.itemR(ob, "draw_wire", text="Wire")
67                 layout.itemR(ob, "draw_texture_space", text="Texture Space")
68                 layout.itemR(ob, "x_ray", text="X-Ray")
69                 layout.itemR(ob, "draw_transparent", text="Transparency")
70
71 class OBJECT_PT_duplication(bpy.types.Panel):
72         __label__ = "Duplication"
73         __context__ = "object"
74
75         def draw(self, context):
76                 ob = context.active_object
77                 layout = self.layout
78
79                 if not ob:
80                         return
81
82                 layout.template_column()
83                 layout.itemR(ob, "dupli_type", text="")
84
85                 if ob.dupli_type == "FRAMES":
86                         layout.template_column_flow(2)
87                         layout.itemR(ob, "dupli_frames_start", text="Start:")
88                         layout.itemR(ob, "dupli_frames_end", text="End:")
89                         layout.itemR(ob, "dupli_frames_on", text="On:")
90                         layout.itemR(ob, "dupli_frames_off", text="Off:")
91
92 class OBJECT_PT_animation(bpy.types.Panel):
93         __label__ = "Animation"
94         __context__ = "object"
95
96         def draw(self, context):
97                 ob = context.active_object
98                 layout = self.layout
99
100                 if not ob:
101                         return
102
103                 layout.template_column()
104                 
105                 layout.template_slot("COLUMN_1")
106                 layout.itemL(text="Time Offset:")
107                 layout.itemR(ob, "time_offset_edit", text="Edit")
108                 layout.itemR(ob, "time_offset_particle", text="Particle")
109                 layout.itemR(ob, "time_offset_parent", text="Parent")
110                 layout.itemR(ob, "slow_parent")
111                 layout.itemR(ob, "time_offset", text="Offset:")
112                 
113                 layout.template_slot("COLUMN_2")
114                 layout.itemL(text="Tracking:")
115                 layout.itemR(ob, "track_axis", text="Axis")
116                 layout.itemR(ob, "up_axis", text="Up Axis")
117                 layout.itemR(ob, "track_rotation", text="Rotation")
118
119 bpy.ui.addPanel(OBJECT_PT_transform, "BUTTONS_WINDOW", "WINDOW")
120 bpy.ui.addPanel(OBJECT_PT_groups, "BUTTONS_WINDOW", "WINDOW")
121 bpy.ui.addPanel(OBJECT_PT_display, "BUTTONS_WINDOW", "WINDOW")
122 bpy.ui.addPanel(OBJECT_PT_duplication, "BUTTONS_WINDOW", "WINDOW")
123 bpy.ui.addPanel(OBJECT_PT_animation, "BUTTONS_WINDOW", "WINDOW")
124