-
I'm trying to import specific prims using the adsk mayaUSDImport python command but with the full parent hierarchy of the prim. By default mayaUSDImport imports the primPath directly to the world. One solution is to construct the parent hierarchy with groups before importing and passing the dag path to parent argument of the mayaUSDImport command. However it feels like a nasty hack and it's ignoring all the usd prim data (ie transforms) of the parents, unless the data is copied manually, hence the nasty hack feeling. Another solution is to ignore the primPath argument altogether and traverse the stage deactivating all the prims that are not the specific prim or its parents. This solution seems optimistic in terms of modifying the stage with the usd core api to a result that can be imported with the mayaUSDImport command but I'm under the impression deactivating all other prims is not the best way to go. I've looked in PopulationMasks and LoadRules and while they work great in the usd core domain I haven't found a way to get a layer identifier with those masks or load rules applied successfully to an import. If you have any suggestions please let me know. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I couldn't find a satisfying way that wouldn't involve a code change. It all boils down to the traversal that the import job is doing. When prim path is provided, we only traverse the subset. Another way around would be to provide a predicate to the traversal and filter all the prims that aren't under given path OR aren't being a parent namespace. The place where such a predicate would need to be set is here maya-usd/lib/mayaUsd/fileio/jobs/readJob.cpp Line 204 in 6a9f673 It is all untested, but by looking at the code that's where I would start. Hope it helps. |
Beta Was this translation helpful? Give feedback.
-
I'm afraid modifying cpp code is above my dev grade but I did manage to achieve what I want by deactivating all other prims with the python api. It doesn't look elegant and hasn't been tested thoroughly but I've attached the code snippet in case it helps someone else or anyone has any suggestions for it. My next problem in line is importing that modified stage without affecting the original stage if it's already in memory (ie loaded in a proxyShape) but I've posted a different question regarding the importing of anonymous layers here. Thank you for taking the time.
|
Beta Was this translation helpful? Give feedback.
I couldn't find a satisfying way that wouldn't involve a code change. It all boils down to the traversal that the import job is doing. When prim path is provided, we only traverse the subset. Another way around would be to provide a predicate to the traversal and filter all the prims that aren't under given path OR aren't being a parent namespace. The place where such a predicate would need to be set is here
maya-usd/lib/mayaUsd/fileio/jobs/readJob.cpp
Line 204 in 6a9f673
It is all untested, but by looking at the code that's where I would start. Hope it helps.