Beispiel #1
0
def resetAllManipulations(nodeName):
    import pymel.core as pm  #doing this here because Maya trips up because this is called from MEL and this skips the imports at the top of this file

    charManipulations = pm.getAttr(nodeName + '.manipulatorPositionsPP')
    wordManipulations = pm.getAttr(nodeName + '.manipulatorWordPositionsPP')
    lineManipulations = pm.getAttr(nodeName + '.manipulatorLinePositionsPP')

    currentChar = pm.getAttr(nodeName + '.manipulateId')
    currentWord = pm.getAttr(nodeName + '.manipulateWord')
    currentLine = pm.getAttr(nodeName + '.manipulateLine')

    #for all in arrays
    for i in range(0, len(charManipulations), 1):
        charManipulations[i] = [0.0, 0.0, 0.0]

    for i in range(0, len(wordManipulations), 1):
        wordManipulations[i] = [0.0, 0.0, 0.0]

    for i in range(0, len(lineManipulations), 1):
        lineManipulations[i] = [0.0, 0.0, 0.0]

    pm.setAttr(nodeName + '.manipulatorPositionsPP',
               charManipulations,
               type="vectorArray")
    pm.setAttr(nodeName + '.manipulatorWordPositionsPP',
               wordManipulations,
               type="vectorArray")
    pm.setAttr(nodeName + '.manipulatorLinePositionsPP',
               lineManipulations,
               type="vectorArray")

    pm.setAttr(nodeName + '.manipulatorRotationsPP',
               charManipulations,
               type="vectorArray")
    pm.setAttr(nodeName + '.manipulatorWordRotationsPP',
               wordManipulations,
               type="vectorArray")
    pm.setAttr(nodeName + '.manipulatorLineRotationsPP',
               lineManipulations,
               type="vectorArray")

    pm.setAttr(nodeName + '.manipulatorScalesPP',
               charManipulations,
               type="vectorArray")
    pm.setAttr(nodeName + '.manipulatorWordScalesPP',
               wordManipulations,
               type="vectorArray")
    pm.setAttr(nodeName + '.manipulatorLineScalesPP',
               lineManipulations,
               type="vectorArray")

    cmds.setAttr(nodeName + '.positionAdjust', 0, 0, 0, type="double3")
    cmds.setAttr(nodeName + '.rotationAdjust', 0, 0, 0, type="double3")
    cmds.setAttr(nodeName + '.scaleAdjust', 0, 0, 0, type="double3")

    #trick to get the type tool to update
    cmds.MoveTool()
    mel.eval("typeMoveTool")
    def ctrlSystem(self, ctrl):

        if (self.ctrls[ctrl][0]):
            cmds.select(self.ctrls[ctrl][0], r=True)
            if (self.ctrls[ctrl][1] == "rotate"):
                cmds.RotateTool()
            elif (self.ctrls[ctrl][1] == "trans"):
                cmds.MoveTool()
        else:
            print("Nothing setup.")
Beispiel #3
0
def controlSelect(obj, manip=None):
	
	selectMode = cmds.symbolCheckBox( localBtn, q=True, value=True)
	
	if( manip == "rot" ):
		# rotate tool
		cmds.RotateTool()
	elif( manip == "trans" ):
		# move tool
		cmds.MoveTool()
	
	if( selectMode ):
		cmds.select( obj, add=True )
	else:
		cmds.select( obj, r=True )
    def ctrlSystem(self, ctrl):
        if (cmds.menuItem(self.testMode, q=True, checkBox=True)):
            if (self.ctrls[ctrl][0]):
                cmds.select(self.ctrls[ctrl][0], r=True)
                if (self.ctrls[ctrl][1] == "rotate"):
                    cmds.RotateTool()
                elif (self.ctrls[ctrl][1] == "trans"):
                    cmds.MoveTool()
            else:
                print("Nothing setup.")

        else:
            selected = cmds.ls(sl=True)
            self.ctrls[ctrl][0] = selected
        print("Control: %s Set-> %s" % (ctrl, (",".join(self.ctrls[ctrl][0]))))
	def getSpherizeTarget(self):
		if cmds.objExists('__NrmTrans_SpherizeTarget'):
			cmds.select('__NrmTrans_SpherizeTarget')
#			cmds.sets( e=True, forceElement= 'Mat_RigTransp_Blue_ShaderG' )
			cmds.MoveTool()
		else:
			cmds.sphere( n = '__NrmTrans_SpherizeTarget',nsp=2,s=4)
		if cmds.objExists('Mat_RigTransp_Blue_ShaderG'):
			cmds.sets( '__NrmTrans_SpherizeTarget', e=True, forceElement= 'Mat_RigTransp_Blue_ShaderG' )
		else:
			cmds.shadingNode('lambert', asShader=True,n='Mat_RigTransp_Blue')
			cmds.sets (r=True, noSurfaceShader=True, n='Mat_RigTransp_Blue_ShaderG')
			cmds.connectAttr ('Mat_RigTransp_Blue.outColor', 'Mat_RigTransp_Blue_ShaderG.surfaceShader')
			cmds.setAttr( 'Mat_RigTransp_Blue.color',0, 1, 0, typ='double3' )
			cmds.setAttr( 'Mat_RigTransp_Blue.incandescence',0, 0, 1, typ='double3' )
			cmds.setAttr( 'Mat_RigTransp_Blue.transparency',0.85, 0.85, 1.85, typ='double3' )
			cmds.sets( '__NrmTrans_SpherizeTarget', e=True, forceElement= 'Mat_RigTransp_Blue_ShaderG' )
		cmds.showHidden( '__NrmTrans_SpherizeTarget' )
    def selectCtrl(self, ctrl, switchMode=None, addMode=False):
        '''
		Selects the control icons.
		'''
        prefSwitch = True

        # Prefered switch
        if (prefSwitch and switchMode):
            # Switch to the proper mode
            if (switchMode.lower() == "rotate"):
                cmds.RotateTool()
            else:
                cmds.MoveTool()

            print("Switching to %s." % switchMode)

            if (addMode):
                cmds.select(ctrl, add=True)
            else:
                cmds.select(ctrl, replace=True)
Beispiel #7
0
def flipTypeManipulator():
    className = getCurrentCtxName()
    if (className == "typeTRSTool"):
        cmds.MoveTool()
        mel.eval("typeMoveTool")