Skip to content

Commit

Permalink
Core: Attribute: moveChannel. Added option to force a fullName of the…
Browse files Browse the repository at this point in the history
… moved attr
  • Loading branch information
miquelcampos committed May 22, 2024
1 parent bc28384 commit 13b7a95
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion release/scripts/mgear/core/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ def addProxyAttribute(sourceAttrs, targets, duplicatedPolicy=None):
)


def moveChannel(attr, sourceNode, targetNode, duplicatedPolicy=None):
def moveChannel(
attr, sourceNode, targetNode, duplicatedPolicy=None, forceFullName=False
):
"""Move channels keeping the output connections.
Duplicated channel policy, stablish the rule in case the channel already
exist on the target.
Expand Down Expand Up @@ -397,6 +399,10 @@ def moveChannel(attr, sourceNode, targetNode, duplicatedPolicy=None):
)
return False

if forceFullName:
attrName = "{}_{}".format(sourceNode.name(), attr)
nName = "{}_{}".format(sourceNode.name(), nName)

outcnx = at.listConnections(p=True)
if not newAtt:
# get the attr data
Expand Down Expand Up @@ -457,6 +463,7 @@ def moveChannel(attr, sourceNode, targetNode, duplicatedPolicy=None):
for cnx in outcnx:
try:
pm.connectAttr(newAtt, cnx, f=True)
return newAtt
except RuntimeError:
pm.displayError(
"There is a problem connecting the "
Expand Down

0 comments on commit 13b7a95

Please sign in to comment.