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


Python core.group函数代码示例

本文整理汇总了Python中pymel.core.group函数的典型用法代码示例。如果您正苦于以下问题:Python group函数的具体用法?Python group怎么用?Python group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: createCtrl

def createCtrl(fol, clusterHandle, name):
    masterGrp = pm.group(em=1, name="{0}_MASTER".format(name))
    locCtrl = pm.group(em=1, name="{0}_LOC".format(name))
    upCtrl = pm.group(em=1, name="{0}_UP".format(name))
    ctrl = pm.group(em=1, name="{0}_Ctrl".format(name))
    ctrl.setParent(upCtrl)
    upCtrl.setParent(locCtrl)
    locCtrl.setParent(fol)
    locCtrl.t.set(0, 0, 0)

    md = pm.createNode("multiplyDivide", name="{0}_MD".format(name))
    clusterHandle.t >> md.input1
    md.input2.set(-1, -1, -1)
    md.output >> upCtrl.t

    ctrl.t >> clusterHandle.t
    ctrl.r >> clusterHandle.r

    ctrl.displayHandle.set(1)
    fol.setParent(masterGrp)
    clusterHandle.setParent(masterGrp)

    currentTime = pm.currentTime(q=1)
    ctrl.t.setKey(t=currentTime)
    ctrl.t.setKey(t=currentTime + 5)
    ctrl.t.setKey(t=currentTime - 5)
    ctrl.r.setKey(t=currentTime)
    ctrl.r.setKey(t=currentTime + 5)
    ctrl.r.setKey(t=currentTime - 5)

    return ctrl
开发者ID:TianD,项目名称:TianD_KX_TOOL,代码行数:31,代码来源:BeautifyClothTool.py

示例2: createPad

    def createPad(cls, *args):

        if args:
            inputObject = args[0]
        else:
            inputObject = pm.selected()

        if type(inputObject) != list:
            inputObject = [inputObject]
        pads = []
        for obj in inputObject:
            pm.select(cl = True)

            paddingGroup = pm.group(em = True)
            upperPaddingGroup = pm.group(em = True)

            pm.parent(paddingGroup, upperPaddingGroup)
            movePivot = pm.parentConstraint(obj, upperPaddingGroup, mo = False)
            pm.delete(movePivot)
            pm.parent(obj, paddingGroup)
            pm.makeIdentity(apply = True, t = True, r = True, s = True, n = 0)

            pm.rename(paddingGroup, obj + '_sdkPad')
            pm.rename(upperPaddingGroup, obj + '_offsetPad')

            pads.append(upperPaddingGroup)
        return pads
开发者ID:kudiaborm,项目名称:mkScripts,代码行数:27,代码来源:Common.py

示例3: addJacketCollarRig

def addJacketCollarRig():
    # jacket collar rig
    collarjnts = pm.ls(sl=True)
    # add hm, grp and auto nulls
    for jnt in collarjnts:
        ctl = pm.circle(r=0.5, sweep=359, normal=(1,0,0), n=jnt.replace('_jnt', '_ctl'))
        auto = pm.group(ctl, n=jnt.replace('_jnt', '_auto'))
        grp = pm.group(auto, n=jnt.replace('_jnt', '_grp'))
        hm = pm.group(grp, n=jnt.replace('_jnt', '_hm'))
        wMat = jnt.getMatrix(worldSpace=True)
        hm.setMatrix(wMat, worldSpace=True)
        collarparent = jnt.getParent()
        collarparent | hm
        auto | jnt
    # auto
    import rigger.modules.poseReader as poseReader
    reload(poseReader)
    xfo = nt.Joint(u'Mathilda_neck_jnt')
    poseReader.radial_pose_reader(xfo, (1,0,0), (1,0,0))
    # connect auto to sdks
    import utils.rigging as rt
    import rigger.utils.modulate as modulate
    angleMult = pm.PyNode('Mathilda_neck_jnt.vectorAngle')
    # Left collar A
    rt.connectSDK('Mathilda_neck_jnt.param', 'LT_collarA_auto.rz',
                    {3.25:0, 4.6:50, 5.5:0})
    mod = modulate.multiplyInput(pm.PyNode('LT_collarA_auto.rz'), 0, '_angle')
    angleMult >> mod
    # Letf collar B
    rt.connectSDK('Mathilda_neck_jnt.param', 'LT_collarB_auto.rz',
                    {4:0, 5:180, 6:180, 7:0})
    mod = modulate.multiplyInput(pm.PyNode('LT_collarB_auto.rz'), 0, '_angle')
    angleMult >> mod
    # Letf collar C
    rt.connectSDK('Mathilda_neck_jnt.param', 'LT_collarC_auto.rz',
                    {0:200, 1.4:0, 4:0, 5.5:200, 6.6:280, 8:0})
    mod = modulate.multiplyInput(pm.PyNode('LT_collarC_auto.rz'), 0, '_angle')
    angleMult >> mod
    # center collar
    rt.connectSDK('Mathilda_neck_jnt.param', 'CT_collar_auto.rz',
                    {0:320, 2.5:0, 5.5:0, 8:320})
    mod = modulate.multiplyInput(pm.PyNode('CT_collar_auto.rz'), 0, '_angle')
    angleMult >> mod
    # right collar A
    rt.connectSDK('Mathilda_neck_jnt.param', 'RT_collarA_auto.rz',
                    {4.75:0, 3.4:50, 2.5:0})
    mod = modulate.multiplyInput(pm.PyNode('RT_collarA_auto.rz'), 0, '_angle')
    angleMult >> mod
    # right collar B
    rt.connectSDK('Mathilda_neck_jnt.param', 'RT_collarB_auto.rz',
                    {4:0, 3:180, 2:180, 1:0})
    mod = modulate.multiplyInput(pm.PyNode('RT_collarB_auto.rz'), 0, '_angle')
    angleMult >> mod
    # right collar C
    rt.connectSDK('Mathilda_neck_jnt.param', 'RT_collarC_auto.rz',
                    {0:200, 6.6:0, 4:0, 2.5:200, 1.4:280, 8:0})
    mod = modulate.multiplyInput(pm.PyNode('RT_collarC_auto.rz'), 0, '_angle')
    angleMult >> mod
    
    pm.select(pm.PyNode(u'Mathilda_neck_jnt.param').outputs())
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:60,代码来源:hacks.py

示例4: create_chain_for_curve

 def create_chain_for_curve(self, crv, obj=None, link_length=1):
     """
     Uses the Curve and creates a chain based on the object that is passed into the function
     
     crv = curve to be used
     obj = object to be used
     linklength = lenght of the obj
     """
             
     if obj is None:
         obj = self.create_link()
         link_length = (2*(self.radius - self.section_radius*2)+self.extrude)
     chain_length = int(pm.PyNode(crv).length()/link_length)
     chain = self.make_chain(obj=obj, link_length=link_length, chain_length=chain_length)
     joints = self.rig_chain(chain)
     
     ik = pm.ikHandle(startJoint=joints[0], endEffector=joints[-1], solver='ikSplineSolver', createCurve=False, curve=crv)[0]
     pm.rename(ik, self.name + "_ikHandle")
         
     control_group = pm.group(joints[0], ik, n="%sctrl_grp" % self.name)
     control_group.v.set(False)
     pm.group(crv, self.name, control_group, n="%s_grp" % self.name)
     
     self.add_cluster_handles(crv)
     pm.select(deselect=True)
     
     return self.name
开发者ID:borgfriend,项目名称:MayaTools,代码行数:27,代码来源:LinkedChain.py

示例5: mirrorXfoFromTo

def mirrorXfoFromTo(xfo_from, xfo_to):
    # create temp nodes
    grp1 = pm.group(em=True)
    grp2 = pm.group(grp1)
    grp3 = pm.group(em=True)
    xfo_from | grp2
    pm.makeIdentity()
    grp3 | grp2
    grp3.sx.set(-1)
    grp1.sx.set(-1)
    '''
    # get original parent of xfo_rt so we can set it back later
    parent_rt = xfo_to.getParent()
    # snap xfo_rt to grp1's xfo
    grp1 | xfo_to
    pm.makeIdentity(xfo_to)
    if parent_rt:
        parent_rt | xfo_to
    else:
        xfo_to.setParent(None)
    '''
    worldXfo = grp1.getMatrix(worldSpace=True)
    xfo_to.setMatrix(worldXfo, worldSpace=True)
    # delete temp nodes
    pm.delete(grp1, grp2, grp3)
    pm.select(xfo_to)
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:26,代码来源:rigging.py

示例6: create_module

def create_module(name):
    """ Creates a top group from an object name
        For now, just dummy checking if the suffix is all caps
    Args:
        name (str): name to parse or use
    Returns (pm.nt.Transform): resulting group node
    """
    module = {}
    if name.split('_')[-1].isupper():
        name = '_'.join( name.split('_')[:-1] )
    
    grp_name = '%s_GRP'%name
    if pm.objExists(name):
        top_group = pm.PyNode(name)
    elif pm.objExists(grp_name):
        top_group = pm.PyNode(grp_name)
    else:
        top_group = pm.group(em=True, n='%s_GRP'%name)
    
    module['top_group'] = top_group
    
    for subgroup in ['skeleton','model','parts','controls']:
        subgroup_name = '%s_%s_GRP'%(name, subgroup)
        if not pm.objExists(subgroup_name):
            module[subgroup] = pm.group(em=True, n=subgroup_name)
            module[subgroup].setParent(top_group)
            top_group.addAttr('%s_vis'%subgroup,
                              at='long',
                              k=True,
                              dv=1, min=0, max=1)
            top_group.attr('%s_vis'%subgroup).connect(module[subgroup].visibility)
        else:
            module[subgroup] = pm.PyNode(subgroup_name)
    
    return module
开发者ID:AndresMWeber,项目名称:aw,代码行数:35,代码来源:create_extrudes_and_connect.py

示例7: createCurveBoundJoints

	def createCurveBoundJoints(self):
		
		pm.select(cl = True)
		
		
		#curve_bound_j_base
		pm.select(cl = True)
		self.curve_bound_j_base = pm.joint(a = True, p= (0,0,0),  co = True, n = self.prefix +'_curve_bound_j_base')
		pm.select(cl = True)
		
		#group
		self.curve_bound_j_base_grp = pm.group(self.curve_bound_j_base, n = self.prefix + '_curve_bound_j_base_grp')
		pm.select(cl = True)
		
		#translate
		self.curve_bound_j_base_grp.translate.set(self.leg_locator_tip_worldCoords)
		pm.select(cl = True)
		
		
		
		#curve_bound_j_tip
		pm.select(cl = True)
		self.curve_bound_j_tip = pm.joint(a = True, p= (0,0,0),  co = True, n = self.prefix +'_curve_bound_j_tip')
		pm.select(cl = True)
		
		#group
		self.curve_bound_j_tip_grp = pm.group(self.curve_bound_j_tip, n = self.prefix + '_curve_bound_j_tip_grp')
		pm.select(cl = True)
		
		#translate
		self.curve_bound_j_tip_grp.translate.set(self.foot_locator_worldCoords)
		pm.select(cl = True)
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:32,代码来源:rbFootRigB.py

示例8: createSortingGroups

	def createSortingGroups(self):
		
		pm.select(cl = True)
		
		
		
		#create nodesGrp
		self.nodesGrp = pm.group(n = self.prefix + '_nodes_grp')
		pm.select(cl = True)
		
		#create manipsGrp
		self.manipsGrp = pm.group(n = self.prefix + '_manips_grp')
		pm.select(cl = True)
		
		#create jointsGrp
		self.jointsGrp = pm.group(n = self.prefix + '_joints_grp')
		pm.select(cl = True)
		
		
		#Parent
		
		#nodesGrp
		pm.parent( self.foot_spline_ik_base_grp ,self.foot_spline_ik_tip_grp, self.foot_splineIk_curve_grp, self.leg_ik_handle_grp, self.nodesGrp)
		pm.select(cl = True)
		
		#manipsGrp
		pm.parent( self.pole_vector_linking_curve_grp, self.manip_foot_ik_tip_grp , self.manip_foot_ik_base_grp, self.leg_ik_pole_vector_locator_grp , self.manip_aim_indicator_grp , self.manip_leg_complete_grp, self.manip_leg_ik_grp, self.manip_leg_base_grp, self.manipsGrp)
		pm.select(cl = True)
		
		#jointsGrp
		pm.parent( self.foot_ik_tip_j_grp , self.foot_ik_base_j_grp, self.foot_ik_bound_j_grp , self.curve_bound_j_tip_grp, self.curve_bound_j_base_grp, self.leg_ik_j_grp, self.jointsGrp)
		pm.select(cl = True)
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:32,代码来源:rbFootRigB.py

示例9: __cleanUp

   def __cleanUp(self):
       
       for i in (self.thumbChain.chain, self.indexChain.chain, self.middleChain.chain, self.ringChain.chain,self.pinkieChain.chain):
           iJoint = i[0].name()
           pm.parent(iJoint,self.handChain.chain[-1].name() )
       
       self.bonesGrp = pm.group (empty = 1, n= nameUtils.getUniqueName(self.side, self.baseName + "Bones", "GRP"))
       self.bonesGrp.setMatrix(self.handChain.chain[0].wm.get())
 
       self.handChain.chain[0].setParent(self.bonesGrp)
       
       self.ctlsGrp = pm.group (self.handChain.controlsArray[0].controlGrp, 
                                self.thumbChain.controlsArray[0].controlGrp,
                                self.indexChain.controlsArray[0].controlGrp, 
                                self.middleChain.controlsArray[0].controlGrp,
                                self.ringChain.controlsArray[0].controlGrp,
                                self.pinkieChain.controlsArray[0].controlGrp, 
                                n= nameUtils.getUniqueName(self.side, self.baseName + "Controls", "GRP"))
       
       self.mainGrpLimb = pm.group (empty= 1, n= nameUtils.getUniqueName (self.side, self.baseName + "Main", "GRP"))
       
       for o in (self.bonesGrp, self.ctlsGrp):
           o.setParent(self.mainGrpLimb)
       
       for i in (self.thumbChain.controlsArray[0].controlGrp,self.indexChain.controlsArray[0].controlGrp,self.middleChain.controlsArray[0].controlGrp,self.ringChain.controlsArray[0].controlGrp,self.pinkieChain.controlsArray[0].controlGrp):
           pm.parent(i, self.handChain.controlsArray[0].controlName)
开发者ID:anamei92,项目名称:SeniorDesign,代码行数:26,代码来源:handModule.py

示例10: create

def create(xfo, parent, suffix=""):
    """
    xfo - transform to drive with local offset
    the local reader will have the same world matrix as this
    parent - transform to parent under
    parent should have the same space as xfo
    parent moves in global space, but keeps the same local space for xfo
    to remain constant
    """
    reader = pm.group(em=True, n=xfo + "_localReader" + suffix)
    readerHm = pm.group(reader, n=xfo + "_localReaderHm" + suffix)

    mat = xfo.getMatrix(worldSpace=True)
    readerHm.setMatrix(mat, worldSpace=True)

    rp = xfo.getRotatePivot(space="world")
    readerHm.setRotatePivot(rp, space="world")
    reader.setRotatePivot(rp, space="world")

    sp = xfo.getScalePivot(space="world")
    readerHm.setScalePivot(sp, space="world")
    reader.setScalePivot(sp, space="world")

    parent | readerHm

    reader.t >> xfo.t
    reader.r >> xfo.r
    reader.s >> xfo.s

    return reader
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:30,代码来源:localReader.py

示例11: build

def build(crv, name=''):
    '''
    creates a Marco Giordano style eyelid rig

    '''
    params = [curve.getClosestPointOnCurve(crv=crv, point = pmc.pointPosition(cv)) for cv in crv.cv[:]]

    mainGrp = pmc.group(empty=1, name='%s_grp' % name)
    baseGrp = pmc.group(empty=1, name='%s_base_grp' % name)
    baseGrp.setParent(mainGrp)

    mps = curve.nodesAlongCurve(crv=crv.name(), numNodes=len(params), name=name)

    for index in range(len(params)):
        mp = common.getPyNode(mps['mpNodes'][index])
        mp.uValue.set(params[index])
        mp.fractionMode.set(0)

        grp = common.getPyNode(mps['grps'][index])

        aimGrp = pmc.group(empty=1, name='%s_%s_aim_grp' % (name, str(index)))
        aimGrp.setParent(baseGrp)
        con = pmc.aimConstraint(grp, aimGrp, mo=0, wut=2, wuo=baseGrp.name())

        pmc.select(aimGrp, r=1)
        j = pmc.joint(name='%s_%s_jnt' % (name, str(index)))
        j.tx.set(10)
开发者ID:duncanrudd,项目名称:rooftops,代码行数:27,代码来源:eyelid.py

示例12: __init__

    def __init__(self, *args, **kwargs):
        self._isJointControl = kwargs.pop("jointControl", False) | kwargs.pop("jc", False)
        self._style = kwargs.pop

        self._translateLocked = kwargs.pop("translate", True) | kwargs.pop("t", True)
        self._rotateLocked = kwargs.pop("rotate", True) | kwargs.pop("r", True)
        self._scaleLocked = kwargs.pop("scale", True) | kwargs.pop("s", True)
        self.name = kwargs.pop("name", "Control")
        self.name = kwargs.pop("n", self.name)

        self.parent = None

        if type(args[0]) == int:
            self.node = pm.group(em=True, n=self.name)
            self.setStyle(args[0])

        # Wrap an existing node
        elif type(args[0]) == pm.nt.Transform:
            if type(args[0].getShape()) == pymel.core.nodetypes.NurbsCurve:
                self.node = args[0]
            else:
                if self._isJointControl:
                    pm.select(cl=True)
                    self.node = pm.joint(n=self.name)
                    self.node.drawStyle.set(2)
                else:
                    self.node = pm.group(em=True, n=self.name)

        else:
            pm.displayError("Invalid argument: {0}".format(args[0]))
开发者ID:kudiaborm,项目名称:mkScripts,代码行数:30,代码来源:Control.py

示例13: build_flexi_jnts

    def build_flexi_jnts(self, follicles):
        """ 
        Args:
            None
        Returns (None)
        """
        follicle_prefix = '%s_flexiPlane_' % self.flexiPlaneNameField.getText()
        jntGRP_name = self.flexiPlaneNameField.getText() + '_flexiPlane_JNT_GRP'
        
        pm.group( em = True, name = jntGRP_name )
        
        for index,follicle in enumerate(follicles):
            jnt_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
                                                 INDEX = 'flexiPlane_jnt%03d' % (index+1),
                                                 SUFFIX = 'JNT')
            jnt_offset_name = jnt_name.replace('_JNT','Offset_GRP')
            tweek_ctrlCon_name = self.format_string.format(PREFIX = self.flexiPlaneNameField.getText(),
                                                 INDEX = 'flexiPlane_tweak%03d' % (index+1),
                                                 SUFFIX = 'CTRLCon_GRP')

            pm.joint( p = ( follicle.translateX.get(), 0, 0 ), n = jnt_name )
            pm.select(jnt_name, r=True)
            offSetGRP.add_offset_grps()
            
            pm.parent( jnt_offset_name, jntGRP_name )
            pm.select( clear = True )
            
            tweak_ctrl_con = pm.PyNode(tweek_ctrlCon_name)
            joint_offset = pm.PyNode(jnt_offset_name)
            
            pm.parentConstraint( tweek_ctrlCon_name, jnt_offset_name )
            
            pm.setAttr(jnt_name + '.rotateZ', -90)
            pm.makeIdentity( jnt_name, apply=True, translate=True, rotate=True )
开发者ID:michaelanieves,项目名称:Rigging,代码行数:34,代码来源:flexi_plane.py

示例14: createGroupsAndSortContent

	def createGroupsAndSortContent(self):
		
		pm.select(cl = True)
		
		#create nodesGrp
		self.nodesGrp = pm.group(n = self.prefix + '_nodes_grp')
		pm.select(cl = True)
		
		#create manipsGrp
		self.manipsGrp = pm.group(n = self.prefix + '_manips_grp')
		pm.select(cl = True)
		
		#create jointsGrp
		self.jointsGrp = pm.group(n = self.prefix + '_joints_grp')
		pm.select(cl = True)
		
		
		#Parent
		
		#nodesGrp
		pm.parent(self.ikHandleAnimatedGrp, self.dynamicChain_spline_ik_grp, self.hairsystemNodesGrp, self.nodesGrp)
		pm.select(cl = True)
		
		#manipsGrp
		pm.parent(self.completeSwingManipGrp, self.fkAnimatedManipsGrp, self.manipIkAnimatedPoleVectorGrp, self.manipIkAnimatedGrp, self.manip_CtrlCenter_grp, self.manip_master_grp, self.manipsGrp)
		pm.select(cl = True)
		
		#jointsGrp
		pm.parent(self.ikDynamicJointsGrp, self.ikAnimatedJointsGrp, self.fkAnimatedJointsGrp, self.completeSwingJointsGrp, self.boundJointsGrp, self.jointsGrp)
		pm.select(cl = True)
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:30,代码来源:rbDynamicChain.py

示例15: create

def create(ctl, tipGeo, weights, name, keys, addGeos=[], useScale=False):
    '''
    tipGeo - vtx of the tip of the eye
    weights - list of weights for each loop radiating outwards (including geoTip)
    e.g. [1, 1, 1, 1, 1, .95, 0.75, 0.5, .25, .1]
    addGeo - list of additional geometry for cluster to deform
    name - 'pupil' or 'iris'
    
    e.g.:
    geo = nt.Mesh(u'LT_eyeball_geoShape')
    tipGeo = geo.vtx[381]
    ctl = nt.Transform(u'LT_eye_ctl')
    name = '_iris'
    
    keys = {'sx': {0.01:0.01, 1:1, 2:2},
            'sy': {0.01:0.01, 1:1, 2:2},
            'sz': {0.01:0.01, 1:1, 2:3.75}}
    weights = [1, 1, 1, 1, 1, .95, 0.75, 0.5, .25, .1]
    '''
    geo = tipGeo.node()
    dfm, hdl = pm.cluster(tipGeo, n=ctl+name+'_dfm', foc=True)
    dfg = pm.group(hdl, n=ctl+name+'_dfg')
    rp = hdl.getRotatePivot(space='world')
    sp = hdl.getScalePivot(space='world')
    dfg.setRotatePivot(rp, space='world')
    dfg.setScalePivot(sp, space='world')
    dfh = pm.group(dfg, n=ctl+name+'_dfh')
    
    ctl.addAttr(name, min=0.01, max=2, dv=1, k=True)
    
    for attr, key in keys.items():
        rt.connectSDK(ctl.attr(name), hdl.attr(attr), key)

    loopNums = len(weights) - 1
    vertLoops = mesh.VertexLoops([tipGeo], loopNums)
    
    # add membership
    pm.select(vertLoops[:])
    for vertLoop in vertLoops[:]:
        for eachVert in vertLoop:
            dfm.setGeometry(eachVert)
            
    for loopId, weight in enumerate(weights):
        for eachVert in vertLoops[loopId]:
            print eachVert
            dfm.setWeight(geo, 0, eachVert, weight)
            
    # add additional geometries
    for eachGeo in addGeos:
        dfm.setGeometry(eachGeo, foc=True)
        
    if useScale:
        # modulate cluster scale by control scale
        for eachAttr in ('sx', 'sy', 'sz'):
            scaleInput = hdl.attr(eachAttr).inputs(p=True)[0]
            mdl = pm.createNode('multDoubleLinear', n=hdl+'_'+eachAttr+'_scale_mdl')
            scaleInput >> mdl.input1
            ctl.attr(eachAttr) >> mdl.input2
            mdl.output >> hdl.attr(eachAttr)   
    return dfh
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:60,代码来源:dilate.py


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