def get_filtered(mode='transform'):
    """
    Create a new mesh by adding,subtracting etc the positional info of one mesh to another

    :parameters:
        sourceObj(str): The mesh we're using to change our target
        target(str): Mesh to be modified itself or by duplication

    :returns
        mesh(str) -- which has been modified

    """
    _str_funcName = 'get_filtered'
    _modes = ['transform']
    _m = cgmValid.kw_fromList(mode,
                              _modes,
                              indexCallable=True,
                              calledFrom=_str_funcName)

    _res = []
    if _m == 'transform':
        _sel = mc.ls(sl=True)
        for s in _sel:
            _t = search.get_transform(s)
            if _t not in _res:
                _res.append(_t)

    return _res
Esempio n. 2
0
def get_filtered(mode = 'transform'):
    """
    Create a new mesh by adding,subtracting etc the positional info of one mesh to another

    :parameters:
        sourceObj(str): The mesh we're using to change our target
        target(str): Mesh to be modified itself or by duplication

    :returns
        mesh(str) -- which has been modified

    """
    _str_funcName = 'get_filtered'
    _modes = ['transform']
    _m = cgmValid.kw_fromList(mode, _modes, indexCallable=True, calledFrom=_str_funcName)
    
    _res = []
    if _m == 'transform':
        _sel = mc.ls(sl=True)
        for s in _sel:
            _t = search.get_transform(s)
            if _t not in _res:
                _res.append(_t)
                
    return  _res
Esempio n. 3
0
def set_primeScaleAxis(control=None,
                       primeAxis=None,
                       slaveOthers=False,
                       alias=None):
    """
    Set a single axis of scale for a given control. The other channels are locked and hidden.
    
    :parameters:
        control(str): Object to change
        primeAxis(str/idx): X,Y,Z or index
        slaveOthers(bool): Whether to drive the remaining attributes of the given channel
        alias(str): If given, will attempt to alias the primeAxis

    :returns
        success(bool)
    """
    _str_func = 'set_primeAxis'
    _l = ['X', 'Y', 'Z']
    _primeAxis = cgmValid.kw_fromList(primeAxis, _l)
    _idx = _l.index(_primeAxis)
    _attr_prime = 'scale{0}'.format(_primeAxis)

    _l_others = []
    for i, v in enumerate(_l):
        if i != _idx:
            _l_others.append(v)

    log.debug("{0} || control:{1}".format(_str_func, control))
    log.debug("{0} || primeAxis:{1}".format(_str_func, _primeAxis))
    log.debug("{0} || slaveOthers:{1}".format(_str_func, slaveOthers))
    log.debug("{0} || alias:{1}".format(_str_func, alias))
    log.debug("{0} || prime attr:{1}".format(_str_func, _attr_prime))
    log.debug("{0} || other attrs:{1}".format(_str_func, _l_others))

    if alias:
        coreAttr.alias_set("{0}.{1}".format(control, _attr_prime), alias)

    for attr in _l_others:
        if slaveOthers:
            try:
                attributes.doConnectAttr(
                    "{0}.{1}".format(control, _attr_prime),
                    "{0}.scale{1}".format(control, attr.capitalize()),
                    transferConnection=True)
            except:
                pass
        attributes.doSetLockHideKeyableAttr(
            control,
            lock=True,
            visible=False,
            keyable=False,
            channels=['s{0}'.format(attr.lower())])

    return True
 def setMode(self,mode):
     """
     Set tool mode
     """
     #assert mode in ['surface','intersections','midPoint'],"'%s' not a defined mode"%mode
     self.mode = cgmValid.kw_fromList(mode, ['surface','intersections','midPoint'],indexCallable=True)