Merge pull request #23060 from willnationsdev/inherit-non-class-script
Fix Script -> Script Class not in CreateDialog
This commit is contained in:
commit
af92b7dc14
1 changed files with 5 additions and 0 deletions
|
@ -857,11 +857,16 @@ bool EditorData::script_class_is_parent(const String &p_class, const String &p_i
|
||||||
if (!ScriptServer::is_global_class(p_class))
|
if (!ScriptServer::is_global_class(p_class))
|
||||||
return false;
|
return false;
|
||||||
String base = script_class_get_base(p_class);
|
String base = script_class_get_base(p_class);
|
||||||
|
Ref<Script> script = ResourceLoader::load(ScriptServer::get_global_class_path(p_class), "Script");
|
||||||
|
Ref<Script> base_script = script->get_base_script();
|
||||||
|
|
||||||
while (p_inherits != base) {
|
while (p_inherits != base) {
|
||||||
if (ClassDB::class_exists(base)) {
|
if (ClassDB::class_exists(base)) {
|
||||||
return ClassDB::is_parent_class(base, p_inherits);
|
return ClassDB::is_parent_class(base, p_inherits);
|
||||||
} else if (ScriptServer::is_global_class(base)) {
|
} else if (ScriptServer::is_global_class(base)) {
|
||||||
base = script_class_get_base(base);
|
base = script_class_get_base(base);
|
||||||
|
} else if (base_script.is_valid()) {
|
||||||
|
return ClassDB::is_parent_class(base_script->get_instance_base_type(), p_inherits);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue