summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/debugger/script_editor_debugger.cpp2
-rw-r--r--editor/editor_dir_dialog.cpp1
-rw-r--r--editor/editor_settings.cpp1
-rw-r--r--editor/plugins/polygon_2d_editor_plugin.cpp2
-rw-r--r--editor/plugins/script_editor_plugin.cpp30
-rw-r--r--editor/plugins/script_editor_plugin.h1
-rw-r--r--editor/plugins/texture_editor_plugin.cpp27
-rw-r--r--editor/plugins/texture_editor_plugin.h2
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp14
9 files changed, 58 insertions, 22 deletions
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp
index ab857dc3ad..d6650c3319 100644
--- a/editor/debugger/script_editor_debugger.cpp
+++ b/editor/debugger/script_editor_debugger.cpp
@@ -147,7 +147,7 @@ void ScriptEditorDebugger::update_tabs() {
}
void ScriptEditorDebugger::clear_style() {
- tabs->add_theme_style_override("panel", nullptr);
+ tabs->remove_theme_style_override("panel");
}
void ScriptEditorDebugger::save_node(ObjectID p_id, const String &p_file) {
diff --git a/editor/editor_dir_dialog.cpp b/editor/editor_dir_dialog.cpp
index 5df392b91e..f91dedf25d 100644
--- a/editor/editor_dir_dialog.cpp
+++ b/editor/editor_dir_dialog.cpp
@@ -44,6 +44,7 @@ void EditorDirDialog::_update_dir(TreeItem *p_item, EditorFileSystemDirectory *p
p_item->set_metadata(0, p_dir->get_path());
p_item->set_icon(0, tree->get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
+ p_item->set_icon_modulate(0, tree->get_theme_color(SNAME("folder_icon_modulate"), SNAME("FileDialog")));
if (!p_item->get_parent()) {
p_item->set_text(0, "res://");
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 1820804cfe..70f43e01cf 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -411,6 +411,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set("interface/editor/automatically_open_screenshots", true);
EDITOR_SETTING_USAGE(Variant::BOOL, PROPERTY_HINT_NONE, "interface/editor/single_window_mode", false, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
_initial_set("interface/editor/hide_console_window", false);
+ _initial_set("interface/editor/mouse_extra_buttons_navigate_history", true);
_initial_set("interface/editor/save_each_scene_on_quit", true); // Regression
// Inspector
diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp
index ac18ff9f1c..5afe9ed60c 100644
--- a/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -779,7 +779,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
if (mm.is_valid()) {
if ((mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
- Vector2 drag(mm->get_relative().x, mm->get_relative().y);
+ Vector2 drag = mm->get_relative();
uv_hscroll->set_value(uv_hscroll->get_value() - drag.x);
uv_vscroll->set_value(uv_vscroll->get_value() - drag.y);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 07e4d4ebf0..6922a48a50 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -2750,6 +2750,29 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co
}
}
+void ScriptEditor::input(const Ref<InputEvent> &p_event) {
+ // This is implemented in `input()` rather than `unhandled_input()` to allow
+ // the shortcut to be used regardless of the click location.
+ // This feature can be disabled to avoid interfering with other uses of the additional
+ // mouse buttons, such as push-to-talk in a VoIP program.
+ if (EDITOR_GET("interface/editor/mouse_extra_buttons_navigate_history")) {
+ const Ref<InputEventMouseButton> mb = p_event;
+
+ // Navigate the script history using additional mouse buttons present on some mice.
+ // This must be hardcoded as the editor shortcuts dialog doesn't allow assigning
+ // more than one shortcut per action.
+ if (mb.is_valid() && mb->is_pressed() && is_visible_in_tree()) {
+ if (mb->get_button_index() == MOUSE_BUTTON_XBUTTON1) {
+ _history_back();
+ }
+
+ if (mb->get_button_index() == MOUSE_BUTTON_XBUTTON2) {
+ _history_forward();
+ }
+ }
+ }
+}
+
void ScriptEditor::unhandled_key_input(const Ref<InputEvent> &p_event) {
ERR_FAIL_COND(p_event.is_null());
@@ -3294,7 +3317,6 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_update_script_connections", &ScriptEditor::_update_script_connections);
ClassDB::bind_method("_help_class_open", &ScriptEditor::_help_class_open);
ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts);
-
ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview);
ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts);
@@ -3427,9 +3449,11 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
ED_SHORTCUT("script_editor/window_sort", TTR("Sort"));
ED_SHORTCUT("script_editor/window_move_up", TTR("Move Up"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_UP);
ED_SHORTCUT("script_editor/window_move_down", TTR("Move Down"), KEY_MASK_SHIFT | KEY_MASK_ALT | KEY_DOWN);
- ED_SHORTCUT("script_editor/next_script", TTR("Next Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_PERIOD); // these should be KEY_GREATER and KEY_LESS but those don't work
+ // FIXME: These should be `KEY_GREATER` and `KEY_LESS` but those don't work.
+ ED_SHORTCUT("script_editor/next_script", TTR("Next Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_PERIOD);
ED_SHORTCUT("script_editor/prev_script", TTR("Previous Script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_COMMA);
- set_process_unhandled_key_input(true);
+ set_process_input(true);
+ set_process_unhandled_input(true);
file_menu = memnew(MenuButton);
file_menu->set_text(TTR("File"));
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 7620605570..6d9b27e0be 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -418,6 +418,7 @@ class ScriptEditor : public PanelContainer {
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
+ virtual void input(const Ref<InputEvent> &p_event) override;
virtual void unhandled_key_input(const Ref<InputEvent> &p_event) override;
void _script_list_gui_input(const Ref<InputEvent> &ev);
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 44db06bcfd..b9ec6bf5ab 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -58,6 +58,21 @@ void TexturePreview::_notification(int p_what) {
}
}
+void TexturePreview::_update_metadata_label_text() {
+ Ref<Texture2D> texture = texture_display->get_texture();
+
+ String format;
+ if (Object::cast_to<ImageTexture>(*texture)) {
+ format = Image::get_format_name(Object::cast_to<ImageTexture>(*texture)->get_format());
+ } else if (Object::cast_to<StreamTexture2D>(*texture)) {
+ format = Image::get_format_name(Object::cast_to<StreamTexture2D>(*texture)->get_format());
+ } else {
+ format = texture->get_class();
+ }
+
+ metadata_label->set_text(itos(texture->get_width()) + "x" + itos(texture->get_height()) + " " + format);
+}
+
TexturePreview::TexturePreview(Ref<Texture2D> p_texture, bool p_show_metadata) {
checkerboard = memnew(TextureRect);
checkerboard->set_stretch_mode(TextureRect::STRETCH_TILE);
@@ -75,16 +90,8 @@ TexturePreview::TexturePreview(Ref<Texture2D> p_texture, bool p_show_metadata) {
if (p_show_metadata) {
metadata_label = memnew(Label);
- String format;
- if (Object::cast_to<ImageTexture>(*p_texture)) {
- format = Image::get_format_name(Object::cast_to<ImageTexture>(*p_texture)->get_format());
- } else if (Object::cast_to<StreamTexture2D>(*p_texture)) {
- format = Image::get_format_name(Object::cast_to<StreamTexture2D>(*p_texture)->get_format());
- } else {
- format = p_texture->get_class();
- }
-
- metadata_label->set_text(itos(p_texture->get_width()) + "x" + itos(p_texture->get_height()) + " " + format);
+ _update_metadata_label_text();
+ p_texture->connect("changed", callable_mp(this, &TexturePreview::_update_metadata_label_text));
// It's okay that these colors are static since the grid color is static too.
metadata_label->add_theme_color_override("font_color", Color::named("white"));
diff --git a/editor/plugins/texture_editor_plugin.h b/editor/plugins/texture_editor_plugin.h
index 36a5513ea6..60349febd7 100644
--- a/editor/plugins/texture_editor_plugin.h
+++ b/editor/plugins/texture_editor_plugin.h
@@ -44,6 +44,8 @@ private:
TextureRect *checkerboard = nullptr;
Label *metadata_label = nullptr;
+ void _update_metadata_label_text();
+
protected:
void _notification(int p_what);
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index 54185d1d2a..97dd02870c 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -87,7 +87,7 @@ void TileSetAtlasSourceEditor::TileSetAtlasSourceProxyObject::_get_property_list
p_list->push_back(PropertyInfo(Variant::OBJECT, "texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"));
p_list->push_back(PropertyInfo(Variant::VECTOR2I, "margins", PROPERTY_HINT_NONE, ""));
p_list->push_back(PropertyInfo(Variant::VECTOR2I, "separation", PROPERTY_HINT_NONE, ""));
- p_list->push_back(PropertyInfo(Variant::VECTOR2I, "tile_size", PROPERTY_HINT_NONE, ""));
+ p_list->push_back(PropertyInfo(Variant::VECTOR2I, "texture_region_size", PROPERTY_HINT_NONE, ""));
}
void TileSetAtlasSourceEditor::TileSetAtlasSourceProxyObject::_bind_methods() {
@@ -926,11 +926,11 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven
can_grow[i] |= (i % 2 == 0) ? size_in_atlas.y > 1 : size_in_atlas.x > 1;
}
for (int i = 0; i < 4; i++) {
- Vector2 pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[i];
+ Vector2 pos = rect.position + rect.size * coords[i];
if (can_grow[i] && can_grow[(i + 3) % 4] && Rect2(pos, zoomed_size).has_point(mouse_local_pos)) {
cursor_shape = (i % 2) ? CURSOR_BDIAGSIZE : CURSOR_FDIAGSIZE;
}
- Vector2 next_pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[(i + 1) % 4];
+ Vector2 next_pos = rect.position + rect.size * coords[(i + 1) % 4];
if (can_grow[i] && Rect2((pos + next_pos) / 2.0, zoomed_size).has_point(mouse_local_pos)) {
cursor_shape = (i % 2) ? CURSOR_HSIZE : CURSOR_VSIZE;
}
@@ -1136,7 +1136,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven
can_grow[i] |= (i % 2 == 0) ? size_in_atlas.y > 1 : size_in_atlas.x > 1;
}
for (int i = 0; i < 4; i++) {
- Vector2 pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[i];
+ Vector2 pos = rect.position + rect.size * coords[i];
if (can_grow[i] && can_grow[(i + 3) % 4] && Rect2(pos, zoomed_size).has_point(mouse_local_pos)) {
drag_type = (DragType)((int)DRAG_TYPE_RESIZE_TOP_LEFT + i * 2);
drag_start_mouse_pos = mouse_local_pos;
@@ -1145,7 +1145,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref<InputEven
drag_start_tile_shape = Rect2i(selected.tile, tile_set_atlas_source->get_tile_size_in_atlas(selected.tile));
cursor_shape = (i % 2) ? CURSOR_BDIAGSIZE : CURSOR_FDIAGSIZE;
}
- Vector2 next_pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[(i + 1) % 4];
+ Vector2 next_pos = rect.position + rect.size * coords[(i + 1) % 4];
if (can_grow[i] && Rect2((pos + next_pos) / 2.0, zoomed_size).has_point(mouse_local_pos)) {
drag_type = (DragType)((int)DRAG_TYPE_RESIZE_TOP + i * 2);
drag_start_mouse_pos = mouse_local_pos;
@@ -1614,13 +1614,13 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() {
can_grow[i] |= (i % 2 == 0) ? size_in_atlas.y > 1 : size_in_atlas.x > 1;
}
for (int i = 0; i < 4; i++) {
- Vector2 pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[i];
+ Vector2 pos = rect.position + rect.size * coords[i];
if (can_grow[i] && can_grow[(i + 3) % 4]) {
tile_atlas_control->draw_texture_rect(resize_handle, Rect2(pos, zoomed_size), false);
} else {
tile_atlas_control->draw_texture_rect(resize_handle_disabled, Rect2(pos, zoomed_size), false);
}
- Vector2 next_pos = rect.position + Vector2(rect.size.x, rect.size.y) * coords[(i + 1) % 4];
+ Vector2 next_pos = rect.position + rect.size * coords[(i + 1) % 4];
if (can_grow[i]) {
tile_atlas_control->draw_texture_rect(resize_handle, Rect2((pos + next_pos) / 2.0, zoomed_size), false);
} else {