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