From 34c4bfeb01be21298ac28429fb321a785d7ac5f3 Mon Sep 17 00:00:00 2001 From: DualMatrix Date: Fri, 12 Oct 2018 01:08:14 +0200 Subject: [PATCH] Fixed parents properties not appearing in inspector if parent is class_name. Fixed parents properties not appearing in inspector if parent is class_name. --- modules/gdscript/gdscript.cpp | 41 +++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 48c1760662c..18272451cd2 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -421,31 +421,40 @@ bool GDScript::_update_exports() { base_cache = Ref(); } - if (c->extends_used && String(c->extends_file) != "" && String(c->extends_file) != get_path()) { + if (c->extends_used) { + String path = ""; + if (String(c->extends_file) != "" && String(c->extends_file) != get_path()) { + path = c->extends_file; + if (path.is_rel_path()) { - String path = c->extends_file; - if (path.is_rel_path()) { + String base = get_path(); + if (base == "" || base.is_rel_path()) { - String base = get_path(); - if (base == "" || base.is_rel_path()) { - - ERR_PRINT(("Could not resolve relative path for parent class: " + path).utf8().get_data()); - } else { - path = base.get_base_dir().plus_file(path); + ERR_PRINT(("Could not resolve relative path for parent class: " + path).utf8().get_data()); + } else { + path = base.get_base_dir().plus_file(path); + } } + } else if (c->extends_class.size() != 0) { + String base = c->extends_class[0]; + + if (ScriptServer::is_global_class(base)) + path = ScriptServer::get_global_class_path(base); } - if (path != get_path()) { + if (path != "") { + if (path != get_path()) { - Ref bf = ResourceLoader::load(path); + Ref bf = ResourceLoader::load(path); - if (bf.is_valid()) { + if (bf.is_valid()) { - base_cache = bf; - bf->inheriters_cache.insert(get_instance_id()); + base_cache = bf; + bf->inheriters_cache.insert(get_instance_id()); + } + } else { + ERR_PRINT(("Path extending itself in " + path).utf8().get_data()); } - } else { - ERR_PRINT(("Path extending itself in " + path).utf8().get_data()); } }