Skip to content

Commit

Permalink
Merge pull request #186 from Simarilius-uk/OS_support
Browse files Browse the repository at this point in the history
fix sector export
  • Loading branch information
Simarilius-uk authored Nov 22, 2024
2 parents 0a9fd58 + 891dd2c commit 3ae8e63
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions i_scene_cp77_gltf/exporters/sectors_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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']=[]
Expand Down Expand Up @@ -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']])
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3ae8e63

Please sign in to comment.