Skip to content

Commit

Permalink
Fix string operator update
Browse files Browse the repository at this point in the history
  • Loading branch information
tokejepsen committed Apr 30, 2024
1 parent a54eaec commit 583a91f
Showing 1 changed file with 15 additions and 21 deletions.
36 changes: 15 additions & 21 deletions openpype/hosts/maya/plugins/load/load_arnold_standin.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ def _get_proxy_path(self, path):
proxy_path = "/".join([os.path.dirname(path), proxy_basename])
return proxy_basename, proxy_path

def _update_operators(self, string_replace_operator, proxy_basename, path):
cmds.setAttr(
string_replace_operator + ".match",
proxy_basename.split(".")[0],
type="string"
)
cmds.setAttr(
string_replace_operator + ".replace",
os.path.basename(path).split(".")[0],
type="string"
)

def _setup_proxy(self, shape, path, namespace):
proxy_basename, proxy_path = self._get_proxy_path(path)

Expand All @@ -164,16 +176,7 @@ def _setup_proxy(self, shape, path, namespace):
"*.(@node=='{}')".format(node_type),
type="string"
)
cmds.setAttr(
string_replace_operator + ".match",
proxy_basename.split(".")[0],
type="string"
)
cmds.setAttr(
string_replace_operator + ".replace",
os.path.basename(path).split(".")[0],
type="string"
)
self._update_operators(string_replace_operator, proxy_basename, path)

cmds.connectAttr(
string_replace_operator + ".out",
Expand Down Expand Up @@ -207,18 +210,9 @@ def update(self, container, representation):
path = get_representation_path(representation)
proxy_basename, proxy_path = self._get_proxy_path(path)

# Whether there is proxy or so, we still update the string operator.
# Whether there is proxy or not, we still update the string operator.
# If no proxy exists, the string operator won't replace anything.
cmds.setAttr(
string_replace_operator + ".match",
proxy_basename,
type="string"
)
cmds.setAttr(
string_replace_operator + ".replace",
os.path.basename(path),
type="string"
)
self._update_operators(string_replace_operator, proxy_basename, path)

dso_path = path
if os.path.exists(proxy_path):
Expand Down

0 comments on commit 583a91f

Please sign in to comment.