Cycles UI files:
[blender.git] / intern / cycles / blender / addon / ui.py
1 #
2 # Copyright 2011, Blender Foundation.
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 #
18
19 # <pep8 compliant>
20
21 import bpy
22
23 from bpy.types import Panel, Menu
24
25 from . import enums, engine
26
27
28 class CYCLES_MT_integrator_presets(Menu):
29     bl_label = "Integrator Presets"
30     preset_subdir = "cycles/integrator"
31     preset_operator = "script.execute_preset"
32     COMPAT_ENGINES = {'CYCLES'}
33     draw = Menu.draw_preset
34
35
36 class CyclesButtonsPanel():
37     bl_space_type = "PROPERTIES"
38     bl_region_type = "WINDOW"
39     bl_context = "render"
40
41     @classmethod
42     def poll(cls, context):
43         rd = context.scene.render
44         return rd.engine == 'CYCLES'
45
46
47 class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
48     bl_label = "Integrator"
49     bl_options = {'DEFAULT_CLOSED'}
50
51     def draw(self, context):
52         layout = self.layout
53
54         scene = context.scene
55         cscene = scene.cycles
56
57         row = layout.row(align=True)
58         row.menu("CYCLES_MT_integrator_presets", text=bpy.types.CYCLES_MT_integrator_presets.bl_label)
59         row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMIN")
60         row.operator("render.cycles_integrator_preset_add", text="", icon="ZOOMOUT").remove_active = True
61
62         split = layout.split()
63
64         col = split.column()
65         sub = col.column(align=True)
66         sub.label(text="Samples:")
67         sub.prop(cscene, "samples", text="Render")
68         sub.prop(cscene, "preview_samples", text="Preview")
69         sub.prop(cscene, "seed")
70
71         sub = col.column(align=True)
72         sub.label("Transparency:")
73         sub.prop(cscene, "transparent_max_bounces", text="Max")
74         sub.prop(cscene, "transparent_min_bounces", text="Min")
75         sub.prop(cscene, "use_transparent_shadows", text="Shadows")
76
77         col = split.column()
78
79         sub = col.column(align=True)
80         sub.label(text="Bounces:")
81         sub.prop(cscene, "max_bounces", text="Max")
82         sub.prop(cscene, "min_bounces", text="Min")
83
84         sub = col.column(align=True)
85         sub.label(text="Light Paths:")
86         sub.prop(cscene, "diffuse_bounces", text="Diffuse")
87         sub.prop(cscene, "glossy_bounces", text="Glossy")
88         sub.prop(cscene, "transmission_bounces", text="Transmission")
89         sub.prop(cscene, "no_caustics")
90
91         #row = col.row()
92         #row.prop(cscene, "blur_caustics")
93         #row.active = not cscene.no_caustics
94
95
96 class CyclesRender_PT_film(CyclesButtonsPanel, Panel):
97     bl_label = "Film"
98
99     def draw(self, context):
100         layout = self.layout
101
102         scene = context.scene
103         cscene = scene.cycles
104
105         split = layout.split()
106
107         col = split.column()
108         col.prop(cscene, "film_exposure")
109         col.prop(cscene, "film_transparent")
110
111         col = split.column()
112         sub = col.column(align=True)
113         sub.prop(cscene, "filter_type", text="")
114         if cscene.filter_type != 'BOX':
115             sub.prop(cscene, "filter_width", text="Width")
116
117
118 class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
119     bl_label = "Performance"
120     bl_options = {'DEFAULT_CLOSED'}
121
122     def draw(self, context):
123         layout = self.layout
124
125         scene = context.scene
126         rd = scene.render
127         cscene = scene.cycles
128
129         split = layout.split()
130
131         col = split.column(align=True)
132
133         col.label(text="Threads:")
134         col.row().prop(rd, "threads_mode", expand=True)
135         sub = col.column()
136         sub.enabled = rd.threads_mode == 'FIXED'
137         sub.prop(rd, "threads")
138
139         sub = col.column(align=True)
140         sub.label(text="Tiles:")
141         sub.prop(cscene, "debug_tile_size")
142         sub.prop(cscene, "debug_min_size")
143
144         col = split.column()
145
146         sub = col.column(align=True)
147         sub.label(text="Acceleration structure:")
148         sub.prop(cscene, "debug_bvh_type", text="")
149         sub.prop(cscene, "debug_use_spatial_splits")
150         sub.prop(cscene, "use_cache")
151
152
153 class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
154     bl_label = "Layers"
155     bl_options = {'DEFAULT_CLOSED'}
156     COMPAT_ENGINES = {'BLENDER_RENDER'}
157
158     def draw(self, context):
159         layout = self.layout
160
161         scene = context.scene
162         rd = scene.render
163
164         row = layout.row()
165         row.template_list(rd, "layers", rd.layers, "active_index", rows=2)
166
167         col = row.column(align=True)
168         col.operator("scene.render_layer_add", icon='ZOOMIN', text="")
169         col.operator("scene.render_layer_remove", icon='ZOOMOUT', text="")
170
171         row = layout.row()
172         rl = rd.layers.active
173         row.prop(rl, "name")
174         row.prop(rd, "use_single_layer", text="", icon_only=True)
175
176         split = layout.split()
177
178         col = split.column()
179         col.prop(scene, "layers", text="Scene")
180         col.label(text="Material:")
181         col.prop(rl, "material_override", text="")
182
183         col = split.column()
184         col.prop(rl, "layers", text="Layer")
185         col.label(text="Mask Layers:")
186         col.prop(rl, "layers_zmask", text="")
187
188         split = layout.split()
189
190         col = split.column()
191         col.label(text="Passes:")
192         col.prop(rl, "use_pass_combined")
193         col.prop(rl, "use_pass_z")
194         col.prop(rl, "use_pass_normal")
195         col.prop(rl, "use_pass_object_index")
196         col.prop(rl, "use_pass_material_index")
197         col.prop(rl, "use_pass_emit")
198         col.prop(rl, "use_pass_environment")
199         col.prop(rl, "use_pass_ambient_occlusion")
200
201         col = split.column()
202         col.label()
203         col.label(text="Diffuse:")
204         row = col.row(align=True)
205         row.prop(rl, "use_pass_diffuse_direct", text="Direct", toggle=True)
206         row.prop(rl, "use_pass_diffuse_indirect", text="Indirect", toggle=True)
207         row.prop(rl, "use_pass_diffuse_color", text="Color", toggle=True)
208         col.label(text="Glossy:")
209         row = col.row(align=True)
210         row.prop(rl, "use_pass_glossy_direct", text="Direct", toggle=True)
211         row.prop(rl, "use_pass_glossy_indirect", text="Indirect", toggle=True)
212         row.prop(rl, "use_pass_glossy_color", text="Color", toggle=True)
213         col.label(text="Transmission:")
214         row = col.row(align=True)
215         row.prop(rl, "use_pass_transmission_direct", text="Direct", toggle=True)
216         row.prop(rl, "use_pass_transmission_indirect", text="Indirect", toggle=True)
217         row.prop(rl, "use_pass_transmission_color", text="Color", toggle=True)
218
219
220 class Cycles_PT_post_processing(CyclesButtonsPanel, Panel):
221     bl_label = "Post Processing"
222     bl_options = {'DEFAULT_CLOSED'}
223
224     def draw(self, context):
225         layout = self.layout
226
227         rd = context.scene.render
228
229         split = layout.split()
230
231         col = split.column()
232         col.prop(rd, "use_compositing")
233         col.prop(rd, "use_sequencer")
234
235         col = split.column()
236         col.prop(rd, "dither_intensity", text="Dither", slider=True)
237
238
239 class CyclesCamera_PT_dof(CyclesButtonsPanel, Panel):
240     bl_label = "Depth of Field"
241     bl_context = "data"
242
243     @classmethod
244     def poll(cls, context):
245         return context.camera and CyclesButtonsPanel.poll(context)
246
247     def draw(self, context):
248         layout = self.layout
249
250         cam = context.camera
251         ccam = cam.cycles
252
253         split = layout.split()
254
255         col = split.column()
256         col.label("Focus:")
257         col.prop(cam, "dof_object", text="")
258
259         sub = col.row()
260         sub.active = cam.dof_object is None
261         sub.prop(cam, "dof_distance", text="Distance")
262
263         col = split.column()
264
265         col.label("Aperture:")
266         sub = col.column(align=True)
267         sub.prop(ccam, "aperture_type", text="")
268         if ccam.aperture_type == 'RADIUS':
269             sub.prop(ccam, "aperture_size", text="Size")
270         elif ccam.aperture_type == 'FSTOP':
271             sub.prop(ccam, "aperture_fstop", text="Number")
272
273         sub = col.column(align=True)
274         sub.prop(ccam, "aperture_blades", text="Blades")
275         sub.prop(ccam, "aperture_rotation", text="Rotation")
276
277
278 class Cycles_PT_context_material(CyclesButtonsPanel, Panel):
279     bl_label = ""
280     bl_context = "material"
281     bl_options = {'HIDE_HEADER'}
282
283     @classmethod
284     def poll(cls, context):
285         return (context.material or context.object) and CyclesButtonsPanel.poll(context)
286
287     def draw(self, context):
288         layout = self.layout
289
290         mat = context.material
291         ob = context.object
292         slot = context.material_slot
293         space = context.space_data
294
295         if ob:
296             row = layout.row()
297
298             row.template_list(ob, "material_slots", ob, "active_material_index", rows=2)
299
300             col = row.column(align=True)
301             col.operator("object.material_slot_add", icon='ZOOMIN', text="")
302             col.operator("object.material_slot_remove", icon='ZOOMOUT', text="")
303
304             col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
305
306             if ob.mode == 'EDIT':
307                 row = layout.row(align=True)
308                 row.operator("object.material_slot_assign", text="Assign")
309                 row.operator("object.material_slot_select", text="Select")
310                 row.operator("object.material_slot_deselect", text="Deselect")
311
312         split = layout.split(percentage=0.65)
313
314         if ob:
315             split.template_ID(ob, "active_material", new="material.new")
316             row = split.row()
317
318             if slot:
319                 row.prop(slot, "link", text="")
320             else:
321                 row.label()
322         elif mat:
323             split.template_ID(space, "pin_id")
324             split.separator()
325
326
327 class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
328     bl_label = "Displacement"
329     bl_context = "data"
330
331     @classmethod
332     def poll(cls, context):
333         if CyclesButtonsPanel.poll(context):
334             if context.mesh or context.curve or context.meta_ball:
335                 if context.scene.cycles.feature_set == 'EXPERIMENTAL':
336                     return True
337
338         return False
339
340     def draw(self, context):
341         layout = self.layout
342
343         mesh = context.mesh
344         curve = context.curve
345         mball = context.meta_ball
346
347         if mesh:
348             cdata = mesh.cycles
349         elif curve:
350             cdata = curve.cycles
351         elif mball:
352             cdata = mball.cycles
353
354         layout.prop(cdata, "displacement_method", text="Method")
355         layout.prop(cdata, "use_subdivision")
356         layout.prop(cdata, "dicing_rate")
357
358
359 class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
360     bl_label = "Ray Visibility"
361     bl_context = "object"
362     bl_options = {'DEFAULT_CLOSED'}
363
364     @classmethod
365     def poll(cls, context):
366         ob = context.object
367         return CyclesButtonsPanel.poll(context) and ob and ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'}  # todo: 'LAMP'
368
369     def draw(self, context):
370         layout = self.layout
371
372         ob = context.object
373         visibility = ob.cycles_visibility
374
375         flow = layout.column_flow()
376
377         flow.prop(visibility, "camera")
378         flow.prop(visibility, "diffuse")
379         flow.prop(visibility, "glossy")
380         flow.prop(visibility, "transmission")
381         flow.prop(visibility, "shadow")
382
383
384 def find_node(material, nodetype):
385     if material and material.node_tree:
386         ntree = material.node_tree
387
388         for node in ntree.nodes:
389             if getattr(node, "type", None) == nodetype:
390                 return node
391
392     return None
393
394
395 def find_node_input(node, name):
396     for input in node.inputs:
397         if input.name == name:
398             return input
399
400     return None
401
402
403 def panel_node_draw(layout, id_data, output_type, input_name):
404     if not id_data.use_nodes:
405         layout.prop(id_data, "use_nodes", icon='NODETREE')
406         return False
407
408     ntree = id_data.node_tree
409
410     node = find_node(id_data, output_type)
411     if not node:
412         layout.label(text="No output node.")
413     else:
414         input = find_node_input(node, input_name)
415         layout.template_node_view(ntree, node, input)
416
417     return True
418
419
420 class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
421     bl_label = "Lamp"
422     bl_context = "data"
423
424     @classmethod
425     def poll(cls, context):
426         return context.lamp and CyclesButtonsPanel.poll(context)
427
428     def draw(self, context):
429         layout = self.layout
430
431         lamp = context.lamp
432         clamp = lamp.cycles
433
434         layout.prop(lamp, "type", expand=True)
435
436         split = layout.split()
437         col = split.column(align=True)
438
439         if lamp.type in {'POINT', 'SUN', 'SPOT'}:
440             col.prop(lamp, "shadow_soft_size", text="Size")
441         elif lamp.type == 'AREA':
442             col.prop(lamp, "shape", text="")
443             sub = col.column(align=True)
444
445             if lamp.shape == 'SQUARE':
446                 sub.prop(lamp, "size")
447             elif lamp.shape == 'RECTANGLE':
448                 sub.prop(lamp, "size", text="Size X")
449                 sub.prop(lamp, "size_y", text="Size Y")
450
451         col = split.column()
452         col.prop(clamp, "cast_shadow")
453
454         if lamp.type == 'SPOT':
455             layout.label(text="Not supported, interpreted as point lamp.")
456         elif lamp.type == 'HEMI':
457             layout.label(text="Not supported, interpreted as sun lamp.")
458
459
460 class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
461     bl_label = "Nodes"
462     bl_context = "data"
463
464     @classmethod
465     def poll(cls, context):
466         return context.lamp and CyclesButtonsPanel.poll(context)
467
468     def draw(self, context):
469         layout = self.layout
470
471         lamp = context.lamp
472         if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'):
473             layout.prop(lamp, "color")
474
475
476 class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
477     bl_label = "Surface"
478     bl_context = "world"
479
480     @classmethod
481     def poll(cls, context):
482         return context.world and CyclesButtonsPanel.poll(context)
483
484     def draw(self, context):
485         layout = self.layout
486
487         world = context.world
488
489         if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
490             layout.prop(world, "horizon_color", text="Color")
491
492
493 class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
494     bl_label = "Volume"
495     bl_context = "world"
496     bl_options = {'DEFAULT_CLOSED'}
497
498     @classmethod
499     def poll(cls, context):
500         # world = context.world
501         # world and world.node_tree and CyclesButtonsPanel.poll(context)
502         return False
503
504     def draw(self, context):
505         layout = self.layout
506         layout.active = False
507
508         world = context.world
509         panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
510
511
512 class CyclesWorld_PT_ambient_occlusion(CyclesButtonsPanel, Panel):
513     bl_label = "Ambient Occlusion"
514     bl_context = "world"
515
516     @classmethod
517     def poll(cls, context):
518         return context.world and CyclesButtonsPanel.poll(context)
519
520     def draw_header(self, context):
521         light = context.world.light_settings
522         self.layout.prop(light, "use_ambient_occlusion", text="")
523
524     def draw(self, context):
525         layout = self.layout
526         light = context.world.light_settings
527
528         layout.active = light.use_ambient_occlusion
529
530         row = layout.row()
531         row.prop(light, "ao_factor", text="Factor")
532         row.prop(light, "distance", text="Distance")
533
534
535 class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
536     bl_label = "Settings"
537     bl_context = "world"
538     bl_options = {'DEFAULT_CLOSED'}
539
540     @classmethod
541     def poll(cls, context):
542         return context.world and CyclesButtonsPanel.poll(context)
543
544     def draw(self, context):
545         layout = self.layout
546
547         world = context.world
548         cworld = world.cycles
549
550         col = layout.column()
551
552         col.prop(cworld, "sample_as_light")
553         row = col.row()
554         row.active = cworld.sample_as_light
555         row.prop(cworld, "sample_map_resolution")
556
557
558 class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
559     bl_label = "Surface"
560     bl_context = "material"
561
562     @classmethod
563     def poll(cls, context):
564         return context.material and CyclesButtonsPanel.poll(context)
565
566     def draw(self, context):
567         layout = self.layout
568
569         mat = context.material
570         if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'):
571             layout.prop(mat, "diffuse_color")
572
573
574 class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
575     bl_label = "Volume"
576     bl_context = "material"
577     bl_options = {'DEFAULT_CLOSED'}
578
579     @classmethod
580     def poll(cls, context):
581         # mat = context.material
582         # mat and mat.node_tree and CyclesButtonsPanel.poll(context)
583         return False
584
585     def draw(self, context):
586         layout = self.layout
587         layout.active = False
588
589         mat = context.material
590         cmat = mat.cycles
591
592         panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Volume')
593
594         layout.prop(cmat, "homogeneous_volume")
595
596
597 class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel):
598     bl_label = "Displacement"
599     bl_context = "material"
600
601     @classmethod
602     def poll(cls, context):
603         mat = context.material
604         return mat and mat.node_tree and CyclesButtonsPanel.poll(context)
605
606     def draw(self, context):
607         layout = self.layout
608
609         mat = context.material
610         panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement')
611
612
613 class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
614     bl_label = "Settings"
615     bl_context = "material"
616     bl_options = {'DEFAULT_CLOSED'}
617
618     @classmethod
619     def poll(cls, context):
620         return context.material and CyclesButtonsPanel.poll(context)
621
622     def draw(self, context):
623         layout = self.layout
624
625         mat = context.material
626         cmat = mat.cycles
627
628         split = layout.split()
629
630         col = split.column()
631         col.prop(mat, "diffuse_color", text="Viewport Color")
632
633         col = split.column()
634         col.prop(cmat, "sample_as_light")
635         col.prop(mat, "pass_index")
636
637
638 class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
639     bl_label = ""
640     bl_context = "texture"
641     bl_options = {'HIDE_HEADER'}
642     COMPAT_ENGINES = {'CYCLES'}
643
644     def draw(self, context):
645         layout = self.layout
646
647         tex = context.texture
648         space = context.space_data
649         pin_id = space.pin_id
650         use_pin_id = space.use_pin_id
651         user = context.texture_user
652
653         if not use_pin_id or not isinstance(pin_id, bpy.types.Texture):
654             pin_id = None
655
656         if not pin_id:
657             layout.template_texture_user()
658
659         if user:
660             layout.separator()
661
662             split = layout.split(percentage=0.65)
663             col = split.column()
664
665             if pin_id:
666                 col.template_ID(space, "pin_id")
667             elif user:
668                 col.template_ID(user, "texture", new="texture.new")
669
670             if tex:
671                 split = layout.split(percentage=0.2)
672                 split.label(text="Type:")
673                 split.prop(tex, "type", text="")
674
675
676 class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel):
677     bl_label = "Nodes"
678     bl_context = "texture"
679
680     @classmethod
681     def poll(cls, context):
682         tex = context.texture
683         return (tex and tex.use_nodes) and CyclesButtonsPanel.poll(context)
684
685     def draw(self, context):
686         layout = self.layout
687
688         tex = context.texture
689         panel_node_draw(layout, tex, 'OUTPUT_TEXTURE', 'Color')
690
691
692 class CyclesTexture_PT_node(CyclesButtonsPanel, Panel):
693     bl_label = "Node"
694     bl_context = "texture"
695
696     @classmethod
697     def poll(cls, context):
698         node = context.texture_node
699         return node and CyclesButtonsPanel.poll(context)
700
701     def draw(self, context):
702         layout = self.layout
703
704         node = context.texture_node
705         ntree = node.id_data
706         layout.template_node_view(ntree, node, None)
707
708
709 class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
710     bl_label = "Mapping"
711     bl_context = "texture"
712
713     @classmethod
714     def poll(cls, context):
715         tex = context.texture
716         node = context.texture_node
717         return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
718
719     def draw(self, context):
720         layout = self.layout
721
722         # tex = context.texture
723         node = context.texture_node
724
725         mapping = node.texture_mapping
726
727         row = layout.row()
728
729         row.column().prop(mapping, "location")
730         row.column().prop(mapping, "rotation")
731         row.column().prop(mapping, "scale")
732
733         layout.label(text="Projection:")
734
735         row = layout.row()
736         row.prop(mapping, "mapping_x", text="")
737         row.prop(mapping, "mapping_y", text="")
738         row.prop(mapping, "mapping_z", text="")
739
740
741 class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
742     bl_label = "Color"
743     bl_context = "texture"
744     bl_options = {'DEFAULT_CLOSED'}
745
746     @classmethod
747     def poll(cls, context):
748         # tex = context.texture
749         # node = context.texture_node
750         return False
751         #return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
752
753     def draw(self, context):
754         layout = self.layout
755
756         # tex = context.texture
757         node = context.texture_node
758
759         mapping = node.color_mapping
760
761         split = layout.split()
762
763         col = split.column()
764         col.label(text="Blend:")
765         col.prop(mapping, "blend_type", text="")
766         col.prop(mapping, "blend_factor", text="Factor")
767         col.prop(mapping, "blend_color", text="")
768
769         col = split.column()
770         col.label(text="Adjust:")
771         col.prop(mapping, "brightness")
772         col.prop(mapping, "contrast")
773         col.prop(mapping, "saturation")
774
775         layout.separator()
776
777         layout.prop(mapping, "use_color_ramp", text="Ramp")
778         if mapping.use_color_ramp:
779             layout.template_color_ramp(mapping, "color_ramp", expand=True)
780
781
782 def draw_device(self, context):
783     scene = context.scene
784     layout = self.layout
785
786     if scene.render.engine == 'CYCLES':
787         cscene = scene.cycles
788
789         layout.prop(cscene, "feature_set")
790
791         device_type = context.user_preferences.system.compute_device_type
792         if device_type == 'CUDA':
793             layout.prop(cscene, "device")
794         elif device_type == 'OPENCL' and cscene.feature_set == 'EXPERIMENTAL':
795             layout.prop(cscene, "device")
796
797
798 def draw_pause(self, context):
799     layout = self.layout
800     scene = context.scene
801
802     if scene.render.engine == "CYCLES":
803         view = context.space_data
804
805         if view.viewport_shade == 'RENDERED':
806             cscene = scene.cycles
807             layout.prop(cscene, "preview_pause", icon="PAUSE", text="")
808
809
810 def get_panels():
811     return (
812         bpy.types.RENDER_PT_render,
813         bpy.types.RENDER_PT_output,
814         bpy.types.RENDER_PT_encoding,
815         bpy.types.RENDER_PT_dimensions,
816         bpy.types.RENDER_PT_stamp,
817         bpy.types.SCENE_PT_scene,
818         bpy.types.SCENE_PT_audio,
819         bpy.types.SCENE_PT_unit,
820         bpy.types.SCENE_PT_keying_sets,
821         bpy.types.SCENE_PT_keying_set_paths,
822         bpy.types.SCENE_PT_physics,
823         bpy.types.WORLD_PT_context_world,
824         bpy.types.DATA_PT_context_mesh,
825         bpy.types.DATA_PT_context_camera,
826         bpy.types.DATA_PT_context_lamp,
827         bpy.types.DATA_PT_texture_space,
828         bpy.types.DATA_PT_curve_texture_space,
829         bpy.types.DATA_PT_mball_texture_space,
830         bpy.types.DATA_PT_vertex_groups,
831         bpy.types.DATA_PT_shape_keys,
832         bpy.types.DATA_PT_uv_texture,
833         bpy.types.DATA_PT_vertex_colors,
834         bpy.types.DATA_PT_camera,
835         bpy.types.DATA_PT_camera_display,
836         bpy.types.DATA_PT_lens,
837         bpy.types.DATA_PT_custom_props_mesh,
838         bpy.types.DATA_PT_custom_props_camera,
839         bpy.types.DATA_PT_custom_props_lamp,
840         bpy.types.TEXTURE_PT_clouds,
841         bpy.types.TEXTURE_PT_wood,
842         bpy.types.TEXTURE_PT_marble,
843         bpy.types.TEXTURE_PT_magic,
844         bpy.types.TEXTURE_PT_blend,
845         bpy.types.TEXTURE_PT_stucci,
846         bpy.types.TEXTURE_PT_image,
847         bpy.types.TEXTURE_PT_image_sampling,
848         bpy.types.TEXTURE_PT_image_mapping,
849         bpy.types.TEXTURE_PT_musgrave,
850         bpy.types.TEXTURE_PT_voronoi,
851         bpy.types.TEXTURE_PT_distortednoise,
852         bpy.types.TEXTURE_PT_voxeldata,
853         bpy.types.TEXTURE_PT_pointdensity,
854         bpy.types.TEXTURE_PT_pointdensity_turbulence,
855         bpy.types.PARTICLE_PT_context_particles,
856         bpy.types.PARTICLE_PT_emission,
857         bpy.types.PARTICLE_PT_hair_dynamics,
858         bpy.types.PARTICLE_PT_cache,
859         bpy.types.PARTICLE_PT_velocity,
860         bpy.types.PARTICLE_PT_rotation,
861         bpy.types.PARTICLE_PT_physics,
862         bpy.types.PARTICLE_PT_boidbrain,
863         bpy.types.PARTICLE_PT_render,
864         bpy.types.PARTICLE_PT_draw,
865         bpy.types.PARTICLE_PT_children,
866         bpy.types.PARTICLE_PT_field_weights,
867         bpy.types.PARTICLE_PT_force_fields,
868         bpy.types.PARTICLE_PT_vertexgroups,
869         bpy.types.PARTICLE_PT_custom_props,
870         )
871
872
873 def register():
874     bpy.types.RENDER_PT_render.append(draw_device)
875     bpy.types.VIEW3D_HT_header.append(draw_pause)
876
877     for panel in get_panels():
878         panel.COMPAT_ENGINES.add('CYCLES')
879
880
881 def unregister():
882     bpy.types.RENDER_PT_render.remove(draw_device)
883     bpy.types.VIEW3D_HT_header.remove(draw_pause)
884
885     for panel in get_panels():
886         panel.COMPAT_ENGINES.remove('CYCLES')