-
Notifications
You must be signed in to change notification settings - Fork 18
Bug: skip None values when imprinting
#282
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
base: develop
Are you sure you want to change the base?
Conversation
When imprinting, skip values that are `None` as there is no real way to convert them to Maya-native values, nor need for it.
|
I actually think this isn't the correct fix... or at least, it's hiding the actual source issue where we're actually passing The question then becomes - how does the |
| # None is not a valid value for attributes, so we skip it | ||
| continue |
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.
I'd say that at the very least this should log a warning with the attribute name that will be skipped because the value is None so that it still stands out what is happening.
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.
Should we move the check if the value is None right before the callable(value) check?
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.
Should we move the check if the value is None right before the callable(value) check?
No, because triggering the callable could still generate a value that is None
It is actually very simple. Just add any custom attribute on the creator that is class TestCreator(plugin.MayaCreator)
identifier = "io.ayon.creators.maya.test"
label = "Test"
product_type = "test"
icon = "cube"
default_variants = []
some_great_attribute = Nonein this case I would argue that emitting any warning is now very much useless as this is usually lost in the console output and is of no use for the artist. Developer will check the code and see the comment. Also, it doesn't break any existing functionality because it would be crashing already with |
|
I can create instances for this just fine: from ayon_maya.api import plugin
class TestCreator(plugin.MayaCreator):
identifier = "io.ayon.creators.maya.test"
label = "Test"
product_type = "test"
icon = "cube"
default_variants = []
some_great_attribute = NoneI can get the error to occur with: from ayon_maya.api import plugin
class TestCreator(plugin.MayaCreator):
identifier = "io.ayon.creators.maya.test"
label = "Test"
product_type = "test"
icon = "cube"
default_variants = []
def create(self, product_name, instance_data, pre_create_data):
instance_data["world"] = None
super().create(product_name, instance_data, pre_create_data)However:
|
|
You are right but ... My issues are coming from I think we should be able to store some defined set of data types in any host. The questions are:
I realize that first question is more for ayon-core. |
|
I think it is highly related to this issue I've created on ayon-core: ynput/ayon-core#1304 I believe passing of untyped and unchecked dictionaires like |
Changelog Description
When imprinting, skip values that are
Noneas there is no real way to convert them to Maya-native values, nor need for it.Additional review information
When Maya enounters
Nonevalue when imprinting, it crashes withTypeError: Unsupported type: <class 'NoneType'>. I think that we can safely assume that if it isNone, we don't need to store it.Testing notes:
Nonevalue to instance data in a creator