question

Alan Jones avatar image
Alan Jones asked ·

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.

arnoldmtoa
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

1 Answer

· Write an Answer
Stephen Blair avatar image
Stephen Blair answered ·

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()

4 comments Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

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.

0 Likes 0 · ·

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

0 Likes 0 · ·
Alan Jones avatar image Alan Jones 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.

0 Likes 0 · ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.