Skip to content

Commit

Permalink
Rigbits: Mirror control shapes. Adding old logic if old implementatio…
Browse files Browse the repository at this point in the history
…n fails. This allows to mirror ctl shapes if the ctl don't have shifter metadata
  • Loading branch information
miquelcampos committed Apr 28, 2024
1 parent 3a38a94 commit ff1ac1c
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions release/scripts/mgear/rigbits/mirror_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,27 @@ def __init__(self):

@staticmethod
def get_opposite_control(node):
side_l = node.attr("L_custom_side_label").get()
side_r = node.attr("R_custom_side_label").get()
side = node.attr("side_label").get()

target_name = None
if side == "L":
target_name = node.name().replace(side_l, side_r)
elif side == "R":
target_name = node.name().replace(side_r, side_l)

if target_name and pm.objExists(target_name):
return pm.PyNode(target_name)
return None
try:
side_l = node.attr("L_custom_side_label").get()
side_r = node.attr("R_custom_side_label").get()
side = node.attr("side_label").get()

target_name = None
if side == "L":
target_name = node.name().replace(side_l, side_r)
elif side == "R":
target_name = node.name().replace(side_r, side_l)

if target_name and pm.objExists(target_name):
return pm.PyNode(target_name)
return None
except pm.MayaAttributeError:
# try to get the opposite control using the old logic
target_name = mgear.core.string.convertRLName(node.name())
target = None
if pm.objExists(target_name):
target = pm.PyNode(target_name)
return target

@staticmethod
def get_specific_side_controls(side="L"):
Expand Down

0 comments on commit ff1ac1c

Please sign in to comment.