diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-23 12:40:30 +0200 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-23 12:40:30 +0200 |
| commit | d08d3e95c80f7e855e32ddaea0e5acd96eab21e7 (patch) | |
| tree | 63c746f7a61f0455b0ce47536b63693f13e02265 | |
| parent | 814de86494bb883592dac1d9c0dde5b27c9c79bb (diff) | |
| parent | 920e53cacb105122d8c727618d0a8bd78b755049 (diff) | |
| download | redot-engine-d08d3e95c80f7e855e32ddaea0e5acd96eab21e7.tar.gz | |
Merge pull request #83507 from timothyqiu/abt-close
Readd close button for nodes in `AnimationNodeBlendTree` editor
| -rw-r--r-- | editor/editor_themes.cpp | 7 | ||||
| -rw-r--r-- | editor/plugins/animation_blend_tree_editor_plugin.cpp | 10 |
2 files changed, 13 insertions, 4 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index bf0c5392c1..2a42224c87 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -2046,12 +2046,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { graphn_sb_panel_selected->set_corner_radius_individual(0, 0, corner_radius * EDSCALE, corner_radius * EDSCALE); graphn_sb_panel_selected->set_expand_margin(SIDE_TOP, 17 * EDSCALE); - const int gn_titlebar_margin_side = 12; - Ref<StyleBoxFlat> graphn_sb_titlebar = make_flat_stylebox(graphnode_bg, gn_titlebar_margin_side, gn_margin_top, gn_titlebar_margin_side, 0, corner_width); + const int gn_titlebar_margin_left = 12; + const int gn_titlebar_margin_right = 4; // The rest is for the close button. + Ref<StyleBoxFlat> graphn_sb_titlebar = make_flat_stylebox(graphnode_bg, gn_titlebar_margin_left, gn_margin_top, gn_titlebar_margin_right, 0, corner_width); graphn_sb_titlebar->set_expand_margin(SIDE_TOP, 2 * EDSCALE); graphn_sb_titlebar->set_corner_radius_individual(corner_radius * EDSCALE, corner_radius * EDSCALE, 0, 0); - Ref<StyleBoxFlat> graphn_sb_titlebar_selected = make_flat_stylebox(graph_node_selected_border_color, gn_titlebar_margin_side, gn_margin_top, gn_titlebar_margin_side, 0, corner_width); + Ref<StyleBoxFlat> graphn_sb_titlebar_selected = make_flat_stylebox(graph_node_selected_border_color, gn_titlebar_margin_left, gn_margin_top, gn_titlebar_margin_right, 0, corner_width); graphn_sb_titlebar_selected->set_corner_radius_individual(corner_radius * EDSCALE, corner_radius * EDSCALE, 0, 0); graphn_sb_titlebar_selected->set_expand_margin(SIDE_TOP, 2 * EDSCALE); Ref<StyleBoxEmpty> graphn_sb_slot = make_empty_stylebox(12, 0, 12, 0); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 772957bc55..4a17fd89ff 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -170,7 +170,15 @@ void AnimationNodeBlendTreeEditor::update_graph() { name->connect("text_changed", callable_mp(this, &AnimationNodeBlendTreeEditor::_node_rename_lineedit_changed), CONNECT_DEFERRED); base = 1; agnode->set_closable(true); - node->connect("delete_request", callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_node_request).bind(E), CONNECT_DEFERRED); + + if (!read_only) { + Button *delete_button = memnew(Button); + delete_button->set_flat(true); + delete_button->set_focus_mode(FOCUS_NONE); + delete_button->set_icon(get_editor_theme_icon(SNAME("Close"))); + delete_button->connect("pressed", callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_node_request).bind(E), CONNECT_DEFERRED); + node->get_titlebar_hbox()->add_child(delete_button); + } } for (int i = 0; i < agnode->get_input_count(); i++) { |
