def doConstraints(constraintType):
	# determine the outgoing plug name and attribute lists based on the constraint type
	outPlug = ''
	attributeList = []
	if (constraintType == 'aimConstraint'):
		outPlug = 'constraintRotate'
		attributeList = ['offset', 'aimVector', 'upVector', 'worldUpVector', 'worldUpMatrix', 'worldUpType']
	elif (constraintType == 'orientConstraint'):
		outPlug = 'constraintRotate'
		attributeList = ['offset', 'interpType']
	elif (constraintType == 'pointConstraint'):
		outPlug = 'constraintTranslate'
		attributeList = ['offset', 'constraintOffsetPolarity']
	
	# set up each constraint
	constraints = cmds.ls(type=constraintType)
	for constraint in constraints:
		# first resolve naming conflicts in case any exist
		constraint = cmds.rename(constraint, constraint)
		# NOTE: Unity implementation does not allow per-child-plug behavior, so just check first child plug
		constrainedObjects = cmds.listConnections('%s.%sX'%(constraint, outPlug), source=False)
		if not constrainedObjects: continue
		for obj in constrainedObjects:
			if constraintType == 'pointConstraint': util.addAttributeValues(obj, constraint, attributeList)
			else: util.addAttributeValues(obj, constraint, attributeList, eulerAttributes=['offset'])
			util.addAttributeValues(obj, constraint, mel.eval('%s -q -wal %s'%(constraintType, constraint)))
			try:
				targets = ['target[%s].targetParentMatrix'%re.search('\d+$', t).group(0) for t in mel.eval('%s -q -wal %s'%(constraintType, constraint))]
				util.addAttributeValues(obj, constraint, targets)
			except: pass
Adds user properties to objects controlled by constraints.
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/amTools/unity/rigs/constraints.py/doConstraints