UI:
[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.active_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.active_object
18                 layout = self.layout
19
20                 layout.row()
21                 layout.itemR(ob, "location")
22                 layout.itemR(ob, "rotation")
23                 layout.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.active_object
31                 layout = self.layout
32
33                 layout.row()
34                 layout.itemR(ob, "pass_index")
35                 layout.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                                 sub = layout.box()
43
44                                 sub.split(number=2, lr=True)
45                                 sub.sub(0).itemR(group, "name")
46                                 # sub.sub(1).itemO("OBJECT_OT_remove_group")
47
48                                 sub.row()
49                                 sub.itemR(group, "layer")
50                                 sub.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.active_object
58                 layout = self.layout
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(ObjectButtonsPanel):
73         __idname__ = "OBJECT_PT_duplication"
74         __label__ = "Duplication"
75
76         def draw(self, context):
77                 ob = context.active_object
78                 layout = self.layout
79
80                 layout.column()
81                 layout.itemR(ob, "dupli_type", text="", expand=True)
82
83                 if ob.dupli_type == "FRAMES":
84                         layout.column_flow()
85                         layout.itemR(ob, "dupli_frames_start", text="Start")
86                         layout.itemR(ob, "dupli_frames_end", text="End")
87                         layout.itemR(ob, "dupli_frames_on", text="On")
88                         layout.itemR(ob, "dupli_frames_off", text="Off")
89
90 class OBJECT_PT_animation(ObjectButtonsPanel):
91         __idname__ = "OBJECT_PT_animation"
92         __label__ = "Animation"
93
94         def draw(self, context):
95                 ob = context.active_object
96                 layout = self.layout
97
98                 layout.split(number=2)
99                 
100                 sub = layout.sub(0)
101                 sub.column()
102                 sub.itemL(text="Time Offset:")
103                 sub.itemR(ob, "time_offset_edit", text="Edit")
104                 sub.itemR(ob, "time_offset_particle", text="Particle")
105                 sub.itemR(ob, "time_offset_parent", text="Parent")
106                 sub.itemR(ob, "slow_parent")
107                 sub.itemR(ob, "time_offset", text="Offset")
108                 
109                 sub = layout.sub(1)
110                 sub.column()
111                 sub.itemL(text="Tracking:")
112                 sub.itemR(ob, "track_axis", text="Axis")
113                 sub.itemR(ob, "up_axis", text="Up Axis")
114                 sub.itemR(ob, "track_rotation", text="Rotation")
115
116 bpy.types.register(OBJECT_PT_transform)
117 bpy.types.register(OBJECT_PT_groups)
118 bpy.types.register(OBJECT_PT_display)
119 bpy.types.register(OBJECT_PT_duplication)
120 bpy.types.register(OBJECT_PT_animation)
121