diff --git a/i_scene_cp77_gltf/exporters/sectors_export.py b/i_scene_cp77_gltf/exporters/sectors_export.py index 7e96a64..52f1461 100644 --- a/i_scene_cp77_gltf/exporters/sectors_export.py +++ b/i_scene_cp77_gltf/exporters/sectors_export.py @@ -409,8 +409,9 @@ def exportSectors(filename, use_yaml): # Open the blank template streaming sector resourcepath=get_resources_dir() - - template_json=jsonload(resourcepath,'empty.streamingsector.json') + with open(os.path.join(resourcepath,'empty.streamingsector.json'),'r') as f: + template_json=json.load(f) + template_nodes = template_json["Data"]["RootChunk"]["nodes"] template_nodeData = template_json['Data']['RootChunk']['nodeData']['Data'] ID=0 @@ -441,7 +442,8 @@ def exportSectors(filename, use_yaml): print(filepath) if filepath==os.path.join(projpath,projectjson): continue - j=jsonload(filepath) + with open(filepath,'r') as f: + j=json.load(f) nodes = j["Data"]["RootChunk"]["nodes"] t=j['Data']['RootChunk']['nodeData']['Data'] # add nodeDataIndex props to all the nodes in t @@ -652,7 +654,7 @@ def exportSectors(filename, use_yaml): new_ni=len(template_nodes) #copy the collision node template_nodes.append(copy.deepcopy(nodes[i])) - createNodeData(template_nodeData, nodes[i], new_ni, obj,ID) + createNodeData(template_nodeData, nodes[i], new_ni, crash,ID) ID+=1 impacts = template_nodes[len(template_nodes)-1] impacts['Data']['compiledData']['Data']['Actors']=[] @@ -845,7 +847,8 @@ def exportSectors(filename, use_yaml): source_sect_coll=bpy.data.collections.get(source_sector) source_sect_json_path=source_sect_coll['filepath'] print(source_sect_json_path) - source_sect_json=jsonload(source_sect_json_path) + with open(source_sect_json_path,'r') as f: + source_sect_json=json.load(f) source_nodes = source_sect_json["Data"]["RootChunk"]["nodes"] print(len(source_nodes),col['nodeIndex']) print(source_nodes[col['nodeIndex']]) @@ -874,7 +877,8 @@ def exportSectors(filename, use_yaml): source_sect_coll=bpy.data.collections.get(source_sector) source_sect_json_path=source_sect_coll['filepath'] print(source_sect_json_path) - source_sect_json=jsonload(source_sect_json_path) + with open(source_sect_json_path,'r') as f: + source_sect_json=json.load(f) source_nodes = source_sect_json["Data"]["RootChunk"]["nodes"] nodes.append(copy.deepcopy(source_nodes[ni])) new_Index=len(nodes)-1 @@ -950,7 +954,8 @@ def exportSectors(filename, use_yaml): source_sect_coll=bpy.data.collections.get(source_sector) source_sect_json_path=source_sect_coll['filepath'] print(source_sect_json_path) - source_sect_json = jsonload(source_sect_json_path) + with open(source_sect_json_path,'r') as f: + source_sect_json=json.load(f) source_nodes = source_sect_json["Data"]["RootChunk"]["nodes"] nodes.append(copy.deepcopy(source_nodes[ni])) new_Index=len(nodes)-1