SceneRenderLayer Removal/Refactor
authorDalai Felinto <dfelinto@gmail.com>
Thu, 16 Nov 2017 15:39:25 +0000 (13:39 -0200)
committerDalai Felinto <dfelinto@gmail.com>
Wed, 22 Nov 2017 09:13:33 +0000 (07:13 -0200)
This patch moves all the functionality previously in SceneRenderLayer to SceneLayer.
If we want to rename some of these structs now would be a good time to do it, before they are in SceneLayer.

Everything should be working, though I will test things further tomorrow. Once this is committed depsgraph can get
rid of the workaround added in rna_Main_meshes_new_from_object and finish whatever this patch was preventing from being finished.

This patch also adds a few placeholders for the overrides (samples, ...). These are obviously not working, so some unittests that rely on 'lay', and 'zmask' will fail.

This patch does not addressed the change of moving samples to ViewRender (I have this as a separate patch and needs some separate discussion).

Following next is the individual note of the individual parts that were committed.

Note 1: It is up to Cycles to still get rid of exclude_layer internally.
Note 2: Cycles still need to handle its own doversion for the use_layer_samples cases and

(1) Remove the override as it is
(2) Add a new override (scene.cycles.samples) if scene.cycles.use_layer_samples != IGNORE

Respecting the expected behaviour when scene.cycles.use_layer_samples == BOUNDED.

Note 3: Cycles still need to implement the per-object holdout
(similar to how we do shadow catcher).

Note 4: There are parts of the old (Blender Internal) rendering pipeline that is still
using lay, e.g., in shi->lay.

Honestly it will be easier to purge the entire Blender Internal code away instead of taking things from it bit by bit.

Reviewers: sergey, campbellbarton, brecht

Differential Revision: https://developer.blender.org/D2919

71 files changed:
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/blender_session.cpp
intern/cycles/blender/blender_sync.cpp
intern/cycles/blender/blender_sync.h
release/scripts/addons
release/scripts/addons_contrib
release/scripts/freestyle/modules/parameter_editor.py
release/scripts/startup/bl_operators/clip.py
release/scripts/startup/bl_operators/freestyle.py
release/scripts/startup/bl_ui/properties_freestyle.py
release/scripts/startup/bl_ui/space_node.py
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/BKE_scene.h
source/blender/blenkernel/intern/layer.c
source/blender/blenkernel/intern/library_query.c
source/blender/blenkernel/intern/linestyle.c
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/versioning_280.c
source/blender/blenloader/intern/versioning_defaults.c
source/blender/blenloader/intern/versioning_legacy.c
source/blender/blenloader/intern/writefile.c
source/blender/compositor/nodes/COM_RenderLayersNode.cpp
source/blender/compositor/operations/COM_RenderLayersProg.cpp
source/blender/editors/animation/anim_filter.c
source/blender/editors/render/render_internal.c
source/blender/editors/render/render_opengl.c
source/blender/editors/render/render_shading.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_buttons/buttons_texture.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_outliner/outliner_draw.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_outliner/outliner_tree.c
source/blender/freestyle/CMakeLists.txt
source/blender/freestyle/FRS_freestyle.h
source/blender/freestyle/intern/application/Controller.cpp
source/blender/freestyle/intern/application/Controller.h
source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h
source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
source/blender/freestyle/intern/scene_graph/NodeSceneLayer.cpp [moved from source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.cpp with 83% similarity]
source/blender/freestyle/intern/scene_graph/NodeSceneLayer.h [moved from source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h with 70% similarity]
source/blender/freestyle/intern/scene_graph/SceneHash.cpp
source/blender/freestyle/intern/scene_graph/SceneHash.h
source/blender/freestyle/intern/scene_graph/SceneVisitor.h
source/blender/gpu/GPU_material.h
source/blender/makesdna/DNA_layer_types.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_layer.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_render.c
source/blender/makesrna/intern/rna_scene.c
source/blender/nodes/NOD_composite.h
source/blender/nodes/composite/node_composite_tree.c
source/blender/nodes/composite/nodes/node_composite_image.c
source/blender/render/extern/include/RE_engine.h
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/include/rendercore.h
source/blender/render/intern/include/renderpipeline.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/envmap.c
source/blender/render/intern/source/external_engine.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/render_result.c
source/blender/render/intern/source/rendercore.c
source/blenderplayer/bad_level_call_stubs/stubs.c

index 365184c382d33bef778a4fc6bba34a10ebf50864..aeeabe001e673728ef74828021fd2845c8d887ed 100644 (file)
@@ -1148,15 +1148,15 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
 def update_render_passes(self, context):
     scene = context.scene
     rd = scene.render
-    rl = rd.layers.active
+    rl = scene.render_layers.active
     rl.update_render_passes()
 
 class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
     @classmethod
     def register(cls):
-        bpy.types.SceneRenderLayer.cycles = PointerProperty(
+        bpy.types.SceneLayer.cycles = PointerProperty(
                 name="Cycles SceneRenderLayer Settings",
-                description="Cycles SceneRenderLayer Settings",
+                description="Cycles SceneLayer Settings",
                 type=cls,
                 )
         cls.pass_debug_bvh_traversed_nodes = BoolProperty(
@@ -1280,7 +1280,7 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
 
     @classmethod
     def unregister(cls):
-        del bpy.types.SceneRenderLayer.cycles
+        del bpy.types.SceneLayer.cycles
 
 
 class CyclesCurveSettings(bpy.types.PropertyGroup):
index b125e0af234c803cd62d1d47437e9305aa72698a..b1e13de5e0cf1cab36dd975a39de65438162edcc 100644 (file)
@@ -400,7 +400,7 @@ class CYCLES_RENDER_PT_performance(CyclesButtonsPanel, Panel):
 
         subsub = sub.column()
         subsub.active = not rd.use_save_buffers
-        for rl in rd.layers:
+        for rl in scene.render_layers:
             if rl.cycles.use_denoising:
                 subsub.active = False
         subsub.prop(cscene, "use_progressive_refine")
@@ -436,28 +436,9 @@ class CYCLES_RENDER_PT_layer_options(CyclesButtonsPanel, Panel):
         layout = self.layout
 
         scene = context.scene
-        rd = scene.render
-        rl = rd.layers.active
-
-        split = layout.split()
-
-        col = split.column()
-        col.prop(scene, "layers", text="Scene")
-        col.prop(rl, "layers_exclude", text="Exclude")
-
-        col = split.column()
-        col.prop(rl, "layers", text="Layer")
-        col.prop(rl, "layers_zmask", text="Mask Layer")
-
-        split = layout.split()
+        rl = scene.render_layers.active
 
-        col = split.column()
-        col.label(text="Material:")
-        col.prop(rl, "material_override", text="")
-        col.separator()
-        col.prop(rl, "samples")
-
-        col = split.column()
+        col = layout.column()
         col.prop(rl, "use_sky", "Use Environment")
         col.prop(rl, "use_ao", "Use AO")
         col.prop(rl, "use_solid", "Use Surfaces")
@@ -476,7 +457,7 @@ class CYCLES_RENDER_PT_layer_passes(CyclesButtonsPanel, Panel):
 
         scene = context.scene
         rd = scene.render
-        rl = rd.layers.active
+        rl = scene.render_layers.active
         crl = rl.cycles
 
         split = layout.split()
@@ -592,10 +573,10 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
     bl_options = {'DEFAULT_CLOSED'}
 
     def draw_header(self, context):
-        rd = context.scene.render
-        rl = rd.layers.active
+        scene = context.scene
+        rl = scene.render_layers.active
         crl = rl.cycles
-        cscene = context.scene.cycles
+        cscene = scene.cycles
         layout = self.layout
 
         layout.prop(crl, "use_denoising", text="")
@@ -605,8 +586,7 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
 
         scene = context.scene
         cscene = scene.cycles
-        rd = scene.render
-        rl = rd.layers.active
+        rl = scene.render_layers.active
         crl = rl.cycles
 
         layout.active = crl.use_denoising
@@ -1110,7 +1090,7 @@ class CYCLES_WORLD_PT_mist(CyclesButtonsPanel, Panel):
     def poll(cls, context):
         if CyclesButtonsPanel.poll(context):
             if context.world:
-                for rl in context.scene.render.layers:
+                for rl in context.scene.render_layers:
                     if rl.use_pass_mist:
                         return True
 
index 028690818341008f69dea4dbba9ac76c098fb95b..9b06e11fd88112f98560ca8b3b61bc36bb1cbdc7 100644 (file)
@@ -383,14 +383,13 @@ void BlenderSession::render()
        BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, b_v3d, b_rv3d, scene->camera, width, height);
 
        /* render each layer */
-       BL::RenderSettings r = b_scene.render();
-       BL::RenderSettings::layers_iterator b_layer_iter;
+       BL::Scene::render_layers_iterator b_layer_iter;
        BL::RenderResult::views_iterator b_view_iter;
 
        /* We do some special meta attributes when we only have single layer. */
-       const bool is_single_layer = (r.layers.length() == 1);
+       const bool is_single_layer = (b_scene.render_layers.length() == 1);
 
-       for(r.layers.begin(b_layer_iter); b_layer_iter != r.layers.end(); ++b_layer_iter) {
+       for(b_scene.render_layers.begin(b_layer_iter); b_layer_iter != b_scene.render_layers.end(); ++b_layer_iter) {
                b_rlay_name = b_layer_iter->name();
 
                /* temporary render result to find needed passes and views */
index c5d203070dbd4c89c21880cae094c8e26aa34717..d340435aa93f84d5b389d97d815219f48b1a4b9a 100644 (file)
@@ -382,19 +382,17 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D& b_v3d, const char *layer)
 
        /* 3d view */
        if(b_v3d) {
-               BL::RenderLayers layers(b_scene.render().ptr);
-               layername = layers.active().name();
+               layername = b_scene.render_layers.active().name();
                layer = layername.c_str();
        }
 
        /* render layer */
-       BL::RenderSettings r = b_scene.render();
-       BL::RenderSettings::layers_iterator b_rlay;
+       BL::Scene::render_layers_iterator b_rlay;
        bool first_layer = true;
        uint layer_override = get_layer(b_engine.layer_override());
        uint scene_layers = layer_override ? layer_override : get_layer(b_scene.layers());
 
-       for(r.layers.begin(b_rlay); b_rlay != r.layers.end(); ++b_rlay) {
+       for(b_scene.render_layers.begin(b_rlay); b_rlay != b_scene.render_layers.end(); ++b_rlay) {
                if((!layer && first_layer) || (layer && b_rlay->name() == layer)) {
                        render_layer.name = b_rlay->name();
 
@@ -528,7 +526,7 @@ int BlenderSync::get_denoising_pass(BL::RenderPass& b_pass)
 }
 
 array<Pass> BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
-                                            BL::SceneRenderLayer& b_srlay,
+                                            BL::SceneLayer& b_slay,
                                             const SessionParams &session_params)
 {
        array<Pass> passes;
@@ -551,49 +549,49 @@ array<Pass> BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay,
                        Pass::add(pass_type, passes);
        }
 
-       PointerRNA crp = RNA_pointer_get(&b_srlay.ptr, "cycles");
+       PointerRNA crp = RNA_pointer_get(&b_slay.ptr, "cycles");
        if(get_boolean(crp, "denoising_store_passes") &&
           get_boolean(crp, "use_denoising"))
        {
-               b_engine.add_pass("Denoising Normal",          3, "XYZ", b_srlay.name().c_str());
-               b_engine.add_pass("Denoising Normal Variance", 3, "XYZ", b_srlay.name().c_str());
-               b_engine.add_pass("Denoising Albedo",          3, "RGB", b_srlay.name().c_str());
-               b_engine.add_pass("Denoising Albedo Variance", 3, "RGB", b_srlay.name().c_str());
-               b_engine.add_pass("Denoising Depth",           1, "Z",   b_srlay.name().c_str());
-               b_engine.add_pass("Denoising Depth Variance",  1, "Z",   b_srlay.name().c_str());
-               b_engine.add_pass("Denoising Shadow A",        3, "XYV", b_srlay.name().c_str());
-               b_engine.add_pass("Denoising Shadow B",        3, "XYV", b_srlay.name().c_str());
-               b_engine.add_pass("Denoising Image",           3, "RGB", b_srlay.name().c_str());
-               b_engine.add_pass("Denoising Image Variance",  3, "RGB", b_srlay.name().c_str());
+               b_engine.add_pass("Denoising Normal",          3, "XYZ", b_slay.name().c_str());
+               b_engine.add_pass("Denoising Normal Variance", 3, "XYZ", b_slay.name().c_str());
+               b_engine.add_pass("Denoising Albedo",          3, "RGB", b_slay.name().c_str());
+               b_engine.add_pass("Denoising Albedo Variance", 3, "RGB", b_slay.name().c_str());
+               b_engine.add_pass("Denoising Depth",           1, "Z",   b_slay.name().c_str());
+               b_engine.add_pass("Denoising Depth Variance",  1, "Z",   b_slay.name().c_str());
+               b_engine.add_pass("Denoising Shadow A",        3, "XYV", b_slay.name().c_str());
+               b_engine.add_pass("Denoising Shadow B",        3, "XYV", b_slay.name().c_str());
+               b_engine.add_pass("Denoising Image",           3, "RGB", b_slay.name().c_str());
+               b_engine.add_pass("Denoising Image Variance",  3, "RGB", b_slay.name().c_str());
        }
 #ifdef __KERNEL_DEBUG__
        if(get_boolean(crp, "pass_debug_bvh_traversed_nodes")) {
-               b_engine.add_pass("Debug BVH Traversed Nodes", 1, "X", b_srlay.name().c_str());
+               b_engine.add_pass("Debug BVH Traversed Nodes", 1, "X", b_slay.name().c_str());
                Pass::add(PASS_BVH_TRAVERSED_NODES, passes);
        }
        if(get_boolean(crp, "pass_debug_bvh_traversed_instances")) {
-               b_engine.add_pass("Debug BVH Traversed Instances", 1, "X", b_srlay.name().c_str());
+               b_engine.add_pass("Debug BVH Traversed Instances", 1, "X", b_slay.name().c_str());
                Pass::add(PASS_BVH_TRAVERSED_INSTANCES, passes);
        }
        if(get_boolean(crp, "pass_debug_bvh_intersections")) {
-               b_engine.add_pass("Debug BVH Intersections", 1, "X", b_srlay.name().c_str());
+               b_engine.add_pass("Debug BVH Intersections", 1, "X", b_slay.name().c_str());
                Pass::add(PASS_BVH_INTERSECTIONS, passes);
        }
        if(get_boolean(crp, "pass_debug_ray_bounces")) {
-               b_engine.add_pass("Debug Ray Bounces", 1, "X", b_srlay.name().c_str());
+               b_engine.add_pass("Debug Ray Bounces", 1, "X", b_slay.name().c_str());
                Pass::add(PASS_RAY_BOUNCES, passes);
        }
 #endif
        if(get_boolean(crp, "pass_debug_render_time")) {
-               b_engine.add_pass("Debug Render Time", 1, "X", b_srlay.name().c_str());
+               b_engine.add_pass("Debug Render Time", 1, "X", b_slay.name().c_str());
                Pass::add(PASS_RENDER_TIME, passes);
        }
        if(get_boolean(crp, "use_pass_volume_direct")) {
-               b_engine.add_pass("VolumeDir", 3, "RGB", b_srlay.name().c_str());
+               b_engine.add_pass("VolumeDir", 3, "RGB", b_slay.name().c_str());
                Pass::add(PASS_VOLUME_DIRECT, passes);
        }
        if(get_boolean(crp, "use_pass_volume_indirect")) {
-               b_engine.add_pass("VolumeInd", 3, "RGB", b_srlay.name().c_str());
+               b_engine.add_pass("VolumeInd", 3, "RGB", b_slay.name().c_str());
                Pass::add(PASS_VOLUME_INDIRECT, passes);
        }
 
@@ -822,8 +820,8 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
                                    !b_r.use_save_buffers();
 
        if(params.progressive_refine) {
-               BL::RenderSettings::layers_iterator b_rlay;
-               for(b_r.layers.begin(b_rlay); b_rlay != b_r.layers.end(); ++b_rlay) {
+               BL::Scene::render_layers_iterator b_rlay;
+               for(b_scene.render_layers.begin(b_rlay); b_rlay != b_scene.render_layers.end(); ++b_rlay) {
                        PointerRNA crl = RNA_pointer_get(&b_rlay->ptr, "cycles");
                        if(get_boolean(crl, "use_denoising")) {
                                params.progressive_refine = false;
index 79c0b006f9f591bca3692267ac2edfa9e4738344..d262adb13fed358fe26aaf5c0989c813fa827bbd 100644 (file)
@@ -69,7 +69,7 @@ public:
                       const char *layer = 0);
        void sync_render_layers(BL::SpaceView3D& b_v3d, const char *layer);
        array<Pass> sync_render_passes(BL::RenderLayer& b_rlay,
-                                      BL::SceneRenderLayer& b_srlay,
+                                      BL::SceneLayer& b_slay,
                                       const SessionParams &session_params);
        void sync_integrator();
        void sync_camera(BL::RenderSettings& b_render,
index 5b02e6e1acc4c3cf4822607ab33f48d7cffecbd3..371960484a38fc64e0a2635170a41a0d8ab2f6bd 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 5b02e6e1acc4c3cf4822607ab33f48d7cffecbd3
+Subproject commit 371960484a38fc64e0a2635170a41a0d8ab2f6bd
index c3991195ad6eac741db27dc9e8905efb224f219d..a8515cfdfe9a98127b592f36fcbe51b7e23b969a 160000 (submodule)
@@ -1 +1 @@
-Subproject commit c3991195ad6eac741db27dc9e8905efb224f219d
+Subproject commit a8515cfdfe9a98127b592f36fcbe51b7e23b969a
index 7e8d87bb46523bc6713fc74b281cdc5953ab8477..e5fc83b07edc25834101df46fa470d08e70f068d 100644 (file)
@@ -1206,7 +1206,7 @@ integration_types = {
 # main function for parameter processing
 def process(layer_name, lineset_name):
     scene = getCurrentScene()
-    layer = scene.render.layers[layer_name]
+    layer = scene.render_layers[layer_name]
     lineset = layer.freestyle_settings.linesets[lineset_name]
     linestyle = lineset.linestyle
 
index d648ec83b7c99ba8db049a1005d4117df9c661f2..f39dc1a8b08cbe3e183e19a9610b241a33d57e90 100644 (file)
@@ -613,22 +613,22 @@ class CLIP_OT_setup_tracking_scene(Operator):
     @staticmethod
     def _setupRenderLayers(context):
         scene = context.scene
-        rlayers = scene.render.layers
+        rlayers = scene.render_layers
 
-        if not scene.render.layers.get("Foreground"):
+        if not scene.render_layers.get("Foreground"):
             if len(rlayers) == 1:
                 fg = rlayers[0]
                 fg.name = 'Foreground'
             else:
-                fg = scene.render.layers.new("Foreground")
+                fg = scene.render_layers.new("Foreground")
 
             fg.use_sky = True
             fg.layers = [True] + [False] * 19
             fg.layers_zmask = [False] * 10 + [True] + [False] * 9
             fg.use_pass_vector = True
 
-        if not scene.render.layers.get("Background"):
-            bg = scene.render.layers.new("Background")
+        if not scene.render_layers.get("Background"):
+            bg = scene.render_layers.new("Background")
             bg.use_pass_shadow = True
             bg.use_pass_ambient_occlusion = True
             bg.layers = [False] * 10 + [True] + [False] * 9
@@ -940,8 +940,8 @@ class CLIP_OT_setup_tracking_scene(Operator):
     def _setupObjects(self, context):
         scene = context.scene
 
-        fg = scene.render.layers.get("Foreground")
-        bg = scene.render.layers.get("Background")
+        fg = scene.render_layers.get("Foreground")
+        bg = scene.render_layers.get("Background")
 
         all_layers = self._mergeLayers(fg.layers, bg.layers)
 
index 4cee1abf15f7f0829a985756e580552eeb352aa9..d13b427e28dc929d3bc70994740746625fa7e837 100644 (file)
@@ -47,14 +47,14 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator):
 
     @classmethod
     def poll(cls, context):
-        rl = context.scene.render.layers.active
+        rl = context.scene.render_layers.active
         return rl and rl.freestyle_settings.linesets.active
 
     def execute(self, context):
         import sys
 
         scene = context.scene
-        rl = scene.render.layers.active
+        rl = scene.render_layers.active
         lineset = rl.freestyle_settings.linesets.active
         linestyle = lineset.linestyle
         # Find the modifier to work on
@@ -207,7 +207,7 @@ class SCENE_OT_freestyle_module_open(bpy.types.Operator):
 
     @classmethod
     def poll(cls, context):
-        rl = context.scene.render.layers.active
+        rl = context.scene.render_layers.active
         return rl and rl.freestyle_settings.mode == 'SCRIPT'
 
     def invoke(self, context, event):
index ddc5c1643d00770f16b9ec31597f8d21c6c56e9d..5d1d6d3dbac823637f2dc520f452797508bc7840 100644 (file)
@@ -75,7 +75,7 @@ class RenderLayerFreestyleButtonsPanel:
         with_freestyle = bpy.app.build_options.freestyle
 
         return (scene and with_freestyle and rd.use_freestyle and
-                rd.layers.active and(scene.view_render.engine in cls.COMPAT_ENGINES))
+                scene.render_layers.active and(scene.view_render.engine in cls.COMPAT_ENGINES))
 
 
 class RenderLayerFreestyleEditorButtonsPanel(RenderLayerFreestyleButtonsPanel):
@@ -85,7 +85,7 @@ class RenderLayerFreestyleEditorButtonsPanel(RenderLayerFreestyleButtonsPanel):
     def poll(cls, context):
         if not super().poll(context):
             return False
-        rl = context.scene.render.layers.active
+        rl = context.scene.render_layers.active
         return rl and rl.freestyle_settings.mode == 'EDITOR'
 
 
@@ -116,8 +116,8 @@ class RENDERLAYER_PT_freestyle(RenderLayerFreestyleButtonsPanel, Panel):
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render
-        rl = rd.layers.active
+        scene = context.scene
+        rl = scene.render_layers.active
         freestyle = rl.freestyle_settings
 
         layout.active = rl.use_freestyle
@@ -187,7 +187,7 @@ class RENDERLAYER_PT_freestyle_lineset(RenderLayerFreestyleEditorButtonsPanel, P
         rd = scene.render
         view_render = scene.view_render
 
-        rl = rd.layers.active
+        rl = scene.render_layers.active
         freestyle = rl.freestyle_settings
         lineset = freestyle.linesets.active
 
@@ -379,7 +379,7 @@ class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel,
                 row = box.row(align=True)
                 row.prop(modifier, "curvature_min")
                 row.prop(modifier, "curvature_max")
-                freestyle = context.scene.render.layers.active.freestyle_settings
+                freestyle = context.scene.render_layers.active.freestyle_settings
                 if not freestyle.use_smoothness:
                     message = "Enable Face Smoothness to use this modifier"
                     self.draw_modifier_box_error(col.box(), modifier, message)
@@ -434,7 +434,7 @@ class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel,
                 row = box.row(align=True)
                 row.prop(modifier, "curvature_min")
                 row.prop(modifier, "curvature_max")
-                freestyle = context.scene.render.layers.active.freestyle_settings
+                freestyle = context.scene.render_layers.active.freestyle_settings
                 if not freestyle.use_smoothness:
                     message = "Enable Face Smoothness to use this modifier"
                     self.draw_modifier_box_error(col.box(), modifier, message)
@@ -506,7 +506,7 @@ class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel,
                 row = box.row(align=True)
                 row.prop(modifier, "curvature_min")
                 row.prop(modifier, "curvature_max")
-                freestyle = context.scene.render.layers.active.freestyle_settings
+                freestyle = context.scene.render_layers.active.freestyle_settings
                 if not freestyle.use_smoothness:
                     message = "Enable Face Smoothness to use this modifier"
                     self.draw_modifier_box_error(col.box(), modifier, message)
@@ -614,8 +614,8 @@ class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel,
     def draw(self, context):
         layout = self.layout
 
-        rd = context.scene.render
-        rl = rd.layers.active
+        scene = context.scene
+        rl = scene.render_layers.active
         lineset = rl.freestyle_settings.linesets.active
 
         layout.active = rl.use_freestyle
index 200fc415f8a74ad2871780060242f489985af8e5..612ac8e4c40fa8809700d4fde213c2f5813090bc 100644 (file)
@@ -81,7 +81,7 @@ class NODE_HT_header(Header):
                     row.prop(snode_id, "use_nodes")
 
             if use_shading_nodes and snode.shader_type == 'LINESTYLE':
-                rl = context.scene.render.layers.active
+                rl = context.scene.render_layers.active
                 lineset = rl.freestyle_settings.linesets.active
                 if lineset is not None:
                     row = layout.row()
index 7a770006e98c766942a7ebb7c0cc5e1f44ee6d9a..83bcad0d7991f3b7fd8321a40784de18bc2a1503 100644 (file)
@@ -988,7 +988,7 @@ void ntreeCompositTagRender(struct Scene *sce);
 int ntreeCompositTagAnimated(struct bNodeTree *ntree);
 void ntreeCompositTagGenerators(struct bNodeTree *ntree);
 void ntreeCompositUpdateRLayers(struct bNodeTree *ntree);
-void ntreeCompositRegisterPass(struct bNodeTree *ntree, struct Scene *scene, struct SceneRenderLayer *srl, const char *name, int type);
+void ntreeCompositRegisterPass(struct bNodeTree *ntree, struct Scene *scene, struct SceneLayer *scene_layer, const char *name, int type);
 void ntreeCompositClearTags(struct bNodeTree *ntree);
 
 struct bNodeSocket *ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, struct bNode *node,
index 0062a0a1932195d3ae12783043e419921bb8fee3..2b8278547a40a9184c461d80f30a372b10874c19 100644 (file)
@@ -43,8 +43,6 @@ struct EvaluationContext;
 struct Main;
 struct Object;
 struct RenderData;
-struct SceneLayer;
-struct SceneRenderLayer;
 struct Scene;
 struct SceneCollection;
 struct SceneLayer;
@@ -150,9 +148,6 @@ void BKE_scene_graph_update_for_newframe(struct EvaluationContext *eval_ctx,
                                          struct Scene *scene,
                                          struct SceneLayer *scene_layer);
 
-struct SceneRenderLayer *BKE_scene_add_render_layer(struct Scene *sce, const char *name);
-bool BKE_scene_remove_render_layer(struct Main *main, struct Scene *scene, struct SceneRenderLayer *srl);
-
 struct SceneRenderView *BKE_scene_add_render_view(struct Scene *sce, const char *name);
 bool BKE_scene_remove_render_view(struct Scene *scene, struct SceneRenderView *srv);
 
index 59da7c84b457f8538ba06f1972a61bd6393d28fd..39938f819ef3f0ab682068f565f558d848c8f0b1 100644 (file)
@@ -33,6 +33,7 @@
 #include "BLT_translation.h"
 
 #include "BKE_collection.h"
+#include "BKE_freestyle.h"
 #include "BKE_global.h"
 #include "BKE_idprop.h"
 #include "BKE_layer.h"
@@ -113,7 +114,7 @@ SceneLayer *BKE_scene_layer_add(Scene *scene, const char *name)
 
        IDPropertyTemplate val = {0};
        SceneLayer *sl = MEM_callocN(sizeof(SceneLayer), "Scene Layer");
-       sl->flag |= SCENE_LAYER_RENDER;
+       sl->flag = SCENE_LAYER_RENDER | SCENE_LAYER_FREESTYLE;
 
        sl->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
        layer_engine_settings_init(sl->properties, false);
@@ -127,6 +128,12 @@ SceneLayer *BKE_scene_layer_add(Scene *scene, const char *name)
        SceneCollection *sc = BKE_collection_master(scene);
        layer_collection_add(sl, NULL, sc);
 
+       /* Pure rendering pipeline settings. */
+       sl->layflag = 0x7FFF;   /* solid ztra halo edge strand */
+       sl->passflag = SCE_PASS_COMBINED | SCE_PASS_Z;
+       sl->pass_alpha_threshold = 0.5f;
+       BKE_freestyle_config_init(&sl->freestyle_config);
+
        return sl;
 }
 
@@ -172,6 +179,13 @@ void BKE_scene_layer_free(SceneLayer *sl)
 
        MEM_SAFE_FREE(sl->stats);
 
+       BKE_freestyle_config_free(&sl->freestyle_config);
+
+       if (sl->id_properties) {
+               IDP_FreeProperty(sl->id_properties);
+               MEM_freeN(sl->id_properties);
+       }
+
        MEM_freeN(sl);
 }
 
index b6f1b6529e9a067cc52f683cbc598f1a5e847672..d83cd2392fd7098bca3f9317365133aa9190c85d 100644 (file)
@@ -407,7 +407,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
                        {
                                Scene *scene = (Scene *) id;
                                ToolSettings *toolsett = scene->toolsettings;
-                               SceneRenderLayer *srl;
 
                                CALLBACK_INVOKE(scene->camera, IDWALK_CB_NOP);
                                CALLBACK_INVOKE(scene->world, IDWALK_CB_USER);
@@ -421,25 +420,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
                                 * since basact is just a pointer to one of those items. */
                                CALLBACK_INVOKE(scene->obedit, IDWALK_CB_NOP);
 
-                               for (srl = scene->r.layers.first; srl; srl = srl->next) {
-                                       FreestyleModuleConfig *fmc;
-                                       FreestyleLineSet *fls;
-
-                                       for (fmc = srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) {
-                                               if (fmc->script) {
-                                                       CALLBACK_INVOKE(fmc->script, IDWALK_CB_NOP);
-                                               }
-                                       }
-                                       for (fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) {
-                                               if (fls->group) {
-                                                       CALLBACK_INVOKE(fls->group, IDWALK_CB_USER);
-                                               }
-                                               if (fls->linestyle) {
-                                                       CALLBACK_INVOKE(fls->linestyle, IDWALK_CB_USER);
-                                               }
-                                       }
-                               }
-
                                if (scene->ed) {
                                        Sequence *seq;
                                        SEQP_BEGIN(scene->ed, seq)
@@ -471,11 +451,27 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
                                }
                                FOREACH_SCENE_COLLECTION_END
 
-                               SceneLayer *sl;
-                               for (sl = scene->render_layers.first; sl; sl = sl->next) {
-                                       for (Base *base = sl->object_bases.first; base; base = base->next) {
+                               SceneLayer *scene_layer;
+                               for (scene_layer = scene->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
+                                       for (Base *base = scene_layer->object_bases.first; base; base = base->next) {
                                                CALLBACK_INVOKE(base->object, IDWALK_NOP);
                                        }
+
+                                       for (FreestyleModuleConfig  *fmc = scene_layer->freestyle_config.modules.first; fmc; fmc = fmc->next) {
+                                               if (fmc->script) {
+                                                       CALLBACK_INVOKE(fmc->script, IDWALK_CB_NOP);
+                                               }
+                                       }
+
+                                       for (FreestyleLineSet *fls = scene_layer->freestyle_config.linesets.first; fls; fls = fls->next) {
+                                               if (fls->group) {
+                                                       CALLBACK_INVOKE(fls->group, IDWALK_CB_USER);
+                                               }
+
+                                               if (fls->linestyle) {
+                                                       CALLBACK_INVOKE(fls->linestyle, IDWALK_CB_USER);
+                                               }
+                                       }
                                }
 
                                for (TimeMarker *marker = scene->markers.first; marker; marker = marker->next) {
index b9131e961b927216b1dd7773c5bab3adfc77b594..c82c002ebb14379058bd164526c5d118f35198d7 100644 (file)
@@ -215,9 +215,9 @@ void BKE_linestyle_make_local(struct Main *bmain, FreestyleLineStyle *linestyle,
 
 FreestyleLineStyle *BKE_linestyle_active_from_scene(Scene *scene)
 {
-       SceneRenderLayer *actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-       if (actsrl) {
-               FreestyleConfig *config = &actsrl->freestyleConfig;
+       SceneLayer *active_render_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+       if (active_render_layer) {
+               FreestyleConfig *config = &active_render_layer->freestyle_config;
                FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
                if (lineset) {
                        return lineset->linestyle;
index 383b55ab1ad5de146e1485e3017953dde59ca7af..e231fd53fe32ae418ad3fee9f2944c504a7db248 100644 (file)
@@ -252,28 +252,33 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
 
        IDPropertyTemplate val = {0};
        BLI_duplicatelist(&sce_dst->render_layers, &sce_src->render_layers);
-       for (SceneLayer *sl_src = sce_src->render_layers.first, *sl_dst = sce_dst->render_layers.first;
-            sl_src;
-            sl_src = sl_src->next, sl_dst = sl_dst->next)
+       for (SceneLayer *scene_layer_src = sce_src->render_layers.first, *scene_layer_dst = sce_dst->render_layers.first;
+            scene_layer_src;
+            scene_layer_src = scene_layer_src->next, scene_layer_dst = scene_layer_dst->next)
        {
-               sl_dst->stats = NULL;
-               sl_dst->properties_evaluated = NULL;
-               sl_dst->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
-               IDP_MergeGroup_ex(sl_dst->properties, sl_src->properties, true, flag_subdata);
+               if (scene_layer_dst->id_properties != NULL) {
+                       scene_layer_dst->id_properties = IDP_CopyProperty_ex(scene_layer_dst->id_properties, flag_subdata);
+               }
+               BKE_freestyle_config_copy(&scene_layer_dst->freestyle_config, &scene_layer_src->freestyle_config, flag_subdata);
+
+               scene_layer_dst->stats = NULL;
+               scene_layer_dst->properties_evaluated = NULL;
+               scene_layer_dst->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
+               IDP_MergeGroup_ex(scene_layer_dst->properties, scene_layer_src->properties, true, flag_subdata);
 
                /* we start fresh with no overrides and no visibility flags set
                 * instead of syncing both trees we simply unlink and relink the scene collection */
-               BLI_listbase_clear(&sl_dst->layer_collections);
-               BLI_listbase_clear(&sl_dst->object_bases);
-               BLI_listbase_clear(&sl_dst->drawdata);
+               BLI_listbase_clear(&scene_layer_dst->layer_collections);
+               BLI_listbase_clear(&scene_layer_dst->object_bases);
+               BLI_listbase_clear(&scene_layer_dst->drawdata);
 
-               layer_collections_recreate(sl_dst, &sl_src->layer_collections, mc_dst, mc_src);
+               layer_collections_recreate(scene_layer_dst, &scene_layer_src->layer_collections, mc_dst, mc_src);
 
                /* Now we handle the syncing for visibility, selectability, ... */
-               layer_collections_sync_flags(&sl_dst->layer_collections, &sl_src->layer_collections);
+               layer_collections_sync_flags(&scene_layer_dst->layer_collections, &scene_layer_src->layer_collections);
 
-               Object *active_ob = OBACT(sl_src);
-               for (Base *base_src = sl_src->object_bases.first, *base_dst = sl_dst->object_bases.first;
+               Object *active_ob = OBACT(scene_layer_src);
+               for (Base *base_src = scene_layer_src->object_bases.first, *base_dst = scene_layer_dst->object_bases.first;
                     base_src;
                     base_src = base_src->next, base_dst = base_dst->next)
                {
@@ -281,7 +286,7 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
                        base_dst->flag_legacy = base_src->flag_legacy;
 
                        if (base_dst->object == active_ob) {
-                               sl_dst->basact = base_dst;
+                               scene_layer_dst->basact = base_dst;
                        }
                }
        }
@@ -296,7 +301,6 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
        }
 
        BLI_duplicatelist(&(sce_dst->markers), &(sce_src->markers));
-       BLI_duplicatelist(&(sce_dst->r.layers), &(sce_src->r.layers));
        BLI_duplicatelist(&(sce_dst->r.views), &(sce_src->r.views));
        BKE_keyingsets_copy(&(sce_dst->keyingsets), &(sce_src->keyingsets));
 
@@ -311,17 +315,6 @@ void BKE_scene_copy_data(Main *bmain, Scene *sce_dst, const Scene *sce_src, cons
                sce_dst->rigidbody_world = BKE_rigidbody_world_copy(sce_src->rigidbody_world, flag_subdata);
        }
 
-       /* copy Freestyle settings */
-       for (SceneRenderLayer *srl_dst = sce_dst->r.layers.first, *srl_src = sce_src->r.layers.first;
-            srl_src;
-            srl_dst = srl_dst->next, srl_src = srl_src->next)
-       {
-               if (srl_dst->prop != NULL) {
-                       srl_dst->prop = IDP_CopyProperty_ex(srl_dst->prop, flag_subdata);
-               }
-               BKE_freestyle_config_copy(&srl_dst->freestyleConfig, &srl_src->freestyleConfig, flag_subdata);
-       }
-
        /* copy color management settings */
        BKE_color_managed_display_settings_copy(&sce_dst->display_settings, &sce_src->display_settings);
        BKE_color_managed_view_settings_copy(&sce_dst->view_settings, &sce_src->view_settings);
@@ -410,16 +403,14 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
         * But for now, let's keep it well isolated here. */
        if (type == SCE_COPY_EMPTY) {
                ToolSettings *ts;
-               ListBase rl, rv;
+               ListBase rv;
 
                sce_copy = BKE_scene_add(bmain, sce->id.name + 2);
 
-               rl = sce_copy->r.layers;
                rv = sce_copy->r.views;
                curvemapping_free_data(&sce_copy->r.mblur_shutter_curve);
                sce_copy->r = sce->r;
-               sce_copy->r.layers = rl;
-               sce_copy->r.actlay = 0;
+               sce_copy->active_layer = 0;
                sce_copy->r.views = rv;
                sce_copy->unit = sce->unit;
                sce_copy->physics_settings = sce->physics_settings;
@@ -517,8 +508,8 @@ Scene *BKE_scene_copy(Main *bmain, Scene *sce, int type)
 
                if (type == SCE_COPY_FULL) {
                        /* Copy Freestyle LineStyle datablocks. */
-                       for (SceneRenderLayer *srl_dst = sce_copy->r.layers.first; srl_dst; srl_dst = srl_dst->next) {
-                               for (FreestyleLineSet *lineset = srl_dst->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
+                       for (SceneLayer *scene_layer_dst = sce_copy->render_layers.first; scene_layer_dst; scene_layer_dst = scene_layer_dst->next) {
+                               for (FreestyleLineSet *lineset = scene_layer_dst->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
                                        if (lineset->linestyle) {
                                                /* XXX Not copying anim/actions here? */
                                                BKE_id_copy_ex(bmain, (ID *)lineset->linestyle, (ID **)&lineset->linestyle, 0, false);
@@ -572,8 +563,6 @@ void BKE_scene_make_local(Main *bmain, Scene *sce, const bool lib_local)
 /** Free (or release) any data used by this scene (does not free the scene itself). */
 void BKE_scene_free_ex(Scene *sce, const bool do_id_user)
 {
-       SceneRenderLayer *srl;
-
        BKE_animdata_free((ID *)sce, false);
 
        /* check all sequences */
@@ -606,16 +595,7 @@ void BKE_scene_free_ex(Scene *sce, const bool do_id_user)
                sce->r.ffcodecdata.properties = NULL;
        }
 
-       for (srl = sce->r.layers.first; srl; srl = srl->next) {
-               if (srl->prop != NULL) {
-                       IDP_FreeProperty(srl->prop);
-                       MEM_freeN(srl->prop);
-               }
-               BKE_freestyle_config_free(&srl->freestyleConfig);
-       }
-
        BLI_freelistN(&sce->markers);
-       BLI_freelistN(&sce->r.layers);
        BLI_freelistN(&sce->r.views);
        
        if (sce->toolsettings) {
@@ -907,7 +887,6 @@ void BKE_scene_init(Scene *sce)
        sce->r.osa = 8;
 
        /* note; in header_info.c the scene copy happens..., if you add more to renderdata it has to be checked there */
-       BKE_scene_add_render_layer(sce, NULL);
 
        /* multiview - stereo */
        BKE_scene_add_render_view(sce, STEREO_LEFT_NAME);
@@ -1618,64 +1597,6 @@ void BKE_scene_graph_update_for_newframe(EvaluationContext *eval_ctx,
        DEG_ids_clear_recalc(bmain);
 }
 
-/* return default layer, also used to patch old files */
-SceneRenderLayer *BKE_scene_add_render_layer(Scene *sce, const char *name)
-{
-       SceneRenderLayer *srl;
-
-       if (!name)
-               name = DATA_("RenderLayer");
-
-       srl = MEM_callocN(sizeof(SceneRenderLayer), "new render layer");
-       BLI_strncpy(srl->name, name, sizeof(srl->name));
-       BLI_uniquename(&sce->r.layers, srl, DATA_("RenderLayer"), '.', offsetof(SceneRenderLayer, name), sizeof(srl->name));
-       BLI_addtail(&sce->r.layers, srl);
-
-       /* note, this is also in render, pipeline.c, to make layer when scenedata doesnt have it */
-       srl->layflag = 0x7FFF;   /* solid ztra halo edge strand */
-       srl->passflag = SCE_PASS_COMBINED | SCE_PASS_Z;
-       srl->pass_alpha_threshold = 0.5f;
-       BKE_freestyle_config_init(&srl->freestyleConfig);
-
-       return srl;
-}
-
-bool BKE_scene_remove_render_layer(Main *bmain, Scene *scene, SceneRenderLayer *srl)
-{
-       const int act = BLI_findindex(&scene->r.layers, srl);
-       Scene *sce;
-
-       if (act == -1) {
-               return false;
-       }
-       else if ( (scene->r.layers.first == scene->r.layers.last) &&
-                 (scene->r.layers.first == srl))
-       {
-               /* ensure 1 layer is kept */
-               return false;
-       }
-
-       BKE_freestyle_config_free(&srl->freestyleConfig);
-
-       if (srl->prop) {
-               IDP_FreeProperty(srl->prop);
-               MEM_freeN(srl->prop);
-       }
-
-       BLI_remlink(&scene->r.layers, srl);
-       MEM_freeN(srl);
-
-       scene->r.actlay = 0;
-
-       for (sce = bmain->scene.first; sce; sce = sce->id.next) {
-               if (sce->nodetree) {
-                       BKE_nodetree_remove_layer_n(sce->nodetree, scene, act);
-               }
-       }
-
-       return true;
-}
-
 /* return default view */
 SceneRenderView *BKE_scene_add_render_view(Scene *sce, const char *name)
 {
index 4dbc93bc20b25b037344f901c1a359d120e79a64..5cc58ff58436fab53b42d8455174450faecff0eb 100644 (file)
@@ -5935,6 +5935,16 @@ static void lib_link_scene(FileData *fd, Main *main)
                        for (SceneLayer *scene_layer = sce->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
                                /* tag scene layer to update for collection tree evaluation */
                                scene_layer->flag |= SCENE_LAYER_ENGINE_DIRTY;
+
+                               for (FreestyleModuleConfig *fmc = scene_layer->freestyle_config.modules.first; fmc; fmc = fmc->next) {
+                                       fmc->script = newlibadr(fd, sce->id.lib, fmc->script);
+                               }
+
+                               for (FreestyleLineSet *fls = scene_layer->freestyle_config.linesets.first; fls; fls = fls->next) {
+                                       fls->linestyle = newlibadr_us(fd, sce->id.lib, fls->linestyle);
+                                       fls->group = newlibadr_us(fd, sce->id.lib, fls->group);
+                               }
+
                                for (Base *base = scene_layer->object_bases.first; base; base = base->next) {
                                        /* we only bump the use count for the collection objects */
                                        base->object = newlibadr(fd, sce->id.lib, base->object);
@@ -6305,11 +6315,7 @@ static void direct_link_scene(FileData *fd, Scene *sce, Main *bmain)
        for (srl = sce->r.layers.first; srl; srl = srl->next) {
                srl->prop = newdataadr(fd, srl->prop);
                IDP_DirectLinkGroup_OrFree(&srl->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
-       }
-       for (srl = sce->r.layers.first; srl; srl = srl->next) {
                link_list(fd, &(srl->freestyleConfig.modules));
-       }
-       for (srl = sce->r.layers.first; srl; srl = srl->next) {
                link_list(fd, &(srl->freestyleConfig.linesets));
        }
        
@@ -6369,6 +6375,12 @@ static void direct_link_scene(FileData *fd, Scene *sce, Main *bmain)
                        BKE_scene_layer_engine_settings_validate_layer(scene_layer);
                }
 
+               scene_layer->id_properties = newdataadr(fd, scene_layer->id_properties);
+               IDP_DirectLinkGroup_OrFree(&scene_layer->id_properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
+
+               link_list(fd, &(scene_layer->freestyle_config.modules));
+               link_list(fd, &(scene_layer->freestyle_config.linesets));
+
                scene_layer->properties_evaluated = NULL;
 
                BLI_listbase_clear(&scene_layer->drawdata);
@@ -9810,7 +9822,22 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
                        expand_doit(fd, mainvar, lineset->linestyle);
                }
        }
-       
+
+       for (SceneLayer *scene_layer = sce->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
+               for (module = scene_layer->freestyle_config.modules.first; module; module = module->next) {
+                       if (module->script) {
+                               expand_doit(fd, mainvar, module->script);
+                       }
+               }
+
+               for (lineset = scene_layer->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
+                       if (lineset->group) {
+                               expand_doit(fd, mainvar, lineset->group);
+                       }
+                       expand_doit(fd, mainvar, lineset->linestyle);
+               }
+       }
+
        if (sce->r.dometext)
                expand_doit(fd, mainvar, sce->gm.dome.warptext);
        
index fa48abaf61e0f18c698d64b357edb02c332de8b2..b261935c09e795be72273bb0661e7f8154dfb7d5 100644 (file)
@@ -51,6 +51,7 @@
 
 #include "BKE_collection.h"
 #include "BKE_customdata.h"
+#include "BKE_freestyle.h"
 #include "BKE_idprop.h"
 #include "BKE_layer.h"
 #include "BKE_main.h"
@@ -324,6 +325,25 @@ void do_versions_after_linking_280(Main *main)
                                                                    (ID *)srl->mat_override);
                                                }
 
+                                               if (srl->layflag & SCE_LAY_DISABLE) {
+                                                       scene_layer->flag &= ~SCENE_LAYER_RENDER;
+                                               }
+
+                                               if ((srl->layflag & SCE_LAY_FRS) == 0) {
+                                                       scene_layer->flag &= ~SCENE_LAYER_FREESTYLE;
+                                               }
+
+                                               /* XXX If we are to keep layflag it should be merged with flag (dfelinto). */
+                                               scene_layer->layflag = srl->layflag;
+                                               /* XXX Not sure if we should keep the passes (dfelinto). */
+                                               scene_layer->passflag = srl->passflag;
+                                               scene_layer->pass_xor = srl->pass_xor;
+                                               scene_layer->pass_alpha_threshold = srl->pass_alpha_threshold;
+
+                                               BKE_freestyle_config_free(&scene_layer->freestyle_config);
+                                               scene_layer->freestyle_config = srl->freestyleConfig;
+                                               scene_layer->id_properties = srl->prop;
+
                                                /* unlink master collection  */
                                                BKE_collection_unlink(scene_layer, scene_layer->layer_collections.first);
 
@@ -383,14 +403,22 @@ void do_versions_after_linking_280(Main *main)
                                                                base->flag |= BASE_SELECTED;
                                                        }
                                                }
-
-                                               /* TODO: passes, samples, mask_layesr, exclude, ... */
                                        }
 
                                        if (BLI_findlink(&scene->render_layers, scene->r.actlay)) {
                                                scene->active_layer = scene->r.actlay;
                                        }
                                }
+                               else {
+                                       for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) {
+                                               if (srl->prop) {
+                                                       IDP_FreeProperty(srl->prop);
+                                                       MEM_freeN(srl->prop);
+                                               }
+                                               BKE_freestyle_config_free(&srl->freestyleConfig);
+                                       }
+                               }
+                               BLI_freelistN(&scene->r.layers);
 
                                SceneLayer *scene_layer = BKE_scene_layer_add(scene, "Viewport");
 
@@ -441,8 +469,6 @@ void do_versions_after_linking_280(Main *main)
                                        base->lay = base->object->lay;
                                }
 
-                               /* TODO: copy scene render data to layer */
-
                                /* Fallback name if only one layer was found in the original file */
                                if (BLI_listbase_count_ex(&sc_master->scene_collections, 2) == 1) {
                                        BKE_collection_rename(scene, sc_master->scene_collections.first, "Default Collection");
@@ -697,4 +723,19 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
                        }
                }
        }
+
+       {
+               if (!DNA_struct_elem_find(fd->filesdna, "SceneLayer", "FreestyleConfig", "freestyle_config")) {
+                       for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+                               SceneLayer *scene_layer;
+                               for (scene_layer = scene->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
+                                       scene_layer->flag |= SCENE_LAYER_FREESTYLE;
+                                       scene_layer->layflag = 0x7FFF;   /* solid ztra halo edge strand */
+                                       scene_layer->passflag = SCE_PASS_COMBINED | SCE_PASS_Z;
+                                       scene_layer->pass_alpha_threshold = 0.5f;
+                                       BKE_freestyle_config_init(&scene_layer->freestyle_config);
+                               }
+                       }
+               }
+       }
 }
index 925a87cb653232a7e96460e7fcd7e54d7dabd570..910a3c28286bd6e5e3589955836ffa19d3b3b9c3 100644 (file)
@@ -127,9 +127,9 @@ void BLO_update_defaults_startup_blend(Main *bmain)
                scene->r.im_format.planes = R_IMF_PLANES_RGBA;
                scene->r.im_format.compress = 15;
 
-               for (SceneRenderLayer *srl = scene->r.layers.first; srl; srl = srl->next) {
-                       srl->freestyleConfig.sphere_radius = 0.1f;
-                       srl->pass_alpha_threshold = 0.5f;
+               for (SceneLayer *scene_layer = scene->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
+                       scene_layer->freestyle_config.sphere_radius = 0.1f;
+                       scene_layer->pass_alpha_threshold = 0.5f;
                }
 
                if (scene->toolsettings) {
index 44b8ec780e8b073f58aeb157e34c9788ea74a6dc..79ae203df097b30e27655b98516e2fd1b9bae9eb 100644 (file)
@@ -2145,18 +2145,16 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
                        if (sce->r.yparts < 2)
                                sce->r.yparts = 4;
 
-                       /* adds default layer */
-                       if (BLI_listbase_is_empty(&sce->r.layers)) {
-                               BKE_scene_add_render_layer(sce, NULL);
-                       }
-                       else {
-                               SceneRenderLayer *srl;
-                               /* new layer flag for sky, was default for solid */
-                               for (srl = sce->r.layers.first; srl; srl = srl->next) {
-                                       if (srl->layflag & SCE_LAY_SOLID)
-                                               srl->layflag |= SCE_LAY_SKY;
-                                       srl->passflag &= (SCE_PASS_COMBINED|SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR);
-                               }
+                       /* We don't add default layer since blender2.8 because the layers
+                        * are now in Scene->render_layers and a default layer is created in
+                        * the doversion later on.
+                        */
+                       SceneRenderLayer *srl;
+                       /* new layer flag for sky, was default for solid */
+                       for (srl = sce->r.layers.first; srl; srl = srl->next) {
+                               if (srl->layflag & SCE_LAY_SOLID)
+                                       srl->layflag |= SCE_LAY_SKY;
+                               srl->passflag &= (SCE_PASS_COMBINED|SCE_PASS_Z|SCE_PASS_NORMAL|SCE_PASS_VECTOR);
                        }
 
                        /* node version changes */
index 8751b5804133353fc1f124fbc41ae53bb21fd059..172c5384f15b94b0e77f4aed933632c46b55607c 100644 (file)
@@ -2748,19 +2748,6 @@ static void write_scene(WriteData *wd, Scene *sce)
                writestruct(wd, DATA, TimeMarker, 1, marker);
        }
 
-       for (SceneRenderLayer *srl = sce->r.layers.first; srl; srl = srl->next) {
-               writestruct(wd, DATA, SceneRenderLayer, 1, srl);
-               if (srl->prop) {
-                       IDP_WriteProperty(srl->prop, wd);
-               }
-               for (FreestyleModuleConfig *fmc = srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) {
-                       writestruct(wd, DATA, FreestyleModuleConfig, 1, fmc);
-               }
-               for (FreestyleLineSet *fls = srl->freestyleConfig.linesets.first; fls; fls = fls->next) {
-                       writestruct(wd, DATA, FreestyleLineSet, 1, fls);
-               }
-       }
-
        /* writing MultiView to the blend file */
        for (SceneRenderView *srv = sce->r.views.first; srv; srv = srv->next) {
                writestruct(wd, DATA, SceneRenderView, 1, srv);
@@ -2787,9 +2774,23 @@ static void write_scene(WriteData *wd, Scene *sce)
        for (SceneLayer *scene_layer = sce->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
                writestruct(wd, DATA, SceneLayer, 1, scene_layer);
                writelist(wd, DATA, Base, &scene_layer->object_bases);
+
                if (scene_layer->properties) {
                        IDP_WriteProperty(scene_layer->properties, wd);
                }
+
+               if (scene_layer->id_properties) {
+                       IDP_WriteProperty(scene_layer->id_properties, wd);
+               }
+
+               for (FreestyleModuleConfig *fmc = scene_layer->freestyle_config.modules.first; fmc; fmc = fmc->next) {
+                       writestruct(wd, DATA, FreestyleModuleConfig, 1, fmc);
+               }
+
+               for (FreestyleLineSet *fls = scene_layer->freestyle_config.linesets.first; fls; fls = fls->next) {
+                       writestruct(wd, DATA, FreestyleLineSet, 1, fls);
+               }
+
                write_layer_collections(wd, &scene_layer->layer_collections);
        }
 
index 2286db81860274f2bc7bc7a987d87f2a93ac3871..d1bb8462aa1fd6733d3332a0fd3c22a74ee2c8a5 100644 (file)
@@ -65,12 +65,12 @@ void RenderLayersNode::testRenderLink(NodeConverter &converter,
                missingRenderLink(converter);
                return;
        }
-       SceneRenderLayer *srl = (SceneRenderLayer *)BLI_findlink(&scene->r.layers, layerId);
-       if (srl == NULL) {
+       SceneLayer *scene_layer = (SceneLayer *)BLI_findlink(&scene->render_layers, layerId);
+       if (scene_layer == NULL) {
                missingRenderLink(converter);
                return;
        }
-       RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
+       RenderLayer *rl = RE_GetRenderLayer(rr, scene_layer->name);
        if (rl == NULL) {
                missingRenderLink(converter);
                return;
index d1c654ddb6c9b53648301c060f4b9f315079b4ac..eec05f582f0be15567a8f1e48c4966c7ebf5ca15 100644 (file)
@@ -55,10 +55,10 @@ void RenderLayersProg::initExecution()
                rr = RE_AcquireResultRead(re);
        
        if (rr) {
-               SceneRenderLayer *srl = (SceneRenderLayer *)BLI_findlink(&scene->r.layers, getLayerId());
-               if (srl) {
+               SceneLayer *scene_layer = (SceneLayer *)BLI_findlink(&scene->render_layers, getLayerId());
+               if (scene_layer) {
 
-                       RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
+                       RenderLayer *rl = RE_GetRenderLayer(rr, scene_layer->name);
                        if (rl) {
                                this->m_inputBuffer = RE_RenderLayerGetPass(rl, this->m_passName.c_str(), this->m_viewName);
                        }
@@ -189,9 +189,9 @@ void RenderLayersProg::determineResolution(unsigned int resolution[2], unsigned
                rr = RE_AcquireResultRead(re);
        
        if (rr) {
-               SceneRenderLayer *srl   = (SceneRenderLayer *)BLI_findlink(&sce->r.layers, getLayerId());
-               if (srl) {
-                       RenderLayer *rl = RE_GetRenderLayer(rr, srl->name);
+               SceneLayer *scene_layer   = (SceneLayer *)BLI_findlink(&sce->render_layers, getLayerId());
+               if (scene_layer) {
+                       RenderLayer *rl = RE_GetRenderLayer(rr, scene_layer->name);
                        if (rl) {
                                resolution[0] = rl->rectx;
                                resolution[1] = rl->recty;
index 63c700c6eeab8fdd83e9047ad8fb5e885f0ff902..f5eadeab92ab15d67674db9805e2005bb046695e 100644 (file)
@@ -1958,25 +1958,26 @@ static size_t animdata_filter_ds_nodetree(bAnimContext *ac, ListBase *anim_data,
 
 static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Scene *sce, int filter_mode)
 {
-       SceneRenderLayer *srl;
+       SceneLayer *scene_layer;
        FreestyleLineSet *lineset;
        size_t items = 0;
        
-       for (srl = sce->r.layers.first; srl; srl = srl->next) {
-               for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
+       for (scene_layer = sce->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
+               for (lineset = scene_layer->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
                        if (lineset->linestyle) {
                                lineset->linestyle->id.tag |= LIB_TAG_DOIT;
                        }
                }
        }
        
-       for (srl = sce->r.layers.first; srl; srl = srl->next) {
+       for (scene_layer = sce->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
                /* skip render layers without Freestyle enabled */
-               if (!(srl->layflag & SCE_LAY_FRS))
+               if ((scene_layer->flag & SCENE_LAYER_FREESTYLE) == 0) {
                        continue;
-               
+               }
+
                /* loop over linesets defined in the render layer */
-               for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
+               for (lineset = scene_layer->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
                        FreestyleLineStyle *linestyle = lineset->linestyle;
                        ListBase tmp_data = {NULL, NULL};
                        size_t tmp_items = 0;
index 3f2951b2a3ee8c1c889c380fcca25a7ab1ecd6c1..701227091b3e06fa1c5ce0c131390d58cf3936de 100644 (file)
@@ -108,7 +108,6 @@ typedef struct RenderJob {
         */
        Depsgraph *depsgraph;
        Render *re;
-       SceneRenderLayer *srl;
        struct Object *camera_override;
        int lay_override;
        bool v3d_override;
@@ -261,7 +260,7 @@ static void image_buffer_rect_update(RenderJob *rj, RenderResult *rr, ImBuf *ibu
 /* set callbacks, exported to sequence render too.
  * Only call in foreground (UI) renders. */
 
-static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **scene, SceneRenderLayer **srl)
+static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **scene, SceneLayer **scene_layer)
 {
        /* single layer re-render */
        if (RNA_struct_property_is_set(op->ptr, "scene")) {
@@ -281,14 +280,14 @@ static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **s
        }
 
        if (RNA_struct_property_is_set(op->ptr, "layer")) {
-               SceneRenderLayer *rl;
+               SceneLayer *rl;
                char rl_name[RE_MAXNAME];
 
                RNA_string_get(op->ptr, "layer", rl_name);
-               rl = (SceneRenderLayer *)BLI_findstring(&(*scene)->r.layers, rl_name, offsetof(SceneRenderLayer, name));
+               rl = (SceneLayer *)BLI_findstring(&(*scene)->render_layers, rl_name, offsetof(SceneLayer, name));
                
                if (rl)
-                       *srl = rl;
+                       *scene_layer = rl;
        }
 }
 
@@ -296,9 +295,8 @@ static void screen_render_scene_layer_set(wmOperator *op, Main *mainp, Scene **s
 static int screen_render_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneLayer *scene_layer = CTX_data_scene_layer(C);
+       SceneLayer *scene_layer = NULL;
        Depsgraph *depsgraph = CTX_data_depsgraph(C);
-       SceneRenderLayer *srl = NULL;
        Render *re;
        Image *ima;
        View3D *v3d = CTX_wm_view3d(C);
@@ -309,7 +307,10 @@ static int screen_render_exec(bContext *C, wmOperator *op)
        struct Object *camera_override = v3d ? V3D_CAMERA_LOCAL(v3d) : NULL;
 
        /* custom scene and single layer re-render */
-       screen_render_scene_layer_set(op, mainp, &scene, &srl);
+       screen_render_scene_layer_set(op, mainp, &scene, &scene_layer);
+       if (scene_layer == NULL) {
+               scene_layer = CTX_data_scene_layer(C);
+       }
 
        if (!is_animation && is_write_still && BKE_imtype_is_movie(scene->r.im_format.imtype)) {
                BKE_report(op->reports, RPT_ERROR, "Cannot write a single file with an animation format selected");
@@ -339,7 +340,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
        if (is_animation)
                RE_BlenderAnim(re, mainp, scene, camera_override, lay_override, scene->r.sfra, scene->r.efra, scene->r.frame_step);
        else
-               RE_BlenderFrame(re, mainp, scene, srl, camera_override, lay_override, scene->r.cfra, is_write_still);
+               RE_BlenderFrame(re, mainp, scene, scene_layer, camera_override, lay_override, scene->r.cfra, is_write_still);
        BLI_end_threaded_malloc();
 
        RE_SetReports(re, NULL);
@@ -616,7 +617,7 @@ static void render_startjob(void *rjv, short *stop, short *do_update, float *pro
        if (rj->anim)
                RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay_override, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step);
        else
-               RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->camera_override, rj->lay_override, rj->scene->r.cfra, rj->write_still);
+               RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->scene_layer, rj->camera_override, rj->lay_override, rj->scene->r.cfra, rj->write_still);
 
        RE_SetReports(rj->re, NULL);
 }
@@ -669,7 +670,7 @@ static void render_endjob(void *rjv)
        /* potentially set by caller */
        rj->scene->r.scemode &= ~R_NO_FRAME_UPDATE;
        
-       if (rj->srl) {
+       if (rj->scene_layer) {
                nodeUpdateID(rj->scene->nodetree, &rj->scene->id);
                WM_main_add_notifier(NC_NODE | NA_EDITED, rj->scene);
        }
@@ -699,7 +700,7 @@ static void render_endjob(void *rjv)
         * engine API, so lets use simple and robust way for now
         *                                          - sergey -
         */
-       if (rj->scene->r.layers.first != rj->scene->r.layers.last ||
+       if (rj->scene->render_layers.first != rj->scene->render_layers.last ||
            rj->image_outdated)
        {
                void *lock;
@@ -844,8 +845,8 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even
 {
        /* new render clears all callbacks */
        Main *mainp;
+       SceneLayer *scene_layer = NULL;
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = NULL;
        Render *re;
        wmJob *wm_job;
        RenderJob *rj;
@@ -912,7 +913,10 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even
        jobflag = WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS;
        
        /* custom scene and single layer re-render */
-       screen_render_scene_layer_set(op, mainp, &scene, &srl);
+       screen_render_scene_layer_set(op, mainp, &scene, &scene_layer);
+       if (scene_layer == NULL) {
+               scene_layer = CTX_data_scene_layer(C);
+       }
 
        if (RNA_struct_property_is_set(op->ptr, "layer"))
                jobflag |= WM_JOB_SUSPEND;
@@ -922,10 +926,9 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even
        rj->main = mainp;
        rj->scene = scene;
        rj->current_scene = rj->scene;
-       rj->scene_layer = CTX_data_scene_layer(C);
+       rj->scene_layer = scene_layer;
        /* TODO(sergey): Render engine should be using own depsgraph. */
        rj->depsgraph = CTX_data_depsgraph(C);
-       rj->srl = srl;
        rj->camera_override = camera_override;
        rj->lay_override = 0;
        rj->anim = is_animation;
@@ -1283,10 +1286,10 @@ static void render_view3d_startjob(void *customdata, short *stop, short *do_upda
                /* initalize always */
                if (use_border) {
                        rdata.mode |= R_BORDER;
-                       RE_InitState(re, NULL, &rdata, &rp->scene->view_render, NULL, rp->ar->winx, rp->ar->winy, &cliprct);
+                       RE_InitState(re, NULL, &rdata, &rp->scene->render_layers, rp->scene->active_layer, &rp->scene->view_render, NULL, rp->ar->winx, rp->ar->winy, &cliprct);
                }
                else
-                       RE_InitState(re, NULL, &rdata, &rp->scene->view_render, NULL, rp->ar->winx, rp->ar->winy, NULL);
+                       RE_InitState(re, NULL, &rdata, &rp->scene->render_layers, rp->scene->active_layer, &rp->scene->view_render, NULL, rp->ar->winx, rp->ar->winy, NULL);
        }
 
        if (orth)
index d436c562f1920a89a8b60592fbdc413e51fbb829..e0193a0caea81e7543f037df574b60c098155599 100644 (file)
@@ -715,7 +715,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
        oglrender->iuser.ok = 1;
 
        /* create render result */
-       RE_InitState(oglrender->re, NULL, &scene->r, view_render, NULL, sizex, sizey, NULL);
+       RE_InitState(oglrender->re, NULL, &scene->r, &scene->render_layers, scene->active_layer, view_render, NULL, sizex, sizey, NULL);
 
        /* create render views */
        screen_opengl_views_setup(oglrender);
index 323b17797a0aae2dca2fffd5aba88ea82cf8c24d..a98751176fcdb93d2c835b7378bad4a2ec5a3715 100644 (file)
@@ -772,9 +772,9 @@ static int freestyle_active_module_poll(bContext *C)
 static int freestyle_module_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
 
-       BKE_freestyle_module_add(&srl->freestyleConfig);
+       BKE_freestyle_module_add(&scene_layer->freestyle_config);
 
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
 
@@ -798,11 +798,11 @@ void SCENE_OT_freestyle_module_add(wmOperatorType *ot)
 static int freestyle_module_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
        PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
        FreestyleModuleConfig *module = ptr.data;
 
-       BKE_freestyle_module_delete(&srl->freestyleConfig, module);
+       BKE_freestyle_module_delete(&scene_layer->freestyle_config, module);
 
        DEG_id_tag_update(&scene->id, 0);
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
@@ -828,12 +828,12 @@ void SCENE_OT_freestyle_module_remove(wmOperatorType *ot)
 static int freestyle_module_move_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
        PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings);
        FreestyleModuleConfig *module = ptr.data;
        int dir = RNA_enum_get(op->ptr, "direction");
 
-       if (BKE_freestyle_module_move(&srl->freestyleConfig, module, dir)) {
+       if (BKE_freestyle_module_move(&scene_layer->freestyle_config, module, dir)) {
                DEG_id_tag_update(&scene->id, 0);
                WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
        }
@@ -870,9 +870,9 @@ static int freestyle_lineset_add_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Main *bmain = CTX_data_main(C);
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
 
-       BKE_freestyle_lineset_add(bmain, &srl->freestyleConfig, NULL);
+       BKE_freestyle_lineset_add(bmain, &scene_layer->freestyle_config, NULL);
 
        DEG_id_tag_update(&scene->id, 0);
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
@@ -897,21 +897,21 @@ void SCENE_OT_freestyle_lineset_add(wmOperatorType *ot)
 static int freestyle_active_lineset_poll(bContext *C)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
 
-       if (!srl) {
+       if (!scene_layer) {
                return false;
        }
 
-       return BKE_freestyle_lineset_get_active(&srl->freestyleConfig) != NULL;
+       return BKE_freestyle_lineset_get_active(&scene_layer->freestyle_config) != NULL;
 }
 
 static int freestyle_lineset_copy_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
 
-       FRS_copy_active_lineset(&srl->freestyleConfig);
+       FRS_copy_active_lineset(&scene_layer->freestyle_config);
 
        return OPERATOR_FINISHED;
 }
@@ -934,9 +934,9 @@ void SCENE_OT_freestyle_lineset_copy(wmOperatorType *ot)
 static int freestyle_lineset_paste_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
 
-       FRS_paste_active_lineset(&srl->freestyleConfig);
+       FRS_paste_active_lineset(&scene_layer->freestyle_config);
 
        DEG_id_tag_update(&scene->id, 0);
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
@@ -962,9 +962,9 @@ void SCENE_OT_freestyle_lineset_paste(wmOperatorType *ot)
 static int freestyle_lineset_remove_exec(bContext *C, wmOperator *UNUSED(op))
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
 
-       FRS_delete_active_lineset(&srl->freestyleConfig);
+       FRS_delete_active_lineset(&scene_layer->freestyle_config);
 
        DEG_id_tag_update(&scene->id, 0);
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
@@ -990,10 +990,10 @@ void SCENE_OT_freestyle_lineset_remove(wmOperatorType *ot)
 static int freestyle_lineset_move_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
        int dir = RNA_enum_get(op->ptr, "direction");
 
-       if (FRS_move_active_lineset(&srl->freestyleConfig, dir)) {
+       if (FRS_move_active_lineset(&scene_layer->freestyle_config, dir)) {
                DEG_id_tag_update(&scene->id, 0);
                WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
        }
@@ -1030,8 +1030,8 @@ static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op)
 {
        Main *bmain = CTX_data_main(C);
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&scene_layer->freestyle_config);
 
        if (!lineset) {
                BKE_report(op->reports, RPT_ERROR, "No active lineset to add a new line style to");
@@ -1068,8 +1068,8 @@ void SCENE_OT_freestyle_linestyle_new(wmOperatorType *ot)
 static int freestyle_color_modifier_add_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&scene_layer->freestyle_config);
        int type = RNA_enum_get(op->ptr, "type");
 
        if (!freestyle_linestyle_check_report(lineset, op->reports)) {
@@ -1108,8 +1108,8 @@ void SCENE_OT_freestyle_color_modifier_add(wmOperatorType *ot)
 static int freestyle_alpha_modifier_add_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&scene_layer->freestyle_config);
        int type = RNA_enum_get(op->ptr, "type");
 
        if (!freestyle_linestyle_check_report(lineset, op->reports)) {
@@ -1148,8 +1148,8 @@ void SCENE_OT_freestyle_alpha_modifier_add(wmOperatorType *ot)
 static int freestyle_thickness_modifier_add_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&scene_layer->freestyle_config);
        int type = RNA_enum_get(op->ptr, "type");
 
        if (!freestyle_linestyle_check_report(lineset, op->reports)) {
@@ -1188,8 +1188,8 @@ void SCENE_OT_freestyle_thickness_modifier_add(wmOperatorType *ot)
 static int freestyle_geometry_modifier_add_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&scene_layer->freestyle_config);
        int type = RNA_enum_get(op->ptr, "type");
 
        if (!freestyle_linestyle_check_report(lineset, op->reports)) {
@@ -1241,8 +1241,8 @@ static int freestyle_get_modifier_type(PointerRNA *ptr)
 static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&scene_layer->freestyle_config);
        PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
        LineStyleModifier *modifier = ptr.data;
 
@@ -1291,8 +1291,8 @@ void SCENE_OT_freestyle_modifier_remove(wmOperatorType *ot)
 static int freestyle_modifier_copy_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&scene_layer->freestyle_config);
        PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
        LineStyleModifier *modifier = ptr.data;
 
@@ -1341,8 +1341,8 @@ void SCENE_OT_freestyle_modifier_copy(wmOperatorType *ot)
 static int freestyle_modifier_move_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&srl->freestyleConfig);
+       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+       FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(&scene_layer->freestyle_config);
        PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier);
        LineStyleModifier *modifier = ptr.data;
        int dir = RNA_enum_get(op->ptr, "direction");
index 8aa4e674d11b0db44f25d8132bffa99eadfacb02..392efd03ee16c34987bdda7e52d7235aa17fc3c2 100644 (file)
@@ -561,7 +561,7 @@ static int buttons_context_path_texture(const bContext *C, ButsContextPath *path
 static bool buttons_context_linestyle_pinnable(const bContext *C)
 {
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *actsrl;
+       SceneLayer *active_scene_layer;
        FreestyleConfig *config;
        SpaceButs *sbuts;
 
@@ -570,8 +570,8 @@ static bool buttons_context_linestyle_pinnable(const bContext *C)
                return false;
        }
        /* if Freestyle is not in the Parameter Editor mode */
-       actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-       config = &actsrl->freestyleConfig;
+       active_scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+       config = &active_scene_layer->freestyle_config;
        if (config->mode != FREESTYLE_CONTROL_EDITOR_MODE) {
                return false;
        }
index ed2a256912e882bfe4807dadd3ed547c051e41aa..8a23c762b8cd6977146e9e9ab0d0d9572ed05ef7 100644 (file)
@@ -109,14 +109,14 @@ bool ED_texture_context_check_linestyle(const bContext *C)
 {
 #ifdef WITH_FREESTYLE
        Scene *scene = CTX_data_scene(C);
-       SceneRenderLayer *actsrl;
+       SceneLayer *active_render_layer;
        FreestyleConfig *config;
        FreestyleLineSet *lineset;
        FreestyleLineStyle *linestyle;
 
        if (scene && (scene->r.mode & R_EDGE_FRS)) {
-               actsrl = BLI_findlink(&scene->r.layers, scene->r.actlay);
-               config = &actsrl->freestyleConfig;
+               active_render_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
+               config = &active_render_layer->freestyle_config;
                if (config->mode == FREESTYLE_CONTROL_EDITOR_MODE) {
                        lineset = BKE_freestyle_lineset_get_active(config);
                        if (lineset) {
index a9bc58661a0e8a2d6a34b43d8f05816526875477..5a682338eee05b20dd9ea65bd44511eea14c70c8 100644 (file)
@@ -700,12 +700,12 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node)
                                for (scene = bmain->scene.first; scene; scene = scene->id.next) {
                                        if (scene->nodetree && scene->use_nodes && ntreeHasTree(scene->nodetree, ntree)) {
                                                if (node->id == NULL || node->id == (ID *)scene) {
-                                                       int num_layers = BLI_listbase_count(&scene->r.layers);
-                                                       scene->r.actlay = node->custom1;
+                                                       int num_layers = BLI_listbase_count(&scene->render_layers);
+                                                       scene->active_layer = node->custom1;
                                                        /* Clamp the value, because it might have come from a different
                                                         * scene which could have more render layers than new one.
                                                         */
-                                                       scene->r.actlay = min_ff(scene->r.actlay, num_layers - 1);
+                                                       scene->active_layer = min_ff(scene->active_layer, num_layers - 1);
                                                }
                                        }
                                }
@@ -1366,13 +1366,13 @@ int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op))
                }
        }
        if (node) {
-               SceneRenderLayer *srl = BLI_findlink(&sce->r.layers, node->custom1);
+               SceneLayer *scene_layer = BLI_findlink(&sce->render_layers, node->custom1);
                
-               if (srl) {
+               if (scene_layer) {
                        PointerRNA op_ptr;
                        
                        WM_operator_properties_create(&op_ptr, "RENDER_OT_render");
-                       RNA_string_set(&op_ptr, "layer", srl->name);
+                       RNA_string_set(&op_ptr, "layer", scene_layer->name);
                        RNA_string_set(&op_ptr, "scene", sce->id.name + 2);
                        
                        /* to keep keypositions */
index 79fded307822b3a625dc462aea99f854fae7d183..c9e2a040af40a28e9da96ee1698d403853bd388f 100644 (file)
@@ -464,7 +464,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
                        if (tselem->type == TSE_R_LAYER) {
                                UI_block_emboss_set(block, UI_EMBOSS_NONE);
                                
-                               bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT - 1,
+                               bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, SCENE_LAYER_RENDER, 0, ICON_CHECKBOX_HLT - 1,
                                                      (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
                                                      UI_UNIT_Y, te->directdata, 0, 0, 0, 0, TIP_("Render this RenderLayer"));
                                UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
index 670be7611e4f277834be278b9e4de5746e089f18..f2aec1cfa52a182849892822146ee39125c9c27c 100644 (file)
@@ -85,11 +85,11 @@ static eOLDrawState tree_element_active_renderlayer(
        sce = (Scene *)tselem->id;
        
        if (set != OL_SETSEL_NONE) {
-               sce->r.actlay = tselem->nr;
+               sce->active_layer = tselem->nr;
                WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, sce);
        }
        else {
-               return sce->r.actlay == tselem->nr;
+               return sce->active_layer == tselem->nr;
        }
        return OL_DRAWSEL_NONE;
 }
index 8c17522103d66b52f1b204e8e234f84b8ed447b8..eda4faab93f14c33f4252c1241dfb1a1ea712075 100644 (file)
@@ -234,7 +234,7 @@ static void outliner_add_bone(SpaceOops *soops, ListBase *lb, ID *id, Bone *curB
 
 #define LOG2I(x) (int)(log(x) / M_LN2)
 
-static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, SceneRenderLayer *srl)
+static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, SceneLayer *scene_layer)
 {
        TreeStoreElem *tselem = NULL;
        TreeElement *te = NULL;
@@ -244,7 +244,7 @@ static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, Sc
        
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_COMBINED));
        te->name = IFACE_("Combined");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
        
        /* save cpu cycles, but we add the first to invoke an open/close triangle */
        tselem = TREESTORE(tenla);
@@ -253,71 +253,71 @@ static void outliner_add_passes(SpaceOops *soops, TreeElement *tenla, ID *id, Sc
        
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_Z));
        te->name = IFACE_("Z");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_VECTOR));
        te->name = IFACE_("Vector");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_NORMAL));
        te->name = IFACE_("Normal");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_UV));
        te->name = IFACE_("UV");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_MIST));
        te->name = IFACE_("Mist");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXOB));
        te->name = IFACE_("Index Object");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDEXMA));
        te->name = IFACE_("Index Material");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_RGBA));
        te->name = IFACE_("Color");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_DIFFUSE));
        te->name = IFACE_("Diffuse");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SPEC));
        te->name = IFACE_("Specular");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_SHADOW));
        te->name = IFACE_("Shadow");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_AO));
        te->name = IFACE_("AO");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFLECT));
        te->name = IFACE_("Reflection");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_REFRACT));
        te->name = IFACE_("Refraction");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_INDIRECT));
        te->name = IFACE_("Indirect");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_ENVIRONMENT));
        te->name = IFACE_("Environment");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 
        te = outliner_add_element(soops, &tenla->subtree, id, tenla, TSE_R_PASS, LOG2I(SCE_PASS_EMIT));
        te->name = IFACE_("Emit");
-       te->directdata = &srl->passflag;
+       te->directdata = &scene_layer->passflag;
 }
 
 #undef LOG2I
@@ -332,19 +332,19 @@ static bool outliner_animdata_test(AnimData *adt)
 #ifdef WITH_FREESTYLE
 static void outliner_add_line_styles(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
 {
-       SceneRenderLayer *srl;
+       SceneLayer *scene_layer;
        FreestyleLineSet *lineset;
 
-       for (srl = sce->r.layers.first; srl; srl = srl->next) {
-               for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
+       for (scene_layer = sce->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
+               for (lineset = scene_layer->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
                        FreestyleLineStyle *linestyle = lineset->linestyle;
                        if (linestyle) {
                                linestyle->id.tag |= LIB_TAG_DOIT;
                        }
                }
        }
-       for (srl = sce->r.layers.first; srl; srl = srl->next) {
-               for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) {
+       for (scene_layer = sce->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
+               for (lineset = scene_layer->freestyle_config.linesets.first; lineset; lineset = lineset->next) {
                        FreestyleLineStyle *linestyle = lineset->linestyle;
                        if (linestyle) {
                                if (!(linestyle->id.tag & LIB_TAG_DOIT))
@@ -359,16 +359,16 @@ static void outliner_add_line_styles(SpaceOops *soops, ListBase *lb, Scene *sce,
 
 static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *sce, TreeElement *te)
 {
-       SceneRenderLayer *srl;
+       SceneLayer *scene_layer;
        TreeElement *tenla = outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
        int a;
        
        tenla->name = IFACE_("RenderLayers");
-       for (a = 0, srl = sce->r.layers.first; srl; srl = srl->next, a++) {
+       for (a = 0, scene_layer = sce->render_layers.first; scene_layer; scene_layer = scene_layer->next, a++) {
                TreeElement *tenlay = outliner_add_element(soops, &tenla->subtree, sce, te, TSE_R_LAYER, a);
-               tenlay->name = srl->name;
-               tenlay->directdata = &srl->layflag;
-               outliner_add_passes(soops, tenlay, &sce->id, srl);
+               tenlay->name = scene_layer->name;
+               tenlay->directdata = &scene_layer->flag;
+               outliner_add_passes(soops, tenlay, &sce->id, scene_layer);
        }
        
        // TODO: move this to the front?
index 1ae4211aa231128ee2056be711024edec805ee02..6106dfa58b2c5be05046c9f7245a9b71f5268e8c 100644 (file)
@@ -392,8 +392,8 @@ set(SRC
        intern/scene_graph/NodeGroup.h
        intern/scene_graph/NodeLight.cpp
        intern/scene_graph/NodeLight.h
-       intern/scene_graph/NodeSceneRenderLayer.cpp
-       intern/scene_graph/NodeSceneRenderLayer.h
+       intern/scene_graph/NodeSceneLayer.cpp
+       intern/scene_graph/NodeSceneLayer.h
        intern/scene_graph/NodeShape.cpp
        intern/scene_graph/NodeShape.h
        intern/scene_graph/NodeTransform.cpp
index a6382010ca79ef36568e5e2806a8f44bfbdb54b2..4b9e09a9fb780f330f87101014e56f8e314db1dd 100644 (file)
@@ -30,6 +30,7 @@ extern "C" {
 #endif
 
 struct Render;
+struct RenderLayer;
 struct Material;
 struct FreestyleConfig;
 struct FreestyleLineStyle;
@@ -50,13 +51,13 @@ extern struct FreestyleGlobals g_freestyle;
 void FRS_initialize(void);
 void FRS_set_context(struct bContext *C);
 void FRS_read_file(struct bContext *C);
-int FRS_is_freestyle_enabled(struct SceneRenderLayer *srl);
+int FRS_is_freestyle_enabled(struct SceneLayer *scene_layer);
 void FRS_init_stroke_renderer(struct Render *re);
 void FRS_begin_stroke_rendering(struct Render *re);
-struct Render *FRS_do_stroke_rendering(struct Render *re, struct SceneRenderLayer *srl, int render);
+struct Render *FRS_do_stroke_rendering(struct Render *re, struct SceneLayer *scene_layer, int render);
 void FRS_end_stroke_rendering(struct Render *re);
 void FRS_free_view_map_cache(void);
-void FRS_composite_result(struct Render *re, struct SceneRenderLayer *srl, struct Render *freestyle_render);
+void FRS_composite_result(struct Render *re, struct SceneLayer *scene_layer, struct Render *freestyle_render);
 void FRS_exit(void);
 
 /* FreestyleConfig.linesets */
index beb8579822372f15e8daed5550368924942cd84b..9754cf1de9f7452eac10e41bb1092ddf3c1060db 100644 (file)
@@ -40,7 +40,7 @@ extern "C" {
 #include "../scene_graph/NodeDrawingStyle.h"
 #include "../scene_graph/NodeShape.h"
 #include "../scene_graph/NodeTransform.h"
-#include "../scene_graph/NodeSceneRenderLayer.h"
+#include "../scene_graph/NodeSceneLayer.h"
 #include "../scene_graph/ScenePrettyPrinter.h"
 #include "../scene_graph/VertexRep.h"
 
@@ -232,9 +232,9 @@ bool Controller::hitViewMapCache()
        return false;
 }
 
-int Controller::LoadMesh(Render *re, SceneRenderLayer *srl)
+int Controller::LoadMesh(Render *re, SceneLayer *scene_layer)
 {
-       BlenderFileLoader loader(re, srl);
+       BlenderFileLoader loader(re, scene_layer);
 
        loader.setRenderMonitor(_pRenderMonitor);
 
@@ -301,7 +301,7 @@ int Controller::LoadMesh(Render *re, SceneRenderLayer *srl)
                }
                cam->setProjectionMatrix(proj);
                _RootNode->AddChild(cam);
-               _RootNode->AddChild(new NodeSceneRenderLayer(*re->scene, *srl));
+               _RootNode->AddChild(new NodeSceneLayer(*re->scene, *scene_layer));
 
                sceneHashFunc.reset();
                //blenderScene->accept(sceneHashFunc);
index 154edaf1e53deef458679cd3a5abbc8e27d2add1..606c80ada3f9845804308a823d7f291a586b0141 100644 (file)
@@ -68,7 +68,7 @@ public:
        //soc
        void init_options();
 
-       int  LoadMesh(Render *re, SceneRenderLayer *srl);
+       int  LoadMesh(Render *re, SceneLayer *scene_layer);
        int  Load3DSFile(const char *iFileName);
        void CloseFile();
        void ComputeViewMap();
index 35ac31719877d931ee96f960cf2057e491b07300..b20349acfd19e15801d1998e623f73fe0dce3f17 100644 (file)
 
 namespace Freestyle {
 
-BlenderFileLoader::BlenderFileLoader(Render *re, SceneRenderLayer *srl)
+BlenderFileLoader::BlenderFileLoader(Render *re, SceneLayer *scene_layer)
 {
        _re = re;
-       _srl = srl;
+       _scene_layer = scene_layer;
        _Scene = NULL;
        _numFacesRead = 0;
 #if 0
        _minEdgeSize = DBL_MAX;
 #endif
-       _smooth = (srl->freestyleConfig.flags & FREESTYLE_FACE_SMOOTHNESS_FLAG) != 0;
+       _smooth = (scene_layer->freestyle_config.flags & FREESTYLE_FACE_SMOOTHNESS_FLAG) != 0;
        _pRenderMonitor = NULL;
 }
 
index 894f8eeeb4e459bbadae3ca412d78781ff63e8d1..b5530e3af09ae27baa1008cf7b5c9e1ba0194efe 100644 (file)
@@ -78,7 +78,7 @@ class BlenderFileLoader
 {
 public:
        /*! Builds a MaxFileLoader */
-       BlenderFileLoader(Render *re, SceneRenderLayer *srl);
+       BlenderFileLoader(Render *re, SceneLayer *scene_layer);
        virtual ~BlenderFileLoader();
 
        /*! Loads the 3D scene and returns a pointer to the scene root node */
@@ -114,7 +114,7 @@ protected:
                unsigned n;
        };
        Render *_re;
-       SceneRenderLayer *_srl;
+       SceneLayer *_scene_layer;
        NodeGroup *_Scene;
        unsigned _numFacesRead;
 #if 0
index 0424ed4bb164bcc7fe4e51910821739e2b995131..847da8067d5fd3635a733e6ccd76a45b212aee02 100644 (file)
@@ -127,12 +127,9 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str
        BKE_scene_set_background(freestyle_bmain, freestyle_scene);
        DEG_graph_id_tag_update(freestyle_bmain, freestyle_depsgraph, &freestyle_scene->id, 0);
 
-       // Render layer
-       SceneRenderLayer *srl = (SceneRenderLayer *)freestyle_scene->r.layers.first;
-       srl->layflag = SCE_LAY_SOLID | SCE_LAY_ZTRA;
-
        // Scene layer.
        SceneLayer *scene_layer = (SceneLayer *)freestyle_scene->render_layers.first;
+       scene_layer->layflag = SCE_LAY_SOLID | SCE_LAY_ZTRA;
 
        // Camera
        Object *object_camera = BKE_object_add(freestyle_bmain, freestyle_scene, scene_layer, OB_CAMERA, NULL);
index ea22633c50e3d3c63e6fb2201fe7c9d5940d2d37..0baad3f51654123469e3ced768641de622c841b1 100644 (file)
@@ -283,19 +283,19 @@ static bool test_edge_type_conditions(struct edge_type_condition *conditions,
        return true;
 }
 
-static void prepare(Render *re, SceneRenderLayer *srl)
+static void prepare(Render *re, SceneLayer *scene_layer)
 {
        // load mesh
        re->i.infostr = IFACE_("Freestyle: Mesh loading");
        re->stats_draw(re->sdh, &re->i);
        re->i.infostr = NULL;
-       if (controller->LoadMesh(re, srl)) // returns if scene cannot be loaded or if empty
+       if (controller->LoadMesh(re, scene_layer)) // returns if scene cannot be loaded or if empty
                return;
        if (re->test_break(re->tbh))
                return;
 
        // add style modules
-       FreestyleConfig *config = &srl->freestyleConfig;
+       FreestyleConfig *config = &scene_layer->freestyle_config;
 
        if (G.debug & G_DEBUG_FREESTYLE) {
                cout << "\n===  Rendering options  ===" << endl;
@@ -359,7 +359,7 @@ static void prepare(Render *re, SceneRenderLayer *srl)
                                        cout << "  " << layer_count+1 << ": " << lineset->name << " - " <<
                                                (lineset->linestyle ? (lineset->linestyle->id.name + 2) : "<NULL>") << endl;
                                }
-                               char *buffer = create_lineset_handler(srl->name, lineset->name);
+                               char *buffer = create_lineset_handler(scene_layer->name, lineset->name);
                                controller->InsertStyleModule(layer_count, lineset->name, buffer);
                                controller->toggleLayer(layer_count, true);
                                MEM_freeN(buffer);
@@ -445,7 +445,7 @@ static void prepare(Render *re, SceneRenderLayer *srl)
        }
 
        // set diffuse and z depth passes
-       RenderLayer *rl = RE_GetRenderLayer(re->result, srl->name);
+       RenderLayer *rl = RE_GetRenderLayer(re->result, scene_layer->name);
        bool diffuse = false, z = false;
        for (RenderPass *rpass = (RenderPass *)rl->passes.first; rpass; rpass = rpass->next) {
                if (STREQ(rpass->name, RE_PASSNAME_DIFFUSE)) {
@@ -473,7 +473,7 @@ static void prepare(Render *re, SceneRenderLayer *srl)
        controller->ComputeViewMap();
 }
 
-void FRS_composite_result(Render *re, SceneRenderLayer *srl, Render *freestyle_render)
+void FRS_composite_result(Render *re, SceneLayer *scene_layer, Render *freestyle_render)
 {
        RenderLayer *rl;
        float *src, *dest, *pixSrc, *pixDest;
@@ -503,7 +503,7 @@ void FRS_composite_result(Render *re, SceneRenderLayer *srl, Render *freestyle_r
        }
 #endif
 
-       rl = RE_GetRenderLayer(re->result, srl->name);
+       rl = RE_GetRenderLayer(re->result, scene_layer->name);
        if (!rl) {
                if (G.debug & G_DEBUG_FREESTYLE) {
                        cout << "No destination render layer to composite to" << endl;
@@ -536,13 +536,13 @@ void FRS_composite_result(Render *re, SceneRenderLayer *srl, Render *freestyle_r
        }
 }
 
-static int displayed_layer_count(SceneRenderLayer *srl)
+static int displayed_layer_count(SceneLayer *scene_layer)
 {
        int count = 0;
 
-       switch (srl->freestyleConfig.mode) {
+       switch (scene_layer->freestyle_config.mode) {
        case FREESTYLE_CONTROL_SCRIPT_MODE:
-               for (FreestyleModuleConfig *module = (FreestyleModuleConfig *)srl->freestyleConfig.modules.first;
+               for (FreestyleModuleConfig *module = (FreestyleModuleConfig *)scene_layer->freestyle_config.modules.first;
                     module;
                     module = module->next)
                {
@@ -551,7 +551,7 @@ static int displayed_layer_count(SceneRenderLayer *srl)
                }
                break;
        case FREESTYLE_CONTROL_EDITOR_MODE:
-               for (FreestyleLineSet *lineset = (FreestyleLineSet *)srl->freestyleConfig.linesets.first;
+               for (FreestyleLineSet *lineset = (FreestyleLineSet *)scene_layer->freestyle_config.linesets.first;
                     lineset;
                     lineset = lineset->next)
                {
@@ -563,9 +563,11 @@ static int displayed_layer_count(SceneRenderLayer *srl)
        return count;
 }
 
-int FRS_is_freestyle_enabled(SceneRenderLayer *srl)
+int FRS_is_freestyle_enabled(SceneLayer *scene_layer)
 {
-       return (!(srl->layflag & SCE_LAY_DISABLE) && srl->layflag & SCE_LAY_FRS && displayed_layer_count(srl) > 0);
+       return ((scene_layer->flag & SCENE_LAYER_RENDER) &&
+               (scene_layer->flag & SCENE_LAYER_FREESTYLE) &&
+               displayed_layer_count(scene_layer) > 0);
 }
 
 void FRS_init_stroke_renderer(Render *re)
@@ -587,7 +589,7 @@ void FRS_begin_stroke_rendering(Render *re)
        init_camera(re);
 }
 
-Render *FRS_do_stroke_rendering(Render *re, SceneRenderLayer *srl, int render)
+Render *FRS_do_stroke_rendering(Render *re, SceneLayer *scene_layer, int render)
 {
        Render *freestyle_render = NULL;
 
@@ -596,12 +598,12 @@ Render *FRS_do_stroke_rendering(Render *re, SceneRenderLayer *srl, int render)
 
        RenderMonitor monitor(re);
        controller->setRenderMonitor(&monitor);
-       controller->setViewMapCache((srl->freestyleConfig.flags & FREESTYLE_VIEW_MAP_CACHE) ? true : false);
+       controller->setViewMapCache((scene_layer->freestyle_config.flags & FREESTYLE_VIEW_MAP_CACHE) ? true : false);
 
        if (G.debug & G_DEBUG_FREESTYLE) {
                cout << endl;
                cout << "----------------------------------------------------------" << endl;
-               cout << "|  " << (re->scene->id.name + 2) << "|" << srl->name << endl;
+               cout << "|  " << (re->scene->id.name + 2) << "|" << scene_layer->name << endl;
                cout << "----------------------------------------------------------" << endl;
        }
 
@@ -610,7 +612,7 @@ Render *FRS_do_stroke_rendering(Render *re, SceneRenderLayer *srl, int render)
        //   - add style modules
        //   - set parameters
        //   - compute view map
-       prepare(re, srl);
+       prepare(re, scene_layer);
 
        if (re->test_break(re->tbh)) {
                controller->CloseFile();
@@ -635,7 +637,7 @@ Render *FRS_do_stroke_rendering(Render *re, SceneRenderLayer *srl, int render)
 
                        // composite result
                        if (freestyle_render) {
-                               FRS_composite_result(re, srl, freestyle_render);
+                               FRS_composite_result(re, scene_layer, freestyle_render);
                                RE_FreeRenderResult(freestyle_render->result);
                                freestyle_render->result = NULL;
                        }
similarity index 83%
rename from source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.cpp
rename to source/blender/freestyle/intern/scene_graph/NodeSceneLayer.cpp
index 24c56ff4e283b5908e2da786b98d4e2964f024fb..c4beed1dbef28543fb41e0140bae5c07aaf34189 100644 (file)
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.cpp
+/** \file blender/freestyle/intern/scene_graph/NodeSceneLayer.cpp
  *  \ingroup freestyle
  *  \brief Class to represent a scene render layer in Blender.
  */
 
-#include "NodeSceneRenderLayer.h"
+#include "NodeSceneLayer.h"
 
 namespace Freestyle {
 
-void NodeSceneRenderLayer::accept(SceneVisitor& v)
+void NodeSceneLayer::accept(SceneVisitor& v)
 {
-       v.visitNodeSceneRenderLayer(*this);
+       v.visitNodeSceneLayer(*this);
 }
 
 } /* namespace Freestyle */
similarity index 70%
rename from source/blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h
rename to source/blender/freestyle/intern/scene_graph/NodeSceneLayer.h
index 8dc93d84201f9cd72e60c1bfef6676e7075627d8..5b781dff528edcc9e40c11db3a7dd1f1cbe8bc1c 100644 (file)
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef __FREESTYLE_NODE_SCENE_RENDER_LAYER_H__
-#define __FREESTYLE_NODE_SCENE_RENDER_LAYER_H__
+#ifndef __FREESTYLE_NODE_SCENE_LAYER_H__
+#define __FREESTYLE_NODE_SCENE_LAYER_H__
 
-/** \file blender/freestyle/intern/scene_graph/NodeSceneRenderLayer.h
+/** \file blender/freestyle/intern/scene_graph/NodeSceneLayer.h
  *  \ingroup freestyle
  *  \brief Class to represent a scene render layer in Blender.
  */
@@ -36,20 +36,20 @@ using namespace std;
 
 namespace Freestyle {
 
-class NodeSceneRenderLayer : public Node
+class NodeSceneLayer : public Node
 {
 public:
-       inline NodeSceneRenderLayer(Scene& scene, SceneRenderLayer& srl) : Node(), _Scene(scene), _SceneRenderLayer(srl) {}
-       virtual ~NodeSceneRenderLayer() {}
+       inline NodeSceneLayer(Scene& scene, SceneLayer& scene_layer) : Node(), _Scene(scene), _SceneLayer(scene_layer) {}
+       virtual ~NodeSceneLayer() {}
 
        inline struct Scene& scene() const
        {
                return _Scene;
        }
 
-       inline struct SceneRenderLayer& sceneRenderLayer() const
+       inline struct SceneLayer& sceneLayer() const
        {
-               return _SceneRenderLayer;
+               return _SceneLayer;
        }
 
        /*! Accept the corresponding visitor */
@@ -58,9 +58,9 @@ public:
 protected:
 
        Scene& _Scene;
-       SceneRenderLayer& _SceneRenderLayer;
+       SceneLayer& _SceneLayer;
 };
 
 } /* namespace Freestyle */
 
-#endif // __FREESTYLE_NODE_SCENE_RENDER_LAYER_H__
+#endif // __FREESTYLE_NODE_SCENE_LAYER_H__
index 2af02ab57649a15c8bd28a7c9459715b227f42da..5fdf06a5059bf11cc9868c857c629515f5e48f2e 100644 (file)
@@ -35,14 +35,14 @@ string SceneHash::toString()
        return ss.str();
 }
 
-void SceneHash::visitNodeSceneRenderLayer(NodeSceneRenderLayer& node)
+void SceneHash::visitNodeSceneLayer(NodeSceneLayer& node)
 {
        struct RenderData *r = &node.scene().r;
        adler32((unsigned char *)&r->xsch, sizeof(r->xsch));  // resolution_x
        adler32((unsigned char *)&r->ysch, sizeof(r->ysch));  // resolution_y
        adler32((unsigned char *)&r->size, sizeof(r->size));  // resolution_percentage
 
-       struct FreestyleConfig *config = &node.sceneRenderLayer().freestyleConfig;
+       struct FreestyleConfig *config = &node.sceneLayer().freestyle_config;
        adler32((unsigned char *)&config->flags, sizeof(config->flags));
        adler32((unsigned char *)&config->crease_angle, sizeof(config->crease_angle));
        adler32((unsigned char *)&config->sphere_radius, sizeof(config->sphere_radius));
index 9da711673f04d9e61d29148837261f7e44cae67e..b21fcf32fe38ccadebf5420ef0f85badf04ae54e 100644 (file)
@@ -26,7 +26,7 @@
  */
 
 #include "IndexedFaceSet.h"
-#include "NodeSceneRenderLayer.h"
+#include "NodeSceneLayer.h"
 #include "NodeCamera.h"
 #include "SceneVisitor.h"
 
@@ -49,7 +49,7 @@ public:
        virtual ~SceneHash() {}
 
        VISIT_DECL(NodeCamera)
-       VISIT_DECL(NodeSceneRenderLayer)
+       VISIT_DECL(NodeSceneLayer)
        VISIT_DECL(IndexedFaceSet)
 
        string toString();
index 712585c406468be125712c775bcf018d4bd203aa..b27abb3625c94f134503142b5ab3353aceb7fb74 100644 (file)
@@ -56,7 +56,7 @@ class NodeLight;
 class NodeCamera;
 class NodeDrawingStyle;
 class NodeTransform;
-class NodeSceneRenderLayer;
+class NodeSceneLayer;
 
 class Rep;
 class LineRep;
@@ -88,7 +88,7 @@ public:
        VISIT_COMPLETE_DEF(NodeCamera)
        VISIT_COMPLETE_DEF(NodeDrawingStyle)
        VISIT_COMPLETE_DEF(NodeTransform)
-       VISIT_COMPLETE_DEF(NodeSceneRenderLayer)
+       VISIT_COMPLETE_DEF(NodeSceneLayer)
 
        VISIT_COMPLETE_DEF(Rep)
        VISIT_COMPLETE_DEF(LineRep)
index e1b20cefe993a5c8f6267dc5175d9eee41991f7b..698f3ada2a346f8eed64fc1eaf5f591448d2cb56 100644 (file)
@@ -47,7 +47,6 @@ struct ListBase;
 struct Material;
 struct Object;
 struct Scene;
-struct SceneRenderLayer;
 struct GPUVertexAttribs;
 struct GPUNode;
 struct GPUNodeLink;
index 86931401aaed87189a131d11e9f6ae4ae20fd5c4..d78a6af1d11c2a163672b05d36550c6f4bde59d1 100644 (file)
@@ -31,6 +31,7 @@
 extern "C" {
 #endif
 
+#include "DNA_freestyle_types.h"
 #include "DNA_listBase.h"
 
 typedef struct Base {
@@ -84,6 +85,16 @@ typedef struct SceneLayer {
        struct IDProperty *properties;  /* overrides */
        struct IDProperty *properties_evaluated;
 
+       /* Old SceneRenderLayer data. */
+       int layflag;
+       int passflag;                   /* pass_xor has to be after passflag */
+       int pass_xor;
+       float pass_alpha_threshold;
+
+       struct IDProperty *id_properties; /* Equivalent to datablocks ID properties. */
+
+       struct FreestyleConfig freestyle_config;
+
        /* Runtime data */
        ListBase drawdata;    /* SceneLayerEngineData */
 } SceneLayer;
@@ -120,6 +131,7 @@ enum {
 enum {
        SCENE_LAYER_RENDER = (1 << 0),
        SCENE_LAYER_ENGINE_DIRTY  = (1 << 1),
+       SCENE_LAYER_FREESTYLE = (1 << 2),
 };
 
 
index 7ac0e74ae5911eedd6890690af6790b85a94428b..9e42c0d0fc8f580b98eba8aa2e7b2b6a68546328 100644 (file)
@@ -172,24 +172,24 @@ typedef struct AudioData {
 typedef struct SceneRenderLayer {
        struct SceneRenderLayer *next, *prev;
        
-       char name[64];  /* MAX_NAME */
+       char name[64] DNA_DEPRECATED;   /* MAX_NAME */
        
        struct Material *mat_override DNA_DEPRECATED; /* Converted to SceneLayer override. */
        
        unsigned int lay DNA_DEPRECATED; /* Converted to LayerCollection cycles camera visibility override. */
        unsigned int lay_zmask DNA_DEPRECATED; /* Converted to LayerCollection cycles holdout override. */
        unsigned int lay_exclude DNA_DEPRECATED;
-       int layflag;
+       int layflag DNA_DEPRECATED; /* Converted to SceneLayer layflag and flag. */
        
-       int passflag;                   /* pass_xor has to be after passflag */
-       int pass_xor;
+       int passflag DNA_DEPRECATED; /* pass_xor has to be after passflag */
+       int pass_xor DNA_DEPRECATED; /* Converted to SceneLayer passflag and flag. */
 
        int samples DNA_DEPRECATED; /* Converted to SceneLayer override. */
-       float pass_alpha_threshold;
+       float pass_alpha_threshold DNA_DEPRECATED; /* Converted to SceneLayer pass_alpha_threshold. */
 
-       IDProperty *prop;
+       IDProperty *prop DNA_DEPRECATED; /* Converted to SceneLayer id_properties. */
 
-       struct FreestyleConfig freestyleConfig;
+       struct FreestyleConfig freestyleConfig DNA_DEPRECATED; /* Converted to SceneLayer freestyleConfig. */
 } SceneRenderLayer;
 
 /* srl->layflag */
@@ -662,8 +662,8 @@ typedef struct RenderData {
        rcti disprect;
        
        /* information on different layers to be rendered */
-       ListBase layers;
-       short actlay;
+       ListBase layers DNA_DEPRECATED; /* Converted to Scene->render_layers. */
+       short actlay DNA_DEPRECATED; /* Converted to Scene->active_layer. */
        
        /* number of mblur samples */
        short mblur_samples;
index b20840ea2541b156fc11c11573766acd4b2cae1e..b0a2009e3b53e49fbb7dbc09dfa06bfaabd120dd 100644 (file)
@@ -35,6 +35,7 @@
 
 #define RNA_MAGIC ((int)~0)
 
+struct FreestyleSettings;
 struct ID;
 struct IDProperty;
 struct Main;
@@ -239,6 +240,29 @@ void rna_object_vcollayer_name_set(struct PointerRNA *ptr, const char *value, ch
 PointerRNA rna_object_shapekey_index_get(struct ID *id, int value);
 int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current);
 
+/* SceneLayer related functions defined in rna_scene.c but required in rna_layer.c */
+void rna_def_freestyle_settings(struct BlenderRNA *brna);
+struct PointerRNA rna_FreestyleLineSet_linestyle_get(struct PointerRNA *ptr);
+void rna_FreestyleLineSet_linestyle_set(struct PointerRNA *ptr, struct PointerRNA value);
+struct FreestyleLineSet *rna_FreestyleSettings_lineset_add(
+        struct ID *id, struct FreestyleSettings *config, struct Main *bmain, const char *name);
+void rna_FreestyleSettings_lineset_remove(
+        struct ID *id, struct FreestyleSettings *config, struct ReportList *reports, struct PointerRNA *lineset_ptr);
+struct PointerRNA rna_FreestyleSettings_active_lineset_get(struct PointerRNA *ptr);
+void rna_FreestyleSettings_active_lineset_index_range(
+        struct PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax);
+int rna_FreestyleSettings_active_lineset_index_get(struct PointerRNA *ptr);
+void rna_FreestyleSettings_active_lineset_index_set(struct PointerRNA *ptr, int value);
+struct FreestyleModuleConfig *rna_FreestyleSettings_module_add(struct ID *id, struct FreestyleSettings *config);
+void rna_FreestyleSettings_module_remove(
+        struct ID *id, struct FreestyleSettings *config, struct ReportList *reports, struct PointerRNA *module_ptr);
+
+void rna_Scene_use_view_map_cache_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
+void rna_Scene_glsl_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
+void rna_Scene_freestyle_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
+void rna_SceneLayer_name_set(struct PointerRNA *ptr, const char *value);
+void rna_SceneLayer_pass_update(struct Main *bmain, struct Scene *activescene, struct PointerRNA *ptr);
+
 /* named internal so as not to conflict with obj.update() rna func */
 void rna_Object_internal_update_data(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
 void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
index b5f031ccaaacc2325fce20501e57f647842b1c62..8391048facfd575fc59bcd710877b89c4fcb5db4 100644 (file)
@@ -805,28 +805,23 @@ static void rna_LayerObjects_active_object_set(PointerRNA *ptr, PointerRNA value
                scene_layer->basact = NULL;
 }
 
-static void rna_SceneLayer_name_set(PointerRNA *ptr, const char *value)
+static IDProperty *rna_SceneLayer_idprops(PointerRNA *ptr, bool create)
 {
-       Scene *scene = (Scene *)ptr->id.data;
        SceneLayer *scene_layer = (SceneLayer *)ptr->data;
-       char oldname[sizeof(scene_layer->name)];
-
-       BLI_strncpy(oldname, scene_layer->name, sizeof(scene_layer->name));
 
-       BLI_strncpy_utf8(scene_layer->name, value, sizeof(scene_layer->name));
-       BLI_uniquename(&scene->render_layers, scene_layer, DATA_("SceneLayer"), '.', offsetof(SceneLayer, name), sizeof(scene_layer->name));
+       if (create && !scene_layer->id_properties) {
+               IDPropertyTemplate val = {0};
+               scene_layer->id_properties = IDP_New(IDP_GROUP, &val, "SceneLayer ID properties");
+       }
 
-       if (scene->nodetree) {
-               bNode *node;
-               int index = BLI_findindex(&scene->render_layers, scene_layer);
+       return scene_layer->id_properties;
+}
 
-               for (node = scene->nodetree->nodes.first; node; node = node->next) {
-                       if (node->type == CMP_NODE_R_LAYERS && node->id == NULL) {
-                               if (node->custom1 == index)
-                                       BLI_strncpy(node->name, scene_layer->name, NODE_MAXSTR);
-                       }
-               }
-       }
+static void rna_SceneLayer_update_render_passes(ID *id)
+{
+       Scene *scene = (Scene *)id;
+       if (scene->nodetree)
+               ntreeCompositUpdateRLayers(scene->nodetree);
 }
 
 static PointerRNA rna_SceneLayer_objects_get(CollectionPropertyIterator *iter)
@@ -2161,12 +2156,13 @@ void RNA_def_scene_layer(BlenderRNA *brna)
        srna = RNA_def_struct(brna, "SceneLayer", NULL);
        RNA_def_struct_ui_text(srna, "Render Layer", "Render layer");
        RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
+       RNA_def_struct_idprops_func(srna, "rna_SceneLayer_idprops");
 
-       prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
-       RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneLayer_name_set");
-       RNA_def_property_ui_text(prop, "Name", "Render layer name");
-       RNA_def_struct_name_property(srna, prop);
-       RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL);
+       rna_def_render_layer_common(srna, 1);
+
+       func = RNA_def_function(srna, "update_render_passes", "rna_SceneLayer_update_render_passes");
+       RNA_def_function_ui_description(func, "Requery the enabled render passes from the render engine");
+       RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF);
 
        prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL);
@@ -2187,6 +2183,20 @@ void RNA_def_scene_layer(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer");
        RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
 
+       prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SCENE_LAYER_FREESTYLE);
+       RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer");
+       RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
+
+       /* Freestyle */
+       rna_def_freestyle_settings(brna);
+
+       prop = RNA_def_property(srna, "freestyle_settings", PROP_POINTER, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_NEVER_NULL);
+       RNA_def_property_pointer_sdna(prop, NULL, "freestyle_config");
+       RNA_def_property_struct_type(prop, "FreestyleSettings");
+       RNA_def_property_ui_text(prop, "Freestyle Settings", "");
+
        /* Override settings */
        prop = RNA_def_property(srna, "engine_overrides", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "properties->data.group", NULL);
index 9ad222d6b7aa7c368a1abb862408d3d9e0ad8c3d..8d44dc1d97068578bc74e143c151b0abe6abf077 100644 (file)
@@ -2780,7 +2780,7 @@ static const EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), P
                return DummyRNA_NULL_items;
        }
 
-       rl = sce->r.layers.first;
+       rl = sce->render_layers.first;
        item = renderresult_layers_add_enum(rl);
 
        *r_free = true;
index 7c5d710c454fc7db644de1272d36401d0580eee6..169210d702630e4d255002f5329179cbc91beb91 100644 (file)
@@ -280,7 +280,7 @@ static void engine_collection_settings_create(RenderEngine *engine, struct IDPro
        RNA_parameter_list_free(&list);
 }
 
-static void engine_update_render_passes(RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl)
+static void engine_update_render_passes(RenderEngine *engine, struct Scene *scene, struct SceneLayer *scene_layer)
 {
        extern FunctionRNA rna_RenderEngine_update_render_passes_func;
        PointerRNA ptr;
@@ -292,7 +292,7 @@ static void engine_update_render_passes(RenderEngine *engine, struct Scene *scen
 
        RNA_parameter_list_create(&list, &ptr, func);
        RNA_parameter_set_lookup(&list, "scene", &scene);
-       RNA_parameter_set_lookup(&list, "renderlayer", &srl);
+       RNA_parameter_set_lookup(&list, "renderlayer", &scene_layer);
        engine->type->ext.call(NULL, &ptr, func, &list);
 
        RNA_parameter_list_free(&list);
@@ -565,7 +565,7 @@ static void rna_def_render_engine(BlenderRNA *brna)
        RNA_def_function_ui_description(func, "Update the render passes that will be generated");
        RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
        parm = RNA_def_pointer(func, "scene", "Scene", "", "");
-       parm = RNA_def_pointer(func, "renderlayer", "SceneRenderLayer", "", "");
+       parm = RNA_def_pointer(func, "renderlayer", "SceneLayer", "", "");
 
        /* per-collection engine settings initialization */
        func = RNA_def_function(srna, "collection_settings_create", NULL);
@@ -758,7 +758,7 @@ static void rna_def_render_engine(BlenderRNA *brna)
        RNA_def_function_ui_description(func, "Register a render pass that will be part of the render with the current settings");
        prop = RNA_def_pointer(func, "scene", "Scene", "", "");
        RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-       prop = RNA_def_pointer(func, "srl", "SceneRenderLayer", "", "");
+       prop = RNA_def_pointer(func, "scene_layer", "SceneLayer", "", "");
        RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
        prop = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
        RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
index 71a62a2bc6365008e59a18b8da852536003f4aea..bfddeb5399677221622c3b10ac6b6d50ef6a179f 100644 (file)
@@ -1286,73 +1286,6 @@ static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene
 }
 #endif
 
-static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr)
-{
-       RenderData *rd = (RenderData *)ptr->data;
-       return rd->actlay;
-}
-
-static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value)
-{
-       RenderData *rd = (RenderData *)ptr->data;
-       int num_layers = BLI_listbase_count(&rd->layers);
-       rd->actlay = min_ff(value, num_layers - 1);
-}
-
-static void rna_RenderSettings_active_layer_index_range(
-        PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
-{
-       RenderData *rd = (RenderData *)ptr->data;
-
-       *min = 0;
-       *max = max_ii(0, BLI_listbase_count(&rd->layers) - 1);
-}
-
-static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
-{
-       RenderData *rd = (RenderData *)ptr->data;
-       SceneRenderLayer *srl = BLI_findlink(&rd->layers, rd->actlay);
-       
-       return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderLayer, srl);
-}
-
-static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA value)
-{
-       RenderData *rd = (RenderData *)ptr->data;
-       SceneRenderLayer *srl = (SceneRenderLayer *)value.data;
-       const int index = BLI_findindex(&rd->layers, srl);
-       if (index != -1) rd->actlay = index;
-}
-
-static SceneRenderLayer *rna_RenderLayer_new(ID *id, RenderData *UNUSED(rd), const char *name)
-{
-       Scene *scene = (Scene *)id;
-       SceneRenderLayer *srl = BKE_scene_add_render_layer(scene, name);
-
-       DEG_id_tag_update(&scene->id, 0);
-       WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
-       return srl;
-}
-
-static void rna_RenderLayer_remove(
-        ID *id, RenderData *UNUSED(rd), Main *bmain, ReportList *reports, PointerRNA *srl_ptr)
-{
-       SceneRenderLayer *srl = srl_ptr->data;
-       Scene *scene = (Scene *)id;
-
-       if (!BKE_scene_remove_render_layer(bmain, scene, srl)) {
-               BKE_reportf(reports, RPT_ERROR, "Render layer '%s' could not be removed from scene '%s'",
-                           srl->name, scene->id.name + 2);
-               return;
-       }
-
-       RNA_POINTER_INVALIDATE(srl_ptr);
-
-       DEG_id_tag_update(&scene->id, 0);
-       WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
-}
-
 static int rna_RenderSettings_active_view_index_get(PointerRNA *ptr)
 {
        RenderData *rd = (RenderData *)ptr->data;
@@ -1431,7 +1364,7 @@ static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value)
        rd->views_format = value;
 }
 
-static void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
        Scene *scene = (Scene *)ptr->id.data;
 
@@ -1446,66 +1379,45 @@ static void rna_Scene_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
        WM_main_add_notifier(NC_WORLD | ND_WORLD, &sc->id);
 }
 
-static void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
        Scene *scene = (Scene *)ptr->id.data;
 
        DEG_id_tag_update(&scene->id, 0);
 }
 
-static void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
 {
 #ifdef WITH_FREESTYLE
        FRS_free_view_map_cache();
 #endif
 }
 
-static IDProperty *rna_SceneRenderLayer_idprops(PointerRNA *ptr, bool create)
-{
-       SceneRenderLayer *srl = (SceneRenderLayer *)ptr->data;
-
-       if (create && !srl->prop) {
-               IDPropertyTemplate val = {0};
-               srl->prop = IDP_New(IDP_GROUP, &val, "SceneRenderLayer ID properties");
-       }
-
-       return srl->prop;
-}
-
-static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value)
+void rna_SceneLayer_name_set(PointerRNA *ptr, const char *value)
 {
        Scene *scene = (Scene *)ptr->id.data;
-       SceneRenderLayer *rl = (SceneRenderLayer *)ptr->data;
-       char oldname[sizeof(rl->name)];
+       SceneLayer *scene_layer = (SceneLayer *)ptr->data;
+       char oldname[sizeof(scene_layer->name)];
 
-       BLI_strncpy(oldname, rl->name, sizeof(rl->name));
+       BLI_strncpy(oldname, scene_layer->name, sizeof(scene_layer->name));
 
-       BLI_strncpy_utf8(rl->name, value, sizeof(rl->name));
-       BLI_uniquename(&scene->r.layers, rl, DATA_("RenderLayer"), '.', offsetof(SceneRenderLayer, name), sizeof(rl->name));
+       BLI_strncpy_utf8(scene_layer->name, value, sizeof(scene_layer->name));
+       BLI_uniquename(&scene->render_layers, scene_layer, DATA_("RenderLayer"), '.', offsetof(SceneLayer, name), sizeof(scene_layer->name));
 
        if (scene->nodetree) {
                bNode *node;
-               int index = BLI_findindex(&scene->r.layers, rl);
+               int index = BLI_findindex(&scene->render_layers, scene_layer);
 
                for (node = scene->nodetree->nodes.first; node; node = node->next) {
                        if (node->type == CMP_NODE_R_LAYERS && node->id == NULL) {
                                if (node->custom1 == index)
-                                       BLI_strncpy(node->name, rl->name, NODE_MAXSTR);
+                                       BLI_strncpy(node->name, scene_layer->name, NODE_MAXSTR);
                        }
                }
        }
 
        /* fix all the animation data which may link to this */
-       BKE_animdata_fix_paths_rename_all(NULL, "render.layers", oldname, rl->name);
-}
-
-static char *rna_SceneRenderLayer_path(PointerRNA *ptr)
-{
-       SceneRenderLayer *srl = (SceneRenderLayer *)ptr->data;
-       char name_esc[sizeof(srl->name) * 2];
-
-       BLI_strescape(name_esc, srl->name, sizeof(name_esc));
-       return BLI_sprintfN("render.layers[\"%s\"]", name_esc);
+       BKE_animdata_fix_paths_rename_all(NULL, "render.layers", oldname, scene_layer->name);
 }
 
 static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value)
@@ -1516,13 +1428,7 @@ static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value)
        BLI_uniquename(&scene->r.views, rv, DATA_("RenderView"), '.', offsetof(SceneRenderView, name), sizeof(rv->name));
 }
 
-static char *rna_SceneRenderView_path(PointerRNA *ptr)
-{
-       SceneRenderView *srv = (SceneRenderView *)ptr->data;
-       return BLI_sprintfN("render.views[\"%s\"]", srv->name);
-}
-
-static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
+void rna_SceneLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
 {
        Scene *scene = (Scene *)ptr->id.data;
 
@@ -1532,11 +1438,10 @@ static void rna_SceneRenderLayer_pass_update(Main *bmain, Scene *activescene, Po
        rna_Scene_glsl_update(bmain, activescene, ptr);
 }
 
-static void rna_SceneRenderLayer_update_render_passes(ID *id)
+static char *rna_SceneRenderView_path(PointerRNA *ptr)
 {
-       Scene *scene = (Scene *)id;
-       if (scene->nodetree)
-               ntreeCompositUpdateRLayers(scene->nodetree);
+       SceneRenderView *srv = (SceneRenderView *)ptr->data;
+       return BLI_sprintfN("render.views[\"%s\"]", srv->name);
 }
 
 static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr)
@@ -1885,14 +1790,14 @@ static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr))
        return BLI_strdup("tool_settings");
 }
 
-static PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
+PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
 {
        FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
 
        return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
 }
 
-static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value)
+void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value)
 {
        FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
 
@@ -1902,7 +1807,7 @@ static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value
        id_us_plus(&lineset->linestyle->id);
 }
 
-static FreestyleLineSet *rna_FreestyleSettings_lineset_add(
+FreestyleLineSet *rna_FreestyleSettings_lineset_add(
         ID *id, FreestyleSettings *config, Main *bmain, const char *name)
 {
        Scene *scene = (Scene *)id;
@@ -1914,7 +1819,7 @@ static FreestyleLineSet *rna_FreestyleSettings_lineset_add(
        return lineset;
 }
 
-static void rna_FreestyleSettings_lineset_remove(
+void rna_FreestyleSettings_lineset_remove(
         ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *lineset_ptr)
 {
        FreestyleLineSet *lineset = lineset_ptr->data;
@@ -1931,14 +1836,14 @@ static void rna_FreestyleSettings_lineset_remove(
        WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
 }
 
-static PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
+PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
 {
        FreestyleConfig *config = (FreestyleConfig *)ptr->data;
        FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
        return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
 }
 
-static void rna_FreestyleSettings_active_lineset_index_range(
+void rna_FreestyleSettings_active_lineset_index_range(
         PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
 {
        FreestyleConfig *config = (FreestyleConfig *)ptr->data;
@@ -1947,19 +1852,19 @@ static void rna_FreestyleSettings_active_lineset_index_range(
        *max = max_ii(0, BLI_listbase_count(&config->linesets) - 1);
 }
 
-static int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
+int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
 {
        FreestyleConfig *config = (FreestyleConfig *)ptr->data;
        return BKE_freestyle_lineset_get_active_index(config);
 }
 
-static void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value)
+void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value)
 {
        FreestyleConfig *config = (FreestyleConfig *)ptr->data;
        BKE_freestyle_lineset_set_active_index(config, value);
 }
 
-static FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, FreestyleSettings *config)
+FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, FreestyleSettings *config)
 {
        Scene *scene = (Scene *)id;
        FreestyleModuleConfig *module = BKE_freestyle_module_add((FreestyleConfig *)config);
@@ -1970,7 +1875,7 @@ static FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, Freestyle
        return module;
 }
 
-static void rna_FreestyleSettings_module_remove(
+void rna_FreestyleSettings_module_remove(
         ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *module_ptr)
 {
        Scene *scene = (Scene *)id;
@@ -3268,7 +3173,7 @@ void rna_def_render_layer_common(StructRNA *srna, int scene)
        PropertyRNA *prop;
 
        prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
-       if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderLayer_name_set");
+       if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneLayer_name_set");
        else RNA_def_property_string_sdna(prop, NULL, "name");
        RNA_def_property_ui_text(prop, "Name", "Render layer name");
        RNA_def_struct_name_property(srna, prop);
@@ -3284,12 +3189,6 @@ void rna_def_render_layer_common(StructRNA *srna, int scene)
        }
 
        /* layer options */
-       prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, "layflag", SCE_LAY_DISABLE);
-       RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
-       else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
        prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
        RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
@@ -3351,247 +3250,241 @@ void rna_def_render_layer_common(StructRNA *srna, int scene)
        if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
-       prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_FRS);
-       RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-       else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
        /* passes */
        prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
        RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z);
        RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        
        prop = RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR);
        RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL);
        RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_uv", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV);
        RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST);
        RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_object_index", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB);
        RNA_def_property_ui_text(prop, "Object Index", "Deliver object index pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
        RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_color", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_RGBA);
        RNA_def_property_ui_text(prop, "Color", "Deliver shade-less color pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_diffuse", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE);
        RNA_def_property_ui_text(prop, "Diffuse", "Deliver diffuse pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_specular", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SPEC);
        RNA_def_property_ui_text(prop, "Specular", "Deliver specular pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW);
        RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO);
        RNA_def_property_ui_text(prop, "AO", "Deliver AO pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        
        prop = RNA_def_property(srna, "use_pass_reflection", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFLECT);
        RNA_def_property_ui_text(prop, "Reflection", "Deliver raytraced reflection pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_refraction", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_REFRACT);
        RNA_def_property_ui_text(prop, "Refraction", "Deliver raytraced refraction pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT);
        RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT);
        RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDIRECT);
        RNA_def_property_ui_text(prop, "Indirect", "Deliver indirect lighting pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "exclude_specular", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SPEC);
        RNA_def_property_ui_text(prop, "Specular Exclude", "Exclude specular pass from combined");
        RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "exclude_shadow", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_SHADOW);
        RNA_def_property_ui_text(prop, "Shadow Exclude", "Exclude shadow pass from combined");
        RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "exclude_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_AO);
        RNA_def_property_ui_text(prop, "AO Exclude", "Exclude AO pass from combined");
        RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        
        prop = RNA_def_property(srna, "exclude_reflection", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFLECT);
        RNA_def_property_ui_text(prop, "Reflection Exclude", "Exclude raytraced reflection pass from combined");
        RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "exclude_refraction", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_REFRACT);
        RNA_def_property_ui_text(prop, "Refraction Exclude", "Exclude raytraced refraction pass from combined");
        RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "exclude_emit", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_EMIT);
        RNA_def_property_ui_text(prop, "Emit Exclude", "Exclude emission pass from combined");
        RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "exclude_environment", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_ENVIRONMENT);
        RNA_def_property_ui_text(prop, "Environment Exclude", "Exclude environment pass from combined");
        RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "exclude_indirect", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "pass_xor", SCE_PASS_INDIRECT);
        RNA_def_property_ui_text(prop, "Indirect Exclude", "Exclude indirect pass from combined");
        RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT);
        RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT);
        RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR);
        RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT);
        RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT);
        RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR);
        RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT);
        RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT);
        RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR);
        RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        
        prop = RNA_def_property(srna, "use_pass_subsurface_direct", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_DIRECT);
        RNA_def_property_ui_text(prop, "Subsurface Direct", "Deliver subsurface direct pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_subsurface_indirect", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_INDIRECT);
        RNA_def_property_ui_text(prop, "Subsurface Indirect", "Deliver subsurface indirect pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 
        prop = RNA_def_property(srna, "use_pass_subsurface_color", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_COLOR);
        RNA_def_property_ui_text(prop, "Subsurface Color", "Deliver subsurface color pass");
-       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneRenderLayer_pass_update");
+       if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneLayer_pass_update");
        else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 }
 
@@ -3661,7 +3554,7 @@ static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
 }
 
-static void rna_def_freestyle_settings(BlenderRNA *brna)
+void rna_def_freestyle_settings(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
@@ -3954,8 +3847,8 @@ static void rna_def_freestyle_settings(BlenderRNA *brna)
 
        srna = RNA_def_struct(brna, "FreestyleSettings", NULL);
        RNA_def_struct_sdna(srna, "FreestyleConfig");
-       RNA_def_struct_nested(brna, srna, "SceneRenderLayer");
-       RNA_def_struct_ui_text(srna, "Freestyle Settings", "Freestyle settings for a SceneRenderLayer data-block");
+       RNA_def_struct_nested(brna, srna, "SceneLayer");
+       RNA_def_struct_ui_text(srna, "Freestyle Settings", "Freestyle settings for a SceneLayer data-block");
 
        prop = RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "modules", NULL);
@@ -4981,82 +4874,6 @@ static void rna_def_scene_layers(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
 }
 
-/* TODO LAYERS: legacy SceneRenderLayers, to be removed */
-
-static void rna_def_scene_render_layer(BlenderRNA *brna)
-{
-       StructRNA *srna;
-       PropertyRNA *prop;
-       FunctionRNA *func;
-
-       srna = RNA_def_struct(brna, "SceneRenderLayer", NULL);
-       RNA_def_struct_ui_text(srna, "Scene Render Layer", "Render layer");
-       RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
-       RNA_def_struct_path_func(srna, "rna_SceneRenderLayer_path");
-       RNA_def_struct_idprops_func(srna, "rna_SceneRenderLayer_idprops");
-
-       rna_def_render_layer_common(srna, 1);
-
-       func = RNA_def_function(srna, "update_render_passes", "rna_SceneRenderLayer_update_render_passes");
-       RNA_def_function_ui_description(func, "Requery the enabled render passes from the render engine");
-       RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF);
-
-       /* Freestyle */
-       rna_def_freestyle_settings(brna);
-
-       prop = RNA_def_property(srna, "freestyle_settings", PROP_POINTER, PROP_NONE);
-       RNA_def_property_flag(prop, PROP_NEVER_NULL);
-       RNA_def_property_pointer_sdna(prop, NULL, "freestyleConfig");
-       RNA_def_property_struct_type(prop, "FreestyleSettings");
-       RNA_def_property_ui_text(prop, "Freestyle Settings", "");
-}
-
-/* Render Layers */
-static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
-{
-       StructRNA *srna;
-       PropertyRNA *prop;
-
-       FunctionRNA *func;
-       PropertyRNA *parm;
-
-       RNA_def_property_srna(cprop, "RenderLayers");
-       srna = RNA_def_struct(brna, "RenderLayers", NULL);
-       RNA_def_struct_sdna(srna, "RenderData");
-       RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
-
-       prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
-       RNA_def_property_int_sdna(prop, NULL, "actlay");
-       RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get",
-                                  "rna_RenderSettings_active_layer_index_set",
-                                  "rna_RenderSettings_active_layer_index_range");
-       RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array");
-       RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
-       
-       prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
-       RNA_def_property_struct_type(prop, "SceneRenderLayer");
-       RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get",
-                                      "rna_RenderSettings_active_layer_set", NULL, NULL);
-       RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
-       RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer");
-       RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
-
-       func = RNA_def_function(srna, "new", "rna_RenderLayer_new");
-       RNA_def_function_ui_description(func, "Add a render layer to scene");
-       RNA_def_function_flag(func, FUNC_USE_SELF_ID);
-       parm = RNA_def_string(func, "name", "RenderLayer", 0, "", "New name for the render layer (not unique)");
-       RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-       parm = RNA_def_pointer(func, "result", "SceneRenderLayer", "", "Newly created render layer");
-       RNA_def_function_return(func, parm);
-
-       func = RNA_def_function(srna, "remove", "rna_RenderLayer_remove");
-       RNA_def_function_ui_description(func, "Remove a render layer");
-       RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
-       parm = RNA_def_pointer(func, "layer", "SceneRenderLayer", "", "Render layer to remove");
-       RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
-       RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-}
-
 /* Render Views - MultiView */
 static void rna_def_scene_render_view(BlenderRNA *brna)
 {
@@ -6422,13 +6239,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Textured Solid", "Draw face-assigned textures in solid draw method");
        RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
 
-       /* layers */
-       prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_collection_sdna(prop, NULL, "layers", NULL);
-       RNA_def_property_struct_type(prop, "SceneRenderLayer");
-       RNA_def_property_ui_text(prop, "Render Layers", "");
-       rna_def_render_layers(brna, prop);
-
        prop = RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER);
        RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer");
@@ -7189,7 +6999,6 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_define_animate_sdna(true);
        /* *** Animated *** */
        rna_def_scene_render_data(brna);
-       rna_def_scene_render_layer(brna);
        rna_def_gpu_fx(brna);
        rna_def_scene_render_view(brna);
 
index a5c2e604f46e9e557368206c7a52edd31b489307..1275729cfdbbf9d4d5b0cd180cd281ad4b67d38a 100644 (file)
@@ -140,7 +140,7 @@ void register_node_type_cmp_planetrackdeform(void);
 void register_node_type_cmp_cornerpin(void);
 
 void node_cmp_rlayers_outputs(struct bNodeTree *ntree, struct bNode *node);
-void node_cmp_rlayers_register_pass(struct bNodeTree *ntree, struct bNode *node, struct Scene *scene, struct SceneRenderLayer *srl, const char *name, int type);
+void node_cmp_rlayers_register_pass(struct bNodeTree *ntree, struct bNode *node, struct Scene *scene, struct SceneLayer *scene_layer, const char *name, int type);
 const char *node_cmp_rlayers_sock_to_pass(int sock_index);
 
 #endif
index 8228ec079ff5bbbe9238e2b133229b1644d7134d..740e9c6eb079ea78f9c4220fc06dd5389df5be7b 100644 (file)
@@ -261,7 +261,7 @@ void ntreeCompositUpdateRLayers(bNodeTree *ntree)
 
 }
 
-void ntreeCompositRegisterPass(bNodeTree *ntree, Scene *scene, SceneRenderLayer *srl, const char *name, int type)
+void ntreeCompositRegisterPass(bNodeTree *ntree, Scene *scene, SceneLayer *scene_layer, const char *name, int type)
 {
        bNode *node;
 
@@ -269,7 +269,7 @@ void ntreeCompositRegisterPass(bNodeTree *ntree, Scene *scene, SceneRenderLayer
 
        for (node = ntree->nodes.first; node; node = node->next) {
                if (node->type == CMP_NODE_R_LAYERS)
-                       node_cmp_rlayers_register_pass(ntree, node, scene, srl, name, type);
+                       node_cmp_rlayers_register_pass(ntree, node, scene, scene_layer, name, type);
        }
 
 }
index 0ca36ef548ea3d14057f6ec6004128d7661586e7..0bcbce3326ff98875369368e619f0a3012b001f3 100644 (file)
@@ -191,16 +191,16 @@ typedef struct RLayerUpdateData {
        int prev_index;
 } RLayerUpdateData;
 
-void node_cmp_rlayers_register_pass(bNodeTree *ntree, bNode *node, Scene *scene, SceneRenderLayer *srl, const char *name, int type)
+void node_cmp_rlayers_register_pass(bNodeTree *ntree, bNode *node, Scene *scene, SceneLayer *scene_layer, const char *name, int type)
 {
        RLayerUpdateData *data = node->storage;
 
-       if (scene == NULL || srl == NULL || data == NULL || node->id != (ID *)scene) {
+       if (scene == NULL || scene_layer == NULL || data == NULL || node->id != (ID *)scene) {
                return;
        }
 
-       SceneRenderLayer *node_srl = BLI_findlink(&scene->r.layers, node->custom1);
-       if (node_srl != srl) {
+       SceneLayer *node_scene_layer = BLI_findlink(&scene->render_layers, node->custom1);
+       if (node_scene_layer != scene_layer) {
                return;
        }
 
@@ -221,15 +221,15 @@ static void cmp_node_rlayer_create_outputs(bNodeTree *ntree, bNode *node, LinkNo
        if (scene) {
                RenderEngineType *engine_type = RE_engines_find(scene->view_render.engine_id);
                if (engine_type && engine_type->update_render_passes) {
-                       SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, node->custom1);
-                       if (srl) {
+                       SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, node->custom1);
+                       if (scene_layer) {
                                RLayerUpdateData *data = MEM_mallocN(sizeof(RLayerUpdateData), "render layer update data");
                                data->available_sockets = available_sockets;
                                data->prev_index = -1;
                                node->storage = data;
 
                                RenderEngine *engine = RE_engine_create(engine_type);
-                               engine_type->update_render_passes(engine, scene, srl);
+                               engine_type->update_render_passes(engine, scene, scene_layer);
                                RE_engine_free(engine);
 
                                MEM_freeN(data);
index 82f9599c65465f49d402a6df8d8a8a9f8f1dd3c6..0f1c8e86688538e174a1178d8c82e61845ab8da5 100644 (file)
@@ -102,7 +102,7 @@ typedef struct RenderEngineType {
        void (*render_to_view)(struct RenderEngine *engine, const struct bContext *context);
 
        void (*update_script_node)(struct RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node);
-       void (*update_render_passes)(struct RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl);
+       void (*update_render_passes)(struct RenderEngine *engine, struct Scene *scene, struct SceneLayer *scene_layer);
 
        void (*collection_settings_create)(struct RenderEngine *engine, struct IDProperty *props);
        void (*render_settings_create)(struct RenderEngine *engine, struct IDProperty *props);
@@ -174,7 +174,7 @@ bool RE_engine_is_external(struct Render *re);
 
 void RE_engine_frame_set(struct RenderEngine *engine, int frame, float subframe);
 
-void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl,
+void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct SceneLayer *scene_layer,
                              const char *name, int channels, const char *chanid, int type);
 
 /* Engine Types */
index 9d2fbcc6d0429952b7c0c9e08092c26f47fef5fa..711d350d51e5c7c127446b107c48b4ce42a492fa 100644 (file)
@@ -48,7 +48,7 @@ struct RenderData;
 struct RenderResult;
 struct ReportList;
 struct Scene;
-struct SceneRenderLayer;
+struct SceneLayer;
 struct EnvMap;
 struct StampData;
 struct ViewRender;
@@ -240,7 +240,8 @@ struct RenderPass *RE_create_gp_pass(struct RenderResult *rr, const char *layern
 
 /* obligatory initialize call, disprect is optional */
 void RE_InitState(struct Render *re, struct Render *source, struct RenderData *rd,
-                  struct ViewRender *view_render, struct SceneRenderLayer *srl,
+                  struct ListBase *render_layers, const int active_layer,
+                  struct ViewRender *view_render, struct SceneLayer *scene_layer,
                   int winx, int winy, rcti *disprect);
 void RE_ChangeResolution(struct Render *re, int winx, int winy, rcti *disprect);
 void RE_ChangeModeFlag(struct Render *re, int flag, bool clear);
@@ -289,7 +290,7 @@ bool RE_WriteRenderViewsMovie(
 
 /* only RE_NewRender() needed, main Blender render calls */
 void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene,
-                     struct SceneRenderLayer *srl, struct Object *camera_override,
+                     struct SceneLayer *scene_layer, struct Object *camera_override,
                      unsigned int lay_override, int frame, const bool write_still);
 void RE_BlenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, struct Object *camera_override,
                     unsigned int lay_override, int sfra, int efra, int tfra);
index ec5bb2c937640d80a075026a9243d7da41450226..8f572c34f3de3310e7ebd184c608c57e10263902 100644 (file)
@@ -192,6 +192,8 @@ struct Render {
        struct Main *main;
        Scene *scene;
        RenderData r;
+       ListBase render_layers;
+       int active_layer;
        World wrld;
        ViewRender view_render;
        struct Object *camera_override;
index f4c4a50ac27f69ac59fb49ef4cd388e243721dc7..14c3d798e4f271bbb8851991ef2db5debea1e55a 100644 (file)
@@ -83,7 +83,7 @@ void zbufshade_sss_tile(struct RenderPart *pa);
 
 int get_sample_layers(struct RenderPart *pa, struct RenderLayer *rl, struct RenderLayer **rlpp);
 
-void render_internal_update_passes(struct RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl);
+void render_internal_update_passes(struct RenderEngine *engine, struct Scene *scene, struct SceneLayer *scene_layer);
 
 
 /* -------- ray.c ------- */
index 44df2726847c19ae722e65624889e76229a89567..8c23eb0d4cb4130813ba9adbfb38b8c51b78d774 100644 (file)
@@ -33,6 +33,7 @@
 #ifndef __RENDERPIPELINE_H__
 #define __RENDERPIPELINE_H__
 
+struct ListBase;
 struct Render;
 struct RenderData;
 struct RenderLayer;
@@ -41,7 +42,7 @@ struct ViewRender;
 
 struct RenderLayer *render_get_active_layer(struct Render *re, struct RenderResult *rr);
 float panorama_pixel_rot(struct Render *re);
-void render_update_anim_renderdata(struct Render *re, struct RenderData *rd);
+void render_update_anim_renderdata(struct Render *re, struct RenderData *rd, struct ListBase *render_layers);
 void render_copy_renderdata(struct RenderData *to, struct RenderData *from);
 void render_copy_viewrender(struct ViewRender *to, struct ViewRender *from);
 
index 8b91b970845df4a4438976c6362072783b29f6cd..496349e4ca6acb8f441ef12b862a4933bea3cd93 100644 (file)
@@ -5203,7 +5203,7 @@ void RE_Database_FromScene(Render *re, Main *bmain, Scene *scene, unsigned int l
        /* applies changes fully */
        if ((re->r.scemode & (R_NO_FRAME_UPDATE|R_BUTS_PREVIEW|R_VIEWPORT_PREVIEW))==0) {
                BKE_scene_graph_update_for_newframe(re->eval_ctx, re->depsgraph, re->main, re->scene, NULL);
-               render_update_anim_renderdata(re, &re->scene->r);
+               render_update_anim_renderdata(re, &re->scene->r, &re->scene->render_layers);
        }
        
        /* if no camera, viewmat should have been set! */
index 1aab70c0fb9394314a2b9b5689c3b7590a53227a..c873de064eb264ddb0c0a76fdba00b4689946399 100644 (file)
@@ -143,7 +143,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env)
        
        /* set up renderdata */
        envre->r.mode &= ~(R_BORDER | R_PANORAMA | R_ORTHO | R_MBLUR);
-       BLI_freelistN(&envre->r.layers);
+       BLI_freelistN(&envre->render_layers);
        BLI_freelistN(&envre->r.views);
        envre->r.filtertype = 0;
        envre->r.tilex = envre->r.xsch / 2;
@@ -151,7 +151,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env)
        envre->r.size = 100;
        envre->r.yasp = envre->r.xasp = 1;
        
-       RE_InitState(envre, NULL, &envre->r, &envre->view_render, NULL, cuberes, cuberes, NULL);
+       RE_InitState(envre, NULL, &envre->r, &re->render_layers, re->active_layer, &envre->view_render, NULL, cuberes, cuberes, NULL);
        envre->main = re->main;
        envre->scene = re->scene;    /* unsure about this... */
        envre->scene_color_manage = re->scene_color_manage;
index 61f59eace89b527f1ecc9b114b4044f0f6ccde34..160f999f4e7f6a68f2ff2ea3f44069dc32fd31eb 100644 (file)
@@ -658,7 +658,7 @@ int RE_engine_render(Render *re, int do_all)
         * creating the render result */
        if ((re->r.scemode & (R_NO_FRAME_UPDATE | R_BUTS_PREVIEW)) == 0) {
                BKE_scene_graph_update_for_newframe(re->eval_ctx, re->depsgraph, re->main, re->scene, NULL);
-               render_update_anim_renderdata(re, &re->scene->r);
+               render_update_anim_renderdata(re, &re->scene->r, &re->scene->render_layers);
        }
 
        /* create render result */
@@ -777,12 +777,12 @@ int RE_engine_render(Render *re, int do_all)
        return 1;
 }
 
-void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl,
+void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct SceneLayer *scene_layer,
                              const char *name, int UNUSED(channels), const char *UNUSED(chanid), int type)
 {
        /* The channel information is currently not used, but is part of the API in case it's needed in the future. */
 
-       if (!(scene && srl && engine)) {
+       if (!(scene && scene_layer && engine)) {
                return;
        }
 
@@ -792,7 +792,7 @@ void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, s
        Scene *sce;
        for (sce = G.main->scene.first; sce; sce = sce->id.next) {
                if (sce->nodetree) {
-                       ntreeCompositRegisterPass(sce->nodetree, scene, srl, name, type);
+                       ntreeCompositRegisterPass(sce->nodetree, scene, scene_layer, name, type);
                }
        }
 }
index 951a66cadeb44ac53bd2f2943c6872606b84a479..ed74696ba782bdb70ed6d91441e669d305c5a34b 100644 (file)
@@ -264,7 +264,7 @@ RenderResult *RE_MultilayerConvert(void *exrhandle, const char *colorspace, bool
 
 RenderLayer *render_get_active_layer(Render *re, RenderResult *rr)
 {
-       RenderLayer *rl = BLI_findlink(&rr->layers, re->r.actlay);
+       RenderLayer *rl = BLI_findlink(&rr->layers, re->active_layer);
        
        if (rl)
                return rl;
@@ -274,21 +274,21 @@ RenderLayer *render_get_active_layer(Render *re, RenderResult *rr)
 
 static int render_scene_needs_vector(Render *re)
 {
-       SceneRenderLayer *srl;
-       
-       for (srl = re->r.layers.first; srl; srl = srl->next)
-               if (!(srl->layflag & SCE_LAY_DISABLE))
-                       if (srl->passflag & SCE_PASS_VECTOR)
+       SceneLayer *scene_layer;
+       for (scene_layer = re->render_layers.first; scene_layer; scene_layer = scene_layer->next)
+               if (scene_layer->flag & SCENE_LAYER_RENDER) {
+                       if (scene_layer->passflag & SCE_PASS_VECTOR) {
                                return 1;
-
+                       }
+               }
        return 0;
 }
 
 static bool render_scene_has_layers_to_render(Scene *scene)
 {
-       SceneRenderLayer *srl;
-       for (srl = scene->r.layers.first; srl; srl = srl->next) {
-               if (!(srl->layflag & SCE_LAY_DISABLE)) {
+       SceneLayer *scene_layer;
+       for (scene_layer = scene->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
+               if (scene_layer->flag & SCENE_LAYER_RENDER) {
                        return true;
                }
        }
@@ -584,7 +584,7 @@ void RE_FreeRender(Render *re)
        BLI_rw_mutex_end(&re->resultmutex);
        BLI_rw_mutex_end(&re->partsmutex);
 
-       BLI_freelistN(&re->r.layers);
+       BLI_freelistN(&re->render_layers);
        BLI_freelistN(&re->r.views);
 
        curvemapping_free_data(&re->r.mblur_shutter_curve);
@@ -730,13 +730,11 @@ static void re_init_resolution(Render *re, Render *source,
 
 void render_copy_renderdata(RenderData *to, RenderData *from)
 {
-       BLI_freelistN(&to->layers);
        BLI_freelistN(&to->views);
        curvemapping_free_data(&to->mblur_shutter_curve);
 
        *to = *from;
 
-       BLI_duplicatelist(&to->layers, &from->layers);
        BLI_duplicatelist(&to->views, &from->views);
        curvemapping_copy_data(&to->mblur_shutter_curve, &from->mblur_shutter_curve);
 }
@@ -749,7 +747,8 @@ void render_copy_viewrender(ViewRender *to, ViewRender *from)
 /* what doesn't change during entire render sequence */
 /* disprect is optional, if NULL it assumes full window render */
 void RE_InitState(Render *re, Render *source, RenderData *rd,
-                  ViewRender *view_render, SceneRenderLayer *srl,
+                  ListBase *render_layers, const int active_layer,
+                  ViewRender *view_render, SceneLayer *scene_layer,
                   int winx, int winy, rcti *disprect)
 {
        bool had_freestyle = (re->r.mode & R_EDGE_FRS) != 0;
@@ -761,6 +760,9 @@ void RE_InitState(Render *re, Render *source, RenderData *rd,
        /* copy render data and render layers for thread safety */
        render_copy_renderdata(&re->r, rd);
        render_copy_viewrender(&re->view_render, view_render);
+       BLI_freelistN(&re->render_layers);
+       BLI_duplicatelist(&re->render_layers, render_layers);
+       re->active_layer = active_layer;
 
        if (source) {
                /* reuse border flags from source renderer */
@@ -809,10 +811,10 @@ void RE_InitState(Render *re, Render *source, RenderData *rd,
                else re->osa = 0;
        }
        
-       if (srl) {
-               int index = BLI_findindex(&rd->layers, srl);
+       if (scene_layer) {
+               int index = BLI_findindex(render_layers, scene_layer);
                if (index != -1) {
-                       re->r.actlay = index;
+                       re->active_layer = index;
                        re->r.scemode |= R_SINGLE_LAYER;
                }
        }
@@ -830,12 +832,12 @@ void RE_InitState(Render *re, Render *source, RenderData *rd,
                        re->result = NULL;
                }
                else if (re->result) {
-                       SceneRenderLayer *actsrl = BLI_findlink(&re->r.layers, re->r.actlay);
+                       SceneLayer *active_render_layer = BLI_findlink(&re->render_layers, re->active_layer);
                        RenderLayer *rl;
                        bool have_layer = false;
 
                        for (rl = re->result->layers.first; rl; rl = rl->next)
-                               if (STREQ(rl->name, actsrl->name))
+                               if (STREQ(rl->name, active_render_layer->name))
                                        have_layer = true;
 
                        if (re->result->rectx == re->rectx && re->result->recty == re->recty &&
@@ -960,7 +962,7 @@ void RE_ChangeModeFlag(Render *re, int flag, bool clear)
 
 /* update some variables that can be animated, and otherwise wouldn't be due to
  * RenderData getting copied once at the start of animation render */
-void render_update_anim_renderdata(Render *re, RenderData *rd)
+void render_update_anim_renderdata(Render *re, RenderData *rd, ListBase *render_layers)
 {
        /* filter */
        re->r.gauss = rd->gauss;
@@ -974,8 +976,8 @@ void render_update_anim_renderdata(Render *re, RenderData *rd)
        re->r.unit_line_thickness = rd->unit_line_thickness;
 
        /* render layers */
-       BLI_freelistN(&re->r.layers);
-       BLI_duplicatelist(&re->r.layers, &rd->layers);
+       BLI_freelistN(&re->render_layers);
+       BLI_duplicatelist(&re->render_layers, render_layers);
 
        /* render views */
        BLI_freelistN(&re->r.views);
@@ -1977,7 +1979,7 @@ static void render_scene(Render *re, Scene *sce, int cfra)
        }
        
        /* initial setup */
-       RE_InitState(resc, re, &sce->r, &sce->view_render, NULL, winx, winy, &re->disprect);
+       RE_InitState(resc, re, &sce->r, &sce->render_layers, sce->active_layer, &sce->view_render, NULL, winx, winy, &re->disprect);
 
        /* We still want to use 'rendercache' setting from org (main) scene... */
        resc->r.scemode = (resc->r.scemode & ~R_EXR_CACHE_FILE) | (re->r.scemode & R_EXR_CACHE_FILE);
@@ -2248,24 +2250,24 @@ static void init_freestyle(Render *re)
 /* invokes Freestyle stroke rendering */
 static void add_freestyle(Render *re, int render)
 {
-       SceneRenderLayer *srl, *actsrl;
+       SceneLayer *scene_layer, *active_render_layer;
        LinkData *link;
        Render *r;
        const bool do_link = (re->r.mode & R_MBLUR) == 0 || re->i.curblur == re->r.mblur_samples;
 
-       actsrl = BLI_findlink(&re->r.layers, re->r.actlay);
+       active_render_layer = BLI_findlink(&re->render_layers, re->active_layer);
 
        FRS_begin_stroke_rendering(re);
 
-       for (srl = (SceneRenderLayer *)re->r.layers.first; srl; srl = srl->next) {
+       for (scene_layer = (SceneLayer *)re->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
                if (do_link) {
                        link = (LinkData *)MEM_callocN(sizeof(LinkData), "LinkData to Freestyle render");
                        BLI_addtail(&re->freestyle_renders, link);
                }
-               if ((re->r.scemode & R_SINGLE_LAYER) && srl != actsrl)
+               if ((re->r.scemode & R_SINGLE_LAYER) && scene_layer != active_render_layer)
                        continue;
-               if (FRS_is_freestyle_enabled(srl)) {
-                       r = FRS_do_stroke_rendering(re, srl, render);
+               if (FRS_is_freestyle_enabled(scene_layer)) {
+                       r = FRS_do_stroke_rendering(re, scene_layer, render);
                        if (do_link)
                                link->data = (void *)r;
                }
@@ -2282,25 +2284,25 @@ static void composite_freestyle_renders(Render *re, int sample)
 {
        Render *freestyle_render;
        RenderView *rv;
-       SceneRenderLayer *srl, *actsrl;
+       SceneLayer *scene_layer, *active_scene_layer;
        LinkData *link;
 
-       actsrl = BLI_findlink(&re->r.layers, re->r.actlay);
+       active_scene_layer = BLI_findlink(&re->render_layers, re->active_layer);
 
        link = (LinkData *)re->freestyle_renders.first;
 
        for (rv = re->result->views.first; rv; rv = rv->next) {
-               for (srl = (SceneRenderLayer *)re->r.layers.first; srl; srl = srl->next) {
-                       if ((re->r.scemode & R_SINGLE_LAYER) && srl != actsrl)
+               for (scene_layer = (SceneLayer *)re->render_layers.first; scene_layer; scene_layer = scene_layer->next) {
+                       if ((re->r.scemode & R_SINGLE_LAYER) && scene_layer != active_scene_layer)
                                continue;
 
-                       if (FRS_is_freestyle_enabled(srl)) {
+                       if (FRS_is_freestyle_enabled(scene_layer)) {
                                freestyle_render = (Render *)link->data;
 
                                /* may be NULL in case of empty render layer */
                                if (freestyle_render) {
                                        render_result_exr_file_read_sample(freestyle_render, sample);
-                                       FRS_composite_result(re, srl, freestyle_render);
+                                       FRS_composite_result(re, scene_layer, freestyle_render);
                                        RE_FreeRenderResult(freestyle_render->result);
                                        freestyle_render->result = NULL;
                                }
@@ -2880,10 +2882,10 @@ bool RE_force_single_renderlayer(Scene *scene)
 {
        int scemode = check_mode_full_sample(&scene->r, &scene->view_render);
        if (scemode & R_SINGLE_LAYER) {
-               SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
+               SceneLayer *scene_layer = BLI_findlink(&scene->render_layers, scene->active_layer);
                /* force layer to be enabled */
-               if (srl->layflag & SCE_LAY_DISABLE) {
-                       srl->layflag &= ~SCE_LAY_DISABLE;
+               if ((scene_layer->flag & SCENE_LAYER_RENDER) == 0) {
+                       scene_layer->flag |= SCENE_LAYER_RENDER;
                        return true;
                }
        }
@@ -3174,7 +3176,7 @@ void RE_SetEngineByID(Render *re, const char *engine_id)
 
 /* evaluating scene options for general Blender render */
 static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain, Scene *scene, ViewRender *view_render,
-                                       SceneRenderLayer *srl, Object *camera_override, unsigned int lay_override,
+                                       SceneLayer *scene_layer, Object *camera_override, unsigned int lay_override,
                                        int anim, int anim_init)
 {
        int winx, winy;
@@ -3213,7 +3215,7 @@ static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain,
 
        /* not too nice, but it survives anim-border render */
        if (anim) {
-               render_update_anim_renderdata(re, &scene->r);
+               render_update_anim_renderdata(re, &scene->r, &scene->render_layers);
                re->disprect = disprect;
                return 1;
        }
@@ -3228,17 +3230,17 @@ static int render_initialize_from_main(Render *re, RenderData *rd, Main *bmain,
         */
        if (0) {
                /* make sure dynamics are up to date */
-               SceneLayer *scene_layer = BKE_scene_layer_from_scene_get(scene);
+               scene_layer = BKE_scene_layer_from_scene_get(scene);
                update_physics_cache(re, scene, scene_layer, anim_init);
        }
        
-       if (srl || scene->r.scemode & R_SINGLE_LAYER) {
+       if (scene_layer || scene->r.scemode & R_SINGLE_LAYER) {
                BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE);
                render_result_single_layer_begin(re);
                BLI_rw_mutex_unlock(&re->resultmutex);
        }
        
-       RE_InitState(re, NULL, &scene->r, &scene->view_render, srl, winx, winy, &disprect);
+       RE_InitState(re, NULL, &scene->r, &scene->render_layers, scene->active_layer, &scene->view_render, scene_layer, winx, winy, &disprect);
        if (!re->ok)  /* if an error was printed, abort */
                return 0;
        
@@ -3259,7 +3261,7 @@ void RE_SetReports(Render *re, ReportList *reports)
 }
 
 /* general Blender frame render call */
-void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, Object *camera_override,
+void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneLayer *scene_layer, Object *camera_override,
                      unsigned int lay_override, int frame, const bool write_still)
 {
        BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_INIT);
@@ -3269,7 +3271,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
        
        scene->r.cfra = frame;
        
-       if (render_initialize_from_main(re, &scene->r, bmain, scene, &scene->view_render, srl,
+       if (render_initialize_from_main(re, &scene->r, bmain, scene, &scene->view_render, scene_layer,
                                        camera_override, lay_override, 0, 0))
        {
                MEM_reset_peak_memory();
@@ -3855,7 +3857,7 @@ void RE_PreviewRender(Render *re, Main *bmain, Scene *sce, ViewRender *view_rend
        winx = (sce->r.size * sce->r.xsch) / 100;
        winy = (sce->r.size * sce->r.ysch) / 100;
 
-       RE_InitState(re, NULL, &sce->r, view_render, NULL, winx, winy, NULL);
+       RE_InitState(re, NULL, &sce->r, &sce->render_layers, sce->active_layer, view_render, NULL, winx, winy, NULL);
 
        re->pool = BKE_image_pool_new();
 
@@ -3910,7 +3912,7 @@ bool RE_ReadRenderResult(Scene *scene, Scene *scenode)
        re = RE_GetSceneRender(scene);
        if (re == NULL)
                re = RE_NewSceneRender(scene);
-       RE_InitState(re, NULL, &scene->r, &scene->view_render, NULL, winx, winy, &disprect);
+       RE_InitState(re, NULL, &scene->r, &scene->render_layers, scene->active_layer, &scene->view_render, NULL, winx, winy, &disprect);
        re->scene = scene;
        re->scene_color_manage = BKE_scene_check_color_management_enabled(scene);
        
index f5f36b88c1d9cfc0ba150442a7a52350b45c315d..1b19307b9e82a5344f1c234d245bdf46493a3e37 100644 (file)
@@ -264,7 +264,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
        RenderResult *rr;
        RenderLayer *rl;
        RenderView *rv;
-       SceneRenderLayer *srl;
+       SceneLayer *scene_layer;
        int rectx, recty;
        int nr;
        
@@ -294,27 +294,30 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
        render_result_views_new(rr, &re->r);
 
        /* check renderdata for amount of layers */
-       for (nr = 0, srl = re->r.layers.first; srl; srl = srl->next, nr++) {
+       for (nr = 0, scene_layer = re->render_layers.first; scene_layer; scene_layer = scene_layer->next, nr++) {
 
                if (layername && layername[0])
-                       if (!STREQ(srl->name, layername))
+                       if (!STREQ(scene_layer->name, layername))
                                continue;
 
                if (re->r.scemode & R_SINGLE_LAYER) {
-                       if (nr != re->r.actlay)
+                       if (nr != re->active_layer) {
                                continue;
+                       }
                }
                else {
-                       if (srl->layflag & SCE_LAY_DISABLE)
+                       if ((scene_layer->flag & SCENE_LAYER_RENDER) == 0) {
                                continue;
+                       }
                }
                
                rl = MEM_callocN(sizeof(RenderLayer), "new render layer");
                BLI_addtail(&rr->layers, rl);
                
-               BLI_strncpy(rl->name, srl->name, sizeof(rl->name));
-               rl->passflag = srl->passflag; /* for debugging: srl->passflag | SCE_PASS_RAYHITS; */
-               rl->pass_xor = srl->pass_xor;
+               BLI_strncpy(rl->name, scene_layer->name, sizeof(rl->name));
+               rl->layflag = scene_layer->layflag;
+               rl->passflag = scene_layer->passflag; /* for debugging: scene_layer->passflag | SCE_PASS_RAYHITS; */
+               rl->pass_xor = scene_layer->pass_xor;
                rl->rectx = rectx;
                rl->recty = recty;
                
@@ -349,65 +352,65 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
                        /* a renderlayer should always have a Combined pass*/
                        render_layer_add_pass(rr, rl, 4, "Combined", view, "RGBA");
 
-                       if (srl->passflag  & SCE_PASS_Z)
+                       if (scene_layer->passflag  & SCE_PASS_Z)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 1, RE_PASSNAME_Z, view, "Z");
-                       if (srl->passflag  & SCE_PASS_VECTOR)
+                       if (scene_layer->passflag  & SCE_PASS_VECTOR)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 4, RE_PASSNAME_VECTOR, view, "XYZW");
-                       if (srl->passflag  & SCE_PASS_NORMAL)
+                       if (scene_layer->passflag  & SCE_PASS_NORMAL)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_NORMAL, view, "XYZ");
-                       if (srl->passflag  & SCE_PASS_UV)
+                       if (scene_layer->passflag  & SCE_PASS_UV)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_UV, view, "UVA");
-                       if (srl->passflag  & SCE_PASS_RGBA)
+                       if (scene_layer->passflag  & SCE_PASS_RGBA)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 4, RE_PASSNAME_RGBA, view, "RGBA");
-                       if (srl->passflag  & SCE_PASS_EMIT)
+                       if (scene_layer->passflag  & SCE_PASS_EMIT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_EMIT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_DIFFUSE)
+                       if (scene_layer->passflag  & SCE_PASS_DIFFUSE)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_DIFFUSE, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_SPEC)
+                       if (scene_layer->passflag  & SCE_PASS_SPEC)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_SPEC, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_AO)
+                       if (scene_layer->passflag  & SCE_PASS_AO)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_AO, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_ENVIRONMENT)
+                       if (scene_layer->passflag  & SCE_PASS_ENVIRONMENT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_ENVIRONMENT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_INDIRECT)
+                       if (scene_layer->passflag  & SCE_PASS_INDIRECT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_INDIRECT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_SHADOW)
+                       if (scene_layer->passflag  & SCE_PASS_SHADOW)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_SHADOW, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_REFLECT)
+                       if (scene_layer->passflag  & SCE_PASS_REFLECT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_REFLECT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_REFRACT)
+                       if (scene_layer->passflag  & SCE_PASS_REFRACT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_REFRACT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_INDEXOB)
+                       if (scene_layer->passflag  & SCE_PASS_INDEXOB)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 1, RE_PASSNAME_INDEXOB, view, "X");
-                       if (srl->passflag  & SCE_PASS_INDEXMA)
+                       if (scene_layer->passflag  & SCE_PASS_INDEXMA)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 1, RE_PASSNAME_INDEXMA, view, "X");
-                       if (srl->passflag  & SCE_PASS_MIST)
+                       if (scene_layer->passflag  & SCE_PASS_MIST)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 1, RE_PASSNAME_MIST, view, "Z");
                        if (rl->passflag & SCE_PASS_RAYHITS)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 4, RE_PASSNAME_RAYHITS, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_DIFFUSE_DIRECT)
+                       if (scene_layer->passflag  & SCE_PASS_DIFFUSE_DIRECT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_DIFFUSE_DIRECT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_DIFFUSE_INDIRECT)
+                       if (scene_layer->passflag  & SCE_PASS_DIFFUSE_INDIRECT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_DIFFUSE_INDIRECT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_DIFFUSE_COLOR)
+                       if (scene_layer->passflag  & SCE_PASS_DIFFUSE_COLOR)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_DIFFUSE_COLOR, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_GLOSSY_DIRECT)
+                       if (scene_layer->passflag  & SCE_PASS_GLOSSY_DIRECT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_GLOSSY_DIRECT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_GLOSSY_INDIRECT)
+                       if (scene_layer->passflag  & SCE_PASS_GLOSSY_INDIRECT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_GLOSSY_INDIRECT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_GLOSSY_COLOR)
+                       if (scene_layer->passflag  & SCE_PASS_GLOSSY_COLOR)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_GLOSSY_COLOR, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_TRANSM_DIRECT)
+                       if (scene_layer->passflag  & SCE_PASS_TRANSM_DIRECT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_TRANSM_DIRECT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_TRANSM_INDIRECT)
+                       if (scene_layer->passflag  & SCE_PASS_TRANSM_INDIRECT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_TRANSM_INDIRECT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_TRANSM_COLOR)
+                       if (scene_layer->passflag  & SCE_PASS_TRANSM_COLOR)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_TRANSM_COLOR, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_SUBSURFACE_DIRECT)
+                       if (scene_layer->passflag  & SCE_PASS_SUBSURFACE_DIRECT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_SUBSURFACE_DIRECT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_SUBSURFACE_INDIRECT)
+                       if (scene_layer->passflag  & SCE_PASS_SUBSURFACE_INDIRECT)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_SUBSURFACE_INDIRECT, view, "RGB");
-                       if (srl->passflag  & SCE_PASS_SUBSURFACE_COLOR)
+                       if (scene_layer->passflag  & SCE_PASS_SUBSURFACE_COLOR)
                                RENDER_LAYER_ADD_PASS_SAFE(rr, rl, 3, RE_PASSNAME_SUBSURFACE_COLOR, view, "RGB");
 #undef RENDER_LAYER_ADD_PASS_SAFE
                }
@@ -444,7 +447,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
                rl->layflag = 0x7FFF;    /* solid ztra halo strand */
                rl->passflag = SCE_PASS_COMBINED;
                
-               re->r.actlay = 0;
+               re->active_layer = 0;
        }
        
        /* border render; calculate offset for use in compositor. compo is centralized coords */
@@ -975,7 +978,7 @@ void render_result_single_layer_begin(Render *re)
 /* if scemode is R_SINGLE_LAYER, at end of rendering, merge the both render results */
 void render_result_single_layer_end(Render *re)
 {
-       SceneRenderLayer *srl;
+       SceneLayer *scene_layer;
        RenderLayer *rlpush;
        RenderLayer *rl;
        int nr;
@@ -996,12 +999,12 @@ void render_result_single_layer_end(Render *re)
                BLI_remlink(&re->result->layers, rl);
                
                /* reconstruct render result layers */
-               for (nr = 0, srl = re->r.layers.first; srl; srl = srl->next, nr++) {
-                       if (nr == re->r.actlay) {
+               for (nr = 0, scene_layer = re->render_layers.first; scene_layer; scene_layer = scene_layer->next, nr++) {
+                       if (nr == re->active_layer) {
                                BLI_addtail(&re->result->layers, rl);
                        }
                        else {
-                               rlpush = RE_GetRenderLayer(re->pushedresult, srl->name);
+                               rlpush = RE_GetRenderLayer(re->pushedresult, scene_layer->name);
                                if (rlpush) {
                                        BLI_remlink(&re->pushedresult->layers, rlpush);
                                        BLI_addtail(&re->result->layers, rlpush);
index 71d233e7d702363d78374dd74afaa58145956677..a129e64db4983d2c6c98fd29523c8edcd16fb46b 100644 (file)
@@ -1992,18 +1992,18 @@ void add_halo_flare(Render *re)
        }
 }
 
-void render_internal_update_passes(RenderEngine *engine, Scene *scene, SceneRenderLayer *srl)
+void render_internal_update_passes(RenderEngine *engine, Scene *scene, SceneLayer *scene_layer)
 {
        int type;
 
-       RE_engine_register_pass(engine, scene, srl, RE_PASSNAME_COMBINED, 4, "RGBA", SOCK_RGBA);
+       RE_engine_register_pass(engine, scene, scene_layer, RE_PASSNAME_COMBINED, 4, "RGBA", SOCK_RGBA);
 
 #define CHECK_PASS(name, channels, chanid) \
-       if (srl->passflag & (SCE_PASS_ ## name)) { \
+       if (scene_layer->passflag & (SCE_PASS_ ## name)) { \
                if (channels == 4) type = SOCK_RGBA; \
                else if (channels == 3) type = SOCK_VECTOR; \
                else type = SOCK_FLOAT; \
-               RE_engine_register_pass(engine, scene, srl, RE_PASSNAME_ ## name, channels, chanid, type); \
+               RE_engine_register_pass(engine, scene, scene_layer, RE_PASSNAME_ ## name, channels, chanid, type); \
        }
 
        CHECK_PASS(Z,           1, "Z");
index f24df74bf7514f0af9f68f1eafcd37286fb13de4..40e904259af377ad9a3aeabace22ad115958f3a3 100644 (file)
@@ -314,7 +314,7 @@ double elbeemEstimateMemreq(int res, float sx, float sy, float sz, int refine, c
 struct Render *RE_NewRender(const char *name) RET_NULL
 struct Render *RE_NewSceneRender(const struct Scene *scene) RET_NULL
 void RE_SwapResult(struct Render *re, struct RenderResult **rr) RET_NONE
-void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct SceneRenderLayer *srl, struct Object *camera_override, unsigned int lay_override, int frame, const bool write_still) RET_NONE
+void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct SceneLayer *scene_layer, struct Object *camera_override, unsigned int lay_override, int frame, const bool write_still) RET_NONE
 bool RE_WriteEnvmapResult(struct ReportList *reports, struct Scene *scene, struct EnvMap *env, const char *relpath, const char imtype, float layout[12]) RET_ZERO
 
 /* rna */
@@ -765,7 +765,7 @@ void RE_point_density_free(struct PointDensity *pd) RET_NONE
 void RE_instance_get_particle_info(struct ObjectInstanceRen *obi, float *index, float *age, float *lifetime, float co[3], float *size, float vel[3], float angvel[3]) RET_NONE
 void RE_FreeAllPersistentData(void) RET_NONE
 float RE_fresnel_dielectric(float incoming[3], float normal[3], float eta) RET_ZERO
-void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct SceneRenderLayer *srl, const char *name, int channels, const char *chanid, int type) RET_NONE
+void RE_engine_register_pass(struct RenderEngine *engine, struct Scene *scene, struct SceneLayer *scene_layer, const char *name, int channels, const char *chanid, int type) RET_NONE
 struct SceneLayer *RE_engine_get_scene_layer(struct Render *re) RET_NULL
 void RE_SetDepsgraph(struct Render *re, struct Depsgraph *graph) RET_NONE