summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/style_box_editor_plugin.cpp10
-rw-r--r--editor/plugins/text_editor.cpp2
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp33
-rw-r--r--editor/plugins/tile_map_editor_plugin.h2
4 files changed, 28 insertions, 19 deletions
diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp
index c4a9803ff4..7e5e278689 100644
--- a/editor/plugins/style_box_editor_plugin.cpp
+++ b/editor/plugins/style_box_editor_plugin.cpp
@@ -68,7 +68,14 @@ void StyleBoxPreview::_sb_changed() {
void StyleBoxPreview::_redraw() {
if (stylebox.is_valid()) {
- preview->draw_style_box(stylebox, preview->get_rect());
+ Rect2 preview_rect = preview->get_rect();
+
+ // Re-adjust preview panel to fit all drawn content
+ Rect2 draw_rect = stylebox->get_draw_rect(preview_rect);
+ preview_rect.size -= draw_rect.size - preview_rect.size;
+ preview_rect.position -= draw_rect.position - preview_rect.position;
+
+ preview->draw_style_box(stylebox, preview_rect);
}
}
@@ -81,6 +88,7 @@ void StyleBoxPreview::_bind_methods() {
StyleBoxPreview::StyleBoxPreview() {
preview = memnew(Control);
preview->set_custom_minimum_size(Size2(0, 150 * EDSCALE));
+ preview->set_clip_contents(true);
preview->connect("draw", this, "_redraw");
add_margin_child(TTR("Preview:"), preview);
}
diff --git a/editor/plugins/text_editor.cpp b/editor/plugins/text_editor.cpp
index 0cef5a8b6f..7651ab8526 100644
--- a/editor/plugins/text_editor.cpp
+++ b/editor/plugins/text_editor.cpp
@@ -713,7 +713,7 @@ TextEditor::TextEditor() {
goto_menu->get_popup()->add_separator();
bookmarks_menu = memnew(PopupMenu);
- bookmarks_menu->set_name(TTR("Bookmarks"));
+ bookmarks_menu->set_name("Bookmarks");
goto_menu->get_popup()->add_child(bookmarks_menu);
goto_menu->get_popup()->add_submenu_item(TTR("Bookmarks"), "Bookmarks");
_update_bookmark_list();
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index 385ba4cfda..a8e81b612b 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -52,12 +52,6 @@ void TileMapEditor::_notification(int p_what) {
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();
}
@@ -1250,14 +1244,13 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
CanvasItemEditor::get_singleton()->update_viewport();
}
- if (show_tile_info) {
- int tile_under = node->get_cell(over_tile.x, over_tile.y);
- String tile_name = "none";
+ 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->show();
+ tile_info->set_text(String::num(over_tile.x) + ", " + String::num(over_tile.y) + " [" + tile_name + "]");
if (tool == TOOL_PAINTING) {
@@ -1925,7 +1918,6 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
tool = TOOL_NONE;
selection_active = false;
mouse_over = false;
- show_tile_info = true;
flip_h = false;
flip_v = false;
@@ -2055,7 +2047,12 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) {
// Tile position.
tile_info = memnew(Label);
- toolbar_right->add_child(tile_info);
+ tile_info->set_modulate(Color(1, 1, 1, 0.8));
+ tile_info->set_mouse_filter(MOUSE_FILTER_IGNORE);
+ tile_info->add_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_font("main", "EditorFonts"));
+ // The tile info is only displayed after a tile has been hovered.
+ tile_info->hide();
+ CanvasItemEditor::get_singleton()->add_control_to_info_overlay(tile_info);
// Menu.
options = memnew(MenuButton);
@@ -2151,6 +2148,10 @@ void TileMapEditorPlugin::make_visible(bool p_visible) {
tile_map_editor->show();
tile_map_editor->get_toolbar()->show();
tile_map_editor->get_toolbar_right()->show();
+ // `tile_info` isn't shown here, as it's displayed after a tile has been hovered.
+ // Otherwise, a translucent black rectangle would be visible as there would be an
+ // empty Label in the CanvasItemEditor's info overlay.
+
// Change to TOOL_SELECT when TileMap node is selected, to prevent accidental movement.
CanvasItemEditor::get_singleton()->set_current_tool(CanvasItemEditor::TOOL_SELECT);
} else {
@@ -2158,6 +2159,7 @@ void TileMapEditorPlugin::make_visible(bool p_visible) {
tile_map_editor->hide();
tile_map_editor->get_toolbar()->hide();
tile_map_editor->get_toolbar_right()->hide();
+ tile_map_editor->get_tile_info()->hide();
tile_map_editor->edit(NULL);
}
}
@@ -2170,7 +2172,6 @@ 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);
EDITOR_DEF("editors/tile_map/editor_side", 1);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "editors/tile_map/editor_side", PROPERTY_HINT_ENUM, "Left,Right"));
diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h
index e3d678c2fd..6400431bd1 100644
--- a/editor/plugins/tile_map_editor_plugin.h
+++ b/editor/plugins/tile_map_editor_plugin.h
@@ -109,7 +109,6 @@ class TileMapEditor : public VBoxContainer {
bool selection_active;
bool mouse_over;
- bool show_tile_info;
bool flip_h;
bool flip_v;
@@ -218,6 +217,7 @@ protected:
public:
HBoxContainer *get_toolbar() const { return toolbar; }
HBoxContainer *get_toolbar_right() const { return toolbar_right; }
+ Label *get_tile_info() const { return tile_info; }
bool forward_gui_input(const Ref<InputEvent> &p_event);
void forward_canvas_draw_over_viewport(Control *p_overlay);