<div dir="ltr">Hi,<div><br></div><div>We don't have any example code for this specifically. It's easiest to create node with the corresponding class directly.<div><br></div><font face="monospace, monospace">CheckerTextureNode *checker = new CheckerTextureNode();<br>checker->color1 = make_float3(1.0f, 0.0f, 0.0f);<br>checker->color2 = make_float3(0.0f, 0.0f, 1.0f);<br>checker->scale = 1.0f;<br>graph->add(checker);<br>shader->set_graph(graph);</font><div><br></div><div>If you want to use the generic API, don't create your own <font face="monospace, monospace">SocketType</font>, look it up in the node.</div><div><br></div><div><font face="monospace, monospace">const SocketType *color1 = snode->find_input(ustring("color1"));</font></div><div><font face="monospace, monospace">snode->set(*color1, make_float3(1.0f, 0.0f, 0.0f));</font></div><div><br>Regards,</div><div>Brecht.</div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 8, 2018 at 2:13 PM, F Escobar <span dir="ltr"><<a href="mailto:materialesescobar@hotmail.es" target="_blank">materialesescobar@hotmail.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<div><span style="background-color:rgba(0,0,0,0)">I tried with this:</span><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::Shader *shader = new ccl::Shader();</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>if (scene != NULL)</div>
<div><span style="white-space:pre-wrap"></span>scene->shaders.push_back(<wbr>shader);</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>shader->name=ccl::ustring(<wbr>material->mName);</div>
<div><span style="white-space:pre-wrap"></span>ccl::ShaderGraph *graph = new ccl::ShaderGraph();</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>const ccl::NodeType *node_type = ccl::NodeType::find(ccl::<wbr>ustring("checker_texture"));</div>
<div><span style="white-space:pre-wrap"></span>if (!node_type) {</div>
<div><span style="white-space:pre-wrap"></span>fprintf(stderr, "Unknown shader node \n");</div>
<div><span style="white-space:pre-wrap"></span>}</div>
<div><span style="white-space:pre-wrap"></span>else if (node_type->type != ccl::NodeType::SHADER) {</div>
<div><span style="white-space:pre-wrap"></span>fprintf(stderr, "Node type \"%s\" is not a shader node.\n", node_type->name.c_str());</div>
<div><span style="white-space:pre-wrap"></span>}</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::ShaderNode* snode = (ccl::ShaderNode*)node_type-><wbr>create(node_type);</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::SocketType color1;</div>
<div><span style="white-space:pre-wrap"></span>color1.type = ccl::SocketType::COLOR;</div>
<div><span style="white-space:pre-wrap"></span><a href="http://color1.name" target="_blank">color1.name</a> = ccl::ustring("color1");</div>
<div><span style="white-space:pre-wrap"></span>snode->set(color1, ccl::make_float3(1.0f, 0.0f, 0.0f));</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::SocketType color2;</div>
<div><span style="white-space:pre-wrap"></span>color2.type = ccl::SocketType::COLOR;</div>
<div><span style="white-space:pre-wrap"></span><a href="http://color2.name" target="_blank">color2.name</a> = ccl::ustring("color2");</div>
<div><span style="white-space:pre-wrap"></span>snode->set(color2, ccl::make_float3(0.0f, 0.0f, 1.0f));</div>
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>ccl::SocketType scale;</div>
<div><span style="white-space:pre-wrap"></span>scale.type = ccl::SocketType::FLOAT;</div>
<div><span style="white-space:pre-wrap"></span><a href="http://scale.name" target="_blank">scale.name</a> = ccl::ustring("scale");</div>
<div><span style="white-space:pre-wrap"></span>snode->set(scale, 1.0f);
<div><br>
</div>
<div><span style="white-space:pre-wrap"></span>graph->add(snode);</div>
<div><span style="white-space:pre-wrap"></span>shader->set_graph(graph);</div>
</div>
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
But I had crashes creating color2 probably I'm doing it wrongly, is there any sample on this?</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0);background-color:rgba(0,0,0,0)">
Thank you in advance.</div>
</div>

<br>______________________________<wbr>_________________<br>
Bf-cycles mailing list<br>
<a href="mailto:Bf-cycles@blender.org">Bf-cycles@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-cycles" rel="noreferrer" target="_blank">https://lists.blender.org/<wbr>mailman/listinfo/bf-cycles</a><br>
<br></blockquote></div><br></div>