diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_layer.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 36 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_collections.c | 8 |
4 files changed, 7 insertions, 45 deletions
diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index cc6c43c51f6..daac35a1196 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -118,11 +118,11 @@ void BKE_base_set_visible(struct Scene *scene, struct ViewLayer *view_layer, struct Base *base, bool extend); -bool BKE_layer_collection_isolate(struct Scene *scene, +void BKE_layer_collection_isolate(struct Scene *scene, struct ViewLayer *view_layer, struct LayerCollection *lc, bool extend); -bool BKE_layer_collection_set_visible(struct ViewLayer *view_layer, +void BKE_layer_collection_set_visible(struct ViewLayer *view_layer, struct LayerCollection *lc, const bool visible, const bool hierarchy); diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index e520701dd25..5bddec8a164 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1000,25 +1000,15 @@ static void layer_collection_flag_unset_recursive(LayerCollection *lc, const int * * If the collection or any of its parents is disabled, make it enabled. * Don't change the children disable state though. - * - * Return whether depsgraph needs update. */ -bool BKE_layer_collection_isolate(Scene *scene, +void BKE_layer_collection_isolate(Scene *scene, ViewLayer *view_layer, LayerCollection *lc, bool extend) { - bool depsgraph_need_update = false; LayerCollection *lc_master = view_layer->layer_collections.first; bool hide_it = extend && (lc->runtime_flag & LAYER_COLLECTION_VISIBLE); - if ((!ID_IS_LINKED(lc->collection) && !hide_it)) { - if (lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) { - lc->collection->flag &= ~COLLECTION_RESTRICT_VIEWPORT; - depsgraph_need_update = true; - } - } - if (!extend) { /* Hide all collections . */ for (LayerCollection *lc_iter = lc_master->layer_collections.first; lc_iter; @@ -1042,13 +1032,6 @@ bool BKE_layer_collection_isolate(Scene *scene, } while (lc_parent != lc) { - if (!ID_IS_LINKED(lc_parent->collection)) { - if (lc_parent->collection->flag & COLLECTION_RESTRICT_VIEWPORT) { - lc_parent->collection->flag &= ~COLLECTION_RESTRICT_VIEWPORT; - depsgraph_need_update = true; - } - } - lc_parent->flag &= ~LAYER_COLLECTION_HIDE; for (LayerCollection *lc_iter = lc_parent->layer_collections.first; lc_iter; @@ -1067,8 +1050,6 @@ bool BKE_layer_collection_isolate(Scene *scene, } BKE_layer_collection_sync(scene, view_layer); - - return depsgraph_need_update; } static void layer_collection_bases_show_recursive(ViewLayer *view_layer, LayerCollection *lc) @@ -1101,22 +1082,12 @@ static void layer_collection_bases_hide_recursive(ViewLayer *view_layer, LayerCo * Hide/show all the elements of a collection. * Don't change the collection children enable/disable state, * but it may change it for the collection itself. - * - * Return true if depsgraph needs update. */ -bool BKE_layer_collection_set_visible(ViewLayer *view_layer, +void BKE_layer_collection_set_visible(ViewLayer *view_layer, LayerCollection *lc, const bool visible, const bool hierarchy) { - bool depsgraph_changed = false; - - if (visible && (!ID_IS_LINKED(lc->collection)) && - ((lc->collection->flag & COLLECTION_RESTRICT_VIEWPORT) != 0)) { - lc->collection->flag &= ~COLLECTION_RESTRICT_VIEWPORT; - depsgraph_changed = true; - } - if (hierarchy) { if (visible) { layer_collection_flag_unset_recursive(lc, LAYER_COLLECTION_HIDE); @@ -1135,7 +1106,6 @@ bool BKE_layer_collection_set_visible(ViewLayer *view_layer, lc->flag |= LAYER_COLLECTION_HIDE; } } - return depsgraph_changed; } /* ---------------------------------------------------------------------- */ @@ -1422,7 +1392,7 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter) static bool base_is_in_mode(struct ObjectsInModeIteratorData *data, Base *base) { - return BASE_VISIBLE(data->v3d, base) && (base->object->type == data->object_type) && + return (base->object->type == data->object_type) && (base->object->mode & data->object_mode) != 0; } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index a542911f4d4..8ccd35051c6 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -288,9 +288,7 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op) DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); - if (BKE_layer_collection_isolate(scene, view_layer, lc, extend)) { - DEG_relations_tag_update(CTX_data_main(C)); - } + BKE_layer_collection_isolate(scene, view_layer, lc, extend); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index aca9e068dc4..459183ff226 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -1045,7 +1045,6 @@ static int collection_visibility_exec(bContext *C, wmOperator *op) SpaceOutliner *soops = CTX_wm_space_outliner(C); const bool is_inside = strstr(op->idname, "inside") != NULL; const bool show = strstr(op->idname, "show") != NULL; - bool depsgraph_changed = false; struct CollectionEditData data = { .scene = scene, .soops = soops, @@ -1058,18 +1057,13 @@ static int collection_visibility_exec(bContext *C, wmOperator *op) GSetIterator collections_to_edit_iter; GSET_ITER (collections_to_edit_iter, data.collections_to_edit) { LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter); - depsgraph_changed |= BKE_layer_collection_set_visible( - view_layer, layer_collection, show, is_inside); + BKE_layer_collection_set_visible(view_layer, layer_collection, show, is_inside); } BLI_gset_free(data.collections_to_edit, NULL); BKE_layer_collection_sync(scene, view_layer); DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS); - if (depsgraph_changed) { - DEG_relations_tag_update(CTX_data_main(C)); - } - WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); return OPERATOR_FINISHED; } |