-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AY-6654 Look: Fix None values in collecting and applying attributes #89
AY-6654 Look: Fix None values in collecting and applying attributes #89
Conversation
… set nicely (unknown type) but do catch empty string attributes as empty values
…ue applying the rest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It all works speaking of the new way of treating the occasion when no any entry in the custom attribute present...so all good on this front!
I have issue when trying the "backward compatible" steps as it throws an error when None
value present in the JSON
so I dont get any warning only instead.
aka it seems that it still fails... (even tho my asset got the look assigned anyway)
// Warning: ayon_maya.api.lib : Skipping setting |screwD_modelMain_01_:_GRP|screwD_modelMain_01_:model_GRP|screwD_modelMain_01_:Body_GEO.custom with value 'None'
# Traceback (most recent call last):
# File "c:\Work\REPO\ayon-maya\client\ayon_maya\tools\mayalookassigner\app.py", line 286, in on_process_selected
# assign_look_by_version(
# File "c:\Work\REPO\ayon-maya\client\ayon_maya\api\lib.py", line 1889, in assign_look_by_version
# apply_shaders(relationships, shader_nodes, nodes)
# File "c:\Work\REPO\ayon-maya\client\ayon_maya\api\lib.py", line 2027, in apply_shaders
# apply_attributes(attributes, nodes_by_id)
# File "c:\Work\REPO\ayon-maya\client\ayon_maya\api\lib.py", line 1738, in apply_attributes
# set_attribute(attr, value, node)
# File "c:\Work\REPO\ayon-maya\client\ayon_maya\api\lib.py", line 1694, in set_attribute
# kwargs = ATTRIBUTE_DICT[value_type]
# KeyError: 'NoneType'
That's exactly the error this PR should solve. It applies the shaders yes, but fails to apply all attributes. |
…kip_none' into bugfix/collect_look_attributes_skip_none
Sorry, somehow my previous push of the commit failed. It was missing this: fc52bb1 Try again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now all good and no errors thrown...
Just that Warning message as mentioned in testing steps.
Good to go!
Changelog Description
This fixes a case where looks failed to apply due to
None
values being present in the collected attributes.These will now be ignored in collected. There's an edge case where Maya returns
None
for string attributes that have no values set - those are captured now explicitly to just""
to still collect and apply them later.Existing looks will now also apply correctly with
None
value in their look attributes, but the attributes withNone
values will be ignored with a warning.Additional info
Testing notes:
test
It will print
None
.4. Publish the look for this mesh
5. The published
.json
file should have attribute value fortest
set to""
To test the 'backwards compatible fix':
develop
branch. The value will benull
in the.json
file.`.json
file, and edit the""
value tonull
Then, confirm that applying the look succeeds without errors but with a warning regarding the
None
value when applying with this PR. For example in my test run it logged: