当前位置: 首页>>代码示例>>Python>>正文


Python cmds.group方法代码示例

本文整理汇总了Python中maya.cmds.group方法的典型用法代码示例。如果您正苦于以下问题:Python cmds.group方法的具体用法?Python cmds.group怎么用?Python cmds.group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在maya.cmds的用法示例。


在下文中一共展示了cmds.group方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: dpLoadJointNode

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def dpLoadJointNode(self, itemList, *args):
        """ Load the respective items to build the joint target list (offset group node).
        """
        leftPrefix = self.langDic[self.langName]["p002_left"]+"_"
        rightPrefix = self.langDic[self.langName]["p003_right"]+"_"
        offsetSuffix = "_Ctrl_Offset_Grp"
        for item in itemList:
            centerName = item+offsetSuffix
            leftName   = leftPrefix+item+offsetSuffix
            rightName  = rightPrefix+item+offsetSuffix
            if cmds.objExists(centerName):
                self.dpLoadJointTgtList(centerName)
            if cmds.objExists(leftName):
                self.dpLoadJointTgtList(leftName)
            if cmds.objExists(rightName):
                self.dpLoadJointTgtList(rightName) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:18,代码来源:dpFacialControl.py

示例2: createElbowCtrl

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def createElbowCtrl(self, myName='Limb_Ctrl', zero=True, armStyle=True, *args):
        """ Create the Ribbon Corner (Elbow) control.
            Returns the group, the control curve and it's zeroOut group.
        """
        if armStyle:
            curve = self.ctrls.cvControl("id_039_RibbonCorner", myName, r=self.ctrlRadius, d=self.curveDegree, rot=(0, 90, 0))
        else:
            curve = self.ctrls.cvControl("id_039_RibbonCorner", myName, r=self.ctrlRadius, d=self.curveDegree, rot=(90, 0, 0))
        grp = None
        if zero:
            zero = cmds.group(curve, n=myName+'_Zero')
            grp = cmds.group(zero, n=myName+'_Grp')
            if armStyle:
                cmds.rotate(0, -90, -90, zero)
            else:
                cmds.rotate(-90, 0, -90, zero)
        cmds.addAttr(curve, longName='autoBend', attributeType='float', minValue=0, maxValue=1, defaultValue=0, keyable=True)
        cmds.addAttr(curve, longName='pin', attributeType='float', minValue=0, maxValue=1, defaultValue=0, keyable=True)
        self.dpUIinst.ctrls.setLockHide([curve], ['sx', 'sy', 'sz', 'v'])
        return [grp, curve, zero] 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:22,代码来源:jcRibbon.py

示例3: cloneMeshs

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def cloneMeshs(meshPaths):
    cloneMeshPaths = []
    cloneGroup = cmds.group(empty = True, world = True, name = 'ssdsResult')
    cloneGroupSL = om.MGlobal.getSelectionListByName(cloneGroup)
    cloneGroupFn = om.MFnTransform(cloneGroupSL.getDagPath(0))
    for path in meshPaths:
        mesh = om.MFnMesh(path)
        meshName = om.MFnDagNode(mesh.parent(0)).name()
        cloneMeshName = 'ssds:' + meshName
        sl = om.MSelectionList();
        sl.clear()
        sl.add(path)
        om.MGlobal.setActiveSelectionList(sl)
        cmds.duplicate(returnRootsOnly = True, name = cloneMeshName, renameChildren = True)
        cmds.parent(cloneMeshName, cloneGroup)
        cmds.setAttr(cloneMeshName + '.inheritsTransform', False)
        cloneMeshSL = om.MGlobal.getSelectionListByName(cloneMeshName)
        cloneMeshPath = cloneMeshSL.getDagPath(0)
        cloneMeshPath.extendToShape()
        cloneMeshPaths.append(cloneMeshPath)
    return cloneMeshPaths, cloneGroup 
开发者ID:TomohikoMukai,项目名称:ssds,代码行数:23,代码来源:main.py

示例4: create_groups

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def create_groups(mocap_data):
    """
    Create groups from the matrices coming from the json data. Two additional
    groups are added to make sure a valid skeleton can be created using the
    HIK functionality in maya.

    :param dict mocap_data:
    :return: Group data
    :rtype: dict
    """
    # variable
    groups = {}

    # matrix groups
    for name, matrix in mocap_data.get("matrices_3d").iteritems():
        group = cmds.group(name=name, world=True, empty=True)
        groups[name] = group

    # extra groups
    for name in ["hip", "spine"]:
        group = cmds.group(name=name, world=True, empty=True)
        groups[name] = group

    return groups 
开发者ID:robertjoosten,项目名称:video2mocap,代码行数:26,代码来源:mocap.py

示例5: create_arrow

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def create_arrow(jointName):
    curve = cmds.curve(
        name="%s_ForwardDirection" % jointName,
        degree=1,
        point=[
            (-1, 0, 0),
            (-1, 2, 0),
            (-2, 2, 0),
            (0, 4, 0),
            (2, 2, 0),
            (1, 2, 0),
            (1, 0, 0),
            (-1, 0, 0),
        ],
    )
    group = cmds.group()
    cmds.xform(objectSpace=True, pivots=(0, 0, 0))
    jointScale = cmds.jointDisplayScale(query=True)
    jointRadius = cmds.getAttr("%s.radius" % jointName)
    jointScale *= jointRadius
    cmds.xform(scale=(jointScale, jointScale, jointScale))

    return group 
开发者ID:chadmv,项目名称:cmt,代码行数:25,代码来源:orientjoints.py

示例6: dpInvertAttrTranformation

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def dpInvertAttrTranformation(self, nodeName, invT=True, invR=False, *args):
        """ Creates a setup to invert attribute transformations in order to avoid doubleTransformation.
        """
        axisList = ['X', 'Y', 'Z']
        if cmds.objExists(nodeName):
            nodePivot = cmds.xform(nodeName, query=True, worldSpace=True, rotatePivot=True)
            if invR:
                invRGrp = cmds.group(nodeName, name=nodeName+"_InvR_Grp")
                cmds.xform(invRGrp, worldSpace=True, rotatePivot=(nodePivot[0], nodePivot[1], nodePivot[2]), rotateOrder="zyx")
                rMD = cmds.createNode('multiplyDivide', name=nodeName+"_InvR_MD", skipSelect=True)
                cmds.setAttr(rMD+'.input2X', -1)
                cmds.setAttr(rMD+'.input2Y', -1)
                cmds.setAttr(rMD+'.input2Z', -1)
                for axis in axisList:
                    cmds.connectAttr(nodeName+'.rotate'+axis, rMD+'.input1'+axis, force=True)
                    cmds.connectAttr(rMD+'.output'+axis, invRGrp+'.rotate'+axis, force=True)
            if invT:
                invTGrp = cmds.group(nodeName, name=nodeName+"_InvT_Grp")
                cmds.xform(invTGrp, worldSpace=True, rotatePivot=(nodePivot[0], nodePivot[1], nodePivot[2]))
                tMD = cmds.createNode('multiplyDivide', name=nodeName+"_InvT_MD", skipSelect=True)
                cmds.setAttr(tMD+'.input2X', -1)
                cmds.setAttr(tMD+'.input2Y', -1)
                cmds.setAttr(tMD+'.input2Z', -1)
                for axis in axisList:
                    cmds.connectAttr(nodeName+'.translate'+axis, tMD+'.input1'+axis, force=True)
                    cmds.connectAttr(tMD+'.output'+axis, invTGrp+'.translate'+axis, force=True) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:28,代码来源:dpRivet.py

示例7: connectShapeSize

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def connectShapeSize(self, clusterHandle, *args):
        """ Connect shapeSize attribute from guide main control to shapeSizeClusterHandle scale XYZ.
        """
        cmds.connectAttr(self.moduleGrp+".shapeSize", clusterHandle+".scaleX", force=True)
        cmds.connectAttr(self.moduleGrp+".shapeSize", clusterHandle+".scaleY", force=True)
        cmds.connectAttr(self.moduleGrp+".shapeSize", clusterHandle+".scaleZ", force=True)
        # re-declaring Temporary Group and parenting shapeSizeClusterHandle:
        self.tempGrpName = 'dpAR_Temp_Grp'
        if not cmds.objExists(self.tempGrpName):
            cmds.group(name=self.tempGrpName, empty=True)
            cmds.setAttr(self.tempGrpName+".visibility", 0)
            cmds.setAttr(self.tempGrpName+".template", 1)
        cmds.parent(clusterHandle, self.tempGrpName) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:15,代码来源:dpBaseClass.py

示例8: cvJointLoc

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def cvJointLoc(self, ctrlName, r=0.3, d=1, rot=(0, 0, 0), guide=True, *args):
        """Create and return a cvJointLocator curve to be usually used in the guideSystem and the clusterHandle to shapeSize.
        """
        # create locator curve:
        cvLoc = self.cvLocator(ctrlName+"_CvLoc", r, d)
        # create arrow curves:
        cvArrow1 = cmds.curve(n=ctrlName+"_CvArrow1", d=3, p=[(-0.1*r, 0.9*r, 0.2*r), (-0.1*r, 0.9*r, 0.23*r), (-0.1*r, 0.9*r, 0.27*r), (-0.1*r, 0.9*r, 0.29*r), (-0.1*r, 0.9*r, 0.3*r), (-0.372*r, 0.9*r, 0.24*r), (-0.45*r, 0.9*r, -0.13*r), (-0.18*r, 0.9*r, -0.345*r), (-0.17*r, 0.9*r, -0.31*r), (-0.26*r, 0.9*r, -0.41*r), (-0.21*r, 0.9*r, -0.41*r), (-0.05*r, 0.9*r, -0.4*r), (0, 0.9*r, -0.4*r), (-0.029*r, 0.9*r, -0.33*r), (-0.048*r, 0.9*r, -0.22*r), (-0.055*r, 0.9*r, -0.16*r), (-0.15*r, 0.9*r, -0.272*r), (-0.12*r, 0.9*r, -0.27*r), (-0.35*r, 0.9*r, -0.1*r), (-0.29*r, 0.9*r, 0.15*r), (-0.16*r, 0.9*r, 0.21*r), (-0.1*r, 0.9*r, 0.2*r)] )
        cvArrow2 = cmds.curve(n=ctrlName+"_CvArrow2", d=3, p=[(0.1*r, 0.9*r, -0.2*r), (0.1*r, 0.9*r, -0.23*r), (0.1*r, 0.9*r, -0.27*r), (0.1*r, 0.9*r, -0.29*r), (0.1*r, 0.9*r, -0.3*r), (0.372*r, 0.9*r, -0.24*r), (0.45*r, 0.9*r, 0.13*r), (0.18*r, 0.9*r, 0.345*r), (0.17*r, 0.9*r, 0.31*r), (0.26*r, 0.9*r, 0.41*r), (0.21*r, 0.9*r, 0.41*r), (0.05*r, 0.9*r, 0.4*r), (0, 0.9*r, 0.4*r), (0.029*r, 0.9*r, 0.33*r), (0.048*r, 0.9*r, 0.22*r), (0.055*r, 0.9*r, 0.16*r), (0.15*r, 0.9*r, 0.272*r), (0.12*r, 0.9*r, 0.27*r), (0.35*r, 0.9*r, 0.1*r), (0.29*r, 0.9*r, -0.15*r), (0.16*r, 0.9*r, -0.21*r), (0.1*r, 0.9*r, -0.2*r)] )
        cvArrow3 = cmds.curve(n=ctrlName+"_CvArrow3", d=3, p=[(-0.1*r, -0.9*r, 0.2*r), (-0.1*r, -0.9*r, 0.23*r), (-0.1*r, -0.9*r, 0.27*r), (-0.1*r, -0.9*r, 0.29*r), (-0.1*r, -0.9*r, 0.3*r), (-0.372*r, -0.9*r, 0.24*r), (-0.45*r, -0.9*r, -0.13*r), (-0.18*r, -0.9*r, -0.345*r), (-0.17*r, -0.9*r, -0.31*r), (-0.26*r, -0.9*r, -0.41*r), (-0.21*r, -0.9*r, -0.41*r), (-0.05*r, -0.9*r, -0.4*r), (0, -0.9*r, -0.4*r), (-0.029*r, -0.9*r, -0.33*r), (-0.048*r, -0.9*r, -0.22*r), (-0.055*r, -0.9*r, -0.16*r), (-0.15*r, -0.9*r, -0.272*r), (-0.12*r, -0.9*r, -0.27*r), (-0.35*r, -0.9*r, -0.1*r), (-0.29*r, -0.9*r, 0.15*r), (-0.16*r, -0.9*r, 0.21*r), (-0.1*r, -0.9*r, 0.2*r)] )
        cvArrow4 = cmds.curve(n=ctrlName+"_CvArrow4", d=3, p=[(0.1*r, -0.9*r, -0.2*r), (0.1*r, -0.9*r, -0.23*r), (0.1*r, -0.9*r, -0.27*r), (0.1*r, -0.9*r, -0.29*r), (0.1*r, -0.9*r, -0.3*r), (0.372*r, -0.9*r, -0.24*r), (0.45*r, -0.9*r, 0.13*r), (0.18*r, -0.9*r, 0.345*r), (0.17*r, -0.9*r, 0.31*r), (0.26*r, -0.9*r, 0.41*r), (0.21*r, -0.9*r, 0.41*r), (0.05*r, -0.9*r, 0.4*r), (0, -0.9*r, 0.4*r), (0.029*r, -0.9*r, 0.33*r), (0.048*r, -0.9*r, 0.22*r), (0.055*r, -0.9*r, 0.16*r), (0.15*r, -0.9*r, 0.272*r), (0.12*r, -0.9*r, 0.27*r), (0.35*r, -0.9*r, 0.1*r), (0.29*r, -0.9*r, -0.15*r), (0.16*r, -0.9*r, -0.21*r), (0.1*r, -0.9*r, -0.2*r)] )
        cvArrow5 = cmds.curve(n=ctrlName+"_CvArrow5", d=1, p=[(0, 0, 1.2*r), (0.09*r, 0, 1*r), (-0.09*r, 0, 1*r), (0, 0, 1.2*r)] )
        cvArrow6 = cmds.curve(n=ctrlName+"_CvArrow6", d=1, p=[(0, 0, 1.2*r), (0, 0.09*r, 1*r), (0, -0.09*r, 1*r), (0, 0, 1.2*r)] )
        # rename curveShape:
        locArrowList = [cvLoc, cvArrow1, cvArrow2, cvArrow3, cvArrow4, cvArrow5, cvArrow6]
        self.renameShape(locArrowList)
        # create ball curve:
        cvTemplateBall = self.cvControl("Ball", ctrlName+"_CvBall", r=0.7*r, d=3)
        # parent shapes to transform:
        locCtrl = cmds.group(name=ctrlName, empty=True)
        ballChildrenList = cmds.listRelatives(cvTemplateBall, shapes=True, children=True)
        for ballChildren in ballChildrenList:
            cmds.setAttr(ballChildren+".template", 1)
        self.transferShape(True, False, cvTemplateBall, [locCtrl])
        for transform in locArrowList:
            self.transferShape(True, False, transform, [locCtrl])
        # set rotation direction:
        cmds.setAttr(locCtrl+".rotateX", rot[0])
        cmds.setAttr(locCtrl+".rotateY", rot[1])
        cmds.setAttr(locCtrl+".rotateZ", rot[2])
        cmds.makeIdentity(locCtrl, rotate=True, apply=True)
        # create an attribute to be used as guide by module:
        cmds.addAttr(locCtrl, longName="nJoint", attributeType='long')
        cmds.setAttr(locCtrl+".nJoint", 1)
        # colorize curveShapes:
        self.colorShape([locCtrl], 'blue')
        # shapeSize setup:
        shapeSizeCluster = self.shapeSizeSetup(locCtrl)
        cmds.select(clear=True)
        return [locCtrl, shapeSizeCluster] 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:41,代码来源:dpControls.py

示例9: cvCharacter

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def cvCharacter(self, ctrlType, ctrlName, r=1, d=1, dir="+Y", rot=(0, 0, 0), *args):
        """ Create and return a curve to be used as a control.
        """
        # get radius by checking linear unit
        r = self.dpCheckLinearUnit(r)
        curve = self.cvControl(ctrlType, ctrlName, r, d, dir, rot)
        # edit a minime curve:
        cmds.addAttr(curve, longName="rigScale", attributeType='float', defaultValue=1, keyable=True)
        cmds.addAttr(curve, longName="rigScaleMultiplier", attributeType='float', defaultValue=1, keyable=False)
        
        # create Option_Ctrl Text:
        try:
            optCtrlTxt = cmds.group(name="Option_Ctrl_Txt", empty=True)
            try:
                cvText = cmds.textCurves(name="Option_Ctrl_Txt_TEMP_Grp", font="Source Sans Pro", text="Option Ctrl", constructionHistory=False)[0]
            except:
                cvText = cmds.textCurves(name="Option_Ctrl_Txt_TEMP_Grp", font="Arial", text="Option Ctrl", constructionHistory=False)[0]
            txtShapeList = cmds.listRelatives(cvText, allDescendents=True, type='nurbsCurve')
            if txtShapeList:
                for s, shape in enumerate(txtShapeList):
                    # store CV world position
                    curveCVList = cmds.getAttr(shape+'.cp', multiIndices=True)
                    vtxWorldPosition = []
                    for i in curveCVList :
                        cvPointPosition = cmds.xform(shape+'.cp['+str(i)+']', query=True, translation=True, worldSpace=True) 
                        vtxWorldPosition.append(cvPointPosition)
                    # parent the shapeNode :
                    cmds.parent(shape, optCtrlTxt, r=True, s=True)
                    # restore the shape world position
                    for i in curveCVList:
                        cmds.xform(shape+'.cp['+str(i)+']', a=True, worldSpace=True, t=vtxWorldPosition[i])
                    cmds.rename(shape, optCtrlTxt+"Shape"+str(s))
            cmds.delete(cvText)
            cmds.parent(optCtrlTxt, curve)
            cmds.setAttr(optCtrlTxt+".template", 1)
            cmds.setAttr(optCtrlTxt+".tx", -0.72*r)
            cmds.setAttr(optCtrlTxt+".ty", 1.1*r)
        except:
            # it will pass if we don't able to find the font to create the text
            pass
        return curve 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:43,代码来源:dpControls.py

示例10: createBendCtrl

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def createBendCtrl(self, myName='Bend_Ctrl', r=1, zero=True, *args):
        """ Create the Ribbon Bend control.
            Returns the group zeroOut and the control curve.
        """
        grp = None
        curve = self.ctrls.cvControl("id_038_RibbonBend", myName, r=self.ctrlRadius, d=self.curveDegree, rot=(0, 90, 0))
        self.dpUIinst.ctrls.setLockHide([curve], ['v'])
        if zero:
            grp = cmds.group(curve, n=myName+'_Grp')
        return [grp, curve] 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:12,代码来源:jcRibbon.py

示例11: createControlShape

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def createControlShape(name, shape, colour_, num=None):
    """ 
    Create a control with offset group.

    :param str name: Name of the control ( _ctrl will be appended )
    :param str shape: Shape of the control.
    :param str colour_: Colour of the control.
    :param int num: Number of control ( padding of 3 ).
    :return: name of offset and control
    :rtype: tuple
    """
    # handle number
    numSuffix = "_{0:03d}".format(num) if num != None else ""

    # get names
    ctrlName = "{0}_ctrl{1}".format(name, numSuffix)
    offsetName = "{0}_ctrl_offset{1}".format(name, numSuffix)

    # validate ctrl name
    if cmds.objExists(ctrlName):
        raise ValueError("createControlShape: name already exists!")

    # get shape position
    shapePoints = controlShape.getControlShape(shape)

    # create
    ctrl, shapes = curve.createCurveShape(ctrlName, shapePoints)
    offset = cmds.group(w=True, em=True, n=offsetName)

    # set colour
    colourString = colour.getColourFromString(colour_)
    for s in shapes:
        cmds.setAttr("{0}.overrideEnabled".format(s), 1)
        cmds.setAttr("{0}.overrideColor".format(s), colourString)
        
    # parent ctrl to offset
    ctrl = cmds.parent(ctrl, offset)[0]

    return offset, ctrl 
开发者ID:robertjoosten,项目名称:maya-spline-ik,代码行数:41,代码来源:control.py

示例12: template_joints

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def template_joints(joints=None, reorient_children=True, reset_orientation=True):
    if joints is None:
        joints = cmds.ls(sl=True, type="joint")
    if not joints:
        raise RuntimeError("No joint selected to orient.")

    if reorient_children:
        children = cmds.listRelatives(fullPath=True, allDescendents=True, type="joint")
        joints.extend(children)

    red, green, blue = create_shaders()

    orient_group = cmds.createNode("transform", name=ORIENT_GROUP)
    manips = []
    for joint in joints:
        if reset_orientation:
            cmds.makeIdentity(joint, apply=True)
            cmds.joint(
                joint,
                edit=True,
                orientJoint="xyz",
                secondaryAxisOrient="yup",
                children=False,
                zeroScaleOrient=True,
            )
        if not cmds.listRelatives(joint, children=True):
            zero_orient([joint])
            continue
        group, manip = create_orient_manipulator(joint, blue)
        manips.append(manip)
        cmds.parent(group, orient_group)
        cmds.parentConstraint(joint, group)
        cmds.setAttr(joint + ".template", 1)
    cmds.select(manips) 
开发者ID:chadmv,项目名称:cmt,代码行数:36,代码来源:orientjoints.py

示例13: create_orient_manipulator

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def create_orient_manipulator(joint, material):
    joint_scale = cmds.jointDisplayScale(query=True)
    joint_radius = cmds.getAttr("{0}.radius".format(joint))
    radius = joint_scale * joint_radius
    children = cmds.listRelatives(joint, children=True, path=True)
    if children:
        p1 = cmds.xform(joint, q=True, ws=True, t=True)
        p1 = OpenMaya.MPoint(*p1)
        p2 = cmds.xform(children[0], q=True, ws=True, t=True)
        p2 = OpenMaya.MPoint(*p2)
        radius = p1.distanceTo(p2)
    arrow_cvs = [
        [-1, 0, 0],
        [-1, 2, 0],
        [-2, 2, 0],
        [0, 4, 0],
        [2, 2, 0],
        [1, 2, 0],
        [1, 0, 0],
        [-1, 0, 0],
    ]
    arrow_cvs = [[x[0] * radius, x[1] * radius, x[2] * radius] for x in arrow_cvs]
    shape = cmds.curve(name="{0}_zForward".format(joint), degree=1, point=arrow_cvs)
    # shape = cmds.sphere(n='{0}_zForward'.format(joint), p=(0, 0, 0), ax=(0, 0, -1), ssw=0, esw=180, r=radius, d=3, ut=0, tol=0.01, s=8, nsp=4, ch=0)[0]
    # cmds.setAttr('{0}.sz'.format(shape), 0)
    # cmds.select(shape)
    # cmds.hyperShade(assign=material)
    group = cmds.createNode("transform", name="{0}_grp".format(shape))
    cmds.parent(shape, group)
    cmds.makeIdentity(shape, apply=True)
    cmds.addAttr(shape, longName=MESSAGE_ATTRIBUTE, attributeType="message")
    cmds.connectAttr(
        "{0}.message".format(joint), "{0}.{1}".format(shape, MESSAGE_ATTRIBUTE)
    )
    for attr in ["tx", "ty", "tz", "ry", "rz", "v"]:
        cmds.setAttr("{0}.{1}".format(shape, attr), lock=True, keyable=False)
    return group, shape 
开发者ID:chadmv,项目名称:cmt,代码行数:39,代码来源:orientjoints.py

示例14: doEditPivotDriver

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def doEditPivotDriver(self, *args):

        newValue = mc.floatSliderButtonGrp(self.floatSlider, query=True, value=True)
        try:
            mc.deleteUI(self.pivotDriverWindow)
        except:
            pass

        currentValue = mc.getAttr(self.pivotDriver)
        if newValue == currentValue:
            return

        oldRP = mc.getAttr(self.node+'.rotatePivot')[0]
        mc.setAttr(self.pivotDriver, newValue)
        newRP = mc.getAttr(self.node+'.rotatePivot')[0]
        mc.setAttr(self.pivotDriver, currentValue)

        parentPosition = mc.group(em=True)
        offsetPosition = mc.group(em=True)
        offsetPosition = mc.parent(offsetPosition, parentPosition)[0]
        mc.setAttr(offsetPosition+'.translate', newRP[0]-oldRP[0], newRP[1]-oldRP[1], newRP[2]-oldRP[2])

        mc.delete(mc.parentConstraint(self.node, parentPosition))

        utl.matchBake(source=[self.node], destination=[parentPosition], bakeOnOnes=True, maintainOffset=False, preserveTangentWeight=False)

        mc.cutKey(self.pivotDriver)
        mc.setAttr(self.pivotDriver, newValue)
        mc.refresh()
        utl.matchBake(source=[offsetPosition], destination=[self.node], bakeOnOnes=True, maintainOffset=False, preserveTangentWeight=False, rotate=False)

        mc.delete(parentPosition) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:34,代码来源:ml_pivot.py

示例15: editPivotHandle

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import group [as 别名]
def editPivotHandle(self):

        qt_maya_window.installEventFilter(self.keypressFilter)

        #create transform
        self.pivotHandle = mc.group(em=True, name='Adjust_Pivot')
        mc.setAttr(self.pivotHandle+'.rotate', lock=True)
        mc.setAttr(self.pivotHandle+'.rx', keyable=False)
        mc.setAttr(self.pivotHandle+'.ry', keyable=False)
        mc.setAttr(self.pivotHandle+'.rz', keyable=False)
        mc.setAttr(self.pivotHandle+'.scale', lock=True)
        mc.setAttr(self.pivotHandle+'.sx', keyable=False)
        mc.setAttr(self.pivotHandle+'.sy', keyable=False)
        mc.setAttr(self.pivotHandle+'.sz', keyable=False)
        mc.setAttr(self.pivotHandle+'.visibility', lock=True, keyable=False)
        mc.setAttr(self.pivotHandle+'.displayHandle', True)

        self.pivotHandle = mc.parent(self.pivotHandle, self.node)[0]

        mc.addAttr(self.pivotHandle, ln='ml_pivot_handle', at='bool', keyable=False)

        #set initial position
        mc.setAttr(self.pivotHandle+'.translate', *mc.getAttr(self.node+'.rotatePivot')[0])

        #lock it so you don't delete it or something.
        mc.lockNode(self.pivotHandle, lock=True)

        self.scriptJob = mc.scriptJob(event=['SelectionChanged', self.cleanup], runOnce=True)

        mc.setToolTo('Move')

        mc.inViewMessage( amg='After moving the pivot, press <hl>Return</hl> to bake or <hl>Esc</hl> to cancel.', pos='midCenterTop', fade=True, fadeStayTime=4000, dragKill=True) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:34,代码来源:ml_pivot.py


注:本文中的maya.cmds.group方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。