Blender V2.61 - r43446

properties.py

Go to the documentation of this file.
00001 #
00002 # Copyright 2011, Blender Foundation.
00003 #
00004 # This program is free software; you can redistribute it and/or
00005 # modify it under the terms of the GNU General Public License
00006 # as published by the Free Software Foundation; either version 2
00007 # of the License, or (at your option) any later version.
00008 #
00009 # This program is distributed in the hope that it will be useful,
00010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 # GNU General Public License for more details.
00013 #
00014 # You should have received a copy of the GNU General Public License
00015 # along with this program; if not, write to the Free Software Foundation,
00016 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017 #
00018 
00019 # <pep8 compliant>
00020 
00021 import bpy
00022 from bpy.props import (BoolProperty,
00023                        EnumProperty,
00024                        FloatProperty,
00025                        IntProperty,
00026                        PointerProperty)
00027 
00028 import math
00029 
00030 from . import enums
00031 
00032 
00033 class CyclesRenderSettings(bpy.types.PropertyGroup):
00034     @classmethod
00035     def register(cls):
00036         bpy.types.Scene.cycles = PointerProperty(type=cls, name="Cycles Render Settings", description="Cycles render settings")
00037 
00038         cls.device = EnumProperty(name="Device", description="Device to use for rendering",
00039             items=enums.devices, default="CPU")
00040 
00041         cls.feature_set = EnumProperty(name="Feature Set", description="Feature set to use for rendering",
00042             items=enums.feature_set, default="SUPPORTED")
00043 
00044         cls.shading_system = EnumProperty(name="Shading System", description="Shading system to use for rendering",
00045             items=enums.shading_systems, default="GPU_COMPATIBLE")
00046 
00047         cls.samples = IntProperty(name="Samples", description="Number of samples to render for each pixel",
00048             default=10, min=1, max=2147483647)
00049         cls.preview_samples = IntProperty(name="Preview Samples", description="Number of samples to render in the viewport, unlimited if 0",
00050             default=10, min=0, max=2147483647)
00051         cls.preview_pause = BoolProperty(name="Pause Preview", description="Pause all viewport preview renders",
00052             default=False)
00053 
00054         cls.no_caustics = BoolProperty(name="No Caustics", description="Leave out caustics, resulting in a darker image with less noise",
00055             default=False)
00056         cls.blur_caustics = FloatProperty(name="Blur Caustics", description="Blur caustics to reduce noise",
00057             default=0.0, min=0.0, max=1.0)
00058 
00059         cls.min_bounces = IntProperty(name="Min Bounces", description="Minimum number of bounces, setting this lower than the maximum enables probalistic path termination (faster but noisier)",
00060             default=3, min=0, max=1024)
00061         cls.max_bounces = IntProperty(name="Max Bounces", description="Total maximum number of bounces",
00062             default=8, min=0, max=1024)
00063 
00064         cls.diffuse_bounces = IntProperty(name="Diffuse Bounces", description="Maximum number of diffuse reflection bounces, bounded by total maximum",
00065             default=128, min=0, max=1024)
00066         cls.glossy_bounces = IntProperty(name="Glossy Bounces", description="Maximum number of glossy reflection bounces, bounded by total maximum",
00067             default=128, min=0, max=1024)
00068         cls.transmission_bounces = IntProperty(name="Transmission Bounces", description="Maximum number of transmission bounces, bounded by total maximum",
00069             default=128, min=0, max=1024)
00070 
00071         cls.transparent_min_bounces = IntProperty(name="Transparent Min Bounces", description="Minimum number of transparent bounces, setting this lower than the maximum enables probalistic path termination (faster but noisier)",
00072             default=8, min=0, max=1024)
00073         cls.transparent_max_bounces = IntProperty(name="Transparent Max Bounces", description="Maximum number of transparent bounces",
00074             default=8, min=0, max=1024)
00075         cls.use_transparent_shadows = BoolProperty(name="Transparent Shadows", description="Use transparency of surfaces for rendering shadows",
00076             default=True)
00077 
00078         cls.film_exposure = FloatProperty(name="Exposure", description="Image brightness scale",
00079             default=1.0, min=0.0, max=10.0)
00080         cls.film_transparent = BoolProperty(name="Transparent", description="World background is transparent",
00081             default=False)
00082 
00083         cls.filter_type = EnumProperty(name="Filter Type", description="Pixel filter type",
00084             items=enums.filter_types, default="GAUSSIAN")
00085         cls.filter_width = FloatProperty(name="Filter Width", description="Pixel filter width",
00086             default=1.5, min=0.01, max=10.0)
00087 
00088         cls.seed = IntProperty(name="Seed", description="Seed value for integrator to get different noise patterns",
00089             default=0, min=0, max=2147483647)
00090 
00091         cls.debug_tile_size = IntProperty(name="Tile Size", description="",
00092             default=1024, min=1, max=4096)
00093         cls.debug_min_size = IntProperty(name="Min Size", description="",
00094             default=64, min=1, max=4096)
00095         cls.debug_reset_timeout = FloatProperty(name="Reset timeout", description="",
00096             default=0.1, min=0.01, max=10.0)
00097         cls.debug_cancel_timeout = FloatProperty(name="Cancel timeout", description="",
00098             default=0.1, min=0.01, max=10.0)
00099         cls.debug_text_timeout = FloatProperty(name="Text timeout", description="",
00100             default=1.0, min=0.01, max=10.0)
00101 
00102         cls.debug_bvh_type = EnumProperty(name="Viewport BVH Type", description="Choose between faster updates, or faster render",
00103             items=enums.bvh_types, default="DYNAMIC_BVH")
00104         cls.debug_use_spatial_splits = BoolProperty(name="Use Spatial Splits", description="Use BVH spatial splits: longer builder time, faster render",
00105             default=False)
00106         cls.use_cache = BoolProperty(name="Cache BVH", description="Cache last built BVH to disk for faster re-render if no geometry changed",
00107             default=False)
00108 
00109     @classmethod
00110     def unregister(cls):
00111         del bpy.types.Scene.cycles
00112 
00113 
00114 class CyclesCameraSettings(bpy.types.PropertyGroup):
00115     @classmethod
00116     def register(cls):
00117         bpy.types.Camera.cycles = PointerProperty(type=cls, name="Cycles Camera Settings", description="Cycles camera settings")
00118 
00119         cls.aperture_size = FloatProperty(name="Aperture Size", description="Radius of the aperture for depth of field",
00120             default=0.0, min=0.0, max=10.0)
00121         cls.aperture_blades = IntProperty(name="Aperture Blades", description="Number of blades in aperture for polygonal bokeh (at least 3)",
00122             default=0, min=0, max=100)
00123         cls.aperture_rotation = FloatProperty(name="Aperture Rotation", description="Rotation of blades in aperture",
00124             default=0, soft_min=-math.pi, soft_max=math.pi, subtype='ANGLE')
00125 
00126     @classmethod
00127     def unregister(cls):
00128         del bpy.types.Camera.cycles
00129 
00130 
00131 class CyclesMaterialSettings(bpy.types.PropertyGroup):
00132     @classmethod
00133     def register(cls):
00134         bpy.types.Material.cycles = PointerProperty(type=cls, name="Cycles Material Settings", description="Cycles material settings")
00135         cls.sample_as_light = BoolProperty(name="Sample as Lamp", description="Use direct light sampling for this material, disabling may reduce overall noise for large objects that emit little light compared to other light sources", default=True)
00136         cls.homogeneous_volume = BoolProperty(name="Homogeneous Volume", description="When using volume rendering, assume volume has the same density everywhere, for faster rendering", default=False)
00137 
00138     @classmethod
00139     def unregister(cls):
00140         del bpy.types.Material.cycles
00141 
00142 
00143 class CyclesLampSettings(bpy.types.PropertyGroup):
00144     @classmethod
00145     def register(cls):
00146         bpy.types.Lamp.cycles = PointerProperty(type=cls, name="Cycles Lamp Settings", description="Cycles lamp settings")
00147         cls.cast_shadow = BoolProperty(name="Cast Shadow", description="Lamp casts shadows", default=True)
00148 
00149     @classmethod
00150     def unregister(cls):
00151         del bpy.types.Lamp.cycles
00152 
00153 
00154 class CyclesWorldSettings(bpy.types.PropertyGroup):
00155     @classmethod
00156     def register(cls):
00157         bpy.types.World.cycles = PointerProperty(type=cls, name="Cycles World Settings", description="Cycles world settings")
00158 
00159     @classmethod
00160     def unregister(cls):
00161         del bpy.types.World.cycles
00162 
00163 
00164 class CyclesVisibilitySettings(bpy.types.PropertyGroup):
00165     @classmethod
00166     def register(cls):
00167         bpy.types.Object.cycles_visibility = PointerProperty(type=cls, name="Cycles Visibility Settings", description="Cycles visibility settings")
00168 
00169         cls.camera = BoolProperty(name="Camera", description="Object visibility for camera rays", default=True)
00170         cls.diffuse = BoolProperty(name="Diffuse", description="Object visibility for diffuse reflection rays", default=True)
00171         cls.glossy = BoolProperty(name="Glossy", description="Object visibility for glossy reflection rays", default=True)
00172         cls.transmission = BoolProperty(name="Transmission", description="Object visibility for transmission rays", default=True)
00173         cls.shadow = BoolProperty(name="Shadow", description="Object visibility for shadow rays", default=True)
00174 
00175     @classmethod
00176     def unregister(cls):
00177         del bpy.types.Object.cycles_visibility
00178 
00179 
00180 class CyclesMeshSettings(bpy.types.PropertyGroup):
00181     @classmethod
00182     def register(cls):
00183         bpy.types.Mesh.cycles = PointerProperty(type=cls, name="Cycles Mesh Settings", description="Cycles mesh settings")
00184         bpy.types.Curve.cycles = PointerProperty(type=cls, name="Cycles Mesh Settings", description="Cycles mesh settings")
00185         bpy.types.MetaBall.cycles = PointerProperty(type=cls, name="Cycles Mesh Settings", description="Cycles mesh settings")
00186 
00187         cls.displacement_method = EnumProperty(name="Displacement Method", description="Method to use for the displacement",
00188             items=enums.displacement_methods, default="BUMP")
00189         cls.use_subdivision = BoolProperty(name="Use Subdivision", description="Subdivide mesh for rendering",
00190             default=False)
00191         cls.dicing_rate = FloatProperty(name="Dicing Rate", description="", default=1.0, min=0.001, max=1000.0)
00192 
00193     @classmethod
00194     def unregister(cls):
00195         del bpy.types.Mesh.cycles
00196         del bpy.types.Curve.cycles
00197         del bpy.types.MetaBall.cycles
00198 
00199 
00200 def register():
00201     bpy.utils.register_class(CyclesRenderSettings)
00202     bpy.utils.register_class(CyclesCameraSettings)
00203     bpy.utils.register_class(CyclesMaterialSettings)
00204     bpy.utils.register_class(CyclesLampSettings)
00205     bpy.utils.register_class(CyclesWorldSettings)
00206     bpy.utils.register_class(CyclesVisibilitySettings)
00207     bpy.utils.register_class(CyclesMeshSettings)
00208 
00209 
00210 def unregister():
00211     bpy.utils.unregister_class(CyclesRenderSettings)
00212     bpy.utils.unregister_class(CyclesCameraSettings)
00213     bpy.utils.unregister_class(CyclesMaterialSettings)
00214     bpy.utils.unregister_class(CyclesLampSettings)
00215     bpy.utils.unregister_class(CyclesWorldSettings)
00216     bpy.utils.unregister_class(CyclesMeshSettings)
00217     bpy.utils.unregister_class(CyclesVisibilitySettings)