From ad8f208bdbcd9d3334c4d57d2e5554dfdb3a36d0 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 23 Aug 2016 19:29:07 -0300 Subject: Proper function/property selection in visual script editing for property. This one has an ordered list, built-in description, search, etc. --- modules/gdscript/gd_script.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'modules/gdscript/gd_script.cpp') diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp index 144fbe2626..13fbfb6ec0 100644 --- a/modules/gdscript/gd_script.cpp +++ b/modules/gdscript/gd_script.cpp @@ -267,6 +267,41 @@ void GDScript::get_script_method_list(List *p_list) const { } } +void GDScript::get_script_property_list(List *p_list) const { + + const GDScript *sptr=this; + List props; + + while(sptr) { + + Vector<_GDScriptMemberSort> msort; + for(Map::Element *E=sptr->member_info.front();E;E=E->next()) { + + _GDScriptMemberSort ms; + ERR_CONTINUE(!sptr->member_indices.has(E->key())); + ms.index=sptr->member_indices[E->key()].index; + ms.name=E->key(); + msort.push_back(ms); + + } + + msort.sort(); + msort.invert(); + for(int i=0;imember_info[msort[i].name]); + + } + + sptr = sptr->_base; + } + + for (List::Element *E=props.front();E;E=E->next()) { + p_list->push_back(E->get()); + } + +} + bool GDScript::has_method(const StringName& p_method) const { return member_functions.has(p_method); -- cgit v1.2.3