From ba542444e3f81498eb3a9851a1b17cbf828abe61 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Wed, 19 Oct 2022 01:58:13 -0500 Subject: Don't allow instancing virtual node types in the Create New Node dialog --- core/object/class_db.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index 41585943b3..0863dea053 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -31,6 +31,7 @@ #include "class_db.h" #include "core/config/engine.h" +#include "core/object/script_language.h" #include "core/os/mutex.h" #include "core/version.h" @@ -376,7 +377,12 @@ bool ClassDB::is_virtual(const StringName &p_class) { OBJTYPE_RLOCK; ClassInfo *ti = classes.getptr(p_class); - ERR_FAIL_COND_V_MSG(!ti, false, "Cannot get class '" + String(p_class) + "'."); + if (!ti) { + if (!ScriptServer::is_global_class(p_class)) { + ERR_FAIL_V_MSG(false, "Cannot get class '" + String(p_class) + "'."); + } + return false; + } #ifdef TOOLS_ENABLED if (ti->api == API_EDITOR && !Engine::get_singleton()->is_editor_hint()) { return false; -- cgit v1.2.3