From ea3c312c93c350df8da9ec1863fa1875f7945b9c Mon Sep 17 00:00:00 2001 From: Willem-Jan van Rootselaar Date: Tue, 13 Apr 2021 13:59:05 +0200 Subject: [PATCH] add defaultValue when creating matrix blend if the default value is not set the reset control script will break de rig. Also some cleanup of comments --- scripts/mgear/rigbits/__init__.py | 17 ++++++++--------- .../mgear/rigbits/facial_rigger/brow_rigger.py | 4 ++-- .../mgear/rigbits/facial_rigger/constraints.py | 3 ++- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/mgear/rigbits/__init__.py b/scripts/mgear/rigbits/__init__.py index 47596a6..753cd6e 100644 --- a/scripts/mgear/rigbits/__init__.py +++ b/scripts/mgear/rigbits/__init__.py @@ -2,7 +2,6 @@ from pymel.core import datatypes from pymel import util as pmu - import mgear from mgear.core import icon, applyop, node, transform, attribute from mgear.core import primitive, meshNavigation, string @@ -295,7 +294,7 @@ def connectWorldTransform(source, target): def connectLocalTransform(objects=None, s=True, r=True, t=True, *args): - """Connect scale, rotatio and translation. + """Connect scale, rotation and translation. Args: objects (None or list of dagNode, optional): If None will use the @@ -350,16 +349,16 @@ def connectUserDefinedChannels(source, targets): def connectInvertSRT(source, target, srt="srt", axis="xyz"): - """Connect the locat transformations with inverted values. + """Connect the local transformations with inverted values. Args: source (dagNode): The source driver dagNode target (dagNode): The target driven dagNode srt (string, optional): String value for the scale(s), rotate(r), - translation(t). Default value is "srt". Posible values "s", "r", + translation(t). Default value is "srt". Possible values "s", "r", "t" or any combination axis (string, optional): String value for the axis. Default - value is "xyz". Posible values "x", "y", "z" or any combination + value is "xyz". Possible values "x", "y", "z" or any combination """ for t in srt: soureList = [] @@ -405,7 +404,7 @@ def replaceShape(source=None, targets=None, *args): if shape: cnx = shape[0].listConnections(plugs=True, c=True) cnx = [[c[1], c[0].shortName()] for c in cnx] - # Disconnect the conexion before delete the old shape + # Disconnect the connection before delete the old shape for s in shape: for c in s.listConnections(plugs=True, c=True): pm.disconnectAttr(c[0]) @@ -422,9 +421,9 @@ def replaceShape(source=None, targets=None, *args): def matchPosfromBBox(*args): - """Match the position usin bounding box of another object another. + """Match the position using bounding box of another object another. - Match the position of one object, using the boundig box center of + Match the position of one object, using the bounding box center of another object. """ @@ -491,7 +490,7 @@ def createInterpolateTransform(objects=None, blend=.5, *args): *args: Maya's dummy Returns: - pyNode: The new transformation witht the interpolate matrix o_node + pyNode: The new transformation with the interpolate matrix o_node applied. """ diff --git a/scripts/mgear/rigbits/facial_rigger/brow_rigger.py b/scripts/mgear/rigbits/facial_rigger/brow_rigger.py index 4f776b3..229c9f8 100644 --- a/scripts/mgear/rigbits/facial_rigger/brow_rigger.py +++ b/scripts/mgear/rigbits/facial_rigger/brow_rigger.py @@ -763,7 +763,7 @@ def getSide(name): for crv in [mainRope_upv, mainCrv_upv]: cvs = crv.getCVs(space="world") for i, cv in enumerate(cvs): - # we populate the closest vertext list here to skipt the first + # we populate the closest vertext list here to skip the first # and latest point offset = [cv[0], cv[1], cv[2] + FRONT_OFFSET] crv.setCV(i, offset, space='world') @@ -784,7 +784,7 @@ def getSide(name): pm.displayWarning("The brow rig can not be parent to: %s. Maybe " "this object doesn't exist." % parent_node) - # Reparent controls + # Re-parent controls # TODO: this can be more simple an easy to read for ctl in mainControls: tag_parent = None diff --git a/scripts/mgear/rigbits/facial_rigger/constraints.py b/scripts/mgear/rigbits/facial_rigger/constraints.py index 69432d1..891cac8 100644 --- a/scripts/mgear/rigbits/facial_rigger/constraints.py +++ b/scripts/mgear/rigbits/facial_rigger/constraints.py @@ -142,7 +142,8 @@ def matrixBlendConstraint(parent=None, # should be a list keyable=True, attributeType='float', min=0.0, - max=1.0) + max=1.0, + defaultValue=weights[x]) pm.connectAttr(host + "." + name, wtMat_node + ".wtMatrix[{}].weightIn".format(x)) pm.setAttr(host + "." + name, weights[x])