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.
Solved! Go to Solution.
Solved by Stephen.Blair. Go to Solution.
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()
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.
Sure, you could use a custom procedural node to create all kinds of Arnold nodes.
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.
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.