SceneRenderLayer Removal/Refactor
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user