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

Substance Painter: Allow users to set texture resolutions when loading mesh to create project #6262

Merged
merged 20 commits into from
Apr 24, 2024

Conversation

moonyuet
Copy link
Member

@moonyuet moonyuet commented Apr 15, 2024

Changelog Description

This PR is to add the support of template settings in the mesh loaders for Substance project creation. User can customize and add template settings in AYON settings and apply it through the option mode(the button with memo icon).

Additional info

This PR also refactors the original loader's setting without directly import qargparse.
Prefers user to use options (memo icon) to set up their preferences as the prompt dialog might not set up the project as expected(It is still experimental).

Testing notes:

  1. Customize the template with a template name in Substance Painter OP setting

  2. Launch Substance Painter

  3. Click Load..

  4. It would pop up the dialog to allow you to choose your template settings

  5. Click Ok
    image

  6. It should apply all the settings you set in AYON settings

@ynbot ynbot added host: Substance Painter type: bug Something isn't working size/XS Denotes a PR changes 0-99 lines, ignoring general files labels Apr 15, 2024
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.

Don't have substance painter installed on my machine currently - so can't test.
Code seems fine overall, just had some small remarks - see comments.

openpype/hosts/substancepainter/plugins/load/load_mesh.py Outdated Show resolved Hide resolved
openpype/hosts/substancepainter/plugins/load/load_mesh.py 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.

The Load with Options works ok and offer all the settings including UDIM tiles workflow etc.
Screenshot 2024-04-15 134134

When Loading with options, all works ok as seen on the vid

SP_Load_Options.mp4

But when just Load model without diving into Options then it starts to have issues, check the vid pls.

SP_Load_No_Options.mp4

I would say it mimicks the issue as in ayon-core repo.

@moonyuet
Copy link
Member Author

The Load with Options works ok and offer all the settings including UDIM tiles workflow etc. Screenshot 2024-04-15 134134

When Loading with options, all works ok as seen on the vid

SP_Load_Options.mp4
But when just Load model without diving into Options then it starts to have issues, check the vid pls.

SP_Load_No_Options.mp4
I would say it mimicks the issue as in ayon-core repo.

I believe it is more likely because the substance painter api doesn't convert the default object into python instance

@moonyuet moonyuet marked this pull request as draft April 16, 2024 09:41
@moonyuet moonyuet marked this pull request as ready for review April 18, 2024 06:51
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.

Works great, all fine I have tried to change some template name to see how the UI accomodate to such change and all fine...

Did test all the templates and all good!

Screenshot 2024-04-18 090425

And when loading the model inside SP

Screenshot 2024-04-18 090847

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.

Getting error on Load Model atm

Screenshot 2024-04-22 104356

Traceback (most recent call last):
  File "C:\Work\REPO\OpenPype\openpype\tools\loader\widgets.py", line 1592, in _load_representations_by_loader
    load_with_repre_context(
  File "C:\Work\REPO\OpenPype\openpype\pipeline\load\utils.py", line 324, in load_with_repre_context
    return loader.load(repre_context, name, namespace, options)
  File "C:\Work\REPO\OpenPype\openpype\hosts\substancepainter\plugins\load\load_mesh.py", line 160, in load
    result = SubstanceProjectConfigurationWindow.prompt(
  File "C:\Work\REPO\OpenPype\openpype\hosts\substancepainter\plugins\load\load_mesh.py", line 136, in prompt
    dialog = cls(templates)
  File "C:\Work\REPO\OpenPype\openpype\hosts\substancepainter\plugins\load\load_mesh.py", line 84, in __init__
    self._update_to_match_template(template_name)
  File "C:\Work\REPO\OpenPype\openpype\hosts\substancepainter\plugins\load\load_mesh.py", line 115, in _update_to_match_template
    self.widgets["import_cameras"].setChecked(template["import_cameras"])
KeyError: 'import_cameras'

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 all working and also Template presets propagates its params into the popup win UI with Project Configuration so when some attrib being off it will be also disabled in this UI widget.

Good to go!

@moonyuet moonyuet merged commit 41e72ff into develop Apr 24, 2024
1 check passed
@moonyuet moonyuet deleted the bugfix/AY-4570_Substance-project-attributes branch April 24, 2024 08:15
@ynbot ynbot added this to the next-patch milestone Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: Substance Painter size/XS Denotes a PR changes 0-99 lines, ignoring general files type: bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants