From a72945f4e35fa726ccc6d2f3c99e9888b843a49e Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 11 Sep 2016 12:20:28 -0300 Subject: [PATCH] Added constants from types in code completion, somehow this was never added. Stuff like Label.ALIGN_CENTER or Mesh.PRIMITIVE_TRIANGLES did not complete.. (cherry picked from commit b83350f4b2e968baac4d1551a6f21fe2e6b468ad) --- modules/gdscript/gd_editor.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index 63c351cbf45..9bed5093345 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -2112,7 +2112,18 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base GDCompletionIdentifier t; if (_guess_expression_type(context,static_cast(node)->arguments[0],p.get_completion_line(),t)) { - if (t.type==Variant::OBJECT && t.obj_type!=StringName()) { + if (t.type==Variant::OBJECT && t.obj_type=="GDNativeClass") { + //native enum + Ref gdn = t.value; + if (gdn.is_valid()) { + StringName cn = gdn->get_name(); + List cnames; + ObjectTypeDB::get_integer_constant_list(cn,&cnames); + for (List::Element *E=cnames.front();E;E=E->next()) { + options.insert(E->get()); + } + } + } else if (t.type==Variant::OBJECT && t.obj_type!=StringName()) { Ref on_script;