Skip to content

Commit 085058b

Browse files
authored
Merge pull request #172 from BigRoy/bugfix/maya_usd_export_030_default_prim
USD Export: Workaround default prim bug in Maya 2025.3 with Maya USD 0.30.0
2 parents 815a5bc + 72f26fe commit 085058b

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

client/ayon_maya/plugins/publish/extract_maya_usd.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ def process(self, instance):
258258
# Parse export options
259259
options = self.default_options
260260
options = self.parse_overrides(instance, options)
261-
self.log.debug("Export options: {0}".format(options))
262261

263262
# Perform extraction
264263
self.log.debug("Performing extraction ...")
@@ -343,6 +342,23 @@ def parse_attr_str(attr_str):
343342
)
344343
del options[key]
345344

345+
# Fix default prim bug in Maya USD 0.30.0 where prefixed `|` remains
346+
# See: https://github.com/Autodesk/maya-usd/issues/3991
347+
if (
348+
options.get("exportRoots") # only if roots are defined
349+
and "defaultPrim" not in options # ignore if already set
350+
and "rootPrim" not in options # ignore if root is created
351+
and maya_usd_version == (0, 30, 0) # only for Maya USD 0.30.0
352+
):
353+
# Define the default prim name as it will end up in the USD file
354+
# from the first export root node
355+
first_root = options["exportRoots"][0]
356+
default_prim = first_root.rsplit("|", 1)[-1]
357+
if options["stripNamespaces"]:
358+
default_prim = default_prim.rsplit(":", 1)[-1]
359+
options["defaultPrim"] = default_prim
360+
361+
self.log.debug("Export options: {0}".format(options))
346362
self.log.debug('Exporting USD: {} / {}'.format(file_path, members))
347363
with maintained_time():
348364
with maintained_selection():

0 commit comments

Comments
 (0)