Small comit, added the colour mode (BW,RGB,RGBA) and object type to rna, and added...
[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, "type", text="Object Type")
68
69                 layout.row()
70                 layout.itemR(ob, "max_draw_type", text="Type")
71                 layout.itemR(ob, "draw_bounds_type", text="Bounds")
72
73                 layout.column_flow()
74                 layout.itemR(ob, "draw_name", text="Name")
75                 layout.itemR(ob, "draw_axis", text="Axis")
76                 layout.itemR(ob, "draw_wire", text="Wire")
77                 layout.itemR(ob, "draw_texture_space", text="Texture Space")
78                 layout.itemR(ob, "x_ray", text="X-Ray")
79                 layout.itemR(ob, "draw_transparent", text="Transparency")
80
81 class OBJECT_PT_duplication(ObjectButtonsPanel):
82         __idname__ = "OBJECT_PT_duplication"
83         __label__ = "Duplication"
84
85         def draw(self, context):
86                 ob = context.active_object
87                 layout = self.layout
88
89                 if not ob:
90                         return
91
92                 layout.column()
93                 layout.itemR(ob, "dupli_type", text="", expand=True)
94
95                 if ob.dupli_type == "FRAMES":
96                         layout.column_flow()
97                         layout.itemR(ob, "dupli_frames_start", text="Start:")
98                         layout.itemR(ob, "dupli_frames_end", text="End:")
99                         layout.itemR(ob, "dupli_frames_on", text="On:")
100                         layout.itemR(ob, "dupli_frames_off", text="Off:")
101
102 class OBJECT_PT_animation(ObjectButtonsPanel):
103         __idname__ = "OBJECT_PT_animation"
104         __label__ = "Animation"
105
106         def draw(self, context):
107                 ob = context.active_object
108                 layout = self.layout
109
110                 if not ob:
111                         return
112
113                 layout.split(number=2)
114                 
115                 sub = layout.sub(0)
116                 sub.column()
117                 sub.itemL(text="Time Offset:")
118                 sub.itemR(ob, "time_offset_edit", text="Edit")
119                 sub.itemR(ob, "time_offset_particle", text="Particle")
120                 sub.itemR(ob, "time_offset_parent", text="Parent")
121                 sub.itemR(ob, "slow_parent")
122                 sub.itemR(ob, "time_offset", text="Offset:")
123                 
124                 sub = layout.sub(1)
125                 sub.column()
126                 sub.itemL(text="Tracking:")
127                 sub.itemR(ob, "track_axis", text="Axis")
128                 sub.itemR(ob, "up_axis", text="Up Axis")
129                 sub.itemR(ob, "track_rotation", text="Rotation")
130
131 bpy.types.register(OBJECT_PT_transform)
132 bpy.types.register(OBJECT_PT_groups)
133 bpy.types.register(OBJECT_PT_display)
134 bpy.types.register(OBJECT_PT_duplication)
135 bpy.types.register(OBJECT_PT_animation)
136