2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19323...
[blender-staging.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 class OBJECT_PT_transform(ObjectButtonsPanel):
10         __idname__ = "OBJECT_PT_transform"
11         __label__ = "Transform"
12
13         def draw(self, context):
14                 ob = context.active_object
15                 layout = self.layout
16
17                 if not ob:
18                         return
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                 if not ob:
34                         return
35
36                 layout.row()
37                 layout.itemR(ob, "pass_index")
38                 layout.itemR(ob, "parent")
39
40                 # layout.left_right()
41                 # layout.itemO("OBJECT_OT_add_group");
42
43                 for group in bpy.data.groups:
44                         if ob in group.objects:
45                                 sub = layout.box()
46
47                                 sub.split(number=2, lr=True)
48                                 sub.sub(0).itemR(group, "name")
49                                 # sub.sub(1).itemO("OBJECT_OT_remove_group")
50
51                                 sub.row()
52                                 sub.itemR(group, "layer")
53                                 sub.itemR(group, "dupli_offset")
54
55 class OBJECT_PT_display(ObjectButtonsPanel):
56         __idname__ = "OBJECT_PT_display"
57         __label__ = "Display"
58
59         def draw(self, context):
60                 ob = context.active_object
61                 layout = self.layout
62
63                 if not ob:
64                         return
65
66                 layout.row()
67                 layout.itemR(ob, "max_draw_type", text="Type")
68                 layout.itemR(ob, "draw_bounds_type", text="Bounds")
69
70                 layout.column_flow()
71                 layout.itemR(ob, "draw_name", text="Name")
72                 layout.itemR(ob, "draw_axis", text="Axis")
73                 layout.itemR(ob, "draw_wire", text="Wire")
74                 layout.itemR(ob, "draw_texture_space", text="Texture Space")
75                 layout.itemR(ob, "x_ray", text="X-Ray")
76                 layout.itemR(ob, "draw_transparent", text="Transparency")
77
78 class OBJECT_PT_duplication(ObjectButtonsPanel):
79         __idname__ = "OBJECT_PT_duplication"
80         __label__ = "Duplication"
81
82         def draw(self, context):
83                 ob = context.active_object
84                 layout = self.layout
85
86                 if not ob:
87                         return
88
89                 layout.column()
90                 layout.itemR(ob, "dupli_type", text="", expand=True)
91
92                 if ob.dupli_type == "FRAMES":
93                         layout.column_flow()
94                         layout.itemR(ob, "dupli_frames_start", text="Start:")
95                         layout.itemR(ob, "dupli_frames_end", text="End:")
96                         layout.itemR(ob, "dupli_frames_on", text="On:")
97                         layout.itemR(ob, "dupli_frames_off", text="Off:")
98
99 class OBJECT_PT_animation(ObjectButtonsPanel):
100         __idname__ = "OBJECT_PT_animation"
101         __label__ = "Animation"
102
103         def draw(self, context):
104                 ob = context.active_object
105                 layout = self.layout
106
107                 if not ob:
108                         return
109
110                 layout.split(number=2)
111                 
112                 sub = layout.sub(0)
113                 sub.column()
114                 sub.itemL(text="Time Offset:")
115                 sub.itemR(ob, "time_offset_edit", text="Edit")
116                 sub.itemR(ob, "time_offset_particle", text="Particle")
117                 sub.itemR(ob, "time_offset_parent", text="Parent")
118                 sub.itemR(ob, "slow_parent")
119                 sub.itemR(ob, "time_offset", text="Offset:")
120                 
121                 sub = layout.sub(1)
122                 sub.column()
123                 sub.itemL(text="Tracking:")
124                 sub.itemR(ob, "track_axis", text="Axis")
125                 sub.itemR(ob, "up_axis", text="Up Axis")
126                 sub.itemR(ob, "track_rotation", text="Rotation")
127
128 bpy.types.register(OBJECT_PT_transform)
129 bpy.types.register(OBJECT_PT_groups)
130 bpy.types.register(OBJECT_PT_display)
131 bpy.types.register(OBJECT_PT_duplication)
132 bpy.types.register(OBJECT_PT_animation)
133