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

Merge Maya Edits to USD, when Skeletons are involved, ends up in an error #3765

Closed
daniele-niero opened this issue May 15, 2024 · 7 comments · Fixed by #3820
Closed

Merge Maya Edits to USD, when Skeletons are involved, ends up in an error #3765

daniele-niero opened this issue May 15, 2024 · 7 comments · Fixed by #3820
Assignees
Labels
bug Something isn't working

Comments

@daniele-niero
Copy link

Issue Description

Maya is able to read and show (USD) Skeletons when loaded through Create->Universal Scene Description (USD)->Stage From File, but it doesn't show individual joints and therefore I can't change them.
However it is possible to right click on the joint root, in the Outliner and choose Edit As Maya Data and the skeleton structure is now converted into Maya's joints.
Now that I have Maya joints I can modify them and right clicking again on the joint root, now a Maya joint, I can see two extra options: Merge Maya Edits to USD and Discard Maya Edits
Discarding edits works just fine. Maya joints disappear and the USD structure come back. Good.
Unfortunately Merge Maya Edits to USD ends always with an error

Steps to reproduce

Steps to reproduce the behavior:

  1. Save this usd file anywhere you want:
#usda 1.0
(
    defaultPrim = "SkeletonGroup"
    metersPerUnit = 0.01
    upAxis = "Z"
)

def SkelRoot "SkeletonGroup" (
    kind = "assembly"
)
{
    def Skeleton "joint1" (
        prepend apiSchemas = ["SkelBindingAPI"]
        customData = {
            dictionary Maya = {
                bool generated = 1
            }
        }
    )
    {
        uniform matrix4d[] bindTransforms = [( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ), ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ), ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )]
        uniform token[] joints = ["joint1", "joint1/joint2", "joint1/joint2/joint3"]
        uniform matrix4d[] restTransforms = [( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ), ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) ), ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )]
        rel skel:animationSource = </SkeletonGroup/joint1/Animation>

        def SkelAnimation "Animation"
        {
            uniform token[] joints = ["joint1/joint2", "joint1/joint2/joint3"]
            quatf[] rotations = [(1, 0, 0, 0), (1, 0, 0, 0)]
            half3[] scales = [(1, 1, 1), (1, 1, 1)]
            float3[] translations = [(2, 0, 0), (2, 0, 0)]
        }
    }
}

This was generated by this Maya structure, exported to USD from Maya itself. Image

  1. Go to Create -> Universal Scene Description (USD) -> Stage From File...
    Image

  2. Select and load the USD file above.
    This will create this structure in Maya:
    Image

  3. Select joint1, which is the Skeleton in the USD structure, right click on it and select Edit As Maya Data
    Image
    Now the USD structure is converted into standard Maya Joints
    image

  4. Modify the joints in any way you want
    Image

  5. Select again joint1, right click on it, and choose Merge Maya Edits to USD
    Image

  6. This will result in an error:

# Opening layer 'anon:0000020F824DF680:tmp.usda' for writing
# Writing to already-open layer 'anon:0000020F824DF680:tmp.usda'
# Error: RuntimeError: Given export root was neither a parent or child of any of the items to export; export aborting

Expected behavior

Whatever modification was done on the joints in Maya, should go back to the USD structure without errors.
If an error happens, it should be clear and explain what went wrong with details and possibly explaining what we should do instead.

Specs:

  • Windows 10
  • Maya versions tried: 2022, 2024, 2025
@daniele-niero daniele-niero added the bug Something isn't working label May 15, 2024
@wallworm
Copy link
Collaborator

Thank you for reporting. We will look into this.

@santosd
Copy link
Collaborator

santosd commented May 17, 2024

Hi @daniele-niero I see the problem you are having. USD expects for joints to exist under a group so that it can convert that into the skel root prim. This seems to be causing issues when we attempt to run an edit as maya data on the root joint.
The workaround in your case would be to run the Edit As Maya Data on the SkeletonGroup prim instead. That way when you merge the edits it has a group to convert back to the USD skel root prim.

I think you still have a valid point that this should still work so I am going to log a ticket internally to see if we can have our development team take a look, but in the meantime try running the Edit As Maya Data on the "SkeletonGroup" instead of on "Joint1"

@daniele-niero
Copy link
Author

@santosd Thank you.

I tried again, picking and converting the root instead of the skeleton and yes, the error is gone, however whatever modification I have done to the joints, when they were in "Maya form" is not pushed back to the USD structure.

@santosd
Copy link
Collaborator

santosd commented Jun 10, 2024

Thank you @daniele-niero I took a look at the issue. I did hit the issue, However, I noticed that my setting didn't have the skeleton options selected for merging my edits, once I made sure that I had the correct skeleton settings for my merge, everything worked as expected. Can you give that a try?

  • When you right click to Merge the edits click on the Options Box.
  • Make sure that the Skeleton and Skin cluster options have All as the option:
    image
  • Once you perform the merge you should see the changes.

I did notice a different issue on my end that when I merge my skeleton it is not in the same location as it is in Maya. I will log this issue internally to have one of our developers take a look.

@daniele-niero
Copy link
Author

daniele-niero commented Jun 12, 2024

Sorry @santosd but it still doesn't work.

The only time I get the SkeletonRoot to convert back to USD data is when those options you mentioned are set to None, all other options gives me errors. Specifically the one you mentioned gives me this:

# Opening layer 'anon:000001DFE1222590:tmp.usda' for writing
# Writing to already-open layer 'anon:000001DFE1222590:tmp.usda'
# Error: RuntimeError: Could not find an ancestor of the prim </__mayaUsd__/SkeletonGroupParent/SkeletonGroup/joint1> that can be converted to a SkelRoot. (USD requires that skinned meshes and skeletons be encapsulated under a SkelRoot.)

If I leave those options to None, then something happens, but as I said, nothing of what I changed gets pushed back to USD.

And of course I'm working at the SkeletonRoot level not the joint level

@santosd
Copy link
Collaborator

santosd commented Aug 30, 2024

Sorry @santosd but it still doesn't work.

The only time I get the SkeletonRoot to convert back to USD data is when those options you mentioned are set to None, all other options gives me errors. Specifically the one you mentioned gives me this:

# Opening layer 'anon:000001DFE1222590:tmp.usda' for writing
# Writing to already-open layer 'anon:000001DFE1222590:tmp.usda'
# Error: RuntimeError: Could not find an ancestor of the prim </__mayaUsd__/SkeletonGroupParent/SkeletonGroup/joint1> that can be converted to a SkelRoot. (USD requires that skinned meshes and skeletons be encapsulated under a SkelRoot.)

If I leave those options to None, then something happens, but as I said, nothing of what I changed gets pushed back to USD.

And of course I'm working at the SkeletonRoot level not the joint level

Hi @daniele-niero sorry it had been a while since I responded on this ticket. It looks like some code was merged that may help with the issue I was seeing.
In your particular error I am seeing that that the Edit was done on /__mayaUsd__/SkeletonGroupParent/SkeletonGroup/joint1 which instead of the skeleton group. Could you verify that you are editing the correct node? I was not able to repro the issue you are seeing on my end.

@santosd
Copy link
Collaborator

santosd commented Sep 9, 2024

Hi @daniele-niero Just checking back to see if you have had a chance to test the information I provided previously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants