diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-03-28 13:07:35 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-03-28 13:07:35 +0400 |
commit | d87995a6b1d03aaa647c9233ca2e6469f2ef7805 (patch) | |
tree | db84209b2664e7f58397f368ba60e086b37ac021 /intern/cycles/blender | |
parent | 33740c5eb56884929b70a394e5b3dc7ceb0cfc91 (diff) |
Cycles: add rendered draw mode option in 3d view header to show the active
render layer rather than the viewport layers.
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 5 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 51 |
3 files changed, 39 insertions, 19 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 86f726f7828..da4de1aeafd 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -74,6 +74,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): description="Pause all viewport preview renders", default=False, ) + cls.preview_active_layer = BoolProperty( + name="Preview Active Layer", + description="Preview active render layer in viewport", + default=False, + ) cls.no_caustics = BoolProperty( name="No Caustics", diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 39f55aafa39..3b78be6c6c9 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -804,7 +804,9 @@ def draw_pause(self, context): if view.viewport_shade == 'RENDERED': cscene = scene.cycles + layername = scene.render.layers.active.name layout.prop(cscene, "preview_pause", icon="PAUSE", text="") + layout.prop(cscene, "preview_active_layer", icon="RENDERLAYERS", text=layername) def get_panels(): diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 9fb2c6e1328..e88f74eea68 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -189,29 +189,42 @@ void BlenderSync::sync_film() void BlenderSync::sync_render_layers(BL::SpaceView3D b_v3d, const char *layer) { + string layername; + + /* 3d view */ if(b_v3d) { - render_layer.scene_layer = get_layer(b_v3d.layers()); - render_layer.layer = render_layer.scene_layer; - render_layer.holdout_layer = 0; - render_layer.material_override = PointerRNA_NULL; + PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); + + if(RNA_boolean_get(&cscene, "preview_active_layer")) { + BL::RenderLayers layers(b_scene.render().ptr); + layername = layers.active().name(); + layer = layername.c_str(); + } + else { + render_layer.scene_layer = get_layer(b_v3d.layers()); + render_layer.layer = render_layer.scene_layer; + render_layer.holdout_layer = 0; + render_layer.material_override = PointerRNA_NULL; + return; + } } - else { - BL::RenderSettings r = b_scene.render(); - BL::RenderSettings::layers_iterator b_rlay; - bool first_layer = true; - - for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) { - if((!layer && first_layer) || (layer && b_rlay->name() == layer)) { - render_layer.name = b_rlay->name(); - render_layer.scene_layer = get_layer(b_scene.layers()); - render_layer.layer = get_layer(b_rlay->layers()); - render_layer.holdout_layer = get_layer(b_rlay->layers_zmask()); - render_layer.layer |= render_layer.holdout_layer; - render_layer.material_override = b_rlay->material_override(); - } - first_layer = false; + /* render layer */ + BL::RenderSettings r = b_scene.render(); + BL::RenderSettings::layers_iterator b_rlay; + bool first_layer = true; + + for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) { + if((!layer && first_layer) || (layer && b_rlay->name() == layer)) { + render_layer.name = b_rlay->name(); + render_layer.scene_layer = get_layer(b_scene.layers()); + render_layer.layer = get_layer(b_rlay->layers()); + render_layer.holdout_layer = get_layer(b_rlay->layers_zmask()); + render_layer.layer |= render_layer.holdout_layer; + render_layer.material_override = b_rlay->material_override(); } + + first_layer = false; } } |