[Bf-blender-cvs] [93f6a9d6522] blender2.8: Depsgraph: Add special cases to deal with multiple objects selection update

Sergey Sharybin noreply at git.blender.org
Fri Nov 24 10:45:31 CET 2017


Commit: 93f6a9d65220f9c43dc6dde7886880d77015eb8c
Author: Sergey Sharybin
Date:   Fri Nov 24 09:54:09 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB93f6a9d65220f9c43dc6dde7886880d77015eb8c

Depsgraph: Add special cases to deal with multiple objects selection update

The idea then is to avoid doing depsgraph tag for each of the object which
selection is changed (which could be tricky to do anyway due to lots of areas
of selection code where this could happen), and simply tag scene's with
selection update tag.

This will involve synchronization of flags from base to objects, which is
rather cheap anyway.

===================================================================

M	source/blender/depsgraph/intern/depsgraph_tag.cc

===================================================================

diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 968be5269c4..2e6d5043336 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -284,13 +284,34 @@ void id_tag_update_copy_on_write(Depsgraph *graph, IDDepsNode *id_node)
 
 void id_tag_update_select_update(Depsgraph *graph, IDDepsNode *id_node)
 {
-	ComponentDepsNode *batch_cache_comp =
-	        id_node->find_component(DEG_NODE_TYPE_BATCH_CACHE);
-	OperationDepsNode *select_update_node =
-	    batch_cache_comp->find_operation(DEG_OPCODE_GEOMETRY_SELECT_UPDATE,
-	                                     "", -1);
-	if (select_update_node != NULL) {
-		select_update_node->tag_update(graph);
+	ComponentDepsNode *component;
+	OperationDepsNode *node = NULL;
+	const ID_Type id_type = GS(id_node->id_orig->name);
+
+	if (id_type == ID_SCE) {
+		/* We need to flush base flags to all objects in a scene since we
+		 * don't know which ones changed. However, we don't want to update
+		 * the whole scene, so pick up some operation which will do as less
+		 * as possible.
+		 *
+		 * TODO(sergey): We can introduce explicit exit operation which
+		 * does nothing and which is only used to cascade flush down the
+		 * road.
+		 */
+		component = id_node->find_component(DEG_NODE_TYPE_LAYER_COLLECTIONS);
+		node = component->find_operation(DEG_OPCODE_VIEW_LAYER_DONE);
+	}
+	else if (id_type == ID_OB) {
+		component = id_node->find_component(DEG_NODE_TYPE_LAYER_COLLECTIONS);
+		node = component->find_operation(DEG_OPCODE_OBJECT_BASE_FLAGS);
+	}
+	else {
+		component = id_node->find_component(DEG_NODE_TYPE_BATCH_CACHE);
+		node = component->find_operation(DEG_OPCODE_GEOMETRY_SELECT_UPDATE,
+		                                     "", -1);
+	}
+	if (node != NULL) {
+		node->tag_update(graph);
 	}
 }



More information about the Bf-blender-cvs mailing list