Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use the AtEnum API?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
AaronWPowell
403 Views, 2 Replies

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 REPLIES 2
Message 2 of 3
AaronWPowell
in reply to: 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()
Message 3 of 3
AaronWPowell
in reply to: 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()`.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report