Skip to content

Commit

Permalink
Fix for 1.9 and should get everything now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simarilius-uk committed Jan 10, 2024
1 parent 334de05 commit bfba781
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions i_scene_cp77_gltf/resources/scripts/export_deletions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import bpy
import re
import os
yamlavail=False
try:
import yaml
Expand All @@ -8,8 +9,8 @@
import json

wolvenkit_project = "archivexlupdate"
mod_directory = "D:\\GOGLibrary\\Cyberpunk 2077\\archive\\pc\\mod\\"
project_directory = "D:\\cpmod\\"
mod_directory = "D:\\GOGLibrary\\Cyberpunk 2077\\archive\\pc\\mod"
project_directory = "D:\\cpmod"

export_to_mod_dir = True
consider_partial_deletions = True
Expand Down Expand Up @@ -57,11 +58,12 @@ def countChildNodes(collection):
def find_empty_collections(collection):
empty_collections = []
is_deletion_candidate = 'nodeIndex' in collection and 'nodeType' in collection

if 'pillow' in collection.name:
print(collection.name)
# check if we want to keep this collection
for keep_check in compiled_partials:
if all(p.search(collection.name) for p in keep_check):
return empty_collections
# for keep_check in compiled_partials:
# if all(p.search(collection.name) for p in keep_check):
# return empty_collections

if len(collection.children) == 0 and is_deletion_candidate:
if len(collection.objects) == 0:
Expand Down Expand Up @@ -91,16 +93,14 @@ def to_archive_xl(filename):
currentNodeIndex = -1
currentNodeComment = ''
currentNodeType = ''
for empty_collection in sectorData:
if empty_collection['nodeIndex'] > currentNodeIndex:
if currentNodeIndex>-1:
new_sector['nodeDeletions'].append({'index':currentNodeIndex,'type':currentNodeType,'debugName':currentNodeComment})
# set instance variables
currentNodeIndex = empty_collection['nodeIndex']
currentNodeComment = empty_collection.name
currentNodeType = empty_collection['nodeType']
elif empty_collection['nodeIndex'] == currentNodeIndex:
currentNodeComment = f"{currentNodeComment}, {empty_collection.name}"
for empty_collection in sectorData:
currentNodeIndex = empty_collection['nodeDataIndex']
currentNodeComment = empty_collection.name
currentNodeType = empty_collection['nodeType']
if currentNodeIndex>-1:
new_sector['nodeDeletions'].append({'index':currentNodeIndex,'type':currentNodeType,'debugName':currentNodeComment})
# set instance variables

sectors.append(new_sector)
with open(filename, "w") as file:
if yamlavail:
Expand Down Expand Up @@ -139,12 +139,11 @@ def to_archive_xl_old(filename):


# Iterate over matching collections and find empty ones
for sectorCollection in [c for c in bpy.data.collections if c.name.endswith("streamingsector")]:
prefix, file_path = sectorCollection["filepath"].split('raw\\')
file_path = file_path.replace(".json", "")
expectedNodes[file_path] = countChildNodes(sectorCollection)
for sectorCollection in [c for c in bpy.data.collections if c.name.endswith("streamingsector")]:
sectorName=os.path.basename(sectorCollection["filepath"])[:-5]
expectedNodes[sectorName] = countChildNodes(sectorCollection)
collections = find_empty_collections(sectorCollection)
if len(collections) > 0:
deletions[file_path] = collections
deletions[sectorName] = collections

to_archive_xl(output_filename)

0 comments on commit bfba781

Please sign in to comment.