diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-11-15 17:08:59 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-11-22 12:13:33 +0300 |
commit | d276e45ee6c2ae6d67177552f4c5f27cd99bdd83 (patch) | |
tree | 890c5e98fa2512a1d5946a3738ef73beac4443f5 | |
parent | e22ca0fb860ed945eb3438bfe6dba8040cfd7cf3 (diff) |
SceneRenderLayer > SceneLayer: Convert Z-Mask
Note: Cycles still need to implement the per-object holdout
(similar to how we do shadow catcher).
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/blender/blender_sync.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_layer.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 9 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 20 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 7 | ||||
-rw-r--r-- | source/blender/render/extern/include/RE_pipeline.h | 2 | ||||
-rw-r--r-- | source/blender/render/intern/source/render_result.c | 1 | ||||
-rw-r--r-- | source/blender/render/intern/source/zbuf.c | 2 |
10 files changed, 33 insertions, 16 deletions
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 2135d72e877..be2fadcc574 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -398,7 +398,7 @@ void BlenderSync::sync_render_layers(BL::SpaceView3D& b_v3d, const char *layer) if((!layer && first_layer) || (layer && b_rlay->name() == layer)) { render_layer.name = b_rlay->name(); - render_layer.holdout_layer = get_layer(b_rlay->layers_zmask()); + render_layer.holdout_layer = 0; render_layer.exclude_layer = 0; render_layer.scene_layer = scene_layers & ~render_layer.exclude_layer; diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index a68b6a03906..57405b74ecc 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -200,7 +200,7 @@ private: string name; uint scene_layer; uint layer; - uint holdout_layer; + uint holdout_layer; /* This can be safely removed from Cycles. */ uint exclude_layer; /* This can be safely removed from Cycles. */ BL::Material material_override; /* This can be safely removed from Cycles. */ bool use_background_shader; diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index d195c98396b..3b1bb5175a2 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -111,6 +111,8 @@ void BKE_layer_sync_object_unlink(const struct Scene *scene, struct SceneCollect void BKE_override_scene_layer_datablock_add(struct SceneLayer *scene_layer, int id_type, const char *data_path, const struct ID *id); void BKE_override_scene_layer_int_add(struct SceneLayer *scene_layer, int id_type, const char *data_path, const int value); +void BKE_override_layer_collection_boolean_add(struct LayerCollection *layer_collection, int id_type, const char *data_path, const bool value); + /* engine settings */ typedef void (*EngineSettingsCB)(struct RenderEngine *engine, struct IDProperty *props); diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index f7866922c1c..59da7c84b45 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1075,6 +1075,15 @@ void BKE_override_scene_layer_int_add(SceneLayer *scene_layer, int id_type, cons TODO_LAYER_OVERRIDE; } +/** + * Add a new boolean override + */ +void BKE_override_layer_collection_boolean_add(struct LayerCollection *layer_collection, int id_type, const char *data_path, const bool value) +{ + UNUSED_VARS(layer_collection, id_type, data_path, value); + TODO_LAYER_OVERRIDE; +} + /* ---------------------------------------------------------------------- */ /* Engine Settings */ diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index f6801d22a53..44ce2014e99 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -330,9 +330,14 @@ void do_versions_after_linking_280(Main *main) /* Add new collection bases. */ for (int layer = 0; layer < 20; layer++) { - if ((scene->lay & (1 << layer)) && - (srl->lay & (1 << layer)) && - ((srl->lay_exclude & (1 << layer)) == 0)) + if (( + (scene->lay & (1 << layer)) && + (srl->lay & (1 << layer)) && + ((srl->lay_exclude & (1 << layer)) == 0)) || + ( + (srl->lay_zmask & (1 << layer)) && + ((scene->lay | srl->lay_exclude) & (1 << layer))) + ) { if (collections[DO_VERSION_COLLECTION_VISIBLE].created & (1 << layer)) { @@ -340,6 +345,14 @@ void do_versions_after_linking_280(Main *main) layer_collection_parent = BKE_collection_link(scene_layer, collections[DO_VERSION_COLLECTION_VISIBLE].collections[layer]); + if (srl->lay_zmask & (1 << layer)) { + BKE_override_layer_collection_boolean_add( + layer_collection_parent, + ID_OB, + "cycles.is_holdout", + true); + } + LayerCollection *layer_collection_child; layer_collection_child = layer_collection_parent->layer_collections.first; @@ -350,6 +363,7 @@ void do_versions_after_linking_280(Main *main) if (collections[j].flag_render & COLLECTION_DISABLED) { BKE_collection_disable(scene_layer, layer_collection_child); } + layer_collection_child = layer_collection_child->next; } } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 7c93febc69f..2f9487bb17e 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -177,7 +177,7 @@ typedef struct SceneRenderLayer { struct Material *mat_override DNA_DEPRECATED; /* Converted to SceneLayer override. */ unsigned int lay; /* scene->lay itself has priority over this */ - unsigned int lay_zmask; /* has to be after lay, this is for Z-masking */ + unsigned int lay_zmask DNA_DEPRECATED; /* Converted to LayerCollection cycles holdout override. */ unsigned int lay_exclude DNA_DEPRECATED; int layflag; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d62741d9383..93b970482f6 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3293,13 +3293,6 @@ void rna_def_render_layer_common(StructRNA *srna, int scene) /* this seems to be too much trouble with depsgraph updates/etc. currently (20140423) */ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); - prop = RNA_def_property(srna, "layers_zmask", PROP_BOOLEAN, PROP_LAYER); - RNA_def_property_boolean_sdna(prop, NULL, "lay_zmask", 1); - RNA_def_property_array(prop, 20); - RNA_def_property_ui_text(prop, "Zmask Layers", "Zmask scene layers for solid faces"); - 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); - if (scene) { prop = RNA_def_property(srna, "pass_alpha_threshold", PROP_FLOAT, PROP_FACTOR); RNA_def_property_ui_text(prop, "Alpha Threshold", diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 97b3af6c1b4..2e9ab10f1c0 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -108,7 +108,7 @@ typedef struct RenderLayer { /* copy of RenderData */ char name[RE_MAXNAME]; - unsigned int lay, lay_zmask; + unsigned int lay; int layflag, passflag, pass_xor; /* MULTIVIEW_TODO: acolrect and scolrect are not supported by multiview at the moment. diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index ecd8d853586..d1a434841e4 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -314,7 +314,6 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf BLI_strncpy(rl->name, srl->name, sizeof(rl->name)); rl->lay = srl->lay; - rl->lay_zmask = srl->lay_zmask; rl->layflag = srl->layflag; rl->passflag = srl->passflag; /* for debugging: srl->passflag | SCE_PASS_RAYHITS; */ rl->pass_xor = srl->pass_xor; diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 1481e7a8059..55f2335f9e8 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -2066,7 +2066,7 @@ void zbuffer_solid(RenderPart *pa, RenderLayer *rl, void(*fillfunc)(RenderPart * ObjectRen *obr; float obwinmat[4][4], winmat[4][4], bounds[4]; float ho1[4], ho2[4], ho3[4], ho4[4]={0}; - unsigned int lay= rl->lay, lay_zmask= rl->lay_zmask; + unsigned int lay= rl->lay, lay_zmask= 0; int i, v, zvlnr, zsample, samples, c1, c2, c3, c4=0; short nofill=0, env=0, wire=0, zmaskpass=0; const bool all_z = (rl->layflag & SCE_LAY_ALL_Z) && !(rl->layflag & SCE_LAY_ZMASK); |