summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.cpp30
-rw-r--r--drivers/gles2/rasterizer_storage_gles2.h1
-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
-rw-r--r--scene/gui/text_edit.cpp1
6 files changed, 39 insertions, 30 deletions
diff --git a/drivers/gles2/rasterizer_storage_gles2.cpp b/drivers/gles2/rasterizer_storage_gles2.cpp
index 147bab9d1f..15b2193cbe 100644
--- a/drivers/gles2/rasterizer_storage_gles2.cpp
+++ b/drivers/gles2/rasterizer_storage_gles2.cpp
@@ -4657,7 +4657,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glGenRenderbuffers(1, &rt->depth);
glBindRenderbuffer(GL_RENDERBUFFER, rt->depth);
- glRenderbufferStorage(GL_RENDERBUFFER, config.depth_internalformat, rt->width, rt->height);
+ glRenderbufferStorage(GL_RENDERBUFFER, config.depth_buffer_internalformat, rt->width, rt->height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
}
@@ -4725,7 +4725,7 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
glGenRenderbuffers(1, &rt->multisample_depth);
glBindRenderbuffer(GL_RENDERBUFFER, rt->multisample_depth);
- glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, config.depth_internalformat, rt->width, rt->height);
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, config.depth_buffer_internalformat, rt->width, rt->height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->multisample_depth);
@@ -5189,7 +5189,7 @@ void RasterizerStorageGLES2::render_target_set_external_texture(RID p_render_tar
// create a multisample depth buffer, we're not reusing Godots because Godot's didn't get created..
glGenRenderbuffers(1, &rt->external.depth);
glBindRenderbuffer(GL_RENDERBUFFER, rt->external.depth);
- glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, config.depth_internalformat, rt->width, rt->height);
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, msaa, config.depth_buffer_internalformat, rt->width, rt->height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->external.depth);
}
@@ -5302,7 +5302,7 @@ RID RasterizerStorageGLES2::canvas_light_shadow_buffer_create(int p_width) {
glGenRenderbuffers(1, &cls->depth);
glBindRenderbuffer(GL_RENDERBUFFER, cls->depth);
- glRenderbufferStorage(GL_RENDERBUFFER, config.depth_internalformat, cls->size, cls->height);
+ glRenderbufferStorage(GL_RENDERBUFFER, config.depth_buffer_internalformat, cls->size, cls->height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, cls->depth);
glGenTextures(1, &cls->distance);
@@ -5783,6 +5783,8 @@ void RasterizerStorageGLES2::initialize() {
config.keep_original_textures = false;
config.shrink_textures_x2 = false;
+ config.depth_internalformat = GL_DEPTH_COMPONENT;
+ config.depth_type = GL_UNSIGNED_INT;
#ifdef GLES_OVER_GL
config.float_texture_supported = true;
@@ -5790,20 +5792,20 @@ void RasterizerStorageGLES2::initialize() {
config.pvrtc_supported = false;
config.etc1_supported = false;
config.support_npot_repeat_mipmap = true;
- config.depth_internalformat = GL_DEPTH_COMPONENT;
- config.depth_type = GL_UNSIGNED_INT;
+ config.depth_buffer_internalformat = GL_DEPTH_COMPONENT24;
#else
config.float_texture_supported = config.extensions.has("GL_ARB_texture_float") || config.extensions.has("GL_OES_texture_float");
config.s3tc_supported = config.extensions.has("GL_EXT_texture_compression_s3tc") || config.extensions.has("WEBGL_compressed_texture_s3tc");
config.etc1_supported = config.extensions.has("GL_OES_compressed_ETC1_RGB8_texture") || config.extensions.has("WEBGL_compressed_texture_etc1");
config.pvrtc_supported = config.extensions.has("IMG_texture_compression_pvrtc") || config.extensions.has("WEBGL_compressed_texture_pvrtc");
config.support_npot_repeat_mipmap = config.extensions.has("GL_OES_texture_npot");
- // on mobile check for 24 bit depth support
+
+ // on mobile check for 24 bit depth support for RenderBufferStorage
if (config.extensions.has("GL_OES_depth24")) {
- config.depth_internalformat = _DEPTH_COMPONENT24_OES;
+ config.depth_buffer_internalformat = _DEPTH_COMPONENT24_OES;
config.depth_type = GL_UNSIGNED_INT;
} else {
- config.depth_internalformat = GL_DEPTH_COMPONENT16;
+ config.depth_buffer_internalformat = GL_DEPTH_COMPONENT16;
config.depth_type = GL_UNSIGNED_SHORT;
}
#endif
@@ -5882,7 +5884,7 @@ void RasterizerStorageGLES2::initialize() {
GLuint depth;
glGenTextures(1, &depth);
glBindTexture(GL_TEXTURE_2D, depth);
- glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, 32, 32, 0, config.depth_internalformat, config.depth_type, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, 32, 32, 0, GL_DEPTH_COMPONENT, config.depth_type, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -5901,8 +5903,12 @@ void RasterizerStorageGLES2::initialize() {
if (status != GL_FRAMEBUFFER_COMPLETE) {
// If it fails, test to see if it supports a framebuffer texture using UNSIGNED_SHORT
// This is needed because many OSX devices don't support either UNSIGNED_INT or UNSIGNED_SHORT
-
+#ifdef GLES_OVER_GL
config.depth_internalformat = GL_DEPTH_COMPONENT16;
+#else
+ // OES_depth_texture extension only specifies GL_DEPTH_COMPONENT.
+ config.depth_internalformat = GL_DEPTH_COMPONENT;
+#endif
config.depth_type = GL_UNSIGNED_SHORT;
glGenFramebuffers(1, &fbo);
@@ -5910,7 +5916,7 @@ void RasterizerStorageGLES2::initialize() {
glGenTextures(1, &depth);
glBindTexture(GL_TEXTURE_2D, depth);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT16, 32, 32, 0, GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT, NULL);
+ glTexImage2D(GL_TEXTURE_2D, 0, config.depth_internalformat, 32, 32, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
diff --git a/drivers/gles2/rasterizer_storage_gles2.h b/drivers/gles2/rasterizer_storage_gles2.h
index 6de530d8c3..daf6b93afc 100644
--- a/drivers/gles2/rasterizer_storage_gles2.h
+++ b/drivers/gles2/rasterizer_storage_gles2.h
@@ -99,6 +99,7 @@ public:
GLuint depth_internalformat;
GLuint depth_type;
+ GLuint depth_buffer_internalformat;
} config;
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);
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 8ddc31745e..b997d7a064 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -4593,6 +4593,7 @@ void TextEdit::_scroll_moved(double p_to_val) {
break;
}
}
+ n_line = MIN(n_line, text.size() - 1);
int line_wrap_amount = times_line_wraps(n_line);
int wi = line_wrap_amount - (sc - v_scroll_i - 1);
wi = CLAMP(wi, 0, line_wrap_amount);