[Bf-blender-cvs] [6b72c23e0ac] functions: data flow graph manages source info allocation

Jacques Lucke noreply at git.blender.org
Tue Mar 26 11:22:22 CET 2019


Commit: 6b72c23e0acb48f3746ff4d503260e4eff7b4930
Author: Jacques Lucke
Date:   Tue Mar 26 10:45:50 2019 +0100
Branches: functions
https://developer.blender.org/rB6b72c23e0acb48f3746ff4d503260e4eff7b4930

data flow graph manages source info allocation

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

M	source/blender/functions/core/data_flow_graph.hpp
M	source/blender/functions/frontends/data_flow_nodes/builder.cpp

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

diff --git a/source/blender/functions/core/data_flow_graph.hpp b/source/blender/functions/core/data_flow_graph.hpp
index 3b60f425553..a9c19a9418b 100644
--- a/source/blender/functions/core/data_flow_graph.hpp
+++ b/source/blender/functions/core/data_flow_graph.hpp
@@ -291,6 +291,14 @@ namespace FN {
 			return m_nodes;
 		}
 
+		template<typename T, typename ...Args>
+		T *new_source_info(Args&&... args)
+		{
+			static_assert(std::is_base_of<SourceInfo, T>::value, "");
+			T *source = new T(std::forward<Args>(args)...);
+			return source;
+		}
+
 		std::string to_dot() const;
 		void to_dot__clipboard() const;
 
diff --git a/source/blender/functions/frontends/data_flow_nodes/builder.cpp b/source/blender/functions/frontends/data_flow_nodes/builder.cpp
index f8120f43a81..8220dc8f698 100644
--- a/source/blender/functions/frontends/data_flow_nodes/builder.cpp
+++ b/source/blender/functions/frontends/data_flow_nodes/builder.cpp
@@ -32,7 +32,7 @@ namespace FN { namespace DataFlowNodes {
 	{
 		BLI_assert(btree != nullptr);
 		BLI_assert(bnode != nullptr);
-		NodeSource *source = new NodeSource(btree, bnode);
+		NodeSource *source = m_graph->new_source_info<NodeSource>(btree, bnode);
 		return m_graph->insert(function, source);
 	}



More information about the Bf-blender-cvs mailing list