diff options
Diffstat (limited to 'intern/cycles/render/graph.cpp')
-rw-r--r-- | intern/cycles/render/graph.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index 1b138455515..684fe6a82c4 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -221,7 +221,7 @@ ShaderGraph::ShaderGraph() finalized = false; simplified = false; num_node_ids = 0; - add(new OutputNode()); + add(create_node<OutputNode>()); } ShaderGraph::~ShaderGraph() @@ -272,7 +272,7 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to) ShaderInput *convert_in; if (to->type() == SocketType::CLOSURE) { - EmissionNode *emission = new EmissionNode(); + EmissionNode *emission = create_node<EmissionNode>(); emission->color = make_float3(1.0f, 1.0f, 1.0f); emission->strength = 1.0f; convert = add(emission); @@ -285,7 +285,7 @@ void ShaderGraph::connect(ShaderOutput *from, ShaderInput *to) } } else { - convert = add(new ConvertNode(from->type(), to->type(), true)); + convert = add(create_node<ConvertNode>(from->type(), to->type(), true)); convert_in = convert->inputs[0]; } @@ -416,7 +416,7 @@ void ShaderGraph::find_dependencies(ShaderNodeSet &dependencies, ShaderInput *in void ShaderGraph::clear_nodes() { foreach (ShaderNode *node, nodes) { - delete node; + delete_node(node); } nodes.clear(); } @@ -428,7 +428,7 @@ void ShaderGraph::copy_nodes(ShaderNodeSet &nodes, ShaderNodeMap &nnodemap) /* copy nodes */ foreach (ShaderNode *node, nodes) { - ShaderNode *nnode = node->clone(); + ShaderNode *nnode = node->clone(this); nnodemap[node] = nnode; /* create new inputs and outputs to recreate links and ensure @@ -523,7 +523,7 @@ void ShaderGraph::remove_proxy_nodes() if (!removed[node->id]) newnodes.push_back(node); else - delete node; + delete_node(node); } nodes = newnodes; @@ -821,7 +821,7 @@ void ShaderGraph::clean(Scene *scene) if (visited[node->id]) newnodes.push_back(node); else - delete node; + delete_node(node); } nodes = newnodes; @@ -848,43 +848,43 @@ void ShaderGraph::default_inputs(bool do_osl) if (!input->link && (!(input->flags() & SocketType::OSL_INTERNAL) || do_osl)) { if (input->flags() & SocketType::LINK_TEXTURE_GENERATED) { if (!texco) - texco = new TextureCoordinateNode(); + texco = create_node<TextureCoordinateNode>(); connect(texco->output("Generated"), input); } if (input->flags() & SocketType::LINK_TEXTURE_NORMAL) { if (!texco) - texco = new TextureCoordinateNode(); + texco = create_node<TextureCoordinateNode>(); connect(texco->output("Normal"), input); } else if (input->flags() & SocketType::LINK_TEXTURE_UV) { if (!texco) - texco = new TextureCoordinateNode(); + texco = create_node<TextureCoordinateNode>(); connect(texco->output("UV"), input); } else if (input->flags() & SocketType::LINK_INCOMING) { if (!geom) - geom = new GeometryNode(); + geom = create_node<GeometryNode>(); connect(geom->output("Incoming"), input); } else if (input->flags() & SocketType::LINK_NORMAL) { if (!geom) - geom = new GeometryNode(); + geom = create_node<GeometryNode>(); connect(geom->output("Normal"), input); } else if (input->flags() & SocketType::LINK_POSITION) { if (!geom) - geom = new GeometryNode(); + geom = create_node<GeometryNode>(); connect(geom->output("Position"), input); } else if (input->flags() & SocketType::LINK_TANGENT) { if (!geom) - geom = new GeometryNode(); + geom = create_node<GeometryNode>(); connect(geom->output("Tangent"), input); } @@ -1064,7 +1064,7 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight if (fin) { /* mix closure: add node to mix closure weights */ - MixClosureWeightNode *mix_node = new MixClosureWeightNode(); + MixClosureWeightNode *mix_node = create_node<MixClosureWeightNode>(); add(mix_node); ShaderInput *fac_in = mix_node->input("Fac"); ShaderInput *weight_in = mix_node->input("Weight"); @@ -1101,7 +1101,7 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight /* already has a weight connected to it? add weights */ float weight_value = node->get_float(weight_in->socket_type); if (weight_in->link || weight_value != 0.0f) { - MathNode *math_node = new MathNode(); + MathNode *math_node = create_node<MathNode>(); add(math_node); if (weight_in->link) |