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

Using Python API to get mesh_light info

6 ANTWORTEN 6
GELÖST
Antworten
Nachricht 1 von 7
Anonymous
804 Aufrufe, 6 Antworten

Using Python API to get mesh_light info

Given an assfile which contains a mesh_light and a polymesh,

where the 'mesh' parameter of the mesh_light is correctly linked to

the polymesh...


Using the Python API, how do I query the mesh_light's 'mesh' parameter to get the polymesh node? I've used 'SetPtr' a lot to create these links but

I can't quite get the hang of querying them..


I have this snippet:

    AiBegin()
    AiASSLoad(ass_file, AI_NODE_ALL)
    iter = AiUniverseGetNodeIterator(AI_NODE_ALL)
    while not AiNodeIteratorFinished(iter):
          node = AiNodeIteratorGetNext(iter)
          if AiNodeIs(node, 'mesh_light'):
             meshPtr = AiNodeGetPtr(node, "mesh")


How do I use the integer pointer 'meshPtr' to get to the actual

polymesh node?


Thank you,




Tags (2)
Beschriftungen (2)
6 ANTWORTEN 6
Nachricht 2 von 7
Stephen.Blair
als Antwort auf: Anonymous

You can do things like AiNodeGetName( meshPtr )

Here's a snippet from MtoA:

        defaultOperatorNode = ai.AiNodeGetPtr(ai.AiUniverseGetOptions(universe), "operator")
        defaultOperator = ''
        if defaultOperatorNode:
            defaultOperator = ai.AiNodeGetName(defaultOperatorNode)




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

Hmm, yes, I had tried that earlier, but got:


name = AiNodeGetName(meshPtr)
File "/usr/apps/arnold/arnold-5.1.0.1/python/arnold/ai_nodes.py", line 86, in AiNodeGetName
return AtPythonStringToStr(_AiNodeGetName(node))
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: expected LP_AtNode instance instead of int

Nachricht 4 von 7
Anonymous
als Antwort auf: Stephen.Blair

Btw, we don't use Maya or MtoA, we have our own in-house node based editor 'Crom' (like Katana) and Arnold Core. Thanks

Nachricht 5 von 7
Stephen.Blair
als Antwort auf: Anonymous

It worked for me (with the latest Arnold). I'll have to check through the release notes to see if there was a related fix.

With the attached ass file, this:

from arnold import *
AiBegin()
AiASSLoad("C:/Users/Stephen Blair/Documents/maya/projects/default/scenes/mesh_light_test3.ass", AI_NODE_ALL)
iter = AiUniverseGetNodeIterator(AI_NODE_ALL)
while not AiNodeIteratorFinished(iter):
    node = AiNodeIteratorGetNext(iter)
    if AiNodeIs(node, 'mesh_light'):
        meshPtr = AiNodeGetPtr(node, "mesh")
        print meshPtr
        print AiNodeGetName( meshPtr )
       
AiEnd()        

Printed this:

<arnold.ai_nodes.LP_AtNode object at 0x00000000D2CC90C8>
/pSphere1/light_pSphere1/light_pSphere1Shape@mesh




// Stephen Blair
// Arnold Renderer Support
Nachricht 6 von 7
Anonymous
als Antwort auf: Stephen.Blair

hmm, dang, yes, this job is still on 5.1.0.1, we have more recent versions online, 5.2.2.0, 5.4.0.2, and 6.0.1.0 but we've not fully tested in production 6.0.1.0.

Ideally, would just like to keep using 5.1.0.1 for this job.. If there's a bug with that version for this, can you think of any alternative way to do this?

Thanks!




Nachricht 7 von 7
Anonymous
als Antwort auf: Stephen.Blair

Okay, just found that this works in 5.4.0.2

Thanks!



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