Cycles / Sampling Presets:
authorThomas Dinges <blender@dingto.org>
Fri, 19 Jul 2013 23:59:40 +0000 (23:59 +0000)
committerThomas Dinges <blender@dingto.org>
Fri, 19 Jul 2013 23:59:40 +0000 (23:59 +0000)
* Add Presets for Sampling. This comes with a simple Preview and Final preset, but as this is varying a lot depending on the scene, they should just be a starting point. The user can add own presets here.

* Some UI layout changes to match the settings a bit better.

intern/cycles/blender/addon/presets.py
intern/cycles/blender/addon/ui.py
release/scripts/presets/cycles/sampling/final.py [new file with mode: 0644]
release/scripts/presets/cycles/sampling/preview.py [new file with mode: 0644]

index e2836b2cc21d53d86280d35edff990283401cd09..d1f8e7c3a6defa190ff9979aeeb98812abbf7b5e 100644 (file)
@@ -46,6 +46,36 @@ class AddPresetIntegrator(AddPresetBase, Operator):
     preset_subdir = "cycles/integrator"
 
 
+class AddPresetSampling(AddPresetBase, Operator):
+    '''Add a Sampling Preset'''
+    bl_idname = "render.cycles_sampling_preset_add"
+    bl_label = "Add Sampling Preset"
+    preset_menu = "CYCLES_MT_sampling_presets"
+
+    preset_defines = [
+        "cycles = bpy.context.scene.cycles"
+    ]
+
+    preset_values = [
+        "cycles.samples",
+        "cycles.preview_samples",
+        "cycles.aa_samples",
+        "cycles.preview_aa_samples",
+        "cycles.diffuse_samples",
+        "cycles.glossy_samples",
+        "cycles.transmission_samples",
+        "cycles.ao_samples",
+        "cycles.mesh_light_samples",
+        "cycles.subsurface_samples",
+        "cycles.no_caustics",
+        "cycles.blur_glossy",
+        "cycles.squared_samples",
+        "cycles.progressive"
+    ]
+
+    preset_subdir = "cycles/sampling"
+
+
 def register():
     pass
 
index d862a00f006e82a9d0edcf3c0a6f38cacd31baa9..1a17675cb71d83084f8318f2c0e689b0ec9399e5 100644 (file)
@@ -23,6 +23,14 @@ import bpy
 from bpy.types import Panel, Menu, Operator
 
 
+class CYCLES_MT_sampling_presets(Menu):
+    bl_label = "Sampling Presets"
+    preset_subdir = "cycles/sampling"
+    preset_operator = "script.execute_preset"
+    COMPAT_ENGINES = {'CYCLES'}
+    draw = Menu.draw_preset
+
+
 class CYCLES_MT_integrator_presets(Menu):
     bl_label = "Integrator Presets"
     preset_subdir = "cycles/integrator"
@@ -52,22 +60,30 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
         scene = context.scene
         cscene = scene.cycles
         device_type = context.user_preferences.system.compute_device_type
+        
+        row = layout.row(align=True)
+        row.menu("CYCLES_MT_sampling_presets", text=bpy.types.CYCLES_MT_sampling_presets.bl_label)
+        row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMIN")
+        row.operator("render.cycles_sampling_preset_add", text="", icon="ZOOMOUT").remove_active = True
 
-        split = layout.split()
-
-        col = split.column()
-        sub = col.column()
+        row = layout.row()
+        sub = row.row()
         sub.active = (device_type == 'NONE' or cscene.device == 'CPU')
         sub.prop(cscene, "progressive")
-
+        row.prop(cscene, "squared_samples")
+        
+        split = layout.split()
+        
+        col = split.column()
         sub = col.column(align=True)
+        sub.label("Settings:")
         sub.prop(cscene, "seed")
         sub.prop(cscene, "sample_clamp")
 
         if cscene.progressive or (device_type != 'NONE' and cscene.device == 'GPU'):
             col = split.column()
-            col.label(text="Samples:")
             sub = col.column(align=True)
+            sub.label(text="Samples:")
             sub.prop(cscene, "samples", text="Render")
             sub.prop(cscene, "preview_samples", text="Preview")
         else:
@@ -76,16 +92,14 @@ class CyclesRender_PT_sampling(CyclesButtonsPanel, Panel):
             sub.prop(cscene, "preview_aa_samples", text="Preview")
 
             col = split.column()
-            col.label(text="Samples:")
             sub = col.column(align=True)
+            sub.label(text="Samples:")
             sub.prop(cscene, "diffuse_samples", text="Diffuse")
             sub.prop(cscene, "glossy_samples", text="Glossy")
             sub.prop(cscene, "transmission_samples", text="Transmission")
             sub.prop(cscene, "ao_samples", text="AO")
             sub.prop(cscene, "mesh_light_samples", text="Mesh Light")
             sub.prop(cscene, "subsurface_samples", text="Subsurface")
-            
-        layout.prop(cscene, "squared_samples")
 
         if cscene.feature_set == 'EXPERIMENTAL' and (device_type == 'NONE' or cscene.device == 'CPU'):
             layout.row().prop(cscene, "sampling_pattern", text="Pattern")
diff --git a/release/scripts/presets/cycles/sampling/final.py b/release/scripts/presets/cycles/sampling/final.py
new file mode 100644 (file)
index 0000000..3e7516c
--- /dev/null
@@ -0,0 +1,16 @@
+import bpy
+cycles = bpy.context.scene.cycles
+
+cycles.squared_samples = True
+
+cycles.samples = 8
+cycles.preview_samples = 8
+cycles.aa_samples = 8
+cycles.preview_aa_samples = 8
+
+cycles.diffuse_samples = 3
+cycles.glossy_samples = 2
+cycles.transmission_samples = 2
+cycles.ao_samples = 1
+cycles.mesh_light_samples = 2
+cycles.subsurface_samples = 2
diff --git a/release/scripts/presets/cycles/sampling/preview.py b/release/scripts/presets/cycles/sampling/preview.py
new file mode 100644 (file)
index 0000000..c9ceead
--- /dev/null
@@ -0,0 +1,16 @@
+import bpy
+cycles = bpy.context.scene.cycles
+
+cycles.squared_samples = True
+
+cycles.samples = 4
+cycles.preview_samples = 4
+cycles.aa_samples = 4
+cycles.preview_aa_samples = 4
+
+cycles.diffuse_samples = 3
+cycles.glossy_samples = 2
+cycles.transmission_samples = 2
+cycles.ao_samples = 1
+cycles.mesh_light_samples = 2
+cycles.subsurface_samples = 2