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:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-03-17 14:47:29 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-04-01 02:27:08 +0300
commiteba09b1520c06df304bc353e93d7220b4e83b755 (patch)
tree27f1e1e397a78b3f2f11a986599ee82d7bbcb89d /source/blender/editors/space_outliner
parent97b9afda3719627b9e52d1862ffd3b0b3ef12518 (diff)
Blender 2.8: Hook of layer collections evaluation in DEG
This moves selectability/visibility flag flush from some hardcoded places in the code to depsgraph. This way it is possible to simply tag depsgraph to update those flags and rest it'll do on its own. Using depsgraph for such flush is an overkill: those flags are fully static and can not be animated, so it doesn't really make sense to hook only those to depsgraph. However, in the future we will have overrides on collections, which ideally would need to be animatable and drivable and easiest way to support this is to do this on depsgraph level, so it ensures proper order of evaluation for animation and drivers. And it seems logical to do both overrides and flags flush from depsgraph from this point of view. This commit also includes the evaluation of IDProperty for collections, which basically are just another form of override. So once we implement the other kind of overrides the flushing and collection evaluation won't change. Patch by Sergey Sharybin and Dalai Felinto
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c5
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c13
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c2
3 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index c5cfd47486f..e9c49ffdb14 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -26,6 +26,7 @@
#include "BKE_context.h"
#include "BKE_collection.h"
+#include "BKE_depsgraph.h"
#include "BKE_layer.h"
#include "BKE_report.h"
@@ -120,6 +121,7 @@ static int collection_link_exec(bContext *C, wmOperator *op)
BKE_collection_link(sl, sc);
+ DAG_relations_tag_update(CTX_data_main(C));
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
return OPERATOR_FINISHED;
}
@@ -217,6 +219,7 @@ static int collection_unlink_exec(bContext *C, wmOperator *op)
SceneLayer *sl = CTX_data_scene_layer(C);
BKE_collection_unlink(sl, lc);
+ DAG_relations_tag_update(CTX_data_main(C));
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
return OPERATOR_FINISHED;
}
@@ -244,6 +247,7 @@ static int collection_new_exec(bContext *C, wmOperator *UNUSED(op))
SceneCollection *sc = BKE_collection_add(scene, NULL, NULL);
BKE_collection_link(sl, sc);
+ DAG_relations_tag_update(CTX_data_main(C));
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
return OPERATOR_FINISHED;
}
@@ -342,6 +346,7 @@ static int collection_delete_exec(bContext *C, wmOperator *UNUSED(op))
TODO_LAYER_OVERRIDE; /* handle overrides */
outliner_tree_traverse(soops, &soops->tree, 0, TSE_SELECTED, collection_delete_cb, &data);
+ DAG_relations_tag_update(CTX_data_main(C));
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 5d1323bbdd8..cbfe0828103 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -245,15 +245,13 @@ 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 restrictbutton_collection_hide_cb(bContext *C, void *poin, void *poin2)
+static void restrictbutton_collection_hide_cb(bContext *C, void *poin, void *UNUSED(poin2))
{
Scene *scene = poin;
- LayerCollection *collection = poin2;
- SceneLayer *sl = BKE_scene_layer_find_from_collection(scene, collection);
/* hide and deselect bases that are directly influenced by this LayerCollection */
- BKE_scene_layer_base_flag_recalculate(sl);
- BKE_scene_layer_engine_settings_collection_recalculate(sl, collection);
+ /* TODO(sergey): Use proper flag for tagging here. */
+ DAG_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);
}
@@ -264,10 +262,9 @@ static void restrictbutton_collection_hide_select_cb(bContext *C, void *poin, vo
LayerCollection *collection = poin2;
if ((collection->flag & COLLECTION_SELECTABLE) == 0) {
- SceneLayer *sl = BKE_scene_layer_find_from_collection(scene, collection);
-
/* deselect bases that are directly influenced by this LayerCollection */
- BKE_scene_layer_base_flag_recalculate(sl);
+ /* TODO(sergey): Use proper flag for tagging here. */
+ DAG_id_tag_update(&scene->id, 0);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
}
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, NULL);
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index a2753dac644..34879c09583 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -847,11 +847,13 @@ static void collection_cb(int event, TreeElement *te, TreeStoreElem *UNUSED(tsel
}
else {
BKE_collection_unlink(sl, lc);
+ DAG_relations_tag_update(CTX_data_main(C));
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
}
}
else if (event == OL_COLLECTION_OP_COLLECTION_DEL) {
if (BKE_collection_remove(scene, sc)) {
+ DAG_relations_tag_update(CTX_data_main(C));
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
}
else {