def OpenPathList(self): path = hou.homeHoudiniDirectory() + '/Proj_Path.txt' path = path.replace("/", "\\") expression = 'explorer "' + str(path) + '"' #print expression subprocess.Popen(expression)
def Refresh(self): if self.proj != self.transition and self.proj != '': self.folderlist.clear() fl = open(hou.homeHoudiniDirectory() + '/Proj_Path.txt').read().splitlines() fl.reverse() for folder in fl: self.folderlist.addItem(folder) self.transition = self.proj self.projpath = str(self.folderlist.currentText())
def setproject(self): setpath = hou.ui.selectFile(title='Set Project', file_type=hou.fileType.Directory) newpath = os.path.dirname(setpath) + '/' if newpath != '/': self.proj = newpath sizeFile = os.stat(hou.homeHoudiniDirectory() + '/Proj_Path.txt').st_size f = open(hou.homeHoudiniDirectory() + '/Proj_Path.txt', 'a+') if (sizeFile == 0): f.write(newpath) else: f.write("\n" + newpath) f.close() #self.setproj.setText("added : "+str(newpath)) self.Refresh() self.CreateInterface()
def Refresh(self): if self.proj != self.transition and self.proj != '': self.folderlist.clear() #Open the file back and read the contents #f=open(hou.homeHoudiniDirectory()+'/Proj_Path.txt', "r") fl = np.genfromtxt(hou.homeHoudiniDirectory() + '/Proj_Path.txt', dtype=str) for folder in fl: self.folderlist.addItem(folder) self.transition = self.proj self.projpath = str(self.folderlist.currentText())
def read(self): pathArr = [] pathHoudini = hou.homeHoudiniDirectory() for env in os.listdir(pathHoudini): if env == "houdini.env": envPath = pathHoudini + "\\" + env f1 = open(envPath, "r") a = list(f1.readlines()) for i in a: if i[0:len("SMILE_HOT_BOXPATH")] == "SMILE_HOT_BOXPATH": pathArr.append(i) f1.close() return pathArr
def runNk(self, newNukePath, nkExePath, nkPythonPaht): #write nkbat homePath = hou.homeHoudiniDirectory() fnkbat = open(homePath + "/" + "nkbat.bat", "w") fnkbat.write('"') fnkbat.write(nkPythonPaht + '" ' + homePath + "/" + "nkstart.py") fnkbat.close() #rwitr nkstart.py nkstart = open(homePath + "/" + "nkstart.py", "w") nkstart.write("import subprocess\n") cmd = [nkExePath, "--nukex", newNukePath] nkstart.write("cmd = ") nkstart.write(str(cmd)) nkstart.write("\n") nkstart.write("subprocess.Popen(cmd ,stdout=subprocess.PIPE,shell=0)") nkstart.close()
def run(self): copySouse = "" newNukePath = "" writeSource = self.sourceRoot + self.setRootData() for path in self.picPathArry: writeSource += self.setReadData(path) allFiles = os.listdir(self.nkfondPath) allFilesTemp = [] newNukePath = self.nkfilePath if allFiles == []: with open(self.nkfilePath, "w") as f: f.write(writeSource) else: for a in allFiles: if a[-1] == "~": pass else: allFilesTemp.append(a) allFiles = allFilesTemp newNukePath = self.nkfondPath + "/" + allFiles[-1] with open(newNukePath) as f: copySouce = f.read() writeSource = copySouce for path in self.picPathArry: writeSource += self.setReadData(path) with open(newNukePath, "w") as f: f.write(writeSource) #run nuk nkExePath = r"C:\Program Files\Nuke10.5v2\Nuke10.5.exe" nkPythonPath = r"C:\Program Files\Nuke10.5v2\python.exe" self.runNk(newNukePath, nkExePath, nkPythonPath) nkBatPath = hou.homeHoudiniDirectory() + "/nkbat.bat" bat_py = os.path.normcase(nkBatPath) os.popen('explorer.exe {0}'.format(bat_py)) print "final", newNukePath
def __init__(self): super(MfProjectViewer, self).__init__() self.scriptpath = 'C:/Users/Public/pipeline/shared/maximef/Houdini/mfaure_tools/python_panels/MfProjectViewer' self.tmpPath = hou.homeHoudiniDirectory() + '/Proj_Path.txt' try: pathfile = open(self.tmpPath) except IOError: #If not exists, create the file pathfile = open(self.tmpPath, 'w+') txtcon = pathfile.readline() pathfile.close() self.oripath = txtcon.replace('\\', '/') self.proj = self.oripath self.transition = '0' loader = QtUiTools.QUiLoader() self.ui = loader.load(self.scriptpath + '/UI.ui') self.ui.setStyleSheet(""" QPushButton{ color: rgb(255,255, 255); background-color: rgba(50, 50, 50, 250);border:none; border-radius:17} QPushButton:hover, #autoEnvVariables:hover, #folderlist:hover, #SAVEFILE QPushButton:hover, QGroupBox#manualvariable QPushButton:!disabled:hover{ color: black; font-weight:bold; background-color: #ffa600;} #SAVEFILE QPushButton{border-radius:20} #SAVEFILE QPushButton{ color: rgb(255, 255, 255);background-color:#5b25fa;transition:all 0.7s } #autoEnvVariables{ color: rgb(255, 255, 255);background-color:#ff3c46; } #folderlist{background-color:rgb(40,40, 40);border:none;} #ALL, #scrollAreaAll{border:none} QGroupBox{border-color:rgbx(255,255,255,50);border-radius:0;} QGroupBox#manualvariable QPushButton:disabled{color: grey; background-color: rgba(50, 50, 50, 150); border-radius:10;} QGroupBox#manualvariable QPushButton:!disabled{ background-color:#fef99c ;color:black; border-radius:10} QGroupBox#manualvariable QPushButton:!disabled:hover{font-weight:normal} """) self.MF_PV_title = self.ui.findChild(QtWidgets.QPushButton, 'MF_PV_title') self.MF_PV_title.clicked.connect(self.openDocumentation) self.setproj = self.ui.findChild(QtWidgets.QPushButton, 'setproj') self.setproj.setText("") self.setproj.setIcon(hou.qt.Icon("BUTTONS_add")) self.setproj.setToolTip('Add a path of houdini scene to the list') self.setproj.setText('') self.setproj.clicked.connect(self.setproject) self.openPathList = self.ui.findChild(QtWidgets.QPushButton, 'openPathList') self.openPathList.clicked.connect(self.OpenPathList) self.openPathList.setIcon(hou.qt.Icon("DATATYPES_file")) self.openPathList.setToolTip('Open path list') self.openPathList.setText('') self.scenelist = self.ui.findChild(QtWidgets.QListWidget, 'scenelist') self.folderlist = self.ui.findChild(QtWidgets.QComboBox, 'folderlist') self.folderlist.activated.connect(self.Refresh) self.folderlist.activated.connect(self.CreateInterface) self.saveas = self.ui.findChild(QtWidgets.QPushButton, 'save_as') self.saveas.clicked.connect(self.saveprojectAs) self.save = self.ui.findChild(QtWidgets.QPushButton, 'save') self.save.clicked.connect(self.saveProject) self.incrementsave = self.ui.findChild(QtWidgets.QPushButton, 'increment_save') self.incrementsave.clicked.connect(self.incrementSave) self.ImportPath = self.ui.findChild(QtWidgets.QPushButton, 'ImportPath') self.ImportPath.clicked.connect(self.SubmitImportPath) self.ImportPath.setToolTip("set IMPORT PATH") self.ExportPath = self.ui.findChild(QtWidgets.QPushButton, 'ExportPath') self.ExportPath.clicked.connect(self.SubmitExportPath) self.ExportPath.setToolTip("set EXPORTS PATH") self.elementsPath = self.ui.findChild(QtWidgets.QPushButton, 'elementsPath') self.elementsPath.clicked.connect(self.SubmitElementsPath) self.elementsPath.setToolTip("set ELMTS PATH") self.outPath = self.ui.findChild(QtWidgets.QPushButton, 'outPath') self.outPath.clicked.connect(self.SubmitOutPath) self.outPath.setToolTip("set OUT PATH") self.publishPath = self.ui.findChild(QtWidgets.QPushButton, 'publishPath') self.publishPath.clicked.connect(self.SubmitPublishPath) self.publishPath.setToolTip("set PUBLISH PATH") self.autoEnvVariables = self.ui.findChild(QtWidgets.QPushButton, 'autoEnvVariables') self.autoEnvVariables.clicked.connect(self.SubmitAutoEnvVariables) self.autoEnvVariables.setToolTip( 'automatically setup CACHE, ELEMENTS, PUBLISH and OUT variables.\n You need to save your file in a proper way like shot/work/task/hou' ) self.refreshBtn = self.ui.findChild(QtWidgets.QPushButton, 'refreshBtn') self.refreshBtn.clicked.connect(self.CreateInterface) self.refreshBtn.setText('') self.refreshBtn.setToolTip('refresh scene list') self.refreshBtn.setIcon(hou.qt.Icon("BUTTONS_cook", 50, 50)) self.openFolder = self.ui.findChild(QtWidgets.QPushButton, 'openFolder') self.openFolder.clicked.connect(self.OpenFolder) self.openFolder.setIcon(hou.qt.Icon("DATATYPES_bundle")) self.openFolder.setToolTip('open the folder in explorer') self.openFolder.setText('') self.openHoudiniFolder = self.ui.findChild(QtWidgets.QPushButton, 'openHoudiniFolder') self.openHoudiniFolder.clicked.connect(self.OpenHoudiniFolder) self.openHoudiniFolder.setIcon(hou.qt.Icon("DATATYPES_folder")) self.openHoudiniFolder.setToolTip('open the folder in Houdini') self.openHoudiniFolder.setText('') mainLayout = QtWidgets.QVBoxLayout() mainLayout.setAlignment(Qt.AlignTop) mainLayout.addWidget(self.ui) self.setLayout(mainLayout) self.Refresh() self.CreateInterface() self.scenelist.setIconSize(QSize(150, 150))
"""First iteration.""" import os import shutil import toolsAiram import hou TEMP_PATH = os.getenv("TEMP") GIT_PATH = toolsAiram.__file__.replace("\\", "/").split("toolsAiram.py")[0] USER_PATH = os.getcwd().replace("\\", "/") USER_NAME = os.getcwd().replace("\\", "/").split("/")[2] VERSION = hou.homeHoudiniDirectory().split("/houdini")[-1] HOUDINI_PATH = hou.homeHoudiniDirectory().replace("\\", "/") CPIO_PATH = os.path.join(HOUDINI_PATH, "cpiosFromDropbox").replace("\\", "/") CPIO_USER_PATH = os.path.join(CPIO_PATH, USER_NAME).replace("\\", "/") def copy_to_file(name_cpio): """Copy file function.""" if not os.path.exists(CPIO_PATH): os.mkdir(CPIO_PATH) if not os.path.exists(CPIO_USER_PATH): os.mkdir(CPIO_USER_PATH) selNodes = hou.selectedNodes() typeNet = selNodes[0].type().category().typeName() fullPath = os.path.join( CPIO_USER_PATH, USER_NAME + "." + VERSION + "." + typeNet + "." + name_cpio + ".cpio") selNodes[0].parent().saveChildrenToFile(selNodes, [], fullPath)
import os import hou hver = 0 if os.environ["HFS"] != "": ver = os.environ["HFS"] # hver = int(ver[ver.rindex('.') + 1:]) from hutil.Qt import QtCore # ------------------------------------------------------ Setting Paths # SECTION Setting Paths ---------------------------------------------- scriptpath = os.path.dirname(os.path.realpath(__file__)) app_name = "Searcher" settingsfile = "searcher_settings.ini" dbfile = "searcher.db" searcher_path = os.path.join(hou.homeHoudiniDirectory(), app_name) searcher_settings = os.path.join(searcher_path, settingsfile) defaultdbpath = os.path.join(searcher_path, dbfile) settingsdata = QtCore.QSettings(searcher_settings, QtCore.QSettings.IniFormat) # !SECTION Setting Paths # -------------------------------------------------- Setting Functions # SECTION Setting Functions ------------------------------------------ # -------------------------------------- createdefaults # NOTE createdefaults --------------------------------- def createdefaults(platform): def_set = util.DEFAULT_SETTINGS def_set[util.SETTINGS_KEYS[1]] = str(defaultdbpath) if platform == "unix":
def get_platform(): return getattr(hou.session, "PLATFORM", None) def get_settings(): return getattr(hou.session, "SETTINGS", None) def get_dbconnection(): return getattr(hou.session, "DBCONNECTION", None) # scriptpath = os.path.dirname(current_file_path) dbfile = "searcher.db" dbpath = os.path.join( hou.homeHoudiniDirectory(), 'Searcher', dbfile ) hou.session.SETTINGS = {} hou.session.DBCONNECTION = DatabaseProxy() db = DatabaseProxy() # --------------------------------------------------------- DatabaseModels # SECTION DatabaseModels ------------------------------------------------- # ------------------------------------------------ Settings # NOTE Settings ------------------------------------------- class Settings(Model): id = IntegerField(unique=True) indexvalue = IntegerField() defaulthotkey = TextField()
from bookish.config import DefaultConfig, expandpath from bookish.stores import FileStore from bookish.stores import MountStore from bookish.stores import ZipTree from houdinihelp import hcoloring, hpages, hsearch, hstores, htextify try: import hou except ImportError: hou = None if hou: hou_home = hou.homeHoudiniDirectory() elif "HOUDINI_USER_PREF_DIR" in os.environ: hou_home = os.environ["HOUDINI_USER_PREF_DIR"] else: hou_home = "." if "HOUDINI_VERSION" in os.environ: version = os.environ["HOUDINI_VERSION"] major_version, minor_version, build_version = version.split(".") else: version = major_version = minor_version = build_version = "" def houdini_docs(doc_dir, add_houdini_path=False, with_zip=False): # Returns a list of Store objects
def __init__(self): super(MfProjectViewer, self).__init__() self.scriptpath = 'C:/Users/Public/pipeline/shared/maximef/Houdini/MF_PROJECT/scripts/MfProjectViewer' self.tmpPath = hou.homeHoudiniDirectory() + '/Proj_Path.txt' try: pathfile = open(self.tmpPath) except IOError: #If not exists, create the file pathfile = open(self.tmpPath, 'w+') txtcon = pathfile.readline() pathfile.close() self.oripath = txtcon.replace('\\', '/') self.proj = self.oripath self.transition = '0' loader = QtUiTools.QUiLoader() self.ui = loader.load(self.scriptpath + '/UI.ui') self.setproj = self.ui.findChild(QtWidgets.QPushButton, 'setproj') self.setproj.setText("ADD PATH") self.openPathList = self.ui.findChild(QtWidgets.QPushButton, 'openPathList') self.openPathList.clicked.connect(self.OpenPathList) self.scenelist = self.ui.findChild(QtWidgets.QListWidget, 'scenelist') #self.label = self.ui.findChild(QtWidgets.QLabel, 'label_2') self.height = self.ui.findChild(QtWidgets.QSpinBox, 'spinbox') self.setproj.clicked.connect(self.setproject) self.folderlist = self.ui.findChild(QtWidgets.QComboBox, 'folderlist') self.folderlist.activated.connect(self.Refresh) self.folderlist.activated.connect(self.CreateInterface) self.height.valueChanged.connect(self.changeHeight) self.saveas = self.ui.findChild(QtWidgets.QPushButton, 'save_as') self.saveas.clicked.connect(self.saveprojectAs) self.save = self.ui.findChild(QtWidgets.QPushButton, 'save') self.save.clicked.connect(self.saveProject) self.incrementsave = self.ui.findChild(QtWidgets.QPushButton, 'increment_save') self.incrementsave.clicked.connect(self.incrementSave) self.imagesPath = self.ui.findChild(QtWidgets.QPushButton, 'imagesPath') self.imagesPath.setText('images path : ') self.imagesPath.clicked.connect(self.SubmitImagesPath) self.cachesPath = self.ui.findChild(QtWidgets.QPushButton, 'cachesPath') self.cachesPath.setText('caches path : ') self.cachesPath.clicked.connect(self.SubmitCachesPath) self.elementsPath = self.ui.findChild(QtWidgets.QPushButton, 'elementsPath') self.elementsPath.setText('elements path : ') self.elementsPath.clicked.connect(self.SubmitElementsPath) self.outPath = self.ui.findChild(QtWidgets.QPushButton, 'outPath') self.outPath.setText('out path : ') self.outPath.clicked.connect(self.SubmitOutPath) self.refreshBtn = self.ui.findChild(QtWidgets.QPushButton, 'refreshBtn') self.refreshBtn.clicked.connect(self.CreateInterface) self.openFolder = self.ui.findChild(QtWidgets.QPushButton, 'openFolder') self.openFolder.clicked.connect(self.OpenFolder) self.openHoudiniFolder = self.ui.findChild(QtWidgets.QPushButton, 'openHoudiniFolder') self.openHoudiniFolder.clicked.connect(self.OpenHoudiniFolder) mainLayout = QtWidgets.QVBoxLayout() mainLayout.addWidget(self.ui) self.setLayout(mainLayout) self.Refresh() self.CreateInterface() self.scenelist.setIconSize(QSize(150, 150)) #self.label.setMaximumHeight(200) heightfile = open(self.scriptpath + '/mf_ProjV/Height.txt') heightS = heightfile.readline() try: height = int(heightS) except ValueError: height = 500 self.scenelist.setMaximumHeight(height) self.scenelist.setMinimumHeight(height) self.height.setValue(height) heightfile.close()
import os import hou user = os.getenv('USER') path = os.path.join(hou.homeHoudiniDirectory(), user).replace("\\", "/") pathShelf = os.path.join(path, user + '.shelf').replace("\\", "/") iconOUT = '' cpioInstaller = """import os path=%(file)r toolName=(%(tt)r) if kwargs['ctrlclick']: display=hou.ui.displayConfirmation('Delete this amazing tool?') if display==True: os.remove(path) hou.shelves.tool(toolName).destroy() else: pass else: panes=hou.ui.currentPaneTabs() for i in panes: if 'NetworkEditor' in str(i.type()): network=i.pwd() break nodes=network.loadChildrenFromFile(path) """ selNodes = hou.selectedNodes() if len(selNodes) == 0: readInput = hou.ui.readInput('Name to save the nodes', buttons=( 'Save',
import hou hver = 0 if os.environ["HFS"] != "": ver = os.environ["HFS"] # hver = int(ver[ver.rindex('.') + 1:]) from hutil.Qt import QtCore # ------------------------------------------------------ Setting Paths # SECTION Setting Paths ---------------------------------------------- scriptpath = os.path.dirname(os.path.realpath(__file__)) app_name = "Searcher" settingsfile = "searcher_settings.ini" dbfile = "searcher.db" searcher_path = os.path.join( hou.homeHoudiniDirectory(), app_name ) searcher_settings = os.path.join( searcher_path, settingsfile ) defaultdbpath = os.path.join( searcher_path, dbfile ) settingsdata = QtCore.QSettings(searcher_settings, QtCore.QSettings.IniFormat) # !SECTION Setting Paths # -------------------------------------------------- Setting Functions # SECTION Setting Functions ------------------------------------------ # -------------------------------------- createdefaults
def openFolder(): folder = os.path.join(hou.homeHoudiniDirectory(), user).replace("\\", "/") #os.system('xdg-open "%s"' %folder) os.startfile(folder)
def get_platform(): return getattr(hou.session, "PLATFORM", None) def get_settings(): return getattr(hou.session, "SETTINGS", None) def get_dbconnection(): return getattr(hou.session, "DBCONNECTION", None) scriptpath = os.path.dirname(current_file_path) dbfile = "searcher.db" dbpath = os.path.join(hou.homeHoudiniDirectory(), 'Searcher', dbfile) hou.session.SETTINGS = {} hou.session.DBCONNECTION = DatabaseProxy() db = DatabaseProxy() # --------------------------------------------------------- DatabaseModels # SECTION DatabaseModels ------------------------------------------------- # ------------------------------------------------ Settings # NOTE Settings ------------------------------------------- class Settings(Model): id = IntegerField(unique=True) indexvalue = IntegerField() defaulthotkey = TextField() searchdescription = IntegerField()