diff options
Diffstat (limited to 'intern/cycles/render/graph.cpp')
-rw-r--r-- | intern/cycles/render/graph.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index 852aaca5ad5..32c176949ed 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -210,8 +210,7 @@ ShaderGraph::ShaderGraph() ShaderGraph::~ShaderGraph() { - foreach(ShaderNode *node, nodes) - delete node; + clear_nodes(); } ShaderNode *ShaderGraph::add(ShaderNode *node) @@ -240,7 +239,7 @@ ShaderGraph *ShaderGraph::copy() copy_nodes(nodes_all, nodes_copy); /* add nodes (in same order, so output is still first) */ - newgraph->nodes.clear(); + newgraph->clear_nodes(); foreach(ShaderNode *node, nodes) newgraph->add(nodes_copy[node]); @@ -354,6 +353,14 @@ void ShaderGraph::find_dependencies(ShaderNodeSet& dependencies, ShaderInput *in } } +void ShaderGraph::clear_nodes() +{ + foreach(ShaderNode *node, nodes) { + delete node; + } + nodes.clear(); +} + void ShaderGraph::copy_nodes(ShaderNodeSet& nodes, ShaderNodeMap& nnodemap) { /* copy a set of nodes, and the links between them. the assumption is |