Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Maya: Add OptionalPyblishPluginMixin to all validators #5575

Closed
wants to merge 4 commits into from

Conversation

antirotor
Copy link
Member

Changelog Description

This PR is adding OptionalPyblishPluginMixin inheritance to all Maya validators. This fixes issues where validators are set as Optional in the Settings but that state is ignored on them.

Additional info

Rationale to add OptionalPyblishPluginMixin to all validators is that it should be decided in the Settings if the plugin is optional or not - or at least on one place and currently there is no way to make Settings dynamic enough so that they will get that from the plugins itself. If this mixin is present, but the setting Optional in Settings is not, it won't allow anyone to disable even the important "must-run" validators. And at the same time, adding it to the Settings will make the validator settable to Optional state.

This is also re-sorted imports with isort tools - for that I am truly sorry as it might complicate code review, but since I had to change import on most of these plugins anyway, I've chose to do it for the sake of consisten and more readable code. I've added default isort configuration in #5572.

Testing notes:

  1. Open Maya
  2. Publish - validators that are set to be optional should behave so

@antirotor antirotor added type: bug Something isn't working host: Maya labels Sep 5, 2023
@antirotor antirotor self-assigned this Sep 5, 2023
@ynbot ynbot added host: UE size/M Denotes a PR changes 500-999 lines, ignoring general files labels Sep 5, 2023
@antirotor antirotor removed the host: UE label Sep 5, 2023
Copy link
Collaborator

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. See comment - all of the mixin inherited classes should do the is_active check to actually work as intended.
  2. Also validators that ensure the correct behavior of the family for publishing should NEVER be optional. I noticed you've added the mixin to some of the classes that are actually validators that ensure the publishing works as expected like ValidateLookContent, ValidateModelContent, ValidateStepSize. I think for now you're best off ONLY changing those plugins that actually are exposed in settings currently?
    • You seem to have skipped ValidateAnimationContent which is ok because it should not be optional but I think you just 'forgot' that one? :)

)


class ValidateOutRelatedNodeIds(pyblish.api.InstancePlugin):
class ValidateOutRelatedNodeIds(pyblish.api.InstancePlugin,
OptionalPyblishPluginMixin):
Copy link
Collaborator

@BigRoy BigRoy Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately the changes made of only adding the mixin does not suffice. The process method should also be doing a self.is_active(instance.data) check to make sure it's actually skipped if the instance is toggled off. (Note that for ContextPlugin it is self.is_active(context.data).

Like:

InstancePlugin

    def process(self, instance):
        if not self.is_active(instance.data):
            return

ContextPlugin

    def process(self, context):
        if not self.is_active(context.data):
            return

Copy link
Member Author

@antirotor antirotor Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also validators that ensure the correct behavior of the family for publishing should NEVER be optional.

True, but to really make them optional, there is another step and that is defining that in the Settings. My point is that even if we add the mixin, it doesn't really make the plugin optional, only the existence of the switch in the Settings does. I would even go that far later on as to unify inheritance of all validator plugin to one class that will wrap it together. Because then it wouldn't be "confusing" in the code as you wouldn't see OptionalPyblishPluginMixin in the signature of the validator class on non-optional plugins.

setup.cfg Outdated Show resolved Hide resolved
Copy link
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now any validator can be set as optional and visible then in the publisher
image
Works fine.

@BigRoy
Copy link
Collaborator

BigRoy commented Sep 8, 2023

Works fine.

This is not true - the plug-ins are still lacking the is_active check and thus when toggled off in the UI they still process as usual. The checkboxes in the publisher thus do nothing.

@LiborBatek
Copy link
Member

Works fine.

This is not true - the plug-ins are still lacking the is_active check and thus when toggled off in the UI they still process as usual. The checkboxes in the publisher thus do nothing.

Will try it out again to confirm. Thx

@LiborBatek LiborBatek self-requested a review September 8, 2023 13:46
@LiborBatek
Copy link
Member

LiborBatek commented Sep 8, 2023

@BigRoy well to be honest I did not tested every single validator but obviously the one I tested does take into account wether ON or OFF

PublishValidation.mp4

This being also true for meshHasUVs validator... all working as it should

This being also true for MeshHasArnoldAttributes...all working fine

I can of course do more of them one by one but seems fine...at first glance. Could u give me some validator exactly not working for you so I can test that special one, pls?

@LiborBatek
Copy link
Member

LiborBatek commented Sep 8, 2023

@BigRoy so I finally found first not working

Transform Zero (Freeze) which does not respect state of the knob being it On / Off

@antirotor not sure why some validators work and some dont

Copy link
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like some validators doesnt respect the Enabled / Disabled knob state.

Need to be addressed.

@BigRoy
Copy link
Collaborator

BigRoy commented Sep 8, 2023

The reason they don't work is described here

@tokejepsen
Copy link
Member

This will need merge conflict resolve before any further testing.

@tokejepsen tokejepsen marked this pull request as draft January 16, 2024 07:35
@mkolar
Copy link
Member

mkolar commented Feb 9, 2024

Because we're splitting OpenPype into ayon-core and individual host addons, this PR would have to be re-created to target one of those.

We're closing it down, but we'll he happy for a new PR to ynput/ayon-core or the host addon repository once it's up.

@mkolar mkolar closed this Feb 9, 2024
@ynbot ynbot added this to the next-patch milestone Feb 9, 2024
@jakubjezek001 jakubjezek001 removed this from the next-patch milestone Feb 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: Maya port to AYON size/M Denotes a PR changes 500-999 lines, ignoring general files type: bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants