def loadCamera(folder): camera_file_name = folder + "/_camera.txt" mydef = loadJsonFile(camera_file_name) if mydef: try: source_name = str(mydef.get('name', 'asset1')) source_type = str(mydef.get('type', '')) new_asset = hasset.createAsset(name = source_name, type = source_type, def_path = folder) hasset.addContent(new_asset) hasset.addAnimationFromFolder(new_asset, folder) return new_asset except: print "This is not a source file" return None
def loadAsset(folder): asset_def_file = folder + "/_asset.txt" mydef = loadJsonFile(asset_def_file) if mydef: try: source_name = str(mydef.get('name', 'asset1')) source_type = str(mydef.get('type', '')) asset_hip_file = "%s/%s.hip" % (folder, source_name) if os.path.isfile(asset_hip_file): hou.hipFile.merge(str(asset_hip_file), node_pattern = "/obj/%s*" % source_name) # new_asset = hou.node("/obj/%s" % source_name) # new_asset.moveToGoodPosition() return True else: new_asset = hasset.createAsset(name = source_name, type = source_type, def_path = "%s/geo" % folder) hasset.addContent(new_asset) return True except: print "This is not a source file" return False