maya-usd icon indicating copy to clipboard operation
maya-usd copied to clipboard

Cannot export root prim with assembly kind if there are non-component gprim descendants

Open Jimmy-LeeBoisvert opened this issue 3 years ago • 1 comments

Bug description When exporting a hierarchy containing gprims with Maya USD and the kind=assembly argument, there is the following error:

Error: </main> has kind 'assembly', which is derived from 'assembly'. Assemblies should not directly contain meshes/gprims.

I understand that conceptually a USD assembly should typically contain component prims or nested assembly prims, but nothing prevents having gprims directly under an assembly prim in pure USD, and considering that the code raising this error was written in 2016, I was wondering if this was a legacy behavior that should not be enforced anymore.

Funnily, I can get around this behavior by using the relatively new disableModelKindProcessor=true argument and adding a USD_kind attribute set to "assembly" on the root Maya node. I can also set the kind argument in the export command to any arbitrary value, and nothing enforces the kind that I've set to be a valid registered kind value. This makes me think that the error might be legacy behavior, and could simply be removed.

Conceptually, I think it would make more sense for Maya to not validate the kind in any way, and rather leave that responsibility to the users, especially considering that USD itself supports having an "assembly" kind with gprims underneath.

Steps to reproduce

  1. In Maya, create an empty group called "root".
  2. Create a mesh node (e.g. a polygon cube) and parent it to the "root" node.
  3. Select the "root" group node.
  4. Export the "root" group node to USD using the following MEL export command in the Maya script editor:
file -force -options "kind=assembly;defaultUSDFormat=usda;" -typ "USD Export" -es "/your/export/usd/file.usda";
  1. Notice the following error:
Error: </root> has kind 'assembly', which is derived from 'assembly'. Assemblies should not directly contain meshes/gprims. Please remove 1 prim: /root/pCube1 //

Expected behavior I would expect Maya USD to let us export root prims that have the "assembly" kind (and any kind for that matter) and that contain gprims that are not under a "component" kind prim, considering that USD itself allows it.

Specs (if applicable):

  • Maya version: 2022.3
  • Maya USD version: 0.19.0

Additional context The code raising an error is in maya-usd/lib/mayaUsd/fileio/jobs/modelKindProcessor.cpp line 194.

Jimmy-LeeBoisvert avatar Sep 07 '22 22:09 Jimmy-LeeBoisvert

We're experiencing the same thing. Is there a good reason for this validation, because it just seems to be getting in the way, and we're having to build a workaround for it.

erikstantoncarlson avatar Apr 02 '25 20:04 erikstantoncarlson