Skip to content
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

Max: Implementation of the validator for model name #59

Merged
merged 26 commits into from
Mar 7, 2024

Conversation

moonyuet
Copy link
Member

Changelog Description

Ported from Openpype: ynput/OpenPype#6164
Implement the validator for model name in 3dsmax

Additional info

The validation regex by default is (.*)_(?P<subset>.*)_(GEO) and
your model name should be {Some name}_{SubsetName}_GEO

Testing notes:

  1. Go to OP/AYON Settings
  2. Turn on Validate Model Name
  3. Set your preferred validation regex for checking your model name
  4. Validate Model Name would check your name accordingly with your validation regex

@ynbot ynbot added size/S type: enhancement Improvement of existing functionality or minor addition host: 3dsmax labels Feb 14, 2024
@LiborBatek
Copy link
Member

Im getting this error when validating the publish:

DEBUG: ['TeaCup01']
Traceback (most recent call last):
  File "C:\Users\lbate\AppData\Local\Ynput\AYON\dependency_packages\ayon_2402141620_windows.zip\dependencies\pyblish\plugin.py", line 527, in __explicit_process
    runner(*args)
  File "C:\Work\REPO\ayon-core\client\ayon_core\hosts\max\plugins\publish\validate_model_name.py", line 96, in process
    invalid = self.get_invalid(instance)
  File "C:\Work\REPO\ayon-core\client\ayon_core\hosts\max\plugins\publish\validate_model_name.py", line 49, in get_invalid
    invalid_model_name = cls.get_invalid_model_name(instance, name)
  File "C:\Work\REPO\ayon-core\client\ayon_core\hosts\max\plugins\publish\validate_model_name.py", line 61, in get_invalid_model_name
    current_asset_name = instance.context.data["asset"]
KeyError: 'asset'

@moonyuet
Copy link
Member Author

Im getting this error when validating the publish:

DEBUG: ['TeaCup01']
Traceback (most recent call last):
  File "C:\Users\lbate\AppData\Local\Ynput\AYON\dependency_packages\ayon_2402141620_windows.zip\dependencies\pyblish\plugin.py", line 527, in __explicit_process
    runner(*args)
  File "C:\Work\REPO\ayon-core\client\ayon_core\hosts\max\plugins\publish\validate_model_name.py", line 96, in process
    invalid = self.get_invalid(instance)
  File "C:\Work\REPO\ayon-core\client\ayon_core\hosts\max\plugins\publish\validate_model_name.py", line 49, in get_invalid
    invalid_model_name = cls.get_invalid_model_name(instance, name)
  File "C:\Work\REPO\ayon-core\client\ayon_core\hosts\max\plugins\publish\validate_model_name.py", line 61, in get_invalid_model_name
    current_asset_name = instance.context.data["asset"]
KeyError: 'asset'

Im getting this error when validating the publish:

DEBUG: ['TeaCup01']
Traceback (most recent call last):
  File "C:\Users\lbate\AppData\Local\Ynput\AYON\dependency_packages\ayon_2402141620_windows.zip\dependencies\pyblish\plugin.py", line 527, in __explicit_process
    runner(*args)
  File "C:\Work\REPO\ayon-core\client\ayon_core\hosts\max\plugins\publish\validate_model_name.py", line 96, in process
    invalid = self.get_invalid(instance)
  File "C:\Work\REPO\ayon-core\client\ayon_core\hosts\max\plugins\publish\validate_model_name.py", line 49, in get_invalid
    invalid_model_name = cls.get_invalid_model_name(instance, name)
  File "C:\Work\REPO\ayon-core\client\ayon_core\hosts\max\plugins\publish\validate_model_name.py", line 61, in get_invalid_model_name
    current_asset_name = instance.context.data["asset"]
KeyError: 'asset'

This happens mainly because the instance.context.data["asset"] switched to instance.context.data["folderPath"] in AYON. Should be working now with the latest commit.

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.

All works as expected.
Validator correctly kicks in. Select Invalid select the non valid geometry
Screenshot 2024-02-26 124048

And if correct then validates properly without error:
image

Copy link
Member

@antirotor antirotor left a comment

Choose a reason for hiding this comment

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

I think we should make it more artist friendly, especially validator that will trigger probably very often. I know that we are not using it on many places, but publisher has already ability to show stuff.

Look at https://github.com/ynput/ayon-core/blob/develop/client/ayon_core/hosts/maya/plugins/publish/validate_node_ids.py

Maybe not the greatest example, but it is using PublishXmlValidationError and xml file located in help directory.

I do understand that this is pretty straightforward validation that is requiring simple action from artist, so I stating it here mainly as a reference.

@moonyuet moonyuet requested review from antirotor and BigRoy February 28, 2024 10:53
Copy link
Member

@antirotor antirotor left a comment

Choose a reason for hiding this comment

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

apart that json file it looks a works great

Copy link
Member

Choose a reason for hiding this comment

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

this shouldn't probably be here in this PR

@moonyuet moonyuet requested a review from antirotor March 5, 2024 04:15
Copy link
Member

@antirotor antirotor left a comment

Choose a reason for hiding this comment

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

great, thanks for the changes!

@moonyuet moonyuet merged commit 7dc8505 into develop Mar 7, 2024
@moonyuet moonyuet deleted the enhancement/OP-7076_Validate-Model-Name branch March 7, 2024 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
host: 3dsmax size/S type: enhancement Improvement of existing functionality or minor addition
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants