Revision: 39781
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39781
Author:   blendix
Date:     2011-08-29 17:55:14 +0000 (Mon, 29 Aug 2011)
Log Message:
-----------
Cycles: integrator presets, patch by Thomas.

Modified Paths:
--------------
    branches/cycles/intern/cycles/blender/CMakeLists.txt
    branches/cycles/intern/cycles/blender/addon/__init__.py
    branches/cycles/intern/cycles/blender/addon/ui.py

Added Paths:
-----------
    branches/cycles/intern/cycles/blender/addon/presets.py
    branches/cycles/release/scripts/presets/cycles/
    branches/cycles/release/scripts/presets/cycles/integrator/
    branches/cycles/release/scripts/presets/cycles/integrator/direct_light.py

Modified: branches/cycles/intern/cycles/blender/CMakeLists.txt
===================================================================
--- branches/cycles/intern/cycles/blender/CMakeLists.txt        2011-08-29 
17:46:07 UTC (rev 39780)
+++ branches/cycles/intern/cycles/blender/CMakeLists.txt        2011-08-29 
17:55:14 UTC (rev 39781)
@@ -16,6 +16,7 @@
        addon/__init__.py
        addon/engine.py 
        addon/enums.py
+       addon/presets.py
        addon/properties.py
        addon/ui.py
        addon/xml.py)

Modified: branches/cycles/intern/cycles/blender/addon/__init__.py
===================================================================
--- branches/cycles/intern/cycles/blender/addon/__init__.py     2011-08-29 
17:46:07 UTC (rev 39780)
+++ branches/cycles/intern/cycles/blender/addon/__init__.py     2011-08-29 
17:55:14 UTC (rev 39781)
@@ -35,6 +35,7 @@
 from cycles import properties
 from cycles import xml
 from cycles import engine
+from cycles import presets
 
 class CyclesRender(bpy.types.RenderEngine):
     bl_idname = 'CYCLES'
@@ -76,11 +77,13 @@
     properties.register()
     ui.register()
     xml.register()
+    presets.register()
     bpy.utils.register_module(__name__)
 
 def unregister():
     xml.unregister()
     ui.unregister()
     properties.unregister()
+    presets.unregister()
     bpy.utils.unregister_module(__name__)
 

Added: branches/cycles/intern/cycles/blender/addon/presets.py
===================================================================
--- branches/cycles/intern/cycles/blender/addon/presets.py                      
        (rev 0)
+++ branches/cycles/intern/cycles/blender/addon/presets.py      2011-08-29 
17:55:14 UTC (rev 39781)
@@ -0,0 +1,48 @@
+#
+# Copyright 2011, Blender Foundation.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+from bl_operators.presets import AddPresetBase
+from bpy.types import Operator
+
+class AddPresetIntegrator(AddPresetBase, Operator):
+    '''Add an Integrator Preset'''
+    bl_idname = "render.cycles_integrator_preset_add"
+    bl_label = "Add Integrator Preset"
+    preset_menu = "CYCLES_MT_integrator_presets"
+
+    preset_defines = [
+        "cycles = bpy.context.scene.cycles"
+    ]
+
+    preset_values = [
+        "cycles.max_bounces",
+        "cycles.min_bounces",
+        "cycles.no_caustics",
+    ]
+
+    preset_subdir = "cycles/integrator"
+    
+def register():
+    pass
+
+def unregister():
+    pass
+    
+if __name__ == "__main__":
+    register()
+

Modified: branches/cycles/intern/cycles/blender/addon/ui.py
===================================================================
--- branches/cycles/intern/cycles/blender/addon/ui.py   2011-08-29 17:46:07 UTC 
(rev 39780)
+++ branches/cycles/intern/cycles/blender/addon/ui.py   2011-08-29 17:55:14 UTC 
(rev 39781)
@@ -18,11 +18,18 @@
 
 import bpy
 
-from bpy.types import Panel
+from bpy.types import Panel, Menu
 
 from cycles import enums
 from cycles import engine
 
+class CYCLES_MT_integrator_presets(Menu):
+    bl_label = "Integrator Presets"
+    preset_subdir = "cycles/integrator"
+    preset_operator = "script.execute_preset"
+    COMPAT_ENGINES = {'CYCLES'}
+    draw = Menu.draw_preset
+
 class CyclesButtonsPanel():
     bl_space_type = "PROPERTIES"
     bl_region_type = "WINDOW"
@@ -41,6 +48,11 @@
 
         scene = context.scene
         cscene = scene.cycles
+        
+        row = layout.row(align=True)
+        row.menu("CYCLES_MT_integrator_presets", 
text=bpy.types.CYCLES_MT_integrator_presets.bl_label)
+        row.operator("render.cycles_integrator_preset_add", text="", 
icon="ZOOMIN")
+        row.operator("render.cycles_integrator_preset_add", text="", 
icon="ZOOMOUT").remove_active = True
 
         split = layout.split()
 

Added: branches/cycles/release/scripts/presets/cycles/integrator/direct_light.py
===================================================================
--- branches/cycles/release/scripts/presets/cycles/integrator/direct_light.py   
                        (rev 0)
+++ branches/cycles/release/scripts/presets/cycles/integrator/direct_light.py   
2011-08-29 17:55:14 UTC (rev 39781)
@@ -0,0 +1,6 @@
+import bpy
+cycles = bpy.context.scene.cycles
+
+cycles.max_bounces = 0
+cycles.min_bounces = 0
+cycles.no_caustics = False

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to