summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2020-11-10 18:31:33 -0300
committerreduz <reduzio@gmail.com>2020-11-10 19:31:10 -0300
commit5288ff538d75d2ddab257a9e1e40050c9b8fa1cb (patch)
treee07e6e9a4d22cce046f03b36d06af28a73fea362 /editor
parenta80ec80b57f419d84d196fb46dcb5f194c880001 (diff)
Create Variant built-in functions.
-Moved Expression to use this, removed its own. -Eventually GDScript/VisualScript/GDNative need to be moved to this. -Given the JSON functions were hacked-in, removed them and created a new JSONParser class -Made sure these functions appear properly in documentation, since they will be removed from GDScript
Diffstat (limited to 'editor')
-rw-r--r--editor/doc_data.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/editor/doc_data.cpp b/editor/doc_data.cpp
index ae31f68587..78c601d4bc 100644
--- a/editor/doc_data.cpp
+++ b/editor/doc_data.cpp
@@ -736,6 +736,43 @@ void DocData::generate(bool p_basic_types) {
}
c.properties.push_back(pd);
}
+
+ List<StringName> builtin_funcs;
+ Variant::get_builtin_function_list(&builtin_funcs);
+ builtin_funcs.sort_custom<StringName::AlphCompare>();
+ for (List<StringName>::Element *E = builtin_funcs.front(); E; E = E->next()) {
+ MethodDoc md;
+ md.name = E->get();
+ //return
+ if (Variant::has_builtin_func_return_value(E->get())) {
+ PropertyInfo pi;
+ pi.type = Variant::get_builtin_func_return_type(E->get());
+ if (pi.type == Variant::NIL) {
+ pi.usage = PROPERTY_USAGE_NIL_IS_VARIANT;
+ }
+ DocData::ArgumentDoc ad;
+ argument_doc_from_arginfo(ad, pi);
+ md.return_type = ad.type;
+ }
+
+ if (Variant::is_builtin_func_vararg(E->get())) {
+ md.qualifiers = "vararg";
+ } else {
+ for (int i = 0; i < Variant::get_builtin_func_argument_count(E->get()); i++) {
+ PropertyInfo pi;
+ pi.type = Variant::get_builtin_func_argument_type(E->get(), i);
+ pi.name = Variant::get_builtin_func_argument_name(E->get(), i);
+ if (pi.type == Variant::NIL) {
+ pi.usage = PROPERTY_USAGE_NIL_IS_VARIANT;
+ }
+ DocData::ArgumentDoc ad;
+ argument_doc_from_arginfo(ad, pi);
+ md.arguments.push_back(ad);
+ }
+ }
+
+ c.methods.push_back(md);
+ }
}
// Built-in script reference.