Skip to content

Commit 3ae8e63

Browse files
Merge pull request #186 from Simarilius-uk/OS_support
fix sector export
2 parents 0a9fd58 + 891dd2c commit 3ae8e63

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

i_scene_cp77_gltf/exporters/sectors_export.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,9 @@ def exportSectors(filename, use_yaml):
409409

410410
# Open the blank template streaming sector
411411
resourcepath=get_resources_dir()
412-
413-
template_json=jsonload(resourcepath,'empty.streamingsector.json')
412+
with open(os.path.join(resourcepath,'empty.streamingsector.json'),'r') as f:
413+
template_json=json.load(f)
414+
414415
template_nodes = template_json["Data"]["RootChunk"]["nodes"]
415416
template_nodeData = template_json['Data']['RootChunk']['nodeData']['Data']
416417
ID=0
@@ -441,7 +442,8 @@ def exportSectors(filename, use_yaml):
441442
print(filepath)
442443
if filepath==os.path.join(projpath,projectjson):
443444
continue
444-
j=jsonload(filepath)
445+
with open(filepath,'r') as f:
446+
j=json.load(f)
445447
nodes = j["Data"]["RootChunk"]["nodes"]
446448
t=j['Data']['RootChunk']['nodeData']['Data']
447449
# add nodeDataIndex props to all the nodes in t
@@ -652,7 +654,7 @@ def exportSectors(filename, use_yaml):
652654
new_ni=len(template_nodes)
653655
#copy the collision node
654656
template_nodes.append(copy.deepcopy(nodes[i]))
655-
createNodeData(template_nodeData, nodes[i], new_ni, obj,ID)
657+
createNodeData(template_nodeData, nodes[i], new_ni, crash,ID)
656658
ID+=1
657659
impacts = template_nodes[len(template_nodes)-1]
658660
impacts['Data']['compiledData']['Data']['Actors']=[]
@@ -845,7 +847,8 @@ def exportSectors(filename, use_yaml):
845847
source_sect_coll=bpy.data.collections.get(source_sector)
846848
source_sect_json_path=source_sect_coll['filepath']
847849
print(source_sect_json_path)
848-
source_sect_json=jsonload(source_sect_json_path)
850+
with open(source_sect_json_path,'r') as f:
851+
source_sect_json=json.load(f)
849852
source_nodes = source_sect_json["Data"]["RootChunk"]["nodes"]
850853
print(len(source_nodes),col['nodeIndex'])
851854
print(source_nodes[col['nodeIndex']])
@@ -874,7 +877,8 @@ def exportSectors(filename, use_yaml):
874877
source_sect_coll=bpy.data.collections.get(source_sector)
875878
source_sect_json_path=source_sect_coll['filepath']
876879
print(source_sect_json_path)
877-
source_sect_json=jsonload(source_sect_json_path)
880+
with open(source_sect_json_path,'r') as f:
881+
source_sect_json=json.load(f)
878882
source_nodes = source_sect_json["Data"]["RootChunk"]["nodes"]
879883
nodes.append(copy.deepcopy(source_nodes[ni]))
880884
new_Index=len(nodes)-1
@@ -950,7 +954,8 @@ def exportSectors(filename, use_yaml):
950954
source_sect_coll=bpy.data.collections.get(source_sector)
951955
source_sect_json_path=source_sect_coll['filepath']
952956
print(source_sect_json_path)
953-
source_sect_json = jsonload(source_sect_json_path)
957+
with open(source_sect_json_path,'r') as f:
958+
source_sect_json=json.load(f)
954959
source_nodes = source_sect_json["Data"]["RootChunk"]["nodes"]
955960
nodes.append(copy.deepcopy(source_nodes[ni]))
956961
new_Index=len(nodes)-1

0 commit comments

Comments
 (0)