Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create Nodes within a Node

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
alan-LFL
319 Views, 5 Replies

Create Nodes within a Node

Hi all,

Say I wanted a custom Arnold node to also create some child nodes when it's made. (for instance, creating a geometry instance, material etc.)

Is this doable? Or is the only option for that DCC specific translators? If so, I notice MtoA's translator uses the naming convention CreateArnoldNodes, though has a return type of an AtNode *. Does is matter which one is returned? Is it safe from memory leaks so long as AddArnoldNode or AddExistingArnoldNode are called for/with each node created?

Cheers,

Alan.

Tags (2)
Labels (2)
5 REPLIES 5
Message 2 of 6
Stephen.Blair
in reply to: alan-LFL

You can do stuff like this in CreateArnoldNodes


   AddArnoldNode("mayaFluid", "shader");
   AddArnoldNode("MayaFluidData", "data");
   return AddArnoldNode("box")

With AddArnoldNode, the first argument is the node type. The second argument is an optional tag used to retrieve a given node later on during export

(with AtNode* node = GetArnoldNode(tag))


The last call to AddArnoldNode() doesn't have a tag because it's the "main" node, so just doing GetArnoldNode() during export will return this node. The "main" node is the node that should be returned by this AddArnoldNode()



// Stephen Blair
// Arnold Renderer Support
Message 3 of 6
alan-LFL
in reply to: Stephen.Blair

Thanks very much, Stephen. Is anything equivalent possible inside node_initialize or node_update in the actual Arnold node, rather than the translator? (Main reason I'd prefer there if I can do it is because that would be DCC agnostic as opposed to needing implementation in every *toA)

Cheers,

Alan.

Message 4 of 6
Stephen.Blair
in reply to: alan-LFL

Sure, you could use a custom procedural node to create all kinds of Arnold nodes.



// Stephen Blair
// Arnold Renderer Support
Message 5 of 6
alan-LFL
in reply to: Stephen.Blair

Thanks, Stephen. I don't think that will serve my needs, as this is for a camera. So if I created a custom procedural, it wouldn't be able to be considered as a camera, right? (without just having the translator create it, in which case I'm back to needing to implement something per translator). Or have is there some magic I can do to use a procedural as a camera?

Cheers,

Alan.

Message 6 of 6
Stephen.Blair
in reply to: alan-LFL

A procedural could create a camera, but the host application wouldn't know about that camera.

A camera shouldn't be creating nodes. I suppose you might get away with it, as long as you did it during scene initialization. But I'd be worried about node dependencies or links, a shader might not exist when try to assign it to a shape.



// Stephen Blair
// Arnold Renderer Support

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report