summaryrefslogtreecommitdiff
path: root/tools/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2016-08-31 07:42:14 +0200
committerGitHub <noreply@github.com>2016-08-31 07:42:14 +0200
commitace2ad961ca9b8b33c30ed6b855af9f7c03f6321 (patch)
tree635a5c31b9c6c8331cfe8d2f191b1680da97c366 /tools/editor/plugins
parentfb4d6d1db0ed0fb8deb530be4b0ae481fb5ba3cd (diff)
parentcd71fcb097b28a1602e34c7167cc4b4c3fc628c7 (diff)
Merge pull request #6228 from manokara/tilemap-someinfo
Add mouse position information in TileMap.
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.cpp11
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp
index 316077c5d5..822d9e6c87 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_map_editor_plugin.cpp
@@ -798,6 +798,13 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) {
canvas_item_editor->update();
}
+ 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 (tool==TOOL_PAINTING) {
int id = get_selected_tile();
@@ -1370,6 +1377,10 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
toolbar->set_alignment(BoxContainer::ALIGN_END);
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(toolbar);
+ // Tile position
+ tile_info = memnew( Label );
+ toolbar->add_child(tile_info);
+
options = memnew( MenuButton );
options->set_text("Tile Map");
options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("TileMap", "EditorIcons"));
diff --git a/tools/editor/plugins/tile_map_editor_plugin.h b/tools/editor/plugins/tile_map_editor_plugin.h
index f586c5bf13..666290489b 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.h
+++ b/tools/editor/plugins/tile_map_editor_plugin.h
@@ -36,6 +36,7 @@
#include "scene/gui/line_edit.h"
#include "scene/gui/tool_button.h"
#include "scene/gui/menu_button.h"
+#include "scene/gui/label.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
@@ -81,6 +82,7 @@ class TileMapEditor : public VBoxContainer {
HBoxContainer *toolbar;
+ Label *tile_info;
MenuButton *options;
ToolButton *transp;
ToolButton *mirror_x;