-
Notifications
You must be signed in to change notification settings - Fork 203
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
seando-adsk
merged 2 commits into
dev
from
donnels/EMSUSD-717/use_display_color_pref_fix
Jan 17, 2024
Merged
EMSUSD-717: USD Prefs: "Use Display Color" preferences are maintained when user cancels change #3553
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,10 @@ global proc mayaUsd_PrefUntexturedModeChanged() | |
if (`radioButtonGrp -exists usdPrefUntexturedMode`) { | ||
int $sel = `radioButtonGrp -q -select usdPrefUntexturedMode`; | ||
optionVar -iv mayaUsd_ShowDisplayColorTextureOff ($sel == 2); | ||
|
||
// 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; | ||
ogs -reset; | ||
} | ||
} | ||
|
@@ -104,6 +108,13 @@ global proc mayaUsd_PrefInitOptionVars(int $forceFactoryDefault) | |
string $saveLayerFormatArgBinaryOptionPref = `python("import mayaUsd.lib as mlib; mlib.OptionVarTokens.SaveLayerFormatArgBinaryOption")`; | ||
string $confirmExistingFileSaveOptionPref = `python("import mayaUsd.lib as mlib; mlib.OptionVarTokens.ConfirmExistingFileSave")`; | ||
|
||
// Special case for the resetting the untextured mode. | ||
if ($forceFactoryDefault && `optionVar -exists "mayaUsd_ShowDisplayColorTextureOff"`) { | ||
if (`optionVar -q "mayaUsd_ShowDisplayColorTextureOff"`) { | ||
optionVar -transient -iv mayaUsd_PrefUntexturedModeChanged 1; | ||
} | ||
} | ||
|
||
int $mjv = `about -majorVersion`; | ||
if ($mjv <= 2022) { | ||
if ($forceFactoryDefault || !`optionVar -exists mayaUsd_SerializedUsdEditsLocation`) { | ||
|
@@ -155,8 +166,13 @@ global proc mayaUsd_PrefInitOptionVars(int $forceFactoryDefault) | |
-iv mayaUsd_ShowDisplayColorTextureOff false | ||
; | ||
} | ||
// Need to refresh the viewport for display mayaUsd_ShowDisplayColorTextureOff | ||
ogs -reset; | ||
|
||
if ($forceFactoryDefault && `optionVar -q mayaUsd_PrefUntexturedModeChanged`) | ||
{ | ||
// Need to refresh the viewport for display mayaUsd_ShowDisplayColorTextureOff | ||
optionVar -remove mayaUsd_PrefUntexturedModeChanged; | ||
ogs -reset; | ||
} | ||
} | ||
|
||
global proc mayaUsd_PrefCreateTab() | ||
|
@@ -392,8 +408,20 @@ global proc mayaUsd_PrefHoldState(string $mode) | |
}; | ||
prefsHoldOptionVars($prefOptionVars, $mode); | ||
|
||
if ($mode == "save") { | ||
// Preferences dialog was opened, make sure we don't have this transient optionVar. | ||
optionVar -remove mayaUsd_PrefUntexturedModeChanged; | ||
} | ||
|
||
if ($mode == "restore") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation seems off here.. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 (`optionVar -q mayaUsd_PrefUntexturedModeChanged`) { | ||
// Need to refresh the viewport for display mayaUsd_ShowDisplayColorTextureOff | ||
ogs -reset; | ||
} | ||
} | ||
|
||
if ($mode == "remove") { | ||
// Finalize preference changes into MayaUsd. | ||
optionVar -remove mayaUsd_PrefUntexturedModeChanged; | ||
} | ||
|
||
global string $gPreferenceWindow; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.