Community
Arnold General Rendering Forum
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

How do I access the polymesh of a scene from a custom procedure node?

2 ANTWORTEN 2
Antworten
Nachricht 1 von 3
Anonymous
251 Aufrufe, 2 Antworten

How do I access the polymesh of a scene from a custom procedure node?

mtoa 2.0.1
Arnold core 5.0.1.0

I'm trying to create a custom procedural node.
The aim is to create a new polymesh as a guide of polymesh of a specific name in the scene. However, when accessing the data of specified polymesh from init () or get_node () of Procedural API, NULL is returned in many cases. Occasionally, "vlist" or "nsides" is returned correctly, but I do not know the reason.
Does anyone know the right way?

Code example


	procedural_init
	{
		AtString obj_name = AiNodeGetStr( node, "object" );
		AtNode* pNode = AiNodeLookUpByName( obj_name );

		AtArray* pSideArray = AiNodeGetArray( pNode, "nsides" );
		int nSides = AiArrayGetNumElements( pSideArray );
	}
	procedural_get_node
	{
		Instancer* pInstancer = (Instancer*)user_ptr;
		AtNode* pObj = pInstancer->objects[i];

		if( AiNodeIs(pObj, AtString("polymesh")) )
		{
			AtArray* pVIdxArray = AiNodeGetArray( pObj, "vidxs" );
			int nPolys = AiArrayGetNumElements( pVIdxArray );

			AtArray* pVerts = AiNodeGetArray( pObj, "vlist" );
			int nVerts = AiArrayGetNumElements( pVerts );
		}
	}
2 ANTWORTEN 2
Nachricht 2 von 3
Stephen.Blair
als Antwort auf: Anonymous

Those arrays (like vlist) are destroyed during the render process, where the data is transformed and stored internally in an optimized way. If you want the render to avoid deleting those arrays, you have to create the render session as interactive: AiBegin(AI_SESSION_INTERACTIVE);



// Stephen Blair
// Arnold Renderer Support
Nachricht 3 von 3
Anonymous
als Antwort auf: Anonymous

@Stephen Blair

Thanks for answering, stephen.
I was very helpful about the internal behavior of Arnold. Since the core version I am using is 5.0.1, I will verify with version 5.1 or higher, which can use the instructed API.

By the way, I'd like to ask because I do not have help etc, but is there any disadvantage in interactive mode compared to normal mode?
I use it with mtoa, but it seems that using with maya_batch can not be done easily without script customization.
Thank you.

Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.

In Foren veröffentlichen  

Autodesk Design & Make Report