faf057e13cc63eaaf94d16c0ea91c30eabba9992
[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         col.prop(ccam, "aperture_size", text="Size")
267
268         sub = col.column(align=True)
269         sub.prop(ccam, "aperture_blades", text="Blades")
270         sub.prop(ccam, "aperture_rotation", text="Rotation")
271
272
273 class Cycles_PT_context_material(CyclesButtonsPanel, Panel):
274     bl_label = ""
275     bl_context = "material"
276     bl_options = {'HIDE_HEADER'}
277
278     @classmethod
279     def poll(cls, context):
280         return (context.material or context.object) and CyclesButtonsPanel.poll(context)
281
282     def draw(self, context):
283         layout = self.layout
284
285         mat = context.material
286         ob = context.object
287         slot = context.material_slot
288         space = context.space_data
289
290         if ob:
291             row = layout.row()
292
293             row.template_list(ob, "material_slots", ob, "active_material_index", rows=2)
294
295             col = row.column(align=True)
296             col.operator("object.material_slot_add", icon='ZOOMIN', text="")
297             col.operator("object.material_slot_remove", icon='ZOOMOUT', text="")
298
299             col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
300
301             if ob.mode == 'EDIT':
302                 row = layout.row(align=True)
303                 row.operator("object.material_slot_assign", text="Assign")
304                 row.operator("object.material_slot_select", text="Select")
305                 row.operator("object.material_slot_deselect", text="Deselect")
306
307         split = layout.split(percentage=0.65)
308
309         if ob:
310             split.template_ID(ob, "active_material", new="material.new")
311             row = split.row()
312
313             if slot:
314                 row.prop(slot, "link", text="")
315             else:
316                 row.label()
317         elif mat:
318             split.template_ID(space, "pin_id")
319             split.separator()
320
321
322 class Cycles_PT_mesh_displacement(CyclesButtonsPanel, Panel):
323     bl_label = "Displacement"
324     bl_context = "data"
325
326     @classmethod
327     def poll(cls, context):
328         if CyclesButtonsPanel.poll(context):
329             if context.mesh or context.curve or context.meta_ball:
330                 if context.scene.cycles.feature_set == 'EXPERIMENTAL':
331                     return True
332
333         return False
334
335     def draw(self, context):
336         layout = self.layout
337
338         mesh = context.mesh
339         curve = context.curve
340         mball = context.meta_ball
341
342         if mesh:
343             cdata = mesh.cycles
344         elif curve:
345             cdata = curve.cycles
346         elif mball:
347             cdata = mball.cycles
348
349         layout.prop(cdata, "displacement_method", text="Method")
350         layout.prop(cdata, "use_subdivision")
351         layout.prop(cdata, "dicing_rate")
352
353
354 class CyclesObject_PT_ray_visibility(CyclesButtonsPanel, Panel):
355     bl_label = "Ray Visibility"
356     bl_context = "object"
357     bl_options = {'DEFAULT_CLOSED'}
358
359     @classmethod
360     def poll(cls, context):
361         ob = context.object
362         return CyclesButtonsPanel.poll(context) and ob and ob.type in {'MESH', 'CURVE', 'CURVE', 'SURFACE', 'FONT', 'META'}  # todo: 'LAMP'
363
364     def draw(self, context):
365         layout = self.layout
366
367         ob = context.object
368         visibility = ob.cycles_visibility
369
370         flow = layout.column_flow()
371
372         flow.prop(visibility, "camera")
373         flow.prop(visibility, "diffuse")
374         flow.prop(visibility, "glossy")
375         flow.prop(visibility, "transmission")
376         flow.prop(visibility, "shadow")
377
378
379 def find_node(material, nodetype):
380     if material and material.node_tree:
381         ntree = material.node_tree
382
383         for node in ntree.nodes:
384             if getattr(node, "type", None) == nodetype:
385                 return node
386
387     return None
388
389
390 def find_node_input(node, name):
391     for input in node.inputs:
392         if input.name == name:
393             return input
394
395     return None
396
397
398 def panel_node_draw(layout, id_data, output_type, input_name):
399     if not id_data.node_tree:
400         layout.prop(id_data, "use_nodes", icon='NODETREE')
401         return False
402
403     ntree = id_data.node_tree
404
405     node = find_node(id_data, output_type)
406     if not node:
407         layout.label(text="No output node.")
408     else:
409         input = find_node_input(node, input_name)
410         layout.template_node_view(ntree, node, input)
411
412     return True
413
414
415 class CyclesLamp_PT_lamp(CyclesButtonsPanel, Panel):
416     bl_label = "Lamp"
417     bl_context = "data"
418
419     @classmethod
420     def poll(cls, context):
421         return context.lamp and CyclesButtonsPanel.poll(context)
422
423     def draw(self, context):
424         layout = self.layout
425
426         lamp = context.lamp
427         clamp = lamp.cycles
428
429         layout.prop(lamp, "type", expand=True)
430
431         split = layout.split()
432         col = split.column(align=True)
433
434         if lamp.type in {'POINT', 'SUN', 'SPOT'}:
435             col.prop(lamp, "shadow_soft_size", text="Size")
436         elif lamp.type == 'AREA':
437             col.prop(lamp, "shape", text="")
438             sub = col.column(align=True)
439
440             if lamp.shape == 'SQUARE':
441                 sub.prop(lamp, "size")
442             elif lamp.shape == 'RECTANGLE':
443                 sub.prop(lamp, "size", text="Size X")
444                 sub.prop(lamp, "size_y", text="Size Y")
445
446         col = split.column()
447         col.prop(clamp, "cast_shadow")
448
449         if lamp.type == 'SPOT':
450             layout.label(text="Not supported, interpreted as point lamp.")
451         elif lamp.type == 'HEMI':
452             layout.label(text="Not supported, interpreted as sun lamp.")
453
454
455 class CyclesLamp_PT_nodes(CyclesButtonsPanel, Panel):
456     bl_label = "Nodes"
457     bl_context = "data"
458
459     @classmethod
460     def poll(cls, context):
461         return context.lamp and CyclesButtonsPanel.poll(context)
462
463     def draw(self, context):
464         layout = self.layout
465
466         lamp = context.lamp
467         if not panel_node_draw(layout, lamp, 'OUTPUT_LAMP', 'Surface'):
468             layout.prop(lamp, "color")
469
470
471 class CyclesWorld_PT_surface(CyclesButtonsPanel, Panel):
472     bl_label = "Surface"
473     bl_context = "world"
474
475     @classmethod
476     def poll(cls, context):
477         return context.world and CyclesButtonsPanel.poll(context)
478
479     def draw(self, context):
480         layout = self.layout
481
482         world = context.world
483
484         if not panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Surface'):
485             layout.prop(world, "horizon_color", text="Color")
486
487 class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel):
488     bl_label = "Volume"
489     bl_context = "world"
490     bl_options = {'DEFAULT_CLOSED'}
491
492     @classmethod
493     def poll(cls, context):
494         # world = context.world
495         # world and world.node_tree and CyclesButtonsPanel.poll(context)
496         return False
497
498     def draw(self, context):
499         layout = self.layout
500         layout.active = False
501
502         world = context.world
503         panel_node_draw(layout, world, 'OUTPUT_WORLD', 'Volume')
504
505 class CyclesWorld_PT_ambient_occlusion(CyclesButtonsPanel, Panel):
506     bl_label = "Ambient Occlusion"
507     bl_context = "world"
508
509     @classmethod
510     def poll(cls, context):
511         return context.world and CyclesButtonsPanel.poll(context)
512
513     def draw_header(self, context):
514         light = context.world.light_settings
515         self.layout.prop(light, "use_ambient_occlusion", text="")
516
517     def draw(self, context):
518         layout = self.layout
519         light = context.world.light_settings
520
521         layout.active = light.use_ambient_occlusion
522
523         split = layout.split()
524         split.prop(light, "ao_factor", text="Factor")
525         split.prop(light, "distance", text="Distance")
526
527 class CyclesWorld_PT_settings(CyclesButtonsPanel, Panel):
528     bl_label = "Settings"
529     bl_context = "world"
530     bl_options = {'DEFAULT_CLOSED'}
531
532     @classmethod
533     def poll(cls, context):
534         return context.world and CyclesButtonsPanel.poll(context)
535
536     def draw(self, context):
537         layout = self.layout
538
539         world = context.world
540         cworld = world.cycles
541
542         col = layout.column()
543
544         col.prop(cworld, "sample_as_light")
545         row = col.row()
546         row.active = cworld.sample_as_light
547         row.prop(cworld, "sample_map_resolution")
548
549 class CyclesMaterial_PT_surface(CyclesButtonsPanel, Panel):
550     bl_label = "Surface"
551     bl_context = "material"
552
553     @classmethod
554     def poll(cls, context):
555         return context.material and CyclesButtonsPanel.poll(context)
556
557     def draw(self, context):
558         layout = self.layout
559
560         mat = context.material
561         if not panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface'):
562             layout.prop(mat, "diffuse_color")
563
564
565 class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel):
566     bl_label = "Volume"
567     bl_context = "material"
568     bl_options = {'DEFAULT_CLOSED'}
569
570     @classmethod
571     def poll(cls, context):
572         # mat = context.material
573         # mat and mat.node_tree and CyclesButtonsPanel.poll(context)
574         return False
575
576     def draw(self, context):
577         layout = self.layout
578         layout.active = False
579
580         mat = context.material
581         cmat = mat.cycles
582
583         panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Volume')
584
585         layout.prop(cmat, "homogeneous_volume")
586
587
588 class CyclesMaterial_PT_displacement(CyclesButtonsPanel, Panel):
589     bl_label = "Displacement"
590     bl_context = "material"
591
592     @classmethod
593     def poll(cls, context):
594         mat = context.material
595         return mat and mat.node_tree and CyclesButtonsPanel.poll(context)
596
597     def draw(self, context):
598         layout = self.layout
599
600         mat = context.material
601         panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement')
602
603
604 class CyclesMaterial_PT_settings(CyclesButtonsPanel, Panel):
605     bl_label = "Settings"
606     bl_context = "material"
607     bl_options = {'DEFAULT_CLOSED'}
608
609     @classmethod
610     def poll(cls, context):
611         return context.material and CyclesButtonsPanel.poll(context)
612
613     def draw(self, context):
614         layout = self.layout
615
616         mat = context.material
617         cmat = mat.cycles
618
619         split = layout.split()
620
621         col = split.column()
622         col.prop(mat, "diffuse_color", text="Viewport Color")
623
624         col = split.column()
625         col.prop(cmat, "sample_as_light")
626         col.prop(mat, "pass_index")
627
628
629 class CyclesTexture_PT_context(CyclesButtonsPanel, Panel):
630     bl_label = ""
631     bl_context = "texture"
632     bl_options = {'HIDE_HEADER'}
633     COMPAT_ENGINES = {'CYCLES'}
634
635     def draw(self, context):
636         layout = self.layout
637
638         tex = context.texture
639         space = context.space_data
640         pin_id = space.pin_id
641         use_pin_id = space.use_pin_id
642         user = context.texture_user
643         # node = context.texture_node
644
645         if not use_pin_id or not isinstance(pin_id, bpy.types.Texture):
646             pin_id = None
647
648         if not pin_id:
649             layout.template_texture_user()
650
651         if user:
652             layout.separator()
653
654             split = layout.split(percentage=0.65)
655             col = split.column()
656
657             if pin_id:
658                 col.template_ID(space, "pin_id")
659             elif user:
660                 col.template_ID(user, "texture", new="texture.new")
661
662             if tex:
663                 split = layout.split(percentage=0.2)
664                 split.label(text="Type:")
665                 split.prop(tex, "type", text="")
666
667
668 class CyclesTexture_PT_nodes(CyclesButtonsPanel, Panel):
669     bl_label = "Nodes"
670     bl_context = "texture"
671
672     @classmethod
673     def poll(cls, context):
674         tex = context.texture
675         return (tex and tex.use_nodes) and CyclesButtonsPanel.poll(context)
676
677     def draw(self, context):
678         layout = self.layout
679
680         tex = context.texture
681         panel_node_draw(layout, tex, 'OUTPUT_TEXTURE', 'Color')
682
683
684 class CyclesTexture_PT_node(CyclesButtonsPanel, Panel):
685     bl_label = "Node"
686     bl_context = "texture"
687
688     @classmethod
689     def poll(cls, context):
690         node = context.texture_node
691         return node and CyclesButtonsPanel.poll(context)
692
693     def draw(self, context):
694         layout = self.layout
695
696         node = context.texture_node
697         ntree = node.id_data
698         layout.template_node_view(ntree, node, None)
699
700
701 class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel):
702     bl_label = "Mapping"
703     bl_context = "texture"
704
705     @classmethod
706     def poll(cls, context):
707         tex = context.texture
708         node = context.texture_node
709         return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
710
711     def draw(self, context):
712         layout = self.layout
713
714         # tex = context.texture
715         node = context.texture_node
716
717         mapping = node.texture_mapping
718
719         row = layout.row()
720
721         row.column().prop(mapping, "location")
722         row.column().prop(mapping, "rotation")
723         row.column().prop(mapping, "scale")
724
725         layout.label(text="Projection:")
726
727         row = layout.row()
728         row.prop(mapping, "mapping_x", text="")
729         row.prop(mapping, "mapping_y", text="")
730         row.prop(mapping, "mapping_z", text="")
731
732
733 class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel):
734     bl_label = "Color"
735     bl_context = "texture"
736     bl_options = {'DEFAULT_CLOSED'}
737
738     @classmethod
739     def poll(cls, context):
740         # tex = context.texture
741         # node = context.texture_node
742         return False
743         #return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
744
745     def draw(self, context):
746         layout = self.layout
747
748         # tex = context.texture
749         node = context.texture_node
750
751         mapping = node.color_mapping
752
753         split = layout.split()
754
755         col = split.column()
756         col.label(text="Blend:")
757         col.prop(mapping, "blend_type", text="")
758         col.prop(mapping, "blend_factor", text="Factor")
759         col.prop(mapping, "blend_color", text="")
760
761         col = split.column()
762         col.label(text="Adjust:")
763         col.prop(mapping, "brightness")
764         col.prop(mapping, "contrast")
765         col.prop(mapping, "saturation")
766
767         layout.separator()
768
769         layout.prop(mapping, "use_color_ramp", text="Ramp")
770         if mapping.use_color_ramp:
771             layout.template_color_ramp(mapping, "color_ramp", expand=True)
772
773
774 def draw_device(self, context):
775     scene = context.scene
776     layout = self.layout
777
778     if scene.render.engine == 'CYCLES':
779         cscene = scene.cycles
780
781         layout.prop(cscene, "feature_set")
782
783         device_type = context.user_preferences.system.compute_device_type
784         if device_type == 'CUDA':
785             layout.prop(cscene, "device")
786         elif device_type == 'OPENCL' and cscene.feature_set == 'EXPERIMENTAL':
787             layout.prop(cscene, "device")
788
789
790 def draw_pause(self, context):
791     layout = self.layout
792     scene = context.scene
793
794     if scene.render.engine == "CYCLES":
795         view = context.space_data
796
797         if view.viewport_shade == 'RENDERED':
798             cscene = scene.cycles
799             layout.prop(cscene, "preview_pause", icon="PAUSE", text="")
800
801
802 def get_panels():
803     return (
804         bpy.types.RENDER_PT_render,
805         bpy.types.RENDER_PT_output,
806         bpy.types.RENDER_PT_encoding,
807         bpy.types.RENDER_PT_dimensions,
808         bpy.types.RENDER_PT_stamp,
809         bpy.types.SCENE_PT_scene,
810         bpy.types.SCENE_PT_audio,
811         bpy.types.SCENE_PT_unit,
812         bpy.types.SCENE_PT_keying_sets,
813         bpy.types.SCENE_PT_keying_set_paths,
814         bpy.types.SCENE_PT_physics,
815         bpy.types.WORLD_PT_context_world,
816         bpy.types.DATA_PT_context_mesh,
817         bpy.types.DATA_PT_context_camera,
818         bpy.types.DATA_PT_context_lamp,
819         bpy.types.DATA_PT_texture_space,
820         bpy.types.DATA_PT_curve_texture_space,
821         bpy.types.DATA_PT_mball_texture_space,
822         bpy.types.DATA_PT_vertex_groups,
823         bpy.types.DATA_PT_shape_keys,
824         bpy.types.DATA_PT_uv_texture,
825         bpy.types.DATA_PT_vertex_colors,
826         bpy.types.DATA_PT_camera,
827         bpy.types.DATA_PT_camera_display,
828         bpy.types.DATA_PT_lens,
829         bpy.types.DATA_PT_custom_props_mesh,
830         bpy.types.DATA_PT_custom_props_camera,
831         bpy.types.DATA_PT_custom_props_lamp,
832         bpy.types.TEXTURE_PT_clouds,
833         bpy.types.TEXTURE_PT_wood,
834         bpy.types.TEXTURE_PT_marble,
835         bpy.types.TEXTURE_PT_magic,
836         bpy.types.TEXTURE_PT_blend,
837         bpy.types.TEXTURE_PT_stucci,
838         bpy.types.TEXTURE_PT_image,
839         bpy.types.TEXTURE_PT_image_sampling,
840         bpy.types.TEXTURE_PT_image_mapping,
841         bpy.types.TEXTURE_PT_musgrave,
842         bpy.types.TEXTURE_PT_voronoi,
843         bpy.types.TEXTURE_PT_distortednoise,
844         bpy.types.TEXTURE_PT_voxeldata,
845         bpy.types.TEXTURE_PT_pointdensity,
846         bpy.types.TEXTURE_PT_pointdensity_turbulence,
847         bpy.types.PARTICLE_PT_context_particles,
848         bpy.types.PARTICLE_PT_emission,
849         bpy.types.PARTICLE_PT_hair_dynamics,
850         bpy.types.PARTICLE_PT_cache,
851         bpy.types.PARTICLE_PT_velocity,
852         bpy.types.PARTICLE_PT_rotation,
853         bpy.types.PARTICLE_PT_physics,
854         bpy.types.PARTICLE_PT_boidbrain,
855         bpy.types.PARTICLE_PT_render,
856         bpy.types.PARTICLE_PT_draw,
857         bpy.types.PARTICLE_PT_children,
858         bpy.types.PARTICLE_PT_field_weights,
859         bpy.types.PARTICLE_PT_force_fields,
860         bpy.types.PARTICLE_PT_vertexgroups,
861         bpy.types.PARTICLE_PT_custom_props,
862         )
863
864
865 def register():
866     bpy.types.RENDER_PT_render.append(draw_device)
867     bpy.types.VIEW3D_HT_header.append(draw_pause)
868
869     for panel in get_panels():
870         panel.COMPAT_ENGINES.add('CYCLES')
871
872
873 def unregister():
874     bpy.types.RENDER_PT_render.remove(draw_device)
875     bpy.types.VIEW3D_HT_header.remove(draw_pause)
876
877     for panel in get_panels():
878         panel.COMPAT_ENGINES.remove('CYCLES')