From 74490637849b79bb4b05d26f91f983495d98d58d Mon Sep 17 00:00:00 2001 From: Romildo Franco <25422687+AttackButton@users.noreply.github.com> Date: Mon, 12 Aug 2024 01:38:51 -0300 Subject: [PATCH] Fix wi::scene::LoadModel returning the wrong entity (#921) Fixed a bug caused by a typo in the LoadModel function call. The issue occurred because LoadModel(scene, fileName, transformMatrix, rootEntity) was mistakenly called instead of LoadModel2(scene, fileName, transformMatrix, rootEntity). The compiler did not catch this mistake because the last parameter of LoadModel is a boolean, and rootEntity was incorrectly used to satisfy that parameter. --- WickedEngine/wiScene.cpp | 2 +- WickedEngine/wiScene.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/WickedEngine/wiScene.cpp b/WickedEngine/wiScene.cpp index ed26a9192..a346119ae 100644 --- a/WickedEngine/wiScene.cpp +++ b/WickedEngine/wiScene.cpp @@ -7021,7 +7021,7 @@ namespace wi::scene void LoadModel2(const std::string& fileName, const XMMATRIX& transformMatrix, Entity rootEntity) { Scene scene; - LoadModel(scene, fileName, transformMatrix, rootEntity); + LoadModel2(scene, fileName, transformMatrix, rootEntity); GetScene().Merge(scene); } diff --git a/WickedEngine/wiScene.h b/WickedEngine/wiScene.h index 716a4b56e..30bf00295 100644 --- a/WickedEngine/wiScene.h +++ b/WickedEngine/wiScene.h @@ -319,6 +319,7 @@ namespace wi::scene virtual void Clear(); // Merge an other scene into this. // The contents of the other scene will be lost (and moved to this)! + // Any references to entities or components from the other scene will now reference them in this scene. virtual void Merge(Scene& other); // Similar to merge but skipping some things that are safe to skip within the Update look void MergeFastInternal(Scene& other);