Open ansuter opened 2 years ago
added stack trace and gif. repro in 2023.1 (mtoa 5.1.2)
Possible workaround to prevent hard crashes. Ignore parent scope, and edit in post.
def rescope_to_parent(self, parent_scope="/root"):
# https://github.com/Autodesk/maya-usd/issues/2505 - bug. Otherwise we wouldn't need this
self._require_file_overwrite = True
namespace_edit = Sdf.BatchNamespaceEdit()
# there's no way to avoid this. we have to reparent everything
for prim in self.usd_stage.TraverseAll():
parent_path = prim.GetParent().GetPath()
if str(parent_path) != '/':
continue
# /mesh1 -> /root/mesh1
prim_path = str(prim.GetPath())
namespace_edit.Add(prim_path, parent_scope + prim_path)
# https://github.com/PixarAnimationStudios/USD/blob/dc710925675f7f58f7a37f6c18d046a687b09271/pxr/usd/sdf/testenv/testSdfBatchNamespaceEdit.py
def Has(layer, path):
return bool(layer.GetObjectAtPath(path))
root_prim = self.usd_stage.DefinePrim(parent_scope, "Scope")
layer = self.usd_stage.GetRootLayer()
has_object = lambda p: Has(layer, p)
can_edit = lambda e: True
results = namespace_edit.Process(has_object, can_edit)
can_apply = layer.CanApply(namespace_edit)
log.info(f'Applying Sdf Edits: {can_apply}. {results}')
layer.Apply(namespace_edit)
MtoA 5.2+ appears to fix this issue.
Oddly hitting this again. MayaUSD 0.18, mtoa 5.2
@santosg87 could you restest this and make sure if its still happening on our side again.
Issue synced internally to EMSUSD-714
Describe the bug I want to export with a parent scope (this used to work in 0.8). But when I set it, Maya 2023 crashes. See gif.
A clear and concise description of what the bug is.
Expected behavior Either for it not to crash Maya and give me an error or to have the behavior it had before.
Attachments![crash2](https://user-images.githubusercontent.com/16786318/181124883-c722df78-f683-4d81-abce-38bd39dc98ed.gif)
Specs (if applicable): Official MayaUSD 0.18 build
Additional context Add any other context about the problem here.