Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r--intern/cycles/blender/addon/__init__.py74
-rw-r--r--intern/cycles/blender/addon/engine.py62
-rw-r--r--intern/cycles/blender/addon/enums.py81
-rw-r--r--intern/cycles/blender/addon/properties.py186
-rw-r--r--intern/cycles/blender/addon/ui.py733
-rw-r--r--intern/cycles/blender/addon/xml.py90
-rw-r--r--intern/cycles/blender/blender_session.cpp48
-rw-r--r--intern/cycles/blender/blender_shader.cpp7
-rw-r--r--intern/cycles/blender/blender_sync.cpp26
9 files changed, 641 insertions, 666 deletions
diff --git a/intern/cycles/blender/addon/__init__.py b/intern/cycles/blender/addon/__init__.py
index e66d078f8c7..418f3d4cd27 100644
--- a/intern/cycles/blender/addon/__init__.py
+++ b/intern/cycles/blender/addon/__init__.py
@@ -37,50 +37,50 @@ from cycles import xml
from cycles import engine
class CyclesRender(bpy.types.RenderEngine):
- bl_idname = 'CYCLES'
- bl_label = "Cycles"
+ bl_idname = 'CYCLES'
+ bl_label = "Cycles"
- def __init__(self):
- engine.init()
- self.session = None
-
- def __del__(self):
- engine.free(self)
+ def __init__(self):
+ engine.init()
+ self.session = None
+
+ def __del__(self):
+ engine.free(self)
- # final render
- def update(self, data, scene):
- engine.create(self, data, scene)
- engine.update(self, data, scene)
+ # final render
+ def update(self, data, scene):
+ engine.create(self, data, scene)
+ engine.update(self, data, scene)
- def render(self):
- engine.render(self)
+ def render(self):
+ engine.render(self)
- # preview render
- # def preview_update(self, context, id):
- # pass
- #
- # def preview_render(self):
- # pass
-
- # viewport render
- def view_update(self, context):
- if not self.session:
- engine.create(self, context.blend_data, context.scene,
- context.region, context.space_data, context.region_data)
- engine.update(self, context.blend_data, context.scene)
+ # preview render
+ # def preview_update(self, context, id):
+ # pass
+ #
+ # def preview_render(self):
+ # pass
+
+ # viewport render
+ def view_update(self, context):
+ if not self.session:
+ engine.create(self, context.blend_data, context.scene,
+ context.region, context.space_data, context.region_data)
+ engine.update(self, context.blend_data, context.scene)
- def view_draw(self, context):
- engine.draw(self, context.region, context.space_data, context.region_data)
+ def view_draw(self, context):
+ engine.draw(self, context.region, context.space_data, context.region_data)
def register():
- properties.register()
- ui.register()
- xml.register()
- bpy.utils.register_module(__name__)
+ properties.register()
+ ui.register()
+ xml.register()
+ bpy.utils.register_module(__name__)
def unregister():
- xml.unregister()
- ui.unregister()
- properties.unregister()
- bpy.utils.unregister_module(__name__)
+ xml.unregister()
+ ui.unregister()
+ properties.unregister()
+ bpy.utils.unregister_module(__name__)
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py
index d25eb21eeb9..d6ea15a435f 100644
--- a/intern/cycles/blender/addon/engine.py
+++ b/intern/cycles/blender/addon/engine.py
@@ -19,52 +19,52 @@
import bpy
def init():
- import libcycles_blender as lib
- import os.path
- lib.init(os.path.dirname(__file__))
+ import libcycles_blender as lib
+ import os.path
+ lib.init(os.path.dirname(__file__))
def create(engine, data, scene, region = 0, v3d = 0, rv3d = 0):
- import libcycles_blender as lib
+ import libcycles_blender as lib
- data = data.as_pointer()
- scene = scene.as_pointer()
- if region:
- region = region.as_pointer()
- if v3d:
- v3d = v3d.as_pointer()
- if rv3d:
- rv3d = rv3d.as_pointer()
+ data = data.as_pointer()
+ scene = scene.as_pointer()
+ if region:
+ region = region.as_pointer()
+ if v3d:
+ v3d = v3d.as_pointer()
+ if rv3d:
+ rv3d = rv3d.as_pointer()
- engine.session = lib.create(engine.as_pointer(), data, scene, region, v3d, rv3d)
+ engine.session = lib.create(engine.as_pointer(), data, scene, region, v3d, rv3d)
def free(engine):
- if "session" in dir(engine):
- if engine.session:
- import libcycles_blender as lib
- lib.free(engine.session)
- del engine.session
+ if "session" in dir(engine):
+ if engine.session:
+ import libcycles_blender as lib
+ lib.free(engine.session)
+ del engine.session
def render(engine):
- import libcycles_blender as lib
- lib.render(engine.session)
+ import libcycles_blender as lib
+ lib.render(engine.session)
def update(engine, data, scene):
- import libcycles_blender as lib
- lib.sync(engine.session)
+ import libcycles_blender as lib
+ lib.sync(engine.session)
def draw(engine, region, v3d, rv3d):
- import libcycles_blender as lib
- v3d = v3d.as_pointer()
- rv3d = rv3d.as_pointer()
+ import libcycles_blender as lib
+ v3d = v3d.as_pointer()
+ rv3d = rv3d.as_pointer()
- # draw render image
- lib.draw(engine.session, v3d, rv3d)
+ # draw render image
+ lib.draw(engine.session, v3d, rv3d)
def available_devices():
- import libcycles_blender as lib
- return lib.available_devices()
+ import libcycles_blender as lib
+ return lib.available_devices()
def with_osl():
- import libcycles_blender as lib
- return lib.with_osl()
+ import libcycles_blender as lib
+ return lib.with_osl()
diff --git a/intern/cycles/blender/addon/enums.py b/intern/cycles/blender/addon/enums.py
index fd12fa6d5a5..4b30f606de2 100644
--- a/intern/cycles/blender/addon/enums.py
+++ b/intern/cycles/blender/addon/enums.py
@@ -33,81 +33,8 @@ bvh_types = (
("DYNAMIC_BVH", "Dynamic BVH", "Objects can be individually updated, at the cost of slower render time"),
("STATIC_BVH", "Static BVH", "Any object modification requires a complete BVH rebuild, but renders faster"))
-response_curves = (
-("None", "None", ""),
-("", "Agfa", ""),
-("Agfacolor Futura 100", "Futura 100", ""),
-("Agfacolor Futura 200", "Futura 200", ""),
-("Agfacolor Futura 400", "Futura 400", ""),
-("Agfacolor Futura II 100", "Futura II 100", ""),
-("Agfacolor Futura II 200", "Futura II 200", ""),
-("Agfacolor Futura II 400", "Futura II 400", ""),
-("Agfacolor HDC 100 plus", "HDC 100 plus", ""),
-("Agfacolor HDC 400 plus", "HDC 400 plus", ""),
-("Agfacolor HDC 200 plus", "HDC 200 plus", ""),
-("Agfacolor Optima II 100", "Optima II 100", ""),
-("Agfacolor Optima II 200", "Optima II 200", ""),
-("Agfacolor Ultra 050", "Ultra 050", ""),
-("", "Agfa", ""),
-("Agfacolor Vista 100", "Vista 100", ""),
-("Agfacolor Vista 200", "Vista 200", ""),
-("Agfacolor Vista 400", "Vista 400", ""),
-("Agfacolor Vista 800", "Vista 800", ""),
-("Agfachrome CT Precisa 100", "CT Precisa 100", ""),
-("Agfachrome CT Precisa 200", "CT Precisa 200", ""),
-("Agfachrome RSX2 050", "Agfachrome RSX2 050", ""),
-("Agfachrome RSX2 100", "Agfachrome RSX2 100", ""),
-("Agfachrome RSX2 200", "Agfachrome RSX2 200", ""),
-("Advantix 100", "Advantix 100", ""),
-("Advantix 200", "Advantix 200", ""),
-("Advantix 400", "Advantix 400", ""),
-("", "Kodak", ""),
-("Gold 100", "Gold 100", ""),
-("Gold 200", "Gold 200", ""),
-("Max Zoom 800", "Max Zoom 800", ""),
-("Portra 100T", "Portra 100T", ""),
-("Portra 160NC", "Portra 160NC", ""),
-("Portra 160VC", "Portra 160VC", ""),
-("Portra 800", "Portra 800", ""),
-("Portra 400VC", "Portra 400VC", ""),
-("Portra 400NC", "Portra 400NC", ""),
-("", "Kodak", ""),
-("Ektachrome 100 plus", "Ektachrome 100 plus", ""),
-("Ektachrome 320T", "Ektachrome 320T", ""),
-("Ektachrome 400X", "Ektachrome 400X", ""),
-("Ektachrome 64", "Ektachrome 64", ""),
-("Ektachrome 64T", "Ektachrome 64T", ""),
-("Ektachrome E100S", "Ektachrome E100S", ""),
-("Ektachrome 100", "Ektachrome 100", ""),
-("Kodachrome 200", "Kodachrome 200", ""),
-("Kodachrome 25", "Kodachrome 25", ""),
-("Kodachrome 64", "Kodachrome 64", ""),
-#("DSCS 3151", "DSCS 3151", ""),
-#("DSCS 3152", "DSCS 3152", ""),
-#("DSCS 3153", "DSCS 3153", ""),
-#("DSCS 3154", "DSCS 3154", ""),
-#("DSCS 3155", "DSCS 3155", ""),
-#("DSCS 3156", "DSCS 3156", ""),
-#("KAI-0311", "KAI-0311", ""),
-#("KAF-2001", "KAF-2001", ""),
-#("KAF-3000", "KAF-3000", ""),
-#("KAI-0372", "KAI-0372", ""),
-#("KAI-1010", "KAI-1010", ""),
-("", "Fujifilm", ""),
-("F-125", "F-125", ""),
-("F-250", "F-250", ""),
-("F-400", "F-400", ""),
-("FCI", "FCI", ""),
-("FP2900Z", "FP2900Z", ""),
-("", "Eastman", ""),
-("Double X Neg 12min", "Double X Neg 12min", ""),
-("Double X Neg 6min", "Double X Neg 6min", ""),
-("Double X Neg 5min", "Double X Neg 5min", ""),
-("Double X Neg 4min", "Double X Neg 4min", ""),
-("", "Canon", ""),
-("Optura 981111", "Optura 981111", ""),
-("Optura 981113", "Optura 981113", ""),
-("Optura 981114", "Optura 981114", ""),
-("Optura 981111.SLRR", "Optura 981111.SLRR", "")
-)
+filter_types = (
+("BOX", "Box", "Box filter"),
+("GAUSSIAN", "Gaussian", "Gaussian filter"))
+
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 3ec0587d89c..62c1db5a16d 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -22,99 +22,117 @@ from bpy.props import *
from cycles import enums
class CyclesRenderSettings(bpy.types.PropertyGroup):
- @classmethod
- def register(cls):
- bpy.types.Scene.cycles = PointerProperty(type=cls, name="Cycles Render Settings", description="Cycles Render Settings")
-
- cls.device = EnumProperty(name="Device", description="Device to use for rendering",
- items=enums.devices, default="CPU")
-
- cls.shading_system = EnumProperty(name="Shading System", description="Shading system to use for rendering",
- items=enums.shading_systems, default="GPU_COMPATIBLE")
-
- cls.passes = IntProperty(name="Passes", description="Number of passes to render",
- default=10, min=1, max=2147483647)
- cls.min_bounces = IntProperty(name="Min Bounces", description="Minimum number of bounces",
- default=3, min=0, max=1024)
- cls.max_bounces = IntProperty(name="Max Bounces", description="Maximum number of bounces",
- default=8, min=0, max=1024)
- cls.no_caustics = BoolProperty(name="No Caustics", description="Leave out caustics, resulting in a darker image with less noise",
- default=False)
- cls.blur_caustics = FloatProperty(name="Blur Caustics", description="Blur caustics to reduce noise",
- default=0.0, min=0.0, max=1.0)
-
- cls.exposure = FloatProperty(name="Exposure", description="Image brightness scale",
- default=1.0, min=0.0, max=10.0)
- cls.response_curve = EnumProperty(name="Response Curve", description="Measured camera film response",
- items=enums.response_curves, default="Advantix 400")
-
- cls.debug_tile_size = IntProperty(name="Tile Size", description="",
- default=1024, min=1, max=4096)
- cls.debug_min_size = IntProperty(name="Min Size", description="",
- default=64, min=1, max=4096)
- cls.debug_reset_timeout = FloatProperty(name="Reset timeout", description="",
- default=0.1, min=0.01, max=10.0)
- cls.debug_cancel_timeout = FloatProperty(name="Cancel timeout", description="",
- default=0.1, min=0.01, max=10.0)
- cls.debug_text_timeout = FloatProperty(name="Text timeout", description="",
- default=1.0, min=0.01, max=10.0)
-
- cls.debug_bvh_type = EnumProperty(name="BVH Type", description="Choose between faster updates, or faster render",
- items=enums.bvh_types, default="DYNAMIC_BVH")
- cls.debug_use_spatial_splits = BoolProperty(name="Use Spatial Splits", description="Use BVH spatial splits: longer builder time, faster render",
- default=False)
-
- @classmethod
- def unregister(cls):
- del bpy.types.Scene.cycles
+ @classmethod
+ def register(cls):
+ bpy.types.Scene.cycles = PointerProperty(type=cls, name="Cycles Render Settings", description="Cycles Render Settings")
+
+ cls.device = EnumProperty(name="Device", description="Device to use for rendering",
+ items=enums.devices, default="CPU")
+
+ cls.shading_system = EnumProperty(name="Shading System", description="Shading system to use for rendering",
+ items=enums.shading_systems, default="GPU_COMPATIBLE")
+
+ cls.passes = IntProperty(name="Passes", description="Number of passes to render",
+ default=10, min=1, max=2147483647)
+ cls.preview_passes = IntProperty(name="Preview Passes", description="Number of passes to render in the viewport, unlimited if 0",
+ default=0, min=0, max=2147483647)
+ cls.min_bounces = IntProperty(name="Min Bounces", description="Minimum number of bounces",
+ default=3, min=0, max=1024)
+ cls.max_bounces = IntProperty(name="Max Bounces", description="Maximum number of bounces",
+ default=8, min=0, max=1024)
+ cls.no_caustics = BoolProperty(name="No Caustics", description="Leave out caustics, resulting in a darker image with less noise",
+ default=False)
+ cls.blur_caustics = FloatProperty(name="Blur Caustics", description="Blur caustics to reduce noise",
+ default=0.0, min=0.0, max=1.0)
+
+ cls.exposure = FloatProperty(name="Exposure", description="Image brightness scale",
+ default=1.0, min=0.0, max=10.0)
+ cls.transparent = BoolProperty(name="Transparent", description="World background is transparent",
+ default=False)
+
+ cls.filter_type = EnumProperty(name="Filter Type", description="Pixel filter type",
+ items=enums.filter_types, default="GAUSSIAN")
+ cls.filter_width = FloatProperty(name="Filter Width", description="Pixel filter width",
+ default=1.5, min=0.01, max=10.0)
+
+ cls.debug_tile_size = IntProperty(name="Tile Size", description="",
+ default=1024, min=1, max=4096)
+ cls.debug_min_size = IntProperty(name="Min Size", description="",
+ default=64, min=1, max=4096)
+ cls.debug_reset_timeout = FloatProperty(name="Reset timeout", description="",
+ default=0.1, min=0.01, max=10.0)
+ cls.debug_cancel_timeout = FloatProperty(name="Cancel timeout", description="",
+ default=0.1, min=0.01, max=10.0)
+ cls.debug_text_timeout = FloatProperty(name="Text timeout", description="",
+ default=1.0, min=0.01, max=10.0)
+
+ cls.debug_bvh_type = EnumProperty(name="BVH Type", description="Choose between faster updates, or faster render",
+ items=enums.bvh_types, default="DYNAMIC_BVH")
+ cls.debug_use_spatial_splits = BoolProperty(name="Use Spatial Splits", description="Use BVH spatial splits: longer builder time, faster render",
+ default=False)
+
+ @classmethod
+ def unregister(cls):
+ del bpy.types.Scene.cycles
class CyclesCameraSettings(bpy.types.PropertyGroup):
- @classmethod
- def register(cls):
- bpy.types.Camera.cycles = PointerProperty(type=cls, name="Cycles Camera Settings", description="Cycles Camera Settings")
+ @classmethod
+ def register(cls):
+ bpy.types.Camera.cycles = PointerProperty(type=cls, name="Cycles Camera Settings", description="Cycles Camera Settings")
- cls.lens_radius = FloatProperty(name="Lens radius", description="Lens radius for depth of field",
- default=0.0, min=0.0, max=10.0)
-
- @classmethod
- def unregister(cls):
- del bpy.types.Camera.cycles
+ cls.lens_radius = FloatProperty(name="Lens radius", description="Lens radius for depth of field",
+ default=0.0, min=0.0, max=10.0)
+
+ @classmethod
+ def unregister(cls):
+ del bpy.types.Camera.cycles
class CyclesMaterialSettings(bpy.types.PropertyGroup):
- @classmethod
- def register(cls):
- bpy.types.Material.cycles = PointerProperty(type=cls, name="Cycles Material Settings", description="Cycles Material Settings")
+ @classmethod
+ def register(cls):
+ bpy.types.Material.cycles = PointerProperty(type=cls, name="Cycles Material Settings", description="Cycles Material Settings")
- @classmethod
- def unregister(cls):
- del bpy.types.Material.cycles
+ @classmethod
+ def unregister(cls):
+ del bpy.types.Material.cycles
+
+class CyclesWorldSettings(bpy.types.PropertyGroup):
+ @classmethod
+ def register(cls):
+ bpy.types.World.cycles = PointerProperty(type=cls, name="Cycles World Settings", description="Cycles World Settings")
+
+ @classmethod
+ def unregister(cls):
+ del bpy.types.World.cycles
class CyclesMeshSettings(bpy.types.PropertyGroup):
- @classmethod
- def register(cls):
- bpy.types.Mesh.cycles = PointerProperty(type=cls, name="Cycles Mesh Settings", description="Cycles Mesh Settings")
- bpy.types.Curve.cycles = PointerProperty(type=cls, name="Cycles Mesh Settings", description="Cycles Mesh Settings")
- bpy.types.MetaBall.cycles = PointerProperty(type=cls, name="Cycles Mesh Settings", description="Cycles Mesh Settings")
-
- cls.displacement_method = EnumProperty(name="Displacement Method", description="Method to use for the displacement",
- items=enums.displacement_methods, default="BUMP")
- cls.use_subdivision = BoolProperty(name="Use Subdivision", description="Subdivide mesh for rendering",
- default=False)
- cls.dicing_rate = FloatProperty(name="Dicing Rate", description="", default=1.0, min=0.001, max=1000.0)
-
- @classmethod
- def unregister(cls):
- del bpy.types.Mesh.cycles
+ @classmethod
+ def register(cls):
+ bpy.types.Mesh.cycles = PointerProperty(type=cls, name="Cycles Mesh Settings", description="Cycles Mesh Settings")
+ bpy.types.Curve.cycles = PointerProperty(type=cls, name="Cycles Mesh Settings", description="Cycles Mesh Settings")
+ bpy.types.MetaBall.cycles = PointerProperty(type=cls, name="Cycles Mesh Settings", description="Cycles Mesh Settings")
+
+ cls.displacement_method = EnumProperty(name="Displacement Method", description="Method to use for the displacement",
+ items=enums.displacement_methods, default="BUMP")
+ cls.use_subdivision = BoolProperty(name="Use Subdivision", description="Subdivide mesh for rendering",
+ default=False)
+ cls.dicing_rate = FloatProperty(name="Dicing Rate", description="", default=1.0, min=0.001, max=1000.0)
+
+ @classmethod
+ def unregister(cls):
+ del bpy.types.Mesh.cycles
def register():
- bpy.utils.register_class(CyclesRenderSettings)
- bpy.utils.register_class(CyclesCameraSettings)
- bpy.utils.register_class(CyclesMaterialSettings)
- bpy.utils.register_class(CyclesMeshSettings)
-
+ bpy.utils.register_class(CyclesRenderSettings)
+ bpy.utils.register_class(CyclesCameraSettings)
+ bpy.utils.register_class(CyclesMaterialSettings)
+ bpy.utils.register_class(CyclesWorldSettings)
+ bpy.utils.register_class(CyclesMeshSettings)
+
def unregister():
- bpy.utils.unregister_class(CyclesRenderSettings)
- bpy.utils.unregister_class(CyclesCameraSettings)
- bpy.utils.unregister_class(CyclesMaterialSettings)
- bpy.utils.unregister_class(CyclesMeshSettings)
+ bpy.utils.unregister_class(CyclesRenderSettings)
+ bpy.utils.unregister_class(CyclesCameraSettings)
+ bpy.utils.unregister_class(CyclesMaterialSettings)
+ bpy.utils.unregister_class(CyclesWorldSettings)
+ bpy.utils.unregister_class(CyclesMeshSettings)
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index ca839691111..a1363ece854 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -22,494 +22,503 @@ from cycles import enums
from cycles import engine
class CyclesButtonsPanel():
- bl_space_type = "PROPERTIES"
- bl_region_type = "WINDOW"
- bl_context = "render"
-
- @classmethod
- def poll(cls, context):
- rd = context.scene.render
- return rd.engine == 'CYCLES'
+ bl_space_type = "PROPERTIES"
+ bl_region_type = "WINDOW"
+ bl_context = "render"
+
+ @classmethod
+ def poll(cls, context):
+ rd = context.scene.render
+ return rd.engine == 'CYCLES'
class CyclesRender_PT_integrator(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Integrator"
+ bl_label = "Integrator"
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- scene = context.scene
- cycles = scene.cycles
+ scene = context.scene
+ cscene = scene.cycles
- split = layout.split()
+ split = layout.split()
- col = split.column()
- col.prop(cycles, "passes")
- col.prop(cycles, "no_caustics")
+ col = split.column()
+ col.prop(cscene, "passes", text="Render Passes")
+ #sub = col.row()
+ #sub.active = cscene.preview_passes >= 1
+ #sub.prop(cscene, "preview_passes")
+ col.prop(cscene, "no_caustics")
- col = split.column()
- col = col.column(align=True)
- col.prop(cycles, "max_bounces")
- col.prop(cycles, "min_bounces")
+ col = split.column()
+ col = col.column(align=True)
+ col.prop(cscene, "max_bounces")
+ col.prop(cscene, "min_bounces")
- #row = col.row()
- #row.prop(cycles, "blur_caustics")
- #row.active = not cycles.no_caustics
-
+ #row = col.row()
+ #row.prop(cscene, "blur_caustics")
+ #row.active = not cscene.no_caustics
+
class CyclesRender_PT_film(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Film"
+ bl_label = "Film"
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- scene = context.scene
- cycles = scene.cycles
+ scene = context.scene
+ cscene = scene.cycles
- split = layout.split()
+ split = layout.split()
- split.prop(cycles, "exposure")
- split.prop(cycles, "response_curve", text="")
+ col = split.column();
+ col.prop(cscene, "exposure")
+ col.prop(cscene, "transparent")
+
+ col = split.column()
+ col.prop(cscene, "filter_type", text="")
+ if cscene.filter_type != 'BOX':
+ col.prop(cscene, "filter_width", text="Width")
class CyclesRender_PT_performance(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Performance"
- bl_options = {'DEFAULT_CLOSED'}
+ bl_label = "Performance"
+ bl_options = {'DEFAULT_CLOSED'}
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- scene = context.scene
- rd = scene.render
- cycles = scene.cycles
+ scene = context.scene
+ rd = scene.render
+ cscene = scene.cycles
- split = layout.split()
+ split = layout.split()
- col = split.column(align=True)
+ col = split.column(align=True)
- col.label(text="Threads:")
- col.row().prop(rd, "threads_mode", expand=True)
- sub = col.column()
- sub.enabled = rd.threads_mode == 'FIXED'
- sub.prop(rd, "threads")
+ col.label(text="Threads:")
+ col.row().prop(rd, "threads_mode", expand=True)
+ sub = col.column()
+ sub.enabled = rd.threads_mode == 'FIXED'
+ sub.prop(rd, "threads")
- sub = col.column(align=True)
- sub.label(text="Tiles:")
- sub.prop(cycles, "debug_tile_size")
- sub.prop(cycles, "debug_min_size")
+ sub = col.column(align=True)
+ sub.label(text="Tiles:")
+ sub.prop(cscene, "debug_tile_size")
+ sub.prop(cscene, "debug_min_size")
- col = split.column()
+ col = split.column()
- sub = col.column(align=True)
- sub.label(text="Acceleration structure:")
- sub.prop(cycles, "debug_bvh_type", text="")
- sub.prop(cycles, "debug_use_spatial_splits")
+ sub = col.column(align=True)
+ sub.label(text="Acceleration structure:")
+ sub.prop(cscene, "debug_bvh_type", text="")
+ sub.prop(cscene, "debug_use_spatial_splits")
class Cycles_PT_post_processing(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Post Processing"
- bl_options = {'DEFAULT_CLOSED'}
+ bl_label = "Post Processing"
+ bl_options = {'DEFAULT_CLOSED'}
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- rd = context.scene.render
+ rd = context.scene.render
- split = layout.split()
+ split = layout.split()
- col = split.column()
- col.prop(rd, "use_compositing")
- col.prop(rd, "use_sequencer")
+ col = split.column()
+ col.prop(rd, "use_compositing")
+ col.prop(rd, "use_sequencer")
- col = split.column()
- col.prop(rd, "dither_intensity", text="Dither", slider=True)
+ col = split.column()
+ col.prop(rd, "dither_intensity", text="Dither", slider=True)
class Cycles_PT_camera(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Cycles"
- bl_context = "data"
+ bl_label = "Cycles"
+ bl_context = "data"
- @classmethod
- def poll(cls, context):
- return context.camera
+ @classmethod
+ def poll(cls, context):
+ return context.camera
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- camera = context.camera
- cycles = camera.cycles
+ camera = context.camera
+ ccamera = camera.cycles
- layout.prop(cycles, "lens_radius")
+ layout.prop(ccamera, "lens_radius")
class Cycles_PT_context_material(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Surface"
- bl_context = "material"
- bl_options = {'HIDE_HEADER'}
+ bl_label = "Surface"
+ bl_context = "material"
+ bl_options = {'HIDE_HEADER'}
- @classmethod
- def poll(cls, context):
- return (context.material or context.object) and CyclesButtonsPanel.poll(context)
+ @classmethod
+ def poll(cls, context):
+ return (context.material or context.object) and CyclesButtonsPanel.poll(context)
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- mat = context.material
- ob = context.object
- slot = context.material_slot
- space = context.space_data
+ mat = context.material
+ ob = context.object
+ slot = context.material_slot
+ space = context.space_data
- if ob:
- row = layout.row()
+ if ob:
+ row = layout.row()
- row.template_list(ob, "material_slots", ob, "active_material_index", rows=2)
+ row.template_list(ob, "material_slots", ob, "active_material_index", rows=2)
- col = row.column(align=True)
- col.operator("object.material_slot_add", icon='ZOOMIN', text="")
- col.operator("object.material_slot_remove", icon='ZOOMOUT', text="")
+ col = row.column(align=True)
+ col.operator("object.material_slot_add", icon='ZOOMIN', text="")
+ col.operator("object.material_slot_remove", icon='ZOOMOUT', text="")
- col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
+ col.menu("MATERIAL_MT_specials", icon='DOWNARROW_HLT', text="")
- if ob.mode == 'EDIT':
- row = layout.row(align=True)
- row.operator("object.material_slot_assign", text="Assign")
- row.operator("object.material_slot_select", text="Select")
- row.operator("object.material_slot_deselect", text="Deselect")
+ if ob.mode == 'EDIT':
+ row = layout.row(align=True)
+ row.operator("object.material_slot_assign", text="Assign")
+ row.operator("object.material_slot_select", text="Select")
+ row.operator("object.material_slot_deselect", text="Deselect")
- split = layout.split(percentage=0.65)
+ split = layout.split(percentage=0.65)
- if ob:
- split.template_ID(ob, "active_material", new="material.new")
- row = split.row()
+ if ob:
+ split.template_ID(ob, "active_material", new="material.new")
+ row = split.row()
- if slot:
- row.prop(slot, "link", text="")
- else:
- row.label()
- elif mat:
- split.template_ID(space, "pin_id")
- split.separator()
+ if slot:
+ row.prop(slot, "link", text="")
+ else:
+ row.label()
+ elif mat:
+ split.template_ID(space, "pin_id")
+ split.separator()
class Cycles_PT_mesh_displacement(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Displacement"
- bl_context = "data"
+ bl_label = "Displacement"
+ bl_context = "data"
- @classmethod
- def poll(cls, context):
- return context.mesh or context.curve or context.meta_ball
+ @classmethod
+ def poll(cls, context):
+ return context.mesh or context.curve or context.meta_ball
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- mesh = context.mesh
- curve = context.curve
- mball = context.meta_ball
+ mesh = context.mesh
+ curve = context.curve
+ mball = context.meta_ball
- if mesh:
- cycles = mesh.cycles
- elif curve:
- cycles = curve.cycles
- elif mball:
- cycles = mball.cycles
+ if mesh:
+ cdata = mesh.cycles
+ elif curve:
+ cdata = curve.cycles
+ elif mball:
+ cdata = mball.cycles
- layout.prop(cycles, "displacement_method", text="Method")
- layout.prop(cycles, "use_subdivision");
- layout.prop(cycles, "dicing_rate");
+ layout.prop(cdata, "displacement_method", text="Method")
+ layout.prop(cdata, "use_subdivision");
+ layout.prop(cdata, "dicing_rate");
def find_node(material, nodetype):
- if material and material.node_tree:
- ntree = material.node_tree
+ if material and material.node_tree:
+ ntree = material.node_tree
- for node in ntree.nodes:
- if type(node) is not bpy.types.NodeGroup and node.type == nodetype:
- return node
-
- return None
+ for node in ntree.nodes:
+ if type(node) is not bpy.types.NodeGroup and node.type == nodetype:
+ return node
+
+ return None
def find_node_input(node, name):
- for input in node.inputs:
- if input.name == name:
- return input
-
- return None
+ for input in node.inputs:
+ if input.name == name:
+ return input
+
+ return None
def panel_node_draw(layout, id, output_type, input_name):
- if not id.node_tree:
- layout.prop(id, "use_nodes")
- return
+ if not id.node_tree:
+ layout.prop(id, "use_nodes")
+ return
- ntree = id.node_tree
+ ntree = id.node_tree
- node = find_node(id, output_type)
- if not node:
- layout.label(text="No output node.")
- else:
- input = find_node_input(node, input_name)
- layout.template_node_view(ntree, node, input);
+ node = find_node(id, output_type)
+ if not node:
+ layout.label(text="No output node.")
+ else:
+ input = find_node_input(node, input_name)
+ layout.template_node_view(ntree, node, input);
class CyclesLamp_PT_lamp(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Surface"
- bl_context = "data"
+ bl_label = "Surface"
+ bl_context = "data"
- @classmethod
- def poll(cls, context):
- return context.lamp and CyclesButtonsPanel.poll(context)
+ @classmethod
+ def poll(cls, context):
+ return context.lamp and CyclesButtonsPanel.poll(context)
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- mat = context.lamp
- panel_node_draw(layout, mat, 'OUTPUT_LAMP', 'Surface')
+ mat = context.lamp
+ panel_node_draw(layout, mat, 'OUTPUT_LAMP', 'Surface')
class CyclesWorld_PT_surface(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Surface"
- bl_context = "world"
+ bl_label = "Surface"
+ bl_context = "world"
- @classmethod
- def poll(cls, context):
- return context.world and CyclesButtonsPanel.poll(context)
+ @classmethod
+ def poll(cls, context):
+ return context.world and CyclesButtonsPanel.poll(context)
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- mat = context.world
- panel_node_draw(layout, mat, 'OUTPUT_WORLD', 'Surface')
+ mat = context.world
+ panel_node_draw(layout, mat, 'OUTPUT_WORLD', 'Surface')
class CyclesWorld_PT_volume(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Volume"
- bl_context = "world"
+ bl_label = "Volume"
+ bl_context = "world"
- @classmethod
- def poll(cls, context):
- return context.world and CyclesButtonsPanel.poll(context)
+ @classmethod
+ def poll(cls, context):
+ return context.world and CyclesButtonsPanel.poll(context)
- def draw(self, context):
- layout = self.layout
- layout.active = False
+ def draw(self, context):
+ layout = self.layout
+ layout.active = False
- mat = context.world
- panel_node_draw(layout, mat, 'OUTPUT_WORLD', 'Volume')
+ mat = context.world
+ panel_node_draw(layout, mat, 'OUTPUT_WORLD', 'Volume')
class CyclesMaterial_PT_surface(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Surface"
- bl_context = "material"
+ bl_label = "Surface"
+ bl_context = "material"
- @classmethod
- def poll(cls, context):
- return context.material and CyclesButtonsPanel.poll(context)
+ @classmethod
+ def poll(cls, context):
+ return context.material and CyclesButtonsPanel.poll(context)
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- mat = context.material
- panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface')
+ mat = context.material
+ panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Surface')
class CyclesMaterial_PT_volume(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Volume"
- bl_context = "material"
+ bl_label = "Volume"
+ bl_context = "material"
- @classmethod
- def poll(cls, context):
- return context.material and CyclesButtonsPanel.poll(context)
+ @classmethod
+ def poll(cls, context):
+ return context.material and CyclesButtonsPanel.poll(context)
- def draw(self, context):
- layout = self.layout
- layout.active = False
+ def draw(self, context):
+ layout = self.layout
+ layout.active = False
- mat = context.material
- panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Volume')
+ mat = context.material
+ panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Volume')
class CyclesMaterial_PT_displacement(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Displacement"
- bl_context = "material"
+ bl_label = "Displacement"
+ bl_context = "material"
- @classmethod
- def poll(cls, context):
- return context.material and CyclesButtonsPanel.poll(context)
+ @classmethod
+ def poll(cls, context):
+ return context.material and CyclesButtonsPanel.poll(context)
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- mat = context.material
- panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement')
+ mat = context.material
+ panel_node_draw(layout, mat, 'OUTPUT_MATERIAL', 'Displacement')
class CyclesMaterial_PT_settings(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Settings"
- bl_context = "material"
- bl_options = {'DEFAULT_CLOSED'}
+ bl_label = "Settings"
+ bl_context = "material"
+ bl_options = {'DEFAULT_CLOSED'}
- @classmethod
- def poll(cls, context):
- # return context.material and CyclesButtonsPanel.poll(context)
- return False
+ @classmethod
+ def poll(cls, context):
+ # return context.material and CyclesButtonsPanel.poll(context)
+ return False
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- mat = context.material
-
- row = layout.row()
- row.label(text="Light Group:")
- row.prop(mat, "light_group", text="")
+ mat = context.material
+
+ row = layout.row()
+ row.label(text="Light Group:")
+ row.prop(mat, "light_group", text="")
class CyclesTexture_PT_context(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = ""
- bl_context = "texture"
- bl_options = {'HIDE_HEADER'}
- COMPAT_ENGINES = {'CYCLES'}
-
- def draw(self, context):
- layout = self.layout
-
- tex = context.texture
- space = context.space_data
- pin_id = space.pin_id
- use_pin_id = space.use_pin_id;
- user = context.texture_user
- node = context.texture_node
-
- if not use_pin_id or not isinstance(pin_id, bpy.types.Texture):
- pin_id = None
-
- if not pin_id:
- layout.template_texture_user()
-
- if user:
- layout.separator()
-
- split = layout.split(percentage=0.65)
- col = split.column()
-
- if pin_id:
- col.template_ID(space, "pin_id")
- elif user:
- col.template_ID(user, "texture", new="texture.new")
-
- if tex:
- row = split.row()
- row.prop(tex, "use_nodes", icon="NODETREE", text="")
- row.label()
-
- if not tex.use_nodes:
- split = layout.split(percentage=0.2)
- split.label(text="Type:")
- split.prop(tex, "type", text="")
+ bl_label = ""
+ bl_context = "texture"
+ bl_options = {'HIDE_HEADER'}
+ COMPAT_ENGINES = {'CYCLES'}
+
+ def draw(self, context):
+ layout = self.layout
+
+ tex = context.texture
+ space = context.space_data
+ pin_id = space.pin_id
+ use_pin_id = space.use_pin_id;
+ user = context.texture_user
+ node = context.texture_node
+
+ if not use_pin_id or not isinstance(pin_id, bpy.types.Texture):
+ pin_id = None
+
+ if not pin_id:
+ layout.template_texture_user()
+
+ if user:
+ layout.separator()
+
+ split = layout.split(percentage=0.65)
+ col = split.column()
+
+ if pin_id:
+ col.template_ID(space, "pin_id")
+ elif user:
+ col.template_ID(user, "texture", new="texture.new")
+
+ if tex:
+ row = split.row()
+ row.prop(tex, "use_nodes", icon="NODETREE", text="")
+ row.label()
+
+ if not tex.use_nodes:
+ split = layout.split(percentage=0.2)
+ split.label(text="Type:")
+ split.prop(tex, "type", text="")
class CyclesTexture_PT_nodes(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Nodes"
- bl_context = "texture"
+ bl_label = "Nodes"
+ bl_context = "texture"
- @classmethod
- def poll(cls, context):
- tex = context.texture
- return (tex and tex.use_nodes) and CyclesButtonsPanel.poll(context)
+ @classmethod
+ def poll(cls, context):
+ tex = context.texture
+ return (tex and tex.use_nodes) and CyclesButtonsPanel.poll(context)
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- tex = context.texture
- panel_node_draw(layout, tex, 'OUTPUT_TEXTURE', 'Color')
+ tex = context.texture
+ panel_node_draw(layout, tex, 'OUTPUT_TEXTURE', 'Color')
class CyclesTexture_PT_node(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Node"
- bl_context = "texture"
+ bl_label = "Node"
+ bl_context = "texture"
- @classmethod
- def poll(cls, context):
- node = context.texture_node
- return node and CyclesButtonsPanel.poll(context)
+ @classmethod
+ def poll(cls, context):
+ node = context.texture_node
+ return node and CyclesButtonsPanel.poll(context)
- def draw(self, context):
- layout = self.layout
+ def draw(self, context):
+ layout = self.layout
- node = context.texture_node
- ntree = node.id_data
- layout.template_node_view(ntree, node, None)
+ node = context.texture_node
+ ntree = node.id_data
+ layout.template_node_view(ntree, node, None)
class CyclesTexture_PT_mapping(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Mapping"
- bl_context = "texture"
+ bl_label = "Mapping"
+ bl_context = "texture"
- @classmethod
- def poll(cls, context):
- tex = context.texture
- node = context.texture_node
- return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
+ @classmethod
+ def poll(cls, context):
+ tex = context.texture
+ node = context.texture_node
+ return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
- def draw(self, context):
- layout = self.layout
- layout.label("Texture coordinate mapping goes here.");
- layout.label("Translate, rotate, scale, projection, XYZ.")
+ def draw(self, context):
+ layout = self.layout
+ layout.label("Texture coordinate mapping goes here.");
+ layout.label("Translate, rotate, scale, projection, XYZ.")
class CyclesTexture_PT_color(CyclesButtonsPanel, bpy.types.Panel):
- bl_label = "Color"
- bl_context = "texture"
-
- @classmethod
- def poll(cls, context):
- tex = context.texture
- node = context.texture_node
- return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
-
- def draw(self, context):
- layout = self.layout
- layout.label("Color modification options go here.");
- layout.label("Ramp, brightness, contrast, saturation.")
-
+ bl_label = "Color"
+ bl_context = "texture"
+
+ @classmethod
+ def poll(cls, context):
+ tex = context.texture
+ node = context.texture_node
+ return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context)
+
+ def draw(self, context):
+ layout = self.layout
+ layout.label("Color modification options go here.");
+ layout.label("Ramp, brightness, contrast, saturation.")
+
def draw_device(self, context):
- scene = context.scene
- layout = self.layout
+ scene = context.scene
+ layout = self.layout
- if scene.render.engine == "CYCLES":
- cycles = scene.cycles
+ if scene.render.engine == "CYCLES":
+ cscene = scene.cycles
- if 'cuda' in engine.available_devices():
- layout.prop(cycles, "device")
- if cycles.device == 'CPU' and engine.with_osl():
- layout.prop(cycles, "shading_system")
+ if 'cuda' in engine.available_devices():
+ layout.prop(cscene, "device")
+ if cscene.device == 'CPU' and engine.with_osl():
+ layout.prop(cscene, "shading_system")
def get_panels():
- return [
- bpy.types.RENDER_PT_render,
- bpy.types.RENDER_PT_output,
- bpy.types.RENDER_PT_encoding,
- bpy.types.RENDER_PT_dimensions,
- bpy.types.RENDER_PT_stamp,
- bpy.types.WORLD_PT_context_world,
- bpy.types.DATA_PT_context_mesh,
- bpy.types.DATA_PT_context_camera,
- bpy.types.DATA_PT_context_lamp,
- bpy.types.DATA_PT_texture_space,
- bpy.types.DATA_PT_curve_texture_space,
- bpy.types.DATA_PT_mball_texture_space,
- bpy.types.DATA_PT_vertex_groups,
- bpy.types.DATA_PT_shape_keys,
- bpy.types.DATA_PT_uv_texture,
- bpy.types.DATA_PT_vertex_colors,
- bpy.types.DATA_PT_camera,
- bpy.types.DATA_PT_camera_display,
- bpy.types.DATA_PT_custom_props_mesh,
- bpy.types.DATA_PT_custom_props_camera,
- bpy.types.DATA_PT_custom_props_lamp,
- bpy.types.TEXTURE_PT_clouds,
- bpy.types.TEXTURE_PT_wood,
- bpy.types.TEXTURE_PT_marble,
- bpy.types.TEXTURE_PT_magic,
- bpy.types.TEXTURE_PT_blend,
- bpy.types.TEXTURE_PT_stucci,
- bpy.types.TEXTURE_PT_image,
- bpy.types.TEXTURE_PT_image_sampling,
- bpy.types.TEXTURE_PT_image_mapping,
- bpy.types.TEXTURE_PT_musgrave,
- bpy.types.TEXTURE_PT_voronoi,
- bpy.types.TEXTURE_PT_distortednoise,
- bpy.types.TEXTURE_PT_voxeldata,
- bpy.types.TEXTURE_PT_pointdensity,
- bpy.types.TEXTURE_PT_pointdensity_turbulence]
+ return [
+ bpy.types.RENDER_PT_render,
+ bpy.types.RENDER_PT_output,
+ bpy.types.RENDER_PT_encoding,
+ bpy.types.RENDER_PT_dimensions,
+ bpy.types.RENDER_PT_stamp,
+ bpy.types.WORLD_PT_context_world,
+ bpy.types.DATA_PT_context_mesh,
+ bpy.types.DATA_PT_context_camera,
+ bpy.types.DATA_PT_context_lamp,
+ bpy.types.DATA_PT_texture_space,
+ bpy.types.DATA_PT_curve_texture_space,
+ bpy.types.DATA_PT_mball_texture_space,
+ bpy.types.DATA_PT_vertex_groups,
+ bpy.types.DATA_PT_shape_keys,
+ bpy.types.DATA_PT_uv_texture,
+ bpy.types.DATA_PT_vertex_colors,
+ bpy.types.DATA_PT_camera,
+ bpy.types.DATA_PT_camera_display,
+ bpy.types.DATA_PT_custom_props_mesh,
+ bpy.types.DATA_PT_custom_props_camera,
+ bpy.types.DATA_PT_custom_props_lamp,
+ bpy.types.TEXTURE_PT_clouds,
+ bpy.types.TEXTURE_PT_wood,
+ bpy.types.TEXTURE_PT_marble,
+ bpy.types.TEXTURE_PT_magic,
+ bpy.types.TEXTURE_PT_blend,
+ bpy.types.TEXTURE_PT_stucci,
+ bpy.types.TEXTURE_PT_image,
+ bpy.types.TEXTURE_PT_image_sampling,
+ bpy.types.TEXTURE_PT_image_mapping,
+ bpy.types.TEXTURE_PT_musgrave,
+ bpy.types.TEXTURE_PT_voronoi,
+ bpy.types.TEXTURE_PT_distortednoise,
+ bpy.types.TEXTURE_PT_voxeldata,
+ bpy.types.TEXTURE_PT_pointdensity,
+ bpy.types.TEXTURE_PT_pointdensity_turbulence]
def register():
- bpy.types.RENDER_PT_render.append(draw_device)
+ bpy.types.RENDER_PT_render.append(draw_device)
- for panel in get_panels():
- panel.COMPAT_ENGINES.add('CYCLES')
-
+ for panel in get_panels():
+ panel.COMPAT_ENGINES.add('CYCLES')
+
def unregister():
- bpy.types.RENDER_PT_render.remove(draw_device)
+ bpy.types.RENDER_PT_render.remove(draw_device)
- for panel in get_panels():
- panel.COMPAT_ENGINES.remove('CYCLES')
+ for panel in get_panels():
+ panel.COMPAT_ENGINES.remove('CYCLES')
diff --git a/intern/cycles/blender/addon/xml.py b/intern/cycles/blender/addon/xml.py
index f489f099e8b..3713da09235 100644
--- a/intern/cycles/blender/addon/xml.py
+++ b/intern/cycles/blender/addon/xml.py
@@ -25,75 +25,75 @@ import xml.etree.ElementTree as etree
import xml.dom.minidom as dom
def strip(root):
- root.text = None
- root.tail = None
+ root.text = None
+ root.tail = None
- for elem in root:
- strip(elem)
+ for elem in root:
+ strip(elem)
def write(node, fname):
- strip(node)
+ strip(node)
- s = etree.tostring(node)
- s = dom.parseString(s).toprettyxml()
+ s = etree.tostring(node)
+ s = dom.parseString(s).toprettyxml()
- f = open(fname, "w")
- f.write(s)
+ f = open(fname, "w")
+ f.write(s)
class ExportCyclesXML(bpy.types.Operator, ExportHelper):
- ''''''
- bl_idname = "export_mesh.cycles_xml"
- bl_label = "Export Cycles XML"
+ ''''''
+ bl_idname = "export_mesh.cycles_xml"
+ bl_label = "Export Cycles XML"
- filename_ext = ".xml"
+ filename_ext = ".xml"
- @classmethod
- def poll(cls, context):
- return context.active_object != None
+ @classmethod
+ def poll(cls, context):
+ return context.active_object != None
- def execute(self, context):
- filepath = bpy.path.ensure_ext(self.filepath, ".xml")
+ def execute(self, context):
+ filepath = bpy.path.ensure_ext(self.filepath, ".xml")
- # get mesh
- scene = context.scene
- object = context.object
+ # get mesh
+ scene = context.scene
+ object = context.object
- if not object:
- raise Exception("No active object")
+ if not object:
+ raise Exception("No active object")
- mesh = object.to_mesh(scene, True, 'PREVIEW')
+ mesh = object.to_mesh(scene, True, 'PREVIEW')
- if not mesh:
- raise Exception("No mesh data in active object")
+ if not mesh:
+ raise Exception("No mesh data in active object")
- # generate mesh node
- nverts = ""
- verts = ""
- P = ""
+ # generate mesh node
+ nverts = ""
+ verts = ""
+ P = ""
- for v in mesh.vertices:
- P += "%f %f %f " % (v.co[0], v.co[1], v.co[2])
+ for v in mesh.vertices:
+ P += "%f %f %f " % (v.co[0], v.co[1], v.co[2])
- for i, f in enumerate(mesh.faces):
- nverts += str(len(f.vertices)) + " "
+ for i, f in enumerate(mesh.faces):
+ nverts += str(len(f.vertices)) + " "
- for v in f.vertices:
- verts += str(v) + " "
- verts += " "
+ for v in f.vertices:
+ verts += str(v) + " "
+ verts += " "
- node = etree.Element('mesh', attrib={'nverts': nverts, 'verts': verts, 'P': P})
-
- # write to file
- write(node, filepath)
+ node = etree.Element('mesh', attrib={'nverts': nverts, 'verts': verts, 'P': P})
+
+ # write to file
+ write(node, filepath)
- return {'FINISHED'}
+ return {'FINISHED'}
def register():
- pass
+ pass
def unregister():
- pass
+ pass
if __name__ == "__main__":
- register()
+ register()
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 4223998c1f6..7be15ca0e3c 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -21,6 +21,7 @@
#include "camera.h"
#include "device.h"
#include "integrator.h"
+#include "film.h"
#include "light.h"
#include "scene.h"
#include "session.h"
@@ -94,7 +95,7 @@ void BlenderSession::create_session()
session->progress.set_cancel_callback(function_bind(&BlenderSession::test_cancel, this));
/* start rendering */
- session->reset(width, height);
+ session->reset(width, height, session_params.passes);
session->start();
}
@@ -118,30 +119,16 @@ void BlenderSession::render()
void BlenderSession::write_render_result()
{
/* get result */
- DisplayBuffer *display = session->display;
- Device *device = session->device;
-
- if(!display->rgba.device_pointer)
- return;
-
- /* todo: get float buffer */
- device->pixels_copy_from(display->rgba, 0, width, height);
- uchar4 *rgba = (uchar4*)display->rgba.data_pointer;
-
- vector<float4> buffer(width*height);
- float fac = 1.0f/255.0f;
- bool color_management = b_scene.render().use_color_management();
-
- /* normalize */
- for(int i = width*height - 1; i >= 0; i--) {
- uchar4 f = rgba[i];
- float3 rgb = make_float3(f.x, f.y, f.z)*fac;
+ RenderBuffers *buffers = session->buffers;
+ float exposure = scene->film->exposure;
+ double total_time, pass_time;
+ int pass;
+ session->progress.get_pass(pass, total_time, pass_time);
- if(color_management)
- rgb = color_srgb_to_scene_linear(rgb);
+ float4 *pixels = buffers->copy_from_device(exposure, pass);
- buffer[i] = make_float4(rgb.x, rgb.y, rgb.z, 1.0f);
- }
+ if(!pixels)
+ return;
struct RenderResult *rrp = RE_engine_begin_result((RenderEngine*)b_engine.ptr.data, 0, 0, width, height);
PointerRNA rrptr;
@@ -150,9 +137,11 @@ void BlenderSession::write_render_result()
BL::RenderResult::layers_iterator layer;
rr.layers.begin(layer);
- rna_RenderLayer_rect_set(&layer->ptr, (float*)&buffer[0]);
+ rna_RenderLayer_rect_set(&layer->ptr, (float*)pixels);
RE_engine_end_result((RenderEngine*)b_engine.ptr.data, rrp);
+
+ delete [] pixels;
}
void BlenderSession::synchronize()
@@ -168,6 +157,9 @@ void BlenderSession::synchronize()
return;
}
+ /* increase passes, but never decrease */
+ session->set_passes(session_params.passes);
+
/* copy recalc flags, outside of mutex so we can decide to do the real
synchronization at a later time to not block on running updates */
sync->sync_recalc();
@@ -188,7 +180,7 @@ void BlenderSession::synchronize()
/* reset if needed */
if(scene->need_reset())
- session->reset(width, height);
+ session->reset(width, height, session_params.passes);
/* unlock */
session->scene->mutex.unlock();
@@ -225,8 +217,10 @@ bool BlenderSession::draw(int w, int h)
}
/* reset if requested */
- if(reset)
- session->reset(width, height);
+ if(reset) {
+ SessionParams session_params = BlenderSync::get_session_params(b_scene, background);
+ session->reset(width, height, session_params.passes);
+ }
}
/* update status and progress for 3d view draw */
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index db65a7f129e..9024de092b7 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -208,6 +208,10 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node *
node = new BackgroundNode();
break;
}
+ case BL::ShaderNode::type_HOLDOUT: {
+ node = new HoldoutNode();
+ break;
+ }
case BL::ShaderNode::type_BSDF_ANISOTROPIC: {
node = new WardBsdfNode();
break;
@@ -594,6 +598,9 @@ void BlenderSync::sync_world()
shader->tag_update(scene);
}
+ PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
+ background->transparent = get_boolean(cscene, "transparent");
+
if(background->modified(prevbackground))
background->tag_update(scene);
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index a6eeb5ec1ae..ccfc3bb2bf1 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -18,6 +18,7 @@
#include "background.h"
#include "film.h"
+#include "../render/filter.h"
#include "graph.h"
#include "integrator.h"
#include "light.h"
@@ -149,10 +150,18 @@ void BlenderSync::sync_film()
Film prevfilm = *film;
film->exposure = get_float(cscene, "exposure");
- film->response = get_enum_identifier(cscene, "response_curve");
if(film->modified(prevfilm))
film->tag_update(scene);
+
+ Filter *filter = scene->filter;
+ Filter prevfilter = *filter;
+
+ filter->filter_type = (FilterType)RNA_enum_get(&cscene, "filter_type");
+ filter->filter_width = (filter->filter_type == FILTER_BOX)? 1.0f: get_float(cscene, "filter_width");
+
+ if(filter->modified(prevfilter))
+ filter->tag_update(scene);
}
/* Scene Parameters */
@@ -190,11 +199,22 @@ SessionParams BlenderSync::get_session_params(BL::Scene b_scene, bool background
foreach(DeviceType dt, types)
if(dt == dtype)
params.device_type = dtype;
+
+ /* Background */
+ params.background = background;
+
+ /* passes */
+ if(background) {
+ params.passes = get_int(cscene, "passes");
+ }
+ else {
+ params.passes = get_int(cscene, "preview_passes");
+ if(params.passes == 0)
+ params.passes = INT_MAX;
+ }
/* other parameters */
params.threads = b_scene.render().threads();
- params.background = background;
- params.passes = (background)? get_int(cscene, "passes"): INT_MAX;
params.tile_size = get_int(cscene, "debug_tile_size");
params.min_size = get_int(cscene, "debug_min_size");
params.cancel_timeout = get_float(cscene, "debug_cancel_timeout");