From 8abf6efcf60fa7f609f38fda0e085d84a72b6dba Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 4 Aug 2021 17:46:55 +0200 Subject: Cleanup: rename restrict to hide/visibility in Object, Collection, MaskLayer This makes the internal naming consistent with the public API. And also gives us a visibility_flag rather than restrictflag that can be extended with more flags. --- source/blender/blenkernel/intern/layer.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'source/blender/blenkernel/intern/layer.c') diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index ae1863f0a47..5940569ba76 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -602,7 +602,7 @@ static bool layer_collection_hidden(ViewLayer *view_layer, LayerCollection *lc) } /* Check visiblilty restriction flags */ - if (lc->flag & LAYER_COLLECTION_HIDE || lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) { + if (lc->flag & LAYER_COLLECTION_HIDE || lc->collection->flag & COLLECTION_HIDE_VIEWPORT) { return true; } @@ -1005,17 +1005,17 @@ static void layer_collection_objects_sync(ViewLayer *view_layer, BLI_addtail(r_lb_new_object_bases, base); } - if ((collection_restrict & COLLECTION_RESTRICT_VIEWPORT) == 0) { + if ((collection_restrict & COLLECTION_HIDE_VIEWPORT) == 0) { base->flag_from_collection |= (BASE_ENABLED_VIEWPORT | BASE_VISIBLE_DEPSGRAPH); if ((layer_restrict & LAYER_COLLECTION_HIDE) == 0) { base->flag_from_collection |= BASE_VISIBLE_VIEWLAYER; } - if (((collection_restrict & COLLECTION_RESTRICT_SELECT) == 0)) { + if (((collection_restrict & COLLECTION_HIDE_SELECT) == 0)) { base->flag_from_collection |= BASE_SELECTABLE; } } - if ((collection_restrict & COLLECTION_RESTRICT_RENDER) == 0) { + if ((collection_restrict & COLLECTION_HIDE_RENDER) == 0) { base->flag_from_collection |= BASE_ENABLED_RENDER; } @@ -1150,11 +1150,11 @@ static void layer_collection_sync(ViewLayer *view_layer, /* We separate restrict viewport and visible view layer because a layer collection can be * hidden in the view layer yet (locally) visible in a viewport (if it is not restricted). */ - if (child_collection_restrict & COLLECTION_RESTRICT_VIEWPORT) { - child_layer->runtime_flag |= LAYER_COLLECTION_RESTRICT_VIEWPORT; + if (child_collection_restrict & COLLECTION_HIDE_VIEWPORT) { + child_layer->runtime_flag |= LAYER_COLLECTION_HIDE_VIEWPORT; } - if (((child_layer->runtime_flag & LAYER_COLLECTION_RESTRICT_VIEWPORT) == 0) && + if (((child_layer->runtime_flag & LAYER_COLLECTION_HIDE_VIEWPORT) == 0) && ((child_layer_restrict & LAYER_COLLECTION_HIDE) == 0)) { child_layer->runtime_flag |= LAYER_COLLECTION_VISIBLE_VIEW_LAYER; } @@ -1333,7 +1333,7 @@ void BKE_main_collection_sync_remap(const Main *bmain) */ bool BKE_layer_collection_objects_select(ViewLayer *view_layer, LayerCollection *lc, bool deselect) { - if (lc->collection->flag & COLLECTION_RESTRICT_SELECT) { + if (lc->collection->flag & COLLECTION_HIDE_SELECT) { return false; } @@ -1369,7 +1369,7 @@ bool BKE_layer_collection_objects_select(ViewLayer *view_layer, LayerCollection bool BKE_layer_collection_has_selected_objects(ViewLayer *view_layer, LayerCollection *lc) { - if (lc->collection->flag & COLLECTION_RESTRICT_SELECT) { + if (lc->collection->flag & COLLECTION_HIDE_SELECT) { return false; } @@ -1457,7 +1457,7 @@ bool BKE_object_is_visible_in_viewport(const View3D *v3d, const struct Object *o { BLI_assert(v3d != NULL); - if (ob->restrictflag & OB_RESTRICT_VIEWPORT) { + if (ob->visibility_flag & OB_HIDE_VIEWPORT) { return false; } @@ -2146,14 +2146,14 @@ void BKE_base_eval_flags(Base *base) base->flag |= (base->flag_from_collection & g_base_collection_flags); /* Apply object restrictions. */ - const int object_restrict = base->object->restrictflag; - if (object_restrict & OB_RESTRICT_VIEWPORT) { + const int object_restrict = base->object->visibility_flag; + if (object_restrict & OB_HIDE_VIEWPORT) { base->flag &= ~BASE_ENABLED_VIEWPORT; } - if (object_restrict & OB_RESTRICT_RENDER) { + if (object_restrict & OB_HIDE_RENDER) { base->flag &= ~BASE_ENABLED_RENDER; } - if (object_restrict & OB_RESTRICT_SELECT) { + if (object_restrict & OB_HIDE_SELECT) { base->flag &= ~BASE_SELECTABLE; } -- cgit v1.2.3