Merge pull request #20463 from fire/vs_expand_hints_to_virtual_func
Visualscript: Carry property hint and hint string through to Visualscript virtual funcs
This commit is contained in:
commit
4488bb9956
|
@ -2905,7 +2905,7 @@ void VisualScriptEditor::_selected_new_virtual_method(const String &p_text, cons
|
|||
undo_redo->add_do_method(script.ptr(), "add_function", name);
|
||||
|
||||
for (int i = 0; i < minfo.arguments.size(); i++) {
|
||||
func_node->add_argument(minfo.arguments[i].type, minfo.arguments[i].name);
|
||||
func_node->add_argument(minfo.arguments[i].type, minfo.arguments[i].name, -1, minfo.arguments[i].hint, minfo.arguments[i].hint_string);
|
||||
}
|
||||
|
||||
undo_redo->add_do_method(script.ptr(), "add_node", name, script->get_available_id(), func_node);
|
||||
|
|
|
@ -177,7 +177,7 @@ class VisualScriptEditor : public ScriptEditorBase {
|
|||
|
||||
void _cancel_connect_node();
|
||||
void _create_new_node(const String &p_text, const String &p_category, const Vector2 &p_point);
|
||||
void _selected_new_virtual_method(const String &p_text, const String &p_category, const bool p_connecting = true);
|
||||
void _selected_new_virtual_method(const String &p_text = String(""), const String &p_category = String(""), const bool p_connecting = true);
|
||||
|
||||
int error_line;
|
||||
|
||||
|
|
|
@ -205,6 +205,8 @@ PropertyInfo VisualScriptFunction::get_output_value_port_info(int p_idx) const {
|
|||
PropertyInfo out;
|
||||
out.type = arguments[p_idx].type;
|
||||
out.name = arguments[p_idx].name;
|
||||
out.hint = arguments[p_idx].hint;
|
||||
out.hint_string = arguments[p_idx].hint_string;
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -218,11 +220,13 @@ String VisualScriptFunction::get_text() const {
|
|||
return get_name(); //use name as function name I guess
|
||||
}
|
||||
|
||||
void VisualScriptFunction::add_argument(Variant::Type p_type, const String &p_name, int p_index) {
|
||||
void VisualScriptFunction::add_argument(Variant::Type p_type, const String &p_name, int p_index, const PropertyHint p_hint, const String &p_hint_string) {
|
||||
|
||||
Argument arg;
|
||||
arg.name = p_name;
|
||||
arg.type = p_type;
|
||||
arg.hint = p_hint;
|
||||
arg.hint_string = p_hint_string;
|
||||
if (p_index >= 0)
|
||||
arguments.insert(p_index, arg);
|
||||
else
|
||||
|
|
|
@ -40,6 +40,8 @@ class VisualScriptFunction : public VisualScriptNode {
|
|||
struct Argument {
|
||||
String name;
|
||||
Variant::Type type;
|
||||
PropertyHint hint;
|
||||
String hint_string;
|
||||
};
|
||||
|
||||
Vector<Argument> arguments;
|
||||
|
@ -70,7 +72,7 @@ public:
|
|||
virtual String get_text() const;
|
||||
virtual String get_category() const { return "flow_control"; }
|
||||
|
||||
void add_argument(Variant::Type p_type, const String &p_name, int p_index = -1);
|
||||
void add_argument(Variant::Type p_type, const String &p_name, int p_index = -1, const PropertyHint p_hint = PROPERTY_HINT_NONE, const String &p_hint_string = String(""));
|
||||
void set_argument_type(int p_argidx, Variant::Type p_type);
|
||||
Variant::Type get_argument_type(int p_argidx) const;
|
||||
void set_argument_name(int p_argidx, const String &p_name);
|
||||
|
|
Loading…
Reference in New Issue