Example #1
0
        def build_fk(self):
            #>>>> FK Segments
            ml_fkJoints = self.ml_fkJoints
            ml_controlsFK = self.ml_controlsFK

            ml_fkJoints[0].parent = self._go._i_constrainNull.controlsFK.mNode

            i_obj = ml_controlsFK[0]
            log.info(" %s controlFK : %s"%(self._str_reportStart,i_obj.p_nameShort))
            log.info(" %s controlFK : %s"%(self._str_reportStart,ml_fkJoints[0].p_nameShort))	    
            try:
                d_buffer = mControlFactory.registerControl(i_obj.mNode,shapeParentTo=ml_fkJoints[0].mNode,
                                                           mirrorSide=self._go._str_mirrorDirection, mirrorAxis="translateX",		                                           
                                                           makeAimable=True,typeModifier='fk') 
            except Exception,error: raise Exception,"Register control | %s"%error

            try:
                i_obj = d_buffer['instance']
                i_obj.axisAim = "%s+"%self._go._jointOrientation[0]
                i_obj.axisUp= "%s+"%self._go._jointOrientation[1]	
                i_obj.axisOut= "%s+"%self._go._jointOrientation[2]
                try:i_obj.drawStyle = 2#Stick joint draw style	    
                except:self.log_error("{0} Failed to set drawStyle".format(i_obj.p_nameShort))
                cgmMeta.cgmAttr(i_obj,'radius',hidden=True)
            except Exception,error: raise Exception,"Failed to set attrs | %s"%error

            try:
                for i_obj in ml_controlsFK:
                    i_obj.delete()
            except Exception,error: raise Exception,"Failed to delete | %s"%error

            self.ml_controlsAll.extend([ml_fkJoints[0]])	
Example #2
0
        def _buildPupilIris_(self):
            mi_go = self._go#Rig Go instance link
            str_mirrorSide = self.str_mirrorSide

            try:#>>>> Iris pupil #==================================================================	
                try:
                    _l_build = [{'tag':'iris','buildCheck':self.mi_helper.buildIris,'shape':self.md_rigList['iris_shape'],'joint':self.md_rigList['iris'],'parent':self.md_rigList['eye']},
                                {'tag':'pupil','buildCheck':self.mi_helper.buildPupil,'shape':self.md_rigList['pupil_shape'],'joint':self.md_rigList['pupil'],'parent':self.md_rigList['iris']}]
                except Exception,error:raise Exception,"[build dict]{%s}"%(error)

                for _d in _l_build:
                    try:
                        self._d_buffer = _d
                        self.log_infoNestedDict('_d_buffer')
                        _tag = _d['tag']
                        _shape = _d['shape']
                        _joint = _d['joint']
                        _b_buildCheck = _d['buildCheck']

                        if not _b_buildCheck:
                            self.log_info("Build %s toggle: off"%(_tag))
                            _shape.delete()

                        else:
                            _joint.parent =  mi_go._i_constrainNull.eyeTrackNull.mNode
                            d_buffer = mControlFactory.registerControl(_joint,useShape = _shape,
                                                                       mirrorSide = str_mirrorSide, mirrorAxis="",
                                                                       makeAimable=True,setRotateOrder ='zxy') 	    

                            mi_control = d_buffer['instance']
                            _shape.delete()

                            attributes.doSetAttr(mi_control.mNode,'overrideEnabled',0)
                            attributes.doSetAttr(mi_control.mNode,'overrideDisplayType',0)
                            cgmMeta.cgmAttr(mi_control,'radius',.0001,hidden=True)
                            mi_go._i_rigNull.connectChildNode(mi_control,'control%s'%_tag.capitalize(),"rigNull")
                            self.ml_controlsAll.append(mi_control)	
                            attributes.doSetLockHideKeyableAttr(mi_control.mNode,channels=['tx','ty','tz','rx','ry','rz','v','s%s'%mi_go._jointOrientation[0]])				
                    except Exception,error:raise Exception,"[%s]{%s}"%(_tag,error)
            except Exception,error:raise Exception,"[Build iris/pupil fail]{%s}"%(error)
Example #3
0
        def build_fk(self):
            #>>>> FK Segments
            ml_fkJoints = self.ml_fkJoints
            ml_controlsFK = self.ml_controlsFK

            ml_fkJoints[0].parent = self._go._i_constrainNull.controlsFK.mNode

            i_obj = ml_controlsFK[0]
            log.info(" %s controlFK : %s" %
                     (self._str_reportStart, i_obj.p_nameShort))
            log.info(" %s controlFK : %s" %
                     (self._str_reportStart, ml_fkJoints[0].p_nameShort))
            try:
                d_buffer = mControlFactory.registerControl(
                    i_obj.mNode,
                    shapeParentTo=ml_fkJoints[0].mNode,
                    mirrorSide=self._go._str_mirrorDirection,
                    mirrorAxis="translateX",
                    makeAimable=True,
                    typeModifier='fk')
            except Exception, error:
                raise Exception, "Register control | %s" % error
Example #4
0
#=======================================================
m1 = cgmPM.cgmModule(name='test')
m1 = r9Meta.MetaClass('spine_part')
m1.setState('skeleton')
m1.getPartNameBase()
m1.modulePuppet.getGeo()
mObj = cgmMeta.cgmObject(control)
i_loc = mObj.doLoc()
i_loc.rx = i_loc.rx + 90
mObj.doCopyTransform(i_loc.mNode)
mObj.mNode
mObj.getAttr('asdfasdf')

#>>> Testing control registering
control = 'cog_controlCurve'
mControlFactory.registerControl(mc.ls(sl=True)[0])
mControlFactory.registerControl(control)
for i in range(2):
    log.info(i)


class dataHolder(object):
    pass


l_targetObjects = mc.ls(sl=True)
log.info(cgmMeta.cgmObject(mc.ls(sl=True)[0]).getNameDict())
log.info(cgmMeta.cgmObject(mc.ls(sl=True)[0]).doName())

str_control = 'neck_2_anim'
mControlFactory.registerControl(str_control,
from cgm.core.rigger import ModuleControlFactory as mControlFactory
reload(mControlFactory)
from cgm.lib import search
obj = mc.ls(sl=True)[0] or False
obj = ''
objList = []

#>>> Modules
#=======================================================
m1 = cgmPM.cgmModule(name = 'test')
m1 = r9Meta.MetaClass('spine_part')
m1.setState('skeleton')
m1.getPartNameBase()
m1.modulePuppet.getGeo()
mObj = cgmMeta.cgmObject(control)
i_loc = mObj.doLoc()
i_loc.rx = i_loc.rx + 90
mObj.doCopyTransform(i_loc.mNode)
mObj.mNode
mObj.getAttr('asdfasdf')
#>>> Testing control registering
control = 'shoulders_ikCurve'
mControlFactory.registerControl(mc.ls(sl=True)[0])
mControlFactory.registerControl(control,copyPivot='spine_2_segIKCurve')
for i in range(2):log.info(i)
class dataHolder(object):
    pass
l_targetObjects = mc.ls(sl=True)
log.info(cgmMeta.cgmObject(mc.ls(sl=True)[0]).getNameDict())
log.info(cgmMeta.cgmObject(mc.ls(sl=True)[0]).doName())
Example #6
0
        def _buildPupilIris_(self):
            mi_go = self._go  #Rig Go instance link
            str_mirrorSide = self.str_mirrorSide

            try:  #>>>> Iris pupil #==================================================================
                try:
                    _l_build = [{
                        'tag': 'iris',
                        'buildCheck': self.mi_helper.buildIris,
                        'shape': self.md_rigList['iris_shape'],
                        'joint': self.md_rigList['iris'],
                        'parent': self.md_rigList['eye']
                    }, {
                        'tag': 'pupil',
                        'buildCheck': self.mi_helper.buildPupil,
                        'shape': self.md_rigList['pupil_shape'],
                        'joint': self.md_rigList['pupil'],
                        'parent': self.md_rigList['iris']
                    }]
                except Exception, error:
                    raise Exception, "[build dict]{%s}" % (error)

                for _d in _l_build:
                    try:
                        self._d_buffer = _d
                        self.log_infoNestedDict('_d_buffer')
                        _tag = _d['tag']
                        _shape = _d['shape']
                        _joint = _d['joint']
                        _b_buildCheck = _d['buildCheck']

                        if not _b_buildCheck:
                            self.log_info("Build %s toggle: off" % (_tag))
                            _shape.delete()

                        else:
                            _joint.parent = mi_go._i_constrainNull.eyeTrackNull.mNode
                            d_buffer = mControlFactory.registerControl(
                                _joint,
                                useShape=_shape,
                                mirrorSide=str_mirrorSide,
                                mirrorAxis="",
                                makeAimable=True,
                                setRotateOrder='zxy')

                            mi_control = d_buffer['instance']
                            _shape.delete()

                            attributes.doSetAttr(mi_control.mNode,
                                                 'overrideEnabled', 0)
                            attributes.doSetAttr(mi_control.mNode,
                                                 'overrideDisplayType', 0)
                            cgmMeta.cgmAttr(mi_control,
                                            'radius',
                                            .0001,
                                            hidden=True)
                            mi_go._i_rigNull.connectChildNode(
                                mi_control, 'control%s' % _tag.capitalize(),
                                "rigNull")
                            self.ml_controlsAll.append(mi_control)
                            attributes.doSetLockHideKeyableAttr(
                                mi_control.mNode,
                                channels=[
                                    'tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'v',
                                    's%s' % mi_go._jointOrientation[0]
                                ])
                    except Exception, error:
                        raise Exception, "[%s]{%s}" % (_tag, error)
Example #7
0
                mi_fkShape = self.md_rigList['fk_shape']
                mi_ikShape = self.md_rigList['ik_shape']
                mi_settingsShape = self.md_rigList['settings_shape']
                mi_eyeMoveShape = self.md_rigList['eyeMove_shape']
                str_mirrorSide = self.str_mirrorSide
            except Exception, error:
                raise Exception, "[Query]{%s}" % error

            try:  #>>>> FK #==================================================================
                mi_fkShape.parent = mi_go._i_constrainNull.controlsFKNull.mNode
                i_obj = mi_fkShape
                d_buffer = mControlFactory.registerControl(
                    i_obj,
                    copyTransform=ml_rigJoints[0],
                    mirrorSide=str_mirrorSide,
                    mirrorAxis="rotateY,rotateZ",
                    makeAimable=True,
                    setRotateOrder='zxy',
                    typeModifier='fk')
                mi_controlFK = d_buffer['instance']
                mi_controlFK.axisAim = "%s+" % mi_go._jointOrientation[0]
                mi_controlFK.axisUp = "%s+" % mi_go._jointOrientation[1]
                mi_controlFK.axisOut = "%s+" % mi_go._jointOrientation[2]

                #We're gonna lock the aim rot
                cgmMeta.cgmAttr(mi_controlFK,
                                'r%s' % mi_go._jointOrientation[0],
                                keyable=False,
                                lock=True,
                                hidden=True)
                mi_go._i_rigNull.connectChildNode(mi_controlFK, 'controlFK',
Example #8
0
        def _buildControls_(self):
            mi_go = self._go#Rig Go instance link

            try:#Query ====================================================================================
                ml_rigJoints = self.ml_rigJoints

                mi_fkShape = self.md_rigList['fk_shape']
                mi_ikShape = self.md_rigList['ik_shape']
                mi_settingsShape = self.md_rigList['settings_shape']
                mi_eyeMoveShape = self.md_rigList['eyeMove_shape']
                str_mirrorSide = self.str_mirrorSide
            except Exception,error:raise Exception,"[Query]{%s}"%error	


            try:#>>>> FK #==================================================================	
                mi_fkShape.parent = mi_go._i_constrainNull.controlsFKNull.mNode
                i_obj = mi_fkShape
                d_buffer = mControlFactory.registerControl(i_obj,copyTransform = ml_rigJoints[0],
                                                           mirrorSide = str_mirrorSide, mirrorAxis="rotateY,rotateZ",
                                                           makeAimable=True,setRotateOrder ='zxy',typeModifier='fk') 	    
                mi_controlFK = d_buffer['instance']
                mi_controlFK.axisAim = "%s+"%mi_go._jointOrientation[0]
                mi_controlFK.axisUp= "%s+"%mi_go._jointOrientation[1]	
                mi_controlFK.axisOut= "%s+"%mi_go._jointOrientation[2]

                #We're gonna lock the aim rot
                cgmMeta.cgmAttr(mi_controlFK,'r%s'%mi_go._jointOrientation[0], keyable = False, lock=True,hidden=True)
                mi_go._i_rigNull.connectChildNode(mi_controlFK,'controlFK',"rigNull")
                self.ml_controlsAll.append(mi_controlFK)	

                attributes.doSetLockHideKeyableAttr(mi_controlFK.mNode,channels=['tx','ty','tz','sx','sy','sz','v'])				

            except Exception,error:raise Exception,"[Build fk fail]{%s}"%(error)

            try:#>>>> IK 
                #==================================================================	
                mi_ikShape.parent = mi_go._i_constrainNull.controlsIKNull.mNode	
                d_buffer = mControlFactory.registerControl(mi_ikShape,
                                                           mirrorSide = str_mirrorSide, mirrorAxis="",		                                           
                                                           typeModifier='ik',addDynParentGroup=True) 	    
                mi_ikControl = d_buffer['instance']	

                mi_go._i_rigNull.connectChildNode(mi_ikControl,'controlIK',"rigNull")
                self.ml_controlsAll.append(mi_ikControl)
                attributes.doSetLockHideKeyableAttr(mi_ikControl.mNode,channels=['sx','sy','sz','v'])				

            except Exception,error:raise Exception,"[Build ik fail]{%s}"%(error)


            try:#>>>> Settings
                #==================================================================	
                mi_settingsShape.parent = mi_go._i_constrainNull.mNode

                try:#Register the control
                    d_buffer = mControlFactory.registerControl(mi_settingsShape,
                                                               mirrorSide = str_mirrorSide, mirrorAxis="",		                                           		                                               
                                                               makeAimable=False,typeModifier='settings') 
                    mi_settings = d_buffer['instance']
                    mi_go._i_rigNull.connectChildNode(mi_settings,'settings','rigNull')
                    self.ml_controlsAll.append(mi_settings)

                    #>>> Verify out vis controls	    
                    self.mPlug_result_moduleFaceSubDriver = mi_go.build_visSubFace()		    

                except Exception,error:raise StandardError,"registration | %s"%error	

                try:#Set up some attributes
                    attributes.doSetLockHideKeyableAttr(mi_settings.mNode)
                    mPlug_FKIK = cgmMeta.cgmAttr(mi_settings.mNode,'blend_FKIK',attrType='float',lock=False,keyable=True,
                                                 minValue=0,maxValue=1.0)
                except Exception,error:raise StandardError,"attribute setup | %s"%error	

            except Exception,error:raise Exception,"[Build Settings fail]{%s}"%(error)

            try:#>>>> eyeMove #==================================================================	
                mi_eyeMoveShape.parent = mi_go._i_constrainNull.mNode

                try:#Register the control
                    d_buffer = mControlFactory.registerControl(mi_eyeMoveShape,
                                                               addMirrorAttributeBridges = [["mirrorIn","t%s"%mi_go._jointOrientation[2]],
                                                                                            ["mirrorBank","r%s"%mi_go._jointOrientation[0]]],
                                                               mirrorSide = str_mirrorSide, mirrorAxis="",		                                               
                                                               makeAimable=False,typeModifier='eyeMove') 
                    mObj = d_buffer['instance']
                    mi_go._i_rigNull.connectChildNode(mObj,'eyeMove','rigNull')
                    self.ml_controlsAll.append(mObj)
                except Exception,error:raise Exception,"[registration]{%s}"%(error)

                try:#Set up some attributes
                    attributes.doSetLockHideKeyableAttr(mObj.mNode,channels = ["r%s"%mi_go._jointOrientation[1],"r%s"%mi_go._jointOrientation[2],'v'])
                except Exception,error:raise Exception,"[Attribute setup]{%s}"%(error)

                try:#Vis Connect
                    for shp in mObj.getShapes():
                        mShp = cgmMeta.cgmNode(shp)
                        mShp.overrideEnabled = 1    
                        self.mPlug_result_moduleFaceSubDriver.doConnectOut("%s.overrideVisibility"%mShp.mNode)
                except Exception,error:raise Exception,"[subVisConnect]{%s}"%(error)


            except Exception,error:raise Exception,"[Build Settings fail]{%s}"%(error)
Example #9
0
objList = []

#>>> Modules
#=======================================================
m1 = cgmPM.cgmModule(name='test')
m1 = r9Meta.MetaClass('spine_part')
m1.setState('skeleton')
m1.getPartNameBase()
m1.modulePuppet.getGeo()
mObj = cgmMeta.cgmObject(control)
i_loc = mObj.doLoc()
i_loc.rx = i_loc.rx + 90
mObj.doCopyTransform(i_loc.mNode)
mObj.mNode
mObj.getAttr('asdfasdf')
#>>> Testing control registering
control = 'shoulders_ikCurve'
mControlFactory.registerControl(mc.ls(sl=True)[0])
mControlFactory.registerControl(control, copyPivot='spine_2_segIKCurve')
for i in range(2):
    log.info(i)


class dataHolder(object):
    pass


l_targetObjects = mc.ls(sl=True)
log.info(cgmMeta.cgmObject(mc.ls(sl=True)[0]).getNameDict())
log.info(cgmMeta.cgmObject(mc.ls(sl=True)[0]).doName())
Example #10
0
	def build_old(self):#================================================================================   	
	    
	    if not self._go.isShaped():
		raise Exception,"%s.build_controls>>> needs shapes to build controls"%self._go._strShortName
	    if not self._go.isRigSkeletonized():
		raise Exception,"%s.build_controls>>> needs shapes to build controls"%self._go._strShortName
	    """
	    __d_controlShapes__ = {'shape':['controlsFK','midIK','settings','hand'],
			     'pivot':['toe','heel','ball','inner','outer
	    for shape in __d_controlShapes__['shape']:
		self._go.__dict__['mi_%s'%shape] = cgmMeta.validateObjArg(self._go._i_rigNull.msgList_getMessage('shape_%s'%shape),noneValid=False)
		log.info(self._go.__dict__['mi_%s'%shape] )"""
	    ml_controlsFK = cgmMeta.validateObjListArg(self._go._i_rigNull.msgList_getMessage('shape_controlsFK'),cgmMeta.cgmObject)
	    ml_segmentIK = cgmMeta.validateObjListArg(self._go._i_rigNull.msgList_getMessage('shape_segmentIK'),cgmMeta.cgmObject)
	    #self._go._i_rigNull.msgList_connect(self._go._md_controlShapes['segmentIK'],'shape_segmentIK_%s'%i,"rigNull")		
	    l_segmentIKChains = []
	    ml_segmentIKChains = []
	    for i in range(50):
		buffer = self._go._i_rigNull.msgList_getMessage('shape_segmentIK_%s'%i)
		if buffer:
		    l_segmentIKChains.append(buffer)
		    ml_segmentIKChains.append(cgmMeta.validateObjListArg(buffer,cgmMeta.cgmObject))
		else:
		    break  
		 
	    #mi_midIK = cgmMeta.validateObjArg(self._go._i_rigNull.getMessage('shape_midIK'),cgmMeta.cgmObject)
	    mi_settings= cgmMeta.validateObjArg(self._go._i_rigNull.getMessage('shape_settings'),cgmMeta.cgmObject)
	    ml_fkJoints = cgmMeta.validateObjListArg(self._go._i_rigNull.msgList_getMessage('fkJoints'),cgmMeta.cgmObject)
	    mi_cap = cgmMeta.validateObjArg(self._go._i_rigNull.getMessage('shape_moduleCap'),cgmMeta.cgmObject)
	    
	    log.info("mi_settings: '%s'"%mi_settings.getShortName())
	    log.info("mi_cap: '%s'"%mi_cap.getShortName())    
	    log.info("ml_fkJoints: %s"%[i_o.getShortName() for i_o in ml_fkJoints])
	    
	    #>>>Make a few extra groups for storing controls and what not to in the deform group
	    for grp in ['controlsFK','controlsIK']:
		i_dup = self._go._i_constrainNull.doDuplicateTransform(True)
		i_dup.parent = self._go._i_constrainNull.mNode
		i_dup.addAttr('cgmTypeModifier',grp,lock=True)
		i_dup.doName()
		
		self._go._i_constrainNull.connectChildNode(i_dup,grp,'owner')
		
	    l_controlsAll = []
	    #==================================================================
	    try:#>>>> FK Segments
		if len( ml_controlsFK )<3:
		    raise Exception,"%s.build_controls>>> Must have at least three fk controls"%self._go._strShortName	    
		
		#for i,i_obj in enumerate(ml_controlsFK[1:]):#parent
		    #i_obj.parent = ml_controlsFK[i].mNode
		ml_fkJoints[0].parent = self._go._i_constrainNull.controlsFK.mNode
			
		for i,i_obj in enumerate(ml_controlsFK):
		    d_buffer = mControlFactory.registerControl(i_obj,shapeParentTo=ml_fkJoints[i],setRotateOrder=3,
		                                               mirrorSide=self._go._str_mirrorDirection, mirrorAxis="translateX",		                                           		                                               
			                                       makeAimable=True,typeModifier='fk',) 	    
		    
		    i_obj = d_buffer['instance']
		    i_obj.axisAim = "%s+"%self._go._jointOrientation[0]
		    i_obj.axisUp= "%s+"%self._go._jointOrientation[1]	
		    i_obj.axisOut= "%s+"%self._go._jointOrientation[2]
		    i_obj.drawStyle = 6#Stick joint draw style
		    
		    cgmMeta.cgmAttr(i_obj,'radius',hidden=True)
		    
		for i_obj in ml_controlsFK:
		    i_obj.delete()
		    
		#ml_controlsFK[0].masterGroup.parent = self._go._i_constrainNull.mNode
		self._go._i_rigNull.msgList_connect(ml_fkJoints,'controlsFK',"rigNull")
		l_controlsAll.extend(ml_fkJoints[:-1])	
	    
	    except Exception,error:	
		log.error("%s.build_controls>>> Build fk fail!"%self._go._strShortName)
		raise Exception,error
Example #11
0
def build_controls(goInstance = None):
    class fncWrap(modUtils.rigStep):
	def __init__(self,goInstance = None):
	    super(fncWrap, self).__init__(goInstance)
	    self._str_funcName = 'build_controls(%s)'%self.d_kws['goInstance']._strShortName	
	    self.__dataBind__()
	    self.l_funcSteps = [{'step':'Build NOT BROKEN UP YET','call':self.build_old},
	                        {'step':'Connections','call':self.build_connections}]	
	    #=================================================================
	    
	def build_old(self):#================================================================================   	
	    
	    if not self._go.isShaped():
		raise Exception,"%s.build_controls>>> needs shapes to build controls"%self._go._strShortName
	    if not self._go.isRigSkeletonized():
		raise Exception,"%s.build_controls>>> needs shapes to build controls"%self._go._strShortName
	    """
	    __d_controlShapes__ = {'shape':['controlsFK','midIK','settings','hand'],
			     'pivot':['toe','heel','ball','inner','outer
	    for shape in __d_controlShapes__['shape']:
		self._go.__dict__['mi_%s'%shape] = cgmMeta.validateObjArg(self._go._i_rigNull.msgList_getMessage('shape_%s'%shape),noneValid=False)
		log.info(self._go.__dict__['mi_%s'%shape] )"""
	    ml_controlsFK = cgmMeta.validateObjListArg(self._go._i_rigNull.msgList_getMessage('shape_controlsFK'),cgmMeta.cgmObject)
	    ml_segmentIK = cgmMeta.validateObjListArg(self._go._i_rigNull.msgList_getMessage('shape_segmentIK'),cgmMeta.cgmObject)
	    #self._go._i_rigNull.msgList_connect(self._go._md_controlShapes['segmentIK'],'shape_segmentIK_%s'%i,"rigNull")		
	    l_segmentIKChains = []
	    ml_segmentIKChains = []
	    for i in range(50):
		buffer = self._go._i_rigNull.msgList_getMessage('shape_segmentIK_%s'%i)
		if buffer:
		    l_segmentIKChains.append(buffer)
		    ml_segmentIKChains.append(cgmMeta.validateObjListArg(buffer,cgmMeta.cgmObject))
		else:
		    break  
		 
	    #mi_midIK = cgmMeta.validateObjArg(self._go._i_rigNull.getMessage('shape_midIK'),cgmMeta.cgmObject)
	    mi_settings= cgmMeta.validateObjArg(self._go._i_rigNull.getMessage('shape_settings'),cgmMeta.cgmObject)
	    ml_fkJoints = cgmMeta.validateObjListArg(self._go._i_rigNull.msgList_getMessage('fkJoints'),cgmMeta.cgmObject)
	    mi_cap = cgmMeta.validateObjArg(self._go._i_rigNull.getMessage('shape_moduleCap'),cgmMeta.cgmObject)
	    
	    log.info("mi_settings: '%s'"%mi_settings.getShortName())
	    log.info("mi_cap: '%s'"%mi_cap.getShortName())    
	    log.info("ml_fkJoints: %s"%[i_o.getShortName() for i_o in ml_fkJoints])
	    
	    #>>>Make a few extra groups for storing controls and what not to in the deform group
	    for grp in ['controlsFK','controlsIK']:
		i_dup = self._go._i_constrainNull.doDuplicateTransform(True)
		i_dup.parent = self._go._i_constrainNull.mNode
		i_dup.addAttr('cgmTypeModifier',grp,lock=True)
		i_dup.doName()
		
		self._go._i_constrainNull.connectChildNode(i_dup,grp,'owner')
		
	    l_controlsAll = []
	    #==================================================================
	    try:#>>>> FK Segments
		if len( ml_controlsFK )<3:
		    raise Exception,"%s.build_controls>>> Must have at least three fk controls"%self._go._strShortName	    
		
		#for i,i_obj in enumerate(ml_controlsFK[1:]):#parent
		    #i_obj.parent = ml_controlsFK[i].mNode
		ml_fkJoints[0].parent = self._go._i_constrainNull.controlsFK.mNode
			
		for i,i_obj in enumerate(ml_controlsFK):
		    d_buffer = mControlFactory.registerControl(i_obj,shapeParentTo=ml_fkJoints[i],setRotateOrder=3,
		                                               mirrorSide=self._go._str_mirrorDirection, mirrorAxis="translateX",		                                           		                                               
			                                       makeAimable=True,typeModifier='fk',) 	    
		    
		    i_obj = d_buffer['instance']
		    i_obj.axisAim = "%s+"%self._go._jointOrientation[0]
		    i_obj.axisUp= "%s+"%self._go._jointOrientation[1]	
		    i_obj.axisOut= "%s+"%self._go._jointOrientation[2]
		    i_obj.drawStyle = 6#Stick joint draw style
		    
		    cgmMeta.cgmAttr(i_obj,'radius',hidden=True)
		    
		for i_obj in ml_controlsFK:
		    i_obj.delete()
		    
		#ml_controlsFK[0].masterGroup.parent = self._go._i_constrainNull.mNode
		self._go._i_rigNull.msgList_connect(ml_fkJoints,'controlsFK',"rigNull")
		l_controlsAll.extend(ml_fkJoints[:-1])	
	    
	    except Exception,error:	
		log.error("%s.build_controls>>> Build fk fail!"%self._go._strShortName)
		raise Exception,error
	    
	    #==================================================================    
	    try:#>>>> IK Handle
		i_IKEnd = mi_cap
		i_IKEnd.parent = False
		d_buffer = mControlFactory.registerControl(i_IKEnd,copyPivot=ml_fkJoints[-2].mNode,setRotateOrder=3,
		                                           mirrorSide=self._go._str_mirrorDirection, mirrorAxis="translateX,rotateY,rotateZ",	                                               		                                           
			                                   typeModifier='ik',addSpacePivots = 1, addDynParentGroup = True,
			                                   addConstraintGroup=True,
			                                   makeAimable = True)
		i_IKEnd = d_buffer['instance']	
		i_IKEnd.masterGroup.parent = self._go._i_constrainNull.controlsIK.mNode
		
		#i_loc.delete()#delete
		self._go._i_rigNull.connectChildNode(i_IKEnd,'controlIK',"rigNull")#connect
		l_controlsAll.append(i_IKEnd)	
	
		#Set aims
		i_IKEnd.axisAim = 'z+'
		i_IKEnd.axisUp= 'y+'
		
	    except Exception,error:
		log.error("%s.build_controls>>> Build ik handle fail!"%self._go._strShortName)	
		raise Exception,error   
	    
	    try:#>>>> Settings
		d_buffer = mControlFactory.registerControl(mi_settings,addExtraGroups=0,typeModifier='settings',autoLockNHide=True,
		                                           mirrorSide=self._go._str_mirrorDirection, mirrorAxis="",	                                               		                                           
			                                   setRotateOrder=2)       
		i_obj = d_buffer['instance']
		i_obj.masterGroup.parent = self._go._i_constrainNull.mNode
		self._go._i_rigNull.connectChildNode(mi_settings,'settings',"rigNull")
		l_controlsAll.append(mi_settings)
		
		mi_settings.addAttr('blend_FKIK', defaultValue = 0, attrType = 'float', minValue = 0, maxValue = 1, keyable = False,hidden = False,lock=True)
		
		self.mPlug_result_moduleSubDriver = self._go.build_visSub()	
		
	    except Exception,error:
		log.error("%s.build_controls>>> Build settings fail!"%self._go._strShortName)		
		raise Exception,error