Exemple #1
0
def SpiralOfPoints(initRadius,endRadius,turns,numberOfPoints):
	loc1 = cmds.spaceLocator()
	loc2 = cmds.spaceLocator()
	cmds.parent (loc2[0],loc1[0])
	cmds.setAttr(loc2[0]+".translateX",float(initRadius))
	groupPoints=cmds.group(empty=True)
	degreeTurns = float(turns * 360)
	degreeStep = float(degreeTurns)/ (numberOfPoints-1)
	posStep = (float(initRadius) - float(endRadius)) / (numberOfPoints-1)

	spcLocArray=[]
	startRot=0.0
	startPos = float(initRadius)
	for point in range(0,numberOfPoints):
		NewLoc = cmds.spaceLocator()
		spcLocArray.append(NewLoc[0])
		RMRigTools.RMAlign(loc2[0] , spcLocArray[point] ,3)
		startPos += (-posStep)
		cmds.setAttr (loc2[0] + ".translateX" ,startPos)
		startRot += degreeStep
		cmds.setAttr (loc1[0] + ".rotateZ" ,startRot)
		cmds.parent ( NewLoc,groupPoints)
	jointArray = mel.eval( '''source "RMRigTools.mel";\nsource "RMRigShapeControls.mel";\n
	RMCreateBonesAtPoints( ''' + melstringArray(spcLocArray) + ''');''')
	control = mel.eval('''RMCreaControl("'''+spcLocArray[0] + '''",'''+ str(float(endRadius)) + ''');''')
	cmds.addAttr(control, longName = "unfold", keyable = True, hasMinValue = True, hasMaxValue = True, maxValue = 10, minValue = 0)

	unfoldStep = 10.0 / numberOfPoints
	currentStep = 0.0

	for joints in jointArray:
		currentrot = cmds.joint(joints,q=True,orientation=True)
		RMRigTools.connectWithLimits(control+".unfold",joints + ".rotateZ",[[currentStep,0],[currentStep + unfoldStep,abs(currentrot[2])]])
		currentStep = currentStep + unfoldStep
Exemple #2
0
def getAngle(radius, joint1,joint2):
	segmentLen01 = RMRigTools.RMLenghtOfBone(joint1)
	
	if joint2:
		segmentLen02 = RMRigTools.RMLenghtOfBone(joint2)
	else:
		segmentLen02 = segmentLen01

	alpha = SegmentAngleInCircle(radius,segmentLen01)
	beta  = SegmentAngleInCircle(radius,segmentLen02)
	return 180 - DeltaBetweenAngles(alpha,beta)
Exemple #3
0
def SinglePropRig(Object, referencePositionControl):
    # if Object.__class__ == list :
    # elif Object.__class__ in [str,unicode]:
    GRS = RMGenericRigStructure.genericRigStructure()

    NameConv = nameConvention.NameConvention()
    bbMesh = RMRigTools.boundingBoxInfo(Object)
    CtrlPosition = cmds.xform(referencePositionControl, q=True, rp=True, worldSpace=True)
    NameList = Object.split(".")
    cntrlToMeshX = bbMesh.position[0] - CtrlPosition[0]
    cntrlToMeshY = bbMesh.position[1] - CtrlPosition[1]
    cntrlToMeshZ = bbMesh.position[2] - CtrlPosition[2]

    if len(NameList) > 1:
        Ctrl = RMRigShapeControls.RMCreateCubeLine(bbMesh.lenX, bbMesh.lenY, bbMesh.lenZ,
                                                   offsetX=-bbMesh.minDistanceToCenterX + cntrlToMeshX,
                                                   offsetY=-bbMesh.minDistanceToCenterY + bbMesh.lenY / 2 + cntrlToMeshY,
                                                   offsetZ=-bbMesh.minDistanceToCenterZ + bbMesh.lenZ / 2 + cntrlToMeshZ,
                                                   name=NameList[1])
        joint = cmds.joint(name=NameList[1] + "jnt")
    else:
        Ctrl = RMRigShapeControls.RMCreateCubeLine(bbMesh.lenX, bbMesh.lenY, bbMesh.lenZ,
                                                   offsetX=-bbMesh.minDistanceToCenterX + cntrlToMeshX,
                                                   offsetY=-bbMesh.minDistanceToCenterY + bbMesh.lenY / 2 + cntrlToMeshY,
                                                   offsetZ=-bbMesh.minDistanceToCenterZ + bbMesh.lenZ / 2 + cntrlToMeshZ,
                                                   name=NameList[0] + "Ctrl")
        joint = cmds.joint(name=NameList[0] + "jnt")

    Ctrl = NameConv.rename_name_in_format(Ctrl, {'objectType': "control"})
    ResetGroup = RMRigTools.RMCreateGroupOnObj(Ctrl)
    cmds.parent(ResetGroup, GRS.groups["controls"]["group"])
    rigJntGrp = cmds.ls("*SimpleRigJoints*")
    if len(rigJntGrp) == 0:
        jointGroup = cmds.group(empty=True, name="SimpleRigJoints")
        jointGroup = NameConv.rename_name_in_format(jointGroup, {})
        cmds.parent(jointGroup, GRS.groups["rig"]['group'])
    else:
        jointGroup = rigJntGrp
    RMRigTools.RMAlign(referencePositionControl, ResetGroup, 3)

    joint = NameConv.rename_name_in_format(joint, {})

    RMRigTools.RMAlign(referencePositionControl, joint, 3)
    ResetJoint = RMRigTools.RMCreateGroupOnObj(joint)
    cmds.parent(ResetJoint, jointGroup)
    # if cmds.objExists
    # for eachObject in Object:
    cmds.select(clear=True)
    cmds.select(Object)
    cmds.select(joint, add=True)
    cmds.skinCluster()
    cmds.parentConstraint(Ctrl, joint)
Exemple #4
0
def addNoiseOnControl(Object, Control):
    if Object.__class__ == list:
        pass

    elif Object.__class__ in [str, unicode]:
        Object = [Object]

    else:
        "Not Valid Arguments on Add Noise"
        return None

    Expresion = '''//{0}
    {0}.rotateX=`noise((time+{2})*{1}.frequency)`*{1}.amplitud;
    {0}.rotateY=`noise((time+{2}+30)*{1}.frequency)`*{1}.amplitud;
    {0}.rotateZ=`noise((time+{2}+60)*{1}.frequency)`*{1}.amplitud;
    {0}.ty=`noise((time+{2}+90)*{1}.frequency)`*{1}.movY + {1}.movY;
    '''
    if not isNoiseControl(Control):
        addAttributes(Control)

    for eachObject in Object:
        constraints = constraintComponents(gessFrom=eachObject)
        ResetGroup = RMRigTools.RMCreateGroupOnObj(eachObject, Type="child")
        for eachkey in constraints.constraintDic:
            cmds.delete(eachkey)
            cmds.parentConstraint(ResetGroup, constraints.constraintDic[eachkey]["affected"], mo=True)
        ExpressionNode = cmds.expression(name="NoiseMainExpresion",
                                         string=Expresion.format(ResetGroup, Control, random.uniform(0, 100)))
Exemple #5
0
def SpiralOfPointsStraight(initRadius, endRadius, numberOfPoints, startPoint, endPoint):
	RigTools   = RMRigTools.RMRigTools()
	ShapeCntrl = RMRigShapeControls.RMRigShapeControls()
	distancia  = RMRigTools.RMPointDistance(startPoint,endPoint)
	minLength  = math.sin(math.pi  / (numberOfPoints + 1)) * initRadius #initRadiusdistancia/numberOfPoints/10
	
	print "minLength:%s" % minLength

	if minLength * numberOfPoints < distancia:
		#Locators = RigTools.RMCreateNLocatorsBetweenObjects( startPoint, endPoint, numberOfPoints )
		Locators = RigTools.RMCreateBiasedLocatorsBetweenObjects( startPoint, endPoint , numberOfPoints, minLength)
		Locators.insert(0,startPoint)
		Locators.insert(len(Locators),endPoint)
		parentJoint, jointArray = RigTools.RMCreateBonesAtPoints( Locators )
		resetPnt, control = ShapeCntrl.RMCircularControl(startPoint,radius = initRadius)
		cmds.addAttr (control, longName = "unfold", keyable = True, hasMinValue = True, hasMaxValue = True, maxValue = 10,minValue = -10)
		unfoldStep = 10.0 / float(numberOfPoints+1)
		currentStep = 10.0
		index = 0
		deltaRadius = (initRadius - endRadius) / numberOfPoints
		currentRadius = initRadius
		#jointArray.reverse()
		angle=20
		for joints in jointArray[:-1]:
			#angle = 180 - SegmentAngleInCircle(currentRadius, RMRigTools.lenght_of_bone(joints) )
			
			if index > 0:
				angle = getAngle (currentRadius ,joints,jointArray[index-1])
			else: 
				angle = getAngle (currentRadius ,joints,None)

			#angle = SpiralFunction (index, numberOfPoints, initRadius, endRadius, distancia)
			#angle = SpiralFunctionBiasedPoints (index, numberOfPoints, initRadius, endRadius, distancia, minLength)
			RMRigTools.connectWithLimits ( control + ".unfold", joints + ".rotateY", [[-currentStep, angle], [-(currentStep-unfoldStep), 0], [currentStep-unfoldStep, 0], [currentStep, -angle]])
			currentStep = currentStep - unfoldStep
			print currentRadius
			currentRadius = currentRadius - deltaRadius
			index+=1
Exemple #6
0
    def LinkAttributes(self, ControlBook):

        RMRigTools.RMConnectWithLimits(ControlBook + ".BookSpread", self.bendSpread + ".curvature", [[0, 0], [10, -60]])
        RMRigTools.RMConnectWithLimits(ControlBook + ".BookLeaf", self.flare + ".endFlareX",
                                       [[-10, -1], [0, 1], [10, 2]])
        RMRigTools.RMConnectWithLimits(ControlBook + ".BorderRefinementOut", self.flare2 + ".startFlareX",
                                       [[-10, -1], [0, 1], [10, 2]])
        RMRigTools.RMConnectWithLimits(ControlBook + ".BorderRefinementIn", self.flare2 + ".endFlareX",
                                       [[-10, -1], [0, 1], [10, 2]])
        RMRigTools.RMConnectWithLimits(ControlBook + ".OpenBend", self.bendOpen + ".curvature",
                                       [[-10, -180], [0, 0], [10, 180]])
        # RMRigTools.RMConnectWithLimits( ControlBook + ".OpenBend",            self.bendOpenOposit   + ".curvature",[[-10,-180],[0,0]] )
        RMRigTools.RMConnectWithLimits(ControlBook + ".OpenLength", self.bendHandleOpen + ".scale",
                                       [[-10, 0], [0, self.heightValue / 2], [10, self.heightValue]])
        RMRigTools.RMConnectWithLimits(ControlBook + ".OpenBendCounter", self.bendMidle + ".curvature",
                                       [[-10, -180], [0, 0], [10, 180]])
        RMRigTools.RMConnectWithLimits(ControlBook + ".OpenBendCounterOffset", self.bendHandleMiddle + ".translateY",
                                       [[-10, -self.heightValue / 2], [0, 0], [10, self.heightValue / 2]])
        RMRigTools.RMConnectWithLimits(ControlBook + ".OpenBendCounterLenght", self.bendHandleMiddle + ".scale",
                                       [[-10, 0], [0, self.heightValue / 2], [10, self.heightValue]])
Exemple #7
0
def deleteSimpleRig():
	constraint = cmds.listConnections(type="parentConstraint")
	if constraint and len(constraint) > 0:
		parentConst = constraint[0]
		wAlias = cmds.parentConstraint( parentConst, q=True, wal= True)
		control = cmds.parentConstraint( parentConst, q=True, tl= True)
		joint = cmds.listConnections ( "%s.constraintTranslateX" % (parentConst))
		skinList = cmds.listConnections (joint, type="skinCluster")
		if skinList and len(skinList) > 0:
			skinCluster = skinList[0]
			geolist = cmds.listConnections("%s.outputGeometry"%(skinCluster))
			cmds.delete(skinCluster)
			parentsJoint = cmds.listRelatives(joint,parent = True)
			parentsControl = cmds.listRelatives(control,parent = True)
			cmds.delete(parentsJoint[0])
			cmds.delete(parentsControl[0])
			for eachObject in geolist:
				RMRigTools.RMLockAndHideAttributes(geolist,"1111111111")
		else:
			print "no skin cluster Identified"
	else:
		print "no constraint Node Identified"
Exemple #8
0
import maya.cmds as cmds
import RMRigTools
selection = cmds.ls(selection=True)
print selection
for i in selection:
    Children = RMRigTools.RMRemoveChildren(i)
    cmds.rotate(0, 180, 0, i, r=True, os=True)
    if Children:
        RMRigTools.RMParentArray(i, Children)
	def EyeLidsSetUp (self,EyeNode):

		Rigtools  = RMRigTools.RMRigTools()
		EyeNodeBB = RMRigTools.boundingBoxInfo(EyeNode)
		eyeRadius = (EyeNodeBB.zmax - EyeNodeBB.zmin)/2

		#eyeScale = cmds.getAttr("%s.scale"%EyeNode) [0]
		#cmds.setAttr ( EyeNode + ".scale", 1.0, 1.0, 1.0)


		MainUpperLid = cmds.joint(name = "EyeUpperLid", rad = eyeRadius / 5)
		UpperLid     = cmds.joint(name = "EyeUpperLidTip" , rad = eyeRadius / 5)
		MainLowerLid = cmds.joint(name = "EyeLowerLid", rad = eyeRadius / 5)
		LowerLid     = cmds.joint(name = "EyeLowerLidTip" , rad = eyeRadius / 5)

		RMRigTools.RMAlign(EyeNode, MainUpperLid, 3)
		EyeParent     = Rigtools.RMCreateGroupOnObj ( MainUpperLid, Type = 'parent')
		EyeParent     = self.NameConv.RMRenameSetFromName( EyeParent,"EyeLidSpin", Token='Name')
		MainEye       = Rigtools.RMCreateGroupOnObj   ( EyeParent, Type = 'parent')
		MainEye       = self.NameConv.RMRenameSetFromName  ( MainEye, "Eye", Token='Name')
	
		upperLidParent  = Rigtools.RMCreateGroupOnObj( MainUpperLid )
		upperLidParent  = self.NameConv.RMRenameSetFromName (upperLidParent,"EyeUpperLidReset", Token='Name')

		cmds.parent( MainLowerLid, EyeParent)
		LowerLidParent  = Rigtools.RMCreateGroupOnObj( MainLowerLid )

		RMRigTools.RMAlign(EyeParent, LowerLid,3)

		MiddleMainUpperLid = cmds.joint( name = "EyeMiddleMainUpperLid", rad = eyeRadius / 5)
		MiddleUpperLid     = cmds.joint( name = "EyeMiddleUpperLidTip" , rad = eyeRadius / 5)
		MiddleMainLowerLid = cmds.joint( name = "EyeMiddleLowerLid", rad = eyeRadius / 5)
		MiddleLowerLid     = cmds.joint( name = "EyeMiddleLowerLidTip" , rad = eyeRadius / 5)

		RMRigTools.RMAlign(EyeParent, MiddleMainUpperLid,3)

		cmds.parent( MiddleMainUpperLid, upperLidParent )
		cmds.parent( MiddleMainLowerLid, LowerLidParent )
		
		cmds.setAttr("%s.translateX"%UpperLid      , eyeRadius)
		cmds.setAttr("%s.translateX"%LowerLid      , eyeRadius)
		cmds.setAttr("%s.translateX"%MiddleUpperLid, eyeRadius)
		cmds.setAttr("%s.translateX"%MiddleLowerLid, eyeRadius)

		mDUpper = cmds.shadingNode("multiplyDivide", asUtility = True, name = "EyeUpperMultDiv")

		cmds.connectAttr("%s.rotate"%MainUpperLid ,"%s.input1"%mDUpper)
		cmds.setAttr    ("%s.input2"%mDUpper, .5,.5,.5)
		cmds.connectAttr("%s.output"%mDUpper , "%s.rotate"%MiddleMainUpperLid)

		mDLower = cmds.shadingNode("multiplyDivide", asUtility = True, name = "EyeLowerMultDiv")
		cmds.connectAttr          ("%s.rotate"%MainLowerLid ,"%s.input1"%mDLower)
		cmds.setAttr              ("%s.input2"%mDLower      ,.5,.5,.5)
		cmds.connectAttr          ("%s.output"%mDLower      ,"%s.rotate"%MiddleMainLowerLid)

		#cmds.setAttr(EyeParent +".scale",eyeScale[0],eyeScale[1],eyeScale[2])
		cmds.setAttr("%s.rotateY"%MainEye,-90)
		cmds.select(EyeNode, replace=True)
		#latticeAttr, lattice, latticeBase = cmds.lattice(name = "EyeLattice", oc= True, dv = [2, 2, 2], ol =  2, ofd = (eyeRadius/3) )
		#latticeScale = cmds.getAttr(lattice+".scale")[0]
		

		#cmds.setAttr ( lattice + ".scale", float(latticeScale[0]) + float(eyeScale[0]), float(latticeScale[1]) + float(eyeScale[1]), float(latticeScale[2]) + float(eyeScale[2]))
		
		#renamingto NameConvention.
		if self.NameConv.RMIsNameInFormat(EyeNode):
			side = self.NameConv.RMGetFromName(EyeNode,Token="Side")
		else:
			side = "MD"
		#latticeAttr, lattice, latticeBase, 
		self.NameConv.RMRenameNameInFormat([mDUpper,mDLower, UpperLid, LowerLid, MiddleMainUpperLid,MiddleMainLowerLid],Side = side)
		self.NameConv.RMRenameSetFromName ([EyeParent, LowerLidParent, upperLidParent ] ,side, Token = "Side")
		MainEye  = self.NameConv.RMRenameSetFromName ( MainEye, side, Token = "Side")
		
		self.NameConv.RMRenameNameInFormat ([MiddleUpperLid, MiddleLowerLid] , Type = "sknjnt" , Side = side)
		MainLowerLid = self.NameConv.RMRenameNameInFormat ( MainLowerLid, Type = "sknjnt" , Side = side)
		MainUpperLid = self.NameConv.RMRenameNameInFormat ( MainUpperLid, Type = "sknjnt" , Side = side)
		
		if not cmds.objExists("Character_MD_EyesRig00_grp_rig"):
			EyesRig = self.NameConv.RMSetNameInFormat("EyesRig", Type = "grp", System = "rig")
			cmds.group(empty = True, name = EyesRig)
			RMRigTools.RMChangeRotateOrder(EyesRig,"xzy" )
			cmds.setAttr("%s.rotateY"%EyesRig,-90)
		else:
			EyesRig = "Character_MD_EyesRig00_grp_rig"

		cmds.parent( MainEye, EyesRig)
		cmds.makeIdentity(MainUpperLid, apply = True, r = 1 )
		cmds.makeIdentity(MainLowerLid, apply = True, r = 1 )

		return MainEye
Exemple #10
0
def SinglePropRig(Object, referencePositionControl, centerPivot=False):
    # if Object.__class__ == list :
    # elif Object.__class__ in [str,unicode]:
    GRS = RMGenericRigStructure.genericRigStructure()

    NameConv = RMNameConvention.RMNameConvention()
    bbMesh = RMRigTools.boundingBoxInfo(Object)
    CtrlPosition = cmds.xform(referencePositionControl, q=True, rp=True, worldSpace=True)

    NameList = Object.split(".")
    cntrlToMeshX = bbMesh.position[0] - CtrlPosition[0]
    cntrlToMeshY = bbMesh.position[1] - CtrlPosition[1]
    cntrlToMeshZ = bbMesh.position[2] - CtrlPosition[2]

    if len(NameList) > 1:
        Ctrl = RMRigShapeControls.RMCreateCubeLine(
            bbMesh.lenX,
            bbMesh.lenY,
            bbMesh.lenZ,
            offsetX=-bbMesh.minDistanceToCenterX + cntrlToMeshX,
            offsetY=-bbMesh.minDistanceToCenterY + bbMesh.lenY / 2 + cntrlToMeshY,
            offsetZ=-bbMesh.minDistanceToCenterZ + bbMesh.lenZ / 2 + cntrlToMeshZ,
            name=NameList[1],
        )
        if centerPivot == True:
            cmds.xform(Ctrl, cp=1)
        joint = cmds.joint(name=NameList[1] + "jnt")
    else:
        Ctrl = RMRigShapeControls.RMCreateCubeLine(
            bbMesh.lenX,
            bbMesh.lenY,
            bbMesh.lenZ,
            offsetX=-bbMesh.minDistanceToCenterX + cntrlToMeshX,
            offsetY=-bbMesh.minDistanceToCenterY + bbMesh.lenY / 2 + cntrlToMeshY,
            offsetZ=-bbMesh.minDistanceToCenterZ + bbMesh.lenZ / 2 + cntrlToMeshZ,
            name=NameList[0] + "Ctrl",
        )
        if centerPivot == True:
            cmds.xform(Ctrl, cp=1)
        joint = cmds.joint(name=NameList[0] + "jnt")

    Ctrl = NameConv.RMRenameNameInFormat(Ctrl, Type="control")
    ResetGroup = RMRigTools.RMCreateGroupOnObj(Ctrl)
    cmds.parent(ResetGroup, GRS.groups["controls"]["group"])
    rigJntGrp = cmds.ls("*SimpleRigJoints*")
    if len(rigJntGrp) == 0:
        jointGroup = cmds.group(empty=True, name="SimpleRigJoints")
        jointGroup = NameConv.RMRenameNameInFormat(jointGroup)
        cmds.parent(jointGroup, GRS.groups["rig"]["group"])
    else:
        jointGroup = rigJntGrp
    if centerPivot != True:
        RMRigTools.RMAlign(referencePositionControl, ResetGroup, 3)

    joint = NameConv.RMRenameNameInFormat(joint)

    RMRigTools.RMAlign(referencePositionControl, joint, 3)
    ResetJoint = RMRigTools.RMCreateGroupOnObj(joint)
    cmds.parent(ResetJoint, jointGroup)
    # if cmds.objExists
    # for eachObject in Object:
    cmds.parentConstraint(Ctrl, joint)
    cmds.select(clear=True)
    cmds.select(Object)
    cmds.select(joint, add=True)
    cmds.skinCluster()
Exemple #11
0
    def CreateBookRig(self, AffectedObject):

        affected = AffectedObject
        self.widthValue = RMRigTools.RMPointDistance(self.width, self.origin)
        self.heightValue = RMRigTools.RMPointDistance(self.height, self.origin)

        parentGroup = cmds.group(empty=True, name="BookRig")
        self.NameConv.default_names["System"] = parentGroup
        RMRigTools.RMAlign(self.origin, parentGroup, 3)

        cmds.select(affected)
        self.flare2, self.flareHandle2 = cmds.nonLinear(type='flare', lowBound=0, highBound=self.widthValue,
                                                        name="FlareLeafsThick")
        self.flare2 = self.NameConv.rename_name_in_format(self.flare2)
        self.flareHandle2 = self.NameConv.rename_name_in_format(self.flareHandle2)

        RMRigTools.RMAlign(self.origin, self.flareHandle2, 3)
        cmds.xform(self.flareHandle2, objectSpace=True, rotation=[180, 0, 90])
        cmds.setAttr(self.flareHandle2 + ".scale", 1, 1, 1)

        cmds.select(affected)
        self.flare, self.flareHandle = cmds.nonLinear(type='flare', lowBound=0, highBound=self.heightValue,
                                                      name="FlareBorderRefinement")  # endFlareX
        self.flare = self.NameConv.rename_name_in_format(self.flare)
        self.flareHandle = self.NameConv.rename_name_in_format(self.flareHandle)
        RMRigTools.RMAlign(self.origin, self.flareHandle, 3)
        cmds.setAttr(self.flareHandle + ".scale", 1, 1, 1)
        cmds.xform(self.flareHandle, objectSpace=True, translation=[self.widthValue / 2, 0, 0])

        cmds.select(affected)
        self.bendSpread, self.bendHandleSpread = cmds.nonLinear(type='bend', lowBound=-self.widthValue,
                                                                highBound=self.widthValue, curvature=0,
                                                                name="bendSpread")  # curvature
        self.bendSpread = self.NameConv.rename_name_in_format(self.bendSpread)
        self.bendHandleSpread = self.NameConv.rename_name_in_format(self.bendHandleSpread)
        RMRigTools.RMAlign(self.origin, self.bendHandleSpread, 3)
        cmds.xform(self.bendHandleSpread, objectSpace=True, rotation=[0, 0, 90])
        cmds.setAttr(self.bendHandleSpread + ".scale", 1, 1, 1)

        cmds.select(affected)
        # self.bendMidle, self.bendHandleMiddle = cmds.nonLinear(type = 'bend', lowBound = 0 , highBound = self.heightValue / 2 , curvature = 0,name = "bendCenter")#curvature Hight Bound
        self.bendMidle, self.bendHandleMiddle = cmds.nonLinear(type='bend', lowBound=0, highBound=1, curvature=0,
                                                               name="bendCenter")  # curvature Hight Bound
        self.bendMidle = self.NameConv.rename_name_in_format(self.bendMidle)
        self.bendHandleMiddle = self.NameConv.rename_name_in_format(self.bendHandleMiddle)
        RMRigTools.RMAlign(self.origin, self.bendHandleMiddle, 3)
        cmds.setAttr(self.bendHandleMiddle + ".scale", 1, 1, 1)
        cmds.xform(self.bendHandleMiddle, objectSpace=True, translation=[0, self.heightValue / 2, 0])

        cmds.select(affected)
        # self.bendOpen, self.bendHandleOpen = cmds.nonLinear(type = 'bend', lowBound = 0 , highBound = self.heightValue / 2 , curvature = 0,name = "bendOpen")#curvature Hight Bound
        self.bendOpen, self.bendHandleOpen = cmds.nonLinear(type='bend', lowBound=0, highBound=1, curvature=0,
                                                            name="bendOpen")  # curvature Hight Bound
        self.bendOpen = self.NameConv.rename_name_in_format(self.bendOpen)
        self.bendHandleOpen = self.NameConv.rename_name_in_format(self.bendHandleOpen)
        RMRigTools.RMAlign(self.origin, self.bendHandleOpen, 3)
        cmds.setAttr(self.bendHandleOpen + ".scale", 1, 1, 1)

        cmds.select(affected)
        # self.bendOpen, self.bendHandleOpen = cmds.nonLinear(type = 'bend', lowBound = 0 , highBound = self.heightValue / 2 , curvature = 0,name = "bendOpen")#curvature Hight Bound
        # self.bendOpenOposit, self.bendHandleOpenOposit = cmds.nonLinear(type = 'bend', lowBound = 0 , highBound = 1 , curvature = 0,name = "bendOpenOposit")#curvature Hight Bound
        # self.bendOpenOposit = self.NameConv.RMRenameNameInFormat(self.bendOpenOposit)
        # self.bendHandleOpenOposit = self.NameConv.RMRenameNameInFormat(self.bendHandleOpenOposit)

        # RMRigTools.RMAlign(self.origin, self.bendHandleOpenOposit,3)
        # cmds.setAttr(self.bendHandleOpenOposit + ".scale", 1 , 1 , 1)

        self.centerBendLocator = cmds.spaceLocator(name="centerBend")[0]
        self.centerBendLocator = self.NameConv.rename_name_in_format(self.centerBendLocator)

        RMRigTools.RMAlign(self.bendHandleMiddle, self.centerBendLocator, 3)
        cmds.parent(self.bendHandleMiddle, self.centerBendLocator)

        cmds.parent(self.centerBendLocator, parentGroup)

        # cmds.xform( self.bendHandleOpen , objectSpace = True, translation = [self.widthValue,0,0])
        # cmds.xform( self.bendHandleOpenOposit , objectSpace = True, translation = [-self.widthValue,0,0])
        cmds.connectAttr(self.bendHandleOpen + ".scaleX", self.centerBendLocator + ".translateY")
        # cmds.connectAttr(self.bendHandleOpen+".scale",self.bendHandleOpenOposit+".scale")


        cmds.parent(self.bendHandleOpen, parentGroup)
        # cmds.parent( self.bendHandleOpenOposit, parentGroup )
        cmds.parent(self.flareHandle, parentGroup)
        cmds.parent(self.bendHandleSpread, parentGroup)
        cmds.parent(self.flareHandle2, parentGroup)

        ControlResetPoint, Control = RMRigShapeControls.RMCircularControl(self.origin, NameConv=self.NameConv)
        self.AddAttributes(Control)
        self.LinkAttributes(Control)
Exemple #12
0
cmds.addAttr("PapirusControl",
             longName="BendDirection",
             keyable=1,
             hasMinValue=1,
             hasMaxValue=1,
             minValue=-10,
             maxValue=10)

print "1"
cmds.addAttr("PapirusControl",
             longName="ExtraControls",
             attributeType="enum",
             enumName="Off:On")

print "2"
RMRigTools.connectWithLimits("PapirusControl.BendRoll", "RolledBend.curvature",
                             [[-10, -180], [0, 0], [10, 180]])
cmds.connectAttr("PapirusControl.BendRollDirection",
                 "RollbendHandle.rotateY",
                 force=True)
print "3"
RMRigTools.connectWithLimits("PapirusControl.BendFloor", "FloorBend.curvature",
                             [[-10, -180], [0, 0], [10, 180]])
RMRigTools.connectWithLimits("PapirusControl.BendFloorDistance",
                             "FloorBendHandle.translateZ", [[0, 0], [10, -20]])
print "4"
RMRigTools.connectWithLimits("PapirusControl.SinAmplitude", "Wave.amplitude",
                             [[0, 0], [10, -20]])
cmds.connectAttr("PapirusControl.SinPhase", "Wave.offset", force=True)
print "5"
RMRigTools.connectWithLimits("PapirusControl.SinDecay", "Wave.dropoff",
                             [[-10, -1], [0, 0], [10, 1]])
	def LinkFacial (self,BSname = "CharacterFacialBS" ):
		self.checkExistance()
		cmds.blendShape("Character",name = BSname)
		NumBS=0
		for keys in sorted(self.FaceBlendShapeDic.iterkeys()):
			if cmds.objExists(keys):
				if keys =="LEyeCls" and cmds.objExists("LEyeHalfCls"):
					cmds.blendShape(BSname,edit=True, target=["Character",NumBS,"LEyeHalfCls",.5])
				if keys =="REyeCls" and cmds.objExists("REyeHalfCls"):
					cmds.blendShape(BSname,edit=True, target=["Character",NumBS,"REyeHalfCls",.5])
				cmds.blendShape(BSname,edit=True, target=["Character",NumBS,keys,1.0])
				self.FaceBlendShapeDic[keys]["index"] = NumBS
				self.FaceBlendShapeDic[keys]["Exists"] = True


				NumBS+=1
			else:
				print "el objeto" + keys + " no fue encontrado."
				self.FaceBlendShapeDic[keys]["Exists"] = False

		if self.FaceBlendShapeDic["Incisibus"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_Incisibus_ctrl_fc.translateY",BSname+".Incisibus",[[0,0],[2,1]])
	
		if self.FaceBlendShapeDic["REyeCls"]["Exists"]:
			RMRigTools.connectWithLimits("Character_RH_ReyeCls_ctrl_fc.translateY", BSname+".REyeCls",[[0,0],[-2,1]])
		if self.FaceBlendShapeDic["LEyeCls"]["Exists"]:
			RMRigTools.connectWithLimits("Character_LF_LeyeCls_ctrl_fc.translateY", BSname+".LEyeCls",[[0,0],[-2,1]])


		if self.FaceBlendShapeDic["RBrowOutUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_RBrowOutUpDn_ctrl_fc.translateY", BSname+".RBrowOutUp",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["RBrowOutDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_RBrowOutUpDn_ctrl_fc.translateY", BSname+".RBrowOutDn",[[0,0],[-1,1]])	
		if self.FaceBlendShapeDic["RBrowInUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_RBrowOutUpDn_ctrl_fc.translateX", BSname+".RBrowInUp",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["RBrowInDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_RBrowOutUpDn_ctrl_fc.translateX", BSname+".RBrowInDn",[[0,0],[-1,1]])

		if self.FaceBlendShapeDic["LBrowOutUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LBrowOutUpDn_ctrl_fc.translateY", BSname+".LBrowOutUp",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["LBrowOutDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LBrowOutUpDn_ctrl_fc.translateY", BSname+".LBrowOutDn",[[0,0],[-1,1]])	
		if self.FaceBlendShapeDic["LBrowInUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LBrowOutUpDn_ctrl_fc.translateX", BSname+".LBrowInUp",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["LBrowInDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LBrowOutUpDn_ctrl_fc.translateX", BSname+".LBrowInDn",[[0,0],[-1,1]])

		if self.FaceBlendShapeDic["LBrowsqueeze"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_Browsqueeze_ctrl_fc.translateY", (BSname + ".LBrowsqueeze"),[[-1,-1],[0,0],[1,1]])
		if self.FaceBlendShapeDic["RBrowsqueeze"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_Browsqueeze_ctrl_fc.translateX", (BSname + ".RBrowsqueeze"),[[-1,-1],[0,0],[1,1]])

		if self.FaceBlendShapeDic["UprLipUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_UprLipUpDn_ctrl_fc.translateY", BSname+".UprLipUp",[[0,0],[1,1]])	
		if self.FaceBlendShapeDic["UprLipDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_UprLipUpDn_ctrl_fc.translateY", BSname+".UprLipDn",[[0,0],[-1,1]])	

		if self.FaceBlendShapeDic["LwrLipUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LowerLipUpDn_ctrl_fc.translateY", BSname+".LwrLipUp",[[0,0],[1,1]])	
		if self.FaceBlendShapeDic["LwrLipDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LowerLipUpDn_ctrl_fc.translateY", BSname+".LwrLipDn",[[0,0],[-1,1]])	


		if cmds.objExists("LeyeLookAt") and cmds.objExists("LeyeOrientacion") and self.FaceBlendShapeDic["LEyeRollLf"]["Exists"] and self.FaceBlendShapeDic["LEyeRollRh"]["Exists"]:
			if not cmds.objExists("LEyesHzFinalRotationPlus"):
				cmds.shadingNode("plusMinusAverage",asUtility=True,name="LEyesHzFinalRotationPlus")
				cmds.connectAttr("LeyeLookAt.rotateY","LEyesHzFinalRotationPlus.input1D[0]")
				cmds.connectAttr("LeyeOrientacion.rotateY","LEyesHzFinalRotationPlus.input1D[1]")

			if self.FaceBlendShapeDic["LEyeRollLf"]["Exists"]:
				RMRigTools.connectWithLimits("LEyesHzFinalRotationPlus.output1D",BSname+".LEyeRollLf",[[0,0],[45,1]])
			
			if self.FaceBlendShapeDic["LEyeRollRh"]["Exists"]:
				RMRigTools.connectWithLimits("LEyesHzFinalRotationPlus.output1D",BSname+".LEyeRollRh",[[0,0],[-45,1]])
		
		if cmds.objExists("ReyeLookAt") and cmds.objExists("ReyeOrientacion") and self.FaceBlendShapeDic["REyeRollLf"]["Exists"] and self.FaceBlendShapeDic["REyeRollRh"]["Exists"]:
			if not cmds.objExists("REyesHorizontalFinalRotationPlus"):
				cmds.shadingNode("plusMinusAverage",asUtility=True,name="REyesHorizontalFinalRotationPlus")
				cmds.connectAttr("ReyeLookAt.rotateY","REyesHorizontalFinalRotationPlus.input1D[0]")
				cmds.connectAttr("ReyeOrientacion.rotateY","REyesHorizontalFinalRotationPlus.input1D[1]")

			if self.FaceBlendShapeDic["REyeRollLf"]["Exists"]:
				RMRigTools.connectWithLimits("REyesHorizontalFinalRotationPlus.output1D",BSname+".REyeRollLf",[[0,0],[45,1]])
			
			if self.FaceBlendShapeDic["REyeRollRh"]["Exists"]:
				RMRigTools.connectWithLimits("REyesHorizontalFinalRotationPlus.output1D",BSname+".REyeRollRh",[[0,0],[-45,1]])

		if cmds.objExists("ReyeLookAt") and cmds.objExists("ReyeOrientacion") and self.FaceBlendShapeDic["REyeRollUp"]["Exists"] and self.FaceBlendShapeDic["REyeRollDn"]["Exists"]:
			if not cmds.objExists("REyesVerticalFinalRotationPlus"):
				cmds.shadingNode("plusMinusAverage",asUtility=True,name="REyesVerticalFinalRotationPlus")
				cmds.connectAttr("ReyeLookAt.rotateX","REyesVerticalFinalRotationPlus.input1D[0]")
				cmds.connectAttr("ReyeOrientacion.rotateX","REyesVerticalFinalRotationPlus.input1D[1]")

			if self.FaceBlendShapeDic["REyeRollUp"]["Exists"]:
				RMRigTools.connectWithLimits("REyesVerticalFinalRotationPlus.output1D",BSname+".REyeRollUp",[[0,0],[-45,1]])
			
			if self.FaceBlendShapeDic["REyeRollDn"]["Exists"]:
				RMRigTools.connectWithLimits("REyesVerticalFinalRotationPlus.output1D",BSname+".REyeRollDn",[[0,0],[45,1]])
		
		if cmds.objExists("LeyeLookAt") and cmds.objExists("LeyeOrientacion") and self.FaceBlendShapeDic["LEyeRollDn"]["Exists"] and self.FaceBlendShapeDic["LEyeRollUp"]["Exists"]:
			if not cmds.objExists("LEyesVerticalFinalRotationPlus"):
				cmds.shadingNode("plusMinusAverage",asUtility=True,name="LEyesVerticalFinalRotationPlus")
				cmds.connectAttr("LeyeLookAt.rotateX","LEyesVerticalFinalRotationPlus.input1D[0]")
				cmds.connectAttr("LeyeOrientacion.rotateX","LEyesVerticalFinalRotationPlus.input1D[1]")

			if self.FaceBlendShapeDic["LEyeRollUp"]["Exists"]:
				RMRigTools.connectWithLimits("LEyesVerticalFinalRotationPlus.output1D",BSname+".LEyeRollUp",[[0,0],[-45,1]])
			
			if self.FaceBlendShapeDic["LEyeRollDn"]["Exists"]:
				RMRigTools.connectWithLimits("LEyesVerticalFinalRotationPlus.output1D",BSname+".LEyeRollDn",[[0,0],[45,1]])


		if self.FaceBlendShapeDic["Wide"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_JawOpen_ctrl_fc.translateX", BSname+".Wide",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["Narrow"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_JawOpen_ctrl_fc.translateX", BSname+".Narrow",[[0,0],[-1,1]])
		if self.FaceBlendShapeDic["Wide"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_JawOpen_ctrl_fc.translateX", BSname+".Wide",[[0,0],[1,1]])


		if self.FaceBlendShapeDic["RSmile"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_MouthEmotion_ctrl_fc.translateY", BSname+".RSmile",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["RFrown"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_MouthEmotion_ctrl_fc.translateY", BSname+".RFrown",[[0,0],[-1,1]])	
		if self.FaceBlendShapeDic["LSmile"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_MouthEmotion_ctrl_fc.translateX", BSname+".LSmile",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["LFrown"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_MouthEmotion_ctrl_fc.translateX", BSname+".LFrown",[[0,0],[-1,1]])

		if self.FaceBlendShapeDic["RSquint"]["Exists"]:
			RMRigTools.connectWithLimits("Character_RH_RSquint_ctrl_fc.translateY", BSname+".RSquint",[[0,0],[1,1]])

		if self.FaceBlendShapeDic["LSquint"]["Exists"]:
			RMRigTools.connectWithLimits("Character_LF_LSquint_ctrl_fc.translateY", BSname+".LSquint",[[0,0],[1,1]])

		if self.FaceBlendShapeDic["RSneer"]["Exists"]:
			RMRigTools.connectWithLimits("Character_RH_RSneer_ctrl_fc.translateY", BSname+".RSneer",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["LSneer"]["Exists"]:
			RMRigTools.connectWithLimits("Character_LF_LSneer_ctrl_fc.translateY", BSname+".LSneer",[[0,0],[1,1]])

		if self.FaceBlendShapeDic["LBrowPositionUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_LF_LBrowPosition_ctrl_fc.translateY", BSname+".LBrowPositionUp",[[0,0],[1,1]])
		
		if self.FaceBlendShapeDic["RBrowPositionUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_RH_RBrowPosition_ctrl_fc.translateY", BSname+".RBrowPositionUp",[[0,0],[1,1]])
		
		if self.FaceBlendShapeDic["LBrowPositionDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_LF_LBrowPosition_ctrl_fc.translateY", BSname+".LBrowPositionDn",[[0,0],[-1,1]])
		
		if self.FaceBlendShapeDic["RBrowPositionDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_RH_RBrowPosition_ctrl_fc.translateY", BSname+".RBrowPositionDn",[[0,0],[-1,1]])
	def JawSetup(self):
			if cmds.objExists("Jaw"):
				RMRigTools.connectWithLimits("Character_MD_JawOpen_ctrl_fc.translateY", "Jaw.rotateZ",[[0,0],[-1,-20],[1,7]])
				RMRigTools.connectWithLimits("Character_MD_JawFwd_ctrl_fc.translateX", "Jaw.rotateY",[[0,0],[1,20],[-1,-20]])
				RMRigTools.connectWithLimits("Character_MD_JawFwd_ctrl_fc.translateY", "Jaw.translateX",[[0,0],[1,-1],[-1,1]])
Exemple #15
0
	def SetupEyes(self):
		if cmds.objExists("LEye") and cmds.objExists("REye"):
			cmds.group(em=True,name="ReyeOrientacion")
			cmds.group(em=True,name="ReyeBase")
			cmds.group(em=True,name="ReyeLookAt")
			cmds.group(em=True,name="ReyePointLookAt")
			
			cmds.group(em=True,name="LeyeOrientacion")
			cmds.group(em=True,name="LeyeBase")
			cmds.group(em=True,name="LeyeLookAt")
			cmds.group(em=True,name="LeyePointLookAt")
			
			cmds.group(em=True,name="eyeOrientation")

			RMRigTools.RMAlign("LEye","LeyeBase",3)
			RMRigTools.RMAlign("LEye","LeyeOrientacion",3)
			RMRigTools.RMAlign("LEye","LeyeLookAt",3)
			RMRigTools.RMAlign("LEye","LeyePointLookAt",3)

			cmds.move(10,"LeyePointLookAt",moveZ=True)
			EyeParent = cmds.listRelatives("LEye",parent=True)
			cmds.parent("LeyeBase",EyeParent)
			cmds.parent("LeyeLookAt","LeyeBase")
			cmds.parent("LeyeOrientacion","LeyeLookAt")

			cmds.aimConstraint("LeyePointLookAt","LeyeLookAt",worldUpObject="eyeOrientation",worldUpType="objectrotation")

			cmds.expression(name = "LEyeExpresionX",unitConversion = "none")
			script = "LeyeOrientacion.rotateY = (Character_LF_Ojo_Ctrl_fc.translateX * 4 + Character_MD_OjoRectangle_ctrl_fc.translateX * 4)/10"
			cmds.expression("LEyeExpresionX",edit=True, string=script,unitConversion = "none")
			cmds.expression(name = "LEyeExpresionY",unitConversion = "none")
			script = "LeyeOrientacion.rotateZ = (Character_LF_Ojo_Ctrl_fc.translateY * 4 + Character_MD_OjoRectangle_ctrl_fc.translateY * 4)/10"
			cmds.expression("LEyeExpresionY",edit=True, string=script,unitConversion = "none")


			RMRigTools.RMAlign("REye","ReyeBase",3)
			RMRigTools.RMAlign("REye","ReyeOrientacion",3)
			RMRigTools.RMAlign("REye","ReyeLookAt",3)
			RMRigTools.RMAlign("REye","ReyePointLookAt",3)

			cmds.move(10,"ReyePointLookAt",moveZ=True)
			EyeParent = cmds.listRelatives("REye",parent=True)
			cmds.parent("ReyeBase",EyeParent)
			cmds.parent("ReyeLookAt","ReyeBase")
			cmds.parent("ReyeOrientacion","ReyeLookAt")

			cmds.aimConstraint("ReyePointLookAt","ReyeLookAt",worldUpObject="eyeOrientation",worldUpType="objectrotation")

			cmds.expression(name = "REyeExpresionX",unitConversion = "none")
			script = "ReyeOrientacion.rotateY = (Character_RH_Ojo_Ctrl_fc.translateX * 4 + Character_MD_OjoRectangle_ctrl_fc.translateX * 4)/10"
			cmds.expression("REyeExpresionX",edit=True, string=script,unitConversion = "none")

			cmds.expression(name = "REyeExpresionY",unitConversion = "none")
			script = "ReyeOrientacion.rotateZ = (Character_RH_Ojo_Ctrl_fc.translateY * 4 + Character_MD_OjoRectangle_ctrl_fc.translateY * 4)/10"
			cmds.expression("REyeExpresionY",edit=True, string=script,unitConversion = "none")
			
			RMRigTools.RMAlign(EyeParent,"eyeOrientation",1)
			cmds.parent("eyeOrientation",EyeParent)

			#$LeyeBase.parent=$LEye.parent;
			#$ReyeBase.parent=$REye.parent;

			cmds.parent("LEye","LeyeOrientacion");
			cmds.parent("REye","ReyeOrientacion");
			
			
			cmds.parent("OjosLookAt",EyeParent);

			cmds.parent("LeyePointLookAt","OjosLookAt_L");
			cmds.parent("ReyePointLookAt","OjosLookAt_R");

		else:
			print "No existen los objetos LEye y REye"
Exemple #16
0
	def LinkM (self):
		cmds.blendShape("Character",name="FacialBS")
		NumBS=0
		for keys in sorted(self.FaceBlendShapeDic.iterkeys()):
			if cmds.objExists(keys):
				cmds.blendShape("FacialBS",edit=True, target=["Character",NumBS,keys,1.0])
				self.FaceBlendShapeDic[keys]["index"] = NumBS
				self.FaceBlendShapeDic[keys]["Exists"] = True
				NumBS+=1
			else:
				print "el objeto" + keys + " no fue encontrado."
				self.FaceBlendShapeDic[keys]["Exists"] = False
		
		if cmds.objExists("RHEyeLashesClosed") and cmds.objExists("LFEyeLashesClosed") :
			cmds.blendShape("EyeLashes",name="EyeLashesBS")
			cmds.blendShape("EyeLashesBS",edit=True, target=["EyeLashes",0,"RHEyeLashesClosed",1.0])
			cmds.blendShape("EyeLashesBS",edit=True, target=["EyeLashes",1,"LFEyeLashesClosed",1.0])

			("Character_RH_ReyeCls_ctrl_fc.translateY", "EyeLashesBS.RHEyeLashesClosed",[[0,0],[-2,1]])

			RMRigTools.connectWithLimits("Character_LF_LeyeCls_ctrl_fc.translateY", "EyeLashesBS.LFEyeLashesClosed",[[0,0],[-2,1]])

		
		if self.FaceBlendShapeDic["REyeCls"]["Exists"]:
			RMRigTools.connectWithLimits("Character_RH_ReyeCls_ctrl_fc.translateY", "FacialBS.REyeCls",[[0,0],[-2,1]])
		if self.FaceBlendShapeDic["LEyeCls"]["Exists"]:
			RMRigTools.connectWithLimits("Character_LF_LeyeCls_ctrl_fc.translateY", "FacialBS.LEyeCls",[[0,0],[-2,1]])


		if self.FaceBlendShapeDic["RBrowOutUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_RBrowOutUpDn_ctrl_fc.translateY", "FacialBS.RBrowOutUp",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["RBrowOutDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_RBrowOutUpDn_ctrl_fc.translateY", "FacialBS.RBrowOutDn",[[0,0],[-1,1]])	
		if self.FaceBlendShapeDic["RBrowInUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_RBrowOutUpDn_ctrl_fc.translateX", "FacialBS.RBrowInUp",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["RBrowInDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_RBrowOutUpDn_ctrl_fc.translateX", "FacialBS.RBrowInDn",[[0,0],[-1,1]])

		if self.FaceBlendShapeDic["LBrowOutUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LBrowOutUpDn_ctrl_fc.translateY", "FacialBS.LBrowOutUp",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["LBrowOutDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LBrowOutUpDn_ctrl_fc.translateY", "FacialBS.LBrowOutDn",[[0,0],[-1,1]])	
		if self.FaceBlendShapeDic["LBrowInUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LBrowOutUpDn_ctrl_fc.translateX", "FacialBS.LBrowInUp",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["LBrowInDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LBrowOutUpDn_ctrl_fc.translateX", "FacialBS.LBrowInDn",[[0,0],[-1,1]])

		if self.FaceBlendShapeDic["Browsqueeze"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_Browsqueeze_ctrl_fc.translateY", "FacialBS.Browsqueeze",[[0,0],[1,1]])

		if self.FaceBlendShapeDic["UprLipUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_UprLipUpDn_ctrl_fc.translateY", "FacialBS.UprLipUp",[[0,0],[1,1]])	
		if self.FaceBlendShapeDic["UprLipDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_UprLipUpDn_ctrl_fc.translateY", "FacialBS.UprLipDn",[[0,0],[-1,1]])	

		if self.FaceBlendShapeDic["LwrLipUp"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LowerLipUpDn_ctrl_fc.translateY", "FacialBS.LwrLipUp",[[0,0],[1,1]])	
		if self.FaceBlendShapeDic["LwrLipDn"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_LowerLipUpDn_ctrl_fc.translateY", "FacialBS.LwrLipDn",[[0,0],[-1,1]])	


		if self.FaceBlendShapeDic["Wide"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_JawOpen_ctrl_fc.translateX", "FacialBS.Wide",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["Narrow"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_JawOpen_ctrl_fc.translateX", "FacialBS.Narrow",[[0,0],[-1,1]])
		if self.FaceBlendShapeDic["Wide"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_JawOpen_ctrl_fc.translateX", "FacialBS.Wide",[[0,0],[1,1]])

		if cmds.objExists("Jaw"):
			RMRigTools.connectWithLimits("Character_MD_JawOpen_ctrl_fc.translateY", "Jaw.rotateZ",[[0,0],[-1,-20],[1,7]])
			RMRigTools.connectWithLimits("Character_MD_JawFwd_ctrl_fc.translateX", "Jaw.rotateY",[[0,0],[1,20],[-1,-20]])
			RMRigTools.connectWithLimits("Character_MD_JawFwd_ctrl_fc.translateY", "Jaw.translateX",[[0,0],[1,-1],[-1,1]])


		if self.FaceBlendShapeDic["RSmile"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_MouthEmotion_ctrl_fc.translateY", "FacialBS.RSmile",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["RFrown"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_MouthEmotion_ctrl_fc.translateY", "FacialBS.RFrown",[[0,0],[-1,1]])	
		if self.FaceBlendShapeDic["LSmile"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_MouthEmotion_ctrl_fc.translateX", "FacialBS.LSmile",[[0,0],[1,1]])
		if self.FaceBlendShapeDic["LFrown"]["Exists"]:
			RMRigTools.connectWithLimits("Character_MD_MouthEmotion_ctrl_fc.translateX", "FacialBS.LFrown",[[0,0],[-1,1]])

		if self.FaceBlendShapeDic["RSquint"]["Exists"]:
			cmds.expression(name = "RSquintExpresion",unitConversion = "none")
			script ='''\nfloat $Zval=0;
				\nfloat $Xval=0;
				\nif (Character_MD_EyeSquint_ctrl_fc.translateY>=0)
				\n{$Zval=Character_MD_EyeSquint_ctrl_fc.translateY;}
				\nelse{$Zval=0;}
				\nif (Character_MD_EyeSquint_ctrl_fc.translateX<=0) 
				\n{$Xval=-Character_MD_EyeSquint_ctrl_fc.translateX;}
				\nelse {$Xval = 0;}
				\nFacialBS.RSquint = ($Zval-$Xval);'''
			cmds.expression("RSquintExpresion",edit=True,string=script,unitConversion = "none")

		if self.FaceBlendShapeDic["LSquint"]["Exists"]:
			cmds.expression(name = "LSquintExpresion",unitConversion = "none")
			script ='''\nfloat $Zval=0;
				\nfloat $Xval=0;
				\nif (Character_MD_EyeSquint_ctrl_fc.translateY>=0)
				\n{$Zval=Character_MD_EyeSquint_ctrl_fc.translateY;}
				\nelse{$Zval=0;}
				\nif (Character_MD_EyeSquint_ctrl_fc.translateX>=0) 
				\n{$Xval=Character_MD_EyeSquint_ctrl_fc.translateX;}
				\nelse {$Xval = 0;}
				\nFacialBS.LSquint = ($Zval-$Xval);'''
			cmds.expression("LSquintExpresion",edit=True,string=script,unitConversion = "none")

		if self.FaceBlendShapeDic["RSneer"]["Exists"]:
			cmds.expression(name = "RSneerExpresion",unitConversion = "none")
			script ='''\nfloat $Zval=0;
				\nfloat $Xval=0;
				\nif (Character_MD_EyeSneer_ctrl_fc.translateY>=0)
				\n{$Zval=Character_MD_EyeSneer_ctrl_fc.translateY;}
				\nelse{$Zval=0;}
				\nif (Character_MD_EyeSneer_ctrl_fc.translateX<=0) 
				\n{$Xval=-Character_MD_EyeSneer_ctrl_fc.translateX;}
				\nelse {$Xval = 0;}
				\nFacialBS.RSneer = ($Zval-$Xval);'''
			cmds.expression("RSneerExpresion",edit=True,string=script,unitConversion = "none")
		if self.FaceBlendShapeDic["LSneer"]["Exists"]:
			cmds.expression(name = "LSneerExpresion",unitConversion = "none")
			script ='''\nfloat $Zval=0;
				\nfloat $Xval=0;
				\nif (Character_MD_EyeSneer_ctrl_fc.translateY>=0)
				\n{$Zval=Character_MD_EyeSneer_ctrl_fc.translateY;}
				\nelse{$Zval=0;}
				\nif (Character_MD_EyeSneer_ctrl_fc.translateX>=0) 
				\n{$Xval=Character_MD_EyeSneer_ctrl_fc.translateX;}
				\nelse {$Xval = 0;}
				\nFacialBS.LSneer = ($Zval-$Xval);'''
			cmds.expression("LSneerExpresion",edit=True,string=script,unitConversion = "none")
Exemple #17
0
 def __init__(self, NameConv=None):
     if NameConv:
         self.NameConv = NameConv
     else:
         self.NameConv = nameConvention.NameConvention()
     RigTools = RMRigTools.RMRigTools(self.NameConv)
Exemple #18
0


'''
cmds.addAttr("PapirusControl",longName="SinAmplitude",keyable=1,hasMinValue=1,hasMaxValue=1,minValue=0,maxValue=10)
cmds.addAttr("PapirusControl",longName="SinPhase",keyable=1)
cmds.addAttr("PapirusControl",longName="SinDecay",keyable=1,hasMinValue=1,hasMaxValue=1,minValue=-10,maxValue=10)
cmds.addAttr("PapirusControl",longName="SinDecayPos",keyable=1,hasMinValue=1,hasMaxValue=1,minValue=0,maxValue=10)
cmds.addAttr("PapirusControl",longName="SinWaveLen",keyable=1,hasMinValue=1,hasMaxValue=1,minValue=0,maxValue=10)
cmds.addAttr("PapirusControl",longName="BendFloor",keyable=1,hasMinValue=1,hasMaxValue=1,minValue=-10,maxValue=10)
cmds.addAttr("PapirusControl",longName="BendFloorDistance",keyable=1,hasMinValue=1,hasMaxValue=1,minValue=0,maxValue=10)
cmds.addAttr("PapirusControl",longName="BendDirection",keyable=1,hasMinValue=1,hasMaxValue=1,minValue=-10,maxValue=10)
cmds.addAttr("PapirusControl",longName="ExtraControls",attributeType="enum",enumName = "Off:On")
'''

'''
RMRigTools.connectWithLimits("PapirusControl.BendRoll","RolledBend.curvature",[[-10,-180],[0,0],[10,180]])
cmds.connectAttr("PapirusControl.BendRollDirection","RollbendHandle.rotateY",force=True)
RMRigTools.connectWithLimits("PapirusControl.BendFloor","FloorBend.curvature",[[-10,-180],[0,0],[10,180]])
RMRigTools.connectWithLimits("PapirusControl.BendFloorDistance","FloorBendHandle.translateZ",[[0,0],[10,-20]])
RMRigTools.connectWithLimits("PapirusControl.SinAmplitude","Wave.amplitude",[[0,0],[10,-20]])
cmds.connectAttr("PapirusControl.SinPhase","Wave.offset",force=True)
RMRigTools.connectWithLimits("PapirusControl.SinDecay","Wave.dropoff",[[-10,-1] , [0,0] , [10,1]] )
RMRigTools.connectWithLimits("PapirusControl.SinDecayPos","sine1Handle.translateZ",[[0,0],[10,-20]])
RMRigTools.connectWithLimits("PapirusControl.SinWaveLen","Wave.wavelength",[[0,.1],[10,6]])
RMRigTools.connectWithLimits("PapirusControl.BendDirection","DirectionBend.curvature",[[-10,-90],[0,0],[10,90]])
cmds.connectAttr("PapirusControl.ExtraControls","curve1.visibility",force=True) '''


'''
cmds.addAttr("MainControl",longName="SinAmplitude",keyable=1,hasMinValue=1,hasMaxValue=1,minValue=0,maxValue=10)
Exemple #19
0
def createTwoPointsLineConstraint(referencePoint01, referencePoint02,
                                  OriginObject):
    groupOrigin = cmds.group(empty=True, name="LineOrigin")
    resultPoint = cmds.group(empty=True, name="ResultPoint")
    resultPointConstrained = cmds.group(empty=True,
                                        name="ResultPointHeightConstrained")
    group1 = cmds.group(empty=True, name="LineReferencePoint01")
    group2 = cmds.group(empty=True, name="LineReferencePoint02")
    cmds.parentConstraint(referencePoint01, group1, mo=False)
    cmds.parentConstraint(referencePoint02, group2, mo=False)
    cmds.parentConstraint(OriginObject, groupOrigin, mo=False)

    cmds.parent(group1, groupOrigin)
    cmds.parent(group2, groupOrigin)
    cmds.parent(resultPoint, groupOrigin)
    cmds.parent(resultPointConstrained, groupOrigin)
    RMRigTools.RMAlign(resultPointConstrained, groupOrigin, 3)

    Substract01 = cmds.shadingNode('plusMinusAverage',
                                   asUtility=True,
                                   name="LineSubstract01")
    Substract02 = cmds.shadingNode('plusMinusAverage',
                                   asUtility=True,
                                   name="LineSubstract02")
    Substract03 = cmds.shadingNode('plusMinusAverage',
                                   asUtility=True,
                                   name="LineSubstract03")
    Divide = cmds.shadingNode('multiplyDivide',
                              asUtility=True,
                              name="LineDivide01")
    multiply = cmds.shadingNode('multiplyDivide',
                                asUtility=True,
                                name="LineMultiply01")
    Adition01 = cmds.shadingNode('plusMinusAverage',
                                 asUtility=True,
                                 name="Adition01")

    cmds.setAttr("%s.operation" % Substract01, 2)
    cmds.setAttr("%s.operation" % Substract02, 2)
    cmds.setAttr("%s.operation" % Substract03, 2)

    cmds.connectAttr("%s.translateX" % resultPointConstrained,
                     "%s.translateX" % resultPoint)
    cmds.connectAttr("%s.translateY" % group1, "%s.input1D[0]" % Substract01)
    cmds.connectAttr("%s.translateY" % group2, "%s.input1D[1]" % Substract01)
    cmds.connectAttr("%s.translateX" % group1, "%s.input1D[0]" % Substract02)
    cmds.connectAttr("%s.translateX" % group2, "%s.input1D[1]" % Substract02)

    cmds.connectAttr("%s.translateX" % resultPoint,
                     "%s.input1D[0]" % Substract03)
    cmds.connectAttr("%s.translateX" % group2, "%s.input1D[1]" % Substract03)

    cmds.setAttr("%s.operation" % Divide, 2)
    cmds.connectAttr("%s.output1D" % Substract03, "%s.input1X" % Divide)
    cmds.connectAttr("%s.output1D" % Substract02, "%s.input2X" % Divide)

    cmds.connectAttr("%s.output1D" % Substract01, "%s.input1X" % multiply)
    cmds.connectAttr("%s.outputX" % Divide, "%s.input2X" % multiply)

    cmds.connectAttr("%s.outputX" % multiply, "%s.input1D[0]" % Adition01)
    cmds.connectAttr("%s.translateY" % group2, "%s.input1D[1]" % Adition01)
    cmds.connectAttr("%s.output1D" % Adition01, "%s.translateY" % resultPoint)
Exemple #20
0
    u'Character_MD_TirasdePapel05_sknjnt_Rig',
    u'Character_MD_TirasdePapel06_sknjnt_Rig',
    u'Character_MD_TirasdePapel07_sknjnt_Rig',
    u'Character_MD_TirasdePapel08_sknjnt_Rig',
    u'Character_MD_TirasdePapel09_sknjnt_Rig',
    u'Character_MD_TirasdePapel10_sknjnt_Rig',
    u'Character_MD_TirasdePapel11_sknjnt_Rig',
    u'Character_MD_TirasdePapel12_sknjnt_Rig'
]

yincrement = 10.0 / (len(locators))

loop = 0
for eachDriver in reversed(drivers):
    constraint = cmds.parentConstraint(joints[len(joints) - loop - 1],
                                       eachDriver,
                                       mo=False)[0]
    cmds.parentConstraint(locators[len(locators) - loop - 1],
                          eachDriver,
                          mo=False)
    constraintManager = RMSpaceSwitch.RMSpaceSwitch()

    WA = cmds.parentConstraint(constraint, q=True, weightAliasList=True)
    RMRigTools.RMConnectWithLimits(
        "nurbsCircle1.paperFold", "%s.%s" % (constraint, WA[0]),
        [[yincrement * loop, 1], [yincrement * (loop + 3), 0]])
    RMRigTools.RMConnectWithLimits(
        "nurbsCircle1.paperFold", "%s.%s" % (constraint, WA[1]),
        [[yincrement * loop, 0], [yincrement * (loop + 3), 1]])
    loop = loop + 1
Exemple #21
0
			#$ReyeBase.parent=$REye.parent;

			cmds.parent("LEye","LeyeOrientacion");
			cmds.parent("REye","ReyeOrientacion");
			
			
			cmds.parent("OjosLookAt",EyeParent);

			cmds.parent("LeyePointLookAt","OjosLookAt_L");
			cmds.parent("ReyePointLookAt","OjosLookAt_R");

		else:
			print "No existen los objetos LEye y REye"

#RMRigTools.connectWithLimits("REyeFollow.rotateY","FacialBS.REyeRollLf",[[0,0],[16,1]])
#RMRigTools.connectWithLimits("REyeFollow.rotateY","FacialBS.REyeRollRh",[[0,0],[-16,1]])
#RMRigTools.connectWithLimits("LEyeFollow.rotateY","FacialBS.LEyeRollLf",[[0,0],[16,1]])
#RMRigTools.connectWithLimits("LEyeFollow.rotateY","FacialBS.LEyeRollRh",[[0,0],[-16,1]])

#RMRigTools.connectWithLimits("Character_RH_ReyeCls_ctrl_fc.translateY", "FacialBS.REyeCls",[[0,0],[-2,1]])
#RMRigTools.connectWithLimits("Character_LF_LeyeCls_ctrl_fc.translateY", "FacialBS.LEyeCls",[[0,0],[-2,1]])
#RMRigTools.connectWithLimits("Character_MD_AutoEyeLids_ctrl_fc.translateY","FacialBS.Incisibus",[[0,0],[-2,1]])


RMRigTools.connectWithLimits("Character_MD_UprLipUpDn_ctrl_fc.translateY", "FacialBS.UpperLipUp",[[0,0],[1,1]])	
RMRigTools.connectWithLimits("Character_MD_UprLipUpDn_ctrl_fc.translateY", "FacialBS.UpperLipDn",[[0,0],[-1,1]])	
RMRigTools.connectWithLimits("Character_MD_LowerLipUpDn_ctrl_fc.translateY", "FacialBS.LowerLipUp",[[0,0],[1,1]])	
RMRigTools.connectWithLimits("Character_MD_LowerLipUpDn_ctrl_fc.translateY", "FacialBS.LowerLipDn",[[0,0],[-1,1]])	

#SetupEyes()
#LinkM(self.FaceBlendShapeDic)