mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
Visualscript fix crash and generic search does not connect ports.
* Signal change requires function changes to _selected_new_virtual_method
This commit is contained in:
parent
96d37769d9
commit
00519debbe
4 changed files with 60 additions and 35 deletions
|
@ -1330,7 +1330,7 @@ void VisualScriptEditor::_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
void VisualScriptEditor::_generic_search() {
|
||||
new_connect_node_select->select_from_visual_script(String(""));
|
||||
new_connect_node_select->select_from_visual_script(String(""), false);
|
||||
}
|
||||
|
||||
void VisualScriptEditor::_members_gui_input(const Ref<InputEvent> &p_event) {
|
||||
|
@ -2610,7 +2610,7 @@ void VisualScriptEditor::connect_data(Ref<VisualScriptNode> vnode_old, Ref<Visua
|
|||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void VisualScriptEditor::_selected_connect_node(const String &p_text, const String &p_category) {
|
||||
void VisualScriptEditor::_selected_connect_node(const String &p_text, const String &p_category, const bool p_connecting) {
|
||||
Vector2 ofs = graph->get_scroll_ofs() + port_action_pos;
|
||||
if (graph->is_using_snap()) {
|
||||
int snap = graph->get_snap();
|
||||
|
@ -2625,12 +2625,12 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
|
|||
Ref<VisualScriptNode> vnode_old = script->get_node(edited_func, port_action_node);
|
||||
int new_id = script->get_available_id();
|
||||
|
||||
if (Object::cast_to<VisualScriptOperator>(vnode_new.ptr())) {
|
||||
if (Object::cast_to<VisualScriptOperator>(vnode_new.ptr()) && script->get_node(edited_func, port_action_node).is_valid()) {
|
||||
Variant::Type type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).type;
|
||||
Object::cast_to<VisualScriptOperator>(vnode_new.ptr())->set_typed(type);
|
||||
}
|
||||
|
||||
if (Object::cast_to<VisualScriptTypeCast>(vnode_new.ptr())) {
|
||||
if (Object::cast_to<VisualScriptTypeCast>(vnode_new.ptr()) && script->get_node(edited_func, port_action_node).is_valid()) {
|
||||
Variant::Type type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).type;
|
||||
String hint_name = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint_string;
|
||||
|
||||
|
@ -2644,8 +2644,11 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
|
|||
}
|
||||
undo_redo->create_action(TTR("Add Node"));
|
||||
undo_redo->add_do_method(script.ptr(), "add_node", edited_func, new_id, vnode_new, ofs);
|
||||
connect_seq(vnode_old, vnode_new, new_id);
|
||||
connect_data(vnode_old, vnode_new, new_id);
|
||||
if (vnode_old.is_valid() && p_connecting == true) {
|
||||
connect_seq(vnode_old, vnode_new, new_id);
|
||||
connect_data(vnode_old, vnode_new, new_id);
|
||||
}
|
||||
|
||||
undo_redo->add_undo_method(script.ptr(), "remove_node", edited_func, new_id);
|
||||
undo_redo->add_do_method(this, "_update_graph");
|
||||
undo_redo->add_undo_method(this, "_update_graph");
|
||||
|
@ -2732,7 +2735,7 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
|
|||
if (tg.gdclass != StringName()) {
|
||||
vsfc->set_base_type(tg.gdclass);
|
||||
|
||||
} else {
|
||||
} else if (script->get_node(edited_func, port_action_node).is_valid()) {
|
||||
PropertyHint hint = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint;
|
||||
String base_type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint_string;
|
||||
|
||||
|
@ -2766,7 +2769,7 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
|
|||
if (tg.gdclass != StringName()) {
|
||||
vsp->set_base_type(tg.gdclass);
|
||||
|
||||
} else {
|
||||
} else if (script->get_node(edited_func, port_action_node).is_valid()) {
|
||||
PropertyHint hint = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint;
|
||||
String base_type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint_string;
|
||||
|
||||
|
@ -2796,10 +2799,9 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
|
|||
if (tg.gdclass != StringName()) {
|
||||
vsp->set_base_type(tg.gdclass);
|
||||
|
||||
} else {
|
||||
} else if (script->get_node(edited_func, port_action_node).is_valid()) {
|
||||
PropertyHint hint = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint;
|
||||
String base_type = script->get_node(edited_func, port_action_node)->get_output_value_port_info(port_action_output).hint_string;
|
||||
|
||||
if (base_type != String() && hint == PROPERTY_HINT_TYPE_STRING) {
|
||||
vsp->set_base_type(base_type);
|
||||
}
|
||||
|
@ -2816,9 +2818,10 @@ void VisualScriptEditor::_selected_connect_node(const String &p_text, const Stri
|
|||
}
|
||||
}
|
||||
Ref<VisualScriptNode> vnode_old = script->get_node(edited_func, port_action_node);
|
||||
connect_seq(vnode_old, vnode, port_action_new_node);
|
||||
connect_data(vnode_old, vnode, port_action_new_node);
|
||||
|
||||
if (vnode_old.is_valid() && p_connecting == true) {
|
||||
connect_seq(vnode_old, vnode, port_action_new_node);
|
||||
connect_data(vnode_old, vnode, port_action_new_node);
|
||||
}
|
||||
_update_graph(port_action_new_node);
|
||||
_update_graph_connections();
|
||||
}
|
||||
|
@ -2869,7 +2872,7 @@ void VisualScriptEditor::connect_seq(Ref<VisualScriptNode> vnode_old, Ref<Visual
|
|||
undo_redo->commit_action();
|
||||
}
|
||||
|
||||
void VisualScriptEditor::_selected_new_virtual_method(const String &p_text, const String &p_category) {
|
||||
void VisualScriptEditor::_selected_new_virtual_method(const String &p_text, const String &p_category, const bool p_connecting) {
|
||||
|
||||
String name = p_text;
|
||||
if (script->has_function(name)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue