From c4025de222a3cf6aaec8f15e851a9f2e55d2a3ec Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 29 Jun 2021 07:13:09 +0800 Subject: [PATCH] Preserve previously extracted brick family indices --- .../tools/extract_r2_required/extract_sbrick.py | 17 ++++++++++++++++- ryzom/tools/extract_r2_required/readme.txt | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ryzom/tools/extract_r2_required/extract_sbrick.py b/ryzom/tools/extract_r2_required/extract_sbrick.py index 1fd197364..1125eece6 100644 --- a/ryzom/tools/extract_r2_required/extract_sbrick.py +++ b/ryzom/tools/extract_r2_required/extract_sbrick.py @@ -22,6 +22,21 @@ listPathExt(sbrickPath, ".sbrick") sbrickMap = {} +def loadTsv(filename): + table = [] + with open(filename, "r") as f: + for l in f: + table += [ l.strip().split("\t") ] + return table; + +preserveIndex = True +if preserveIndex: + table = loadTsv("sbrick_index.tsv") + for entry in table: + e = filter(None, entry) + entryName = e[0] + str(int(e[1])).zfill(4) # + name + sbrickMap[entryName] = e + for sbrick in fileMap: contents = "" name = sbrick.split(".")[0].lower() @@ -59,7 +74,7 @@ for sbrick in fileMap: #print(name) #print(sitem) templateName = familyId.lower() + str(int(indexInFamily)).zfill(2) - entryName = familyId + str(int(indexInFamily)).zfill(4) + name + entryName = familyId + str(int(indexInFamily)).zfill(4) # + name entry = [ familyId, indexInFamily ] if name != templateName: entry += [ name ] diff --git a/ryzom/tools/extract_r2_required/readme.txt b/ryzom/tools/extract_r2_required/readme.txt index 4cca8b830..b268f8194 100644 --- a/ryzom/tools/extract_r2_required/readme.txt +++ b/ryzom/tools/extract_r2_required/readme.txt @@ -4,4 +4,5 @@ - Run extract_shapes.py to list all shapes into shape_list.txt - Run scheme_shape_parser.py to generate shape_parsed from shape_list.txt excluding _mission_ shapes - Run sitem_shape_matcher.py to generate match_sitem_shape.tsv from shape_parsed.tsv and sitem_parsed.tsv +- Run extract_sbrick.py to generate the sbrick_index.tsv to ensure indices are correctly reused - Run generate_sitem.py to generate sitems from the tsv