mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Fix set_attribute for enum attributes
This commit is contained in:
parent
b538efdcdd
commit
4d87046f6a
1 changed files with 9 additions and 1 deletions
|
|
@ -1522,7 +1522,15 @@ def set_attribute(attribute, value, node):
|
|||
cmds.addAttr(node, longName=attribute, **kwargs)
|
||||
|
||||
node_attr = "{}.{}".format(node, attribute)
|
||||
if "dataType" in kwargs:
|
||||
enum_type = cmds.attributeQuery(attribute, node=node, enum=True)
|
||||
if enum_type and value_type == "str":
|
||||
enum_string_values = cmds.attributeQuery(
|
||||
attribute, node=node, listEnum=True
|
||||
)[0].split(":")
|
||||
cmds.setAttr(
|
||||
"{}.{}".format(node, attribute), enum_string_values.index(value)
|
||||
)
|
||||
elif "dataType" in kwargs:
|
||||
attr_type = kwargs["dataType"]
|
||||
cmds.setAttr(node_attr, value, type=attr_type)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue