def update_gallery_items(kwargs=None): """Reload all gallery items. """ galleries = hou.galleries.galleries() gal_files = set() # a set of all currently loaded gallery files # collect all loaded galleries and remove them for g in galleries: try: f = re.search('"([^\"]+)"', repr(g)).group(1) gal_files.add(f) #print "found:", f hou.galleries.removeGallery(f) except: pass # look for new gallery files in the paths, and collect them paths = hou.houdiniPath("HOUDINI_GALLERY_PATH") for path in paths: files = glob.glob(path + "/*.gal") gal_files.update(files) # install all found gallery files for file in gal_files: #print "installing:", file hou.galleries.installGallery(file)
def show_houdinipath(kwargs): """Displays entries . """ hou.ui.displayMessage( "Houdini Path ($HOUDINI_PATH) entries (in order)", details = "\n".join(hou.houdiniPath()), details_expanded=True)
def main(): filePath = hou.houdiniPath() abcFolder = "/import" abcPath = filePath[0] + abcFolder geo = hou.selectedNodes() if(os.path.exists(abcPath)): abcList = os.listdir(abcPath) geo[0].createNode( "null" ).setDisplayFlag(True) for abcFile in abcList: if(abcFile.endswith( ".abc" )): abcSop = geo[0].createNode( "alembic" ) abcSop.setDisplayFlag(False) houAbc = "$HIP"+ abcFolder +"/" + abcFile abcSop.parm( "fileName" ).set(houAbc) geo[0].layoutChildren() hou.ui.displayMessage(text = "succes") else: hou.ui.displayMessage(text = "abc folder not exist!!!", severity = hou.severityType.Error)
def set_hip_path(self): rownum = self.tableWidget.rowCount() h_path = hou.houdiniPath() for r in range(0, rownum): ep = self.tableWidget.item(r, 3).text() try: if ep.find('$HIP') == -1: k = ep.replace(str(h_path[0]), '$HIP') if k != ep: print 'set', self.tableWidget.item( r, 2).text(), ' ', k self.tableWidget.item(r, 4).setText( QtGui.QApplication.translate( "MainWindow", str(k), None, QtGui.QApplication.UnicodeUTF8)) except: print 'Error:', self.tableWidget.item(r, 2).text()
def _findPlaneGroups(): # Mapping between plane group names and their source files. groupMap = {} # Look for planes throughout the Houdini path. for path in hou.houdiniPath(): # Look for any json files in soho/planes/ dirs. files = glob.glob(os.path.join(path, "soho/planes/*.json")) for filePath in files: baseName = os.path.basename(filePath) # The file isn't a definitions file processed elsewhere. if baseName != "definitions.json": # The group name is the name of the file. groupName = os.path.splitext(baseName)[0] # If we haven't seen this group yet, add it to the map. if groupName not in groupMap: groupMap[groupName] = filePath return groupMap