Integrated Freestyle to rendering pipeline
[blender.git] / release / ui / buttons_object.py
1
2 import bpy
3
4 class ObjectButtonsPanel(bpy.types.Panel):
5         __space_type__ = 'PROPERTIES'
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                 split = layout.split()
97                 col = split.column()
98                 col.itemR(ob, "max_draw_type", text="Type")
99                 col = split.column()
100                 row = col.row()
101                 row.itemR(ob, "draw_bounds", text="Bounds")
102                 row.itemR(ob, "draw_bounds_type", text="")
103
104                 flow = layout.column_flow()
105                 flow.itemR(ob, "draw_name", text="Name")
106                 flow.itemR(ob, "draw_axis", text="Axis")
107                 flow.itemR(ob, "draw_wire", text="Wire")
108                 flow.itemR(ob, "draw_texture_space", text="Texture Space")
109                 flow.itemR(ob, "x_ray", text="X-Ray")
110                 flow.itemR(ob, "draw_transparent", text="Transparency")
111
112 class OBJECT_PT_duplication(ObjectButtonsPanel):
113         __label__ = "Duplication"
114
115         def draw(self, context):
116                 layout = self.layout
117                 
118                 ob = context.object
119
120                 layout.itemR(ob, "dupli_type", expand=True)
121
122                 if ob.dupli_type == 'FRAMES':
123                         split = layout.split()
124                         
125                         col = split.column(align=True)
126                         col.itemR(ob, "dupli_frames_start", text="Start")
127                         col.itemR(ob, "dupli_frames_end", text="End")
128                         
129                         col = split.column(align=True)
130                         col.itemR(ob, "dupli_frames_on", text="On")
131                         col.itemR(ob, "dupli_frames_off", text="Off")
132                         
133                         layout.itemR(ob, "dupli_frames_no_speed", text="No Speed")
134
135                 elif ob.dupli_type == 'VERTS':
136                         layout.itemR(ob, "dupli_verts_rotation", text="Rotation")
137
138                 elif ob.dupli_type == 'FACES':
139                         row = layout.row()
140                         row.itemR(ob, "dupli_faces_scale", text="Scale")
141                         row.itemR(ob, "dupli_faces_inherit_scale", text="Inherit Scale")
142
143                 elif ob.dupli_type == 'GROUP':
144                         layout.itemR(ob, "dupli_group", text="Group")
145
146 class OBJECT_PT_animation(ObjectButtonsPanel):
147         __label__ = "Animation"
148
149         def draw(self, context):
150                 layout = self.layout
151                 
152                 ob = context.object
153                 
154                 split = layout.split()
155                 
156                 col = split.column()
157                 col.itemL(text="Time Offset:")
158                 col.itemR(ob, "time_offset_edit", text="Edit")
159                 row = col.row()
160                 row.itemR(ob, "time_offset_particle", text="Particle")
161                 row.active = len(ob.particle_systems) != 0
162                 row = col.row()
163                 row.itemR(ob, "time_offset_parent", text="Parent")
164                 row.active = ob.parent != None
165                 row = col.row()
166                 row.itemR(ob, "slow_parent")
167                 row.active = ob.parent != None
168                 col.itemR(ob, "time_offset", text="Offset")
169
170                 col = split.column()
171                 col.itemL(text="Track:")
172                 col.itemR(ob, "track", text="")
173                 col.itemR(ob, "track_axis", text="Axis")
174                 col.itemR(ob, "up_axis", text="Up Axis")
175                 row = col.row()
176                 row.itemR(ob, "track_override_parent", text="Override Parent")
177                 row.active = ob.parent != None
178
179 bpy.types.register(OBJECT_PT_context_object)
180 bpy.types.register(OBJECT_PT_transform)
181 bpy.types.register(OBJECT_PT_relations)
182 bpy.types.register(OBJECT_PT_groups)
183 bpy.types.register(OBJECT_PT_display)
184 bpy.types.register(OBJECT_PT_duplication)
185 bpy.types.register(OBJECT_PT_animation)