godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.63k stars 21.1k forks source link

Crashing during bone remap #87904

Closed tdaven closed 2 months ago

tdaven commented 8 months ago

Tested versions

Reproducible in any version newer then: [96a95cb9743e755f10fa6a14895ea099e5ac4c51] Add const lvalue ref to container parameters

System information

Godot v4.3.dev (0a2ddaa6b) - Fedora Linux 39 (Workstation Edition) - Wayland - Vulkan (Forward+) - dedicated AMD Radeon RX 6700 XT (RADV NAVI22) () - 13th Gen Intel(R) Core(TM) i7-13700K (24 Threads)

Issue description

The editor crashes during the import of a model when a bone map has been applied but not all bones are able to be mapped.

An example model can be found here: https://skfb.ly/6AnLO

This might be related to #84371 and #83041.

With commit 96a95cb9743e755f10fa6a14895ea099e5ac4c51, const was added to the HashMap passed into PostImportPluginSkeletonRenamer::_internal_process. This had a subtle change of behavior.

The code was using the [] operator(see here) on the HashMap which previously would insert if the item being accessed did not exist(see more here). This allowed the code to previously work.

The const version, does not insert and instead hits a CRASH_COND and crashes (see here for more).

Steps to reproduce

  1. Create new project.
  2. Download the GLB version of the model.
  3. Import into Godot
  4. From the import dialog, add a new BoneMone, selecting the humanoid profile.
  5. Click import

Minimal reproduction project (MRP)

The only model I have on hand that reproduces currently is the one linked above. It is over the max size. Steps are sufficient to reproduce.

akien-mga commented 2 months ago

Superseded by #81746 as per https://github.com/godotengine/godot/pull/87905#issuecomment-1962400768.