def block_getFromSelected(): _str_func = 'block_getFromSelected' _res = [] mL = cgmMeta.asMeta(sl=1, noneValid=True) or [] for mObj in mL: if mObj.getMayaAttr('mClass') == 'cgmRigBlock': return mObj _found = SEARCH.seek_upStream(mObj.mNode, matchAttrValue={'mClass': 'cgmRigBlock'}) log.info(_found) if _found: return cgmMeta.asMeta(_found) return False
def get_driver(driven=None, getPlug=True, select=True): """ Get the driver objects or plugs by following the anim curve out of our intial driven :parameters: driven(str): Attribute to map. If none provided, checks selection getPlug(bool): Whether to get plug or node select(bool): Select the result :returns driven """ _str_func = 'get_driver' driven = VALID.listArg(driven) if not driven: driven = SEARCH.get_selectedFromChannelBox(False) or [] log.debug("|{0}| >> Driven: {1}".format(_str_func, driven)) if not driven: log.error( "|{0}| >> No driven found or offered. Try selecting an attribute that is an sdk driven" .format(_str_func)) return False l_driver = [] for d in driven: _buffer = mc.listConnections(d, scn=True, s=True, d=False) or [] if not _buffer: log.error("|{0}| >> Driven: {1} | No data found".format( _str_func, d)) for c in _buffer: log.debug("|{0}| >> Checking: {1}".format(_str_func, c)) #b_transform = VALID.is_transform(c) #if not b_transform: l_driver.append( SEARCH.seek_upStream(c, mode='isTransform', getPlug=getPlug)) l_driver = LISTS.get_noDuplicates(l_driver) if not l_driver: log.error("|{0}| >> No driver found".format(_str_func)) return False if select: mc.select(l_driver) pprint.pprint(l_driver) return l_driver