Skip to content

Commit 7a1b62c

Browse files
authored
Merge pull request #1258 from yannci/mayaUsdPlugin10.3
options: Build maya IECoreUSD against the maya-usd plugin libraries if installed
2 parents 210c457 + f3c2f01 commit 7a1b62c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

config/ie/options

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,29 @@ if targetApp=="maya" :
326326
INSTALL_COREMAYA_POST_COMMAND="scons -i -f config/ie/postCoreMayaInstall MAYA_VERSION='" + mayaVersion + "' INSTALLPREFIX="+appPrefix+" install"
327327
WITH_MAYA_PLUGIN_LOADER = 1
328328

329+
mayaUsdVersion = mayaReg.get( "mayaUsdVersion" )
330+
mayaUsdReg = IEEnv.registry["apps"]["mayaUsd"].get( mayaUsdVersion, {} ).get( platform )
331+
# If the Maya usd plugin is not in the registry we build against our standalone USD version
332+
if mayaUsdReg :
333+
pluginUsdVersion = mayaUsdReg["usdVersion"]
334+
# Maya ships the USD libraries with the installation, but not the header files... we use the one that are installed by standalone usd
335+
usdReg = IEEnv.registry["apps"]["usd"].get( pluginUsdVersion, {} ).get( platform )
336+
if usdReg :
337+
USD_INCLUDE_PATH = os.path.join( usdReg["location"], targetApp, compatibilityVersion, "include" )
338+
339+
mayaLooseVersion = distutils.version.LooseVersion(mayaVersion)
340+
if mayaLooseVersion >= "2022" and mayaLooseVersion < "2023":
341+
# Maya 2022 installs the USD libs and the maya plugin itself for python 2 and 3. This is not the case for the 2020 version
342+
# We make the assumption, that the python version suffix is for Maya 2022 only, because Maya 2023 will be python 3 exclusively.
343+
mayaPythonMajorVersion = mayaReg["pythonVersion"].split(".")[0]
344+
USD_LIB_PATH = os.path.join( mayaUsdReg["location"], "mayausd/USD{}/lib".format( mayaPythonMajorVersion ) )
345+
else:
346+
USD_LIB_PATH = os.path.join( mayaUsdReg["location"], "mayausd/USD/lib" )
347+
348+
# Pixar introduced a library prefix `usd_` in USD v21.11, which Autodesk does not use yet, so we have to reset the prefix.
349+
# See https://github.com/Autodesk/maya-usd/issues/2108 for reference
350+
USD_LIB_PREFIX = "" if mayaUsdReg.get( "usdLibPrefix" ) == "" else mayaUsdReg.get( "usdLibPrefix" ) or USD_LIB_PREFIX
351+
329352
# find nuke if we're building for nuke
330353
if targetApp=="nuke" :
331354

0 commit comments

Comments
 (0)