diff --git a/i_scene_cp77_gltf/resources/scripts/export_deletions.py b/i_scene_cp77_gltf/resources/scripts/export_deletions.py index ef8ed13..5d6ca68 100644 --- a/i_scene_cp77_gltf/resources/scripts/export_deletions.py +++ b/i_scene_cp77_gltf/resources/scripts/export_deletions.py @@ -1,5 +1,6 @@ import bpy import re +import os yamlavail=False try: import yaml @@ -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 @@ -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: @@ -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: @@ -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)