"Could not add constraint or connections."


#1

Hi guys,

I ran into a situation where a script of mine couldn’t create an orient constraint. Ignoring my script and it’s lack of padding, when I select these and try to make a constraint by hand I get:

// Error: line 0: Could not add constraint or connections. //

Here is the full input and output hypergraph connections for both… very tame stuff… so why is it disallowing me from creating this orient constraint?

Any better way to troubleshoot this stuff?


#2

This can happen if your rotate channels are locked. I would start by looking there.


#3

Dude, you’re awesome. So my method to createController should check for locked rots and warn, or only constrain the unlocked axis, or unlock them and apply the locks to the controller.

Thanks a lot, we’re just moving to Maya here and tripping over these kinds of issues where there’s no useful feedback.


#4

In case anyone else runs into this, just a three min thing, but might be helpful:


   def lockedXforms(node):
 	locked = []
       	attrs = ["t", "tx", "ty", "tz", "r", "rx", "ry", "rz"]
       	for attr in attrs:
       		att = (node + "." + attr)
       		if cmds.getAttr(att, lock=1): locked.append(att)
       	return locked
     
            print lockedXforms('an_L_Forearm_JNT')
            >>['an_L_Forearm_JNT.rx', 'an_L_Forearm_JNT.ry']
            

#5

man, why after so many years does this place still suck with text or code auto-formatting…?


#6

If Crytek is switching to Maya(Good News!) i recommend to dive into pyMel directly:

from pymel.core import *

selObj = ls(sl=1)
attrs = attributeInfo(selObj[0], all=1, t='transform')

for each in attrs:
    cmd = ('selObj[0].' + each + '.isLocked()')
    try:
        if eval(cmd):
            print '{0} is locked'.format(each)
    except:
        print '	{0} is not lockable'.format(each)

#7

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.