change call mode to self when adding nodes with node search

fixes #28614
This commit is contained in:
Jummit 2019-05-12 09:27:05 +02:00
parent 89c37dae49
commit 1d056d3921

View file

@ -2726,7 +2726,9 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
Ref<VisualScriptFunctionCall> vsfc = vsn;
vsfc->set_function(p_text);
if (p_connecting) {
VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node, port_action_output, vn);
if (tg.type == Variant::OBJECT) {
vsfc->set_call_mode(VisualScriptFunctionCall::CALL_MODE_INSTANCE);
vsfc->set_base_type(String(""));
@ -2755,9 +2757,11 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
vsfc->set_basic_type(tg.type);
}
}
}
// if connecting from another node the call mode shouldn't be self
if (p_connecting) {
if (Object::cast_to<VisualScriptPropertySet>(vsn.ptr())) {
Ref<VisualScriptPropertySet> vsp = vsn;
VisualScriptNode::TypeGuess tg = _guess_output_type(port_action_node, port_action_output, vn);
@ -2815,6 +2819,7 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
vsp->set_basic_type(tg.type);
}
}
}
Ref<VisualScriptNode> vnode_old = script->get_node(edited_func, port_action_node);
if (vnode_old.is_valid() && p_connecting) {
connect_seq(vnode_old, vnode, port_action_new_node);