Пример #1
0
def preferedUnityVersion():
    projPath = getProj.getProject()
    settingsFile = '%sdata/projectSettings.json' % (projPath)
    with open(settingsFile) as json_data:
        data = json.load(json_data)
        json_data.close()
        return (data['unity']['preferedVersion'])
Пример #2
0
def submitButton():
    prefData = []
    for l in prefWidget.layerWidgets:

        prefData.append([l.label.text(), 'value', '%s' % l.lineEdit.text()])
    IO.writePrefsToFile(prefData,
                        '%s/data/projectPrefs.json' % getProj.getProject())
Пример #3
0
def fixRef(asset, errorButton):

    #get full path to incorrectly referenced file
    fullRefPath = cmds.referenceQuery(asset, filename=True)

    publishName = ''
    #try and get name from top transform publish attribute
    if cmds.attributeQuery('publishName', n=asset, exists=True):
        publishName = cmds.getAttr('%s.publishName' % asset)
    else:
        #try and get the name from the start of the incorrect filename
        publishName = '%s_REF' % fullRefPath.split('/')[-1].split('_')[0]

    #find ref node
    refNode = cmds.referenceQuery(asset, referenceNode=True)
    parentFolder = 'scenes/Models/%s' % fullRefPath.split('/')[-3]
    projPath = getProj.getProject()
    #check assumed path exists
    checkExistsPath = '%s%s/%s.ma' % (projPath, parentFolder, publishName)
    newPath = '%s/%s.ma' % (parentFolder, publishName)
    if os.path.isfile(checkExistsPath):
        #set new path
        cmds.file(newPath, loadReference=refNode)
        #hide button
        cmds.iconTextButton(errorButton, e=True, vis=False)
Пример #4
0
def listAllShots():
	projPath = getProj.getProject()
	pathName = '%s../Unity/Assets/Resources/json'%projPath
	print pathName
	
	files = os.listdir(pathName)
	
	shDict = {}
	EPs = []
	SEQs = []
	SHs = []
	for f in files:
		if f.split('.')[-1] == 'json':
			print f
			
			asList = f.split('_')
			EP = [s for s in asList if "EP" in s]
			SEQ = [s for s in asList if "SEQ" in s]
			SH = [s for s in asList if "SH" in s]
			V = [s for s in asList if "v" in s]
			
			if EP:
				if EP[0] not in shDict:
					shDict[EP[0]] = {}
				if SEQ[0] not in shDict[EP[0]]:
					shDict[EP[0]][SEQ[0]] = {}
				if SH[0] not in shDict[EP[0]][SEQ[0]]:
					shDict[EP[0]][SEQ[0]][SH[0]] = {}
				shDict[EP[0]][SEQ[0]][SH[0]] = f
		
	return shDict
Пример #5
0
def getParentFolder():
    #get parent folder
    projPath = getProj.getProject()
    scenePath = cmds.file(q=True, sn=True)
    parentFolder = projPath.rsplit('/', 2)[0]
    pathLen = len(projPath.split('/'))
    remainingPath = scenePath.split('/', pathLen)[-1].rsplit('/', 1)[0]
    return parentFolder, remainingPath
Пример #6
0
def submitButton():


    print 'submit'

    #loop through layers in layerWidget
    for l in layerWidget.layerWidgets:

        if l.checkBox_layerEnable.isChecked() == 1:
            widgets = l.findChildren(QtWidgets.QWidget)
            for w in widgets:
                try:
                    value = ''
                    type = w.metaObject().className()
                    if type == 'QLineEdit':
                        value = w.text()
                    if type == 'QComboBox':
                        value = w.currentText()
                    if type == 'QSpinBox':
                        value = w.value()
                    if value and w.parent() == l:
                        if cmds.attributeQuery(w.objectName(),node=l.checkBox_layerEnable.text(),ex=True) == False:
                            cmds.addAttr(l.checkBox_layerEnable.text(),ln=w.objectName(),dt='string')
                        cmds.setAttr('%s.%s'%(l.checkBox_layerEnable.text(),w.objectName()),value,type="string")       
                except:
                    pass

            #create string
            submitString = ''
            submitString += '%s '%stf_window.mainWidget.lineEdit_submitExe.text()
            submitString += ' -Type Redshift for Maya'
            submitString += ' -Scene %s'%getProj.filepath()
            submitString += ' -Project %s'%getProj.getProject()
            submitString += ' -Name maya: %s (%s)'%(getProj.sceneName(),l.checkBox_layerEnable.text())
            submitString += ' -Extra \"-rl %s\"'%l.checkBox_layerEnable.text()
            submitString += ' -Priority %s'%l.layerPrioritySlider.value()
            submitString += ' -PacketSize %s'%l.spinBox_layerPacketSize.value()
            submitString += ' -Pool %s'%l.comboBox_layerPool.currentText()
            submitString += ' -Range %s'%l.lineEdit_layerRange.text()
            submitString += ' -Executable %s'%stf_window.mainWidget.lineEdit_render.text()
            if stf_window.mainWidget.checkBox_paused.isChecked() == 1:
                submitString += ' -Paused'
            submitString += ' -Creator %s'%stf_window.mainWidget.lineEdit_name.text()
            submitString += ' -StaggerStart %s'%stf_window.mainWidget.lineEdit_stagger.text()
            submitString += ' -Note %s'%stf_window.mainWidget.lineEdit_note.text()
            if stf_window.mainWidget.checkBox_errors.isChecked() == 1:
                submitString += ' -DetectErrors 0'
            submitString += ' -CPUs -1 -GPUs 1 -RAM -1 -DistributeMode 0 -StaggerCount 1 -StaggerMode 1'
            try:
                smedgeBifrostCache.submitToSmedge(4,100,1,0,1)
            except:
                print 'failed to submit, check path to submit.exe exists'
            print submitString
            layerDict(l.checkBox_layerEnable.text())
    localDict()
    fileDict()
Пример #7
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
Пример #8
0
def exportAnimation(obj):
    #rename file temporarily
    filename = cmds.file(q=True, sn=True)
    #objName = obj.split('|')[-1].split(':')[-1]
    objName = obj.split('|')[-1]
    objName = objName.replace(':', '_')
    newName = '%s_%s' % (filename.rsplit('.', 1)[0], objName)
    print 'new name = %s' % newName
    #move object to the root and redefine as itself if it's not already
    try:
        obj = cmds.parent(obj, w=True)[0]
    except:
        pass

    #select object to export
    try:
        exportObject = '%s|*:DeformationSystem' % (obj)
        cmds.select(exportObject, r=True)
    except:
        exportObject = obj
        cmds.select(exportObject, r=True)
    #define full file name
    if ':' in exportObject:
        ns = exportObject.split(':', 1)[0]
        ns = ns.split('|')[-1]
        ns = ':%s' % ns
    else:
        ns = ':'
    refFileName = ('%s.fbx' % (newName.rsplit('/', 1)[-1].split('.')[0]))

    #output name
    parentFolder, remainingPath = getParentFolder()
    pathName = '%s/Unity/Assets/Resources/%s/%s' % (parentFolder,
                                                    remainingPath, refFileName)
    #make folder if it doesn't exist
    if not os.path.exists(pathName.rsplit('/', 1)[0]):
        os.makedirs(pathName.rsplit('/', 1)[0])

    #load fbx presets from file
    mel.eval(
        "FBXLoadExportPresetFile -f \"%s/data/IoM_animExport.fbxexportpreset\";"
        % getProj.getProject())
    #export fbx
    cmds.file(pathName,
              force=True,
              type='FBX export',
              relativeNamespace=ns,
              es=True)
    #restore the filename
    cmds.file(rename=filename)

    return obj, newName, remainingPath
Пример #9
0
def newAsset():

    setProjectPth()

    newAssetType = assetManagerUIWindow.mainWidget.lineEdit_newAssetType.text()
    newAssetName = assetManagerUIWindow.mainWidget.lineEdit_newAssetName.text()
    if newAssetName:
        if not newAssetType:
            newAssetType = assetManagerUIWindow.mainWidget.listWidget_assetType.currentItem(
            ).text()
        project = assetManagerUIWindow.mainWidget.project_comboBox.currentText(
        )
        assetPath = '%s/scenes/REF/%s/%s' % (
            projectsDictGlobal[project]["projectPath"], newAssetType,
            newAssetName)

        itemsText = []
        items = []
        for index in xrange(
                assetManagerUIWindow.mainWidget.listWidget_assetType.count()):
            items.append(
                assetManagerUIWindow.mainWidget.listWidget_assetType.item(
                    index))
            itemsText.append(
                assetManagerUIWindow.mainWidget.listWidget_assetType.item(
                    index).text())

        if newAssetType not in itemsText:
            #add item to type list
            itm = QtWidgets.QListWidgetItem(newAssetType)
            assetManagerUIWindow.mainWidget.listWidget_assetType.addItem(itm)
            assetManagerUIWindow.mainWidget.listWidget_assets.clear()
            if not os.path.exists(assetPath):
                os.makedirs(assetPath)

        else:
            for i in items:
                if newAssetType == i.text():
                    itm = i
            #setType()
        itm.setSelected(True)

        #add item to asset list
        try:
            dirname = os.path.dirname(__file__)
        except:
            print 'running in test environment'
            dirname = 'C:/Users/Admin/Documents/Toolbox'
        itm = QtWidgets.QListWidgetItem(
            QtGui.QIcon('%s/icons/lightRed.png' % (dirname)), newAssetName)
        assetManagerUIWindow.mainWidget.listWidget_assets.addItem(itm)
        for index in xrange(
                assetManagerUIWindow.mainWidget.listWidget_assets.count()):
            (assetManagerUIWindow.mainWidget.listWidget_assets.item(index)
             ).setSelected(False)
        itm.setSelected(True)
        #create folder and file
        if not os.path.exists(assetPath):
            os.makedirs(assetPath)
        #create new file
        cmds.file(newFile=True, force=True)
        cmds.file(rename='%s/%s_v001_cl.mb' % (assetPath, newAssetName))
        #set settings from project config file
        try:
            configFolder = '%s../.projectData' % getProj.getProject()
            projectsDict = IO.loadDictionary('%s/projectPrefs.json' %
                                             configFolder)
            cmds.setAttr("defaultResolution.width",
                         int(projectsDict["resolutionW"]["value"]))
            cmds.setAttr("defaultResolution.height",
                         int(projectsDict["resolutionH"]["value"]))
            fps = '%sfps' % (projectsDict["frameRate"]["value"])
            cmds.currentUnit(time=fps)
        except:
            pass
Пример #10
0
def projectDict():
    prefData = []
    prefData.append(['pathToRenderExe','value','\'%s\''%stf_window.mainWidget.lineEdit_render.text()])
    prefData.append(['trelloBoard','value','\'%s\''%stf_window.mainWidget.lineEdit_trelloBoard.text()])
    IO.writePrefsToFile(prefData,'%s/data/projectPrefs.json'%getProj.getProject())
Пример #11
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