diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-09-24 16:05:49 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-09-25 22:01:59 +0200 |
commit | a199e2b2631064015daab94780e06bfbb24ae3d5 (patch) | |
tree | a5a733c4e9d7830b79520e94b76cc0343b5d7705 /scene/resources | |
parent | edf9055b7f3fb16f9b927d09bc84be31c1076ce7 (diff) |
Mention `MeshLibrary.get_item_preview()` not working in running project
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/mesh_library.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/resources/mesh_library.cpp b/scene/resources/mesh_library.cpp index ad8da63abf..f04af29761 100644 --- a/scene/resources/mesh_library.cpp +++ b/scene/resources/mesh_library.cpp @@ -29,6 +29,7 @@ /*************************************************************************/ #include "mesh_library.h" +#include "core/engine.h" bool MeshLibrary::_set(const StringName &p_name, const Variant &p_value) { @@ -201,6 +202,11 @@ Transform MeshLibrary::get_item_navmesh_transform(int p_item) const { Ref<Texture> 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<Texture>(); + } + ERR_FAIL_COND_V_MSG(!item_map.has(p_item), Ref<Texture>(), "Requested for nonexistent MeshLibrary item '" + itos(p_item) + "'."); return item_map[p_item].preview; } |