def _findPlaneDefinitions(): # Look for any plane definition files in the Houdini path. try: defFiles = hou.findFiles("soho/planes/definitions.json") # Couldn't find any so return an empty dictionary. except hou.OperationFailed: return {} # Mapping between plane names and the corresponding RenderPlane object. defMap = {} # Process each definition file. for filePath in defFiles: # Load the json file. f = open(filePath) data = json.load(f) f.close() # Convert from unicode to regular strings. data = _convertFromUnicode(data) # Process each plane definition. for planeName, planeData in data.iteritems(): # If a plane of the same name has already been processed, skip it. if planeName in defMap: continue # Build the plane. plane = RenderPlane(planeName, filePath, planeData) # Store a reference to the plane based on the name in the map. defMap[planeName] = plane return defMap
def _registerOperations(self): """Register operations that should be run by the manager.""" import hou # Look for files containing a list of operations. try: files = hou.findFiles("pyfilter/operations.json") # If no files could be found then abort. except hou.OperationFailed: return for filepath in files: with open(filepath) as fp: data = json.load(fp, object_hook=ht.utils.convertFromUnicode) if "operations" not in data: continue for operation in data["operations"]: module_name, class_name = operation # Import the operation class. cls = getattr(__import__(module_name, {}, {}, [class_name]), class_name) logger.info("Registering {}".format(class_name)) # Add an instance of it to our operations list. self.operations.append(cls(self))
def _registerOperations(self): """Register operations that should be run by the manager.""" import hou # Look for files containing a list of operations. try: files = hou.findFiles("pyfilter/operations.json") # If no files could be found then abort. except hou.OperationFailed: return for filepath in files: with open(filepath) as fp: data = json.load(fp) if "operations" not in data: continue for operation in data["operations"]: module_name, class_name = operation # Import the operation class. cls = getattr(__import__(module_name, {}, {}, [class_name]), class_name) logger.debug("Registering {}".format(class_name)) # Add an instance of it to our operations list. self.operations.append(cls(self))
def _find_operation_files(): """Find any operation loading files. :return: Any found operations files. :rtype: tuple(str) """ import hou # Look for files containing a list of operations. try: files = hou.findFiles("pyfilter/operations.json") # If no files could be found then abort. except hou.OperationFailed: logger.debug("Could not find any operations to load") files = () return files
def _find_operation_files(): """Find any operation loading files. :return: Any found operations files. :rtype: tuple(str) """ import hou # Look for files containing a list of operations. try: files = hou.findFiles("pyfilter/operations.json") # If no files could be found then abort. except hou.OperationFailed: _logger.debug("Could not find any operations to load") files = () return files