Ejemplo n.º 1
0
def _lsUI(**kwargs):
    long = kwargs.pop("long", kwargs.pop("l", True))
    head = kwargs.pop("head", kwargs.pop("hd", None))
    tail = kwargs.pop("tail", kwargs.pop("tl", None))

    if not kwargs:
        kwargs = {
            "windows": 1,
            "panels": 1,
            "editors": 1,
            "controls": 1,
            "controlLayouts": 1,
            "collection": 1,
            "radioMenuItemCollections": 1,
            "menus": 1,
            "menuItems": 1,
            "contexts": 0,
            "cmdTemplates": 1,
        }
    kwargs["long"] = long
    if head is not None:
        kwargs["head"] = head
    if tail is not None:
        kwargs["tail"] = tail
    return _util.listForNone(cmds.lsUI(**kwargs))
Ejemplo n.º 2
0
def listAnimatable( *args, **kwargs ):
    """
Modifications:
    - returns an empty list when the result is None
    - returns wrapped classes
    """
    return map( _general.PyNode, _util.listForNone(cmds.listAnimatable( *args, **kwargs ) ) )
Ejemplo n.º 3
0
def _lsUI(**kwargs):
    long = kwargs.pop('long', kwargs.pop('l', True))
    head = kwargs.pop('head', kwargs.pop('hd', None))
    tail = kwargs.pop('tail', kwargs.pop('tl', None))

    if not kwargs:
        kwargs = {
            'windows': 1,
            'panels': 1,
            'editors': 1,
            'controls': 1,
            'controlLayouts': 1,
            'collection': 1,
            'radioMenuItemCollections': 1,
            'menus': 1,
            'menuItems': 1,
            'contexts': 0,
            'cmdTemplates': 1
        }
    kwargs['long'] = long
    if head is not None:
        kwargs['head'] = head
    if tail is not None:
        kwargs['tail'] = tail
    return _util.listForNone(cmds.lsUI(**kwargs))
Ejemplo n.º 4
0
def lsThroughFilter(*args, **kwargs):
    """
    Modifications:
      - returns an empty list when the result is None
      - returns wrapped classes
    """
    return [
        _general.PyNode(x)
        for x in _util.listForNone(cmds.lsThroughFilter(*args, **kwargs))
    ]
Ejemplo n.º 5
0
def keyframe(*args, **kwargs):
    """
    Modifications:
        - returns an empty list when the result is None
        - if both valueChange and timeChange are queried, the result will be a list of (time,value) pairs
    """
    res = _util.listForNone(cmds.keyframe(*args, **kwargs))
    if kwargs.get('query', kwargs.get('q', False) ) and \
            kwargs.get('valueChange', kwargs.get('vc', False)) and kwargs.get('timeChange', kwargs.get('tc', False)):
        return list(_util.pairIter(res))
    return res
Ejemplo n.º 6
0
def keyframe( *args, **kwargs ):
    """
Modifications:
    - returns an empty list when the result is None
    - if both valueChange and timeChange are queried, the result will be a list of (time,value) pairs
    """
    res = _util.listForNone( cmds.keyframe(*args, **kwargs) )
    if kwargs.get('query', kwargs.get('q', False) ) and \
            kwargs.get('valueChange', kwargs.get('vc', False) ) and kwargs.get('timeChange', kwargs.get('tc', False) ):
        return list(_util.pairIter(res))
    return res
Ejemplo n.º 7
0
def _findLongName(name, type=None):
    # this remap is currently for OptionMenu, but the fix only works in 2011
    # lsUI won't list popupMenus or optionMenus
    kwargs = {"long": True}
    if type:
        kwargs["type"] = _commandsToUITypes.get(type, type)

    uiObjs = _util.listForNone(_lsUI(**kwargs))
    res = [x for x in uiObjs if x.endswith("|" + name)]
    if len(res) > 1:
        raise ValueError, "found more than one UI element matching the name %s" % name
    elif len(res) == 0:
        raise ValueError, "could not find a UI element matching the name %s" % name
    return res[0]
Ejemplo n.º 8
0
def _findLongName(name, type=None):
    # this remap is currently for OptionMenu, but the fix only works in 2011
    # lsUI won't list popupMenus or optionMenus
    kwargs = {'long': True}
    if type:
        kwargs['type'] = _commandsToUITypes.get(type, type)

    uiObjs = _util.listForNone(_lsUI(**kwargs))
    res = [x for x in uiObjs if x.endswith('|' + name)]
    if len(res) > 1:
        raise ValueError, "found more than one UI element matching the name %s" % name
    elif len(res) == 0:
        raise ValueError, "could not find a UI element matching the name %s" % name
    return res[0]
Ejemplo n.º 9
0
def _lsUI( **kwargs ):
    long = kwargs.pop( 'long', kwargs.pop( 'l', True ) )
    head = kwargs.pop( 'head', kwargs.pop( 'hd', None ) )
    tail = kwargs.pop( 'tail', kwargs.pop( 'tl', None) )

    if not kwargs:
        kwargs = {
            'windows': 1, 'panels' : 1, 'editors' : 1, 'controls' : 1, 'controlLayouts' : 1,
            'collection' : 1, 'radioMenuItemCollections' : 1, 'menus' : 1, 'menuItems' : 1,
            'contexts' : 0, 'cmdTemplates' : 1
            }
    kwargs['long'] = long
    if head is not None: kwargs['head'] = head
    if tail is not None: kwargs['tail'] = tail
    return _util.listForNone(cmds.lsUI(**kwargs))