コード例 #1
0
ファイル: dynamics.py プロジェクト: pj1138/MayaToolbox
def quickDyn(spread=5, num=10, joints=False, bake=False):
    target = []
    g = py.gravity()

    for i in range(0,num):
        c = py.polyCube()
        target.append(c)
        x = rnd(-spread,spread)
        y = rnd(-spread,spread) + 10
        z = rnd(-spread,spread)
        py.move(x,y,z)
        py.rotate(x,y,z)

    s(target)
    py.rigidBody()

    for i in range(0,len(target)):
        py.connectDynamic(target[i],f=g)

    if(joints==False and bake==True):
        bakeAnimation(target)
        
    if(joints==True):
        target2 = []

        for i in range(0,len(target)):
            s(target[i])
            jnt = py.joint()
            target2.append(jnt)
            
        if(bake==True):
            bakeAnimation(target2)

        for i in range(0,len(target2)):
            unparent(target2[i])
コード例 #2
0
    def buildBoxController(self):
        defaultPointsList = [(1, -1, 1), (1, -1, -1), (-1, -1, -1),
                             (-1, -1, 1), (1, 1, 1), (1, 1, -1), (-1, 1, -1),
                             (-1, 1, 1)]
        pointsList = []
        for p in defaultPointsList:
            pointsList.append((p[0] * self.ctrlScale, p[1] * self.ctrlScale,
                               p[2] * self.ctrlScale))

        knotsList = [i for i in range(16)]
        curvePoints = [
            pointsList[0], pointsList[1], pointsList[2], pointsList[3],
            pointsList[7], pointsList[4], pointsList[5], pointsList[6],
            pointsList[7], pointsList[3], pointsList[0], pointsList[4],
            pointsList[5], pointsList[1], pointsList[2], pointsList[6]
        ]

        ctrl = pm.curve(d=1, p=curvePoints, k=knotsList)
        ctrl = pm.rename(ctrl, self.ctrlName)
        ctrlGrp = pm.group(ctrl, n=str(self.ctrlName + '_grp'))

        # pm.addAttr(ctrl,ln='parent',at='message')
        # pm.connectAttr(ctrlGrp.name() + '.message' , ctrl.name() + '.parent')

        pm.move(ctrlGrp, self.ctrlPos[0], self.ctrlPos[1], self.ctrlPos[2])
        pm.rotate(ctrlGrp, self.ctrlRot[0], self.ctrlRot[1], self.ctrlRot[2])
        self.ctrlGrp = ctrlGrp
コード例 #3
0
def add_text_shape(ctrl, text):
    text_curve = pm.PyNode( pm.textCurves(ch=False, font="Arial Black", text=text, name='text_curve')[0] )
    text_curve_length = text_curve.boundingBox()[1][0] #max X
    text_curve_height = text_curve.boundingBox()[1][1] #max Y
    
    shapes = pm.listRelatives(text_curve, ad=True, type="shape")
    
    pm.xform(text_curve, piv=[0,text_curve_height,0], ws=True)

    pm.move(text_curve, 0, -text_curve_height , 0)

    scale = 1 / text_curve_length
    pm.scale(text_curve, scale, scale, scale)
            
    pm.makeIdentity(text_curve, apply=True, t=True, r=True, s=True)

    display_attr = ("%s_text_display"%text)
    if not ctrl.hasAttr(display_attr):
        ctrl.addAttr(display_attr, at='bool', k=True, dv=1)

    for s in shapes:
        pm.parent(s, ctrl, s=True, r=True)
        s.rename('%sText'%text)
        pm.connectAttr("%s.%s" %(ctrl.name(), display_attr), s.visibility)

    pm.delete(text_curve)
コード例 #4
0
def move_to_origo(node=None):
    if not node:
        for node in pm.selected():
            move_to_origo(node)
        return

    pm.move(node, [0, 0, 0], rpr=True)
コード例 #5
0
ファイル: ctrlShape.py プロジェクト: Aiacos/DevPyLib
def chestCtrlShape(name, normalDirection=[1, 1, 0], scale=1):
    ctrl = pm.circle(n=name, s=10, nr=[0, 0, 1])[0]

    pm.move(0, 0, 1, ctrl.cv[3:4], ctrl.cv[8:9], r=True, os=True)
    pm.scale([ctrl.cv[3:4], ctrl.cv[8:9]], [1, 3, 1], r=True, p=[0, 0, 1])
    pm.scale([ctrl.cv[0], ctrl.cv[2], ctrl.cv[5], ctrl.cv[7]], [1.75, 1.35, 1], r=True, p=[0, 0, 0])
    pm.move(0, 0, -0.75, ctrl.cv[0], ctrl.cv[2], ctrl.cv[5], ctrl.cv[7], r=True, os=True)
    pm.move(0, 0, -1, ctrl.cv[1], ctrl.cv[6], r=True, os=True)
    pm.move(0, -0.75, 0, ctrl.cv[1], r=True, os=True)
    pm.move(0, 0.25, 0, ctrl.cv[0], ctrl.cv[2], r=True, os=True)
    # pm.xform(ctrl, ws=True, pivots=[0, 0, -0.35])

    if normalDirection[0] == 1:
        pm.rotate(ctrl.cv[:], [90, 0, 0])
    elif normalDirection[0] == -1:
        pm.rotate(ctrl.cv[:], [-90, 0, 0])

    if normalDirection[1] == 1:
        pm.rotate(ctrl.cv[:], [0, 90, 0])
    elif normalDirection[1] == -1:
        pm.rotate(ctrl.cv[:], [0, -90, 0])

    if normalDirection[2] == 1:
        pm.rotate(ctrl.cv[:], [0, 0, 90])
    elif normalDirection[2] == -1:
        pm.rotate(ctrl.cv[:], [0, 0, -90])

    ctrl.scale.set(scale, scale, scale)
    common.deleteHistory(ctrl)
    common.freezeTranform(ctrl)

    return ctrl
コード例 #6
0
ファイル: __init__.py プロジェクト: loichuss/maya
def __restoreShapes__(elts):

    if elts==None:
        # get each objects from rigShapesSet
        if pmc.objExists('rigShapesSet'):
            elts = pmc.sets('rigShapesSet', query=True)
        fromSelection=False
    else:
        fromSelection=True
    
    if elts:
        for elt in elts:
            if fromSelection:
                atoms = various.getAtoms(elt.getShape(), flat=False)
                for i in range(len(atoms)):
                    try:
                        pmc.move(atoms[i], pmc.PyNode(elt.name()+'_storedShp.cv'+str(i)).get(), absolute=True)
                    except:
                        vp.vPrint('No %s in rigShapesSet set' % (elt.name()+'_storedShp'), 1)
            else:
                if pmc.objExists(elt.name().replace('_storedShp', '')):
                    obj = pmc.PyNode(elt.name().replace('_storedShp', '')).getShape()
                    atoms = various.getAtoms(obj, flat=False)
                    for i in range(len(atoms)):
                        try:
                            pmc.move(atoms[i], pmc.PyNode(elt+'.cv'+str(i)).get(), absolute=True)
                        except:
                            vp.vPrint('No data founded from %s in rigShapesSet set' % elt.name(), 1)
                else:
                    vp.vPrint('Shape %s doesn\'t exist' % elt.name().replace('_storedShp', ''), 1)
コード例 #7
0
ファイル: planePair.py プロジェクト: Mikfr83/fossil
def build():

    ctrl = nurbsPlane(ax=[0, 1, 0], w=1, d=1, lr=1)[0]
    move(ctrl.cv, [0, 0.5, 0], r=1, os=1, wd=True)
    other = nurbsPlane(ax=[0, 1, 0], w=1, d=1, lr=1)[0]
    move(other.cv, [0, -0.5, 0], r=1, os=1, wd=True)

    points = [
        (-0.5, 0, 0.5),
        (0.5, 0, 0.5),
        (0.5, 0, -0.5),
        (-0.5, 0, -0.5),
        (-0.5, 0, 0.5),
    ]

    line = curve(p=[(p[0], p[1] + .5, p[2])
                    for p in points] + [(p[0], p[1] - .5, p[2])
                                        for p in points],
                 d=1)
    line.rename('outline')

    other.getShape().setParent(ctrl, add=True, shape=True)
    line.getShape().setParent(ctrl, add=True, shape=True)

    delete(line, other)

    return ctrl
コード例 #8
0
def matchCtrlTranslations():

    ctrl_map = {
        'CTRLIKArm_R': 'Wrist_R',
        'CTRLIKLeg_R': 'Ankle_R'
    }

    for ctrl in ctrl_map:
        pm.delete(pm.pointConstraint(ctrl_map[ctrl], ctrl))

    pole_map = {
        'CTRLPoleArm_R': ['Shoulder_R', 'Elbow_R', 'Wrist_R'],
        'CTRLPoleLeg_R': ['Hip_R', 'Knee_R', 'Ankle_R']
    }

    for pole in pole_map:
        mid = pm.ls(pole_map[pole][1])[0]
        loc = getPoleVector(
            *pm.ls(pole_map[pole])).normal()*20 + mid.getTranslation(ws=True)
        pm.move(pole, loc)

    eye_ht = pm.ls('Eye_R')[0].getTranslation(ws=True)[1]
    aim_loc = pm.ls('CTRLAimEye_M')[0].getTranslation(ws=True)
    aim_loc[1] = eye_ht
    pm.move('CTRLAimEye_M', aim_loc)
コード例 #9
0
ファイル: classes.py プロジェクト: coxevan/tech_art_tools
 def move_to_position(self):
     for i in range(0, len(self.locator)):
         py.select(self.locator[i])
         py.move(self.original_positions[i])
         self.grp_position.append([py.getAttr(self.locator[i]+'.t')])
         print 'moving %s' % self.locator[i]
     return self.locator
コード例 #10
0
    def createSrf(self):
        # calculate the witdth of the surface as a fraction of the total joint chain length
        jntChainLength = 0
        crvPoints = []
        for i in range(1, self.numJnt):
            pos1 = self.ikJntList[i - 1].getTranslation(space='world')
            crvPoints.append(pos1)
            pos2 = self.ikJntList[i].getTranslation(space='world')

            jntChainLength += (pos2 - pos1).length()
            if i == self.numJnt - 1:
                crvPoints.append(pos2)

        jntChainLength = math.ceil(jntChainLength)
        self.width = jntChainLength * self.widthMult

        crv1 = pm.curve(n=self.name + '_crv1', d=1, p=crvPoints)
        pm.move(crv1, self.width / 2.0, 0, 0, r=1)
        pm.parent(crv1, self.mainGrp)
        crv2 = pm.curve(n=self.name + '_crv2', d=1, p=crvPoints)
        pm.move(crv2, self.width / -2.0, 0, 0, r=1)
        pm.parent(crv2, self.mainGrp)

        pm.select(cl=1)
        loftSrf = pm.loft(crv2, crv1, ch=1, u=1, c=0, ar=1, d=3, ss=1, rn=0, po=0, rsn=1, n=self.name + "_srf")[0]
        rebuiltLoftSrf = \
        pm.rebuildSurface(loftSrf, ch=1, rpo=1, rt=0, end=1, kr=0, kcp=0, kc=0, su=self.numCtrl - 1, du=3, sv=0, dv=3,
                          tol=0, fr=0, dir=2)[0]

        self.srf = loftSrf
        pm.parent(self.srf, self.mainGrp)
コード例 #11
0
    def test_build_joint_chain(self):
        reg_node, chain = utils.build_joint_chain(name='temp',
                                                  crv=self.crv,
                                                  order='xyz',
                                                  num=10,
                                                  loc=self.loc)

        # Confirm right number of joints
        self.assertEqual(len(chain), 10)

        # Confirm expected names
        self.assertEqual([x.name() for x in chain],
                         ['temp_Jnt_%s' % (x+1) for x in range(10)])

        # Check positions match input curves'
        for jnt, pos in zip(chain, self.positions):
            self.assertTrue(transforms.assertLocationIs(jnt, pm.dt.Point(pos)))

        # Check aim axis is x
        for jnt in chain[:-1]:
            self.assertTrue(joints.assertAimAxis(jnt, 'x'))

        # Check for reg_node connection
        self.assertEqual(reg_node.temp_chain_root.listConnections()[0],
                         chain[0])

        # Check y axis pointing backwards (x, y, -1)
        for jnt in chain:
            loc = pm.spaceLocator()
            pm.delete(pm.parentConstraint(jnt, loc, mo=0))
            pm.move(loc, 0, 0, -1, r=1)
            pos = pm.xform(loc, q=1, ws=1, rp=1)
            self.assertAlmostEqual(pos[-1], -1)
            pm.delete(loc)
コード例 #12
0
ファイル: aw_influenceGrid.py プロジェクト: AndresMWeber/aw
def locatorGrid(width, height, depth, offset, centered=True):
	'''Create a grid of locators to test upon
	Args:
		width (int): Width of the grid
		height (int): Height of the grid
		offset (float): Adds an offset multiplier to the locator positions
		centered (bool): determines whether it's centered in world space
	Returns (pm.PyNode): The top group of the locator grid
	Usage: locatorGrid(5,5,5,2)
	'''
	if not pm.objExists('locatorGrid'):
		grp=pm.group(em=True,n='locatorGrid')
		for d in range(0,depth):
			for w in range(0,width):
				for h in range(0,height):
					loc = pm.polyCube(w=.5, h=.5, d=.5, ch=0)[0]
					pm.move(loc,(w*offset,h*offset,d*offset), rpr=True)
					loc.setParent(grp)
					if loc.getShape().type() == "locator":
						loc.localScale.set(.2,.2,.2)
		if centered:
			pm.xform(grp, cp=1)
			pm.move(grp, (0, 0, 0), rpr=1)
			pm.makeIdentity(grp, apply=True, r=1,s=1,t=1)
		return grp
コード例 #13
0
ファイル: transform.py プロジェクト: darrickyee/dyutils
def alignToVector(xform, aim_x=(1, 0, 0), aim_y=(0, 1, 0), freeze=False):
    """
    Rotates transform so that axes align with specified world-space directions.

    Parameters
    ----------
    xform : pm.nt.Transform
        Transform to rotate.
    aim_x : tuple, optional
        World-space direction for the x-axis of `xform`.
    aim_y : tuple, optional
        World-space direction for the y-axis of `xform`.  If not orthogonal to `aim_x`,
        the y-axis will attempt to be as close as possible to this vector.
    freeze : bool, optional
        Freeze transformation if True. Default is False.

    """

    xform = pm.ls(xform)[0]

    xf_node = pm.createNode('transform')
    pm.move(xf_node, xform.getTranslation(ws=True))

    aim_node = pm.createNode('transform')
    pm.move(aim_node, xform.getTranslation(space='world') + aim_x)

    pm.delete(pm.aimConstraint(aim_node, xf_node, worldUpVector=aim_y),
              aim_node)

    xform.setRotation(xf_node.getRotation(ws=True), ws=True)
    pm.delete(xf_node)

    if freeze:
        pm.makeIdentity(xform, apply=True)
コード例 #14
0
    def createEmitter(self, mesh, name="particleEmitter_msh"):
        # Create boundingBox of the mesh
        bbx = pm.polyEvaluate(mesh, b=True)
        cube = pm.polyCube(
            w=abs(bbx[0][1] - bbx[0][0]),
            h=abs(bbx[1][1] - bbx[1][0]),
            d=abs(bbx[2][1] - bbx[2][0]),
            sx=1,
            sy=1,
            sz=1,
            ax=(0, 1, 0),
            cuv=4,
            ch=0,
            name=name,
        )
        cube = cube[0]
        cube.setAttr("t", ((bbx[0][1] + bbx[0][0]) / 2, (bbx[1][1] + bbx[1][0]) / 2, (bbx[2][1] + bbx[2][0]) / 2))

        # Keep only face 1 for emit
        pm.delete([cube + ".f[2:6]", cube + ".f[0]"])

        # Connection of mesh and the emitter
        self.connectOriginaleMesh(mesh, cube)

        # Move emitter in y  in a percentage of area of face.
        face = pm.PyNode(cube + ".f[1]")
        area = face.getArea(space="world")
        pm.select(cube)
        y = pow(area, 0.1) * 100
        pm.move(0, y, 0, r=1, os=1, wd=1)
        return cube
コード例 #15
0
    def generateShape(self, *args):
        sel = pm.ls(sl=1)
        if len(sel) != 4:
            pm.mel.warning('Must select: Neutral, TargetA, TargetB, TargetC meshes')
            return
        
        meshN = sel[0]
        meshA = sel[1]
        meshB = sel[2]
        meshC = sel[3]
        
        # Create new mesh
        new = pm.duplicate(meshN, n='Corrective')[0]
        
        # Per vertex, translate in world space: C-(A+B)
        for vtx in new.vtx:
            vert = vtx.split('.')[1]
            n_pos = pmd.Point(pm.xform( vtx, query=True, ws=True, t=True))
            a_pos = pmd.Point(pm.xform( meshA + '.' + vert, query=True, ws=True, t=True))
            b_pos = pmd.Point(pm.xform( meshB + '.' + vert, query=True, ws=True, t=True))
            c_pos = pmd.Point(pm.xform( meshC + '.' + vert, query=True, ws=True, t=True))
            
            aVec = a_pos - n_pos
            bVec = b_pos - n_pos
            cVec = c_pos - n_pos

            delta = cVec - (aVec + bVec)
            
            pm.move(vtx, delta, r=1)
コード例 #16
0
    def _build(self, *args):
        """
        Builds the joints on the curve.
        """
        # naming convention
        asset = self.asset
        side = self.side
        part = self.part
        joints = self.joints
        suffix = self.suffix

        if self.gui:
            asset = self.asset_name.text()
            side = self.side.currentText()
            part = self.part_name.text()
            joints = self.joints_box.value()
            suffix = self.suffix.currentText()
        try:
            curve = pm.ls(sl=True)[0]
            curve_name = NameUtils.get_unique_name(asset, side, part, "crv")
            self.curve = pm.rename(curve, curve_name)
        except IndexError:
            pm.warning("Please select a curve")
            return

        length_of_curve = pm.arclen(self.curve)
        equal_spacing = length_of_curve / float(joints)

        # clear the selection
        pm.select(cl=True)

        # # create the joints
        curve_joints = list()
        for x in xrange(int(joints) + 1):
            name = NameUtils.get_unique_name(asset, side, part, suffix)
            joint = pm.joint(n=name)
            curve_joints.append(joint)

            joint_position = (x * equal_spacing)
            pm.move(0, joint_position, 0)
        
        # rename last joint
        last_joint = curve_joints[-1]
        pm.rename(last_joint, last_joint + "End")

        root_joint = pm.selected()[0].root()
        end_joint = pm.ls(sl=True)[0]
        solver = 'ikSplineSolver'

        # attach joints to curve
        ik_name = NameUtils.get_unique_name(asset, side, part, "ikHandle")
        self.ikHandle = pm.ikHandle(sj=root_joint, ee=end_joint, sol=solver,
                        c=self.curve, pcv=True, roc=True, ccv=False, n=ik_name)
        joint_chain = pm.ls(root_joint, dag=True)

        # delete history
        pm.makeIdentity(root_joint, apply=True)

        # cleanup
        self._cleanup()
コード例 #17
0
    def bdBuildSphereController(self):
        circleA = pm.circle(n=self.ctrlName + 'A',
                            nr=(0, 1, 0),
                            c=(0, 0, 0),
                            radius=self.ctrlScale)
        circleB = pm.circle(n=self.ctrlName + 'B',
                            nr=(1, 0, 0),
                            c=(0, 0, 0),
                            radius=self.ctrlScale)
        circleC = pm.circle(n=self.ctrlName + 'C',
                            nr=(0, 0, 1),
                            c=(0, 0, 0),
                            radius=self.ctrlScale)

        circleBShape = pm.listRelatives(circleB[0], c=True)
        circleCShape = pm.listRelatives(circleC[0], c=True)
        pm.parent(circleBShape[0], circleA[0], r=True, s=True)
        pm.parent(circleCShape[0], circleA[0], r=True, s=True)
        pm.delete(circleB, circleC)
        ctrl = pm.rename(circleA[0], self.ctrlName)
        ctrlGrp = pm.group(ctrl, n=self.ctrlName + '_grp')

        pm.move(ctrlGrp, self.ctrlPos[0], self.ctrlPos[1], self.ctrlPos[2])
        pm.rotate(ctrlGrp, self.ctrlRot[0], self.ctrlRot[1], self.ctrlRot[2])

        self.ctrlGrp = ctrlGrp
コード例 #18
0
ファイル: pinedit.py プロジェクト: oba315/sketch_deformer
 def press_cmd(self, *args) :
     
     ctx            = self.ctx
     print "paramProgress_befor", self.paramProgress_befor
     
     pressPosition              = cmds.draggerContext( ctx, query=True, anchorPoint=True)
     self.drag_star_point       = pressPosition
     print ("Press: " + str(pressPosition))
     
     #self.paramProgress = 0.0
     pos            = curvetool.getCurvePoint(
                             self.cur,
                             [self.paramProgress],
                             "normal"
                             )[0]   
                     # 第二引数でターゲットの初期位置を指定
     
     self.moving_sph       = pm.sphere(n = "moving_sph", r=0.1)[0]
     pm.move( self.moving_sph , [pos[0],pos[1],pos[2]] )
     pm.refresh(f = 1)
     
     # ハイライト
     pm.hilite(self.cur)
     list = pm.ls(type = u'transform')
     for i in list :
         if "temp" in i.name() :
             pm.hilite(i)
コード例 #19
0
    def create_point_base(self, point, **kwargs):
        super(RigAim, self).create_point_base(point, **kwargs)
        root = self.create.group.point_base(point, type='world', name='root')
        aim = pm.duplicate(root)[0]
        self.name_convention.rename_name_in_format(aim, name='aim')

        pm.move(aim, 10, **{'move{}'.format(config.axis_order[0].upper()): True, 'objectSpace': True, 'relative': True})
        aim.setParent(self.rig_system.kinematics)
        root.setParent(self.rig_system.kinematics)
        reset = self.create.group.point_base(root, type='inserted', name='reset')

        self.tip = reset
        self.aim = root

        reset_control, control = self.create.controls.point_base(aim, name='aim')
        reset_control.setParent(self.rig_system.controls)
        parent = kwargs.pop('parent', control)
        aim_vector = [0, 0, 0]
        aim_vector[config.axis_order[0]] = 1
        up_vector = [0, 0, 0]
        up_vector[config.axis_order[1]] = 1
        self.create.constraint.point(point, reset, mo=True)
        pm.aimConstraint(aim, root, aimVector=aim_vector, worldUpType='objectrotation',
                         upVector=up_vector, worldUpObject=parent, worldUpVector=[0, 1, 0])
        self.rm.align(root, reset_control, translate=False)
        pm.parentConstraint(control, aim)
        self.reset_controls.append(reset_control)
        self.controls.append(control)
コード例 #20
0
ファイル: elephantPuppet.py プロジェクト: ziltz/riggingTools
def elephantFinish():
    print 'Finishing elephant'

    rig_quadFinalize()

    '''
    pm.setAttr("neckFocus_CTRL.focusNeck", 0.75)

    pm.setAttr("spineUpperPivot_CTRL.translateY", -17.164)
    pm.setAttr("spineUpperPivot_CTRL.translateZ", 1.81)
    pm.setAttr("spineUpper_CTRL.stretch", 0.2)
    '''
    pm.move( 'tailUpperAim_LOCUp', 0, 1000, 0,r=True,os=True )
    pm.move('tailLowerAim_LOCUp', 0, 1000, 0, r=True, os=True)

    pm.move(pm.PyNode( 'neckTipIK_CTRL.cv[:]'), 0 , 0, -5, r=True, os=True)
    pm.move(pm.PyNode( 'neckMidBIK_CTRL.cv[:]'), 0 ,-8.5, -13, r=True, os=True)
    pm.move(pm.PyNode( 'neckMidAIK_CTRL.cv[:]'), 0 , -1 , -23, r=True, os=True)
    
    controlSet = pm.PyNode('elephantRigPuppetControlSet')
    for s in ('l', 'r'):
        #pm.setAttr("displayModulesToggleControl."+s+"_fingers", 0)
        #pm.setAttr("displayModulesToggleControl."+s+"_toes", 0)

        #pm.setAttr(s+"_armPV_CTRL.space", 1)
        #pm.setAttr(s+"_shoulder_CTRL.followArm", 1)

        #pm.rotate(pm.PyNode(s+'_handBall_CTRL').cv, 0, 90, 0, r=True, os=True)
        #pm.scale(pm.PyNode(s+'_handBall_CTRL').cv, 2, 2, 2)

        #pm.parentConstraint( s+'_anklePos_JNT', s+'_toeThumbModify1_GRP' ,mo=True )

        controlSet.removeMembers([ s+'_shoulder_CTRL' ])
コード例 #21
0
    def generateShape(self, *args):
        sel = pm.ls(sl=1)
        if len(sel) != 4:
            pm.mel.warning(
                'Must select: Neutral, TargetA, TargetB, TargetC meshes')
            return

        meshN = sel[0]
        meshA = sel[1]
        meshB = sel[2]
        meshC = sel[3]

        # Create new mesh
        new = pm.duplicate(meshN, n='Corrective')[0]

        # Per vertex, translate in world space: C-(A+B)
        for vtx in new.vtx:
            vert = vtx.split('.')[1]
            n_pos = pmd.Point(pm.xform(vtx, query=True, ws=True, t=True))
            a_pos = pmd.Point(
                pm.xform(meshA + '.' + vert, query=True, ws=True, t=True))
            b_pos = pmd.Point(
                pm.xform(meshB + '.' + vert, query=True, ws=True, t=True))
            c_pos = pmd.Point(
                pm.xform(meshC + '.' + vert, query=True, ws=True, t=True))

            aVec = a_pos - n_pos
            bVec = b_pos - n_pos
            cVec = c_pos - n_pos

            delta = cVec - (aVec + bVec)

            pm.move(vtx, delta, r=1)
コード例 #22
0
ファイル: spiralStairs.py プロジェクト: Husky707/MayaTools
 def _build_step(self, objName):
     pm.select(objName + '.f[4]')
     pm.move(self.strWidth, x=True)
     pm.select(objName + '.f[1]')
     pm.scale(self.strHeight, y=True)
     pm.select(objName + '.f[2]')
     pm.scale(self.strDepth, z=True)
コード例 #23
0
ファイル: lib_mpc.py プロジェクト: AndresMWeber/aw
def rig_makeCtrlLabel(label):
	'''Creates a control that is displayed in customized choice of letters
	Args:
		label (string): the name of the desired control/visual display text
	Returns (pm.nt.Transform): returns the display control object
	Example Usage:
		rig_makeCtrlLabel("display")
	'''
	if not pm.objExists(label + "_CTRL"):
		txt_crv=pm.PyNode( pm.textCurves(ch=0,t=label,f="Courier")[0] )
		curves=[]
		i=1
		for crvShp in pm.ls(txt_crv.getChildren(ad=True), et="nurbsCurve"):
			crvTrm = crvShp.getParent()
			crvShp.getParent().setParent(w=True)
			pm.makeIdentity(crvShp.getParent(),apply=True,s=1,r=1,t=1,n=0)
			crvTrm.rename("display_%02d_CRV" % i)
			curves.append(crvTrm)
			i+=1
		displayCtrl=rig_combineCurves(curves,label+'_CTRL')
		pm.delete(txt_crv)
		displayCtrl.centerPivots()
		pm.move(displayCtrl, (0,0,0), rpr=True)
		pm.makeIdentity(displayCtrl,apply=True,s=1,r=1,t=1,n=0)
		displayGrp=pm.group(em=1,n=(label + "Offset_GRP"))
		displayCtrl.setParent(displayGrp)
		for displayCtrlShape in displayCtrl.listRelatives(shapes=True, fullPath=True):
			pm.setAttr(displayCtrlShape + ".overrideEnabled", 1)
			pm.setAttr(displayCtrlShape + ".overrideColor",17)
			
		rig_ctrlLock([displayCtrl], ["tx","ty","tz","rx","ry","rz","sx","sy","sz","v"], setKeyable=False, lock=True)
		return displayCtrl
	else:
		pm.error("That control already exists smarty pants!\n")
コード例 #24
0
ファイル: spiralStairs.py プロジェクト: Husky707/MayaTools
 def _set_step_pivot(self, objName):
     pm.select(objName + '.f[5]')
     pm.move(0, x=True)
     pm.select(objName + '.f[3]')
     pm.scale(0, y=True)
     pm.select(objName + '.f[0]')
     pm.scale(0, z=True)
コード例 #25
0
ファイル: jo_varFk.py プロジェクト: kyuhoChoi/mayaTools
def create_guideSurface( IdName, listOfJnts ):
    loftCurves = []
    for i in range(2):
        # duplicate and select hierarchy of joints
        listOfOffsetJnts = pm.duplicate( listOfJnts, name = 'b_' + IdName +'_offset1', parentOnly = True )
        
        # offset each joint on it's own z-axis
        for jnt in listOfOffsetJnts:
            if i == 0: pm.move(jnt, (0,0,-0.5), relative = True, objectSpace = True, preserveChildPosition = True)
            if i == 1: pm.move(jnt, (0,0,0.5), relative = True, objectSpace = True, preserveChildPosition = True)
        
        # draw loftcurves
        loftCurvePoints = []
        for each in listOfOffsetJnts:
            jntPosition = pm.xform(each, q = True, t = True, ws = True)
            loftCurvePoints.append(jntPosition)
        
        loftCurves.append( pm.curve( name = IdName + '_loftCurve' + str(i), degree = 1, point = loftCurvePoints ) ) 
        pm.delete(listOfOffsetJnts)

    # loft guideSurface
    guideSurface = pm.loft( loftCurves[0], loftCurves[1], name = IdName + '_guide_surface', ar=True, rsn=True, d=3, ss=1, object=True, ch=False, polygon=0 )
    guideSurface = pm.rebuildSurface( guideSurface ,ch=1, rpo=1, rt=0, end=1, kr=1, kcp=0, kc=0, su=0, du=3, sv=1, dv=3, tol=0.01, fr=0, dir=2 )
        
    # cleanup
    pm.delete( loftCurves )
    guideSurface[0].inheritsTransform.set(False)
    guideSurface[0].overrideEnabled.set(True)
    guideSurface[0].overrideDisplayType.set(1)
    # guideSurface[0].visibility.set(False)
    
    print('Successfully lofted guide surface. Continuing...')
    return guideSurface
コード例 #26
0
def generateJointCube(distant=3):
    last_crv = None
    for i, start_jnt in enumerate(pm.ls(sl=1, v=1, ni=1, dag=1, type="joint"),
                                  1):
        start_matrix = start_jnt.worldMatrix[0].get()
        start_pt = start_jnt.getTranslation(space="world")
        for end_jnt in start_jnt.listRelatives(c=1, type="joint"):
            end_pt = end_jnt.getTranslation(space="world")
            crv = generateCubeFromVector(start_pt, end_pt, distant=distant)

            crv.rename("%s_ctrl" % start_jnt)
            x, y, z = start_pt
            pm.move(x, y, z, crv.scalePivot, crv.rotatePivot)
            grp = pm.group(crv)
            grp.rename(crv.name() + "_GRP")
            pm.xform(grp, m=start_matrix.inverse())
            pm.makeIdentity(grp, a=1, t=1, r=1, s=1, n=0, pn=1)
            pm.xform(grp, m=start_matrix)
            # if last_crv:
            #     grp.setParent(last_crv)
            last_crv = crv

            pm.setAttr(crv.sx, l=1, k=0, cb=0)
            pm.setAttr(crv.sy, l=1, k=0, cb=0)
            pm.setAttr(crv.sz, l=1, k=0, cb=0)
            pm.parentConstraint(crv, start_jnt, mo=1)
コード例 #27
0
ファイル: bdTail.py プロジェクト: Mortaciunea/bdScripts
 def createSrf(self):
     #calculate the witdth of the surface as a fraction of the total joint chain length
     jntChainLength = 0
     crvPoints = []
     for i in range(1,self.numJnt):
         pos1 = self.ikJntList[i-1].getTranslation(space='world')
         crvPoints.append(pos1)
         pos2 = self.ikJntList[i].getTranslation(space='world')
 
         jntChainLength += (pos2 - pos1).length()
         if i == self.numJnt - 1:
             crvPoints.append(pos2)
     
     jntChainLength = math.ceil(jntChainLength )
     self.width = jntChainLength * self.widthMult
     
     crv1 = pm.curve(n=self.name + '_crv1',d=1,p=crvPoints)
     pm.move(crv1,self.width / 2.0,0,0,r=1)
     pm.parent(crv1,self.mainGrp)
     crv2 = pm.curve(n=self.name + '_crv2',d=1,p=crvPoints)
     pm.move(crv2,self.width / -2.0,0,0,r=1)
     pm.parent(crv2,self.mainGrp)
     
     pm.select(cl=1)
     loftSrf = pm.loft(crv2,crv1,ch=1,u=1,c= 0,ar= 1,d=3,ss= 1,rn=0,po=0,rsn=1,n=self.name + "_srf")[0]
     rebuiltLoftSrf = pm.rebuildSurface(loftSrf,ch=1, rpo=1, rt=0, end=1, kr=0, kcp=0, kc=0, su=self.numCtrl-1, du=3, sv=0, dv=3, tol=0, fr=0, dir=2 )[0]
     
     
     self.srf = loftSrf 
     pm.parent(self.srf,self.mainGrp)
コード例 #28
0
def snapCurveToClosestVertices(crv, geo):
    ''' Find closest Vertex on geo for each cv on curve and snaps to it
    Args:
        crv (transform): The curve which shall be snapped
        geo (transform): The geo as the base for the search
    Returns: 
         True if no error
    '''
    crvShape = pm.PyNode(crv).getShape()
    geoShape = pm.PyNode(geo).getShape()
    
    numcvs = crvShape.numCVs()
    
    
    for curvePoint in range(numcvs):
        # find closest vertex
        tempLoc = pm.spaceLocator(n='tempLoc')
        pm.xform(tempLoc, t=pm.pointPosition(crvShape.cv[curvePoint]))
        closestVertex = getClosestVertex(tempLoc, geo)
        
        # move curvepoint to closest vertex
        pm.xform(tempLoc, t=pm.pointPosition(closestVertex))
        pm.move(crvShape.cv[curvePoint], pm.pointPosition(closestVertex))
        
        pm.delete(tempLoc)
    return True
コード例 #29
0
 def create(self, startLocation=[0, 0, 0]):
     try:
         py.delete(tempConnectorName)
     except:
         pass
     py.polyCube(n=tempConnectorName,
                 height=100,
                 width=100,
                 depth=10,
                 subdivisionsWidth=3,
                 subdivisionsHeight=3)
     py.setAttr(tempConnectorName + '.rz',
                lock=True,
                keyable=False,
                channelBox=False)
     py.scale(tempConnectorName + '.f[4]', (0.25, 0.25, 0.25))
     py.polyExtrudeFacet(tempConnectorName + '.f[4]', localTranslateZ=10)
     py.polyExtrudeFacet(tempConnectorName + '.f[4]',
                         localScale=(1.25, 1.25, 1.25))
     py.polyExtrudeFacet(tempConnectorName + '.f[4]', localTranslateZ=20)
     py.scale(tempConnectorName + '.f[4]', (0, 0, 1))
     py.polyExtrudeFacet(tempConnectorName + '.f[32]',
                         localScale=(0.3, 0.27, 1))
     py.polyExtrudeFacet(tempConnectorName + '.f[32]', localTranslateZ=3)
     py.polyExtrudeFacet(tempConnectorName + '.f[32]',
                         localScale=(1.25, 1.25, 1.25))
     py.polyExtrudeFacet(tempConnectorName + '.f[32]', localTranslateZ=5)
     py.scale(tempConnectorName + '.f[32]', (0, 1, 0))
     py.move(tempConnectorName + '.f[32]', (0, 0, 6.15), r=True)
     py.xform(tempConnectorName, pivots=(0, -50, -5))
     py.move(tempConnectorName, startLocation)
     py.select(tempConnectorName)
コード例 #30
0
def inbound():
    
    global jointGuides,setUpName,jointGuidesGrp,side
    setUpName = pm.textFieldGrp('NameTFG', tx = True,q = True)
    colorSel = pm.radioButtonGrp('ColSel',q = True,sl = True) 
    
    if colorSel == 1:
        side = 'l'
    elif colorSel == 2:    
        side = 'm'
    elif colorSel == 3:    
        side = 'r'
        
    numOfJoints = pm.intSliderGrp('Joint_Num',q = True,v = True)   
    jointGuidesGrp = pm.group(em = 1,n = getUniqueName(side,setUpName + 'Gud', 'grp'))                
        
    for num in range(numOfJoints):
        loc = pm.spaceLocator(n = getUniqueName(side,setUpName,'loc'))
        pm.move(0,num * 2,0,loc)
        jointGuides.append(loc)
        loc.setParent(jointGuidesGrp)
    
    jointGuides.reverse()
    for num,loc in enumerate(jointGuides):
        if num < (len(jointGuides) - 1):
            jointGuides[num].setParent(jointGuides[num + 1])
    jointGuides.reverse()   
コード例 #31
0
def movePivot(objects, moveto="zero"):
    for object in objects:
        if moveto == "zero":
            pm.move(0,
                    0,
                    0,
                    object + ".scalePivot",
                    object + ".rotatePivot",
                    absolute=True)
        if moveto == "minY":
            bbox = pm.exactWorldBoundingBox(object)
            currentPivot = pm.xform(object, q=1, rp=1, ws=1)
            #bottom = [(bbox[0] + bbox[3]) / 2, bbox[1], (bbox[2] + bbox[5]) / 2]
            bottom = [currentPivot[0], bbox[1], currentPivot[2]]
            pm.xform(object, piv=bottom, ws=True)
        if moveto == "minX":
            bbox = pm.exactWorldBoundingBox(object)
            currentPivot = pm.xform(object, q=1, rp=1, ws=1)
            #bottom = [(bbox[0] + bbox[3]) / 2, bbox[1], (bbox[2] + bbox[5]) / 2]
            bottom = [bbox[0], currentPivot[1], currentPivot[2]]
            pm.xform(object, piv=bottom, ws=True)
        if moveto == "minZ":
            bbox = pm.exactWorldBoundingBox(object)
            currentPivot = pm.xform(object, q=1, rp=1, ws=1)
            #bottom = [(bbox[0] + bbox[3]) / 2, bbox[1], (bbox[2] + bbox[5]) / 2]
            bottom = [currentPivot[0], currentPivot[1], bbox[2]]
            pm.xform(object, piv=bottom, ws=True)
        if moveto == "center":
            pm.xform(object, cp=1)
コード例 #32
0
ファイル: lib_deformer.py プロジェクト: creuter23/tools
def createBendDeformerOnCurve(curveTransforms, upDir=(1,0,0), aimDir=(0,1,0)):
	'''Creates bend deformers on every curve and aims them at the end
	Args:
		curveTransforms ([pm.nt.Transform]): list of transforms with nurbsCurve shapes
		upDir (float, float, float): up direction for aim to orient the bend deformer
	Returns:
		([pm.nt.nonLinear]): list of bend deformers
	Usage:
		createBendDeformerOnCurve(pm.ls(sl=True))
	'''
	bends=[]
	for curveTransform in curveTransforms:
		bendName = curveTransform.name().replace('CRV','BEND')
		bend = pm.nonLinear(curveTransform, type='bend', frontOfChain=True, curvature=0.0, lowBound=0, highBound=1)
		bend[0].rename(bendName.replace('BEND','BENDHDL'))
		bend[1].rename(bendName)
		startPosition = curveTransform.getShape().cv[0].getPosition(space='world')
		endPosition = curveTransform.getShape().cv[-1].getPosition(space='world')
		loc = pm.spaceLocator()
		
		pm.move(loc, endPosition, a=True)
		pm.move(bend[1], startPosition, a=True)
		
		aimConst = pm.aimConstraint( loc, bend[1], upVector=upDir, aimVector=aimDir )
		pm.delete([loc, aimConst])
		bends.append(bend)
	return bends
コード例 #33
0
ファイル: forestGenerator.py プロジェクト: DeanB93/test
    def createEmitter(self, mesh, name="particleEmitter_msh"):
        #Create boundingBox of the mesh
        bbx = pm.polyEvaluate(mesh, b=True)
        cube = pm.polyCube(w=abs(bbx[0][1] - bbx[0][0]),
                           h=abs(bbx[1][1] - bbx[1][0]),
                           d=abs(bbx[2][1] - bbx[2][0]),
                           sx=1,
                           sy=1,
                           sz=1,
                           ax=(0, 1, 0),
                           cuv=4,
                           ch=0,
                           name=name)
        cube = cube[0]
        cube.setAttr("t",
                     ((bbx[0][1] + bbx[0][0]) / 2, (bbx[1][1] + bbx[1][0]) / 2,
                      (bbx[2][1] + bbx[2][0]) / 2))

        #Keep only face 1 for emit
        pm.delete([cube + ".f[2:6]", cube + ".f[0]"])

        #Connection of mesh and the emitter
        self.connectOriginaleMesh(mesh, cube)

        #Move emitter in y  in a percentage of area of face.
        face = pm.PyNode(cube + ".f[1]")
        area = face.getArea(space="world")
        pm.select(cube)
        y = pow(area, 0.1) * 100
        pm.move(0, y, 0, r=1, os=1, wd=1)
        return cube
コード例 #34
0
ファイル: torso.py プロジェクト: martinvillert/first_tool_rig
    def upper_part(self):
        """
        creat a torso from an ik spline chain
        """
        self.chain_torso = Chain.make_jnt_chain(self.controls[-3:-1],
                                                name_template=self.prefix +
                                                "_IK_top_spine_{number}_JNT",
                                                parent=self.spline_chain[-1])
        transform.match(self.controls[-1], self.chain_torso[0])
        pm.pointConstraint(self.spline_chain[-1], self.chain_torso[0])
        pm.orientConstraint(self.controls[-1], self.chain_torso[0])

        self.main_ctrl = Control.make_control(self.controls[0],
                                              name=self.prefix +
                                              "main_ctrl_spine_{number}_CTRL",
                                              parent=self.root_grp)
        pm.move(self.main_ctrl.getShape().cv, 1, 0, 0, relative=True)
        [ctl.set_parent(self.main_ctrl) for ctl in self.controls[::1]]

        self.fk_spline_chain = self.spline_chain.duplicate(
            name_template=self.prefix + "_FK_torso_{number}_JNT")
        self.fk_spline_chain.set_parent(self.root_grp)

        for jnt_torso, fk_ctrl in zip(self.fk_spline_chain,
                                      self.spine_fk_ctrl):
            pm.parentConstraint(fk_ctrl, jnt_torso)

        pm.connectAttr(self.root_grp.scale, self.null_chain[0].scale)
        pm.connectAttr(self.root_grp.scale,
                       self.spine_fk_ctrl[0].getParent().scale)
コード例 #35
0
def FUCBoxCreator():
    pos = [0, 0, 0]
    thisW = 1
    thisH = 1
    thisD = 1

    try:
        pm.select('FUC_Box')
        pos = cmds.objectCenter('FUC_Box', gl=True)
        thisW = pm.getAttr('FUC_Box' + '.sx')
        thisH = pm.getAttr('FUC_Box' + '.sy')
        thisD = pm.getAttr('FUC_Box' + '.sz')
        pm.delete()
    except:
        pass

    try:
        pm.select('FUC_Sphere')
        posX = pm.getAttr('FUC_Sphere' + '.tx')
        posY = pm.getAttr('FUC_Sphere' + '.ty')
        posZ = pm.getAttr('FUC_Sphere' + '.tz')
        pos = [posX, posY, posZ]
        r = pm.getAttr('FUC_Sphere' + '.sx')
        thisW = r
        thisH = thisW
        thisD = thisW
        pm.delete()
    except:
        pass

    pm.polyCube(name='FUC_Box', w=1, h=1, d=1)
    pm.move(pos)
    pm.scale(thisW, thisH, thisD)
    mel.eval('setAttr "FUC_Box.overrideEnabled" 1;')
    mel.eval('setAttr "FUC_Box.overrideShading" 0;')
コード例 #36
0
ファイル: splineNeck.py プロジェクト: Mikfr83/fossil
    def readIkKwargs(cls,
                     card,
                     isMirroredSide,
                     sideAlteration=lambda **kwargs: kwargs,
                     kinematicType='ik'):
        '''
        Overriden to handle if a custom curve was given, which then needs to be duplicated, mirrored and
        fed directly into the splineTwist.
        '''

        kwargs = cls.readKwargs(card,
                                isMirroredSide,
                                sideAlteration,
                                kinematicType='ik')
        if isMirroredSide:
            if 'curve' in kwargs:
                crv = kwargs['curve']
                crv = duplicate(crv)[0]
                kwargs['curve'] = crv
                move(crv.sp, [0, 0, 0], a=True)
                move(crv.rp, [0, 0, 0], a=True)
                crv.sx.set(-1)

                kwargs['duplicateCurve'] = False

        return kwargs
コード例 #37
0
def maketext(t=u"temptext",name = u"temptext", p=[0,0,0], r=[0,0,0], s=0.1) :
    t = str(t)
    obj = pm.textCurves(n = name, t=t, f ='Courier')
    pm.move(obj[0], p[0],p[1],p[2])
    pm.rotate(obj[0],r[0],r[1],r[2])
    pm.scale(obj[0],s,s,s)
    return obj[0]
コード例 #38
0
    def test_simple(self):
        source_cube = self.create_cube()
        target_cube = self.create_cube()
        source_joints = [self.create_joint() for _ in range(5)]
        [pm.move(j, (0.1, 0.1, 0.1)) for j in source_joints]
        source_skincl = skinutils.bind_mesh_to_joints(source_cube,
                                                      source_joints)
        expected = [
            pm.skinPercent(source_skincl, v, value=True, q=True)
            for v in source_cube.vtx
        ]
        pm.select(clear=True)
        target_joints = [self.create_joint() for _ in range(5)]
        [pm.move(j, (0.1, 0.1, 0.1)) for j in target_joints]
        target_skincl = skinutils.bind_mesh_to_joints(target_cube,
                                                      target_joints)
        pm.skinPercent(target_skincl,
                       target_cube.vtx,
                       transformValue=(target_joints[-1], 1.0))
        skinutils.copy_weights(source_cube, target_cube)
        result = [
            pm.skinPercent(source_skincl, v, value=True, q=True)
            for v in source_cube.vtx
        ]

        for e, r in zip(expected, result):
            [
                self.assertAlmostEqual(expected_weight, result_weight)
                for expected_weight, result_weight in zip(e, r)
            ]
コード例 #39
0
 def run(self):
     selected = pm.ls(sl=1)
     if not selected:
         self.fail_check(u"先手动选中模型大组")
         return
     # get all xforms
     top_node = pm.ls(sl=1)[0]
     hierarchy_xfroms = top_node.getChildren(allDescendents=True,
                                             type="transform")
     hierarchy_xfroms.append(top_node)
     # freeze directly
     locked_attr_list = []
     for xform in hierarchy_xfroms:
         pm.move(0, 0, 0, [xform + '.scalePivot', xform + '.rotatePivot'])
         # check locked attrs
         base_attributes = [
             'tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'
         ]
         for attr in base_attributes:
             if xform.getAttr(attr, lock=True):
                 locked_attr_name = "%s.%s" % (xform, attr)
                 locked_attr_node = pm.PyNode(locked_attr_name)
                 locked_attr_node.unlock()
                 locked_attr_list.append(locked_attr_node)
         # freeze them
         try:
             pm.makeIdentity(xform,
                             apply=True,
                             translate=True,
                             rotate=True,
                             scale=True,
                             n=0,
                             pn=1)
         except RuntimeError, e:
             self.error_list.append(xform.longName())
コード例 #40
0
ファイル: modeling.py プロジェクト: rBrenick/b-tools
    def toggle_pivot_positions(obj_list):
        last_obj = obj_list[-1]  # selects last obj of list
        pivot = pm.xform(last_obj, q=True, rp=True, ws=True)

        state = next_pivot_state(
            last_obj)  # Gets the next state for last selected obj

        for obj in obj_list:
            bbox = pm.xform(obj, q=True, ws=True, bb=True)
            center = [(bbox[0] + bbox[3]) / 2, (bbox[1] + bbox[4]) / 2,
                      (bbox[2] + bbox[5]) / 2]
            bottom = [(bbox[0] + bbox[3]) / 2, bbox[1],
                      (bbox[2] + bbox[5]) / 2]

            for i in range(0, 3):
                pivot[i] = round(pivot[i], 4)
                center[i] = round(center[i], 4)
                bottom[i] = round(bottom[i], 4)

            # Setting the pivot to match whatever state the last selected obj has
            if state == "origo":
                new_sel = pm.ls(obj)
                pm.move(0,
                        0,
                        0, (new_sel[0] + ".scalePivot"),
                        (new_sel[0] + ".rotatePivot"),
                        absolute=True)  # Sets pivot to origo
            if state == "bottom":
                pm.xform(obj, piv=bottom, ws=True,
                         absolute=True)  # Sets pivot to bottom of Bounding Box
            if state == "center":
                pm.xform(obj, piv=center, ws=True,
                         absolute=True)  # Sets pivot to center

            pm.select(obj_list)
コード例 #41
0
def CurveLoft(crv, geom, size, norDir, nm):
    try:
        crvSh = crv.listRelatives(s=1, type='nurbsCurve')[0]
    except:
        pm.warning('%s is not nurbsCurve')
        return
    tmpOC = pm.createNode('nearestPointOnCurve', n='TmpOC')
    crv.ws >> tmpOC.inputCurve
    copyCrvA = crv.duplicate(n='%sCopyACrv' % crv.name().replace('Crv', ''))[0]
    copyCrvB = crv.duplicate(n='%sCopyBCrv' % crv.name().replace('Crv', ''))[0]
    cvSz = int(crv.spans.get())
    if crv.d.get() == 3: cvSz = cvSz + 3
    upvec = dt.Vector(int(norDir[0]), int(norDir[1]), int(norDir[2]))
    for i in xrange(cvSz):
        tmpOC.inPosition.set(crv.cv[i].getPosition(space='world'))
        tVec = pm.pointOnCurve(crv, pr=tmpOC.parameter.get(), nt=1)
        cVecA = dt.cross(upvec, dt.Vector(tVec))
        cVecB = dt.cross(dt.Vector(tVec), upvec)
        pm.move(copyCrvA.cv[i], cVecA * size, r=1)
        pm.move(copyCrvB.cv[i], cVecB * size, r=1)
    geo = pm.loft(copyCrvB,
                  copyCrvA,
                  ch=1,
                  u=1,
                  c=0,
                  ar=1,
                  d=3,
                  ss=1,
                  rn=0,
                  po=int(geom),
                  rsn=1)
    mel.eval('DeleteHistory %s' % geo[0].name())
    pm.delete(tmpOC, copyCrvA, copyCrvB)
    return geo[0]
コード例 #42
0
ファイル: joint.py プロジェクト: dayelov/DevPyLib
    def makeInnerTwistJoints(self, prefix, startJnt, endJnt, nTwistJoint=3, rotAxis='X'):
        """
        Add Twist Joint for selected Joint
        :param joint_selection:
        :param nTwistJoint:
        :return:
        """
        distance = util.get_distance(startJnt, endJnt) / (nTwistJoint + 1)

        joint_list = []
        for i in range(0, nTwistJoint):
            # Create new twist Joint
            joint_name = prefix + '_twistJ' + str(i + 1) + 'JNT'
            new_joint = pm.joint(n=joint_name)
            pm.delete(pm.parentConstraint(startJnt, new_joint))
            common.freezeTranform(new_joint)
            pm.parent(new_joint, startJnt)

            direction = jointDirection(startJnt)
            pm.move((i + 1) * distance * direction, 0, 0, new_joint, relative=True, localSpace=True)

            # connect to mulDoubleLinear node
            multiplyNode = pm.shadingNode('multDoubleLinear', asUtility=True)
            pm.connectAttr(startJnt.name()+'.rotate'+rotAxis, multiplyNode.input1, f=True)
            pm.connectAttr(multiplyNode.output, new_joint.name()+'.rotate'+rotAxis)
            weight = (1.0 / (nTwistJoint + 1.0)) * (i + 1)
            multiplyNode.input2.set(weight)

            # ovveride joint color
            new_joint.ove.set(1)
            new_joint.ovc.set(13)

            joint_list.append(new_joint)

        return joint_list
コード例 #43
0
ファイル: bdRigUtils.py プロジェクト: Mortaciunea/bdScripts
def setShape(shape,shapeInfo):
    cvPos = shapeInfo['cvsPos']
    for i in range(len(cvPos)):
        pm.move(shape.name() + '.cv[' + str(i) + ']',cvPos[i][0],cvPos[i][1],cvPos[i][2],a=1,ws=1,)
        
    #shape.setCVs(cvPos,space='world')
    #shape.updateCurve()
コード例 #44
0
def setupBakeScene(objs=None) :
	selected = cmds.ls(sl=True)
	if objs == None :
		objs = selected
	cmds.select(objs, hi=True)
	objs = cmds.ls(sl=True, type='mesh')

	# convert to uvMesh
	out = []
	for o in objs :
		cmds.select(o, r=True)
		out.append(createMeshFromUV())
	# assign shader
	cmds.select(out)	
	assignBakeShader()

	# create camera
	cam = createBakeCamera()

	g = pm.group(em=True, name='mzBake2dGroup')
	for o in out :
		pm.parent(o, g)
	pm.parent(cam, g)

	min, max = getSceneBound()
	print(min, max)
	offsetmin = max[0]
	if max[2] < offsetmin :
		offsetmin = max[2]
	pm.move(g, max[0]+1, 0, max[2]+1)
コード例 #45
0
def create_boundingBoxCtrl(transform):
    """
	Usage:
		create_boundingBoxCtrl( pm.ls(sl=True)[0] )
	"""
    base_name = transform.name().replace("_GEO", "") + "Own"

    bbox = pm.exactWorldBoundingBox(transform, ii=True, ce=True)
    centerX = (bbox[0] + bbox[3]) / 2.0
    centerY = (bbox[1] + bbox[4]) / 2.0
    centerZ = (bbox[2] + bbox[5]) / 2.0
    center_point = (centerX, centerY, centerZ)

    p0 = (bbox[0], bbox[1], bbox[2])
    p1 = (bbox[0], bbox[1], bbox[5])
    p2 = (bbox[0], bbox[4], bbox[2])
    p3 = (bbox[0], bbox[4], bbox[5])
    p4 = (bbox[3], bbox[4], bbox[2])
    p5 = (bbox[3], bbox[4], bbox[5])
    p6 = (bbox[3], bbox[1], bbox[2])
    p7 = (bbox[3], bbox[1], bbox[5])

    points = [p0, p1, p2, p3, p4, p5, p6, p7]
    path_ids = [1, 3, 5, 7, 1, 0, 2, 3, 5, 4, 6, 7, 6, 0, 2, 4]
    path_values = []

    for path_id in path_ids:
        path_values.append(points[path_id])

    curve = pm.curve(p=path_values, n=(base_name + "_CTRL"), d=1)
    curve.rotatePivot.set(center_point)
    curve.scalePivot.set(center_point)
    pm.move(curve, [0, 0, 0], rpr=True)
    pm.makeIdentity(curve, apply=True, n=0, t=True, r=True, s=True)
    con_grp = pm.group(n=base_name + "Con_GRP", em=True)
    con_grp.setParent(curve)
    grp = pm.group(n=base_name + "Offset_GRP", em=True)
    pm.move(grp, center_point, rpr=True)
    curve.setParent(grp, a=True)
    curve.translate.set([0, 0, 0])

    short_name = pm.ls(curve.name(), sn=True)[0].name()
    color = None
    left_color = [6, 15, 29, 28, 18, 27]
    right_color = [13, 12, 31, 4, 30, 21]
    middle_color = [23, 11, 10, 25, 24, 7]
    random_color = random.randint(0, 5)

    if short_name[0] == "l":
        color = left_color[random_color]
    elif short_name[0] == "r":
        color = right_color[random_color]
    else:
        color = middle_color[random_color]
    curve.getShape().overrideEnabled.set(1)
    curve.getShape().overrideColor.set(color)

    return grp
コード例 #46
0
def moveShape(sel, movX = False, movY = False, movZ = False, move = 2):
    pm.select(clear = True)
    shapList = (pm.listRelatives(sel, shapes = True))
    for s in shapList:
        cvs = s.cv
        pm.select(cvs, add = True)
    
    pm.move(move, move, move,moveX = movX, moveY = movY, moveZ = movZ, relative = True,objectSpace = True, worldSpaceDistance  = True )
    pm.select(sel)
コード例 #47
0
ファイル: GeneralUtils.py プロジェクト: jspatrick/beings
def centerCrv(ctl, obj1, obj2, amt=.5):
    """Move a control's shape between two other objects (typically joints).
    Control is moved relative to it's starting point, and is moved along
    the vector from object 1 to object 2."""
    ctl = pm.PyNode(ctl)
    obj1 = pm.PyNode(obj1)
    obj2 = pm.PyNode(obj2)
    numCvs = ctl.numCVs()
    newPosVector = (pm.datatypes.Vector((pm.xform(obj2, q=1, t=1, ws=1)) - pm.datatypes.Vector(pm.xform(obj1, q=1, t=1, ws=1))) * amt)
    pm.move(ctl.cv[0:numCvs - 1], newPosVector, r=True, ws=True)
コード例 #48
0
ファイル: utils.py プロジェクト: Mortaciunea/yart
def buildCircleController(target,ctrlName,scale=1):
    pm.select(cl=1)
    ctrl = pm.circle(name = ctrlName,c=[0,0,0],nr=[0,1,0],ch=0,radius=scale)[0]
    ctrlGrp = pm.group(ctrl,n=str(ctrlName + '_grp'))
    pm.select(cl=1)
    
    targetPos = pm.xform(target,q=True,ws=True,t=True)
    pm.move(ctrlGrp,targetPos[0],targetPos[1],targetPos[2])
    
    return ctrl,ctrlGrp
コード例 #49
0
ファイル: __init__.py プロジェクト: loichuss/maya
def __mirrorShapes__(elts, across='x', direction='L_'):
    if elts==None:
        # get each element inside CONTROL
        if pmc.objExists('CONTROLS'):
            elts = pmc.sets('CONTROLS', query=True)
            i=0
            while i<len(elts):
                if pmc.objectType(elts[i]) == 'objectSet':
                    elts.extend(pmc.sets(elts[i], query=True))
                    elts.pop(i)
                    i -= 1
                i += 1
            
            # delete element at center meaning without L_ or R_
            
            for i in reversed(range(len(elts))):
                if (elts[i].name().startswith(direction)==False):
                    elts.pop(i)
        else:
            vp.vPrint('No CONTROLS set funded', 1)
            
    else:
        # delete element at center meaning without L_ or R_
        for i in reversed(range(len(elts))):
            if (elts[i].name().startswith('L_')==False) and (elts[i].name().startswith('R_')==False):
                elts.pop(i)
    
    # creating the vector inverse depending on the across variable
    if across=='x':
        vectInverse = [-1,1,1]
    if across=='y':
        vectInverse = [1,-1,1]
    if across=='z':
        vectInverse = [1,1,-1]
    
    # loop into each element
    for elt in elts:
        # finding the opposite transform
        if elt.startswith('L_'):
            eltInv = various.checkObj( elt.name().replace('L_', 'R_'), type=['transform', 'joint'] )
        else:
            eltInv = various.checkObj( elt.name().replace('R_', 'L_'), type=['transform', 'joint'] )
        
        if eltInv:
            # getting atoms from both element
            atoms    = various.getAtoms(elt,    flat=False)
            atomsInv = various.getAtoms(eltInv, flat=False)
            # finding the smallest object just in case one has less atoms than the other
            if len(atoms) > len(atomsInv):
                size = len(atomsInv)
            else:
                size = len(atoms)
            # working on each atoms
            for i in range(size):
                pmc.move(atomsInv[i], atoms[i].getPosition(space='world')*vectInverse, absolute=True)
コード例 #50
0
def cbsTrans(*args, **kwargs):
    
    sculptTrans = kwargs.setdefault('sculptTrans', pm.ls(sl=True)[0])# (string) The mesh to get the tweak edits extracted from
    shape = kwargs.setdefault('shape') # (string) The shape node of the sculptTrans node
    tweak = kwargs.setdefault('tweak') # (string) The tweak node that is going to be cleared
    skin = kwargs.setdefault('skin') # (string) The skinCluster node that drives the base mesh
    base = kwargs.setdefault('base') # (string) The base mesh for the character

    #get some info
    sculptTrans, shape, tweak, skin =  gatherInfo(sculptTrans, shape, tweak, skin)
    if not 'baseTransform' in pm.listAttr(sculptTrans, ud=True):
        pm.error('This model has not been prepared for sculpting. If you accidentally started, simply run Clear Tweaks to extract what has been done')
    if not base:
        base = sculptTrans.baseTransform.get()

    baseRef = sculptTrans.baseReference.get()

    #turn off a couple things that might mess with things
    pm.symmetricModelling(e=True, symmetry= False)
    pm.softSelect(e=True, softSelectEnabled=False)

    #first, let's unlock the guys from the old function
    pm.lockNode(base, l=False)
    pm.lockNode(sculptTrans, l=False)
    pm.setAttr('%s.v'%base, True)

    #extract from the sculpted shape
    newShape = clearTweaks(base=base, tweak=tweak)

    pm.delete(sculptTrans)

    newOrig = pm.duplicate(base, n='%s_editReference'%base)[0]
    pm.connectAttr(('%s.outMesh' %newOrig.getShapes()[1]), ('%s.inMesh' %newOrig.getShape()))

    pm.select(cl=True)
    deviation = False
    for v in range(pm.polyEvaluate(base, v=True)):
        refPos = pm.xform('%s.vtx[%i]'%(baseRef, v), q=True, t=True)
        adjPos = pm.xform('%s.vtx[%i]'%(newOrig, v), q=True, t=True)

        if not refPos == adjPos:
            deviation=True
            pm.move('%s.vtx[%i]' %(newShape, v), (refPos[0]-adjPos[0], refPos[1]-adjPos[1], refPos[2]-adjPos[2]), r=True)
            pm.move('%s.vtx[%i]'%(base, v), (refPos[0]-adjPos[0], refPos[1]-adjPos[1], refPos[2]-adjPos[2]), os=True, r=True)
            pm.select('%s.vtx[%i]' %(base, v), add=True)

    if deviation:
        pm.warning('It appears there were issues extracting from the mesh, steps have been taken to try and remedy, but unexpected results may occur')

    #apply a texture to the new shape.
    pm.select(newShape, r=True)
    pm.sets('initialShadingGroup', e=True, forceElement=True)

    pm.delete(newOrig, baseRef)
    return newShape
コード例 #51
0
 def snapPivot(self):
     haircap = self.capName.getText()
     oldSel = pm.selected()
     self.transform()
     if pm.objExists(haircap):
         geo = pm.ls(haircap)[0]
         for sel in pm.selected():
             point = geo.getClosestPoint(sel.getTranslation())
             pm.move( point[0][0], point[0][1], point[0][2], sel)
         pm.select(oldSel)
     else: pm.error('hair cap doesnt exist in scene')
コード例 #52
0
ファイル: mkUtils.py プロジェクト: atvKumar/mkUtils
def groundObjectY(src, dest=None):
    """ Moves Object in Y to 0 if objB not specified. Else MaxY """
    offset = 0
    if isinstance(dest, pm.nodetypes.Transform):
        offset = dest.boundingBox()[1][1]
    if isinstance(src, pm.nodetypes.Transform):  # Parent Node, or raise error
        bbox = src.boundingBox()
        if bbox[0][1] < 0:
            pm.move(abs(bbox[0][1]) + offset, src, y=True, r=True)
        else:
            pm.move(-bbox[0][1] + offset, src, y=True, r=True)
コード例 #53
0
    def test_assertAimingAt(self):
        a = pm.group(empty=1)
        b = pm.group(empty=1)
        pm.move(3, 3, 3, b, a=1)

        self.assertFalse(transforms.assertAimingAt(a, b, "x"))
        pm.aimConstraint(b, a)
        self.assertFalse(transforms.assertAimingAt(a, b, "y"))
        self.assertFalse(transforms.assertAimingAt(a, b, "z"))

        self.assertTrue(transforms.assertAimingAt(a, b, "x"))
コード例 #54
0
def snap_object(transforms, target_mesh_transform):
    """ Helper function that overlays locators onto selection
    Args:
        transforms [pm.nt.Transform]: a transform with a nurbsCurve shape node under it
        target_mesh_transform (pm.nt.Transform): target mesh to query positions
    Returns: None
    Usage:
        snap_object(pm.ls(sl=True, fl=True)[:-1], pm.ls(sl=True)[-1])
    """
    point_data = lib_cp.get_closest_point_sets(transforms, target_mesh_transform)
    for transform in point_data:
        pm.move (transform, point_data[transform]['position'], rpr=True)
コード例 #55
0
ファイル: definitions.py プロジェクト: coxevan/SplashBoard
def reference_plane(flip, **kwargs):
    """
    Creates reference planes based on kwargs and boolean "flip"

    If height of image is greater than or equal to 700, scaleFactor of 0.25 is applied.

    Kwargs -
        axis - (1, 2, 3) for (X, Y, Z)
        dict - image dictionary
        term - search term
        width - image width
        height - image height
        scaleFactor - 1*
        
    Returns reference plane
    """
    fallback_dict = {'path': "", "width": 0, "height": 0}
    radio = kwargs.setdefault('axis')
    image_dict = kwargs.setdefault('dict', fallback_dict)
    name = kwargs.setdefault('term')+'_reference'
    path = kwargs.setdefault('path', image_dict['path'])
    material = create_material(path)
    scale_factor = kwargs.setdefault('scaleFactor', 1)

    dict_width = float(image_dict['width'])
    dict_height = float(image_dict['height'])

    width = kwargs.setdefault('width', dict_width)
    height = kwargs.setdefault('height', dict_height)
    print height
    if height >= 700:
        scale_factor = 0.25

    width *= scale_factor
    height *= scale_factor

    if radio is 3:
        plane = py.polyPlane(n=name, ax=(0, 0, 1), w=width, h=height, sx=1, sy=1)[0]
        py.move(0, (0.5*height), 0, plane)
        py.xform(plane, piv=(0, -0.5*height, 0))
    elif radio is 2:
        plane = py.polyPlane(n=name, ax=(0, 1, 0), w=width, h=height, sx=1, sy=1)[0]
    else:
        plane = py.polyPlane(n=name, ax=(1, 0, 0), w=width, h=height, sx=1, sy=1)[0]
        py.move(0, (0.5*height), 0, plane)
        py.xform(plane, piv=(0, -0.5*height, 0))
    if flip is True:
        py.setAttr(plane+'.scaleZ', -1)
    apply_material(plane, material, freeze=True)
    reference_layer(plane)

    return plane
コード例 #56
0
ファイル: spineModule.py プロジェクト: RyugasakiHu/AT_Rigging
    def __bodyCtrl(self):
         
        self.bodyCtrl = control.Control(self.side,self.baseName + 'Main',size = self.bodySize * 1.25,aimAxis = self.ctrlAxis) 
        self.bodyCtrl.circleCtrl()
        
        #move the target object
#         midPos = self.fkGuides[(self.segment - 1) / 2].getTranslation(space = 'world')
#         pm.move(midPos[0],midPos[1],midPos[2] - self.length / 1.5,self.bodyCtrl.controlGrp,a=True)
        
        endPos = self.fkGuides[0].getTranslation(space = 'world')
        pm.move(endPos[0],endPos[1],endPos[2],self.bodyCtrl.controlGrp,a=True)
        
        #lock and hide
        control.lockAndHideAttr(self.bodyCtrl.control,['sx','sy','sz','v'])
        
        #add attr
        control.addFloatAttr(self.bodyCtrl.control,['volume'],0,1)
        control.addFloatAttr(self.bodyCtrl.control,['ik_vis'],0,1)
        self.bodyCtrl.control.ik_vis.set(1)
        
        #bend
        pm.addAttr(self.bodyCtrl.control,ln = '______',at = 'enum',en = '0')
        pm.setAttr(self.bodyCtrl.control + '.______',e = 1,channelBox = 1)
        control.addFloatAttr(self.bodyCtrl.control,
                             ['bend_up','bend_mid','bend_lo'],-3600,3600)

        pm.addAttr(self.bodyCtrl.control,ln = '_______',at = 'enum',en = '0')
        pm.setAttr(self.bodyCtrl.control + '._______',e = 1,channelBox = 1)
        control.addFloatAttr(self.bodyCtrl.control,
                             ['bend_up_rev','bend_mid_rev','bend_lo_rev'],-3600,3600)
        
        #side
        pm.addAttr(self.bodyCtrl.control,ln = '__________',at = 'enum',en = '0')
        pm.setAttr(self.bodyCtrl.control + '.__________',e = 1,channelBox = 1)
        control.addFloatAttr(self.bodyCtrl.control,
                             ['side_up','side_mid','side_lo'],-3600,3600)

        pm.addAttr(self.bodyCtrl.control,ln = '___________',at = 'enum',en = '0')
        pm.setAttr(self.bodyCtrl.control + '.___________',e = 1,channelBox = 1)
        control.addFloatAttr(self.bodyCtrl.control,
                             ['side_up_rev','side_mid_rev','side_lo_rev'],-3600,3600)               
        
        #twist
        pm.addAttr(self.bodyCtrl.control,ln = '________',at = 'enum',en = '0')
        pm.setAttr(self.bodyCtrl.control + '.________',e = 1,channelBox = 1)
        control.addFloatAttr(self.bodyCtrl.control,
                             ['twist_up','twist_mid','twist_lo'],-3600,3600)

        pm.addAttr(self.bodyCtrl.control,ln = '_________',at = 'enum',en = '0')
        pm.setAttr(self.bodyCtrl.control + '._________',e = 1,channelBox = 1)
        control.addFloatAttr(self.bodyCtrl.control,
                             ['twist_up_rev','twist_mid_rev','twist_lo_rev'],-3600,3600)                 
コード例 #57
0
 def randomize(self, list, transRot):
     list = pm.ls(list, fl = True)
     rt = self.randSliderT.getValue()
     rr = self.randSliderR.getValue()
     for x in list:
         if transRot == 2 or transRot == 0:
             pm.move(str(x), random.uniform(-rt*self.TXCheckBox.getValue(),rt*self.TXCheckBox.getValue()), \
             random.uniform(-rt*self.TYCheckBox.getValue(),rt*self.TYCheckBox.getValue()), \
             random.uniform(-rt*self.TZCheckBox.getValue(),rt*self.TZCheckBox.getValue()),  relative = True)
         if transRot == 2 or transRot == 1:
             pm.rotate(str(x), [random.uniform(-rr*self.RXCheckBox.getValue(),rr*self.RXCheckBox.getValue()),\
              +random.uniform(-rr*self.RYCheckBox.getValue(),rr*self.RYCheckBox.getValue()),\
               +random.uniform(-rr*self.RZCheckBox.getValue(),rr*self.RZCheckBox.getValue())], relative = True )
コード例 #58
0
ファイル: __init__.py プロジェクト: loichuss/maya
def positionShape(shape, position, offset=[0,0,0]):
    # check the type of position
    if (isinstance(position, dt.Vector))==False:
        if (isinstance(position, list))==False:
            obj = various.checkObj(position, type=['transform', 'joint'])
            if obj:
                position = obj.getTranslation(space='world')
        else:
            position = dt.Vector(position)
    
    # get difference between the parent of the shape and the global position
    move = position - pmc.PyNode(shape).getParent().getTranslation(space='world')
    for vert in various.getAtoms(shape, flat=True):
        pmc.move(vert, move, relative=True)
コード例 #59
0
ファイル: hierarchy.py プロジェクト: RyugasakiHu/AT_Rigging
 def build(self):
     
     self.visGuides[0].v.set(0)
     
     #vis cc
     self.visGuidePos = [x.getTranslation(space = 'world') for x in self.visGuides]
     self.visCtrl = control.Control(self.side,'visibility',self.size) 
     self.visCtrl.visCtrl()
     pm.move(self.visCtrl.controlGrp,self.visGuidePos[0])
     control.addFloatAttr(self.visCtrl.control,
                          ['spine_fk_vis','finger_ctrl_vis','facial_mouth_sec_vis','facial_panel'],0,1)
     pm.setAttr(self.visCtrl.control.spine_fk_vis,e = 1,cb = True)
     pm.setAttr(self.visCtrl.control.finger_ctrl_vis,e = 1,cb = True)
     pm.setAttr(self.visCtrl.control.facial_mouth_sec_vis,e = 1,cb = True)
     pm.setAttr(self.visCtrl.control.facial_panel,e = 1,cb = True)
     
     #build grp
     self.ALL = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'ALL')) 
     self.TRS = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'TRS')) 
     self.PP = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'PP')) 
     self.SKL = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'SKL')) 
     self.CC = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'CC')) 
     self.IK = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'IK')) 
     self.LOC = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'LOC')) 
     self.GEO = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'GEO')) 
     self.XTR = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'XTR')) 
     self.CSG = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'CSG'))
     self.GUD = pm.group(empty = 1,n = nameUtils.getHierachyName(self.characterName,'GUD'))
     
     #set ctrl
     #set cog
     self.cogCtrl = control.Control(side = 'm',baseName = self.characterName ,size = self.size,aimAxis = 'y')
     self.cogCtrl.circleCtrl()
     self.cogCtrl.controlGrp.setParent(self.ALL)        
     
     #set grp 
     self.TRS.setParent(self.cogCtrl.control)
     self.PP.setParent(self.TRS)
     self.CSG.setParent(self.TRS)
     self.SKL.setParent(self.PP)
     self.CC.setParent(self.PP)
     self.IK.setParent(self.PP)
     self.LOC.setParent(self.PP)
     self.GEO.setParent(self.ALL)
     self.XTR.setParent(self.ALL)
     self.GUD.setParent(self.ALL)
     
     #clean up
     self.__cleanUp()