Color Management, Stage 2: Switch color pipeline to use OpenColorIO
[blender.git] / release / scripts / startup / bl_ui / properties_scene.py
1 # ##### BEGIN GPL LICENSE BLOCK #####
2 #
3 #  This program is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU General Public License
5 #  as published by the Free Software Foundation; either version 2
6 #  of the License, or (at your option) any later version.
7 #
8 #  This program is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 #  GNU General Public License for more details.
12 #
13 #  You should have received a copy of the GNU General Public License
14 #  along with this program; if not, write to the Free Software Foundation,
15 #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ##### END GPL LICENSE BLOCK #####
18
19 # <pep8 compliant>
20 import bpy
21 from bpy.types import Panel
22 from rna_prop_ui import PropertyPanel
23
24
25 class SceneButtonsPanel():
26     bl_space_type = 'PROPERTIES'
27     bl_region_type = 'WINDOW'
28     bl_context = "scene"
29
30     @classmethod
31     def poll(cls, context):
32         rd = context.scene.render
33         return context.scene and (rd.engine in cls.COMPAT_ENGINES)
34
35
36 class SCENE_PT_scene(SceneButtonsPanel, Panel):
37     bl_label = "Scene"
38     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
39
40     def draw(self, context):
41         layout = self.layout
42
43         scene = context.scene
44
45         layout.prop(scene, "camera")
46         layout.prop(scene, "background_set", text="Background")
47         layout.prop(scene, "active_clip", text="Active Clip")
48
49
50 class SCENE_PT_audio(SceneButtonsPanel, Panel):
51     bl_label = "Audio"
52     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
53
54     def draw(self, context):
55         layout = self.layout
56
57         scene = context.scene
58         rd = context.scene.render
59         ffmpeg = rd.ffmpeg
60
61         layout.prop(scene, "audio_volume")
62         layout.operator("sound.bake_animation")
63
64         split = layout.split()
65
66         col = split.column()
67         col.label("Listener:")
68         col.prop(scene, "audio_distance_model", text="")
69         col.prop(scene, "audio_doppler_speed", text="Speed")
70         col.prop(scene, "audio_doppler_factor", text="Doppler")
71
72         col = split.column()
73         col.label("Format:")
74         col.prop(ffmpeg, "audio_channels", text="")
75         col.prop(ffmpeg, "audio_mixrate", text="Rate")
76
77         layout.operator("sound.mixdown")
78
79
80 class SCENE_PT_unit(SceneButtonsPanel, Panel):
81     bl_label = "Units"
82     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
83
84     def draw(self, context):
85         layout = self.layout
86
87         unit = context.scene.unit_settings
88
89         col = layout.column()
90         col.row().prop(unit, "system", expand=True)
91         col.row().prop(unit, "system_rotation", expand=True)
92
93         row = layout.row()
94         row.active = (unit.system != 'NONE')
95         row.prop(unit, "scale_length", text="Scale")
96         row.prop(unit, "use_separate")
97
98
99 class SCENE_PT_keying_sets(SceneButtonsPanel, Panel):
100     bl_label = "Keying Sets"
101     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
102
103     def draw(self, context):
104         layout = self.layout
105
106         scene = context.scene
107         row = layout.row()
108
109         col = row.column()
110         col.template_list(scene, "keying_sets", scene.keying_sets, "active_index", rows=2)
111
112         col = row.column(align=True)
113         col.operator("anim.keying_set_add", icon='ZOOMIN', text="")
114         col.operator("anim.keying_set_remove", icon='ZOOMOUT', text="")
115
116         ks = scene.keying_sets.active
117         if ks and ks.is_path_absolute:
118             row = layout.row()
119
120             col = row.column()
121             col.prop(ks, "bl_label")
122             col.prop(ks, "bl_description")
123
124             subcol = col.column()
125             subcol.operator_context = 'INVOKE_DEFAULT'
126             subcol.operator("anim.keying_set_export", text="Export to File").filepath = "keyingset.py"
127
128             col = row.column(align=True)
129             col.label(text="Keyframing Settings:")
130             col.prop(ks, "bl_options")
131
132
133 class SCENE_PT_keying_set_paths(SceneButtonsPanel, Panel):
134     bl_label = "Active Keying Set"
135     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
136
137     @classmethod
138     def poll(cls, context):
139         ks = context.scene.keying_sets.active
140         return (ks and ks.is_path_absolute)
141
142     def draw(self, context):
143         layout = self.layout
144
145         scene = context.scene
146         ks = scene.keying_sets.active
147
148         row = layout.row()
149         row.label(text="Paths:")
150
151         row = layout.row()
152
153         col = row.column()
154         col.template_list(ks, "paths", ks.paths, "active_index", rows=2)
155
156         col = row.column(align=True)
157         col.operator("anim.keying_set_path_add", icon='ZOOMIN', text="")
158         col.operator("anim.keying_set_path_remove", icon='ZOOMOUT', text="")
159
160         ksp = ks.paths.active
161         if ksp:
162             col = layout.column()
163             col.label(text="Target:")
164             col.template_any_ID(ksp, "id", "id_type")
165             col.template_path_builder(ksp, "data_path", ksp.id)
166
167             row = col.row(align=True)
168             row.label(text="Array Target:")
169             row.prop(ksp, "use_entire_array", text="All Items")
170             if ksp.use_entire_array:
171                 row.label(text=" ")  # padding
172             else:
173                 row.prop(ksp, "array_index", text="Index")
174
175             layout.separator()
176
177             row = layout.row()
178             col = row.column()
179             col.label(text="F-Curve Grouping:")
180             col.prop(ksp, "group_method", text="")
181             if ksp.group_method == 'NAMED':
182                 col.prop(ksp, "group")
183
184             col = row.column(align=True)
185             col.label(text="Keyframing Settings:")
186             col.prop(ksp, "bl_options")
187
188
189 class SCENE_PT_physics(SceneButtonsPanel, Panel):
190     bl_label = "Gravity"
191     COMPAT_ENGINES = {'BLENDER_RENDER'}
192
193     def draw_header(self, context):
194         self.layout.prop(context.scene, "use_gravity", text="")
195
196     def draw(self, context):
197         layout = self.layout
198
199         scene = context.scene
200
201         layout.active = scene.use_gravity
202
203         layout.prop(scene, "gravity", text="")
204
205
206 class SCENE_PT_simplify(SceneButtonsPanel, Panel):
207     bl_label = "Simplify"
208     COMPAT_ENGINES = {'BLENDER_RENDER'}
209
210     def draw_header(self, context):
211         rd = context.scene.render
212         self.layout.prop(rd, "use_simplify", text="")
213
214     def draw(self, context):
215         layout = self.layout
216
217         rd = context.scene.render
218
219         layout.active = rd.use_simplify
220
221         split = layout.split()
222
223         col = split.column()
224         col.prop(rd, "simplify_subdivision", text="Subdivision")
225         col.prop(rd, "simplify_child_particles", text="Child Particles")
226
227         col.prop(rd, "use_simplify_triangulate")
228
229         col = split.column()
230         col.prop(rd, "simplify_shadow_samples", text="Shadow Samples")
231         col.prop(rd, "simplify_ao_sss", text="AO and SSS")
232
233
234 class SCENE_PT_color_management(Panel):
235     bl_label = "Color Management"
236     bl_space_type = 'PROPERTIES'
237     bl_region_type = 'WINDOW'
238     bl_context = "scene"
239
240     def draw(self, context):
241         layout = self.layout
242
243         scene = context.scene
244
245         col = layout.column()
246         col.label(text="Display:")
247         col.prop(scene.display_settings, "display_device")
248
249         col = layout.column()
250         col.separator()
251         col.label(text="Render:")
252         col.template_colormanaged_view_settings(scene, "view_settings")
253
254         col = layout.column()
255         col.separator()
256         col.label(text="Sequencer:")
257         col.prop(scene.sequencer_colorspace_settings, "name")
258
259
260 class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, Panel):
261     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
262     _context_path = "scene"
263     _property_type = bpy.types.Scene
264
265 if __name__ == "__main__":  # only for live edit.
266     bpy.utils.register_module(__name__)