From b80190721b56e5b398282f7bd0c8b08e26119bb9 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 17 Feb 2020 00:01:52 +0100 Subject: [PATCH] Allow using `MeshLibrary.get_item_preview()` in non-editor builds again This closes #36268. (cherry picked from commit 64fac9dd5d8ad360c783020a62a04c8434f5e143) --- doc/classes/MeshLibrary.xml | 3 +-- scene/resources/mesh_library.cpp | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/doc/classes/MeshLibrary.xml b/doc/classes/MeshLibrary.xml index 75d2dd22f38..fed82520792 100644 --- a/doc/classes/MeshLibrary.xml +++ b/doc/classes/MeshLibrary.xml @@ -84,8 +84,7 @@ - Returns a generated item preview (a 3D rendering in isometric perspective). - [b]Note:[/b] Since item previews are only generated in an editor context, this function will return an empty [Texture] in a running project. + When running in the editor, returns a generated item preview (a 3D rendering in isometric perspective). When used in a running project, returns the manually-defined item preview which can be set using [method set_item_preview]. Returns an empty [Texture] if no preview was manually set in a running project. diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp index 754cad4defd..0e017f6f23b 100644 --- a/scene/resources/mesh_library.cpp +++ b/scene/resources/mesh_library.cpp @@ -29,7 +29,6 @@ /*************************************************************************/ #include "mesh_library.h" -#include "core/engine.h" bool MeshLibrary::_set(const StringName &p_name, const Variant &p_value) { @@ -202,11 +201,6 @@ Transform MeshLibrary::get_item_navmesh_transform(int p_item) const { Ref MeshLibrary::get_item_preview(int p_item) const { - if (!Engine::get_singleton()->is_editor_hint()) { - ERR_PRINT("MeshLibrary item previews are only generated in an editor context, which means they aren't available in a running project."); - return Ref(); - } - ERR_FAIL_COND_V_MSG(!item_map.has(p_item), Ref(), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'."); return item_map[p_item].preview; }