# Path: mayaLib/rigLib/base/module.py
# class Base():
# class Module():
#     def __init__(
#             self,
#             characterName='new',
#             scale=1.0,
#             mainCtrlAttachObj=''
#     ):
#     def getScaleLocator(self):
#     def getDisplayControl(self):
#     def createHalo(self, mainCtrlAttachObj, scale):
#     def createDisplay(self, mainCtrlAttachObj, scale):
#     def createIKFK(self, mainCtrlAttachObj, scale):
#     def __init__(
#             self,
#             prefix='new',
#             baseObj=None
#     ):
# 
# Path: mayaLib/rigLib/utils/deform.py
# def blendShapeDeformer(base, blendshapeList, nodeName, defaultValue=[1, ], frontOfChain=False):
# def wrapDeformer(wrappedObjs, wrapperObj):
# def deltaMushDeformer(geo, smoothingIterations=10, smoothingStep=0.5):
# def shrinkWrapDeformer(wrappedObj, wrapperObj):
# def cMuscleSystemDeformer(obj, relativeSticky=True):
# def cMuscleConnectMuscle(muscleMainObj, muscleObjList):
# def softModDeformer(vertex):
# def meshCollision(deformer, deformed):
# 
# Path: mayaLib/rigLib/utils/dynamic.py
# class DynamicCurve():
#     def __init__(self, curve, prefix='new', baseRig=None):
#     def makeCurveDynamic(self, crv, name):
#     def getOutputCurve(self):
#     def getInputCurve(self):
#     def getSystemGrp(self):
#     def getFollicleGrp(self):
# 
# Path: mayaLib/rigLib/utils/name.py
# def removeSuffix(name):
# def getSide(name):
# def getAlpha(i):
# 
# Path: mayaLib/rigLib/utils/control.py
# class Control():
#     def __init__(
#             self,
#             prefix='new',
#             scale=1.0,
#             translateTo='',
#             rotateTo='',
#             parent='',
#             shape='circle',
#             lockChannels=['s', 'v'],
#             doOffset=True,
#             doModify=False,
#             doDynamicPivot=False,
#             objBBox=''
#     ):
#     def ctrlRadiusFromJoint(self, jnt, useSphere=True):
#     def calculateScale(self, scale, translateTo='', objBBox='', useBBox=False, useMean=False):
#     def getCtrlScale(self):
#     def makeDynamicPivot(self, prefix, scale, translateTo, rotateTo):
#     def getControl(self):
#     def getOffsetGrp(self):
#     def getModifyGrp(self):
#     def getTop(self):


import pymel.core as pm
from mayaLib.rigLib.base import module
from mayaLib.rigLib.utils import deform
from mayaLib.rigLib.utils import dynamic
from mayaLib.rigLib.utils import name, control

        pm.parentConstraint(self.baseAttachGrp, chainControls[0].Off, mo=1)

        pm.hide(chainIk)
        pm.parent(chainIk, self.rigmodule.partsNoTransGrp)

        # add twist attribute
        twistAt = 'twist'
        pm.addAttr(chainControls[-1].C, ln=twistAt, k=1)
        pm.connectAttr(chainControls[-1].C + '.' + twistAt, chainIk + '.twist')

        # save class attribute
        self.chainCurve = chainCurve
        self.controlCurve = ctrlCurve

        if doDynamic:
            self.dynCurve = self.makeDynamic(prefix, baseRig, self.rigmodule, chainControls, chainCurveClusters)

            deform.blendShapeDeformer(self.dynCurve.getInputCurve(), [self.controlCurve],
                                      nodeName=prefix + 'BlendShape', frontOfChain=True)
            deform.blendShapeDeformer(self.chainCurve, [self.dynCurve.getOutputCurve()], nodeName=prefix + 'BlendShape',
                                      frontOfChain=True)
        else:
            deform.blendShapeDeformer(self.chainCurve, [self.controlCurve], nodeName=prefix + 'BlendShape',
                                      frontOfChain=True)

    def getModuleDict(self):
        return {'module': self.rigmodule, 'baseAttachGrp': self.baseAttachGrp}

    def makeDynamic(self, prefix, baserig, basemodule, chainControls, chainCurveClusters):
        # duplicate ikChain curve and make dynamic

# Path: mayaLib/rigLib/base/module.py
# class Base():
# class Module():
#     def __init__(
#             self,
#             characterName='new',
#             scale=1.0,
#             mainCtrlAttachObj=''
#     ):
#     def getScaleLocator(self):
#     def getDisplayControl(self):
#     def createHalo(self, mainCtrlAttachObj, scale):
#     def createDisplay(self, mainCtrlAttachObj, scale):
#     def createIKFK(self, mainCtrlAttachObj, scale):
#     def __init__(
#             self,
#             prefix='new',
#             baseObj=None
#     ):
# 
# Path: mayaLib/rigLib/utils/deform.py
# def blendShapeDeformer(base, blendshapeList, nodeName, defaultValue=[1, ], frontOfChain=False):
# def wrapDeformer(wrappedObjs, wrapperObj):
# def deltaMushDeformer(geo, smoothingIterations=10, smoothingStep=0.5):
# def shrinkWrapDeformer(wrappedObj, wrapperObj):
# def cMuscleSystemDeformer(obj, relativeSticky=True):
# def cMuscleConnectMuscle(muscleMainObj, muscleObjList):
# def softModDeformer(vertex):
# def meshCollision(deformer, deformed):
# 
# Path: mayaLib/rigLib/utils/dynamic.py
# class DynamicCurve():
#     def __init__(self, curve, prefix='new', baseRig=None):
#     def makeCurveDynamic(self, crv, name):
#     def getOutputCurve(self):
#     def getInputCurve(self):
#     def getSystemGrp(self):
#     def getFollicleGrp(self):
# 
# Path: mayaLib/rigLib/utils/name.py
# def removeSuffix(name):
# def getSide(name):
# def getAlpha(i):
# 
# Path: mayaLib/rigLib/utils/control.py
# class Control():
#     def __init__(
#             self,
#             prefix='new',
#             scale=1.0,
#             translateTo='',
#             rotateTo='',
#             parent='',
#             shape='circle',
#             lockChannels=['s', 'v'],
#             doOffset=True,
#             doModify=False,
#             doDynamicPivot=False,
#             objBBox=''
#     ):
#     def ctrlRadiusFromJoint(self, jnt, useSphere=True):
#     def calculateScale(self, scale, translateTo='', objBBox='', useBBox=False, useMean=False):
#     def getCtrlScale(self):
#     def makeDynamicPivot(self, prefix, scale, translateTo, rotateTo):
#     def getControl(self):
#     def getOffsetGrp(self):
#     def getModifyGrp(self):
#     def getTop(self):


# Path: mayaLib/rigLib/base/ikChain.py
import pymel.core as pm
from mayaLib.rigLib.base import module
from mayaLib.rigLib.utils import deform
from mayaLib.rigLib.utils import dynamic
from mayaLib.rigLib.utils import name, control

        pm.parentConstraint(self.baseAttachGrp, chainControls[0].Off, mo=1)

        pm.hide(chainIk)
        pm.parent(chainIk, self.rigmodule.partsNoTransGrp)

        # add twist attribute
        twistAt = 'twist'
        pm.addAttr(chainControls[-1].C, ln=twistAt, k=1)
        pm.connectAttr(chainControls[-1].C + '.' + twistAt, chainIk + '.twist')

        # save class attribute
        self.chainCurve = chainCurve
        self.controlCurve = ctrlCurve

        if doDynamic:
            self.dynCurve = self.makeDynamic(prefix, baseRig, self.rigmodule, chainControls, chainCurveClusters)

            deform.blendShapeDeformer(self.dynCurve.getInputCurve(), [self.controlCurve],
                                      nodeName=prefix + 'BlendShape', frontOfChain=True)
            deform.blendShapeDeformer(self.chainCurve, [self.dynCurve.getOutputCurve()], nodeName=prefix + 'BlendShape',
                                      frontOfChain=True)
        else:
            deform.blendShapeDeformer(self.chainCurve, [self.controlCurve], nodeName=prefix + 'BlendShape',
                                      frontOfChain=True)

    def getModuleDict(self):
        return {'module': self.rigmodule, 'baseAttachGrp': self.baseAttachGrp}

    def makeDynamic(self, prefix, baserig, basemodule, chainControls, chainCurveClusters):
        # duplicate ikChain curve and make dynamic

        dynamicCurveName = name.removeSuffix(pm.ls(self.chainCurve)[0].shortName()) + '_CRV'
