On 22/08/2016 at 15:43, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   17 
Platform:      Mac OSX  ; 
Language(s) :     C++  ;

Does anybody have an example of how to use GvNode::SetTitle()? It doesn't seem to be working for me on nodes that are not the root. i.e.: if I do:

GvNodeMaster* m_nodeMaster = GvGetWorld()->AllocNodeMaster(master, false, true);
GvNode* root = m_nodeMaster->GetRoot();
GvNode* bxdf = m_nodeMaster->CreateNode(root, ID_OPERATOR_OBJECT);

I can see that root has the  new title, "FOOBAR"; bxdf does not get the "BLAH" title.


On 23/08/2016 at 05:19, xxxxxxxx wrote:

Hi Ian,

the reason is the node type. Object nodes always show the name of the linked object. The title gets only shown on them, if the linked object gets deleted. To test this, create a Null object and drop it onto your object node. It shows "Null" as title. Now, delete the Null object in the Object Manager and look at the node again. It shows your set title (with yellow background, as the node doesn't work without a linked object).

On 23/08/2016 at 08:47, xxxxxxxx wrote:

Hi Andreas,

Thanks for getting back to me so quickly! Maybe I'm going about this the wrong way then. What I'm trying to do is basically create a shader network creation UI, similar to what the Arnold plugin has.

From an e-mail with Sebastian, I took the example code here and stuck it into our plugin and now I can display the node graph UI in a dialog window.


and then I added the necessary calls in my MaterialData class (GvGetWorld()->AllocNodeMaster(), GvGetWorld()->FreeNodeMaster(), CopyTo(), etc...). Just as a test, I was hoping to then call some method in my MaterialData that would build the shading network to be ready for display. The graph would have nodes that represent both our pattern plugins (registered as C4D shaders/ShaderData) and MaterialData. I would use SetTitle() so that it displayed the title/name of the pattern plugin the node represented, along with its input/output ports already displayed.

If there's a better way to do this I should be pursuing, I'm open to suggestions.


On 24/08/2016 at 02:48, xxxxxxxx wrote:

Hi Ian,

in general Arnold does a different thing compared to what seem to be you trying to do. As far as we know, Arnold's material node system is completely independent from any C4D entities (in the sense of materials, shaders,...). So they basically have virtual nodes referencing their own entities.

I'm not completely sure about the actual problem/question. Is it still about the naming of the nodes? I mean, you can reference for example shaders with an object node (ID_OPERATOR_OBJECT) and the title of the node shows the name of the shader.

Please don't hesitate to get back to me, if I missed your point.

On 24/08/2016 at 15:06, xxxxxxxx wrote:

Hi Andreas,

Well, the naming of the nodes is one part of the problem, but it sounds like my overall approach wouldn't work.

Basically, the approach I took was something like:

- before displaying the node graph dialog, get the current active object.
- get the object's Ttexture tag, if it exists.
- Get the material from the Ttexture tag.
- Call a "GenerateGraph" method from the material and return the GvNodeMaster instance and attach it to our GvNodeGUI instance.
- The "GenerateGraph" would populate the GvNodeMaster with the nodes that represented the shader graph for that material, so you would have one material node and multiple shader nodes wired into it.

However, it sounds like from your explanation, the nodes I create would be tied/linked to the MaterialData object in this case? I can't create arbitrary, non-linked, objects where I'd be free to set the title/add ports etc?

So far I've only been testing to see if I can create arbitrary nodes in the graph (it's not tied to our ShaderData plugins yet), hence my question about SetTitle.

You mentioned Arnold was probably use virtual nodes. Is there a documentation page I can refer to about virtual nodes?

Thanks for your patience with me, Andreas! Sorry if my questions don't make sense. I'm still trying to get myself up to speed with the C4D API terminology


On 25/08/2016 at 05:31, xxxxxxxx wrote:

Hi Ian,

please, don't feel sorry for asking questions. After all your questions partly feed my family and two cats ;)

And documentation-wise is GraphView a bitter topic.

As long as you use the object node (ID_OPERATOR_OBJECT) those nodes would indeed be tied to materials and shaders. In order to "create arbitrary, non-linked, objects where I'd be free to set the title/add ports, you'd have to create your own nodes derived from GvOperatorData. I think, in your case this should actually be quite easy, as your nodes don't need to do anything (if I'm not mistaken). I mean, you are using the nodes just for visualization and connecting purposes, right?
While we do have no detailed documentation, there's at least an example on a GvOperatorData implementation in this thread (you don't need the Calculate stuff).

As we are leaving the realms of setting node titles, I think, we should move into a new thread, so future users can easily find the infos again.

Edit: fixed links

On 25/08/2016 at 10:24, xxxxxxxx wrote:

LOL, OK. At least I don't feel as bad if I'm feeding people. :D

Yep, for now I'm just using it for visualization and connecting purposes. I'll look into GvOperatorData docs that you linked to. And, yes, I'll open a new thread if I have more questions on this.

Thanks, Andreas!