summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gd_script.cpp35
-rw-r--r--modules/gdscript/gd_script.h3
2 files changed, 38 insertions, 0 deletions
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<MethodInfo> *p_list) const {
}
}
+void GDScript::get_script_property_list(List<PropertyInfo> *p_list) const {
+
+ const GDScript *sptr=this;
+ List<PropertyInfo> props;
+
+ while(sptr) {
+
+ Vector<_GDScriptMemberSort> msort;
+ for(Map<StringName,PropertyInfo>::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;i<msort.size();i++) {
+
+ props.push_front(sptr->member_info[msort[i].name]);
+
+ }
+
+ sptr = sptr->_base;
+ }
+
+ for (List<PropertyInfo>::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);
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 8ec11c1e3e..856211b2fd 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -186,6 +186,9 @@ public:
virtual bool has_method(const StringName& p_method) const;
virtual MethodInfo get_method_info(const StringName& p_method) const;
+ virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
+
+
virtual ScriptLanguage *get_language() const;
GDScript();