Added game soft body settings, and cleaned up layout there slightly.
[blender.git] / release / ui / buttons_object.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_context_object(ObjectButtonsPanel):
10         __show_header__ = False
11
12         def draw(self, context):
13                 layout = self.layout
14                 
15                 ob = context.object
16                 
17                 row = layout.row()
18                 row.itemL(text="", icon="ICON_OBJECT_DATA")
19                 row.itemR(ob, "name", text="")
20
21 class OBJECT_PT_transform(ObjectButtonsPanel):
22         __label__ = "Transform"
23
24         def draw(self, context):
25                 layout = self.layout
26                 
27                 ob = context.object
28
29                 row = layout.row()
30                 row.column().itemR(ob, "location")
31                 row.column().itemR(ob, "rotation")
32                 row.column().itemR(ob, "scale")
33
34 class OBJECT_PT_relations(ObjectButtonsPanel):
35         __label__ = "Relations"
36
37         def draw(self, context):
38                 layout = self.layout
39                 
40                 ob = context.object
41
42                 split = layout.split()
43                 
44                 col = split.column()
45                 col.itemR(ob, "layers")
46                 col.itemS()
47                 col.itemR(ob, "pass_index")
48
49                 col = split.column()
50                 col.itemL(text="Parent:")
51                 col.itemR(ob, "parent", text="")
52
53                 sub = col.column()
54                 split = sub.split(percentage=0.3)
55                 split.itemL(text="Type:")
56                 split.itemR(ob, "parent_type", text="")
57                 parent = ob.parent
58                 if parent and ob.parent_type == 'BONE' and parent.type == 'ARMATURE':
59                         sub.item_pointerR(ob, "parent_bone", parent.data, "bones", text="")
60                 sub.active = parent != None
61
62 class OBJECT_PT_groups(ObjectButtonsPanel):
63         __label__ = "Groups"
64
65         def draw(self, context):
66                 layout = self.layout
67                 
68                 ob = context.object
69
70                 split = layout.split()
71                 split.item_menu_enumO("object.group_add", "group", text="Add to Group")
72                 split.itemL()
73
74                 for group in bpy.data.groups:
75                         if ob.name in group.objects:
76                                 col = layout.column(align=True)
77
78                                 col.set_context_pointer("group", group)
79
80                                 row = col.box().row()
81                                 row.itemR(group, "name", text="")
82                                 row.itemO("object.group_remove", text="", icon="VICON_X")
83
84                                 split = col.box().split()
85                                 split.column().itemR(group, "layer", text="Dupli")
86                                 split.column().itemR(group, "dupli_offset", text="")
87
88 class OBJECT_PT_display(ObjectButtonsPanel):
89         __label__ = "Display"
90
91         def draw(self, context):
92                 layout = self.layout
93                 
94                 ob = context.object
95                         
96                 row = layout.row()
97                 row.itemR(ob, "max_draw_type", text="Type")
98                 row.itemR(ob, "draw_bounds_type", text="Bounds")
99
100                 flow = layout.column_flow()
101                 flow.itemR(ob, "draw_name", text="Name")
102                 flow.itemR(ob, "draw_axis", text="Axis")
103                 flow.itemR(ob, "draw_wire", text="Wire")
104                 flow.itemR(ob, "draw_texture_space", text="Texture Space")
105                 flow.itemR(ob, "x_ray", text="X-Ray")
106                 flow.itemR(ob, "draw_transparent", text="Transparency")
107
108 class OBJECT_PT_duplication(ObjectButtonsPanel):
109         __label__ = "Duplication"
110
111         def draw(self, context):
112                 layout = self.layout
113                 
114                 ob = context.object
115
116                 layout.itemR(ob, "dupli_type", expand=True)
117
118                 if ob.dupli_type == 'FRAMES':
119                         split = layout.split()
120                         
121                         col = split.column(align=True)
122                         col.itemR(ob, "dupli_frames_start", text="Start")
123                         col.itemR(ob, "dupli_frames_end", text="End")
124                         
125                         col = split.column(align=True)
126                         col.itemR(ob, "dupli_frames_on", text="On")
127                         col.itemR(ob, "dupli_frames_off", text="Off")
128                         
129                         layout.itemR(ob, "dupli_frames_no_speed", text="No Speed")
130
131                 elif ob.dupli_type == 'VERTS':
132                         layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
133
134                 elif ob.dupli_type == 'FACES':
135                         row = layout.row()
136                         row.itemR(ob, "dupli_faces_scale", text="Scale")
137                         row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
138
139                 elif ob.dupli_type == 'GROUP':
140                         layout.itemR(ob, "dupli_group", text="Group")
141
142 class OBJECT_PT_animation(ObjectButtonsPanel):
143         __label__ = "Animation"
144
145         def draw(self, context):
146                 layout = self.layout
147                 
148                 ob = context.object
149                 
150                 split = layout.split()
151                 
152                 col = split.column()
153                 col.itemL(text="Time Offset:")
154                 col.itemR(ob, "time_offset_edit", text="Edit")
155                 row = col.row()
156                 row.itemR(ob, "time_offset_particle", text="Particle")
157                 row.active = len(ob.particle_systems) != 0
158                 row = col.row()
159                 row.itemR(ob, "time_offset_parent", text="Parent")
160                 row.active = ob.parent != None
161                 row = col.row()
162                 row.itemR(ob, "slow_parent")
163                 row.active = ob.parent != None
164                 col.itemR(ob, "time_offset", text="Offset")
165
166                 col = split.column()
167                 col.itemL(text="Track:")
168                 col.itemR(ob, "track", text="")
169                 col.itemR(ob, "track_axis", text="Axis")
170                 col.itemR(ob, "up_axis", text="Up Axis")
171                 row = col.row()
172                 row.itemR(ob, "track_override_parent", text="Override Parent")
173                 row.active = ob.parent != None
174
175 bpy.types.register(OBJECT_PT_context_object)
176 bpy.types.register(OBJECT_PT_transform)
177 bpy.types.register(OBJECT_PT_relations)
178 bpy.types.register(OBJECT_PT_groups)
179 bpy.types.register(OBJECT_PT_display)
180 bpy.types.register(OBJECT_PT_duplication)
181 bpy.types.register(OBJECT_PT_animation)