|
@@ -683,6 +683,21 @@ bool ClassDB::can_instantiate(const StringName &p_class) {
|
|
|
return (!ti->disabled && ti->creation_func != nullptr && !(ti->gdextension && !ti->gdextension->create_instance));
|
|
|
}
|
|
|
|
|
|
+bool ClassDB::is_abstract(const StringName &p_class) {
|
|
|
+ OBJTYPE_RLOCK;
|
|
|
+
|
|
|
+ ClassInfo *ti = classes.getptr(p_class);
|
|
|
+ if (!ti) {
|
|
|
+ if (!ScriptServer::is_global_class(p_class)) {
|
|
|
+ ERR_FAIL_V_MSG(false, "Cannot get class '" + String(p_class) + "'.");
|
|
|
+ }
|
|
|
+ String path = ScriptServer::get_global_class_path(p_class);
|
|
|
+ Ref<Script> scr = ResourceLoader::load(path);
|
|
|
+ return scr.is_valid() && scr->is_valid() && scr->is_abstract();
|
|
|
+ }
|
|
|
+ return ti->creation_func == nullptr && (!ti->gdextension || ti->gdextension->create_instance == nullptr);
|
|
|
+}
|
|
|
+
|
|
|
bool ClassDB::is_virtual(const StringName &p_class) {
|
|
|
OBJTYPE_RLOCK;
|
|
|
|