def __func__(self): """ """ self.mi_baseCurve = cgmMeta.validateObjArg(self.d_kws['baseCurve'],mayaType='nurbsCurve',noneValid=False) self._str_funcCombined = self._str_funcCombined + "(%s)"%self.mi_baseCurve.p_nameShort self.str_arg = cgmValid.stringArg(self.d_kws['arg'],noneValid=True) self.b_keepOriginal = cgmValid.boolArg(self.d_kws['keepOriginal'], calledFrom=self._str_funcCombined) if isEP(self.mi_baseCurve): log.warning("%s %s already an ep curve"%(self._str_reportStart,self.mi_baseCurve.p_nameShort)) return False mi_crv = self.mi_baseCurve if self.str_arg.lower() == 'ep': l_pos = [] for cv in mi_crv.getComponents('cv'): locatorName = locators.locMeObject(cv) pos = distance.returnClosestUPosition(locatorName,mi_crv.mNode) mc.delete(locatorName) l_pos.append( pos ) if not self.b_keepOriginal:mi_crv.delete() return mc.curve(d = 2,ep = l_pos, os = True) #return curves.curveFromPosList(l_pos) raise NotImplementedError,"arg: %s"%self.str_arg
def ObjectFacesToFolicles(): try: import parentConstraintToSurface except: "Can't find parentConstraintToSurface" selection = mc.ls(sl=True) or [] if not selection: return "Nothing selected" #If we're going, create a return set returnSet = SetFactory.SetFactory('folicledLocs', 'td', True) # Make some groups mLocGroup = mc.group(em=True, name='locators_grp') number = len(selection) returnList = [] for i, o in enumerate(selection): guiFactory.report("On %s. %s of %s" % (o, i, number)) faceBuffer = "%s.f[4]" % o if not mc.objExists(faceBuffer): print "'%s' has no face!" % o loc = locators.locMeObject(faceBuffer) returnSet.store(loc) mc.select(cl=True) mc.select(loc, o) parentConstraintToSurface.parentConstraintToSurface() rigging.doParentReturnName(loc, mLocGroup) follicles = mc.ls(type='follicle') mc.select(follicles) mc.group(name='folicles_grp')
def returnHorizontalOrVertical(objList): """ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION: Returns if a set of objects is laid out vertically or horizontally ARGUMENTS: objList(list) RETURNS: direction(string) - horizontal/vertical >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> """ #make locators in case we're using something like joints locList = [] for obj in objList: locList.append(locators.locMeObject(obj)) box = distance.returnBoundingBoxSize(locList) maxIndex = box.index(max(box)) if maxIndex == 1: generalDirection = 'vertical' else: generalDirection = 'horizontal' #delete our locators for loc in locList: mc.delete(loc) return generalDirection
def returnLocalAimDirection(rootObj, aimObj): """ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION: Returns a local aim direction ARGUMENTS: rootObj(string) aimObj(string) RETURNS: direction(list) - [0,0,0] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> """ directionalLocArray = [] locGroups = [] directions = ['+x', '-x', '+y', '-y', '+z', '-z'] returnDirections = [[1, 0, 0], [-1, 0, 0], [0, 1, 0], [0, -1, 0], [0, 0, 1], [0, 0, -1]] distanceBuffer = distance.returnDistanceBetweenObjects(rootObj, aimObj) #distanceValues = distanceBuffer /2 cnt = 0 for direction in directions: locBuffer = locators.locMeObject(rootObj) locBuffer = mc.rename(locBuffer, (locBuffer + '_' + str(cnt))) locGroups.append(rigging.groupMeObject(locBuffer)) directionBuffer = list(direction) if directionBuffer[0] == '-': mc.setAttr((locBuffer + '.t' + directionBuffer[1]), -1) else: mc.setAttr((locBuffer + '.t' + directionBuffer[1]), 1) directionalLocArray.append(locBuffer) cnt += 1 closestLoc = distance.returnClosestObject(aimObj, directionalLocArray) matchIndex = directionalLocArray.index(closestLoc) for grp in locGroups: mc.delete(grp) return returnDirections[matchIndex]
def ObjectFacesToFolicles(): try: import parentConstraintToSurface except: "Can't find parentConstraintToSurface" selection = mc.ls(sl=True) or [] if not selection: return "Nothing selected" #If we're going, create a return set returnSet = SetFactory.SetFactory('folicledLocs','td',True) # Make some groups mLocGroup = mc.group(em=True,name = 'locators_grp') number = len(selection) returnList = [] for i,o in enumerate(selection): guiFactory.report("On %s. %s of %s"%(o,i,number)) faceBuffer = "%s.f[4]"%o if not mc.objExists(faceBuffer): print "'%s' has no face!"%o loc = locators.locMeObject(faceBuffer) returnSet.store(loc) mc.select(cl=True) mc.select(loc,o) parentConstraintToSurface.parentConstraintToSurface() rigging.doParentReturnName(loc,mLocGroup) follicles = mc.ls(type='follicle') mc.select(follicles) mc.group(name = 'folicles_grp')
def doPointAimConstraintObjectGroup(targets,object,mode=0): """ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ACKNOWLEDGEMENT: Idea for this stype of constraint setup is from http://td-matt.blogspot.com/2011/01/spine-control-rig.html DESCRIPTION: Groups an object and constrains that group to the other objects ARGUMENTS: targets(list) - should be in format of from to back with the last one being the aim object object(string) mode(int) - 0 - equal influence 1 - distance spread RETURNS: group(string) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> """ returnList = [] """ figure out which is the aim direction """ aimVector = logic.returnLocalAimDirection(object,targets[-1]) upVector = logic.returnLocalUp(aimVector) """ create locators """ locs = [] toMake = ['point','aim','up'] for type in toMake: locBuffer = locators.locMeObject(object) attributes.storeInfo(locBuffer,'cgmName',object) attributes.storeInfo(locBuffer,'cgmTypeModifier',type) locs.append(NameFactory.doNameObject(locBuffer)) pointLoc = locs[0] aimLoc = locs[1] upLoc = locs[2] """ move the locators """ mc.xform(aimLoc,t=aimVector,r=True,os=True) mc.xform(upLoc,t=upVector,r=True,os=True) """group constraint""" objGroup = rigging.groupMeObject(object,True,True) attributes.storeInfo(objGroup,'cgmName',object) attributes.storeInfo(objGroup,'cgmTypeModifier','follow') objGroup = NameFactory.doNameObject(objGroup) pointConstraintBuffer = mc.pointConstraint (pointLoc,objGroup, maintainOffset=False) aimConstraintBuffer = mc.aimConstraint(aimLoc,objGroup,maintainOffset = False, weight = 1, aimVector = aimVector, upVector = upVector, worldUpObject = upLoc, worldUpType = 'object' ) """loc constraints""" locConstraints = [] for loc in locs: parentConstraintBuffer = mc.parentConstraint (targets,loc, maintainOffset=True) locConstraints.append(parentConstraintBuffer[0]) if mode == 1: distances = [] for target in targets: distances.append(distance.returnDistanceBetweenObjects(target,objGroup)) normalizedDistances = cgmMath.normList(distances) for constraint in locConstraints: targetWeights = mc.parentConstraint(constraint,q=True, weightAliasList=True) cnt=1 for value in normalizedDistances: mc.setAttr(('%s%s%s' % (constraint,'.',targetWeights[cnt])),value ) cnt-=1 returnList.append(objGroup) returnList.append(locs) return returnList
def match_orientation(obj=None, source=None, rotateOrder=True, rotateAxis=True): """ Copy the axis from one object to another. For rotation axis -- a locator is created from the source to get local space values for pushing to the rotate axis of the obj object. We do this cleanly by removing children from our obj during our processing and then reparenting at the end as well as restoring shapes from a place holder duplicate. :parameters: obj(str): Object to modify sourceObject(str): object to copy from rotateOrder(bool): whether to copy the rotateOrder while preserving rotations rotateAxis(bool): whether to copy the rotateAxis :returns success(bool) """ _str_func = 'match_orientation' obj = VALID.mNodeString(obj) source = VALID.mNodeString(source) log.debug("|{0}| >> obj:{1}".format(_str_func, obj)) log.debug("|{0}| >> source:{1}".format(_str_func, source)) log.debug("|{0}| >> rotateOrder:{1}".format(_str_func, rotateOrder)) log.debug("|{0}| >> rotateAxis:{1}".format(_str_func, rotateAxis)) if not rotateOrder and not rotateAxis: raise ValueError, "|{0}| >> Both rotateOrder and rotateAxis are False. Nothing to do...".format( _str_func) #First gather children to parent away and shapes so they don't get messed up either _l_children = mc.listRelatives(obj, children=True, type='transform') or [] _l_shapes = mc.listRelatives(obj, shapes=True, fullPath=True) or [] _dup = False log.debug("|{0}| >> children:{1}".format(_str_func, _l_children)) log.debug("|{0}| >> shapes:{1}".format(_str_func, _l_shapes)) if _l_children: #...parent children to world as we'll be messing with stuff for i, c in enumerate(_l_children): _l_children[i] = parent_set(c, False) log.debug("|{0}| >> children:{1}".format(_str_func, _l_children)) if _l_shapes: #...dup our shapes to properly shape parent them back _dup = mc.duplicate(obj, parentOnly=True)[0] log.debug("|{0}| >> dup:{1}".format(_str_func, _dup)) for s in _l_shapes: shapeParent_in_place(_dup, s, keepSource=False) #The meat of it... _restorePivotRP = False _restorePivotSP = False if rotateAxis: log.debug("|{0}| >> rotateAxis...".format(_str_func)) #There must be a better way to do this. Storing to be able to restore after matrix ops _restorePivotRP = mc.xform(obj, q=True, ws=True, rp=True) _restorePivotSP = mc.xform(obj, q=True, ws=True, sp=True) _restoreRO = mc.xform(obj, q=True, roo=True) #We do our stuff with a locator to get simple transferrable values after matching parents and what not... loc = locators.locMeObject(source) #..match ro before starting to do values parent_set(loc, parent_get(obj)) #...match parent mc.xform(loc, ws=True, t=mc.xform(obj, q=True, ws=True, rp=True)) #...snap #mc.xform(loc, roo = mc.xform (obj, q=True, roo=True ), p=True)#...match rotateOrder mc.xform(loc, roo='xyz', p=True) mc.xform(obj, roo='xyz', p=True) mc.makeIdentity(obj, a=True, rotate=True) #...push matrix _matrix = mc.xform(loc, q=True, m=True) mc.xform(obj, m=_matrix) objRot = mc.xform(obj, q=True, os=True, ro=True) mc.xform(obj, ra=[v for v in objRot], os=True) mc.xform(obj, os=True, ro=[0, 0, 0]) #...clear""" mc.delete(loc) mc.xform(obj, roo=_restoreRO) mc.xform(obj, ws=True, rp=_restorePivotRP) mc.xform(obj, ws=True, sp=_restorePivotSP) if rotateOrder: log.debug("|{0}| >> rotateOrder...".format(_str_func)) mc.xform(obj, roo=mc.xform(source, q=True, roo=True), p=True) #...match rotateOrder if _dup: log.debug("|{0}| >> shapes back...: {1}".format(_str_func, _l_shapes)) #mc.delete(_l_shapes) shapeParent_in_place(obj, _dup) mc.delete(_dup) for c in _l_children: log.debug("|{0}| >> parent back...: '{1}'".format(_str_func, c)) log.debug("|{0}| >> obj:{1}".format(_str_func, obj)) parent_set(c, obj) return True
def doPointAimConstraintObjectGroup(targets, object, mode=0): """ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ACKNOWLEDGEMENT: Idea for this stype of constraint setup is from http://td-matt.blogspot.com/2011/01/spine-control-rig.html DESCRIPTION: Groups an object and constrains that group to the other objects ARGUMENTS: targets(list) - should be in format of from to back with the last one being the aim object object(string) mode(int) - 0 - equal influence 1 - distance spread RETURNS: group(string) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> """ returnList = [] """ figure out which is the aim direction """ aimVector = logic.returnLocalAimDirection(object, targets[-1]) upVector = logic.returnLocalUp(aimVector) """ create locators """ locs = [] toMake = ['point', 'aim', 'up'] for type in toMake: locBuffer = locators.locMeObject(object) attributes.storeInfo(locBuffer, 'cgmName', object) attributes.storeInfo(locBuffer, 'cgmTypeModifier', type) locs.append(NameFactory.doNameObject(locBuffer)) pointLoc = locs[0] aimLoc = locs[1] upLoc = locs[2] """ move the locators """ mc.xform(aimLoc, t=aimVector, r=True, os=True) mc.xform(upLoc, t=upVector, r=True, os=True) """group constraint""" objGroup = rigging.groupMeObject(object, True, True) attributes.storeInfo(objGroup, 'cgmName', object) attributes.storeInfo(objGroup, 'cgmTypeModifier', 'follow') objGroup = NameFactory.doNameObject(objGroup) pointConstraintBuffer = mc.pointConstraint(pointLoc, objGroup, maintainOffset=False) aimConstraintBuffer = mc.aimConstraint(aimLoc, objGroup, maintainOffset=False, weight=1, aimVector=aimVector, upVector=upVector, worldUpObject=upLoc, worldUpType='object') """loc constraints""" locConstraints = [] for loc in locs: parentConstraintBuffer = mc.parentConstraint(targets, loc, maintainOffset=True) locConstraints.append(parentConstraintBuffer[0]) if mode == 1: distances = [] for target in targets: distances.append( distance.returnDistanceBetweenObjects(target, objGroup)) normalizedDistances = cgmMath.normList(distances) for constraint in locConstraints: targetWeights = mc.parentConstraint(constraint, q=True, weightAliasList=True) cnt = 1 for value in normalizedDistances: mc.setAttr(('%s%s%s' % (constraint, '.', targetWeights[cnt])), value) cnt -= 1 returnList.append(objGroup) returnList.append(locs) return returnList
def getCurveMirrorData(self,mi_crv): d_return = {} d_return['f_bbMin'] = mi_crv.boundingBoxMin[self.int_across] d_return['f_bbMax'] = mi_crv.boundingBoxMax[self.int_across] d_return['b_oneSided'] = False d_return['b_balanced'] = False d_return['b_weighted'] = None #> First see our push direction ---------------------------------------------------------- try: if cgmMath.isFloatEquivalent( d_return['f_bbMax'], d_return['f_bbMin']): d_return['b_balanced'] = 1 if d_return['f_bbMax'] > d_return['f_bbMin']: d_return['b_weighted'] = 1 elif d_return['f_bbMax'] < d_return['f_bbMin']: d_return['b_weighted'] = -1 except Exception,error:raise StandardError,"Push direction check | %s"%error #> Check thresholds ---------------------------------------------------------------------- try: if -d_return['f_bbMin'] <= self.f_threshold and d_return['f_bbMax'] >= self.f_threshold or d_return['f_bbMin'] <= -self.f_threshold and d_return['f_bbMax'] <= -self.f_threshold: d_return['b_oneSided'] = True """if abs(d_return['f_bbMin']) <= self.f_threshold or abs(d_return['f_bbMax']) <= self.f_threshold: d_return['b_oneSided'] = True""" except Exception,error:raise StandardError,"Threshholds check | %s"%error #> Is ep -------------------------------------------------------------------- try: d_return['b_epState'] = isEP(mi_crv) except Exception,error:raise StandardError,"ep check | %s"%error #> Get positions ------------------------------------------------------------------------- try: l_cvs = mi_crv.getComponents('cv') l_cvPos = [] l_epPos = [] if d_return['b_epState']: for ep in mi_crv.getComponents('ep'): pos = mc.pointPosition(ep,w=True) l_epPos.append( pos ) for cv in l_cvs: l_cvPos.append( mc.pointPosition(cv,w=True) ) else: for cv in l_cvs: l_cvPos.append( mc.pointPosition(cv,w=True) ) #Get an ep value locatorName = locators.locMeObject(cv) pos = distance.returnClosestUPosition(locatorName,mi_crv.mNode) mc.delete(locatorName) l_epPos.append( pos ) d_return['l_cvPos'] = l_cvPos d_return['l_epPos'] = l_epPos d_return['l_cvs'] = l_cvs except Exception,error:raise StandardError,"Get positions | %s"%error #> Is even -------------------------------------------------------------------- try: if len(l_cvs)%2==0:#even d_return['b_even'] = True else: d_return['b_even'] = False except Exception,error:"Even check | %s"%error #> Which end is bigger try: if abs(l_cvPos[0][self.int_across]) <= self.f_threshold: d_return['b_startInThreshold'] = True else:d_return['b_startInThreshold'] = False if abs(l_cvPos[-1][self.int_across]) <= self.f_threshold: d_return['b_endInThreshold'] = True else:d_return['b_endInThreshold'] = False except Exception,error:raise StandardError,"End check | %s"%error return d_return
def doCreateStartingPositionLoc(self, modeType='child', workingObject=None, aimingObject=None, cvIndex = None ): """ >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> DESCRIPTION: Adds a locator setup to duplicate to get our initial position locators. All should be zeroed out. The top node of the return group has the loctor and move group connected is message nodes if needed. ARGUMENTS: modeType(string) child - basic child locator to the workingObject innerChild - aims locator from the working to the aiming curves cvBack - works off working curves cvIndex. Places it and aiming it back on z. Mainly used for tails radialOut - Works off working curve cv for position and radial orientation. It's transform group is oriented to the aiming curves equivalent cv. Good for arms radialDown - same as radial out but locator orientation is y down zup for legs. transform orientation is the same as radial out footBase - looking for it's module Parent's last loc to start from parentDuplicate - looking for it's module Parent's last loc to start from workingObject(string) - usually the sizing objects start curve (can be a locator for parentchild loc) aimingObject(string) - usually the sizing objects end curve cvIndex(int) - cv to work off of RETURNS: returnList(list) = [rootHelper(string),helperObjects(list),helperObjectGroups(list)] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> """ if modeType == 'child': """ make initial loc and orient it """ returnLoc = [] curveShapes = mc.listRelatives(workingObject, shapes = True) startLoc = locators.locMeObject(workingObject) aimLoc = locators.locMeObject(workingObject) upLoc = locators.locMeCvFromCvIndex(curveShapes[0],0) startLoc = mc.rename(startLoc,(self.ModuleNull.nameBase+'child_startLoc')) StartLoc = ObjectFactory(startLoc) sizeObjectLength = distance.returnDistanceBetweenObjects(workingObject,aimingObject) mc.xform(aimLoc,t=[0,0,sizeObjectLength],r=True,os=True) aimConstraintBuffer = mc.aimConstraint(aimLoc,startLoc,maintainOffset = False, weight = 1, aimVector = [0,0,1], upVector = [0,1,0], worldUpObject = upLoc, worldUpType = 'object' ) mc.delete(aimConstraintBuffer[0]) mc.delete(upLoc) mc.delete(aimLoc) zeroGroup = StartLoc.doGroup() returnLoc.append(StartLoc.nameLong) attributes.storeInfo(zeroGroup,'locator',startLoc) returnLoc.append(zeroGroup) return returnLoc elif modeType == 'innerChild': """ make initial lock and orient it """ returnLoc = [] curveShapes = mc.listRelatives(workingObject, shapes = True) startLoc = locators.locMeObject(workingObject) aimLoc = locators.locMeObject(aimingObject) upLoc = locators.locMeCvFromCvIndex(curveShapes[0],0) startLoc = mc.rename(startLoc, (self.ModuleNull.nameBase+'_innerChild_startLoc')) StartLoc = ObjectFactory(startLoc) aimConstraintBuffer = mc.aimConstraint(aimLoc,startLoc,maintainOffset = False, weight = 1, aimVector = [0,0,1], upVector = [0,1,0], worldUpObject = upLoc, worldUpType = 'object' ) mc.delete(aimConstraintBuffer[0]) mc.delete(upLoc) mc.delete(aimLoc) zeroGroup = StartLoc.doGroup() returnLoc.append(StartLoc.nameLong) #zeroGroup = rigging.zeroTransformMeObject(startLoc) #attributes.storeInfo(zeroGroup,'locator',startLoc) returnLoc.append(zeroGroup) return returnLoc elif modeType == 'cvBack': returnLoc = [] curveShapes = mc.listRelatives(workingObject, shapes = True) startLoc = locators.locMeCvFromCvIndex(curveShapes[0],cvIndex) upLoc = locators.locMeObject(workingObject) initialAimLoc = locators.locMeObject(aimingObject) aimConstraintBuffer = mc.aimConstraint(initialAimLoc,startLoc,maintainOffset = False, weight = 1, aimVector = [0,0,-1], upVector = [0,-1,0], worldUpObject = upLoc, worldUpType = 'object', skip = ['x','z']) mc.delete(aimConstraintBuffer[0]) mc.delete(initialAimLoc) aimLoc = locators.locMeCvFromCvIndex(curveShapes[0],cvIndex) startLoc = mc.rename(startLoc, (self.ModuleNull.nameBase+'_radialBackl_startLoc')) StartLoc = ObjectFactory(startLoc) sizeObjectLength = distance.returnDistanceBetweenObjects(workingObject,aimingObject) mc.xform(aimLoc,t=[0,0,-sizeObjectLength],r=True,ws=True) aimConstraintBuffer = mc.aimConstraint(aimLoc,startLoc,maintainOffset = False, weight = 1, aimVector = [0,0,1], upVector = [0,1,0], worldUpType = 'vector' ) mc.delete(aimConstraintBuffer[0]) mc.delete(aimLoc) mc.delete(upLoc) returnLoc.append(startLoc) zeroGroup = StartLoc.doGroup() returnLoc.append(StartLoc.nameLong) return returnLoc elif modeType == 'radialOut': sizeObjectLength = distance.returnDistanceBetweenObjects(workingObject,aimingObject) returnLoc = [] workingObjectShapes = mc.listRelatives(workingObject, shapes = True) aimingObjectShapes = mc.listRelatives(aimingObject, shapes = True) """initial loc creation and orientation""" startLoc = locators.locMeCvFromCvIndex(workingObjectShapes[0],cvIndex) startLocAim = locators.locMeObject(workingObject) startLocUp = locators.locMeCvFromCvIndex(workingObjectShapes[0],cvIndex) startLoc = mc.rename(startLoc, (self.ModuleNull.nameBase+'_radialOut_startLoc')) StartLoc = ObjectFactory(startLoc) """ move the up loc up """ mc.xform(startLocUp,t=[0,sizeObjectLength,0],r=True,ws=True) """ aim it """ aimConstraintBuffer = mc.aimConstraint(startLocAim,startLoc,maintainOffset = False, weight = 1, aimVector = [0,0,-1], upVector = [0,1,0], worldUpType = 'vector' ) mc.delete(aimConstraintBuffer[0]) mc.delete(startLocUp) """ setup the transform group""" transformGroup = rigging.groupMeObject(startLoc,False) transformGroup = mc.rename(transformGroup,('%s%s' %(startLoc,'_moveGroup'))) groupUp = startLocAim groupAim = locators.locMeCvFromCvIndex(aimingObjectShapes[0],cvIndex) """aim it""" aimConstraintBuffer = mc.aimConstraint(groupAim,transformGroup,maintainOffset = False, weight = 1, aimVector = [0,0,1], upVector = [0,-1,0], worldUpObject = groupUp, worldUpType = 'object') mc.delete(aimConstraintBuffer[0]) mc.delete(groupUp) mc.delete(groupAim) startLoc = rigging.doParentReturnName(startLoc,transformGroup) rigging.zeroTransformMeObject(startLoc) returnLoc.append(startLoc) returnLoc.append(transformGroup) zeroGroup = rigging.groupMeObject(transformGroup) attributes.storeInfo(zeroGroup,'move',transformGroup) returnLoc.append(zeroGroup) return returnLoc elif modeType == 'radialDown': sizeObjectLength = distance.returnDistanceBetweenObjects(workingObject,aimingObject) returnLoc = [] workingObjectShapes = mc.listRelatives(workingObject, shapes = True) aimingObjectShapes = mc.listRelatives(aimingObject, shapes = True) """initial loc creation and orientation""" startLoc = locators.locMeCvFromCvIndex(workingObjectShapes[0],cvIndex) startLocAim = locators.locMeCvFromCvIndex(workingObjectShapes[0],cvIndex) startLoc = mc.rename(startLoc, (self.ModuleNull.nameBase+'_radialDown_startLoc')) StartLoc = ObjectFactory(startLoc) """ move the up loc up """ mc.xform(startLocAim,t=[0,-sizeObjectLength,0],r=True, ws=True) """ aim it """ aimConstraintBuffer = mc.aimConstraint(startLocAim,startLoc,maintainOffset = False, weight = 1, aimVector = [0,0,1], upVector = [0,0,1], worldUpType = 'vector' ) mc.delete(aimConstraintBuffer[0]) """ setup the transform group""" transformGroup = rigging.groupMeObject(startLoc,False) transformGroup = mc.rename(transformGroup,('%s%s' %(startLoc,'_moveGroup'))) groupUp = startLocAim groupAim = locators.locMeCvFromCvIndex(aimingObjectShapes[0],cvIndex) """aim it""" aimConstraintBuffer = mc.aimConstraint(groupAim,transformGroup,maintainOffset = False, weight = 1, aimVector = [0,0,1], upVector = [0,-1,0], worldUpObject = groupUp, worldUpType = 'object') mc.delete(aimConstraintBuffer[0]) mc.delete(groupUp) mc.delete(groupAim) startLoc = rigging.doParentReturnName(startLoc,transformGroup) rigging.zeroTransformMeObject(startLoc) returnLoc.append(startLoc) returnLoc.append(transformGroup) zeroGroup = rigging.groupMeObject(transformGroup) attributes.storeInfo(zeroGroup,'move',transformGroup) returnLoc.append(zeroGroup) return returnLoc elif modeType == 'footBase': returnLoc = [] startLoc = locators.locMeObject(workingObject) startLoc = mc.rename(startLoc,(self.ModuleNull.nameBase+'_footcgmase_startLoc')) StartLoc = ObjectFactory(startLoc) masterGroup = rigging.groupMeObject(startLoc) mc.setAttr((startLoc+'.rx'),-90) returnLoc.append(startLoc) zeroGroup = rigging.zeroTransformMeObject(startLoc) currentPos = mc.xform(zeroGroup,q=True, t=True,ws=True) mc.xform(zeroGroup,t=[currentPos[0],0,currentPos[2]], ws = True) attributes.storeInfo(zeroGroup,'locator',startLoc) returnLoc.append(zeroGroup) returnLoc.append(masterGroup) return returnLoc elif modeType == 'parentDuplicate': returnLoc = [] startLoc = locators.locMeObject(workingObject) startLoc = mc.rename(startLoc,(self.ModuleNull.nameBase+'_parentDup_startLoc')) StartLoc = ObjectFactory(startLoc) masterGroup = rigging.groupMeObject(startLoc) returnLoc.append(startLoc) returnLoc.append(masterGroup) return returnLoc else: return False