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
@@ -81,7 +81,9 @@ void extract(const std::string& name,
tfrag3::MercEffect envmap_eff;
envmap_eff.has_envmap = false;
out.new_model.name = name;
out.new_model.max_bones = joints;
// if we have a skeleton, use that joint count, otherwise use a high default value since the model
// we replace can have more
out.new_model.max_bones = joints != 3 ? joints : 100;
out.new_model.max_draws = 0;
auto process_normal_draw = [&](tfrag3::MercEffect& eff, int mat_idx, const tfrag3::MercDraw& d_) {