def tgpLoadTxBtn(self,
                     loadBtn,
                     objectType,
                     objectDesc,
                     keywords,
                     objectNickname=None):
        if objectNickname is None:
            objectNickname = objectType

        self.selLoad = []
        self.selLoad = mc.ls(sl=True, fl=True, type="transform")

        if (len(self.selLoad) != 1):
            mc.warning("Select only the {0}".format(objectDesc))
            return
        else:
            if CRU.checkObjectType(self.selLoad[0]) != objectType:
                mc.warning("{0} should be a {1}".format(
                    objectDesc, objectNickname))
                return
            selName = self.selLoad[0]

            if not all(word.lower() in selName.lower() for word in keywords):
                mc.warning("That is the wrong {0}. Select the {1}".format(
                    objectNickname, objectDesc))
                return
            mc.textFieldButtonGrp(loadBtn, e=True, tx=selName)
            return selName
    def tgpLoadCtrlsBtn(self,
                        loadBtn,
                        objectType,
                        objectDesc,
                        keywords,
                        objectNickname=None):
        if objectNickname is None:
            objectNickname = objectType
        # hierarchy
        self.selLoad = []
        self.selLoad = mc.ls(sl=True, fl=True, type="transform")

        if (len(self.selLoad) != 1):
            mc.warning("Select only the {0} control".format(objectDesc))
            return
        else:

            if CRU.checkObjectType(self.selLoad[0]) != objectType:
                mc.warning("The Control should be a {0}".format(objectType))
                return
            selName = self.selLoad[0]

            if not all(word.lower() in selName.lower() for word in keywords):
                mc.warning("That is the wrong {0}. Select the {1}".format(
                    objectNickname, objectDesc))
                return

            mc.textFieldButtonGrp(loadBtn, e=True, tx=selName)

            # get the children joints
            self.parent = self.selLoad[0]
            self.child = mc.listRelatives(self.selLoad,
                                          ad=True,
                                          type="transform")
            # collect the joints in an array
            self.ctrlsArray = [self.parent]
            # reverse the order of the children joints
            self.child.reverse()

            # add to the current list
            self.ctrlsArray.extend(self.child)
            ctrlsArraySorted = []
            # sort the array
            for i in range(len(self.ctrlsArray)):
                sels = mc.listRelatives(self.ctrlsArray[i], c=True, s=True)
                if objectType in mc.objectType(
                        sels) or objectType == mc.objectType(sels):
                    ctrlsArraySorted.append(self.ctrlsArray[i])

            self.ctrlsRoot = self.selLoad[0]
            self.ctrlsArray = ctrlsArraySorted

        return self.ctrlsArray
    def tgpLoadJntsBtn(self,
                       loadBtn,
                       objectType,
                       objectDesc,
                       keywords,
                       objectNickname=None):
        if objectNickname is None:
            objectNickname = objectType
        # hierarchy
        self.selLoad = []
        self.selLoad = mc.ls(sl=True, fl=True, type=objectType)
        if (len(self.selLoad) != 1):
            mc.warning("Select only the {0}".format(objectDesc))
            return
        else:

            if CRU.checkObjectType(self.selLoad[0]) != objectType:
                mc.warning("{0} should be a {1}".format(
                    objectDesc, objectNickname))
                return

            selName = self.selLoad[0]

            if not all(word.lower() in selName.lower() for word in keywords):
                mc.warning("That is the wrong {0}. Select the {1}".format(
                    objectType, objectDesc))
                return

            mc.textFieldButtonGrp(loadBtn, e=True, tx=selName)

            # get the children joints
            self.parent = self.selLoad[0]
            self.child = mc.listRelatives(self.selLoad, ad=True, type="joint")
            # collect the joints in an array
            self.jointArray = [self.parent]
            # reverse the order of the children joints
            self.child.reverse()

            # add to the current list
            self.jointArray.extend(self.child)

        return self.jointArray
Exemple #4
0
import pcCreateRig00AUtilities
from pcCreateRig00AUtilities import pcCreateRigUtilities as CRU

reload(pcCreateRig00AUtilities)

nameSet = "myCorrectivesSet"

myVals = ["tx", "ty", "tz", "rx", "ry", "rz", "sx", "sy", "sz", "v"]


sels = mc.ls(sl=True)
sel = sels[0]
print(sel)
if len(sels) == 1:
    if CRU.checkObjectType(sel) == "mesh":
        print("I got here")

        dupMesh = mc.duplicate(sel, rc=True)[0]

        try:
            mc.parent(dupMesh, w=True)
        except:
            pass
        mc.select(dupMesh)
        CRU.lockHideCtrls(dupMesh, translate=True, rotate=True, scale=True, toHide=True, visible=True, toLock=False)
        if mc.objExists(nameSet):
            mc.sets(dupMesh, include=nameSet)
        else:
            mc.sets(dupMesh, n=nameSet)
        mc.move(0, 0, -100, dupMesh)