[Bf-blender-cvs] [cc061d349b2] blender2.8: Depsgraph: Connect duplicating geometry to duplicator

Sergey Sharybin noreply at git.blender.org
Wed Sep 19 16:10:25 CEST 2018


Commit: cc061d349b253583d8120e6e7be56d09f96c639e
Author: Sergey Sharybin
Date:   Wed Sep 19 15:09:55 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBcc061d349b253583d8120e6e7be56d09f96c639e

Depsgraph: Connect duplicating geometry to duplicator

This allows to force duplicated object to be fully evaluated for
display/draw.

Previously only transform component of duplicated object was
forced to become evaluated.

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

M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
M	source/blender/depsgraph/intern/depsgraph_type_defines.cc
M	source/blender/depsgraph/intern/depsgraph_types.h
M	source/blender/depsgraph/intern/nodes/deg_node_component.cc
M	source/blender/depsgraph/intern/nodes/deg_node_component.h

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 0b072256dba..ec279a1c716 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -620,6 +620,11 @@ void DepsgraphNodeBuilder::build_object(int base_index,
 		is_parent_collection_visible_ = is_visible;
 		build_collection(object->dup_group);
 		is_parent_collection_visible_ = is_current_parent_collection_visible;
+		add_operation_node(&object->id,
+		                   DEG_NODE_TYPE_DUPLI,
+		                   NULL,
+		                   DEG_OPCODE_PLACEHOLDER,
+		                   "Dupli");
 	}
 }
 
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index bdbac826544..002369b7910 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -468,6 +468,8 @@ void DepsgraphRelationBuilder::build_collection(
 	OperationKey object_transform_final_key(object != NULL ? &object->id : NULL,
 	                                        DEG_NODE_TYPE_TRANSFORM,
 	                                        DEG_OPCODE_TRANSFORM_FINAL);
+	ComponentKey duplicator_key(object != NULL ? &object->id : NULL,
+	                            DEG_NODE_TYPE_DUPLI);
 	if (!group_done) {
 		LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
 			build_object(NULL, cob->ob);
@@ -480,7 +482,22 @@ void DepsgraphRelationBuilder::build_collection(
 		FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(collection, ob, graph_->mode)
 		{
 			ComponentKey dupli_transform_key(&ob->id, DEG_NODE_TYPE_TRANSFORM);
-			add_relation(dupli_transform_key, object_transform_final_key, "Dupligroup");
+			add_relation(dupli_transform_key,
+			             object_transform_final_key,
+			             "Dupligroup");
+			/* Hook to special component, to ensure proper visibility/evaluation
+			 * optimizations.
+			 */
+			add_relation(dupli_transform_key, duplicator_key, "Dupligroup");
+			const eDepsNode_Type dupli_geometry_component_type =
+			        deg_geometry_tag_to_component(&ob->id);
+			if (dupli_geometry_component_type != DEG_NODE_TYPE_UNDEFINED) {
+				ComponentKey dupli_geometry_component_key(
+				        &ob->id, dupli_geometry_component_type);
+				add_relation(dupli_geometry_component_key,
+				             duplicator_key,
+				             "Dupligroup");
+			}
 		}
 		FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END;
 	}
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
index df6e72f490f..47cb3ebcd91 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
@@ -408,6 +408,7 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
 		case DEG_NODE_TYPE_COPY_ON_WRITE:
 		case DEG_NODE_TYPE_OBJECT_FROM_LAYER:
 		case DEG_NODE_TYPE_BATCH_CACHE:
+		case DEG_NODE_TYPE_DUPLI:
 		{
 			ComponentDepsNode *comp_node = (ComponentDepsNode *)node;
 			if (!comp_node->operations.empty()) {
diff --git a/source/blender/depsgraph/intern/depsgraph_type_defines.cc b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
index 7abde2e865c..1a0b1e64279 100644
--- a/source/blender/depsgraph/intern/depsgraph_type_defines.cc
+++ b/source/blender/depsgraph/intern/depsgraph_type_defines.cc
@@ -101,6 +101,8 @@ const char *nodeTypeAsString(eDepsNode_Type type)
 		STRINGIFY_TYPE(SHADING_PARAMETERS);
 		STRINGIFY_TYPE(CACHE);
 		STRINGIFY_TYPE(BATCH_CACHE);
+		/* Duplication. */
+		STRINGIFY_TYPE(DUPLI);
 
 		/* Total number of meaningful node types. */
 		case NUM_DEG_NODE_TYPES: return "SpecialCase";
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index 534376653e9..ed488ddf185 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -155,6 +155,11 @@ typedef enum eDepsNode_Type {
 	/* Batch Cache Component - TODO (dfelinto/sergey) rename to make it more generic. */
 	DEG_NODE_TYPE_BATCH_CACHE,
 
+	/* Duplication system. Used to force duplicated objects visible when
+	 * when duplicator is visible.
+	 */
+	DEG_NODE_TYPE_DUPLI,
+
 	/* Total number of meaningful node types. */
 	NUM_DEG_NODE_TYPES,
 } eDepsNode_Type;
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
index 9600eadb126..72718fb48a0 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
@@ -393,6 +393,7 @@ DEG_COMPONENT_NODE_DEFINE(Shading,           SHADING,            ID_RECALC_DRAW)
 DEG_COMPONENT_NODE_DEFINE(ShadingParameters, SHADING_PARAMETERS, ID_RECALC_DRAW);
 DEG_COMPONENT_NODE_DEFINE(Transform,         TRANSFORM,          ID_RECALC_TRANSFORM);
 DEG_COMPONENT_NODE_DEFINE(ObjectFromLayer,   OBJECT_FROM_LAYER,  ID_RECALC);
+DEG_COMPONENT_NODE_DEFINE(Dupli,             DUPLI,              0);
 
 /* Node Types Register =================================== */
 
@@ -414,6 +415,7 @@ void deg_register_component_depsnodes()
 	deg_register_node_typeinfo(&DNTI_SHADING_PARAMETERS);
 	deg_register_node_typeinfo(&DNTI_TRANSFORM);
 	deg_register_node_typeinfo(&DNTI_OBJECT_FROM_LAYER);
+	deg_register_node_typeinfo(&DNTI_DUPLI);
 }
 
 }  // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/nodes/deg_node_component.h
index e4a77f2e72b..9a87269b301 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h
@@ -193,6 +193,7 @@ DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(Shading);
 DEG_COMPONENT_NODE_DECLARE_GENERIC(ShadingParameters);
 DEG_COMPONENT_NODE_DECLARE_GENERIC(Transform);
 DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(ObjectFromLayer);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Dupli);
 
 /* Bone Component */
 struct BoneComponentDepsNode : public ComponentDepsNode {



More information about the Bf-blender-cvs mailing list