diff options
Diffstat (limited to 'core/object/class_db.cpp')
-rw-r--r-- | core/object/class_db.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index 7ea26c3fc5..fe4345aa0d 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -31,7 +31,6 @@ #include "class_db.h" #include "core/config/engine.h" -#include "core/core_string_names.h" #include "core/io/resource_loader.h" #include "core/object/script_language.h" #include "core/os/mutex.h" @@ -506,7 +505,7 @@ Object *ClassDB::_instantiate_internal(const StringName &p_class, bool p_require ERR_FAIL_NULL_V_MSG(ti->creation_func, nullptr, "Class '" + String(p_class) + "' or its base class cannot be instantiated."); } #ifdef TOOLS_ENABLED - if (ti->api == API_EDITOR && !Engine::get_singleton()->is_editor_hint()) { + if ((ti->api == API_EDITOR || ti->api == API_EDITOR_EXTENSION) && !Engine::get_singleton()->is_editor_hint()) { ERR_PRINT("Class '" + String(p_class) + "' can only be instantiated by editor."); return nullptr; } @@ -523,7 +522,7 @@ Object *ClassDB::_instantiate_internal(const StringName &p_class, bool p_require #ifdef TOOLS_ENABLED if (!p_require_real_class && ti->is_runtime && Engine::get_singleton()->is_editor_hint()) { if (!ti->inherits_ptr || !ti->inherits_ptr->creation_func) { - ERR_PRINT_ONCE(vformat("Cannot make a placeholder instance of runtime class %s because its parent cannot be constructed.", ti->name)); + ERR_PRINT(vformat("Cannot make a placeholder instance of runtime class %s because its parent cannot be constructed.", ti->name)); } else { ObjectGDExtension *extension = get_placeholder_extension(ti->name); return (Object *)extension->create_instance(extension->class_userdata); @@ -665,7 +664,7 @@ bool ClassDB::can_instantiate(const StringName &p_class) { return scr.is_valid() && scr->is_valid() && !scr->is_abstract(); } #ifdef TOOLS_ENABLED - if (ti->api == API_EDITOR && !Engine::get_singleton()->is_editor_hint()) { + if ((ti->api == API_EDITOR || ti->api == API_EDITOR_EXTENSION) && !Engine::get_singleton()->is_editor_hint()) { return false; } #endif @@ -685,7 +684,7 @@ bool ClassDB::is_virtual(const StringName &p_class) { return scr.is_valid() && scr->is_valid() && scr->is_abstract(); } #ifdef TOOLS_ENABLED - if (ti->api == API_EDITOR && !Engine::get_singleton()->is_editor_hint()) { + if ((ti->api == API_EDITOR || ti->api == API_EDITOR_EXTENSION) && !Engine::get_singleton()->is_editor_hint()) { return false; } #endif |