Tilemap Editor: Setting to hide tile info in the menu bar

Based on e513ecb7a1.
This commit is contained in:
Rémi Verschelde 2017-08-16 19:51:55 +02:00
parent 0dd51fc722
commit 19aff15a1a
2 changed files with 17 additions and 5 deletions

View file

@ -52,8 +52,15 @@ void TileMapEditor::_notification(int p_what) {
search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
} break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
bool new_show_tile_info = EditorSettings::get_singleton()->get("editors/tile_map/show_tile_info_on_hover");
if (new_show_tile_info != show_tile_info) {
show_tile_info = new_show_tile_info;
tile_info->set_visible(show_tile_info);
}
if (is_visible_in_tree()) {
_update_palette();
}
@ -912,12 +919,14 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
canvas_item_editor->update();
}
int tile_under = node->get_cell(over_tile.x, over_tile.y);
String tile_name = "none";
if (show_tile_info) {
int tile_under = node->get_cell(over_tile.x, over_tile.y);
String tile_name = "none";
if (node->get_tileset()->has_tile(tile_under))
tile_name = node->get_tileset()->tile_get_name(tile_under);
tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]");
if (node->get_tileset()->has_tile(tile_under))
tile_name = node->get_tileset()->tile_get_name(tile_under);
tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]");
}
if (tool == TOOL_PAINTING) {
@ -1439,6 +1448,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
tool = TOOL_NONE;
selection_active = false;
mouse_over = false;
show_tile_info = true;
flip_h = false;
flip_v = false;
@ -1602,6 +1612,7 @@ TileMapEditorPlugin::TileMapEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("editors/tile_map/show_tile_ids", false);
EDITOR_DEF("editors/tile_map/sort_tiles_by_name", true);
EDITOR_DEF("editors/tile_map/bucket_fill_preview", true);
EDITOR_DEF("editors/tile_map/show_tile_info_on_hover", true);
tile_map_editor = memnew(TileMapEditor(p_node));
add_control_to_container(CONTAINER_CANVAS_EDITOR_SIDE, tile_map_editor);

View file

@ -97,6 +97,7 @@ class TileMapEditor : public VBoxContainer {
bool selection_active;
bool mouse_over;
bool show_tile_info;
bool flip_h;
bool flip_v;