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