mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Fix #2497: reset empty string attributes correctly to "" instead of "None"
This commit is contained in:
parent
7ecfda3566
commit
5d2c5d7776
1 changed files with 7 additions and 7 deletions
|
|
@ -313,13 +313,7 @@ def attribute_values(attr_values):
|
|||
|
||||
"""
|
||||
|
||||
# NOTE(antirotor): this didn't work for some reason for Yeti attributes
|
||||
# original = [(attr, cmds.getAttr(attr)) for attr in attr_values]
|
||||
original = []
|
||||
for attr in attr_values:
|
||||
type = cmds.getAttr(attr, type=True)
|
||||
value = cmds.getAttr(attr)
|
||||
original.append((attr, str(value) if type == "string" else value))
|
||||
original = [(attr, cmds.getAttr(attr)) for attr in attr_values]
|
||||
try:
|
||||
for attr, value in attr_values.items():
|
||||
if isinstance(value, string_types):
|
||||
|
|
@ -331,6 +325,12 @@ def attribute_values(attr_values):
|
|||
for attr, value in original:
|
||||
if isinstance(value, string_types):
|
||||
cmds.setAttr(attr, value, type="string")
|
||||
elif value is None and cmds.getAttr(attr, type=True) == "string":
|
||||
# In some cases the maya.cmds.getAttr command returns None
|
||||
# for string attributes but this value cannot assigned.
|
||||
# Note: After setting it once to "" it will then return ""
|
||||
# instead of None. So this would only happen once.
|
||||
cmds.setAttr(attr, "", type="string")
|
||||
else:
|
||||
cmds.setAttr(attr, value)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue