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

EMSUSD-717: USD Prefs: "Use Display Color" preferences are maintained when user cancels change #3553

Merged
merged 2 commits into from
Jan 17, 2024

Conversation

seando-adsk
Copy link
Collaborator

EMSUSD-717: USD Preferences: "Use Display Color" preferences are maintained when user cancels change

  • Fix cancel case and optimize when to call 'ogs -reset'

…tained when user cancels change

* Fix cancel case and optimize when to call 'ogs -reset'
@seando-adsk seando-adsk added the adsk Related to Autodesk plugin label Jan 12, 2024
Comment on lines +97 to +100

// Set a temporary optionVar saying that we have changed the untextured mode
// so in case user cancels, we can do reset again.
optionVar -transient -iv mayaUsd_PrefUntexturedModeChanged 1;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

transient optionvars are not saved when exiting Maya. ogs -reset is not a cheap operation so we should not just call it unless needed (such as when opening the pref dialog we don't need to call it). Use this optionvar to keep track of when the untextured mode pref changes and only call ogs -reset when needed.

optionVar -remove mayaUsd_PrefUntexturedModeChanged;
}

if ($mode == "restore") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indentation seems off here..

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry it is a mix of tabs/spaces. I'll fix it.

if ($mode == "restore") {
if (`optionVar -q mayaUsd_PrefUntexturedModeChanged`) {
// Need to refresh the viewport for display mayaUsd_ShowDisplayColorTextureOff
ogs -reset;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we remove the mayaUsd_PrefUntexturedModeChanged optionVar once the viewport is reset?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is covered by the "restore" case just below. when you click cancel on the prefs dialog this function will be called twice (restore, then remove). When you click save from the prefs dialog it will be called with "remove".

…tained when user cancels change

* Fix indentation (code review comment)
@seando-adsk seando-adsk self-assigned this Jan 17, 2024
@seando-adsk seando-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jan 17, 2024
@seando-adsk seando-adsk merged commit e86bf80 into dev Jan 17, 2024
11 checks passed
@seando-adsk seando-adsk deleted the donnels/EMSUSD-717/use_display_color_pref_fix branch January 17, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants