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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-12-14 16:46:49 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-12-15 13:56:48 +0300
commit1f5106de610b115b87ab6121d7871d447ca48cd2 (patch)
treed929ef94556eac6063c24983cc6b89f52075701c
parent7402b8ec74b4f74371d92816d22869ec9bd95da4 (diff)
Group collection viewport/render options and remove collection visibility
Users can change the group collection visibility in the outliner when looking at groups. Regular collections on the other hand don't have any special visibility control, if you need a collection to be invisible during render, either don't link it into the view layer used for F12, or disable it. This includes: * Updated unittests - update your lib/tests/layers folder. * Subversion bump - branches be aware of that. Note: Although we are using eval_ctx to determine the visibility of a group collection when rendering, the depsgraph is still using the same depsgraph for the viewport and the render engine, so at the moment the render visibility is ignored. Following next is a workaround for this separately to tag the groups before and after rendering to tackle that.
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenkernel/BKE_layer.h1
-rw-r--r--source/blender/blenkernel/intern/layer.c56
-rw-r--r--source/blender/blenloader/intern/versioning_280.c66
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_query.h8
-rw-r--r--source/blender/draw/engines/eevee/eevee_engine.c4
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightprobes.c9
-rw-r--r--source/blender/draw/intern/draw_manager.c4
-rw-r--r--source/blender/draw/modes/object_mode.c4
-rw-r--r--source/blender/editors/render/render_preview.c5
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c5
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c105
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h10
-rw-r--r--source/blender/makesdna/DNA_layer_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_layer.c78
-rw-r--r--source/blender/makesrna/intern/rna_object.c21
-rw-r--r--tests/python/view_layer/test_evaluation_selectability_a.py2
-rw-r--r--tests/python/view_layer/test_evaluation_selectability_b.py4
-rw-r--r--tests/python/view_layer/test_evaluation_selectability_c.py2
-rw-r--r--tests/python/view_layer/test_evaluation_selectability_d.py4
-rw-r--r--tests/python/view_layer/test_evaluation_selectability_e.py6
-rw-r--r--tests/python/view_layer/test_evaluation_selectability_f.py4
-rw-r--r--tests/python/view_layer/test_evaluation_visibility_a.py4
-rw-r--r--tests/python/view_layer/test_evaluation_visibility_b.py6
-rw-r--r--tests/python/view_layer/test_evaluation_visibility_c.py6
-rw-r--r--tests/python/view_layer/test_evaluation_visibility_d.py2
-rw-r--r--tests/python/view_layer/test_evaluation_visibility_e.py4
-rw-r--r--tests/python/view_layer/test_evaluation_visibility_f.py6
-rw-r--r--tests/python/view_layer/test_group_b.py16
-rw-r--r--tests/python/view_layer/test_move_above_below_layer_collection_f.py12
-rw-r--r--tests/python/view_layer/test_move_above_below_layer_collection_g.py12
-rw-r--r--tests/python/view_layer/test_move_above_below_layer_collection_h.py12
-rw-r--r--tests/python/view_layer/test_move_above_below_layer_collection_i.py8
-rw-r--r--tests/python/view_layer/test_move_above_below_layer_collection_j.py8
-rw-r--r--tests/python/view_layer/test_move_into_layer_collection_f.py8
-rw-r--r--tests/python/view_layer/test_move_into_layer_collection_g.py12
-rw-r--r--tests/python/view_layer/test_move_into_layer_collection_h.py8
-rw-r--r--tests/python/view_layer/test_scene_copy_f.py24
38 files changed, 248 insertions, 303 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 8d326c6441c..27223afe4ff 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 2
+#define BLENDER_SUBVERSION 3
/* Several breakages with 270, e.g. constraint deg vs rad */
#define BLENDER_MINVERSION 270
#define BLENDER_MINSUBVERSION 6
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h
index e4f8b8790f6..6a762c9b711 100644
--- a/source/blender/blenkernel/BKE_layer.h
+++ b/source/blender/blenkernel/BKE_layer.h
@@ -102,7 +102,6 @@ struct LayerCollection *BKE_collection_link(struct ViewLayer *view_layer, struct
void BKE_collection_unlink(struct ViewLayer *view_layer, struct LayerCollection *lc);
void BKE_collection_enable(struct ViewLayer *view_layer, struct LayerCollection *lc);
-void BKE_collection_disable(struct ViewLayer *view_layer, struct LayerCollection *lc);
bool BKE_view_layer_has_collection(struct ViewLayer *view_layer, const struct SceneCollection *sc);
bool BKE_scene_has_object(struct Scene *scene, struct Object *ob);
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c
index 84eb4ee2e33..2e6cd769db8 100644
--- a/source/blender/blenkernel/intern/layer.c
+++ b/source/blender/blenkernel/intern/layer.c
@@ -42,6 +42,8 @@
#include "BKE_node.h"
#include "BKE_workspace.h"
+#include "DEG_depsgraph.h"
+
#include "DNA_group_types.h"
#include "DNA_ID.h"
#include "DNA_layer_types.h"
@@ -1018,7 +1020,8 @@ static void layer_collection_enable(ViewLayer *view_layer, LayerCollection *lc)
/**
* Enable collection
* Add its objects bases to ViewLayer
- * Depsgraph needs to be rebuilt afterwards
+ *
+ * Only around for doversion.
*/
void BKE_collection_enable(ViewLayer *view_layer, LayerCollection *lc)
{
@@ -1030,33 +1033,6 @@ void BKE_collection_enable(ViewLayer *view_layer, LayerCollection *lc)
layer_collection_enable(view_layer, lc);
}
-/**
- * Recursively disable nested collections
- */
-static void layer_collection_disable(ViewLayer *view_layer, LayerCollection *lc)
-{
- layer_collection_objects_unpopulate(view_layer, lc);
-
- for (LayerCollection *nlc = lc->layer_collections.first; nlc; nlc = nlc->next) {
- layer_collection_disable(view_layer, nlc);
- }
-}
-
-/**
- * Disable collection
- * Remove all its object bases from ViewLayer
- * Depsgraph needs to be rebuilt afterwards
- */
-void BKE_collection_disable(ViewLayer *view_layer, LayerCollection *lc)
-{
- if ((lc->flag & COLLECTION_DISABLED) != 0) {
- return;
- }
-
- lc->flag |= COLLECTION_DISABLED;
- layer_collection_disable(view_layer, lc);
-}
-
static void layer_collection_object_add(ViewLayer *view_layer, LayerCollection *lc, Object *ob)
{
Base *base = object_base_add(view_layer, ob);
@@ -1068,7 +1044,7 @@ static void layer_collection_object_add(ViewLayer *view_layer, LayerCollection *
return;
}
- bool is_visible = (lc->flag & COLLECTION_VISIBLE) != 0;
+ bool is_visible = ((lc->flag & COLLECTION_VIEWPORT) != 0) && ((lc->flag & COLLECTION_DISABLED) == 0);
bool is_selectable = is_visible && ((lc->flag & COLLECTION_SELECTABLE) != 0);
if (is_visible) {
@@ -1117,7 +1093,7 @@ static LayerCollection *layer_collection_add(ViewLayer *view_layer, LayerCollect
LayerCollection *lc = MEM_callocN(sizeof(LayerCollection), "Collection Base");
lc->scene_collection = sc;
- lc->flag = COLLECTION_VISIBLE | COLLECTION_SELECTABLE;
+ lc->flag = COLLECTION_SELECTABLE | COLLECTION_VIEWPORT | COLLECTION_RENDER;
lc->properties = IDP_New(IDP_GROUP, &val, ROOT_PROP);
collection_engine_settings_init(lc->properties, false);
@@ -2118,7 +2094,21 @@ static const char *collection_type_lookup[] =
"Group Internal", /* COLLECTION_TYPE_GROUP_INTERNAL */
};
-void BKE_layer_eval_layer_collection(const struct EvaluationContext *UNUSED(eval_ctx),
+static bool layer_collection_visible_get(const EvaluationContext *eval_ctx, LayerCollection *layer_collection)
+{
+ bool is_visible = (layer_collection->flag & COLLECTION_DISABLED) == 0;
+
+ if (eval_ctx->mode == DAG_EVAL_VIEWPORT) {
+ is_visible &= (layer_collection->flag & COLLECTION_VIEWPORT) != 0;
+ }
+ else {
+ is_visible &= (layer_collection->flag & COLLECTION_RENDER) != 0;
+ }
+
+ return is_visible;
+}
+
+void BKE_layer_eval_layer_collection(const EvaluationContext *eval_ctx,
LayerCollection *layer_collection,
LayerCollection *parent_layer_collection)
{
@@ -2134,11 +2124,11 @@ void BKE_layer_eval_layer_collection(const struct EvaluationContext *UNUSED(eval
/* visibility */
layer_collection->flag_evaluated = layer_collection->flag;
- bool is_visible = (layer_collection->flag & COLLECTION_VISIBLE) != 0;
+ bool is_visible = layer_collection_visible_get(eval_ctx, layer_collection);
bool is_selectable = is_visible && ((layer_collection->flag & COLLECTION_SELECTABLE) != 0);
if (parent_layer_collection != NULL) {
- is_visible &= (parent_layer_collection->flag_evaluated & COLLECTION_VISIBLE) != 0;
+ is_visible &= layer_collection_visible_get(eval_ctx, parent_layer_collection);
is_selectable &= (parent_layer_collection->flag_evaluated & COLLECTION_SELECTABLE) != 0;
layer_collection->flag_evaluated &= parent_layer_collection->flag_evaluated;
}
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 163df9987bb..cfe7ffe87a2 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -189,21 +189,21 @@ void do_versions_after_linking_280(Main *main)
.collections = {NULL},
.created = 0,
.suffix = "",
- .flag_viewport = COLLECTION_VISIBLE | COLLECTION_SELECTABLE,
- .flag_render = COLLECTION_VISIBLE | COLLECTION_SELECTABLE
+ .flag_viewport = COLLECTION_SELECTABLE,
+ .flag_render = COLLECTION_SELECTABLE
},
{
.collections = {NULL},
.created = 0,
.suffix = " - Hide Viewport",
.flag_viewport = COLLECTION_SELECTABLE,
- .flag_render = COLLECTION_VISIBLE | COLLECTION_SELECTABLE
+ .flag_render = COLLECTION_SELECTABLE
},
{
.collections = {NULL},
.created = 0,
.suffix = " - Hide Render",
- .flag_viewport = COLLECTION_VISIBLE | COLLECTION_SELECTABLE,
+ .flag_viewport = COLLECTION_SELECTABLE,
.flag_render = COLLECTION_SELECTABLE | COLLECTION_DISABLED
},
{
@@ -391,13 +391,9 @@ void do_versions_after_linking_280(Main *main)
for (int j = 1; j < 4; j++) {
if (collections[j].created & (1 << layer)) {
- layer_collection_child->flag =
- collections[j].flag_render & (~COLLECTION_DISABLED);
-
- if (collections[j].flag_render & COLLECTION_DISABLED) {
- BKE_collection_disable(view_layer, layer_collection_child);
- }
-
+ layer_collection_child->flag = COLLECTION_VIEWPORT |
+ COLLECTION_RENDER |
+ collections[j].flag_render;
layer_collection_child = layer_collection_child->next;
}
}
@@ -450,7 +446,7 @@ void do_versions_after_linking_280(Main *main)
/* We only need to disable the parent collection. */
if (is_disabled) {
- BKE_collection_disable(view_layer, layer_collection_parent);
+ layer_collection_parent->flag |= COLLECTION_DISABLED;
}
LayerCollection *layer_collection_child;
@@ -458,11 +454,9 @@ void do_versions_after_linking_280(Main *main)
for (int j = 1; j < 4; j++) {
if (collections[j].created & (1 << layer)) {
- layer_collection_child->flag = collections[j].flag_viewport & (~COLLECTION_DISABLED);
-
- if (collections[j].flag_viewport & COLLECTION_DISABLED) {
- BKE_collection_disable(view_layer, layer_collection_child);
- }
+ layer_collection_child->flag = COLLECTION_VIEWPORT |
+ COLLECTION_RENDER |
+ collections[j].flag_viewport;
layer_collection_child = layer_collection_child->next;
}
}
@@ -594,11 +588,9 @@ void do_versions_after_linking_280(Main *main)
if (sc_hidden != NULL) {
LayerCollection *layer_collection_master, *layer_collection_hidden;
-
layer_collection_master = group->view_layer->layer_collections.first;
layer_collection_hidden = layer_collection_master->layer_collections.first;
-
- layer_collection_hidden->flag &= ~COLLECTION_VISIBLE;
+ layer_collection_hidden->flag |= COLLECTION_DISABLED;
}
}
@@ -629,6 +621,25 @@ static void do_version_layer_collections_idproperties(ListBase *lb)
}
}
+static void do_version_view_layer_visibility(ViewLayer *view_layer)
+{
+ LayerCollection *layer_collection;
+ for (layer_collection = view_layer->layer_collections.first;
+ layer_collection;
+ layer_collection = layer_collection->next)
+ {
+ if (layer_collection->flag & COLLECTION_DISABLED) {
+ BKE_collection_enable(view_layer, layer_collection);
+ layer_collection->flag &= ~COLLECTION_DISABLED;
+ }
+
+ if ((layer_collection->flag & (1 << 0)) == 0) { /* !COLLECTION_VISIBLE */
+ layer_collection->flag |= COLLECTION_DISABLED;
+ }
+ layer_collection->flag |= COLLECTION_VIEWPORT | COLLECTION_RENDER;
+ }
+}
+
void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
{
@@ -827,4 +838,19 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *main)
}
}
}
+
+ if (!MAIN_VERSION_ATLEAST(main, 280, 3)) {
+ for (Scene *scene = main->scene.first; scene; scene = scene->id.next) {
+ ViewLayer *view_layer;
+ for (view_layer = scene->view_layers.first; view_layer; view_layer = view_layer->next) {
+ do_version_view_layer_visibility(view_layer);
+ }
+ }
+
+ for (Group *group = main->group.first; group; group = group->id.next) {
+ if (group->view_layer != NULL){
+ do_version_view_layer_visibility(group->view_layer);
+ }
+ }
+ }
}
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index 7771d35d581..bd604289534 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -111,7 +111,7 @@ void DEG_iterator_objects_end(struct BLI_Iterator *iter);
#define DEG_OBJECT_ITER(graph_, instance_, flag_) \
{ \
- DEGOIterObjectData data_ = { \
+ DEGOIterObjectData data_ = { \
.graph = (graph_), \
.flag = (flag_), \
}; \
@@ -119,7 +119,11 @@ void DEG_iterator_objects_end(struct BLI_Iterator *iter);
ITER_BEGIN(DEG_iterator_objects_begin, \
DEG_iterator_objects_next, \
DEG_iterator_objects_end, \
- &data_, Object *, instance_)
+ &data_, Object *, instance_) \
+ \
+ if (BKE_object_is_visible(instance_) == false) { \
+ continue; \
+ }
#define DEG_OBJECT_ITER_END \
ITER_END \
diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c
index 6f6992a2256..f24381e1fb4 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -114,10 +114,6 @@ static void eevee_cache_populate(void *vedata, Object *ob)
}
if (ELEM(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT)) {
- if (!BKE_object_is_visible(ob)) {
- return;
- }
-
EEVEE_materials_cache_populate(vedata, sldata, ob);
const bool cast_shadow = true;
diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c
index d7ccc1a5336..fed8460e008 100644
--- a/source/blender/draw/engines/eevee/eevee_lightprobes.c
+++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c
@@ -685,8 +685,7 @@ static void EEVEE_planar_reflections_updates(EEVEE_ViewLayerData *sldata, EEVEE_
eplanar->attenuation_bias = max_dist * -eplanar->attenuation_scale;
/* Debug Display */
- if (BKE_object_is_visible(ob) &&
- DRW_state_draw_support() &&
+ if (DRW_state_draw_support() &&
(probe->flag & LIGHTPROBE_FLAG_SHOW_DATA))
{
DRW_shgroup_call_dynamic_add(stl->g_data->planar_display_shgrp, &ped->probe_id, ob->obmat);
@@ -734,8 +733,7 @@ static void EEVEE_lightprobes_updates(EEVEE_ViewLayerData *sldata, EEVEE_PassLis
invert_m4(eprobe->parallaxmat);
/* Debug Display */
- if (BKE_object_is_visible(ob) &&
- DRW_state_draw_support() &&
+ if (DRW_state_draw_support() &&
(probe->flag & LIGHTPROBE_FLAG_SHOW_DATA))
{
ped->probe_size = probe->data_draw_size * 0.1f;
@@ -816,8 +814,7 @@ static void EEVEE_lightprobes_updates(EEVEE_ViewLayerData *sldata, EEVEE_PassLis
len_v3(egrid->increment_z)) + 1.0f;
/* Debug Display */
- if (BKE_object_is_visible(ob) &&
- DRW_state_draw_support() &&
+ if (DRW_state_draw_support() &&
(probe->flag & LIGHTPROBE_FLAG_SHOW_DATA))
{
struct Gwn_Batch *geom = DRW_cache_sphere_get();
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 525289f51b9..2ab5b9dd758 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2214,9 +2214,7 @@ bool DRW_object_is_renderable(Object *ob)
Scene *scene = DST.draw_ctx.scene;
Object *obedit = scene->obedit;
- if (!BKE_object_is_visible(ob)) {
- return false;
- }
+ BLI_assert(BKE_object_is_visible(ob));
if (ob->type == OB_MESH) {
if (ob == obedit) {
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 91b64818eff..3d84611f94d 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -1763,10 +1763,6 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
View3D *v3d = draw_ctx->v3d;
int theme_id = TH_UNDEFINED;
- if (!BKE_object_is_visible(ob)) {
- return;
- }
-
//CollectionEngineSettings *ces_mode_ob = BKE_layer_collection_engine_evaluated_get(ob, COLLECTION_MODE_OBJECT, "");
//bool do_wire = BKE_collection_engine_property_value_get_bool(ces_mode_ob, "show_wire");
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 47794e0e357..83beb7da1ce 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -313,11 +313,10 @@ static void set_preview_layer(ViewLayer *view_layer, char pr_type)
for (lc = view_layer->layer_collections.first; lc; lc = lc->next) {
if (STREQ(lc->scene_collection->name, collection_name)) {
- lc->flag = COLLECTION_VISIBLE | COLLECTION_DISABLED;
- BKE_collection_enable(view_layer, lc);
+ lc->flag = COLLECTION_VIEWPORT | COLLECTION_RENDER;
}
else {
- BKE_collection_disable(view_layer, lc);
+ lc->flag = COLLECTION_DISABLED;
}
}
}
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index b00f33ae37d..0a51b1a0d69 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -489,13 +489,12 @@ static int collection_toggle_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
int action = RNA_enum_get(op->ptr, "action");
LayerCollection *layer_collection = CTX_data_layer_collection(C);
if (layer_collection->flag & COLLECTION_DISABLED) {
if (ELEM(action, ACTION_TOGGLE, ACTION_ENABLE)) {
- BKE_collection_enable(view_layer, layer_collection);
+ layer_collection->flag &= ~COLLECTION_DISABLED;
}
else { /* ACTION_DISABLE */
BKE_reportf(op->reports, RPT_ERROR, "Layer collection %s already disabled",
@@ -505,7 +504,7 @@ static int collection_toggle_exec(bContext *C, wmOperator *op)
}
else {
if (ELEM(action, ACTION_TOGGLE, ACTION_DISABLE)) {
- BKE_collection_disable(view_layer, layer_collection);
+ layer_collection->flag |= COLLECTION_DISABLED;
}
else { /* ACTION_ENABLE */
BKE_reportf(op->reports, RPT_ERROR, "Layer collection %s already enabled",
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index cecfc0cb71d..bc40067c2a8 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -247,49 +247,16 @@ static void restrictbutton_gp_layer_flag_cb(bContext *C, void *UNUSED(poin), voi
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
-static void enablebutton_collection_flag_cb(bContext *C, void *poin, void *poin2)
-{
- Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
- ID *id = poin;
- LayerCollection *layer_collection = poin2;
- ViewLayer *view_layer = BKE_view_layer_find_from_collection(id, layer_collection);
-
- /* TODO: This breaks when you see the collections of a group. (dfelinto) */
- if (view_layer == NULL) {
- WM_reportf(RPT_INFO, "Enable/disable of group collections disabled for now");
- return;
- }
-
- /* We need to toggle the flag since this is called after the flag is already set. */
- layer_collection->flag ^= COLLECTION_DISABLED;
-
- if (layer_collection->flag & COLLECTION_DISABLED) {
- BKE_collection_enable(view_layer, layer_collection);
- }
- else {
- BKE_collection_disable(view_layer, layer_collection);
- }
-
- DEG_relations_tag_update(bmain);
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(&scene->id, 0);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, NULL);
-}
-
static void restrictbutton_collection_flag_cb(bContext *C, void *poin, void *UNUSED(poin2))
{
ID *id = (ID *)poin;
- /* hide and deselect bases that are directly influenced by this LayerCollection */
/* TODO(sergey): Use proper flag for tagging here. */
DEG_id_tag_update(id, 0);
if (GS(id->name) == ID_SCE) {
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, id);
}
-
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, NULL);
}
@@ -602,21 +569,6 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
UI_block_emboss_set(block, UI_EMBOSS_NONE);
- bt = uiDefIconButBitS(block, UI_BTYPE_BUT_TOGGLE, COLLECTION_DISABLED, 0,
- is_enabled ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT,
- (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_ENABLEX), te->ys, UI_UNIT_X,
- UI_UNIT_Y, &collection->flag, 0, 0, 0, 0,
- TIP_("Enable/Disable collection from depsgraph"));
- UI_but_func_set(bt, enablebutton_collection_flag_cb, tselem->id, collection);
- UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
- bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE_N, COLLECTION_VISIBLE, 0, ICON_RESTRICT_VIEW_OFF,
- (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
- UI_UNIT_Y, &collection->flag, 0, 0, 0, 0,
- TIP_("Restrict/Allow 3D View visibility of objects in the collection"));
- UI_but_func_set(bt, restrictbutton_collection_flag_cb, tselem->id, collection);
- UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
if (collection->scene_collection->type == COLLECTION_TYPE_NONE) {
bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE_N, COLLECTION_SELECTABLE, 0, ICON_RESTRICT_SELECT_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X,
@@ -625,6 +577,31 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
UI_but_func_set(bt, restrictbutton_collection_flag_cb, scene, collection);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
}
+ else if ((soops->outlinevis == SO_GROUPS) &&
+ (collection->scene_collection->type == COLLECTION_TYPE_GROUP_INTERNAL))
+ {
+ bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE_N, COLLECTION_VIEWPORT, 0, ICON_RESTRICT_VIEW_OFF,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWPORTX), te->ys, UI_UNIT_X,
+ UI_UNIT_Y, &collection->flag, 0, 0, 0, 0,
+ TIP_("Restrict/Allow 3D View selection of objects in the collection"));
+ UI_but_func_set(bt, restrictbutton_collection_flag_cb, tselem->id, collection);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+
+ bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE_N, COLLECTION_RENDER, 0, ICON_RESTRICT_RENDER_OFF,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X,
+ UI_UNIT_Y, &collection->flag, 0, 0, 0, 0,
+ TIP_("Restrict/Allow 3D View selection of objects in the collection"));
+ UI_but_func_set(bt, restrictbutton_collection_flag_cb, tselem->id, collection);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ }
+
+ bt = uiDefIconButBitS(block, UI_BTYPE_BUT_TOGGLE, COLLECTION_DISABLED, 0,
+ is_enabled ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_ENABLEX), te->ys, UI_UNIT_X,
+ UI_UNIT_Y, &collection->flag, 0, 0, 0, 0,
+ TIP_("Enable/Disable collection"));
+ UI_but_func_set(bt, restrictbutton_collection_flag_cb, tselem->id, collection);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_block_emboss_set(block, UI_EMBOSS);
}
@@ -1805,8 +1782,9 @@ static void outliner_draw_tree(
/* set scissor so tree elements or lines can't overlap restriction icons */
GLfloat scissor[4] = {0};
+ const bool is_group = (soops->outlinevis == SO_GROUPS);
if (has_restrict_icons) {
- int mask_x = BLI_rcti_size_x(&ar->v2d.mask) - (int)OL_TOGW + 1;
+ int mask_x = BLI_rcti_size_x(&ar->v2d.mask) - (int)(is_group ? OL_TOG_GROUPW : OL_TOGW) + 1;
CLAMP_MIN(mask_x, 0);
glGetFloatv(GL_SCISSOR_BOX, scissor);
@@ -1872,27 +1850,31 @@ static void outliner_back(ARegion *ar)
immUnbindProgram();
}
-static void outliner_draw_restrictcols(ARegion *ar)
+static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops)
{
glLineWidth(1.0f);
+ const bool is_group = (soops->outlinevis == SO_GROUPS);
+
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_I32, 2, GWN_FETCH_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShadeAlpha(TH_BACK, -15, -200);
- immBegin(GWN_PRIM_LINES, 6);
+ immBegin(GWN_PRIM_LINES, is_group ? 6 : 4);
/* view */
- immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymax);
- immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), (int)ar->v2d.cur.ymin);
-
- /* render */
- immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)ar->v2d.cur.ymax);
- immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), (int)ar->v2d.cur.ymin);
+ immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_ENABLEX), (int)ar->v2d.cur.ymax);
+ immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_ENABLEX), (int)ar->v2d.cur.ymin);
/* render */
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)ar->v2d.cur.ymax);
immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), (int)ar->v2d.cur.ymin);
+ if (is_group) {
+ /* render */
+ immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWPORTX), (int)ar->v2d.cur.ymax);
+ immVertex2i(pos, (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWPORTX), (int)ar->v2d.cur.ymin);
+ }
+
immEnd();
immUnbindProgram();
}
@@ -1943,8 +1925,9 @@ void draw_outliner(const bContext *C)
/* constant offset for restriction columns */
// XXX this isn't that great yet...
- if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0)
- sizex += OL_TOGW * 3;
+ if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0) {
+ sizex += OL_TOGW * ((soops->flag & SO_GROUPS) != 0 ? 3 : 2);
+ }
has_restrict_icons = !(soops->flag & SO_HIDE_RESTRICTCOLS);
}
@@ -1972,12 +1955,12 @@ void draw_outliner(const bContext *C)
}
else if ((soops->outlinevis == SO_ID_ORPHANS) && has_restrict_icons) {
/* draw user toggle columns */
- outliner_draw_restrictcols(ar);
+ outliner_draw_restrictcols(ar, soops);
outliner_draw_userbuts(block, ar, soops, &soops->tree);
}
else if (has_restrict_icons) {
/* draw restriction columns */
- outliner_draw_restrictcols(ar);
+ outliner_draw_restrictcols(ar, soops);
outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree);
}
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 9047512caad..abf733d0684 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -143,12 +143,14 @@ typedef enum {
/* size constants */
#define OL_Y_OFFSET 2
-#define OL_TOG_RESTRICT_ENABLEX (UI_UNIT_X * 3.0f)
+#define OL_TOG_RESTRICT_ENABLEX UI_UNIT_X
#define OL_TOG_RESTRICT_VIEWX (UI_UNIT_X * 2.0f)
-#define OL_TOG_RESTRICT_SELECTX UI_UNIT_X
-#define OL_TOG_RESTRICT_RENDERX UI_UNIT_X
+#define OL_TOG_RESTRICT_SELECTX (UI_UNIT_X * 2.0f)
+#define OL_TOG_RESTRICT_RENDERX (UI_UNIT_X * 2.0f)
+#define OL_TOG_RESTRICT_VIEWPORTX (UI_UNIT_X * 3.0f)
-#define OL_TOGW OL_TOG_RESTRICT_ENABLEX
+#define OL_TOGW OL_TOG_RESTRICT_VIEWX
+#define OL_TOG_GROUPW OL_TOG_RESTRICT_VIEWPORTX
#define OL_RNA_COLX (UI_UNIT_X * 15)
#define OL_RNA_COL_SIZEX (UI_UNIT_X * 7.5f)
diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h
index c677383cb6e..ff81e04c5a1 100644
--- a/source/blender/makesdna/DNA_layer_types.h
+++ b/source/blender/makesdna/DNA_layer_types.h
@@ -123,9 +123,10 @@ enum {
/* LayerCollection->flag */
enum {
- COLLECTION_VISIBLE = (1 << 0),
+ COLLECTION_VIEWPORT = (1 << 0), /* Only used for group collections. */
COLLECTION_SELECTABLE = (1 << 1),
COLLECTION_DISABLED = (1 << 2),
+ COLLECTION_RENDER = (1 << 3), /* Only used for group collections. */
};
/* ViewLayer->flag */
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index 877d6b250c0..11e35bed9ee 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -70,6 +70,7 @@ const EnumPropertyItem rna_enum_collection_type_items[] = {
#include "BKE_idprop.h"
#include "BKE_layer.h"
#include "BKE_node.h"
+#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_mesh.h"
@@ -703,48 +704,6 @@ static void rna_LayerCollection_flag_update(bContext *C, PointerRNA *ptr)
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
}
-static void rna_LayerCollection_enable_set(
- ID *id, LayerCollection *layer_collection, Main *bmain, bContext *C, ReportList *reports, int value)
-{
- ViewLayer *view_layer;
- if (GS(id->name) == ID_SCE) {
- Scene *scene = (Scene *)id;
- view_layer = BKE_view_layer_find_from_collection(&scene->id, layer_collection);
- }
- else {
- BLI_assert(GS(id->name) == ID_GR);
- Group *group = (Group *)id;
- view_layer = group->view_layer;
- }
-
- if (layer_collection->flag & COLLECTION_DISABLED) {
- if (value == 1) {
- BKE_collection_enable(view_layer, layer_collection);
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is already disabled",
- layer_collection->scene_collection->name);
- return;
- }
- }
- else {
- if (value == 0) {
- BKE_collection_disable(view_layer, layer_collection);
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is already enabled",
- layer_collection->scene_collection->name);
- }
- }
-
- Scene *scene = CTX_data_scene(C);
- DEG_relations_tag_update(bmain);
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(&scene->id, 0);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
- WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, scene);
-}
-
static Group *rna_LayerCollection_create_group(
ID *id, LayerCollection *layer_collection, Main *bmain, bContext *C, ReportList *reports)
{
@@ -2065,11 +2024,6 @@ static void rna_def_layer_collection(BlenderRNA *brna)
parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded");
RNA_def_function_return(func, parm);
- func = RNA_def_function(srna, "enable_set", "rna_LayerCollection_enable_set");
- RNA_def_function_ui_description(func, "Enable or disable a collection");
- parm = RNA_def_boolean(func, "value", 1, "Enable", "");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
-
func = RNA_def_function(srna, "create_group", "rna_LayerCollection_create_group");
RNA_def_function_ui_description(func, "Enable or disable a collection");
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
@@ -2077,23 +2031,31 @@ static void rna_def_layer_collection(BlenderRNA *brna)
RNA_def_function_return(func, parm);
/* Flags */
- prop = RNA_def_property(srna, "is_enabled", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_DISABLED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Enabled", "Enable or disable collection from depsgraph");
+ prop = RNA_def_property(srna, "selectable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_SELECTABLE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
+ RNA_def_property_ui_text(prop, "Selectable", "Restrict selection");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update");
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_VISIBLE);
+ prop = RNA_def_property(srna, "visible_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_VIEWPORT);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
- RNA_def_property_ui_text(prop, "Hide", "Restrict visiblity");
+ RNA_def_property_ui_text(prop, "Viewport Visibility", "");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update");
- prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_SELECTABLE);
+ prop = RNA_def_property(srna, "visible_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RENDER);
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
- RNA_def_property_ui_text(prop, "Hide Selectable", "Restrict selection");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
+ RNA_def_property_ui_text(prop, "Render Visibility", "Control");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update");
+
+ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_DISABLED);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Enabled", "Enable or disable collection");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update");
/* TODO_LAYER_OVERRIDE */
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 9301ed63adb..786598b0731 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -229,6 +229,12 @@ static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA
DEG_id_type_tag(bmain, ID_OB);
}
+static int rna_Object_is_visible_get(PointerRNA *ptr)
+{
+ Object *ob = ptr->id.data;
+ return BKE_object_is_visible(ob);
+}
+
static void rna_Object_collection_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Object *ob = ptr->data;
@@ -2786,27 +2792,14 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies");
/* restrict */
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
- RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
-
- prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
- RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
- /* Keep it in sync with BKE_object_is_visible. */
prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_VISIBLED);
+ RNA_def_property_boolean_funcs(prop, "rna_Object_is_visible_get", NULL);
RNA_def_property_ui_text(prop, "Visible", "Visible to camera rays, set only on objects evaluated by depsgraph");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/tests/python/view_layer/test_evaluation_selectability_a.py b/tests/python/view_layer/test_evaluation_selectability_a.py
index 82404d54fe3..bd80f638ef4 100644
--- a/tests/python/view_layer/test_evaluation_selectability_a.py
+++ b/tests/python/view_layer/test_evaluation_selectability_a.py
@@ -37,7 +37,7 @@ class UnitTesting(ViewLayerTesting):
layer_collection_mom = layer.collections.link(scene_collection_mom)
layer_collection_kid = layer.collections.link(scene_collection_kid)
- layer_collection_mom.hide = True
+ layer_collection_mom.enabled = False
bpy.context.scene.update() # update depsgraph
cube.select_set('SELECT')
diff --git a/tests/python/view_layer/test_evaluation_selectability_b.py b/tests/python/view_layer/test_evaluation_selectability_b.py
index f05ab5de2e1..a220d89445e 100644
--- a/tests/python/view_layer/test_evaluation_selectability_b.py
+++ b/tests/python/view_layer/test_evaluation_selectability_b.py
@@ -39,8 +39,8 @@ class UnitTesting(ViewLayerTesting):
bpy.context.scene.update() # update depsgraph
cube.select_set('SELECT')
- layer_collection_mom.collections[layer_collection_kid.name].hide = True
- layer_collection_kid.hide = True
+ layer_collection_mom.collections[layer_collection_kid.name].enabled = False
+ layer_collection_kid.enabled = False
bpy.context.scene.update() # update depsgraph
self.assertFalse(cube.visible_get(), "Cube should be invisible")
diff --git a/tests/python/view_layer/test_evaluation_selectability_c.py b/tests/python/view_layer/test_evaluation_selectability_c.py
index 71452bc1354..e551310cbbe 100644
--- a/tests/python/view_layer/test_evaluation_selectability_c.py
+++ b/tests/python/view_layer/test_evaluation_selectability_c.py
@@ -37,7 +37,7 @@ class UnitTesting(ViewLayerTesting):
layer_collection_mom = layer.collections.link(scene_collection_mom)
layer_collection_kid = layer.collections.link(scene_collection_kid)
- layer_collection_mom.hide = False
+ layer_collection_mom.enabled = True
bpy.context.scene.update() # update depsgraph
cube.select_set('SELECT')
diff --git a/tests/python/view_layer/test_evaluation_selectability_d.py b/tests/python/view_layer/test_evaluation_selectability_d.py
index 529a36c101e..76adf12c666 100644
--- a/tests/python/view_layer/test_evaluation_selectability_d.py
+++ b/tests/python/view_layer/test_evaluation_selectability_d.py
@@ -37,11 +37,11 @@ class UnitTesting(ViewLayerTesting):
layer_collection_mom = layer.collections.link(scene_collection_mom)
layer_collection_kid = layer.collections.link(scene_collection_kid)
- layer_collection_mom.hide = False
+ layer_collection_mom.enabled = True
bpy.context.scene.update() # update depsgraph
cube.select_set('SELECT')
- layer_collection_mom.collections[layer_collection_kid.name].hide_select = True
+ layer_collection_mom.collections[layer_collection_kid.name].selectable = False
bpy.context.scene.update() # update depsgraph
self.assertTrue(cube.visible_get(), "Cube should be visible")
diff --git a/tests/python/view_layer/test_evaluation_selectability_e.py b/tests/python/view_layer/test_evaluation_selectability_e.py
index a26fa0df304..970c1cdd9d2 100644
--- a/tests/python/view_layer/test_evaluation_selectability_e.py
+++ b/tests/python/view_layer/test_evaluation_selectability_e.py
@@ -37,10 +37,10 @@ class UnitTesting(ViewLayerTesting):
layer_collection_mom = layer.collections.link(scene_collection_mom)
layer_collection_kid = layer.collections.link(scene_collection_kid)
- layer_collection_mom.hide = False
+ layer_collection_mom.enabled = True
cube.select_set('SELECT')
- layer_collection_mom.collections[layer_collection_kid.name].hide_select = True
- layer_collection_kid.hide = True
+ layer_collection_mom.collections[layer_collection_kid.name].selectable = False
+ layer_collection_kid.enabled = False
bpy.context.scene.update() # update depsgraph
self.assertTrue(cube.visible_get(), "Cube should be visible")
diff --git a/tests/python/view_layer/test_evaluation_selectability_f.py b/tests/python/view_layer/test_evaluation_selectability_f.py
index 1cffed9b0f4..54a070e4ae9 100644
--- a/tests/python/view_layer/test_evaluation_selectability_f.py
+++ b/tests/python/view_layer/test_evaluation_selectability_f.py
@@ -26,8 +26,8 @@ class UnitTesting(ViewLayerTesting):
scene_collection.objects.link(cube)
- self.assertFalse(layer_collection.hide)
- self.assertFalse(layer_collection.hide_select)
+ self.assertTrue(layer_collection.enabled)
+ self.assertTrue(layer_collection.selectable)
bpy.context.scene.update() # update depsgraph
cube.select_set(action='SELECT')
diff --git a/tests/python/view_layer/test_evaluation_visibility_a.py b/tests/python/view_layer/test_evaluation_visibility_a.py
index 3ae567df82c..c1e6a427210 100644
--- a/tests/python/view_layer/test_evaluation_visibility_a.py
+++ b/tests/python/view_layer/test_evaluation_visibility_a.py
@@ -38,8 +38,8 @@ class UnitTesting(ViewLayerTesting):
layer_collection_mom = layer.collections.link(scene_collection_mom)
layer_collection_kid = layer.collections.link(scene_collection_kid)
- layer_collection_mom.hide = True
- layer_collection_kid.hide = False
+ layer_collection_mom.enabled = False
+ layer_collection_kid.enabled = True
bpy.context.scene.update() # update depsgraph
self.assertTrue(cube.visible_get(), "Object should be visible")
diff --git a/tests/python/view_layer/test_evaluation_visibility_b.py b/tests/python/view_layer/test_evaluation_visibility_b.py
index 93ace3928f2..a6859ba31ec 100644
--- a/tests/python/view_layer/test_evaluation_visibility_b.py
+++ b/tests/python/view_layer/test_evaluation_visibility_b.py
@@ -37,9 +37,9 @@ class UnitTesting(ViewLayerTesting):
layer_collection_mom = layer.collections.link(scene_collection_mom)
layer_collection_kid = layer.collections.link(scene_collection_kid)
- layer_collection_mom.hide = False
- layer_collection_mom.collections[layer_collection_kid.name].hide = True
- layer_collection_kid.hide = True
+ layer_collection_mom.enabled = True
+ layer_collection_mom.collections[layer_collection_kid.name].enabled = False
+ layer_collection_kid.enabled = False
bpy.context.scene.update() # update depsgraph
self.assertFalse(cube.visible_get(), "Object should be invisible")
diff --git a/tests/python/view_layer/test_evaluation_visibility_c.py b/tests/python/view_layer/test_evaluation_visibility_c.py
index 05db8577167..8c88a045c99 100644
--- a/tests/python/view_layer/test_evaluation_visibility_c.py
+++ b/tests/python/view_layer/test_evaluation_visibility_c.py
@@ -37,9 +37,9 @@ class UnitTesting(ViewLayerTesting):
layer_collection_mom = layer.collections.link(scene_collection_mom)
layer_collection_kid = layer.collections.link(scene_collection_kid)
- layer_collection_mom.hide = False
- layer_collection_mom.collections[layer_collection_kid.name].hide = True
- layer_collection_kid.hide = False
+ layer_collection_mom.enabled = True
+ layer_collection_mom.collections[layer_collection_kid.name].enabled = False
+ layer_collection_kid.enabled = True
bpy.context.scene.update() # update depsgraph
self.assertTrue(cube.visible_get(), "Object should be visible")
diff --git a/tests/python/view_layer/test_evaluation_visibility_d.py b/tests/python/view_layer/test_evaluation_visibility_d.py
index e08ab4d571e..1836fae9802 100644
--- a/tests/python/view_layer/test_evaluation_visibility_d.py
+++ b/tests/python/view_layer/test_evaluation_visibility_d.py
@@ -37,7 +37,7 @@ class UnitTesting(ViewLayerTesting):
layer_collection_mom = layer.collections.link(scene_collection_mom)
layer_collection_kid = layer.collections.link(scene_collection_kid)
- layer_collection_mom.hide = False
+ layer_collection_mom.enabled = True
bpy.context.scene.update() # update depsgraph
self.assertTrue(cube.visible_get(), "Object should be visible")
diff --git a/tests/python/view_layer/test_evaluation_visibility_e.py b/tests/python/view_layer/test_evaluation_visibility_e.py
index b54238337c6..f05d797ecdc 100644
--- a/tests/python/view_layer/test_evaluation_visibility_e.py
+++ b/tests/python/view_layer/test_evaluation_visibility_e.py
@@ -38,8 +38,8 @@ class UnitTesting(ViewLayerTesting):
layer_collection_mom = layer.collections.link(scene_collection_mom)
layer_collection_kid = layer.collections.link(scene_collection_kid)
- layer_collection_mom.hide = False
- layer_collection_kid.hide = True
+ layer_collection_mom.enabled = True
+ layer_collection_kid.enabled = False
bpy.context.scene.update() # update depsgraph
self.assertTrue(cube.visible_get(), "Object should be visible")
diff --git a/tests/python/view_layer/test_evaluation_visibility_f.py b/tests/python/view_layer/test_evaluation_visibility_f.py
index e532a19e3ef..9034d0ce6f8 100644
--- a/tests/python/view_layer/test_evaluation_visibility_f.py
+++ b/tests/python/view_layer/test_evaluation_visibility_f.py
@@ -38,9 +38,9 @@ class UnitTesting(ViewLayerTesting):
layer_collection_mom = layer.collections.link(scene_collection_mom)
layer_collection_kid = layer.collections.link(scene_collection_kid)
- layer_collection_mom.hide = False
- layer_collection_mom.collections[layer_collection_kid.name].hide = True
- layer_collection_kid.hide = True
+ layer_collection_mom.enabled = True
+ layer_collection_mom.collections[layer_collection_kid.name].enabled = False
+ layer_collection_kid.enabled = False
bpy.context.scene.update() # update depsgraph
self.assertTrue(cube.visible_get(), "Object should be visible")
diff --git a/tests/python/view_layer/test_group_b.py b/tests/python/view_layer/test_group_b.py
index 6a4478aeba8..5d3a03b129b 100644
--- a/tests/python/view_layer/test_group_b.py
+++ b/tests/python/view_layer/test_group_b.py
@@ -35,10 +35,10 @@ class UnitTesting(ViewLayerTesting):
grandma_layer_collection = scene.view_layers[0].collections.link(grandma)
mom_layer_collection = grandma_layer_collection.collections[0]
- grandma_layer_collection.hide = False
- grandma_layer_collection.hide = False
- mom_layer_collection.hide = True
- mom_layer_collection.hide_select = False
+ grandma_layer_collection.enabled = True
+ grandma_layer_collection.enabled = True
+ mom_layer_collection.enabled = False
+ mom_layer_collection.selectable = True
# update depsgraph
scene.update()
@@ -53,14 +53,14 @@ class UnitTesting(ViewLayerTesting):
self.assertEqual(len(group.view_layer.collections), 1)
grandma_group_layer = group.view_layer.collections[0]
- self.assertEqual(grandma_group_layer.hide, False)
- self.assertEqual(grandma_group_layer.hide_select, False)
+ self.assertTrue(grandma_group_layer.enabled, True)
+ self.assertTrue(grandma_group_layer.selectable)
self.assertEqual(len(grandma_group_layer.collections), 1)
mom_group_layer = grandma_group_layer.collections[0]
- self.assertEqual(mom_group_layer.hide, True)
- self.assertEqual(mom_group_layer.hide_select, False)
+ self.assertFalse(mom_group_layer.enabled)
+ self.assertTrue(mom_group_layer.selectable)
# ############################################################
diff --git a/tests/python/view_layer/test_move_above_below_layer_collection_f.py b/tests/python/view_layer/test_move_above_below_layer_collection_f.py
index 8182655ebbd..77d65ef8671 100644
--- a/tests/python/view_layer/test_move_above_below_layer_collection_f.py
+++ b/tests/python/view_layer/test_move_above_below_layer_collection_f.py
@@ -72,13 +72,13 @@ class UnitTesting(MoveLayerCollectionTesting):
# collection that will be moved
collection_original = self.parse_move('Layer 2.3')
- collection_original.hide = False
- collection_original.hide_select = True
+ collection_original.enabled = True
+ collection_original.selectable = False
# collection that will disappear
collection_old = self.parse_move('Layer 2.C.3')
- collection_old.hide = True
- collection_old.hide_select = False
+ collection_old.enabled = False
+ collection_old.selectable = True
# move
self.assertTrue(self.move_below('Layer 2.3', 'Layer 2.C.1'))
@@ -87,8 +87,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# we expect the settings to be carried along from the
# original layer collection
collection_new = self.parse_move('Layer 2.C.3')
- self.assertEqual(collection_new.hide, False)
- self.assertEqual(collection_new.hide_select, True)
+ self.assertEqual(collection_new.enabled, True)
+ self.assertEqual(collection_new.selectable, False)
# ############################################################
diff --git a/tests/python/view_layer/test_move_above_below_layer_collection_g.py b/tests/python/view_layer/test_move_above_below_layer_collection_g.py
index 7ee7aff9dc7..16cd628edfc 100644
--- a/tests/python/view_layer/test_move_above_below_layer_collection_g.py
+++ b/tests/python/view_layer/test_move_above_below_layer_collection_g.py
@@ -53,13 +53,13 @@ class UnitTesting(MoveLayerCollectionTesting):
# collection that will be moved
collection_original = self.parse_move('Layer 2.C.3.cat')
- collection_original.hide = False
- collection_original.hide_select = True
+ collection_original.enabled = True
+ collection_original.selectable = False
# collection that will disappear
collection_old = self.parse_move('Layer 2.3.cat')
- collection_old.hide = True
- collection_old.hide_select = False
+ collection_old.enabled = False
+ collection_old.selectable = True
# move
self.assertTrue(self.move_above('Layer 2.C.3.cat', 'Layer 2.3.dog'))
@@ -68,8 +68,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# we expect the settings to be carried along from the
# original layer collection
collection_new = self.parse_move('Layer 2.3.cat')
- self.assertEqual(collection_new.hide, False)
- self.assertEqual(collection_new.hide_select, True)
+ self.assertEqual(collection_new.enabled, True)
+ self.assertEqual(collection_new.selectable, False)
# ############################################################
diff --git a/tests/python/view_layer/test_move_above_below_layer_collection_h.py b/tests/python/view_layer/test_move_above_below_layer_collection_h.py
index 4581f9d4767..4fe2c857e50 100644
--- a/tests/python/view_layer/test_move_above_below_layer_collection_h.py
+++ b/tests/python/view_layer/test_move_above_below_layer_collection_h.py
@@ -38,13 +38,13 @@ class UnitTesting(MoveLayerCollectionTesting):
# collection that will be moved
collection_original = self.parse_move('Layer 2.C.3.cat')
- collection_original.hide = False
- collection_original.hide_select = True
+ collection_original.enabled = True
+ collection_original.selectable = False
# collection that will disappear
collection_old = self.parse_move('Layer 2.3.cat')
- collection_old.hide = True
- collection_old.hide_select = False
+ collection_old.enabled = False
+ collection_old.selectable = True
# move
self.assertTrue(self.move_below('Layer 2.C.3.cat', 'Layer 2.3.dog'))
@@ -53,8 +53,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# we expect the settings to be carried along from the
# original layer collection
collection_new = self.parse_move('Layer 2.3.cat')
- self.assertEqual(collection_new.hide, False)
- self.assertEqual(collection_new.hide_select, True)
+ self.assertEqual(collection_new.enabled, True)
+ self.assertEqual(collection_new.selectable, False)
# ############################################################
diff --git a/tests/python/view_layer/test_move_above_below_layer_collection_i.py b/tests/python/view_layer/test_move_above_below_layer_collection_i.py
index fd204cc0a46..0134d11adcd 100644
--- a/tests/python/view_layer/test_move_above_below_layer_collection_i.py
+++ b/tests/python/view_layer/test_move_above_below_layer_collection_i.py
@@ -50,8 +50,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# collection that will be moved
collection_original = self.parse_move('Layer 2.C')
- collection_original.hide = False
- collection_original.hide_select = True
+ collection_original.enabled = True
+ collection_original.selectable = False
# move
self.assertTrue(self.move_below('Layer 2.C', 'Layer 2.3'))
@@ -60,8 +60,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# we expect the settings to be carried along from the
# original layer collection
collection_new = self.parse_move('Layer 2.C')
- self.assertEqual(collection_new.hide, False)
- self.assertEqual(collection_new.hide_select, True)
+ self.assertEqual(collection_new.enabled, True)
+ self.assertEqual(collection_new.selectable, False)
# ############################################################
diff --git a/tests/python/view_layer/test_move_above_below_layer_collection_j.py b/tests/python/view_layer/test_move_above_below_layer_collection_j.py
index 7c9dcbfdb3a..cb56ca0b963 100644
--- a/tests/python/view_layer/test_move_above_below_layer_collection_j.py
+++ b/tests/python/view_layer/test_move_above_below_layer_collection_j.py
@@ -39,8 +39,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# collection that will be moved
collection_original = self.parse_move('Layer 1.3.dog')
- collection_original.hide = False
- collection_original.hide_select = True
+ collection_original.enabled = True
+ collection_original.selectable = False
# move
self.assertTrue(self.move_below('Layer 1.3.dog', 'Layer 1.3.cat'))
@@ -50,8 +50,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# we expect the settings to be carried along from the
# original layer collection
collection_new = self.parse_move('Layer 1.3.dog')
- self.assertEqual(collection_new.hide, False)
- self.assertEqual(collection_new.hide_select, True)
+ self.assertEqual(collection_new.enabled, True)
+ self.assertEqual(collection_new.selectable, False)
# ############################################################
diff --git a/tests/python/view_layer/test_move_into_layer_collection_f.py b/tests/python/view_layer/test_move_into_layer_collection_f.py
index d857fd4cd1b..7bf007d2724 100644
--- a/tests/python/view_layer/test_move_into_layer_collection_f.py
+++ b/tests/python/view_layer/test_move_into_layer_collection_f.py
@@ -64,8 +64,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# collection that will be moved
collection_original = self.parse_move('Layer 1.3')
- collection_original.hide = False
- collection_original.hide_select = True
+ collection_original.enabled = True
+ collection_original.selectable = False
self.assertTrue(self.move_into('Layer 1.3', 'Layer 1.Master Collection.A'))
self.compare_tree_maps()
@@ -73,8 +73,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# we expect the settings to be carried along from the
# original layer collection
collection_new = self.parse_move('Layer 1.Master Collection.A.3')
- self.assertEqual(collection_new.hide, False)
- self.assertEqual(collection_new.hide_select, True)
+ self.assertEqual(collection_new.enabled, True)
+ self.assertEqual(collection_new.selectable, False)
# ############################################################
diff --git a/tests/python/view_layer/test_move_into_layer_collection_g.py b/tests/python/view_layer/test_move_into_layer_collection_g.py
index c3a0e80c3a0..efcdd44da97 100644
--- a/tests/python/view_layer/test_move_into_layer_collection_g.py
+++ b/tests/python/view_layer/test_move_into_layer_collection_g.py
@@ -49,13 +49,13 @@ class UnitTesting(MoveLayerCollectionTesting):
# collection that will be moved
collection_original = self.parse_move('Layer 2.3')
- collection_original.hide = False
- collection_original.hide_select = True
+ collection_original.enabled = True
+ collection_original.selectable = False
# collection that will disappear
collection_old = self.parse_move('Layer 2.C.3')
- collection_old.hide = True
- collection_old.hide_select = False
+ collection_old.enabled = False
+ collection_old.selectable = True
# move collection
self.assertTrue(self.move_into('Layer 2.3', 'Layer 2.C'))
@@ -64,8 +64,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# we expect the settings to be carried along from the
# original layer collection
collection_new = self.parse_move('Layer 2.C.3')
- self.assertEqual(collection_new.hide, False)
- self.assertEqual(collection_new.hide_select, True)
+ self.assertEqual(collection_new.enabled, True)
+ self.assertEqual(collection_new.selectable, False)
# ############################################################
diff --git a/tests/python/view_layer/test_move_into_layer_collection_h.py b/tests/python/view_layer/test_move_into_layer_collection_h.py
index fc0bef61214..82f5d70dceb 100644
--- a/tests/python/view_layer/test_move_into_layer_collection_h.py
+++ b/tests/python/view_layer/test_move_into_layer_collection_h.py
@@ -54,8 +54,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# collection that will be moved
collection_original = self.parse_move('Layer 1.3.dog')
- collection_original.hide = False
- collection_original.hide_select = True
+ collection_original.enabled = True
+ collection_original.selectable = False
self.assertTrue(self.move_into('Layer 1.3.dog', 'Layer 1.C.1'))
self.compare_tree_maps()
@@ -63,8 +63,8 @@ class UnitTesting(MoveLayerCollectionTesting):
# we expect the settings to be carried along from the
# original layer collection
collection_new = self.parse_move('Layer 1.C.1.dog')
- self.assertEqual(collection_new.hide, False)
- self.assertEqual(collection_new.hide_select, True)
+ self.assertEqual(collection_new.enabled, True)
+ self.assertEqual(collection_new.selectable, False)
# ############################################################
diff --git a/tests/python/view_layer/test_scene_copy_f.py b/tests/python/view_layer/test_scene_copy_f.py
index 726861df9ba..f97eec3b98a 100644
--- a/tests/python/view_layer/test_scene_copy_f.py
+++ b/tests/python/view_layer/test_scene_copy_f.py
@@ -24,11 +24,11 @@ class UnitTesting(ViewLayerTesting):
scene = bpy.context.scene
- hide_lookup = [0, 1, 1, 0]
- hide_lookup_sub = [1, 0, 1]
+ enabled_lookup = [True, False, False, True]
+ enabled_lookup_sub = [False, True, False]
- hide_select_lookup = [0, 0, 1, 1]
- hide_select_lookup_sub = [1, 0, 1, 0]
+ selectable_lookup = [True, True, False, False]
+ selectable_lookup_sub = [False, True, False, True]
new_collections = []
# clean everything
@@ -50,12 +50,12 @@ class UnitTesting(ViewLayerTesting):
layer.collections.link(collection)
self.assertEqual(layer.collections[-1], layer.collections[i])
- layer.collections[i].hide = hide_lookup[i]
- layer.collections[i].hide_select = hide_select_lookup[i]
+ layer.collections[i].enabled = enabled_lookup[i]
+ layer.collections[i].selectable = selectable_lookup[i]
for j, sub_collection in enumerate(layer.collections[i].collections):
- sub_collection.hide = hide_lookup_sub[j]
- sub_collection.hide_select = hide_select_lookup_sub[j]
+ sub_collection.enabled = enabled_lookup_sub[j]
+ sub_collection.selectable = selectable_lookup_sub[j]
# copy scene
bpy.ops.scene.new(type='FULL_COPY')
@@ -71,13 +71,13 @@ class UnitTesting(ViewLayerTesting):
for i, collection in enumerate(layer.collections):
new_collection = new_layer.collections[i]
- self.assertEqual(collection.hide, new_collection.hide)
- self.assertEqual(collection.hide_select, new_collection.hide_select)
+ self.assertEqual(collection.enabled, new_collection.enabled)
+ self.assertEqual(collection.selectable, new_collection.selectable)
for j, sub_collection in enumerate(layer.collections[i].collections):
new_sub_collection = new_collection.collections[j]
- self.assertEqual(sub_collection.hide, new_sub_collection.hide)
- self.assertEqual(sub_collection.hide_select, new_sub_collection.hide_select)
+ self.assertEqual(sub_collection.enabled, new_sub_collection.enabled)
+ self.assertEqual(sub_collection.selectable, new_sub_collection.selectable)
# ############################################################