merged changes to revisio 23915
[blender.git] / release / scripts / ui / buttons_scene.py
1 import bpy
2
3 class SceneButtonsPanel(bpy.types.Panel):
4         __space_type__ = 'PROPERTIES'
5         __region_type__ = 'WINDOW'
6         __context__ = "scene"
7         
8         def poll(self, context):
9                 return context.scene
10
11 class SCENE_PT_scene(SceneButtonsPanel):
12         __label__ = "Scene"
13         COMPAT_ENGINES = set(['BLENDER_RENDER'])
14
15         def draw(self, context):
16                 layout = self.layout
17                 
18                 scene = context.scene
19
20                 layout.itemR(scene, "camera")
21                 layout.itemR(scene, "set", text="Background")
22
23 class SCENE_PT_unit(SceneButtonsPanel):
24         __label__ = "Units"
25         COMPAT_ENGINES = set(['BLENDER_RENDER'])
26
27         def draw(self, context):
28                 layout = self.layout
29                 
30                 unit = context.scene.unit_settings
31                 
32                 col = layout.column()
33                 col.row().itemR(unit, "system", expand=True)
34                 
35                 row = layout.row()
36                 row.active = (unit.system != 'NONE')
37                 row.itemR(unit, "scale_length", text="Scale")
38                 row.itemR(unit, "use_separate")
39                 
40 class SCENE_PT_keying_sets(SceneButtonsPanel):
41         __label__ = "Keying Sets"
42         
43         def draw(self, context):
44                 layout = self.layout
45                 
46                 scene = context.scene
47                 
48                 row = layout.row()
49                 
50                 col = row.column()
51                 col.template_list(scene, "keying_sets", scene, "active_keying_set_index", rows=2)
52                 
53                 col = row.column(align=True)
54                 col.itemO("anim.keying_set_add", icon='ICON_ZOOMIN', text="")
55                 col.itemO("anim.keying_set_remove", icon='ICON_ZOOMOUT', text="")
56                 
57                 ks = scene.active_keying_set
58                 if ks:
59                         row = layout.row()
60                         
61                         col = row.column()
62                         col.itemR(ks, "name")
63                         col.itemR(ks, "absolute")
64                         
65                         col = row.column()
66                         col.itemL(text="Keyframing Settings:")
67                         col.itemR(ks, "insertkey_needed", text="Needed")
68                         col.itemR(ks, "insertkey_visual", text="Visual")
69                         
70 class SCENE_PT_keying_set_paths(SceneButtonsPanel):
71         __label__ = "Active Keying Set"
72         
73         def poll(self, context):
74                 return (context.scene != None) and (context.scene.active_keying_set != None)
75         
76         def draw(self, context):
77                 layout = self.layout
78                 
79                 scene = context.scene
80                 ks = scene.active_keying_set
81                 
82                 row = layout.row()
83                 row.itemL(text="Paths:")
84                 
85                 row = layout.row()
86                 
87                 col = row.column()
88                 col.template_list(ks, "paths", ks, "active_path_index", rows=2)
89                 
90                 col = row.column(align=True)
91                 col.itemO("anim.keying_set_path_add", icon='ICON_ZOOMIN', text="")
92                 col.itemO("anim.keying_set_path_remove", icon='ICON_ZOOMOUT', text="")
93                 
94                 ksp = ks.active_path
95                 if ksp:
96                         col = layout.column()
97                         col.itemL(text="Target:")
98                         col.template_any_ID(ksp, "id", "id_type")
99                         col.template_path_builder(ksp, "rna_path", ksp.id)
100                         
101                         
102                         row = layout.row()
103                         
104                         col = row.column()
105                         col.itemL(text="Array Target:")
106                         col.itemR(ksp, "entire_array")
107                         if ksp.entire_array == False:
108                                 col.itemR(ksp, "array_index")
109                                 
110                         col = row.column()
111                         col.itemL(text="F-Curve Grouping:")
112                         col.itemR(ksp, "grouping")
113                         if ksp.grouping == 'NAMED':
114                                 col.itemR(ksp, "group")
115
116 class SCENE_PT_physics(SceneButtonsPanel):
117         __label__ = "Gravity"
118         COMPAT_ENGINES = set(['BLENDER_RENDER'])
119
120         def draw_header(self, context):
121                 self.layout.itemR(context.scene, "use_gravity", text="")
122
123         def draw(self, context):
124                 layout = self.layout
125                 
126                 scene = context.scene
127
128                 layout.active = scene.use_gravity
129
130                 layout.itemR(scene, "gravity", text="")
131
132 bpy.types.register(SCENE_PT_scene)              
133 bpy.types.register(SCENE_PT_unit)
134 bpy.types.register(SCENE_PT_keying_sets)
135 bpy.types.register(SCENE_PT_keying_set_paths)
136 bpy.types.register(SCENE_PT_physics)
137