Esempio n. 1
0
def promptForPath(**kwargs):
    """ Prompt the user for a folder path """

    if cmds.about(linux=1):
        return _Path(fileDialog(**kwargs))

    else:
        # a little trick that allows us to change the top-level 'folder' variable from
        # the nested function ('getfolder') - use a single-element list, and change its content

        folder = [None]
        def getfolder(*args):
            folder[0] = args[0]

        kwargs.pop('fileCommand',None)
        kwargs['fc'] = getfolder
        
        if 'mode' not in kwargs:
            kwargs['mode'] = 0

        kwargs['an'] = kwargs.pop('an', kwargs.pop('actionName', "Select File"))
        ret = cmds.fileBrowserDialog(**kwargs)
        folder = _Path(folder[0])
        if folder: 
            #Ensure something was entered/selected. But don't test if it exists
            # as this would break mode 1/100+ causing them to return None
            return folder
Esempio n. 2
0
def promptForPath(**kwargs):
    """ Prompt the user for a folder path """

    if cmds.about(linux=1):
        return _Path(fileDialog(**kwargs))

    else:
        # a little trick that allows us to change the top-level 'folder' variable from
        # the nested function ('getfolder') - use a single-element list, and change its content

        folder = [None]

        def getfolder(*args):
            folder[0] = args[0]

        kwargs.pop('fileCommand', None)
        kwargs['fc'] = getfolder

        if 'mode' not in kwargs:
            kwargs['mode'] = 0

        kwargs['an'] = kwargs.pop('an', kwargs.pop('actionName',
                                                   "Select File"))
        ret = cmds.fileBrowserDialog(**kwargs)
        folder = _Path(folder[0])
        if folder:
            # Ensure something was entered/selected. But don't test if it exists
            # as this would break mode 1/100+ causing them to return None
            return folder
Esempio n. 3
0
def promptForFolder():
    """ Prompt the user for a folder path """

    # a little trick that allows us to change the top-level 'folder' variable from
    # the nested function ('getfolder') - use a single-element list, and change its content
    folder = [None]
    def getfolder(*args):
        folder[0] = args[0]
    ret = cmds.fileBrowserDialog(m=4, fc=getfolder, an="Get Folder")
    folder = _Path(folder[0])
    if folder.exists():
        return folder
Esempio n. 4
0
def promptForFolder():
    """ Prompt the user for a folder path """

    # a little trick that allows us to change the top-level 'folder' variable from
    # the nested function ('getfolder') - use a single-element list, and change its content
    folder = [None]

    def getfolder(*args):
        folder[0] = args[0]

    ret = cmds.fileBrowserDialog(m=4, fc=getfolder, an="Get Folder")
    folder = _Path(folder[0])
    if folder.exists():
        return folder
Esempio n. 5
0
def promptForPath(**kwargs):
    """ Prompt the user for a folder path """

    if cmds.about(linux=1):
        return _Path(fileDialog(**kwargs))

    else:
        # a little trick that allows us to change the top-level 'folder' variable from
        # the nested function ('getfolder') - use a single-element list, and change its content

        folder = [None]
        def getfolder(*args):
            folder[0] = args[0]

        kwargs.pop('fileCommand',None)
        kwargs['fc'] = getfolder

        kwargs['an'] = kwargs.pop('an', kwargs.pop('actionName', "Select File"))
        ret = cmds.fileBrowserDialog(**kwargs)
        folder = _Path(folder[0])
        if folder.exists():
            return folder