def onToolbarLoadProject(self): project_name = self.toolbar.getProject() if project_name: PillarsUtils.loadProject(project_name) self.loadFromGoto() self.statusBar.setMessage("Load Project Successful") else: QtGui.QMessageBox.about(self, "Wrong", "Please enter Project name")
def loadScenesForShotTool(): shot = PillarsUtils.loadGotoAsset() proj = PillarsUtils.loadGotoProject() shot_dir = str(shot.location) proj_dir = str(proj.getFullPath()) hbridge.loadScene(shot_dir, proj_dir) hou.ui.displayMessage("Load Scene Secessfull.")
def loadPre(self): goto = PillarsUtils.loadGoto() if goto: self.gotobar.setProject(goto.project) self.gotobar.setAsset(goto.asset) self.gotobar.setTask(goto.task) self.gotobar.setInfo("P:/Project/%s/%s/%s" % (goto.project, goto.asset, goto.task)) self.assets = PillarsUtils.loadAssets() self.updateAssetViewer()
def loadFromGoto(self): self.project = PillarsUtils.loadGotoProject() self.asset = PillarsUtils.loadGotoAsset() self.task = PillarsUtils.loadGotoTask() self.author = PillarsUtils.loadGotoAuthor() if self.project and self.asset and self.task and self.author: self.toolbar.setInfo(self.project.name, self.asset.name, self.task.name, self.asset.location, self.task.location) self.toolbar.setLogName(self.author.name) self.assets = PillarsUtils.loadAssets() if self.assets: self.updateAssetViewer()
def onToolbarLoadProject(self): project_name = self.toolbar.getProject() if project_name: self.project = PillarsCore.Project(project_name) self.project.location = PillarsUtils.PillarsProjectDir self.project.writeJson(PillarsUtils.GotoProject) PillarsUtils.loadProject(project_name) self.loadFromGoto() self.statusBar.setMessage("Load Project Successful") else: QtGui.QMessageBox.about(self, "Wrong", "Please enter Project name")
def onLoginButtonClicked(self): company = unicode(self.tCompany.text()) user = unicode(self.tAuthor.text()) password = unicode(self.tPassword.text()) if PillarsAssetClient.login(company, user, password): self.author = PillarsAssetClient.getAuthor(user) if self.author: PillarsUtils.writeCurrentAuthor(self.author) self.accept() self.close() return True else: return False
def onProjButtonClick(self): proj_names = PillarsUtils.getAllProjectNames() selui = SelectItemDialog(title = "Projects", items = proj_names) if selui.exec_() == QtGui.QDialog.Accepted: sel = selui.getSelected() self.tProj.setText(sel) self.tAsset.setText('') self.tTask.setText('') return True else: return False
def onLoginButtonClicked(self): company = unicode(self.tCompany.text()) user = unicode(self.tAuthor.text()) password = unicode(self.tPassword.text()) if PillarsUtils.login(company, user, password): self.accept() self.close() return True else: return False
def onGoTaskButtonClick(self): project_name = unicode(self.tProj.text()) asset_name = unicode(self.tAsset.text()) if project_name and asset_name: task_names = PillarsUtils.getTaskNames(project_name, asset_name) selui = SelectItemDialog(title = "Tasks", items = task_names) if selui.exec_() == QtGui.QDialog.Accepted: sel = selui.getSelected() self.tTask.setText(sel) return True else: return False
def onShelfbarGoto(self): project_name = self.toolbar.getProject() asset_name = self.toolbar.getAsset() task_name = self.toolbar.getTask() self.project = PillarsCore.Project(project_name) self.project.location = PillarsUtils.PillarsProjectDir tasks = PillarsUtils.getTasks(project_name, asset_name) for task in tasks: if task_name == task.name: task.location = PillarsCore.getWorkPath(PillarsUtils.PillarsProjectDir, project_name, self.author.department, self.author.name) self.task = task self.toolbar.setTaskPath(self.task.location) self.project.writeJson(PillarsUtils.GotoProject) self.asset.writeJson(PillarsUtils.GotoAsset) self.task.writeJson(PillarsUtils.GotoTask) self.statusBar.setMessage("Goto %s:%s Successful" % (asset_name, task_name))
def onGotoBarGoto(self): project_name = self.gotobar.getProject() asset_name = self.gotobar.getAsset() task_name = self.gotobar.getTask() self.assets = PillarsAssetClient.getAllAssets(project_name) self.tasks = PillarsAssetClient.getTasks(project_name, asset_name) self.updateAssetViewer() if self.assets: PillarsUtils.writeAssets(self.assets) if self.tasks: PillarsUtils.writeTasks(self.tasks) goto = PillarsCore.Goto(project_name, asset_name, task_name) PillarsUtils.writeGoto(goto) self.gotobar.setInfo("P:/Project/%s/%s/%s" % (goto.project, goto.asset, goto.task)) print "Goto successful."
def loadTool(): asset = PillarsUtils.loadGotoAsset() task = PillarsUtils.loadGotoTask() hbridge.loadDepend(str(asset.location), str(task.name))
def gotoTool(): project = PillarsUtils.loadGotoProject() if project: p_path = str(project.getFullPath()) hou.hscript("job %s" % p_path)
- To post Asset Server, you must login first. """ __author__ = "kun.wang" __version__ = "0.1" import os, sys, string from datetime import datetime import httplib, urllib, cookielib, urllib2 import json from PillarsCore import * import PillarsUtils SERVER = PillarsUtils.getAssetServer() COOKIE_FILE = os.path.join(PillarsUtils.Pillars_Home, 'cookie') def login(company, username, password): login_url = 'http://%s/login/' % SERVER login_data = urllib.urlencode({'login_input_isMem' : 'on', 'login_input_company' : company.encode('UTF-8'), 'login_agreement': 'on', 'login_input_username' : username, 'login_input_password' : password}) req = urllib2.Request(login_url, login_data) req.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0)') ckjar = cookielib.MozillaCookieJar(COOKIE_FILE) ckproc = urllib2.HTTPCookieProcessor(ckjar) try: opener = urllib2.build_opener(ckproc) f = opener.open(req) ckjar.save(ignore_discard=True, ignore_expires=True)
def publishCurrentAsset(): asset = PillarsUtils.loadGotoAsset() task = PillarsUtils.loadGotoTask() mbridge.assetPublish(asset.location, asset.name, task.name, task.version) mc.confirmDialog(title='OK', message='Publish %s successful.' % asset.name)
def createCameraAsset(): shot = PillarsUtils.loadGotoAsset() if shot.group == "shot": mbridge.createAsset("%s_camera" % shot.name, "camera")
def createCurrentAsset(): asset = PillarsUtils.loadGotoAsset() mbridge.createAsset(asset.name, asset.type)
def goto(): work_path = PillarsUtils.getWorkingPath() mbridge.setWorkspace(work_path)
def onToolbarLogin(self): self.author = PillarsUtils.loadGotoAuthor() self.toolbar.setLogName(self.author.name)
def setCurrentStatus(self): self.tCompany.setText(u"动量影视") self.author = PillarsUtils.loadCurrentAuthor() if self.author: self.tAuthor.setText(self.author.name) return True