question

Carlos Quintero Gonzalez avatar image
Carlos Quintero Gonzalez asked ·

How to retrieve polymesh information?

I'm creating a shader using Arnold SDK, I have instances of a polymesh in a scene and I need to access some polymesh properties through the code.

I've been digging in the API looking for a way to retrieve the polymesh node given the the ginstance pointer, but I haven't been able to get it done.

Some things I have tried:

auto parent = AiNodeGetParent(sg->Op); if (parent != nullptr) {...} //it always returns null

auto it = AiUniverseGetNodeEntryIterator(AI_NODE_ALL);

while (!AiNodeEntryIteratorFinished(it)) {...} //doesn't seem to be in there

Update: more background.

This seems to return the polymesh as a NodeEntry:

auto nodeEntry = AiNodeGetNodeEntry(sg->Op);
const char * entryName = AiNodeEntryGetName(nodeEntry);

But I see parameters inside the polymesh in the .ass file I can't find here. I have looped through the params and metadata using the given iterators without any luck:

auto paramIt = AiNodeEntryGetParamIterator(nodeEntry);

while(!AiParamIteratorFinished(paramIt))
{
auto paramEntry = AiParamIteratorGetNext(paramIt); 
auto paramname = AiParamGetName(paramEntry);
printf("%s", paramname);
}
AiParamIteratorDestroy(paramIt);
auto metadataIt = AiNodeEntryGetMetaDataIterator(nodeEntry);

while(!AiMetaDataIteratorFinished(metadataIt))
{
auto metadataEntry = AiMetaDataIteratorGetNext(metadataIt);
printf("%s", metadataEntry->name);
}
AiMetaDataIteratorDestroy(metadataIt);

I guess if it is shown in the ass file should be somewhere...

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 ·
AiNodeGetPtr(instance_node, 'node')
2 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.

This is returning null:

AiNodeGetPtr(sg->Op, "node");

I'm using MaxToA, and according to the ass file "node" is a string, but this is returning null as well

AiNodeGetStr(sg->Op, "node");

ginstance {

...

node "/iTooArnold_Mesh_000001E28ABACF90"

...

0 Likes 0 · ·

node is not a string

bin\kick -info ginstance.node
node: ginstance
param: node
type: NODE
default: (null)
0 Likes 0 · ·

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.