From e2754a377e8c66174e0f177fd136c7c4994dfbf0 Mon Sep 17 00:00:00 2001 From: Timothy Liu <154667371+timothyliu3d@users.noreply.github.com> Date: Sat, 24 Jan 2026 00:51:29 -0800 Subject: [PATCH] docs: Fix type hints. --- release/scripts/mgear/core/applyop.py | 42 ++++----- release/scripts/mgear/core/attribute.py | 6 +- release/scripts/mgear/core/curve.py | 8 +- release/scripts/mgear/core/icon.py | 86 ++++++++++--------- release/scripts/mgear/core/transform.py | 29 ++++--- release/scripts/mgear/shifter/__init__.py | 4 +- .../mgear/shifter/component/__init__.py | 10 +-- release/scripts/mgear/shifter/guide.py | 14 +-- 8 files changed, 101 insertions(+), 98 deletions(-) diff --git a/release/scripts/mgear/core/applyop.py b/release/scripts/mgear/core/applyop.py index 9e03685d..cbb86422 100644 --- a/release/scripts/mgear/core/applyop.py +++ b/release/scripts/mgear/core/applyop.py @@ -146,7 +146,7 @@ def oriCns(driver, driven, maintainOffset=False): maintainOffset (bool): Keep the offset. Returns: - pyNode: Orientation constraintn node. + pm.node._Node: Orientation constraintn node. Example: .. code-block:: python @@ -182,7 +182,7 @@ def pathCns(obj, curve, cnsType=False, u=0, tangent=False): tangent (bool): Keep tangent orientation option. Returns: - pyNode: The newly created constraint. + pm.node._Node: The newly created constraint. """ node = pm.PyNode(pm.createNode("motionPath")) node.setAttr("uValue", u) @@ -223,7 +223,7 @@ def aimCns( maintainOffset (bool): Maintain offset. Returns: - pyNode: Newly created constraint. + pm.node._Node: Newly created constraint. """ node = pm.aimConstraint( @@ -320,7 +320,7 @@ def gear_raycast( connect_srt (str, optional): scale rotation traanslation flag Returns: - PyNode: The raycast node + pm.node._Node: The raycast node """ node = pm.createNode("mgear_rayCastPosition") pm.connectAttr( @@ -357,7 +357,7 @@ def gear_matrix_cns( scl_mult (list, optional): scale multiplier for XYZ Returns: - PyNode: The matrix constraint node + pm.node._Node: The matrix constraint node """ node = pm.createNode("mgear_matrixConstraint") if isinstance(in_obj, pm.node._NodeTypes) and in_obj.type() == "matrix": @@ -421,7 +421,7 @@ def gear_spring_op(in_obj, goal=False, solver="mgear_springNode"): solver (str, optional): Spring solver Returns: - pyNode: Newly created node + pm.node._Node: Newly created node """ if not goal: goal = in_obj @@ -459,7 +459,7 @@ def gear_spring_gravity_op(in_obj, goal=False): goal (dagNode): By default is False. Returns: - pyNode: Newly created node + pm.node._Node: Newly created node """ return gear_spring_op(in_obj, goal=goal, solver="mgear_springGravityNode") @@ -480,7 +480,7 @@ def gear_mulmatrix_op(mA, mB, target=False, transform="srt"): value s r t Returns: - pyNode: Newly created mGear_multMatrix node + pm.node._Node: Newly created mGear_multMatrix node """ node = pm.createNode("mgear_mulMatrix") @@ -520,7 +520,7 @@ def gear_intmatrix_op(mA, mB, blend=0): blend (float or connection): Blending value. Returns: - pyNode: Newly created mGear_intMatrix node + pm.node._Node: Newly created mGear_intMatrix node """ node = pm.createNode("mgear_intMatrix") @@ -546,7 +546,7 @@ def gear_curvecns_op(crv, inputs=[]): Also the order should be the same as the points Returns: - pyNode: The curvecns node. + pm.node._Node: The curvecns node. """ pm.select(crv) node = pm.deformer(type="mgear_curveCns")[0] @@ -571,7 +571,7 @@ def gear_curveslide2_op( softness (float): Default softness value (from 0 to 1). Returns: - pyNode: The newly created operator. + pm.node._Node: The newly created operator. """ pm.select(outcrv) node = pm.deformer(type="mgear_slideCurve2")[0] @@ -602,7 +602,7 @@ def gear_spinePointAtOp(cns, startobj, endobj, blend=0.5, axis="-Z"): axis (string): Axis direction. Returns: - pyNode: The newly created operator. + pm.node._Node: The newly created operator. """ node = pm.createNode("mgear_spinePointAt") @@ -634,7 +634,7 @@ def gear_spinePointAtOpWM(cns, startobj, endobj, blend=0.5, axis="-Z"): axis (str): Axis direction. Returns: - pyNode: The newly created operator. + pm.node._Node: The newly created operator. """ node = pm.createNode("mgear_spinePointAt") @@ -692,7 +692,7 @@ def gear_ikfk2bone_op( blend (float): Default blend value (0 for full ik, 1 for full fk). Returns: - pyNode: The newly created operator. + pm.node._Node: The newly created operator. """ node = pm.createNode("mgear_ikfk2Bone") @@ -764,7 +764,7 @@ def gear_rollsplinekine_op(out, controlers=[], u=0.5, subdiv=10): subdiv (int): spline subdivision precision. Returns: - pyNode: The newly created operator. + pm.node._Node: The newly created operator. """ node = pm.createNode("mgear_rollSplineKine") @@ -800,11 +800,11 @@ def gear_squashstretch2_op( sclref (dagNode): Global scaling reference object. length (float): Rest Length of the S&S. axis (str): 'x' for scale all except x axis... - scaleComp (list of float): extra scale compensation to avoid double + scaleComp (str | pm.Attribute): extra scale compensation to avoid double scale in some situations. Returns: - pyNode: The newly created operator. + pm.node._Node: The newly created operator. """ node = pm.createNode("mgear_squashStretch2") @@ -843,7 +843,7 @@ def gear_inverseRotorder_op(out_obj, in_obj): in_obj (dagNode): Input object. Returns: - pyNode: The newly created operator. + pm.node._Node: The newly created operator. """ node = pm.createNode("mgear_inverseRotOrder") @@ -869,7 +869,7 @@ def create_proximity_constraint(shape, out_trans (str, optional): Output transform node. Returns: - tuple: (output transform, proximityPin node) + tuple[pm.node._Node, pm.node._Node]: (output transform, proximityPin node) """ if not cmds.objExists(shape): @@ -957,7 +957,7 @@ def create_proximity_constraints(shape, in_trans_list): in_trans_list (List[PyNode] or List[str]): List of in transforms Returns: - List[PyNode]: List of output transforms + list[pm.node._Node]: List of output transforms """ # Convert shape to PyNode if necessary if isinstance(shape, str): @@ -1022,7 +1022,7 @@ def create_uv_pin_constraint(shape, out_trans (str, optional): Output transform node. Returns: - tuple: (output transform, uvPin node) + tuple[str, str]: (output transform, uvPin node) """ if not cmds.objExists(shape): raise RuntimeError("Shape '{}' does not exist.".format(shape)) diff --git a/release/scripts/mgear/core/attribute.py b/release/scripts/mgear/core/attribute.py index 5cbb1e00..64309269 100644 --- a/release/scripts/mgear/core/attribute.py +++ b/release/scripts/mgear/core/attribute.py @@ -53,7 +53,7 @@ def addAttribute( when the attribute is not keyable. (optional) Returns: - str: The long name of the new attribute + pm.Attribute: A pymaya ``Attribute`` wrapper of the new attribute. """ if isinstance(node, str): try: @@ -245,7 +245,7 @@ def addEnumAttribute( writable (bool): Set if the attribute is writable or not. (optional) Returns: - str: The long name of the new attribute + pm.Attribute: The long name of the new attribute """ if node.hasAttr(longName): @@ -1677,7 +1677,7 @@ def get_alias_for_attr(full_attr_name): ########################################################## -def add_mirror_config_channels(ctl, conf=[0, 0, 0, 0, 0, 0, 0, 0, 0]): +def add_mirror_config_channels(ctl, conf=(0, 0, 0, 0, 0, 0, 0, 0, 0)): """Add channels to configure the mirror posing Args: diff --git a/release/scripts/mgear/core/curve.py b/release/scripts/mgear/core/curve.py index ecaf3275..775527f3 100644 --- a/release/scripts/mgear/core/curve.py +++ b/release/scripts/mgear/core/curve.py @@ -64,16 +64,16 @@ def addCurve( Arguments: parent (dagNode): Parent object. name (str): Name - points (list of float | list of datatypes.Vector | list of om2.MPoint): + points (list[float] | list[om2.MVector] | list[om2.MPoint]): points of the curve in a one dimension array [point0X, point0Y, point0Z, 1, point1X, point1Y, point1Z, 1, ...]. close (bool): True to close the curve. degree (int): 1 for linear curve, 3 for Cubic. m (matrix): Global transform. - op (bool, optional): If True will add a curve that pass over the points - This is equivalent of using"editPoint " flag + op (bool, optional): If True will add a curve that pass over the points. + This is equivalent of using "editPoint" flag. - No Longer Returned: + Returns: dagNode: The newly created curve. """ # Check and convert only if the item is an MPoint diff --git a/release/scripts/mgear/core/icon.py b/release/scripts/mgear/core/icon.py index b6cb6260..e72b4131 100644 --- a/release/scripts/mgear/core/icon.py +++ b/release/scripts/mgear/core/icon.py @@ -23,7 +23,7 @@ def create( parent=None, name="icon", m=datatypes.Matrix(), - color=[0, 0, 0], + color=(0, 0, 0), icon="cube", **kwargs ): @@ -36,7 +36,7 @@ def create( parent (dagNode): The parent for the new icon name (str): Name of the Icon. m (matrix): Transformation matrix of the icon - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. icon (str): Icon type. Options: "cube", "pyramid", "square", "flower", "circle", "cylinder", "compas", "diamond", "cubewithpeak", "sphere", "arrow", "crossarrow", @@ -190,7 +190,7 @@ def cube( width=1, height=1, depth=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -203,7 +203,7 @@ def cube( width (float): Width of the shape. height (float): Height of the shape. depth (float): Depth of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -212,6 +212,7 @@ def cube( Returns: dagNode: The newly created icon. + """ lenX = width * 0.5 lenY = height * 0.5 @@ -261,7 +262,7 @@ def pyramid( width=1, height=1, depth=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -274,7 +275,7 @@ def pyramid( width (float): Width of the shape. height (float): Height of the shape. depth (float): Depth of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -312,7 +313,7 @@ def square( name="square", width=1, depth=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -324,7 +325,7 @@ def square( name (str): Name of the curve. width (float): Width of the shape. depth (float): Depth of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -356,7 +357,7 @@ def flower( parent=None, name="flower", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -368,7 +369,7 @@ def flower( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -405,7 +406,7 @@ def circle( parent=None, name="circle", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -417,7 +418,7 @@ def circle( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -455,7 +456,7 @@ def cylinder( name="cylinder", width=1, heigth=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -468,7 +469,7 @@ def cylinder( name (str): Name of the curve. width (float): Width of the shape. height (float): Height of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -554,7 +555,7 @@ def compas( parent=None, name="compas", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -566,7 +567,7 @@ def compas( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -604,7 +605,7 @@ def diamond( parent=None, name="diamond", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -617,7 +618,7 @@ def diamond( width (float): Width of the shape. height (float): Height of the shape. depth (float): Depth of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -669,7 +670,7 @@ def cubewithpeak( parent=None, name="cubewithpeak", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -680,7 +681,7 @@ def cubewithpeak( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -742,7 +743,7 @@ def sphere( parent=None, name="sphere", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -754,7 +755,7 @@ def sphere( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -817,7 +818,7 @@ def arrow( parent=None, name="arrow", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -828,7 +829,7 @@ def arrow( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -864,7 +865,7 @@ def crossarrow( parent=None, name="crossArrow", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -875,7 +876,7 @@ def crossarrow( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -952,7 +953,7 @@ def cross( parent=None, name="cross", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -963,7 +964,7 @@ def cross( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -1011,7 +1012,7 @@ def null( parent=None, name="null", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -1022,7 +1023,7 @@ def null( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -1065,7 +1066,7 @@ def axis( parent=None, name="axis", width=1, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -1076,7 +1077,7 @@ def axis( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -1153,6 +1154,7 @@ def direction_arrow( Returns: str: The name of the created arrow curve. + """ # Validate axis input valid_axes = ["x", "y", "z", "-x", "-y", "-z"] @@ -1214,7 +1216,7 @@ def guideRootIcon( parent=None, name="root", width=0.5, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -1228,7 +1230,7 @@ def guideRootIcon( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -1270,7 +1272,7 @@ def guideRootIcon2D( parent=None, name="root", width=0.5, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -1284,7 +1286,7 @@ def guideRootIcon2D( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -1331,7 +1333,7 @@ def guideLocatorIcon( parent=None, name="locator", width=0.5, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -1345,7 +1347,7 @@ def guideLocatorIcon( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. width (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -1354,6 +1356,7 @@ def guideLocatorIcon( Returns: dagNode: The newly created icon. + """ rootIco = null(parent, name, width, color, m, pos_offset, rot_offset) spheWidth = width / 2.0 @@ -1379,7 +1382,7 @@ def guideBladeIcon( parent=None, name="blade", lenX=1.0, - color=[0, 0, 0], + color=(0, 0, 0), m=datatypes.Matrix(), pos_offset=None, rot_offset=None, @@ -1393,7 +1396,7 @@ def guideBladeIcon( parent (dagNode): The parent object of the newly created curve. name (str): Name of the curve. lenX (float): Width of the shape. - color (int or list of float): The color in index base or RGB. + color (int | list of float | tuple of float): The color in index base or RGB. m (matrix): The global transformation of the curve. pos_offset (vector): The xyz position offset of the curve from its center. @@ -1492,8 +1495,7 @@ def setcolor(node, color): Arguments: node(dagNode): The object - color (int or list of float): The color in index base or RGB. - + color (int | list of float | tuple of float): The color in index base or RGB. """ # TODO: configure this funcion to work with RGB or Index color base diff --git a/release/scripts/mgear/core/transform.py b/release/scripts/mgear/core/transform.py index 6e02626a..00127e43 100644 --- a/release/scripts/mgear/core/transform.py +++ b/release/scripts/mgear/core/transform.py @@ -169,12 +169,12 @@ def getChainTransform(positions, normal, negate=False, axis="xz"): """Get a tranformation list from a positions list and normal. Arguments: - positions(list of vector): List with the chain positions. - normal (vector): Normal direction. + positions (list[om2.MVector | datatypes.Vector]): List with the chain positions. + normal (om2.MVector | datatypes.Vector): Normal direction. negate (bool): If true invert the chain orientation. - returns: - list of matrix: The list containing the transformation matrix + Returns: + list[datatypes.Matrix]: The list containing the transformation matrix for the chain. >>> tra.getChainTransform(self.guide.apos, self.normal, self.negate) @@ -204,12 +204,12 @@ def getChainTransform2(positions, normal, negate=False, axis="xz"): getChainTransform2 is using the latest position on the chain Arguments: - positions(list of vector): List with the chain positions. - normal (vector): Normal direction. + positions (list[om2.MVector | datatypes.Vector]): List with the chain positions. + normal (om2.MVector | datatypes.Vector): Normal direction. negate (bool): If true invert the chain orientation. - returns: - list of matrix: The list containing the transformation matrix + Returns: + list[datatypes.Matrix]: The list containing the transformation matrix for the chain. >>> tra.getChainTransform2(self.guide.apos, @@ -249,10 +249,10 @@ def getTransformFromPos(pos): """Create a transformation Matrix from a given position. Arguments: - pos (vector): Position for the transformation matrix + pos (om2.MVector | datatypes.Vector): Position for the transformation matrix Returns: - matrix: The newly created transformation matrix + datatypes.Matrix: The newly created transformation matrix >>> t = tra.getTransformFromPos(self.guide.pos["root"]) @@ -266,18 +266,19 @@ def getTransformFromPos(pos): return m -def getOffsetPosition(node, offset=[0, 0, 0]): +def getOffsetPosition(node, offset=(0, 0, 0)): """Get an offset position from dagNode Arguments: node (dagNode): The dagNode with the original position. - offset (list of float): Ofsset values for xyz. - exp : [1.2, 4.6, 32.78] + offset (list[float] | tuple[float]): Offset values for xyz. + Example: [1.2, 4.6, 32.78] Returns: - list of float: the new offset position. + datatypes.Vector: the new offset position. Example: + .. code-block:: python self.root = self.addRoot() diff --git a/release/scripts/mgear/shifter/__init__.py b/release/scripts/mgear/shifter/__init__.py index ef272a11..367b21ec 100644 --- a/release/scripts/mgear/shifter/__init__.py +++ b/release/scripts/mgear/shifter/__init__.py @@ -615,7 +615,6 @@ def finalize(self): pm.select(ctl_master_grp, replace=True) dag_node = pm.dagPose(save=True, selection=True) pm.connectAttr(dag_node.message, self.model.rigPoses[0]) - print(dag_node) # hide all DG nodes inputs in channel box ----------------------- # only hides if components_finalize or All steps are done @@ -898,7 +897,7 @@ def getRelativeName(self, guideName): if names: return names[1] - def findRelative(self, guideName, relatives_map={}): + def findRelative(self, guideName, relatives_map=None): """Return the objects in the rig matching the guide object. Args: @@ -914,6 +913,7 @@ def findRelative(self, guideName, relatives_map={}): if guideName is None: return self.global_ctl + relatives_map = relatives_map or {} if guideName in relatives_map.keys(): return relatives_map[guideName] diff --git a/release/scripts/mgear/shifter/component/__init__.py b/release/scripts/mgear/shifter/component/__init__.py index 53ab5e7b..d1d47ac7 100644 --- a/release/scripts/mgear/shifter/component/__init__.py +++ b/release/scripts/mgear/shifter/component/__init__.py @@ -56,8 +56,8 @@ def __init__(self, rig, guide): # -------------------------------------------------- # Main Objects - self.rig = rig - self.guide = guide + self.rig = rig # type: mgear.shifter.Rig + self.guide = guide # type: mgear.shifter.guide.Rig self.options = self.rig.options self.model = self.rig.model @@ -923,7 +923,7 @@ def addCtl( iconShape, tp=None, lp=True, - mirrorConf=[0, 0, 0, 0, 0, 0, 0, 0, 0], + mirrorConf=(0, 0, 0, 0, 0, 0, 0, 0, 0), guide_loc_ref=None, add_2_grp=True, **kwargs @@ -1343,7 +1343,7 @@ def addAnimParam( from the component name or instance name.(optional) Returns: - str: The long name of the new attribute + pm.Attribute: A pymaya ``Attribute`` wrapper of the new attribute. """ if not uihost: @@ -1423,7 +1423,7 @@ def addAnimEnumParam( uihost (dagNode): Optional uihost, if none self.uihost will be use Returns: - str: The long name of the new attribute + pm.Attribute: A pymaya ``Attribute`` wrapper of the new attribute. """ diff --git a/release/scripts/mgear/shifter/guide.py b/release/scripts/mgear/shifter/guide.py index 38c01503..a591e77c 100644 --- a/release/scripts/mgear/shifter/guide.py +++ b/release/scripts/mgear/shifter/guide.py @@ -190,15 +190,15 @@ def addParam( scriptName (str): Parameter scriptname. valueType (str): The Attribute Type. Exp: 'string', 'bool', 'long', etc.. - value (float or int): Default parameter value. + value (float | int | str | bool): Default parameter value. niceName (str): Parameter niceName. shortName (str): Parameter shortName. - minimum (float or int): mininum value. - maximum (float or int): maximum value. - keyable (boo): If true is keyable - readable (boo): If true is readable - storable (boo): If true is storable - writable (boo): If true is writable + minimum (float | int | None): mininum value. + maximum (float | int | None): maximum value. + keyable (bool): If true is keyable + readable (bool): If true is readable + storable (bool): If true is storable + writable (bool): If true is writable Returns: paramDef: The newly create paramenter definition.