OP-3277 - added functionality to replace root value with environment variable.

Useful for remote workflows where Site Sync is being used.
When Load reference is used, real root value (c:/project) is replaced with ${OPENPYPE_ROOT_WORK}.
This commit is contained in:
Petr Kalis 2022-05-30 11:51:19 +02:00
parent 303eabd0a2
commit d404fbf8a2

View file

@ -8,6 +8,7 @@ from openpype.pipeline import (
legacy_create,
)
import openpype.hosts.maya.api.plugin
from openpype.api import Anatomy
from openpype.hosts.maya.api.lib import maintained_selection
@ -51,7 +52,9 @@ class ReferenceLoader(openpype.hosts.maya.api.plugin.ReferenceLoader):
with maintained_selection():
cmds.loadPlugin("AbcImport.mll", quiet=True)
nodes = cmds.file(self.fname,
anatomy = Anatomy(context["project"]["code"])
file_url = anatomy.replace_root_with_env_key(self.fname, '${{{}}}')
nodes = cmds.file(file_url,
namespace=namespace,
sharedReferenceFile=False,
reference=True,