diff options
-rw-r--r-- | core/object/object.cpp | 35 | ||||
-rw-r--r-- | core/object/object.h | 3 | ||||
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 5 | ||||
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 2 |
4 files changed, 43 insertions, 2 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp index 9dec417b11..96469db8c6 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -209,6 +209,17 @@ MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const arguments.push_back(p_param5); } +MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5, const PropertyInfo &p_param6) : + name(p_name), + flags(METHOD_FLAG_NORMAL) { + arguments.push_back(p_param1); + arguments.push_back(p_param2); + arguments.push_back(p_param3); + arguments.push_back(p_param4); + arguments.push_back(p_param5); + arguments.push_back(p_param6); +} + MethodInfo::MethodInfo(Variant::Type ret) : flags(METHOD_FLAG_NORMAL) { return_val.type = ret; @@ -265,6 +276,18 @@ MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyIn arguments.push_back(p_param5); } +MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5, const PropertyInfo &p_param6) : + name(p_name), + flags(METHOD_FLAG_NORMAL) { + return_val.type = ret; + arguments.push_back(p_param1); + arguments.push_back(p_param2); + arguments.push_back(p_param3); + arguments.push_back(p_param4); + arguments.push_back(p_param5); + arguments.push_back(p_param6); +} + MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name) : name(p_name), return_val(p_ret), @@ -316,6 +339,18 @@ MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name, const Pr arguments.push_back(p_param5); } +MethodInfo::MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5, const PropertyInfo &p_param6) : + name(p_name), + return_val(p_ret), + flags(METHOD_FLAG_NORMAL) { + arguments.push_back(p_param1); + arguments.push_back(p_param2); + arguments.push_back(p_param3); + arguments.push_back(p_param4); + arguments.push_back(p_param5); + arguments.push_back(p_param6); +} + Object::Connection::operator Variant() const { Dictionary d; d["signal"] = signal; diff --git a/core/object/object.h b/core/object/object.h index 7cbedd29d9..8117783fae 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -225,6 +225,7 @@ struct MethodInfo { MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3); MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4); MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5); + MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5, const PropertyInfo &p_param6); MethodInfo(Variant::Type ret); MethodInfo(Variant::Type ret, const String &p_name); MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1); @@ -232,12 +233,14 @@ struct MethodInfo { MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3); MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4); MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5); + MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5, const PropertyInfo &p_param6); MethodInfo(const PropertyInfo &p_ret, const String &p_name); MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1); MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2); MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3); MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4); MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5); + MethodInfo(const PropertyInfo &p_ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2, const PropertyInfo &p_param3, const PropertyInfo &p_param4, const PropertyInfo &p_param5, const PropertyInfo &p_param6); }; // API used to extend in GDNative and other C compatible compiled languages. diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 202d1dcdf4..5345143271 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -738,7 +738,7 @@ static void _get_directory_contents(EditorFileSystemDirectory *p_dir, HashMap<St static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_annotation, int p_argument, const String p_quote_style, HashMap<String, ScriptLanguage::CodeCompletionOption> &r_result) { if (p_annotation->name == SNAME("@export_range")) { - if (p_argument == 3 || p_argument == 4) { + if (p_argument == 3 || p_argument == 4 || p_argument == 5) { // Slider hint. ScriptLanguage::CodeCompletionOption slider1("or_greater", ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT); slider1.insert_text = slider1.display.quote(p_quote_style); @@ -746,6 +746,9 @@ static void _find_annotation_arguments(const GDScriptParser::AnnotationNode *p_a ScriptLanguage::CodeCompletionOption slider2("or_lesser", ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT); slider2.insert_text = slider2.display.quote(p_quote_style); r_result.insert(slider2.display, slider2); + ScriptLanguage::CodeCompletionOption slider3("noslider", ScriptLanguage::CODE_COMPLETION_KIND_PLAIN_TEXT); + slider3.insert_text = slider3.display.quote(p_quote_style); + r_result.insert(slider3.display, slider3); } } else if (p_annotation->name == SNAME("@export_exp_easing")) { if (p_argument == 0 || p_argument == 1) { diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index bc225850c9..5abbf907c7 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -120,7 +120,7 @@ GDScriptParser::GDScriptParser() { register_annotation(MethodInfo("@export_global_dir"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_GLOBAL_DIR, Variant::STRING>); register_annotation(MethodInfo("@export_multiline"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_MULTILINE_TEXT, Variant::STRING>); register_annotation(MethodInfo("@export_placeholder"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_PLACEHOLDER_TEXT, Variant::STRING>); - register_annotation(MethodInfo("@export_range", { Variant::FLOAT, "min" }, { Variant::FLOAT, "max" }, { Variant::FLOAT, "step" }, { Variant::STRING, "slider1" }, { Variant::STRING, "slider2" }), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_RANGE, Variant::FLOAT>, 3); + register_annotation(MethodInfo("@export_range", { Variant::FLOAT, "min" }, { Variant::FLOAT, "max" }, { Variant::FLOAT, "step" }, { Variant::STRING, "slider1" }, { Variant::STRING, "slider2" }, { Variant::STRING, "slider3" }), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_RANGE, Variant::FLOAT>, 4); register_annotation(MethodInfo("@export_exp_easing", { Variant::STRING, "hint1" }, { Variant::STRING, "hint2" }), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_EXP_EASING, Variant::FLOAT>, 2); register_annotation(MethodInfo("@export_color_no_alpha"), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_COLOR_NO_ALPHA, Variant::COLOR>); register_annotation(MethodInfo("@export_node_path", { Variant::STRING, "type" }), AnnotationInfo::VARIABLE, &GDScriptParser::export_annotations<PROPERTY_HINT_NODE_PATH_VALID_TYPES, Variant::NODE_PATH>, 1, true); |