Esempio n. 1
0
    def __check_parameters(self):
        """ Check the given parameters for validation """
        #--- obj
        assert self._obj, check.error(self, 1, `self._obj`)

        #--- replace
        assert self._replace, check.error(self, 1, `self._replace`)
Esempio n. 2
0
def lock_attributes(obj=None, attr=None, lock=True, hide=True):
    #--- check parameters
    assert obj, check.error(obj, 1, `obj`)
    assert attr, check.error(attr, 1, `attr`)
    assert isinstance(attr, list), check.error(obj, 12, `attr`)

    if isinstance(obj, list):
        for i in obj:
            for a in attr:
                compound = cmds.attributeQuery(a, node=i, listChildren=True)
                if compound:
                    for c in compound:
                        if hide:
                            cmds.setAttr(i + '.' + c, lock=lock, keyable=False)
                        else:
                            cmds.setAttr(i + '.' + c, lock=lock, keyable=True)
                else:
                    if hide:
                        cmds.setAttr(i + '.' + a, lock=lock, keyable=False)
                    else:
                        cmds.setAttr(i + '.' + a, lock=lock, keyable=True)
        return
    for a in attr:
        compound = cmds.attributeQuery(a, node=obj, listChildren=True)
        if compound:
            for c in compound:
                if hide:
                    cmds.setAttr(obj + '.' + c, lock=lock, keyable=False)
                else:
                    cmds.setAttr(obj + '.' + c, lock=lock, keyable=True)
        else:
            if hide:
                cmds.setAttr(obj + '.' + a, lock=lock, keyable=False)
            else:
                cmds.setAttr(obj + '.' + a, lock=lock, keyable=True)
Esempio n. 3
0
 def __check_parameters(self):
     #--- currentFile
     assert self._currentFile, check.error(self, 1, `self._currentFile`)
     #--- assetInfo
     self.assetInfo = data.asset_info(self._currentFile)
     assert self.assetInfo, check.error(self, 1, `self.assetInfo`)
     assert len(self.assetInfo) == 4, check.error(self, 21, `self.assetInfo`)
Esempio n. 4
0
    def __check_parameters(self):
        #--- plugin
        assert self.plugin, check.error(self, 2, `self.plugin`)
        assert isinstance(self.plugin, str), check.error(self, 2, `self.plugin`)

        #--- suffix
        assert self.suffix, check.error(self, 2, `self.suffix`)
        assert isinstance(self.suffix, str), check.error(self, 2, `self.suffix`)
Esempio n. 5
0
    def __check_scene(self):
        #--- check plugin
        plugin_master.PluginSetup(plugin='goe_tools', suffix='py')

        if not self._exists:
            #--- control shape
            composed = self._side + "_" + self._name + "_CTLShape"
            assert not cmds.objExists(composed), check.error(self, 20, `composed`)

        #--- parent
        if self._parent:
            assert cmds.objExists(self._parent), check.error(self, 0, `self._parent`)
Esempio n. 6
0
    def __check_parameters(self):
        #--- amount
        msg = "Please call SetupRoot(__file__) before creating guides!"
        assert cmds.objExists(self.root), check.error(self, 0, `self.root`, msg)

        #--- moduleName
        assert self._moduleName, check.error(self, 1, `self._moduleName`)
        assert isinstance(self._moduleName, str), check.error(self, 2, `self._moduleName`)

        #--- amount
        assert not self._amount < 1, check.error(self, 1, `self._amount`)

        #--- mirrorAxis
        assert (self._mirrorAxis == 'x' or self._mirrorAxis == 'y' or
                self._mirrorAxis == 'z'), check.error(self, 1, `self._mirrorAxis`)
Esempio n. 7
0
 def __setup_rig_structure(self):
     groot = 'GUIDE_ROOT'
     assert cmds.objExists(groot), check.error(self, 0, groot)
     if not cmds.objExists(self.root + '.project'):
         project = cmds.getAttr(groot + '.project')
         cmds.addAttr(self.root, longName='project', dataType='string')
         cmds.setAttr(self.root + '.project',
                      project,
                      type='string',
                      lock=True)
     if not cmds.objExists(self.root + '.assetType'):
         asset_type = cmds.getAttr(groot + '.assetType')
         cmds.addAttr(self.root, longName='assetType', dataType='string')
         cmds.setAttr(self.root + '.assetType',
                      asset_type,
                      type='string',
                      lock=True)
     if not cmds.objExists(self.root + '.assetResolution'):
         asset_res = cmds.getAttr(groot + '.assetResolution')
         cmds.addAttr(self.root,
                      longName='assetResolution',
                      dataType='string')
         cmds.setAttr(self.root + '.assetResolution',
                      asset_res,
                      type='string',
                      lock=True)
     if not cmds.objExists(self.root + '.assetName'):
         asset_name = cmds.getAttr(groot + '.assetName')
         cmds.addAttr(self.root, longName='assetName', dataType='string')
         cmds.setAttr(self.root + '.assetName',
                      asset_name,
                      type='string',
                      lock=True)
Esempio n. 8
0
def lock_n_hide(obj=None, attr=None, unlock=False):
    #--- check parameters
    assert obj, check.error(obj, 1, `obj`)
    assert attr, check.error(attr, 1, `attr`)
    assert isinstance(attr, list), check.error(obj, 12, `attr`)

    for a in attr:
        compound = cmds.attributeQuery(a, node=obj, listChildren=True)
        if compound:
            for c in compound:
                if unlock:
                    cmds.setAttr(obj + '.' + c, lock=False, keyable=True)
                else:
                    cmds.setAttr(obj + '.' + c, lock=True, keyable=False)
        else:
            if unlock:
                cmds.setAttr(obj + '.' + a, lock=False, keyable=True)
            else:
                cmds.setAttr(obj + '.' + a, lock=True, keyable=False)
Esempio n. 9
0
 def __check_scene(self):
     #--- check GUIDE ROOT, its attributes and values
     gr = "GUIDE_ROOT"
     assert cmds.objExists(gr), check.error(self, 0, gr)
     assert cmds.objExists(gr + ".project"), check.error(self, 0, gr + ".project")
     assert cmds.objExists(gr + ".assetType"), check.error(self, 0, gr + ".assetType")
     assert cmds.objExists(gr + ".assetResolution"), check.error(self, 0, gr + ".assetResolution")
     assert cmds.objExists(gr + ".assetName"), check.error(self, 0, gr + ".assetName")
     self._project = cmds.getAttr(gr + ".project")
     self._asset_type = cmds.getAttr(gr + ".assetType")
     self._asset_res = cmds.getAttr(gr + ".assetResolution")
     self._asset_name = cmds.getAttr(gr + ".assetName")
     assert self._project, check.error(self, 23, self._project)
     assert self._asset_type, check.error(self, 23, self._asset_type)
     assert self._asset_res, check.error(self, 23, self._asset_res)
     assert self._asset_name, check.error(self, 23, self._asset_name)
Esempio n. 10
0
 def __check_scene(self):
     asset = cmds.ls(type='transform')
     project = None
     asset_type = None
     asset_res = None
     asset_name = None
     for i in asset:
         if cmds.objExists(i + '.project'):
             project = cmds.getAttr(i + '.project')
         if cmds.objExists(i + '.assetType'):
             asset_type = cmds.getAttr(i + '.assetType')
         if cmds.objExists(i + '.assetResolution'):
             asset_res = cmds.getAttr(i + '.assetResolution')
         if cmds.objExists(i + '.assetName'):
             asset_name = cmds.getAttr(i + '.assetName')
     assert project, check.error(self, 0, `project`)
     assert asset_type, check.error(self, 0, `asset_type`)
     assert asset_res, check.error(self, 0, `asset_res`)
     assert asset_name, check.error(self, 0, `asset_name`)
     return [project, asset_type, asset_res, asset_name]
Esempio n. 11
0
 def __check_scene(self):
     assert cmds.objExists('GUIDE_ROOT'), check.error(self, 0, 'GUIDE_ROOT')
     project = cmds.getAttr('GUIDE_ROOT.project')
     asset_type = cmds.getAttr('GUIDE_ROOT.assetType')
     asset_res = cmds.getAttr('GUIDE_ROOT.assetResolution')
     asset_name = cmds.getAttr('GUIDE_ROOT.assetName')
     assert project, check.error(self, 0, `project`)
     assert asset_type, check.error(self, 0, `asset_type`)
     assert asset_res, check.error(self, 0, `asset_res`)
     assert asset_name, check.error(self, 0, `asset_name`)
     return [project, asset_type, asset_res, asset_name]
Esempio n. 12
0
 def __check_scene(self):
     #--- check GUIDE ROOT, its attributes and values
     gr = "GUIDE_ROOT"
     assert cmds.objExists(gr), check.error(self, 0, gr)
     assert cmds.objExists(gr + ".project"), check.error(
         self, 0, gr + ".project")
     assert cmds.objExists(gr + ".assetType"), check.error(
         self, 0, gr + ".assetType")
     assert cmds.objExists(gr + ".assetResolution"), check.error(
         self, 0, gr + ".assetResolution")
     assert cmds.objExists(gr + ".assetName"), check.error(
         self, 0, gr + ".assetName")
     self._project = cmds.getAttr(gr + ".project")
     self._asset_type = cmds.getAttr(gr + ".assetType")
     self._asset_res = cmds.getAttr(gr + ".assetResolution")
     self._asset_name = cmds.getAttr(gr + ".assetName")
     assert self._project, check.error(self, 23, self._project)
     assert self._asset_type, check.error(self, 23, self._asset_type)
     assert self._asset_res, check.error(self, 23, self._asset_res)
     assert self._asset_name, check.error(self, 23, self._asset_name)
Esempio n. 13
0
    def get_data(self):
        data = list()
        gr = 'GUIDE_ROOT'
        grgs = gr + '.globalScale'
        assert cmds.objExists(gr), check.error(self, 0, gr)
        assert cmds.objExists(grgs), check.error(self, 0, grgs)
        gs = cmds.getAttr(grgs)
        root = [gr, gs]
        data.append(root)

        sel = cmds.ls(type='goe_locator')
        for i in sel:
            trn = cmds.listRelatives(i, parent=True, type='transform')
            if not trn:
                break
            if not cmds.objExists(trn[0] + '.CTL'):
                break
            ctl = trn[0]
            assert cmds.objExists(ctl + '.side'), check.error(self, 0, `trn[0]`)
            assert cmds.objExists(ctl + '.name'), check.error(self, 0, `trn[0]`)
            assert cmds.objExists(ctl + '.index'), check.error(self, 0, `trn[0]`)
            #--- check if control is a mirror and asymmetrical
            if cmds.objExists(trn[0] + '.MIRROR'):
                if not cmds.objExists(trn[0] + '.ASYM'):
                    pass
            #--- get the attribute values
            side = cmds.getAttr(ctl + '.side')
            name = cmds.getAttr(ctl + '.name')
            index = cmds.getAttr(ctl + '.index')
            compose = side + '_' + name + 'Guide' + index + '_CTL'
            #--- get the position and rotation
            position = cmds.xform(ctl, query=True, translation=True)
            rotation = cmds.xform(ctl, query=True, rotation=True)
            result = [compose, position, rotation]
            data.append(result)
        return data
Esempio n. 14
0
 def get_data(self):
     data = list()
     sel = cmds.ls(type='goe_locator')
     assert sel, check.error(self, 0, str(sel))
     for i in sel:
         #--- get the localPosition and localScale
         lpos = list(cmds.getAttr(i + '.localPosition')[0])
         lsca = list(cmds.getAttr(i + '.localScale')[0])
         #--- get the shape info
         siz = cmds.getAttr(i + '.size')
         shp = cmds.getAttr(i + '.shape')
         ori = cmds.getAttr(i + '.orientation')
         col = cmds.getAttr(i + '.overrideColor')
         result = [i, lpos, lsca, siz, shp, ori, col]
         data.append(result)
     return data
Esempio n. 15
0
    def __check_parameters(self):
        #--- side
        assert self._side, check.error(self, 2, `self._side`)
        assert isinstance(self._side, str), check.error(self, 2, `self._side`)
        err = check.error(self, 1, `self._side`, "Valid sides are 'C', 'R', 'L'!")
        assert (self._side == 'C' or self._side == 'R' or self._side == 'L'), err

        #--- name
        assert self._name, check.error(self, 2, `self._name`)
        assert isinstance(self._side, str), check.error(self, 2, `self._name`)
        assert not "_" in self._name, check.error(self, 1, `self._name`, "No '_' please!") 

        #--- rotateOrder
        err = check.error(self, 1, `self._rotateOrder`)
        assert (self._rotateOrder == 'xyz' or self._rotateOrder == 'yzx' or
                self._rotateOrder == 'zxy' or self._rotateOrder == 'xzy' or 
                self._rotateOrder == 'yxz' or self._rotateOrder == 'zyx'), err

        #--- limitTransforms
        for d in self._limitTransforms:
            node = None
            attr = None
            for i in d.items():
                if i[0] == 'node':
                    node = i[1]
                elif i[0] == 'attr':
                    attr = i[1]
                elif i[0] == 'min':
                    pass
                elif i[0] == 'max':
                    pass
                else:
                    raise Exception(check.error(self, 1, i))
            if not node:
                break
            assert attr, check.error(self, 1, `attr`)
            assert not isinstance(attr, list), check.error(self, 3, `attr`)
            if not (node == 'group' or node == 'transform' or node == None):
                var = 0
                for o in range(self._offsetGroups):
                    if 'offset' + `o` in node:
                        var = 1
                assert var, check.error(self, 1, `node`, "Or index out of range!")
            if not (attr == 'tx' or attr == 'ty' or attr == 'tz' or
                    attr == 'rx' or attr == 'ry' or attr == 'rz' or
                    attr == 'sx' or attr == 'sy' or attr == 'sz' or attr == None):
                raise Exception(check.error(self, 1, `attr`))
Esempio n. 16
0
 def __check_plugin(self):
     """ this method check the plugin """
     comp = self.plugin + '.' + self.suffix
     if not cmds.pluginInfo(comp, query=True, loaded=True):
         #--- check if the plugin was specified
         assert self.plugin, check.error(self, 10)
         #--- compose the plugin path
         path = None
         if self.suffix == 'so':
             path = self.base_path + self.plugin + '/' + self.plugin + '.so'
         else:
             path = self.base_path + self.plugin + '.py'
         cmds.loadPlugin(path)
         if self.info:
             print 'Successfully loaded plugin: ' + self.plugin + '.' + self.suffix
     else:
         if self.info:
             print 'Plugin already loaded: ' + self.plugin + '.' + self.suffix
Esempio n. 17
0
 def __update_plugin(self):
     """ this method updates the plugin """
     #--- open a new file
     cmds.file(new=True, force=True)
     #--- check if the plugin was specified
     assert self.plugin, check.error(self, 10)
     #--- compose the plugin path
     path = None
     if self.suffix == 'so':
         path = self.base_path + self.plugin + '/' + self.plugin + '.so'
     else:
         path = self.base_path + self.plugin + '.py'
     #--- reload plugin
     if cmds.pluginInfo(self.plugin + '.' + self.suffix, query=True, loaded=True):
         cmds.unloadPlugin(self.plugin + '.' + self.suffix)
     cmds.loadPlugin(path)
     if self.info:
         print 'Successfully reloaded plugin: ' + self.plugin + '.' + self.suffix
Esempio n. 18
0
 def __check_plugin(self):
     """ this method check the plugin """
     comp = self.plugin + '.' + self.suffix
     if not cmds.pluginInfo(comp, query=True, loaded=True):
         #--- check if the plugin was specified
         assert self.plugin, check.error(self, 10)
         #--- compose the plugin path
         path = None
         if self.suffix == 'so':
             path = self.base_path + self.plugin + '/' + self.plugin + '.so'
         else:
             path = self.base_path + self.plugin + '.py'
         cmds.loadPlugin(path)
         if self.info:
             print 'Successfully loaded plugin: ' + self.plugin + '.' + self.suffix
     else:
         if self.info:
             print 'Plugin already loaded: ' + self.plugin + '.' + self.suffix
Esempio n. 19
0
 def __update_plugin(self):
     """ this method updates the plugin """
     #--- open a new file
     cmds.file(new=True, force=True)
     #--- check if the plugin was specified
     assert self.plugin, check.error(self, 10)
     #--- compose the plugin path
     path = None
     if self.suffix == 'so':
         path = self.base_path + self.plugin + '/' + self.plugin + '.so'
     else:
         path = self.base_path + self.plugin + '.py'
     #--- reload plugin
     if cmds.pluginInfo(self.plugin + '.' + self.suffix,
                        query=True,
                        loaded=True):
         cmds.unloadPlugin(self.plugin + '.' + self.suffix)
     cmds.loadPlugin(path)
     if self.info:
         print 'Successfully reloaded plugin: ' + self.plugin + '.' + self.suffix
Esempio n. 20
0
def lock_all(obj=None, unlock=False):
    #--- check parameters
    assert obj, check.error(obj, 1, `obj`)

    if isinstance(obj, list):
        for i in obj:
            lock_all(i, unlock)
        return

    k = cmds.listAttr(obj, k=True)
    cb = cmds.listAttr(obj, cb=True)
    l = cmds.listAttr(obj, l=True)
    if unlock:
        if not l:
            return
        for a in l:
            if (a == 'caching' or a == 'nodeState' or a == 'blackBox' or a == 'CTL'):
                continue
            if ('shear' in a or 'rotateAxis' in a or
                    'inheritsTransform' in a or 'rotateOrder' in a):
                cmds.setAttr(obj + '.' + a, lock=False)
            else:
                cmds.setAttr(obj + '.' + a, lock=False, keyable=True)
    else:
        if not k:
            return
        for a in k:
            try:
                cmds.setAttr(obj + '.' + a, lock=True, keyable=False)
            except:
                pass
        if cb:
            for a in cb:
                cmds.setAttr(obj + '.' + a, lock=True, keyable=False)
                cmds.setAttr(obj + '.' + a, edit=True, channelBox=False)
        for a in ['shearXY', 'shearYZ', 'shearXZ', 'rotateAxisX', 'rotateAxisY',
                  'rotateAxisZ', 'inheritsTransform', 'rotateOrder']:
            if cmds.objExists(obj + '.' + a):
                cmds.setAttr(obj + '.' + a, lock=True, keyable=False)
Esempio n. 21
0
 def __setup_rig_structure(self):
     groot = 'GUIDE_ROOT'
     assert cmds.objExists(groot), check.error(self, 0, groot)
     if not cmds.objExists(self.root + '.project'):
         project = cmds.getAttr(groot + '.project')
         cmds.addAttr(self.root, longName='project', dataType='string')
         cmds.setAttr(self.root + '.project', project,
                      type='string', lock=True)
     if not cmds.objExists(self.root + '.assetType'):
         asset_type = cmds.getAttr(groot + '.assetType')
         cmds.addAttr(self.root, longName='assetType', dataType='string')
         cmds.setAttr(self.root + '.assetType', asset_type,
                      type='string', lock=True)
     if not cmds.objExists(self.root + '.assetResolution'):
         asset_res = cmds.getAttr(groot + '.assetResolution')
         cmds.addAttr(self.root, longName='assetResolution',
                      dataType='string')
         cmds.setAttr(self.root + '.assetResolution', asset_res,
                      type='string', lock=True)
     if not cmds.objExists(self.root + '.assetName'):
         asset_name = cmds.getAttr(groot + '.assetName')
         cmds.addAttr(self.root, longName='assetName', dataType='string')
         cmds.setAttr(self.root + '.assetName', asset_name,
                      type='string', lock=True)
Esempio n. 22
0
    def __check_parameters(self):
        #--- project
        assert self._project, check.error(self, 1, `self._project`)
        #--- assetName
        assert self._assetName, check.error(self, 1, `self._assetName`)
        #--- assetRes
        assert self._assetRes, check.error(self, 1, `self._assetRes`)
        #--- assetType
        assert self._assetType, check.error(self, 1, `self._assetType`)

        #--- check path
        path = os.getenv('MAYA_PLUG_IN_PATH')
        envs = path.split(':')
        for i in envs:
            if 'PandorasBox' in i:
                self.path = i
        assert os.path.exists(self.path), check.error(self, 22, `self.path`)
        path_to_build = os.path.join(self.path, 'goe_builds')
        assert os.path.exists(path_to_build), check.error(self, 22, `path_to_build`)
Esempio n. 23
0
    def __mirror_guides(self, obj, index):
        #--- check and setup the side
        msg = "Please specify 'L' or 'R' as valid side!"
        assert not self._side == 'C', check.error(self, 1, str(self._side),
                                                  msg)
        side = 'R'
        color = 13
        if self._side == 'R':
            side = 'L'
            color = 6

        #--- create mirror control
        ctl = self.__create_control(side, self._moduleName, index, color,
                                    self.mod)

        #--- add mirror attribute
        if not cmds.objExists(ctl.transform + '.MIRROR'):
            cmds.addAttr(ctl.transform,
                         longName="MIRROR",
                         attributeType='bool')
            cmds.setAttr(ctl.transform + '.MIRROR',
                         1,
                         lock=True,
                         keyable=False)
            if self._asymmetry:
                if not cmds.objExists(ctl.transform + '.ASYM'):
                    cmds.addAttr(ctl.transform,
                                 longName="ASYM",
                                 attributeType='bool')
                    cmds.setAttr(ctl.transform + '.ASYM',
                                 1,
                                 lock=True,
                                 keyable=False)

        #--- create mirror setup
        name = side + "_" + self._moduleName + repr(index) + "_MIR"
        mir = cmds.createNode("goe_mirror", name=name)
        self.to_ihi.append(mir)

        #--- connect mirror setup
        cmds.connectAttr(obj + ".worldMatrix", mir + ".inputMatrix")
        cmds.connectAttr(mir + ".outTranslation", ctl.group + ".translate")
        cmds.connectAttr(mir + ".outRotation", ctl.group + ".rotate")

        #--- setup mirror attrs
        if self._mirrorAxis == 'x':
            cmds.setAttr(mir + '.mirrorAxis', 0, lock=True, keyable=False)
        elif self._mirrorAxis == 'y':
            cmds.setAttr(mir + '.mirrorAxis', 1, lock=True, keyable=False)
        elif self._mirrorAxis == 'z':
            cmds.setAttr(mir + '.mirrorAxis', 2, lock=True, keyable=False)
        cmds.setAttr(mir + '.mirror', 1, lock=True, keyable=False)
        cmds.setAttr(ctl.group + '.inheritsTransform', lock=False)
        cmds.setAttr(ctl.group + '.inheritsTransform', 0, lock=True)

        #--- global scale connection
        for axis in 'xyz':
            cmds.setAttr(ctl.group + '.s' + axis, lock=False, keyable=True)
        cmds.connectAttr(self.root + ".globalScale", ctl.group + ".sx")
        cmds.connectAttr(self.root + ".globalScale", ctl.group + ".sy")
        cmds.connectAttr(self.root + ".globalScale", ctl.group + ".sz")
        for axis in 'xyz':
            cmds.setAttr(ctl.group + '.s' + axis, lock=True, keyable=False)

        #--- change displayType to reference
        if not self._asymmetry:
            cmds.setAttr(ctl.shape + '.overrideEnabled', 1)
            cmds.setAttr(ctl.shape + '.overrideDisplayType', 2)
            for axis in 'xyz':
                cmds.setAttr(ctl.transform + '.t' + axis,
                             lock=True,
                             keyable=False)
                cmds.setAttr(ctl.transform + '.r' + axis,
                             lock=True,
                             keyable=False)

        self.mirror_control.append(ctl)
Esempio n. 24
0
    def __mirror_guides(self, obj, index):
        #--- check and setup the side
        msg = "Please specify 'L' or 'R' as valid side!"
        assert not self._side == 'C', check.error(self, 1, str(self._side), msg)
        side = 'R'
        color = 13
        if self._side == 'R':
            side = 'L'
            color = 6

        #--- create mirror control
        ctl = self.__create_control(side, self._moduleName,
                                    index, color, self.mod)

        #--- add mirror attribute
        if not cmds.objExists(ctl.transform + '.MIRROR'):
            cmds.addAttr(ctl.transform, longName="MIRROR", attributeType='bool')
            cmds.setAttr(ctl.transform + '.MIRROR', 1, lock=True, keyable=False)
            if self._asymmetry:
                if not cmds.objExists(ctl.transform + '.ASYM'):
                    cmds.addAttr(ctl.transform, longName="ASYM",
                                 attributeType='bool')
                    cmds.setAttr(ctl.transform + '.ASYM', 1,
                                 lock=True, keyable=False)

        #--- create mirror setup
        name = side + "_" + self._moduleName + repr(index) + "_MIR"
        mir = cmds.createNode("goe_mirror", name=name)
        self.to_ihi.append(mir)

        #--- connect mirror setup
        cmds.connectAttr(obj + ".worldMatrix", mir + ".inputMatrix")
        cmds.connectAttr(mir + ".outTranslation", ctl.group + ".translate")
        cmds.connectAttr(mir + ".outRotation", ctl.group + ".rotate")

        #--- setup mirror attrs
        if self._mirrorAxis == 'x':
            cmds.setAttr(mir + '.mirrorAxis', 0, lock=True, keyable=False)
        elif self._mirrorAxis == 'y':
            cmds.setAttr(mir + '.mirrorAxis', 1, lock=True, keyable=False)
        elif self._mirrorAxis == 'z':
            cmds.setAttr(mir + '.mirrorAxis', 2, lock=True, keyable=False)
        cmds.setAttr(mir + '.mirror', 1, lock=True, keyable=False)
        cmds.setAttr(ctl.group + '.inheritsTransform', lock=False)
        cmds.setAttr(ctl.group + '.inheritsTransform', 0, lock=True)

        #--- global scale connection
        for axis in 'xyz':
            cmds.setAttr(ctl.group + '.s' + axis, lock=False, keyable=True)
        cmds.connectAttr(self.root + ".globalScale", ctl.group + ".sx")
        cmds.connectAttr(self.root + ".globalScale", ctl.group + ".sy")
        cmds.connectAttr(self.root + ".globalScale", ctl.group + ".sz")
        for axis in 'xyz':
            cmds.setAttr(ctl.group + '.s' + axis, lock=True, keyable=False)

        #--- change displayType to reference
        if not self._asymmetry:
            cmds.setAttr(ctl.shape + '.overrideEnabled', 1)
            cmds.setAttr(ctl.shape + '.overrideDisplayType', 2)
            for axis in 'xyz':
                cmds.setAttr(ctl.transform + '.t' + axis, lock=True, keyable=False)
                cmds.setAttr(ctl.transform + '.r' + axis, lock=True, keyable=False)

        self.mirror_control.append(ctl)
Esempio n. 25
0
        #--- lockAttributes
        for d in self._lockAttrs.items():
            if not d[0]:
                break
            assert d[1], check.error(self, 1, `d[1]`)
            if not (d[0] == 'group' or d[0] == 'transform' or d[0] == None):
                var = 0
                for o in range(self._offsetGroups):
                    if 'offset' + `o` in d[0]:
                        var = 1
                assert var, check.error(self, 1, `d[0]`, "Or index out of range!")
            assert isinstance(d[1], list), check.error(self, 3, `d[1]`)

        #--- parent
        if self._parent:
            assert cmds.objExists(self._parent), check.error(self, 0, `self._parent`)
    #END __check_parameters()

    def __check_scene(self):
        #--- check plugin
        plugin_master.PluginSetup(plugin='goe_tools', suffix='py')

        if not self._exists:
            #--- control shape
            composed = self._side + "_" + self._name + "_CTLShape"
            assert not cmds.objExists(composed), check.error(self, 20, `composed`)

        #--- parent
        if self._parent:
            assert cmds.objExists(self._parent), check.error(self, 0, `self._parent`)
    #END __check_scene()