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

How to use the AtEnum API?

2 ANTWORTEN 2
GELÖST
Antworten
Nachricht 1 von 3
AaronWPowell
532 Aufrufe, 2 Antworten

How to use the AtEnum API?

I'm trying to figure out how to use the AtEnum API, specifically so I can work with state shaders with the Python API. Are there any good references in either C++ or Python I can reference that show how to get/set enum values from an AtNode object?

2 ANTWORTEN 2
Nachricht 2 von 3
AaronWPowell
als Antwort auf: AaronWPowell

I figured it out after digging through the API a bit. This code snippet shows a basic solution.

 

from arnold import *

AiBegin()

shader = AiNode(None, "state_float")
entry = AiNodeGetNodeEntry(shader)
enum = AiParamGetEnum(AiNodeEntryLookUpParameter(entry, "variable"))
value = AiEnumGetValue(enum, "sx")

print(value) # prints out 0

AiEnd()
Nachricht 3 von 3
AaronWPowell
als Antwort auf: AaronWPowell

I should also clarify...

 

This solution ^^ is great for accessing the EnumAPI, but it turns out all you need to do to set or get the enum value from something like a `state_float` node is to use `AiNodeSetStr()` or `AiNodeGetStr()`.

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