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

MAYA-106722 Maya check callback to see if there are any unsaved edits #934

Closed
wants to merge 4 commits into from

Conversation

fowlertADSK
Copy link
Contributor

This adds a file new and open check callback so we can warn the user that they have USD edits that are not saved. The "check" callbacks from Maya pass a bool variable that you can set to false in order to block the file IO operation. Meaning, before Maya actually opens another file or creates a new scene we can cancel it and stay in the current scene.

We are still iterating on the entire workflow of warning the user and then helping them to quick save the edits, so at the moment this is only in the ADSK plugin. Once we finalize the workflow we can look at what might be useful down in the shared lib.

Copy link

@kxl-adsk kxl-adsk left a comment

Choose a reason for hiding this comment

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

Even if we enable this for the Autodesk plugin only, I don't see why we wouldn't put sceneResetCheck in the mayaUsd library. Please move it.

@kxl-adsk kxl-adsk added the workflows Related to in-context workflows label Nov 20, 2020
continue;
}

std::string temp;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This variable is unused.

SdfLayerHandleVector allLayers = stage->GetLayerStack(true);
for (auto layer : allLayers) {
if (layer->IsDirty()) {
atLeastOneDirty = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not break here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The for loop will exit immediately, it checks atLeastOneDirty. I think I had originally been printing out some information while debugging something and just left it like this (but completely missed the temp variable you pointed out). I could remove the check in the for loop and add an extra line to "break" here if you prefer that style.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually it won't because you are in a for-loop (allLayers) inside of that other for-loop (that checks atLeastOneDirty).

@fowlertADSK fowlertADSK added the do-not-merge-yet Development is not finished, PR not ready for merge label Nov 23, 2020
@fowlertADSK
Copy link
Contributor Author

Even if we enable this for the Autodesk plugin only, I don't see why we wouldn't put sceneResetCheck in the mayaUsd library. Please move it.

Were you thinking about adding some kind of registration where plugins would provide their proxy shape node id or something to tell the lib to look at it for dirty layers?

One of the reasons I didn’t bother adding it to the common lib yet, other than just that we’re still in-progress on this, was that I believe the Animal Logic ability to save edits to the Maya scene leave the Usd layers dirty. So even though they have saved everything and can recover it, Maya will still provide this warning dialog. If this is moved down to the lib then I guess the easiest way to avoid this is the registration where we only look at proxy shapes that are requesting this check. I’m assuming that you are voting to do that and enable it for the ADSK and Pixar nodes, but not the Animal Logic node?

Or were you voting to move it to the shared lib but only have it look at the ADSK nodes?

@kxl-adsk
Copy link

Maybe even simpler than that. Let's move sceneResetCheck.cpp and sceneResetCheck.h to the core library. Make sure any studio plugin (not limited to AL or PXR) that derives from ProxyShapeBase can register the check (so deal with the node type). Finally, as part of this change, we only make Autodesk proxy to register this check.

@kxl-adsk
Copy link

kxl-adsk commented Jan 9, 2021

@fowlertADSK I believe this PR can be now closed?

@kxl-adsk kxl-adsk closed this Jan 15, 2021
@fowlertADSK fowlertADSK deleted the fowlert/MAYA-106780/check_for_dirty_state branch January 18, 2021 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge-yet Development is not finished, PR not ready for merge workflows Related to in-context workflows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants