Esempio n. 1
0
def removeProject():
    #read curent project from dropdown menu
    currentProject = assetManagerUIWindow.mainWidget.project_comboBox.currentText(
    )
    #load project dictionary
    projectDict = IO.loadDictionary('%s/projects.json' % qtBase.local_path())
    #remove current project from dictionary
    del projectDict[currentProject]
    #write out to json file
    with open('%s/projects.json' % qtBase.local_path(), mode='w') as feedsjson:
        json.dump(projectDict, feedsjson, indent=4, sort_keys=True)
    #remove text from dropdown menu
    assetManagerUIWindow.mainWidget.project_comboBox.removeItem(
        assetManagerUIWindow.mainWidget.project_comboBox.currentIndex())
Esempio n. 2
0
def selectFolder():
    filename = QtWidgets.QFileDialog.getExistingDirectory()
    projectName = filename.split('/')[-2]
    projectPath = filename
    projectData = []
    projectData.append([projectName, 'projectPath', projectPath])
    IO.writePrefsToFile(projectData, '%s/projects.json' % qtBase.local_path())
    assetManagerUIWindow.mainWidget.project_comboBox.addItems([projectName])
    assetManagerUIWindow.mainWidget.project_comboBox.setCurrentText(
        projectName)

    global projectsDictGlobal
    projectsDictGlobal = IO.loadDictionary('%s/projects.json' %
                                           qtBase.local_path())
Esempio n. 3
0
def openAssetManagertWindow():
    global assetManagerUIWindow
    global projectsDictGlobal
    assetManagerUIWindow = assetManagerUI()

    #set project dropdown to current project
    currentProject = cmds.workspace(fullName=True)
    projectsDict = IO.loadDictionary('%s/projects.json' % qtBase.local_path())
    projectsDictGlobal = projectsDict
    print currentProject
    print projectsDict
    foundProject = 0
    for d in projectsDict:
        print d
        print projectsDict[d]['projectPath']
        if currentProject == projectsDict[d]['projectPath']:
            print 'key = %s' % d
            assetManagerUIWindow.mainWidget.project_comboBox.setCurrentText(d)
            setProject()
            foundProject = 1
    if foundProject == 0:
        #print
        try:
            setProject()
        except:
            pass
Esempio n. 4
0
def setProject():
    projectsDict = IO.loadDictionary('%s/projects.json' % qtBase.local_path())
    print projectsDict
    print 'foobar'
    key = assetManagerUIWindow.mainWidget.project_comboBox.currentText()
    projectPath = projectsDict[key]["projectPath"]

    assetTypeFolders = []
    path = '%s/scenes/REF/' % projectPath
    files = os.listdir(path)
    for name in files:
        if os.path.isdir(os.path.join(os.path.abspath(path), name)):
            #remove hidden folders
            if name[0] != '.':
                assetTypeFolders.append(name)
    #populate listWidget with folders
    assetManagerUIWindow.mainWidget.listWidget_assetType.clear()
    assetManagerUIWindow.mainWidget.listWidget_assetType.addItems(
        assetTypeFolders)

    #select first item in list
    try:
        items = []
        for index in xrange(
                assetManagerUIWindow.mainWidget.listWidget_assetType.count()):
            items.append(
                assetManagerUIWindow.mainWidget.listWidget_assetType.item(
                    index))

        items[0].setSelected(True)
        assetManagerUIWindow.mainWidget.listWidget_assetType.setCurrentItem(
            items[0])
        setType()
    except:
        pass
Esempio n. 5
0
def submitRenderUI():
    stf_window = qtBase.BaseWindow(qtBase.GetMayaWindow(),'submitToFarm.ui')
    stf_window._windowTitle = 'Submit to Farm'
    stf_window._windowName = 'SubmitToFarm'
    stf_window.pathModify = 'pipelime/'
    stf_window.BuildUI()
    stf_window.show(dockable=True)
    #hide config panel 
    stf_window.mainWidget.configPanel.setVisible(False)
    #connect buttons
    stf_window.mainWidget.submitButton.clicked.connect(submitButton)
    stf_window.mainWidget.pushButton_globals.clicked.connect(globalDict)
    stf_window.mainWidget.pushButton_project.clicked.connect(projectDict)
    stf_window.mainWidget.pushButton_user.clicked.connect(localDict)
    stf_window.mainWidget.pushButton_render.clicked.connect(selectRenderExe)
    stf_window.mainWidget.pushButton_submitExe.clicked.connect(selectSubmitExe)
    #icon on button
    try:
        buttonIcon = QtGui.QIcon("%s/icons/%s.png"%(qtBase.self_path(), "gear"))
        stf_window.mainWidget.pushButton_settings.setIcon(buttonIcon)
    except:
        pass
    #merge all dictionaries into one
    comboDict = {}
    comboDict = mergeDictionaries(comboDict,IO.loadDictionary('%s/config/globalPrefs.json'%qtBase.self_path()))
    comboDict = mergeDictionaries(comboDict,IO.loadDictionary('%s/data/projectPrefs.json'%getProj.getProject()))
    comboDict = mergeDictionaries(comboDict,IO.loadDictionary('%s/localPrefs.json'%qtBase.local_path()))
    rangeFromTimeline =  '%s-%s'%(sceneVar.getStartFrame(),sceneVar.getEndFrame())
    comboDict = mergeDictionaries(comboDict,{"lineEdit_range": {"value":rangeFromTimeline}})
    versionlessSceneName = ''.join([c for c in getProj.sceneName() if c not in "1234567890"])
    comboDict = mergeDictionaries(comboDict,IO.loadDictionary('%s/.data/%s.json'%(getProj.sceneFolder(),versionlessSceneName)))

    setOptions(comboDict,stf_window)
    return stf_window
Esempio n. 6
0
def incrementSceneFile():
    localPrefDict = IO.loadDictionary('%s/localPrefs.json' %
                                      qtBase.local_path())
    try:
        userInitials = localPrefDict["userInitials"]["value"].strip('\'')
    except:
        userInitials = ''
    incSave.IncrementCurrentFile(initials=userInitials)
    writeDataAfterSave()
Esempio n. 7
0
def localDict():
    prefData = []
    prefData.append(['userName','value','\'%s\''%stf_window.mainWidget.lineEdit_name.text()])
    prefData.append(['userSlackID','value','\'%s\''%stf_window.mainWidget.lineEdit_slack.text()])
    prefData.append(['checkBox_Paused','value',stf_window.mainWidget.checkBox_paused.isChecked()])
    prefData.append(['prioritySlider','value',stf_window.mainWidget.prioritySlider.value()])
    prefData.append(['comboBox_pool','value','\'%s\''%stf_window.mainWidget.comboBox_pool.currentText()])
    prefData.append(['spinBox_packetSize','value',stf_window.mainWidget.spinBox_packetSize.value()])
    IO.writePrefsToFile(prefData,'%s/localPrefs.json'%qtBase.local_path())
Esempio n. 8
0
def assetManagerUI():
    window = qtBase.BaseWindow(qtBase.GetMayaWindow(), 'lm_assetManager.ui')
    window._windowTitle = 'Asset Manager'
    window._windowName = 'assetManager'
    window.pathModify = 'pipelime/'
    window.BuildUI()
    window.show(dockable=True)

    projectsDict = IO.loadDictionary('%s/projects.json' % qtBase.local_path())

    projectLines = []
    for key in projectsDict:
        try:
            projectLines.append(key)
        except:
            pass

    window.mainWidget.project_comboBox.addItems(projectLines)
    window.mainWidget.project_comboBox.currentTextChanged.connect(setProject)

    window.mainWidget.listWidget_assetType.currentTextChanged.connect(setType)

    #add project button
    window.mainWidget.pushButton_addProject.clicked.connect(selectFolder)
    #remove project button
    window.mainWidget.pushButton_removeProject.clicked.connect(removeProject)
    #change asset selection
    window.mainWidget.listWidget_assets.currentTextChanged.connect(setAsset)
    window.mainWidget.listWidget_assets.doubleClicked.connect(doubleClicked)
    #window.mainWidget.listWidget_assets.itemSelectionChanged.connect(listChanged)
    #reference button
    window.mainWidget.pushButton_reference.clicked.connect(
        lambda: referenceAsset(
            window.mainWidget.listWidget_assets.selectedItems(), 0))
    #import button
    window.mainWidget.pushButton_import.clicked.connect(lambda: referenceAsset(
        window.mainWidget.listWidget_assets.selectedItems(), 1))
    #new button
    window.mainWidget.pushButton_new.clicked.connect(newAsset)
    #edit button
    window.mainWidget.pushButton_edit.clicked.connect(lambda: editAsset(
        window.mainWidget.listWidget_assets.currentItem().text()))
    #thumbnail button
    window.mainWidget.pushButton_thumb.clicked.connect(lambda: takeScreenshot(
        window.mainWidget.listWidget_assets.currentItem().text()))
    #save button
    window.mainWidget.pushButton_save.clicked.connect(saveSceneFile)
    #increment button
    window.mainWidget.pushButton_increment.clicked.connect(incrementSceneFile)
    #publish button
    window.mainWidget.pushButton_publish.clicked.connect(publishModel)

    #set project in menu

    return window
Esempio n. 9
0
def prefConfigUI():
    window = qtBase.BaseWindow(qtBase.GetMayaWindow(), 'lm_projectConfig.ui')
    window._windowTitle = 'Configure Project'
    window._windowName = 'configureProject'
    window.pathModify = 'pipelime/'
    window.BuildUI()
    window.show(dockable=True)
    #connect buttons
    window.mainWidget.pushButton_accept.clicked.connect(submitButton)

    #merge all dictionaries into one
    comboDict = {
        "userName": {
            "value": ""
        },
        "userInitials": {
            "value": ""
        },
        "userSlackID": {
            "value": "@"
        }
    }
    #comboDict = mergeDictionaries(comboDict,IO.loadDictionary('C:/Users/Admin/Documents/Toolbox/config/globalPrefs.json'))
    comboDict = mergeDictionaries(
        comboDict,
        IO.loadDictionary('%s/localPrefs.json' % qtBase.local_path()))
    projectDict = IO.loadDictionary('%s/../.projectData/projectPrefs.json' %
                                    getProj.getProject())
    print projectDict

    projectLines = []
    for key in projectDict:
        try:
            projectLines.append([key, projectDict[key]["value"]])
        except:
            pass

    lines = []
    for key in comboDict:
        try:
            lines.append([key, comboDict[key]["value"]])
        except:
            pass
    #layers = sceneVar.getRenderLayers()
    global prefWidget
    prefWidget = LayerWidget(lines, window.mainWidget.verticalLayout_user)
    global projectPrefsWidget
    prefWidget = LayerWidget(projectLines,
                             window.mainWidget.verticalLayout_project)
    global globalPrefsWidget
    prefWidget = LayerWidget(lines, window.mainWidget.verticalLayout_global)
    return window
Esempio n. 10
0
def writeDataAfterSave():
    metaData = []
    localPrefDict = IO.loadDictionary('%s/localPrefs.json' %
                                      qtBase.local_path())
    metaData.append([
        'user', 'value',
        '%s' % localPrefDict["userName"]["value"].strip('\'')
    ])
    metaData.append([
        'note', 'value',
        '%s' % assetManagerUIWindow.mainWidget.textEdit_note.toPlainText()
    ])
    IO.writePrefsToFile(
        metaData,
        '%s/.data/%s.json' % (getProj.sceneFolder(), getProj.sceneName()))
Esempio n. 11
0
def publishModel():
    IO_publishModel(0)
    metaData = []
    localPrefDict = IO.loadDictionary('%s/localPrefs.json' %
                                      qtBase.local_path())
    metaData.append([
        'user', 'value',
        '%s' % localPrefDict["userName"]["value"].strip('\'')
    ])
    metaData.append([
        'note', 'value',
        '%s' % assetManagerUIWindow.mainWidget.textEdit_note.toPlainText()
    ])
    folderName = getProj.sceneFolder().rsplit('/', 1)[1]
    IO.writePrefsToFile(
        metaData, '%s/.data/%s_REF.json' % (getProj.sceneFolder(), folderName))
Esempio n. 12
0
def setProjectPth():
    projectsDict = IO.loadDictionary('%s/projects.json' % qtBase.local_path())
    key = assetManagerUIWindow.mainWidget.project_comboBox.currentText()
    cmds.workspace(projectsDict[key]['projectPath'], openWorkspace=True)