Cycles: integrator presets, patch by Thomas.

This commit is contained in:
Brecht Van Lommel 2011-08-29 17:55:14 +00:00
parent eac2674f1d
commit 1e741b3a52
5 changed files with 71 additions and 1 deletions

@ -16,6 +16,7 @@ set(addonfiles
addon/__init__.py
addon/engine.py
addon/enums.py
addon/presets.py
addon/properties.py
addon/ui.py
addon/xml.py)

@ -35,6 +35,7 @@ from cycles import ui
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 @@ def register():
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__)

@ -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()

@ -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 @@ class CyclesRender_PT_integrator(CyclesButtonsPanel, Panel):
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()

@ -0,0 +1,6 @@
import bpy
cycles = bpy.context.scene.cycles
cycles.max_bounces = 0
cycles.min_bounces = 0
cycles.no_caustics = False