PDA

View Full Version : Connect Attribute


noobmode
08-02-2012, 02:03 PM
Hello everybody.
I try to write a script to replace objects which had been connected, so i run a test, with 4 locator : loc01,loc02,loc03,loc04. Loc2 pointConstraint by Loc1 and loc3 pointConstraint by loc2. I want to replace loc2 with loc4. So


def listConnect(srcObj,tarObj):
...outAttrs = srcObj.listConnections(source=False,connections=True,sourceFirst=True,plugs=True)
...inAttrs = srcObj.listConnections(source=True,connections=True,sourceFirst=True,plugs=True)

...for attrIn, attrOut in outAttrs:
......pm.connectAttr(attrIn.replace('%s.'%srcObj.name(),'%s.'%tarObj.name()),attrOut.replace('%s.'%srcObj.name(),'%s.'%tarObj.name()),f=True)

...for attrOut, attrIn in inAttrs:
......pm.connectAttr(attrOut.replace('%s.'%srcObj.name(),'%s.'%tarObj.name(),attrIn.replace('%s.'%srcObj.name(),'%s.'%tarObj.name())),f=True)
and
srcObj = pm.PyNode('locator2')
tarObj = pm.PyNode('locator4')
listConnect(srcObj,tarObj)

And it gave me a crash right away.
Anything would help, thanks

noobmode
08-02-2012, 03:09 PM
Sorry, my mistake, after a few more check. It was only my type error. ^^

CGTalk Moderation
08-02-2012, 03:09 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.