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?
Gelöst! Gehe zur Lösung
Gelöst von AaronWPowell. Gehe zur Lösung
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()
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.