ObColor wasnt converted into an RNA string.
[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 class OBJECT_PT_transform(ObjectButtonsPanel):
10         __idname__ = "OBJECT_PT_transform"
11         __label__ = "Transform"
12
13         def draw(self, context):
14                 layout = self.layout
15                 ob = context.object
16
17                 row = layout.row()
18                 row.column().itemR(ob, "location")
19                 row.column().itemR(ob, "rotation")
20                 row.column().itemR(ob, "scale")
21
22 class OBJECT_PT_groups(ObjectButtonsPanel):
23         __idname__ = "OBJECT_PT_groups"
24         __label__ = "Groups"
25
26         def draw(self, context):
27                 layout = self.layout
28                 ob = context.object
29
30                 row = layout.row()
31                 row.itemR(ob, "pass_index")
32                 row.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.name in group.objects:
39                                 col = layout.column(align=True)
40
41                                 row = col.box().row()
42                                 row.itemR(group, "name", text="")
43                                 #row.itemO("OBJECT_OT_remove_group")
44
45                                 split = col.box().split()
46                                 split.column().itemR(group, "layer")
47                                 split.column().itemR(group, "dupli_offset")
48
49 class OBJECT_PT_display(ObjectButtonsPanel):
50         __idname__ = "OBJECT_PT_display"
51         __label__ = "Display"
52
53         def draw(self, context):
54                 layout = self.layout
55                 ob = context.object
56                         
57                 row = layout.row()
58                 row.itemR(ob, "max_draw_type", text="Type")
59                 row.itemR(ob, "draw_bounds_type", text="Bounds")
60
61                 flow = layout.column_flow()
62                 flow.itemR(ob, "draw_name", text="Name")
63                 flow.itemR(ob, "draw_axis", text="Axis")
64                 flow.itemR(ob, "draw_wire", text="Wire")
65                 flow.itemR(ob, "draw_texture_space", text="Texture Space")
66                 flow.itemR(ob, "x_ray", text="X-Ray")
67                 flow.itemR(ob, "draw_transparent", text="Transparency")
68
69 class OBJECT_PT_duplication(ObjectButtonsPanel):
70         __idname__ = "OBJECT_PT_duplication"
71         __label__ = "Duplication"
72
73         def draw(self, context):
74                 layout = self.layout
75                 ob = context.object
76
77                 layout.itemR(ob, "dupli_type", expand=True)
78
79                 if ob.dupli_type == 'FRAMES':
80                         split = layout.split()
81                         
82                         sub = split.column(align=True)
83                         sub.itemR(ob, "dupli_frames_start", text="Start")
84                         sub.itemR(ob, "dupli_frames_end", text="End")
85                         
86                         sub = split.column(align=True)
87                         sub.itemR(ob, "dupli_frames_on", text="On")
88                         sub.itemR(ob, "dupli_frames_off", text="Off")
89                         
90                         layout.itemR(ob, "dupli_frames_no_speed", text="No Speed")
91
92                 elif ob.dupli_type == 'VERTS':
93                         layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
94
95                 elif ob.dupli_type == 'FACES':
96                         row = layout.row()
97                         row.itemR(ob, "dupli_faces_scale", text="Scale")
98                         row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
99
100                 elif ob.dupli_type == 'GROUP':
101                         layout.itemR(ob, "dupli_group", text="Group")
102
103 class OBJECT_PT_animation(ObjectButtonsPanel):
104         __idname__ = "OBJECT_PT_animation"
105         __label__ = "Animation"
106
107         def draw(self, context):
108                 layout = self.layout
109                 ob = context.object
110                 
111                 split = layout.split()
112                 
113                 sub = split.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 = split.column()
122                 sub.itemL(text="Tracking:")
123                 sub.itemR(ob, "track_axis", text="Axis")
124                 sub.itemR(ob, "up_axis", text="Up Axis")
125                 sub.itemR(ob, "track_rotation", text="Rotation")
126
127 bpy.types.register(OBJECT_PT_transform)
128 bpy.types.register(OBJECT_PT_groups)
129 bpy.types.register(OBJECT_PT_display)
130 bpy.types.register(OBJECT_PT_duplication)
131 bpy.types.register(OBJECT_PT_animation)