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

Added file format attribute to LayerManager and improved format detection for serialised layers #1792

Merged

Conversation

jonjondev
Copy link
Contributor

This PR allows for the extension to now be retrieved using USD's API instead of string parsing, and adds the layer's file format as a serialisation attribute (along with the current identifier and serialised content).

This is to help deserialisation in the case that the identifier does not resolve without a proper context (which is the case with the layer manager).

@kxl-adsk kxl-adsk added al Related to AnimalLogic plugin core Related to core library labels Nov 4, 2021
@fabal fabal force-pushed the J-Mo63/add-file-format-id-to-layer-manager branch from 29976fe to 872e1c9 Compare November 8, 2021 05:12
@jonjondev
Copy link
Contributor Author

Hi @kxl-adsk, just saw a missing Clang format blocked the preflight builds. It's been formatted now if you're happy to rerun the CI.

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.

Left small request for a change in the test. You will also need to look at the PF results...there is an error in the test.

Comment on lines 150 to 151
_, rootLayerPath = tempfile.mkstemp(suffix=".usda")
_, tmpMayafilePath = tempfile.mkstemp(suffix=".ma")
Copy link

Choose a reason for hiding this comment

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

We have moved away from using temp files, because:

  • it's harder to debug
  • required periodic temp folder cleanup

For this reason, we use explicit names and local to the test area within the build folder. Generated files are easy to discover and the build folder is more often cleared than the temp folder.

Here is an example - https://github.com/Autodesk/maya-usd/blob/dev/test/lib/usd/translators/testUsdExportMaterialX.py#L43

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @kxl-adsk, looks like PF checks are now passing, and I've updated the test to avoid tempfiles (we'll keep this in mind going forward). Let me know if there's anything else needed.

import unittest

from maya import cmds
from AL.usdmaya import ProxyShape

import fixturesUtils

Choose a reason for hiding this comment

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

We use fixturesUtils all over the place. What was the reason to remove it from AL tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Internally we have not set up our testing to take advantage of the module, however that transition is underway and a PR will be up for it at some point. I'll also be removing tempfile usage across AL tests.

Choose a reason for hiding this comment

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

That’s great to hear. Looking forward to this PR.

Choose a reason for hiding this comment

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

@J-Mo63 Looks like I didn't notice something in your change. All our tests are writing files to the build folder. I just run the new tests locally and you write the source folder...this means that now I always have changes in the source tree after running tests, e.g.

git status
HEAD detached at origin/dev
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	plugin/al/plugin/AL_USDMayaTestPlugin/py/testLayerManagerOutput/

Please adjust it to match what other tests are doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes that's no good at all. The switch to fixturesUtils is on the way.

@@ -1027,6 +1026,16 @@ MStatus LayerManager::initialize()
stat = addAttribute(identifier);
CHECK_MSTATUS_AND_RETURN_IT(stat);

fileFormatId

Choose a reason for hiding this comment

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

Since we don't share the same implementation of LayerManager, it would be good to add a test for this new addition to validate the core implementation as well. I won't make it a blocker for this change, but please open a new PR with it.

@kxl-adsk kxl-adsk merged commit 82ac60a into Autodesk:dev Nov 22, 2021
@jonjondev jonjondev deleted the J-Mo63/add-file-format-id-to-layer-manager branch November 22, 2021 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
al Related to AnimalLogic plugin core Related to core library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants