diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-05-24 10:50:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-24 10:50:55 +0200 |
commit | 65dd1bf02392adf777ffd1891c8232615cf57a1d (patch) | |
tree | 732e32fb7a991c0e3f5d97ee666e68a3f4c72c01 /modules/visual_script/editor | |
parent | 56dbfcdcbadf2c958d9656e4e3b7443b9bb11be1 (diff) | |
parent | 307427af89d4cbbcf32099f6009739f50c8bd0a0 (diff) |
Merge pull request #47665 from trollodel/tree_more_buttons_signals
Diffstat (limited to 'modules/visual_script/editor')
-rw-r--r-- | modules/visual_script/editor/visual_script_editor.cpp | 16 | ||||
-rw-r--r-- | modules/visual_script/editor/visual_script_editor.h | 4 |
2 files changed, 14 insertions, 6 deletions
diff --git a/modules/visual_script/editor/visual_script_editor.cpp b/modules/visual_script/editor/visual_script_editor.cpp index 642f15db86..7454c8076f 100644 --- a/modules/visual_script/editor/visual_script_editor.cpp +++ b/modules/visual_script/editor/visual_script_editor.cpp @@ -1440,7 +1440,11 @@ void VisualScriptEditor::_deselect_input_names() { } } -void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_button) { +void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button) { + if (p_mouse_button != MouseButton::LEFT) { + return; + } + TreeItem *ti = Object::cast_to<TreeItem>(p_item); TreeItem *root = members->get_root(); @@ -4343,7 +4347,11 @@ void VisualScriptEditor::_get_ends(int p_node, const List<VisualScript::Sequence } } -void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos) { +void VisualScriptEditor::_member_rmb_selected(const Vector2 &p_pos, MouseButton p_button) { + if (p_button != MouseButton::RIGHT) { + return; + } + TreeItem *ti = members->get_selected(); ERR_FAIL_COND(!ti); @@ -4544,11 +4552,11 @@ VisualScriptEditor::VisualScriptEditor() { members_section->add_margin_child(TTR("Members:"), members, true); members->set_custom_minimum_size(Size2(0, 50 * EDSCALE)); members->set_hide_root(true); - members->connect("button_pressed", callable_mp(this, &VisualScriptEditor::_member_button)); + members->connect("button_clicked", callable_mp(this, &VisualScriptEditor::_member_button)); members->connect("item_edited", callable_mp(this, &VisualScriptEditor::_member_edited)); members->connect("cell_selected", callable_mp(this, &VisualScriptEditor::_member_selected), varray(), CONNECT_DEFERRED); members->connect("gui_input", callable_mp(this, &VisualScriptEditor::_members_gui_input)); - members->connect("item_rmb_selected", callable_mp(this, &VisualScriptEditor::_member_rmb_selected)); + members->connect("item_mouse_selected", callable_mp(this, &VisualScriptEditor::_member_rmb_selected)); members->set_allow_rmb_select(true); members->set_allow_reselect(true); members->set_hide_folding(true); diff --git a/modules/visual_script/editor/visual_script_editor.h b/modules/visual_script/editor/visual_script_editor.h index c7fd8c4a78..fd59d22cbe 100644 --- a/modules/visual_script/editor/visual_script_editor.h +++ b/modules/visual_script/editor/visual_script_editor.h @@ -226,7 +226,7 @@ class VisualScriptEditor : public ScriptEditorBase { void _update_available_nodes(); - void _member_button(Object *p_item, int p_column, int p_button); + void _member_button(Object *p_item, int p_column, int p_button, MouseButton p_mouse_button); void _expression_text_changed(const String &p_text, int p_id); void _add_input_port(int p_id); @@ -289,7 +289,7 @@ class VisualScriptEditor : public ScriptEditorBase { VisualScriptNode::TypeGuess _guess_output_type(int p_port_action_node, int p_port_action_output, RBSet<int> &p_visited_nodes); - void _member_rmb_selected(const Vector2 &p_pos); + void _member_rmb_selected(const Vector2 &p_pos, MouseButton p_button); void _member_option(int p_option); void _toggle_scripts_pressed(); |