Skip to content

Commit

Permalink
Merge pull request #86947 from TheSofox/tile-set-paint-button-tooltip
Browse files Browse the repository at this point in the history
Made tooltip on `TileSet` Paint Button give more information when disabled
  • Loading branch information
akien-mga committed Jun 4, 2024
2 parents 7b63ac4 + 3614aa9 commit 92ea322
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
19 changes: 10 additions & 9 deletions editor/plugins/tiles/tile_set_atlas_source_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,13 @@ void TileSetAtlasSourceEditor::_update_toolbar() {
}
}

void TileSetAtlasSourceEditor::_update_buttons() {
tool_paint_button->set_disabled(read_only);
tool_paint_button->set_tooltip_text(read_only ? TTR("TileSet is in read-only mode. Make the resource unique to edit TileSet properties.") : TTR("Paint properties."));
tools_settings_erase_button->set_disabled(read_only);
tool_advanced_menu_button->set_disabled(read_only);
}

void TileSetAtlasSourceEditor::_tile_atlas_control_mouse_exited() {
hovered_base_tile_coords = TileSetSource::INVALID_ATLAS_COORDS;
tile_atlas_control->queue_redraw();
Expand Down Expand Up @@ -2212,10 +2219,7 @@ void TileSetAtlasSourceEditor::edit(Ref<TileSet> p_tile_set, TileSetAtlasSource
tool_setup_atlas_source_button->set_pressed(true);
}

// Disable buttons in read-only mode.
tool_paint_button->set_disabled(read_only);
tools_settings_erase_button->set_disabled(read_only);
tool_advanced_menu_button->set_disabled(read_only);
_update_buttons();

// Update everything.
_update_source_inspector();
Expand Down Expand Up @@ -2458,10 +2462,7 @@ void TileSetAtlasSourceEditor::_notification(int p_what) {
read_only = EditorNode::get_singleton()->is_resource_read_only(tile_set);
}

// Disable buttons in read-only mode.
tool_paint_button->set_disabled(read_only);
tools_settings_erase_button->set_disabled(read_only);
tool_advanced_menu_button->set_disabled(read_only);
_update_buttons();

// Update everything.
_update_source_inspector();
Expand Down Expand Up @@ -2545,7 +2546,6 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
tool_paint_button->set_theme_type_variation("FlatButton");
tool_paint_button->set_toggle_mode(true);
tool_paint_button->set_button_group(tools_button_group);
tool_paint_button->set_tooltip_text(TTR("Paint properties."));
toolbox->add_child(tool_paint_button);

// Tile inspector.
Expand Down Expand Up @@ -2647,6 +2647,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() {
tool_settings->add_child(outside_tiles_warning);

_update_toolbar();
_update_buttons();

// Right side of toolbar.
Control *middle_space = memnew(Control);
Expand Down
1 change: 1 addition & 0 deletions editor/plugins/tiles/tile_set_atlas_source_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ class TileSetAtlasSourceEditor : public HSplitContainer {
void _update_manage_tile_properties_button();
void _update_atlas_view();
void _update_toolbar();
void _update_buttons();

// -- Misc --
void _auto_create_tiles();
Expand Down

0 comments on commit 92ea322

Please sign in to comment.