diff options
24 files changed, 197 insertions, 91 deletions
diff --git a/AUTHORS.md b/AUTHORS.md index 0f002cfaed..e8bb91d4bb 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -95,6 +95,7 @@ name is available. Indah Sylvia (ISylvox) J08nY Jakub Grzesik (kubecz3k) + James Buck (jbuck3) Jérôme Gully (Nutriz) Joan Fons Sanchez (JFonS) Johan Manuel (29jm) @@ -24,11 +24,12 @@ generous deed immortalized in the next stable release of Godot Engine. AD Ford Alan Beauchamp - Anand Mallik + albinaask Andrew Dunai Brandon Lamb Christian Baune Christopher Montesano + Darius Pranskus Darkhan Baimyrza Darrin Massena Dov Zimring @@ -41,15 +42,18 @@ generous deed immortalized in the next stable release of Godot Engine. Jasper Brooks Javary Co. Jeffery Chiu + John Benard (Linuxydable) Justin Arnold Justo Delgado Baudí Kyle Szklenski + Marcel Kräml Matthieu Huvé Maxim Karsten Mike King Nathan Warden Neal Gompa (Conan Kudo) Péter Magyar + Ronnie Cheng Slobodan Milnovic Stephan Lanfermann Steve @@ -58,12 +62,14 @@ generous deed immortalized in the next stable release of Godot Engine. ## Gold donors + Bjarke David Gehrig David Graham David Snopek Ed Morley Florian Rämisch Jakub Grzesik + HardRound Manuele Finocchiaro Officine Pixel S.n.c. Ronan Zeegers @@ -92,10 +98,10 @@ generous deed immortalized in the next stable release of Godot Engine. Maciej Pendolski Matthew Hillier Mohamed Ikbel Boulabiar - Mored4u Rene Retro Village Rob Messick + Roland Fredenhagen Ryan Badour Sandro Jenny Scott Wadden @@ -108,16 +114,19 @@ generous deed immortalized in the next stable release of Godot Engine. Alex Khayrullin alice gambrell + Barugon Chris Goddard Chris Serino Christian Padilla Conrad Curry Craig Smith Darrian Little + Hoai Nam Tran Horváth Péter - Ivan Trombley + Jamal Aboudrar Joan Fons Joshua Flores + Leo Fidel R Liban Petr Malac Rami Rob @@ -149,20 +158,20 @@ generous deed immortalized in the next stable release of Godot Engine. Christoph Schröder Codee Leaf Cody Parker - Coldragon Craig Ostrin + curtis Kramer D Easypete + Edgar Sun Eric Monson Eugenio Hugo Salgüero Jáñez - Fain flesk Gary Hulst gavlig GGGames.org Guilherme Felipe de C. G. da Silva - Halom Vered Heath Hayes + Hu Hund Isaac Clausman Jared White Jeff Nyte @@ -171,18 +180,21 @@ generous deed immortalized in the next stable release of Godot Engine. Jose Malheiro Joshua Lesperance Juan Velandia + Julian Todd Juraj Móza Kelteseth kickmaniac kinfox Lain Ballard Marcelo Dornbusch Lopes + Marcelo Henrique Gonçalves Markus Fehr Markus Wiesner Martin Eigel Matt Eunson m kaersten MuffinManKen + Nick Abousselam Oliver Dick Oscar Campos Patrick Ting @@ -197,14 +209,16 @@ generous deed immortalized in the next stable release of Godot Engine. Samuel Judd Scott Pilet Sean Morgan + Sean Robertson + Sébastien Serban Serafimescu - Sindre Sømme SleepCircle spilldata Stoned Xander TheLevelOfDetail . Thomas Kurz Tobias Bocanegra + Trent Fehl Urho William Foster Zhou Tuizhi @@ -214,6 +228,7 @@ generous deed immortalized in the next stable release of Godot Engine. ## Silver donors 1D_Inc + Aaron Winter Abraham Haskins Acheron Adam @@ -229,7 +244,6 @@ generous deed immortalized in the next stable release of Godot Engine. Agustinus Arya Aidan O'Flannagain Aki Mimoto - Alan Mervitz Alan Stice Albin Jonasson Svärdsby Alder Stefano @@ -237,14 +251,17 @@ generous deed immortalized in the next stable release of Godot Engine. Alessandro Senese Alexander Erlemann alex clavelle + Alfred Reinold Baudisch Allan Davis Allen Schade - Andreas Evers Andreas Krampitz + Andres Hernandez André Simões + andrew james morris + Andrew Mansuetti Andrew Thomas + Ano Nim Anthony Avina - Anthony Staunton AP Condomines Arda Erol Armin Preiml @@ -252,10 +269,11 @@ generous deed immortalized in the next stable release of Godot Engine. Arthur S. Muszynski Asger Ashley Claymore + Ashton Scott Snapp Aubrey Falconer - Avencherus B A Balázs Batári + Bartosz Bielecki Benedikt Ben Vercammen Bernd Jänichen @@ -265,10 +283,8 @@ generous deed immortalized in the next stable release of Godot Engine. Bobby CC Wong Bram brian - bugcaptor Burney Waring Cameron Meyer - Carlo Sitaro Carl van der Geest Carwyn Edwards Cas Brugman @@ -289,7 +305,7 @@ generous deed immortalized in the next stable release of Godot Engine. Daniel Tebbutt David May David Woodard - DiCola Jamn + Dimitri Stanojevic Dominic Cooney Dominik Wetzel Donn Eddy @@ -301,24 +317,25 @@ generous deed immortalized in the next stable release of Godot Engine. Eduardo Teixeira Edward Herbert Edward Swartz + Eelco F Hillenius Egon Elbre Elgenzay Elias Nykrem - Elmeri '- Duy Kevin Nguyen Ephemeral Eric Ellingson - Eric Rogers Eric Williams Erkki Seppälä Evan Rose + Fain + Faisal Alkubaisi Fancy Ants Studios Fekinox Felix Bohmann Felix Kollmann Flaredown Forty Doubleu - fox FuDiggity + Frank Gadzhi Kharkharov gamedev by Celio Gary Thomas @@ -328,16 +345,17 @@ generous deed immortalized in the next stable release of Godot Engine. Greyson Richey Grid Guillaume Audirac + Guillaume Pham Ngoc Guldoman Hal A Heribert Hirth Hunter Jones Hylpher - Ichiro Dohi Iiari iKlem IndustrialRobot Ivan Nikolaev + Jackson Harmer Jacob Jaiden Gerig Jaime Ruiz-Borau Vizárraga @@ -346,9 +364,11 @@ generous deed immortalized in the next stable release of Godot Engine. Janders Jannik Gröger JARKKO PARVIAINEN + Jean-Baptiste LEPESME Jeff Hungerford Jennifer Graves Jesse Dubay + Joe Alden Joel Fivat Joel Höglund Joel Setterberg @@ -363,14 +383,18 @@ generous deed immortalized in the next stable release of Godot Engine. Jonathan G Jon Bonazza Jon Sully + Jordy Goodridge + Jorge Antunes Jorge Caballero Jose Aleman Jose C. Rubio Joseph Catrambone Josh Mitchell + Joshua Southerland Juanfran Judd Julian Murgia + June Little JungleRobba Justin Hamilton Justin Spedding @@ -382,7 +406,6 @@ generous deed immortalized in the next stable release of Godot Engine. Kent Jofur Kevin McPhillips Kiri Jolly - Kiyohiro Kawamura (kyorohiro) Kjetil Haugland Klagsam KsyTek Games @@ -390,26 +413,24 @@ generous deed immortalized in the next stable release of Godot Engine. kycho Kyle Appelgate Laurent Tréguier + Leonard Meagher Leonardo Dimano Levi Lindsey Lin Chear Linus Lind Lundgren Lionel Gaillard - Lukáš Rendvanský Luigi Renna LunaticInAHat Lurkars Major Haul Malcolm - Malik Ahmed - Malik Nejer + Marco Lardelli Markus Michael Egger Martin Holas Martin Liška Marvin - Mathieu Rimelen + Mathieu Matt Edwards - Matthew Little Mauro Pellegrini Max Fiedler Maxime Blade @@ -426,7 +447,7 @@ generous deed immortalized in the next stable release of Godot Engine. Mikayla Mike Birkhead Mike Cunningham - Mitchell J. Wagner + Molinghu MoM Mored4u Nathan Fish @@ -435,8 +456,10 @@ generous deed immortalized in the next stable release of Godot Engine. Neil Blakey-Milner Neil Wang Nerdforge + Nerdyninja Nicholas Nicholas Girga + Nick Allen Nick Macholl Niclas Eriksen Nicolás Montaña @@ -453,11 +476,12 @@ generous deed immortalized in the next stable release of Godot Engine. Paweł Kowal Pedro Assuncao Penguin + Peter Philip Cohoe Point08 + pwab Rad Cat Rafa Laguna - rainerLinux Remi Rampin Rémi Verschelde Ricardo Alcantara @@ -470,6 +494,7 @@ generous deed immortalized in the next stable release of Godot Engine. Roman Tinkov Ronald Ho Hip (CrimsonZA) Ronan + Ronny Mühle Ryan Groom Ryan Hentz Sam Edson @@ -483,6 +508,7 @@ generous deed immortalized in the next stable release of Godot Engine. Shane Shane Sicienski Shane Spoor + Shiomi '- Duy Kevin Nguyen Siim Raidma Simon Jonas Larsen Simon Wenner @@ -490,17 +516,21 @@ generous deed immortalized in the next stable release of Godot Engine. SK smbe19 smo1704 + soft circles + Squirrel Stefano Caronia Steve Cloete Svenne Krap Taylor Fahlman Terry tezuvholovdr + TheVoiceInMyHead thomas Thomas Bechtold Thomas Detoy Thomas Kelly Tim Drumheller + Tim Erskine Timothy B. MacDonald Title Plinsut Tobbun @@ -516,6 +546,7 @@ generous deed immortalized in the next stable release of Godot Engine. Tyler Compton Tyler Stafos UltyX + Valentí Gàmez Vaughan Ling Victor Vigilant Watch @@ -525,10 +556,12 @@ generous deed immortalized in the next stable release of Godot Engine. werner mendizabal Wiley Thompson Will - William Hogben Wyatt Goodin Yegor + Yuri LaPointe Yuri Sizov + Zgegnesh Hemomancer + 郝晨煜 ## Bronze donors diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index 499c3b8271..dbe725f08b 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -182,14 +182,6 @@ Selects the file, with the path provided by [code]file[/code], in the FileSystem dock. </description> </method> - <method name="set_distraction_free_mode"> - <return type="void"> - </return> - <argument index="0" name="enter" type="bool"> - </argument> - <description> - </description> - </method> <method name="set_main_screen_editor"> <return type="void"> </return> @@ -210,6 +202,10 @@ </description> </method> </methods> + <members> + <member name="distraction_free_mode" type="bool" setter="set_distraction_free_mode" getter="is_distraction_free_mode_enabled"> + </member> + </members> <constants> </constants> </class> diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index 55d2275194..aa8c8d2443 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -436,6 +436,12 @@ Saves the image as a PNG file to [code]path[/code]. </description> </method> + <method name="save_png_to_buffer" qualifiers="const"> + <return type="PackedByteArray"> + </return> + <description> + </description> + </method> <method name="set_pixel"> <return type="void"> </return> diff --git a/doc/classes/Skeleton3D.xml b/doc/classes/Skeleton3D.xml index 4460b519fc..640cbe84f5 100644 --- a/doc/classes/Skeleton3D.xml +++ b/doc/classes/Skeleton3D.xml @@ -106,6 +106,12 @@ Returns the pose transform of the specified bone. Pose is applied on top of the custom pose, which is applied on top the rest pose. </description> </method> + <method name="get_bone_process_orders"> + <return type="PackedInt32Array"> + </return> + <description> + </description> + </method> <method name="get_bone_rest" qualifiers="const"> <return type="Transform"> </return> @@ -268,6 +274,12 @@ <member name="animate_physical_bones" type="bool" setter="set_animate_physical_bones" getter="get_animate_physical_bones" default="true"> </member> </members> + <signals> + <signal name="pose_updated"> + <description> + </description> + </signal> + </signals> <constants> <constant name="NOTIFICATION_UPDATE_SKELETON" value="50"> </constant> diff --git a/drivers/gles2/shader_compiler_gles2.cpp b/drivers/gles2/shader_compiler_gles2.cpp index 9b57f417cb..2e36de5c79 100644 --- a/drivers/gles2/shader_compiler_gles2.cpp +++ b/drivers/gles2/shader_compiler_gles2.cpp @@ -262,7 +262,7 @@ void ShaderCompilerGLES2::_dump_function_deps(SL::ShaderNode *p_node, const Stri } } -String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning) { +String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning, bool p_use_scope) { StringBuilder code; switch (p_node->type) { @@ -626,7 +626,7 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener if (arr_node->call_expression != nullptr) { code += "."; - code += _dump_node_code(arr_node->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning); + code += _dump_node_code(arr_node->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning, false); } if (arr_node->index_expression != nullptr) { @@ -822,13 +822,17 @@ String ShaderCompilerGLES2::_dump_node_code(SL::Node *p_node, int p_level, Gener } break; default: { - code += "("; + if (p_use_scope) { + code += "("; + } code += _dump_node_code(op_node->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning); code += " "; code += _opstr(op_node->op); code += " "; code += _dump_node_code(op_node->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning); - code += ")"; + if (p_use_scope) { + code += ")"; + } } break; } } break; diff --git a/drivers/gles2/shader_compiler_gles2.h b/drivers/gles2/shader_compiler_gles2.h index 369bf7877b..66a3af0739 100644 --- a/drivers/gles2/shader_compiler_gles2.h +++ b/drivers/gles2/shader_compiler_gles2.h @@ -75,7 +75,7 @@ private: }; void _dump_function_deps(ShaderLanguage::ShaderNode *p_node, const StringName &p_for_func, const Map<StringName, String> &p_func_code, StringBuilder &r_to_add, Set<StringName> &r_added); - String _dump_node_code(ShaderLanguage::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning); + String _dump_node_code(ShaderLanguage::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning, bool p_use_scope = true); StringName current_func_name; StringName vertex_name; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 3ea970a0f0..9888013ce6 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -657,7 +657,7 @@ FindReplaceBar::FindReplaceBar() { // be handled too late if they weren't handled here. void CodeTextEditor::_input(const Ref<InputEvent> &event) { const Ref<InputEventKey> key_event = event; - if (!key_event.is_valid() || !key_event->is_pressed()) { + if (!key_event.is_valid() || !key_event->is_pressed() || !text_editor->has_focus()) { return; } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 8b7014fabe..4d69b3f0d6 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4782,7 +4782,7 @@ void EditorNode::set_distraction_free_mode(bool p_enter) { } } -bool EditorNode::get_distraction_free_mode() const { +bool EditorNode::is_distraction_free_mode_enabled() const { return distraction_free->is_pressed(); } diff --git a/editor/editor_node.h b/editor/editor_node.h index dfe3d91c07..7c9cf44d6c 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -693,7 +693,7 @@ public: bool get_docks_visible() const; void set_distraction_free_mode(bool p_enter); - bool get_distraction_free_mode() const; + bool is_distraction_free_mode_enabled() const; void add_control_to_dock(DockSlot p_slot, Control *p_control); void remove_control_from_dock(Control *p_control); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 2365090f03..6d93e92555 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -270,6 +270,10 @@ void EditorInterface::set_distraction_free_mode(bool p_enter) { EditorNode::get_singleton()->set_distraction_free_mode(p_enter); } +bool EditorInterface::is_distraction_free_mode_enabled() const { + return EditorNode::get_singleton()->is_distraction_free_mode_enabled(); +} + EditorInterface *EditorInterface::singleton = nullptr; void EditorInterface::_bind_methods() { @@ -302,6 +306,9 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("set_main_screen_editor", "name"), &EditorInterface::set_main_screen_editor); ClassDB::bind_method(D_METHOD("set_distraction_free_mode", "enter"), &EditorInterface::set_distraction_free_mode); + ClassDB::bind_method(D_METHOD("is_distraction_free_mode_enabled"), &EditorInterface::is_distraction_free_mode_enabled); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "distraction_free_mode"), "set_distraction_free_mode", "is_distraction_free_mode_enabled"); } EditorInterface::EditorInterface() { diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 2792c8bf19..aac36bfdfd 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -105,6 +105,7 @@ public: void set_main_screen_editor(const String &p_name); void set_distraction_free_mode(bool p_enter); + bool is_distraction_free_mode_enabled() const; EditorInterface(); }; diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 573876c488..59366a239f 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -87,7 +87,6 @@ public: GridContainer *child_container; set_title(TTR("Configure Snap")); - get_ok()->set_text(TTR("Close")); container = memnew(VBoxContainer); add_child(container); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index e7f8a56e5e..4b79d8c344 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -609,6 +609,18 @@ void ScriptTextEditor::_validate_script() { for (List<ScriptLanguage::Warning>::Element *E = warnings.front(); E; E = E->next()) { ScriptLanguage::Warning w = E->get(); + Dictionary ignore_meta; + ignore_meta["line"] = w.line; + ignore_meta["code"] = w.string_code.to_lower(); + warnings_panel->push_cell(); + warnings_panel->push_meta(ignore_meta); + warnings_panel->push_color( + warnings_panel->get_theme_color("accent_color", "Editor").lerp(warnings_panel->get_theme_color("mono_color", "Editor"), 0.5)); + warnings_panel->add_text(TTR("[Ignore]")); + warnings_panel->pop(); // Color. + warnings_panel->pop(); // Meta ignore. + warnings_panel->pop(); // Cell. + warnings_panel->push_cell(); warnings_panel->push_meta(w.line - 1); warnings_panel->push_color(warnings_panel->get_theme_color("warning_color", "Editor")); @@ -621,15 +633,6 @@ void ScriptTextEditor::_validate_script() { warnings_panel->push_cell(); warnings_panel->add_text(w.message); warnings_panel->pop(); // Cell. - - Dictionary ignore_meta; - ignore_meta["line"] = w.line; - ignore_meta["code"] = w.string_code.to_lower(); - warnings_panel->push_cell(); - warnings_panel->push_meta(ignore_meta); - warnings_panel->add_text(TTR("(ignore)")); - warnings_panel->pop(); // Meta ignore. - warnings_panel->pop(); // Cell. } warnings_panel->pop(); // Table. @@ -1747,6 +1750,8 @@ ScriptTextEditor::ScriptTextEditor() { warnings_panel = memnew(RichTextLabel); editor_box->add_child(warnings_panel); + warnings_panel->add_theme_font_override( + "normal_font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("main", "EditorFonts")); warnings_panel->set_custom_minimum_size(Size2(0, 100 * EDSCALE)); warnings_panel->set_h_size_flags(SIZE_EXPAND_FILL); warnings_panel->set_meta_underline(true); diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index 6c037f94a0..3281a59c1c 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -194,6 +194,21 @@ void TileMapEditor::_palette_multi_selected(int index, bool selected) { _update_palette(); } +void TileMapEditor::_palette_input(const Ref<InputEvent> &p_event) { + const Ref<InputEventMouseButton> mb = p_event; + + // Zoom in/out using Ctrl + mouse wheel. + if (mb.is_valid() && mb->is_pressed() && mb->get_command()) { + if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) { + size_slider->set_value(size_slider->get_value() + 0.2); + } + + if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) { + size_slider->set_value(size_slider->get_value() - 0.2); + } + } +} + void TileMapEditor::_canvas_mouse_enter() { mouse_over = true; CanvasItemEditor::get_singleton()->update_viewport(); @@ -1913,6 +1928,7 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { palette->add_theme_constant_override("vseparation", 8 * EDSCALE); palette->connect("item_selected", callable_mp(this, &TileMapEditor::_palette_selected)); palette->connect("multi_selected", callable_mp(this, &TileMapEditor::_palette_multi_selected)); + palette->connect("gui_input", callable_mp(this, &TileMapEditor::_palette_input)); palette_container->add_child(palette); // Add message for when no texture is selected. diff --git a/editor/plugins/tile_map_editor_plugin.h b/editor/plugins/tile_map_editor_plugin.h index 5f82d7bfb8..e25e2d2add 100644 --- a/editor/plugins/tile_map_editor_plugin.h +++ b/editor/plugins/tile_map_editor_plugin.h @@ -182,6 +182,7 @@ class TileMapEditor : public VBoxContainer { void _menu_option(int p_option); void _palette_selected(int index); void _palette_multi_selected(int index, bool selected); + void _palette_input(const Ref<InputEvent> &p_event); Dictionary _create_cell_dictionary(int tile, bool flip_x, bool flip_y, bool transpose, Vector2 autotile_coord); void _start_undo(const String &p_action); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 644facd5bd..b3d4b391d3 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -569,6 +569,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { scroll = memnew(ScrollContainer); main_vb->add_child(scroll); scroll->set_v_size_flags(SIZE_EXPAND_FILL); + scroll->connect("gui_input", callable_mp(this, &TileSetEditor::_on_scroll_container_input)); scroll->set_clip_contents(true); empty_message = memnew(Label); @@ -1198,6 +1199,27 @@ bool TileSetEditor::is_within_grabbing_distance_of_first_point(const Vector2 &p_ return distance < p_grab_threshold; } +void TileSetEditor::_on_scroll_container_input(const Ref<InputEvent> &p_event) { + const Ref<InputEventMouseButton> mb = p_event; + + if (mb.is_valid()) { + // Zoom in/out using Ctrl + mouse wheel. This is done on the ScrollContainer + // to allow performing this action anywhere, even if the cursor isn't + // hovering the texture in the workspace. + if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { + print_line("zooming in"); + _zoom_in(); + // Don't scroll up after zooming in. + accept_event(); + } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { + print_line("zooming out"); + _zoom_out(); + // Don't scroll down after zooming out. + accept_event(); + } + } +} + void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { if (tileset.is_null() || !get_current_texture().is_valid()) { return; @@ -1214,8 +1236,8 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { } current_tile_region.position += WORKSPACE_MARGIN; - Ref<InputEventMouseButton> mb = p_ie; - Ref<InputEventMouseMotion> mm = p_ie; + const Ref<InputEventMouseButton> mb = p_ie; + const Ref<InputEventMouseMotion> mm = p_ie; if (mb.is_valid()) { if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && !creating_shape) { @@ -1239,13 +1261,6 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) { delete tiles; } } - - // Mouse Wheel Event - if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) { - _zoom_in(); - } else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) { - _zoom_out(); - } } // Drag Middle Mouse if (mm.is_valid()) { diff --git a/editor/plugins/tile_set_editor_plugin.h b/editor/plugins/tile_set_editor_plugin.h index 827325cfd7..2955dda244 100644 --- a/editor/plugins/tile_set_editor_plugin.h +++ b/editor/plugins/tile_set_editor_plugin.h @@ -200,6 +200,7 @@ private: void _on_workspace_overlay_draw(); void _on_workspace_draw(); void _on_workspace_process(); + void _on_scroll_container_input(const Ref<InputEvent> &p_event); void _on_workspace_input(const Ref<InputEvent> &p_ie); void _on_tool_clicked(int p_tool); void _on_priority_changed(float val); diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index d5c065bd55..2f5af0eda0 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -256,6 +256,11 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & lh = line < l.height_caches.size() ? l.height_caches[line] : 1; \ line_ascent = line < l.ascent_caches.size() ? l.ascent_caches[line] : 1; \ line_descent = line < l.descent_caches.size() ? l.descent_caches[line] : 1; \ + if (p_mode == PROCESS_DRAW) { \ + if (line < l.offset_caches.size()) { \ + wofs = l.offset_caches[line]; \ + } \ + } \ } \ if (p_mode == PROCESS_POINTER && r_click_item && p_click_pos.y >= p_ofs.y + y && p_click_pos.y <= p_ofs.y + y + lh && p_click_pos.x < p_ofs.x + wofs) { \ if (r_outside) \ @@ -873,7 +878,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & } void RichTextLabel::_scroll_changed(double) { - if (updating_scroll || !scroll_active) { + if (updating_scroll) { return; } @@ -2008,6 +2013,7 @@ void RichTextLabel::set_scroll_active(bool p_active) { } scroll_active = p_active; + vscroll->set_drag_node_enabled(p_active); update(); } diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index e7950bec98..4db6ca2949 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -506,6 +506,10 @@ void ScrollBar::_drag_node_exit() { } void ScrollBar::_drag_node_input(const Ref<InputEvent> &p_input) { + if (!drag_node_enabled) { + return; + } + Ref<InputEventMouseButton> mb = p_input; if (mb.is_valid()) { @@ -590,6 +594,10 @@ NodePath ScrollBar::get_drag_node() const { return drag_node_path; } +void ScrollBar::set_drag_node_enabled(bool p_enable) { + drag_node_enabled = p_enable; +} + void ScrollBar::set_smooth_scroll_enabled(bool p_enable) { smooth_scroll_enabled = p_enable; } @@ -610,19 +618,6 @@ void ScrollBar::_bind_methods() { ScrollBar::ScrollBar(Orientation p_orientation) { orientation = p_orientation; - highlight = HIGHLIGHT_NONE; - custom_step = -1; - drag_node = nullptr; - - drag.active = false; - - drag_node_speed = Vector2(); - drag_node_touching = false; - drag_node_touching_deaccel = false; - - scrolling = false; - target_scroll = 0; - smooth_scroll_enabled = false; if (focus_by_default) { set_focus_mode(FOCUS_ALL); diff --git a/scene/gui/scroll_bar.h b/scene/gui/scroll_bar.h index d2641b14f3..23ee61d9e1 100644 --- a/scene/gui/scroll_bar.h +++ b/scene/gui/scroll_bar.h @@ -47,12 +47,12 @@ class ScrollBar : public Range { Orientation orientation; Size2 size; - float custom_step; + float custom_step = -1; - HighlightStatus highlight; + HighlightStatus highlight = HIGHLIGHT_NONE; struct Drag { - bool active; + bool active = false; float pos_at_click; float value_at_click; } drag; @@ -66,22 +66,23 @@ class ScrollBar : public Range { static void set_can_focus_by_default(bool p_can_focus); - Node *drag_node; + Node *drag_node = nullptr; NodePath drag_node_path; + bool drag_node_enabled = true; - Vector2 drag_node_speed; + Vector2 drag_node_speed = Vector2(); Vector2 drag_node_accum; Vector2 drag_node_from; Vector2 last_drag_node_accum; float last_drag_node_time; float time_since_motion; - bool drag_node_touching; - bool drag_node_touching_deaccel; + bool drag_node_touching = false; + bool drag_node_touching_deaccel = false; bool click_handled; - bool scrolling; - double target_scroll; - bool smooth_scroll_enabled; + bool scrolling = false; + double target_scroll = 0; + bool smooth_scroll_enabled = false; void _drag_node_exit(); void _drag_node_input(const Ref<InputEvent> &p_input); @@ -99,6 +100,7 @@ public: void set_drag_node(const NodePath &p_path); NodePath get_drag_node() const; + void set_drag_node_enabled(bool p_enable); void set_smooth_scroll_enabled(bool p_enable); bool is_smooth_scroll_enabled() const; diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 99edf26dc1..8d9c5f07b2 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -204,7 +204,7 @@ void PrimitiveMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("set_flip_faces", "flip_faces"), &PrimitiveMesh::set_flip_faces); ClassDB::bind_method(D_METHOD("get_flip_faces"), &PrimitiveMesh::get_flip_faces); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "StandardMaterial3D,ShaderMaterial"), "set_material", "get_material"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "ShaderMaterial,StandardMaterial3D"), "set_material", "get_material"); ADD_PROPERTY(PropertyInfo(Variant::AABB, "custom_aabb", PROPERTY_HINT_NONE, ""), "set_custom_aabb", "get_custom_aabb"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "flip_faces"), "set_flip_faces", "get_flip_faces"); } diff --git a/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp index d0b91df470..32321164a1 100644 --- a/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp +++ b/servers/rendering/rasterizer_rd/shader_compiler_rd.cpp @@ -479,7 +479,7 @@ static String _get_global_variable_from_type_and_index(const String &p_buffer, c } } -String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning) { +String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning, bool p_use_scope) { String code; switch (p_node->type) { @@ -967,7 +967,7 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge if (anode->call_expression != nullptr) { code += "."; - code += _dump_node_code(anode->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning); + code += _dump_node_code(anode->call_expression, p_level, r_gen_code, p_actions, p_default_actions, p_assigning, false); } if (anode->index_expression != nullptr) { @@ -1113,7 +1113,13 @@ String ShaderCompilerRD::_dump_node_code(const SL::Node *p_node, int p_level, Ge } break; default: { - code = "(" + _dump_node_code(onode->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning) + _opstr(onode->op) + _dump_node_code(onode->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning) + ")"; + if (p_use_scope) { + code += "("; + } + code += _dump_node_code(onode->arguments[0], p_level, r_gen_code, p_actions, p_default_actions, p_assigning) + _opstr(onode->op) + _dump_node_code(onode->arguments[1], p_level, r_gen_code, p_actions, p_default_actions, p_assigning); + if (p_use_scope) { + code += ")"; + } break; } } diff --git a/servers/rendering/rasterizer_rd/shader_compiler_rd.h b/servers/rendering/rasterizer_rd/shader_compiler_rd.h index eaad34b8cd..ce94fb743f 100644 --- a/servers/rendering/rasterizer_rd/shader_compiler_rd.h +++ b/servers/rendering/rasterizer_rd/shader_compiler_rd.h @@ -96,7 +96,7 @@ private: String _get_sampler_name(ShaderLanguage::TextureFilter p_filter, ShaderLanguage::TextureRepeat p_repeat); void _dump_function_deps(const ShaderLanguage::ShaderNode *p_node, const StringName &p_for_func, const Map<StringName, String> &p_func_code, String &r_to_add, Set<StringName> &added); - String _dump_node_code(const ShaderLanguage::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning); + String _dump_node_code(const ShaderLanguage::Node *p_node, int p_level, GeneratedCode &r_gen_code, IdentifierActions &p_actions, const DefaultIdentifierActions &p_default_actions, bool p_assigning, bool p_scope = true); const ShaderLanguage::ShaderNode *shader; const ShaderLanguage::FunctionNode *function; |