Results 1 to 1 of 1

Thread: still looking for a way to break the connection on an input

  1. #1
    integer srlake314's Avatar
    Join Date
    Jul 2013
    Location
    Toluca Lake, CA
    Posts
    30

    Default still looking for a way to break the connection on an input



    Hey all.

    I have not found a solution to how to deal with this scenario:

    # attach locator(s) to moPath
    theMoPath = mc.pathAnimation(theLoc,usrSel)

    The idea is, eventually hook up control and offset joints to the curve.

    However, first I create the motion path attaching the locator to the curve. The important part, that I can't seem to figure out is to break the connection
    of the u.Value in the channel box of the input for the locator. delete, deleteAttr, disconnectAttr, don't seem to work, or at least I can't figure out the proper way to do it.

    The whole code, so far. (I want to compress is more and clean it up, just trying to get it all down)

    Code:
    import maya.cmds as mc
    # Declare variables
    mainName = None
    jntName = None
    cvWin = None
    cvAmt = None
    
    # Get curve selected
    def makeSelection():
    	
    	mySel = mc.ls(selection=True)
    	#return name of selected objects
    	return mySel
    	
    usrSel = makeSelection()
    
    # Create Window for UI(eventually a function)
    if mc.window("cvWin", ex=True):
    	mc.deleteUI("cvWin", window=True)
    	
    mc.window("cvWin",t="Facial Curve",w=100, s=False)
    mc.columnLayout("c_layout", adj =True)
    mc.separator()
    mc.text("Define Main Name")
    mc.separator()
    
    fieldLocPrfx = mc.textFieldGrp(l="Name of prefix:")
    fieldMainName = mc.textFieldGrp(l="Name of object:")
    fieldCvAmt = mc.textFieldGrp(l="Number of points:")
    
    mc.separator()
    mc.text("Please select your curve.")
    mc.separator()
    mc.button("Create", bgc=[0,0,1], c="moPathGen()")
    mc.separator()
    
    mc.showWindow("cvWin")
    usrSel = makeSelection()
    
    
    # Define moPathGen
    def moPathGen():
    	
    	# Query user field entries
    	usrPrefix = mc.textFieldGrp(fieldLocPrfx,q=True,text=True)
    	usrMainName = mc.textFieldGrp(fieldMainName,q=True,text=True)
    	usrPoints = mc.textFieldGrp(fieldCvAmt,q=True,text=True)
    	
    	# for loop to create locator(s)
    	for i in range(0,int(usrPoints)):
    		# create locator(s)
    		theLoc = mc.spaceLocator(n = '{}_{}{}_loc'.format(usrPrefix, usrMainName, i))
    	
    	# for loop to attach locator(s) to motion path
    	for loc in range(0,int(usrPoints)):
    		# attach locator(s) to moPath
    		theMoPath = mc.pathAnimation(theLoc,usrSel)
    		mc.listConnections(theLoc)
    		# get uValue attr based on usrInput
    		uVal = mc.getAttr(theMoPath+".uValue")
    	
    		#mc.delete (uVal)
    		print uVal
    		
    		return
    Any help would be appreciated.

    Thanks!
    Last edited by srlake314; 03-02-2017 at 10:23 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •