model replacements: prevent duplicate processing (#3789)

Store a small database of which models have already been swapped out in
a level to prevent duplicate processing.

Also a small fix for cases where using a model replacement that has no
armature would cause merc nightmares due to only having a `max_bones` of
3.
This commit is contained in:
Hat Kid
2024-12-01 22:01:50 +01:00
committed by GitHub
parent 8feb46dc45
commit 477cefb6a5
8 changed files with 86 additions and 29 deletions
+3 -1
View File
@@ -112,10 +112,12 @@ void extract_art_groups_from_level(const ObjectFileDB& db,
std::map<std::string, level_tools::ArtData>& art_group_data) {
if (db.obj_files_by_dgo.count(dgo_name)) {
const auto& files = db.obj_files_by_dgo.at(dgo_name);
MercSwapInfo swapped_info;
for (const auto& file : files) {
if (file.name.length() > 3 && !file.name.compare(file.name.length() - 3, 3, "-ag")) {
const auto& ag_file = db.lookup_record(file);
extract_merc(ag_file, tex_db, db.dts, tex_remap, level_data, false, db.version());
extract_merc(ag_file, tex_db, db.dts, tex_remap, level_data, false, db.version(),
swapped_info);
extract_joint_group(ag_file, db.dts, db.version(), art_group_data);
}
}