Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Commit

Permalink
Mirror controls required target shape to exist
Browse files Browse the repository at this point in the history
There was a bug where rigbits.mirror_control required a target shape to exist. If the shape did not exist already, two errors occurred.
1. cnx was an undeclared variable
2. Getting the color of the target shape returned None and then tried to set color to None.
  • Loading branch information
chris-lesage committed Aug 9, 2020
1 parent 37ce738 commit bd543aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions scripts/mgear/rigbits/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ def replaceShape(source=None, targets=None, *args):
for target in targets:
source2 = pm.duplicate(source)[0]
shape = target.getShapes()
cnx = []
if shape:
cnx = shape[0].listConnections(plugs=True, c=True)
cnx = [[c[1], c[0].shortName()] for c in cnx]
Expand Down
8 changes: 5 additions & 3 deletions scripts/mgear/rigbits/mirror_controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,11 @@ def mirror_pairs(pairs):
pc.parent(source_copy, target)
pc.makeIdentity(source_copy, apply=True, t=1, r=1, s=1, n=0)
pc.parent(source_copy, target.getParent())
mgear.core.curve.set_color(
source_copy, mgear.core.curve.get_color(target)
)
targetColor = mgear.core.curve.get_color(target)
if targetColor:
mgear.core.curve.set_color(
source_copy, targetColor)
)

# Replace shape
mgear.rigbits.replaceShape(source_copy, [target])
Expand Down

0 comments on commit bd543aa

Please sign in to comment.