diff options
46 files changed, 277 insertions, 102 deletions
@@ -70,6 +70,8 @@ J08nY <johny@neuromancer.sk> <jancar.jj@gmail.com> J08nY <johny@neuromancer.sk> <J08nY@users.noreply.github.com> Jake Young <young9003@gmail.com> Jakub Grzesik <kubecz3k@gmail.com> +Jakub Marcowski <chubercikbattle@gmail.com> <01158831@pw.edu.pl> +Jakub Marcowski <chubercikbattle@gmail.com> <37378746+Chubercik@users.noreply.github.com> janglee <merupatel123@gmail.com> Jason Knight <00jknight@gmail.com> <jason@winterpixel.com> Jean-Michel Bernard <jmb462@gmail.com> diff --git a/AUTHORS.md b/AUTHORS.md index 768eb4f904..f2fc58c1be 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -34,8 +34,10 @@ name is available. Alex Drozd (brno32) Alexey Khoroshavin (allkhor) Alfred Reinold Baudisch (alfredbaudisch) + Alistair Leslie-Hughes (alesliehughes) Alket Rexhepi (alketii) Andrea Catania (AndreaCatania) + Andreia Gaita (shana) Andrii Doroshenko (Xrayez) Andy Maloney (asmaloney) Andy Moss (MillionOstrich) @@ -132,6 +134,7 @@ name is available. J08nY Jake Young (Duroxxigar) Jakub Grzesik (kubecz3k) + Jakub Marcowski (Chubercik) James Buck (jbuck3) Jan Haller (Bromeon) Jason Knight (jasonwinterpixel) @@ -287,7 +290,9 @@ name is available. Will Nations (willnationsdev) Wilson E. Alvarez (Rubonnek) Xavier Cho (mysticfall) + Yaohua Xiong (xiongyaohua) yg2f (SuperUserNameMan) + Yordan Dolchinkov (Jordyfel) Yuri Rubinsky (Chaosus) Yuri Sizov (YuriSizov) Zae Chao (zaevi) @@ -12,40 +12,40 @@ generous deed immortalized in the next stable release of Godot Engine. ## Patrons - OSS Capital <https://oss.capital> - Re-Logic <https://re-logic.com> + OSS Capital <https://oss.capital/> + Re-Logic <https://re-logic.com/> ## Platinum sponsors - Google Play <https://play.google.com> - Heroic Labs <https://heroiclabs.com> - Ramatak <https://ramatak.com> + Google Play <https://play.google.com/> + Heroic Labs <https://heroiclabs.com/> + Ramatak <https://ramatak.com/> V-Sekai <https://github.com/V-Sekai> - W4 Games <https://w4games.com> + W4 Games <https://w4games.com/> ## Gold sponsors - Mega Crit <https://www.megacrit.com> - Prehensile Tales <https://prehensile-tales.com> - Robot Gentleman <http://robotgentleman.com> + Mega Crit <https://www.megacrit.com/> + Pirate Software <https://gopiratesoftware.com/> + Prehensile Tales <https://prehensile-tales.com/> + Robot Gentleman <http://robotgentleman.com/> ## Silver sponsors - Affray Interactive <https://scp.games/pandemic> - Broken Rules <https://brokenrul.es> - Chasing Carrots <https://www.chasing-carrots.com> - Delton Ding - Gamblify <https://www.gamblify.com> - Indoor Astronaut <https://indoorastronaut.ch> - Null <https://null.com> - Orbital Knight <https://www.orbitalknight.com> - Playful Studios <https://playfulstudios.com> + Affray Interactive <https://scp.games/pandemic/> + Broken Rules <https://brokenrul.es/> + Chasing Carrots <https://www.chasing-carrots.com/> + Gamblify <https://www.gamblify.com/> + Indoor Astronaut <https://indoorastronaut.ch/> + Null <https://null.com/> + Orbital Knight <https://www.orbitalknight.com/> + Playful Studios <https://playfulstudios.com/> ## Diamond members Sealow - Sylv <https://rankith.itch.io/unnamed-space-idle-prototype> - And 3 anonymous donors + Sylv <https://rankith.itch.io/unnamed-space-idle-prototype/> + And 4 anonymous donors ## Titanium members @@ -55,43 +55,43 @@ generous deed immortalized in the next stable release of Godot Engine. Game Dev Artisan <https://gamedevartisan.com/> Garry Newman Isaiah Smith <https://www.isaiahsmith.dev/> - katnamag <https://katnamag.com/> Kenney <https://kenney.nl/> Life Art Studios <https://lifeartstudios.net/> Lucid Silence Games Matthew Campbell Maxim Karsten - Midjiwan AB <https://polytopia.io/> PolyMars <https://polymars.dev/> + RPG in a Box <https://www.rpginabox.com/> Razenpok <https://www.youtube.com/watch?v=-QxI-RP6-HM> Smirk Software <https://smirk.gg/> Sterling Long <https://www.sterlinglong.me/> Sunshower <https://github.com/Phanterm> TrampolineTales <https://trampolinetales.com/> - Wilfred James <https://twitter.com/0430agi> 粟二华 (Su Erhua) - And 5 anonymous donors + And 4 anonymous donors ## Platinum members - AD Ford + Andy Touch BlockImperiumGames (BIG) + Christian Baune Christoph Woinke Christopher Shifflett Darrin Massena Druvsaft Edward Flick + getIntoGameDev HP van Braam iCommitGames Jonah Stich Justin McGettigan Justo Delgado Baudí + katnamag Marek Belski Matthew Ekenstedt Memories in 8Bit Mike King Nassor Paulino da Silva - nate-wilkins Neal Gompa (Conan Kudo) Ronnie Cheng Ryan Heath @@ -103,60 +103,56 @@ generous deed immortalized in the next stable release of Godot Engine. Stephan Lanfermann TigerJ Tim Yuen - Tobias Holewa Violin Iliev Vladimír Chvátil - And 17 anonymous donors + And 16 anonymous donors ## Gold members @reilaos - albinaask alMoo Games Alva Majo Antti Vesanen Artur Ilkaev + Asher Glick Ben Burbank Ben Rog-Wilhelm Benito Benjamin Sarsgard Bernd Barsuhn - Brian Ernst + Blake Farnsworth Brian Levinsen Brut Carlo del Mundo - Chen-Pang He (jdh8) ClarkThyLord Cosmin Munteanu Coy Humphrey + David Chen Zhen + David Coles David Hubber David Snopek - Dehyvis Coronel + Delton Ding Dustuu - Ed Morley ElektroFox endaye Ends Eric Phy Faisal Al-Kubaisi (QatariGameDev) - getIntoGameDev + FeralBytes GlassBrick Grau - HTML5onMobilePLZ - Hammster + Guangzhou Lingchan Here's my 20 cents hiulit Illyan Jacob (HACKhalo2 Studios) Jam - James Green Jason Cawood Javier Roman Joel Martinez John Gabriel Jon Woodward José Canepa - João Pedro Braz KAR Games Karasu Studio korinVR @@ -166,20 +162,21 @@ generous deed immortalized in the next stable release of Godot Engine. Luca Vazzano LyaaaaaGames MHDante + Malcolm Nixon + Manuel Requena Mara Huldra - Mark Schramm - Martin Agnar Dahl Martin Šenkeřík - Matthew Hillier Megabit Interactive Modus Ponens nezticle + Niklas Wahrman NotNet - Officine Pixel S.n.c. + Obelisk Island Studios ohanaya3 Oleksii Nosov Pav Soor RAWRLAB Games + RadenTheFolf Rafa Laguna Request re:thinc @@ -187,19 +184,21 @@ generous deed immortalized in the next stable release of Godot Engine. Saltlight Studio Samuel Judd Silverclad Studios + Sofox Space Kraken Studios Spoony Panda - Sympa City ThatGamer ThePolyglotProgrammer + Tim Nedvyga Tom Langwaldt Trevor Slocum tukon + Vincent Foulon Weasel Games + WuotanStudios.com Zhu Li zikes - Alexander Erlemann Alex Khayrullin Algebrute Andriy @@ -222,8 +221,6 @@ generous deed immortalized in the next stable release of Godot Engine. Fransiska Harry Tumber Harvey Fong - Horváth-Lázár Péter - illuxxium James Couzens Jared White Jesús Chicharro @@ -237,11 +234,8 @@ generous deed immortalized in the next stable release of Godot Engine. kickmaniac Liam Smyth LoparPanda - Marcus Dobler Martin Gulliksson Martin Soucek - Matt Greene - Matthew Dana Michael Dürwald Michael Policastro n00sh @@ -257,7 +251,6 @@ generous deed immortalized in the next stable release of Godot Engine. Rob Rob McInroy RodZilla - Ronnie Ashlock Ruzgud Ryan Breaker "Sage Automatic Systems, LLC" @@ -269,6 +262,7 @@ generous deed immortalized in the next stable release of Godot Engine. toto bibi Valryia VoidPointer + wpbirney420 Yifan Lai zkip lan @@ -286,14 +280,12 @@ generous deed immortalized in the next stable release of Godot Engine. Aki Mimoto Alan Beauchamp Alejandro Saucedo - AleMax + Alexander Erlemann Alex Clavelle - Alex de la Mare alex raeside Andre Altmueller Andreas Østergaard Nielsen Andrew - andrew james morris Ano Nim Arch Toasty Arda Erol @@ -301,19 +293,16 @@ generous deed immortalized in the next stable release of Godot Engine. Ash K Aubrey Falconer Austin Miller - Azar Gurbanov AzulCrescent Balázs Batári Beau Seymour Benedikt Ben Visness Bill Thibault - Bjarne Voigtländer Bread Brian Ford Caleb Makela Cameron Meyer - Carlos Rios Carl van der Geest Cerno_b ChainZ @@ -366,7 +355,6 @@ generous deed immortalized in the next stable release of Godot Engine. Gary Thomas gebba Green Fox - Greg Burkland Greyson Richey Grominet Guldoman @@ -389,7 +377,6 @@ generous deed immortalized in the next stable release of Godot Engine. Jeffrey Berube Jennifer Graves Joakim Askenbäck - John Bruce Jonas Jonas Arndt Jonas Yamazaki @@ -400,12 +387,9 @@ generous deed immortalized in the next stable release of Godot Engine. Joshua Heidrich Juanfran Juan Maggi - Juan Uys - Jueast Julian le Roux Justin Spedding Kalydi Balázs - Keedong Park Keegan Scott Keith Bradner Kent Jofur @@ -417,6 +401,7 @@ generous deed immortalized in the next stable release of Godot Engine. Kyle Jacobs Leland Vakarian Levi Berciu + liberodark Linus Lind Lundgren Ludovic DELVAL Luigi Renna @@ -430,7 +415,6 @@ generous deed immortalized in the next stable release of Godot Engine. Markie Music Mark Tyler Markus Michael Egger - Markus Strompen Martin Holas Martin Liška Martin Trbola @@ -464,7 +448,6 @@ generous deed immortalized in the next stable release of Godot Engine. Nicolas Rosset Nik Rudenko Noel Billig - Olexa Tourko Oscar Domingo ozrk Parth Patel @@ -482,7 +465,6 @@ generous deed immortalized in the next stable release of Godot Engine. Point08 Portponky PsycHead - Puntigames Quincy Quincy Quinn Morrison Raghava Kovvali @@ -493,12 +475,12 @@ generous deed immortalized in the next stable release of Godot Engine. Richard Hayes Riley RobotCritter - Rob Ruana Roka Roland Rząsa Russ Ryan Groom Sammy Fischer + Satnam Singh Sebastian Michailidis SeongWan Kim Sessamekesh @@ -515,11 +497,10 @@ generous deed immortalized in the next stable release of Godot Engine. smbe19 smo1704 SpicyCactuar - Squidgy + SquidgySapphic Squirrel Stephen Rice Stephen Schlie - Sung soo Choi Sven Walter SxP tadashi endo @@ -536,23 +517,20 @@ generous deed immortalized in the next stable release of Godot Engine. Tim Riley Tom Webster Trent Skinner - Turgut Temucin Tyler Stafos Tyler Stepke - Ukko K. Uther Vaughan Ling vgmoose - Vulinux + vlnx Wapiti . Wiley Thompson Xatonym - Yan Shi Zekim ケルベロス 貴宏 小松 - And 196 anonymous donors + And 208 anonymous donors ## Silver and bronze donors diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index 75eea2ef50..104b17961d 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -1528,6 +1528,7 @@ ProjectSettings::ProjectSettings() { GLOBAL_DEF_RST("internationalization/rendering/force_right_to_left_layout_direction", false); GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "internationalization/rendering/root_node_layout_direction", PROPERTY_HINT_ENUM, "Based on Application Locale,Left-to-Right,Right-to-Left,Based on System Locale"), 0); + GLOBAL_DEF_BASIC("internationalization/rendering/root_node_auto_translate", true); GLOBAL_DEF(PropertyInfo(Variant::INT, "gui/timers/incremental_search_max_interval_msec", PROPERTY_HINT_RANGE, "0,10000,1,or_greater"), 2000); diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 8c85030783..03c31bee28 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -338,6 +338,10 @@ bool OS::is_process_running(int p_pid) const { return ::OS::get_singleton()->is_process_running(p_pid); } +int OS::get_process_exit_code(int p_pid) const { + return ::OS::get_singleton()->get_process_exit_code(p_pid); +} + int OS::get_process_id() const { return ::OS::get_singleton()->get_process_id(); } @@ -602,6 +606,7 @@ void OS::_bind_methods() { ClassDB::bind_method(D_METHOD("shell_open", "uri"), &OS::shell_open); ClassDB::bind_method(D_METHOD("shell_show_in_file_manager", "file_or_dir_path", "open_folder"), &OS::shell_show_in_file_manager, DEFVAL(true)); ClassDB::bind_method(D_METHOD("is_process_running", "pid"), &OS::is_process_running); + ClassDB::bind_method(D_METHOD("get_process_exit_code", "pid"), &OS::get_process_exit_code); ClassDB::bind_method(D_METHOD("get_process_id"), &OS::get_process_id); ClassDB::bind_method(D_METHOD("has_environment", "variable"), &OS::has_environment); diff --git a/core/core_bind.h b/core/core_bind.h index d46321cf5c..3c0cdc25ce 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -164,6 +164,7 @@ public: Error shell_show_in_file_manager(const String &p_path, bool p_open_folder = true); bool is_process_running(int p_pid) const; + int get_process_exit_code(int p_pid) const; int get_process_id() const; void set_restart_on_exit(bool p_restart, const Vector<String> &p_restart_arguments = Vector<String>()); diff --git a/core/io/stream_peer_tcp.cpp b/core/io/stream_peer_tcp.cpp index 2b9487b9e1..90a8f49a75 100644 --- a/core/io/stream_peer_tcp.cpp +++ b/core/io/stream_peer_tcp.cpp @@ -51,6 +51,7 @@ Error StreamPeerTCP::poll() { status = STATUS_ERROR; return err; } + return OK; } else if (status != STATUS_CONNECTING) { return OK; } diff --git a/core/os/os.h b/core/os/os.h index 3827bb273a..06be0e2b41 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -176,6 +176,7 @@ public: virtual Error kill(const ProcessID &p_pid) = 0; virtual int get_process_id() const; virtual bool is_process_running(const ProcessID &p_pid) const = 0; + virtual int get_process_exit_code(const ProcessID &p_pid) const = 0; virtual void vibrate_handheld(int p_duration_ms = 500) {} virtual Error shell_open(const String &p_uri); diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 7dcee57981..20ee65403c 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -656,6 +656,9 @@ <member name="interface/editor/font_subpixel_positioning" type="int" setter="" getter=""> The subpixel positioning mode to use when rendering editor font glyphs. This affects both the main and code fonts. [b]Disabled[/b] is the fastest to render and uses the least memory. [b]Auto[/b] only uses subpixel positioning for small font sizes (where the benefit is the most noticeable). [b]One Half of a Pixel[/b] and [b]One Quarter of a Pixel[/b] force the same subpixel positioning mode for all editor fonts, regardless of their size (with [b]One Quarter of a Pixel[/b] being the highest-quality option). </member> + <member name="interface/editor/import_resources_when_unfocused" type="bool" setter="" getter=""> + If [code]true[/code], (re)imports resources even if the editor window is unfocused or minimized. If [code]false[/code], resources are only (re)imported when the editor window is focused. This can be set to [code]true[/code] to speed up iteration by starting the import process earlier when saving files in the project folder. This also allows getting visual feedback on changes without having to click the editor window, which is useful with multi-monitor setups. The downside of setting this to [code]true[/code] is that it increases idle CPU usage and may steal CPU time from other applications when importing resources. + </member> <member name="interface/editor/localize_settings" type="bool" setter="" getter=""> If [code]true[/code], setting names in the editor are localized when possible. [b]Note:[/b] This setting affects most [EditorInspector]s in the editor UI, primarily Project Settings and Editor Settings. To control names displayed in the Inspector dock, use [member interface/inspector/default_property_name_style] instead. diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index aea4082dbe..37e64da8c8 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -970,8 +970,8 @@ </methods> <members> <member name="auto_translate_mode" type="int" setter="set_auto_translate_mode" getter="get_auto_translate_mode" enum="Node.AutoTranslateMode" default="0"> - Defines if any text should automatically change to its translated version depending on the current locale (for nodes such as [Label], [RichTextLabel], [Window], etc.). See [enum AutoTranslateMode]. - Also decides if the node's strings should be parsed for POT generation. + Defines if any text should automatically change to its translated version depending on the current locale (for nodes such as [Label], [RichTextLabel], [Window], etc.). Also decides if the node's strings should be parsed for POT generation. + [b]Note:[/b] For the root node, auto translate mode can also be set via [member ProjectSettings.internationalization/rendering/root_node_auto_translate]. </member> <member name="editor_description" type="String" setter="set_editor_description" getter="get_editor_description" default=""""> An optional description to the node. It will be displayed as a tooltip when hovering over the node in the editor's Scene dock. diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index de39901133..a130b06dba 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -408,11 +408,20 @@ [b]Note:[/b] On Web platforms, it is still possible to determine the host platform's OS with feature tags. See [method has_feature]. </description> </method> + <method name="get_process_exit_code" qualifiers="const"> + <return type="int" /> + <param index="0" name="pid" type="int" /> + <description> + Returns the exit code of a spawned process once it has finished running (see [method is_process_running]). + Returns [code]-1[/code] if the [param pid] is not a PID of a spawned child process, the process is still running, or the method is not implemented for the current platform. + [b]Note:[/b] This method is implemented on Android, Linux, macOS and Windows. + </description> + </method> <method name="get_process_id" qualifiers="const"> <return type="int" /> <description> Returns the number used by the host machine to uniquely identify this application. - [b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS, and Windows. </description> </method> <method name="get_processor_count" qualifiers="const"> @@ -592,7 +601,7 @@ <param index="0" name="pid" type="int" /> <description> Returns [code]true[/code] if the child process ID ([param pid]) is still running or [code]false[/code] if it has terminated. [param pid] must be a valid ID generated from [method create_process]. - [b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS and Windows. + [b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS, and Windows. </description> </method> <method name="is_restart_on_exit_set" qualifiers="const"> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index a5aeee5bc4..015d16291b 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -637,6 +637,9 @@ <member name="debug/shader_language/warnings/formatting_error" type="bool" setter="" getter="" default="true"> When set to [code]true[/code], produces a warning upon encountering certain formatting errors. Currently this only checks for empty statements. More formatting errors may be added over time. </member> + <member name="debug/shader_language/warnings/magic_position_write" type="bool" setter="" getter="" default="true"> + When set to [code]true[/code], produces a warning when the shader contains [code]POSITION = vec4(vertex,[/code] as this was very common code written in Godot 4.2 and earlier that was paired with a QuadMesh to produce a full screen post processes pass. With the switch to reversed z in 4.3, this trick no longer works, as it implicitly relied on the [code]VERTEX.z[/code] being 0. + </member> <member name="debug/shader_language/warnings/treat_warnings_as_errors" type="bool" setter="" getter="" default="false"> When set to [code]true[/code], warnings are treated as errors. </member> @@ -1436,6 +1439,10 @@ <member name="internationalization/rendering/force_right_to_left_layout_direction" type="bool" setter="" getter="" default="false"> Force layout direction and text writing direction to RTL for all controls. </member> + <member name="internationalization/rendering/root_node_auto_translate" type="bool" setter="" getter="" default="true"> + If [code]true[/code], root node will use [constant Node.AUTO_TRANSLATE_MODE_ALWAYS], otherwise [constant Node.AUTO_TRANSLATE_MODE_DISABLED] will be used. + [b]Note:[/b] This property is only read when the project starts. To change the auto translate mode at runtime, set [member Node.auto_translate_mode] of [member SceneTree.root] instead. + </member> <member name="internationalization/rendering/root_node_layout_direction" type="int" setter="" getter="" default="0"> Root node default layout direction. </member> diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index ffeb5ad752..1a8cd53486 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -168,11 +168,13 @@ void OS_Unix::initialize_core() { NetSocketPosix::make_default(); IPUnix::make_default(); + process_map = memnew((HashMap<ProcessID, ProcessInfo>)); _setup_clock(); } void OS_Unix::finalize_core() { + memdelete(process_map); NetSocketPosix::cleanup(); } @@ -582,6 +584,11 @@ Dictionary OS_Unix::execute_with_pipe(const String &p_path, const List<String> & err_pipe.instantiate(); err_pipe->open_existing(pipe_err[0], 0); + ProcessInfo pi; + process_map_mutex.lock(); + process_map->insert(pid, pi); + process_map_mutex.unlock(); + ret["stdio"] = main_pipe; ret["stderr"] = err_pipe; ret["pid"] = pid; @@ -698,6 +705,11 @@ Error OS_Unix::create_process(const String &p_path, const List<String> &p_argume raise(SIGKILL); } + ProcessInfo pi; + process_map_mutex.lock(); + process_map->insert(pid, pi); + process_map_mutex.unlock(); + if (r_child_id) { *r_child_id = pid; } @@ -720,14 +732,45 @@ int OS_Unix::get_process_id() const { } bool OS_Unix::is_process_running(const ProcessID &p_pid) const { + MutexLock lock(process_map_mutex); + const ProcessInfo *pi = process_map->getptr(p_pid); + + if (pi && !pi->is_running) { + return false; + } + int status = 0; if (waitpid(p_pid, &status, WNOHANG) != 0) { + if (pi) { + pi->is_running = false; + pi->exit_code = status; + } return false; } return true; } +int OS_Unix::get_process_exit_code(const ProcessID &p_pid) const { + MutexLock lock(process_map_mutex); + const ProcessInfo *pi = process_map->getptr(p_pid); + + if (pi && !pi->is_running) { + return pi->exit_code; + } + + int status = 0; + if (waitpid(p_pid, &status, WNOHANG) != 0) { + status = WIFEXITED(status) ? WEXITSTATUS(status) : status; + if (pi) { + pi->is_running = false; + pi->exit_code = status; + } + return status; + } + return -1; +} + String OS_Unix::get_locale() const { if (!has_environment("LANG")) { return "en"; diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 2936c28797..a107e7a0e3 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -37,6 +37,13 @@ #include "drivers/unix/ip_unix.h" class OS_Unix : public OS { + struct ProcessInfo { + mutable bool is_running = true; + mutable int exit_code = -1; + }; + HashMap<ProcessID, ProcessInfo> *process_map = nullptr; + Mutex process_map_mutex; + protected: // UNIX only handles the core functions. // inheriting platforms under unix (eg. X11) should handle the rest @@ -81,6 +88,7 @@ public: virtual Error kill(const ProcessID &p_pid) override; virtual int get_process_id() const override; virtual bool is_process_running(const ProcessID &p_pid) const override; + virtual int get_process_exit_code(const ProcessID &p_pid) const override; virtual bool has_environment(const String &p_var) const override; virtual String get_environment(const String &p_var) const override; diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 353b9f5699..e5ef888370 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -771,6 +771,12 @@ void EditorNode::_notification(int p_what) { EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EDITOR_GET("filesystem/file_dialog/display_mode").operator int()); } + if (EDITOR_GET("interface/editor/import_resources_when_unfocused")) { + scan_changes_timer->start(); + } else { + scan_changes_timer->stop(); + } + follow_system_theme = EDITOR_GET("interface/theme/follow_system_theme"); use_system_accent_color = EDITOR_GET("interface/theme/use_system_accent_color"); @@ -6577,6 +6583,12 @@ EditorNode::EditorNode() { editor_layout_save_delay_timer->set_one_shot(true); editor_layout_save_delay_timer->connect("timeout", callable_mp(this, &EditorNode::_save_editor_layout)); + scan_changes_timer = memnew(Timer); + scan_changes_timer->set_wait_time(0.5); + scan_changes_timer->set_autostart(EDITOR_GET("interface/editor/import_resources_when_unfocused")); + scan_changes_timer->connect("timeout", callable_mp(EditorFileSystem::get_singleton(), &EditorFileSystem::scan_changes)); + add_child(scan_changes_timer); + top_split = memnew(VSplitContainer); center_split->add_child(top_split); top_split->set_v_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/editor/editor_node.h b/editor/editor_node.h index 3bda1d4507..ad0a7ec5e0 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -420,6 +420,7 @@ private: EditorDockManager *editor_dock_manager = nullptr; Timer *editor_layout_save_delay_timer = nullptr; + Timer *scan_changes_timer = nullptr; Button *distraction_free = nullptr; EditorBottomPanel *bottom_panel = nullptr; diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 30587b257c..452715a577 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -445,7 +445,6 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm") EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font_bold", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm") EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/code_font", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm") - _initial_set("interface/editor/separate_distraction_mode", false); _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) @@ -471,6 +470,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { // being focused again, so this should be used at the user's discretion. EDITOR_SETTING_USAGE(Variant::INT, PROPERTY_HINT_RANGE, "interface/editor/unfocused_low_processor_mode_sleep_usec", 100000, "1,1000000,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED) + EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/editor/import_resources_when_unfocused", false, "") + EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/vsync_mode", 1, "Disabled,Enabled,Adaptive,Mailbox") EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/editor/update_continuously", false, "") diff --git a/editor/import/3d/resource_importer_scene.cpp b/editor/import/3d/resource_importer_scene.cpp index f7e8657525..dce68a97ac 100644 --- a/editor/import/3d/resource_importer_scene.cpp +++ b/editor/import/3d/resource_importer_scene.cpp @@ -1993,7 +1993,6 @@ void ResourceImporterScene::get_internal_import_options(InternalImportCategory p case INTERNAL_IMPORT_CATEGORY_MESH: { r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "save_to_file/enabled", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false)); r_options->push_back(ImportOption(PropertyInfo(Variant::STRING, "save_to_file/path", PROPERTY_HINT_SAVE_FILE, "*.res,*.tres"), "")); - r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "save_to_file/make_streamable"), "")); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "generate/shadow_meshes", PROPERTY_HINT_ENUM, "Default,Enable,Disable"), 0)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "generate/lightmap_uv", PROPERTY_HINT_ENUM, "Default,Enable,Disable"), 0)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "generate/lods", PROPERTY_HINT_ENUM, "Default,Enable,Disable"), 0)); @@ -2147,7 +2146,7 @@ bool ResourceImporterScene::get_internal_option_visibility(InternalImportCategor } } break; case INTERNAL_IMPORT_CATEGORY_MESH: { - if (p_option == "save_to_file/path" || p_option == "save_to_file/make_streamable") { + if (p_option == "save_to_file/path") { return p_options["save_to_file/enabled"]; } } break; diff --git a/modules/navigation/2d/nav_mesh_generator_2d.cpp b/modules/navigation/2d/nav_mesh_generator_2d.cpp index d8f1170f6a..9000259524 100644 --- a/modules/navigation/2d/nav_mesh_generator_2d.cpp +++ b/modules/navigation/2d/nav_mesh_generator_2d.cpp @@ -43,9 +43,9 @@ #include "scene/resources/2d/circle_shape_2d.h" #include "scene/resources/2d/concave_polygon_shape_2d.h" #include "scene/resources/2d/convex_polygon_shape_2d.h" +#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h" +#include "scene/resources/2d/navigation_polygon.h" #include "scene/resources/2d/rectangle_shape_2d.h" -#include "scene/resources/navigation_mesh_source_geometry_data_2d.h" -#include "scene/resources/navigation_polygon.h" #include "thirdparty/clipper2/include/clipper2/clipper.h" #include "thirdparty/misc/polypartition.h" diff --git a/modules/navigation/3d/nav_mesh_generator_3d.cpp b/modules/navigation/3d/nav_mesh_generator_3d.cpp index 3d3f4b4679..b1b3cbed5d 100644 --- a/modules/navigation/3d/nav_mesh_generator_3d.cpp +++ b/modules/navigation/3d/nav_mesh_generator_3d.cpp @@ -45,12 +45,12 @@ #include "scene/resources/3d/convex_polygon_shape_3d.h" #include "scene/resources/3d/cylinder_shape_3d.h" #include "scene/resources/3d/height_map_shape_3d.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "scene/resources/3d/primitive_meshes.h" #include "scene/resources/3d/shape_3d.h" #include "scene/resources/3d/sphere_shape_3d.h" #include "scene/resources/3d/world_boundary_shape_3d.h" #include "scene/resources/navigation_mesh.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" #include "modules/modules_enabled.gen.h" // For csg, gridmap. diff --git a/modules/navigation/3d/navigation_mesh_generator.cpp b/modules/navigation/3d/navigation_mesh_generator.cpp index 8393896db1..54df42e266 100644 --- a/modules/navigation/3d/navigation_mesh_generator.cpp +++ b/modules/navigation/3d/navigation_mesh_generator.cpp @@ -32,7 +32,7 @@ #include "navigation_mesh_generator.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "servers/navigation_server_3d.h" NavigationMeshGenerator *NavigationMeshGenerator::singleton = nullptr; diff --git a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp index 352203f5aa..d7bf1cdd38 100644 --- a/modules/navigation/editor/navigation_mesh_editor_plugin.cpp +++ b/modules/navigation/editor/navigation_mesh_editor_plugin.cpp @@ -42,7 +42,6 @@ #include "scene/gui/button.h" #include "scene/gui/dialogs.h" #include "scene/gui/label.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" void NavigationMeshEditor::_node_removed(Node *p_node) { if (p_node == node) { diff --git a/platform/web/os_web.cpp b/platform/web/os_web.cpp index 8fc89a79d9..4158295520 100644 --- a/platform/web/os_web.cpp +++ b/platform/web/os_web.cpp @@ -132,6 +132,10 @@ bool OS_Web::is_process_running(const ProcessID &p_pid) const { return false; } +int OS_Web::get_process_exit_code(const ProcessID &p_pid) const { + return -1; +} + int OS_Web::get_processor_count() const { return godot_js_os_hw_concurrency_get(); } diff --git a/platform/web/os_web.h b/platform/web/os_web.h index 537b05048a..eeeafdac34 100644 --- a/platform/web/os_web.h +++ b/platform/web/os_web.h @@ -85,6 +85,7 @@ public: Error kill(const ProcessID &p_pid) override; int get_process_id() const override; bool is_process_running(const ProcessID &p_pid) const override; + int get_process_exit_code(const ProcessID &p_pid) const override; int get_processor_count() const override; String get_unique_id() const override; int get_default_thread_pool_size() const override { return 1; } diff --git a/platform/web/serve.py b/platform/web/serve.py index 6a3efcc463..89dff63ca3 100755 --- a/platform/web/serve.py +++ b/platform/web/serve.py @@ -5,9 +5,20 @@ from pathlib import Path import os import sys import argparse +import contextlib +import socket import subprocess +# See cpython GH-17851 and GH-17864. +class DualStackServer(HTTPServer): + def server_bind(self): + # Suppress exception when protocol is IPv4. + with contextlib.suppress(Exception): + self.socket.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0) + return super().server_bind() + + class CORSRequestHandler(SimpleHTTPRequestHandler): def end_headers(self): self.send_header("Cross-Origin-Opener-Policy", "same-origin") @@ -32,7 +43,7 @@ def serve(root, port, run_browser): print("Opening the served URL in the default browser (use `--no-browser` or `-n` to disable this).") shell_open(f"http://127.0.0.1:{port}") - test(CORSRequestHandler, HTTPServer, port=port) + test(CORSRequestHandler, DualStackServer, port=port) if __name__ == "__main__": diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index e0e35c6e0f..f2a9989606 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -867,7 +867,9 @@ Dictionary OS_Windows::execute_with_pipe(const String &p_path, const List<String CloseHandle(pipe_err[1]); ProcessID pid = pi.pi.dwProcessId; + process_map_mutex.lock(); process_map->insert(pid, pi); + process_map_mutex.unlock(); Ref<FileAccessWindowsPipe> main_pipe; main_pipe.instantiate(); @@ -1014,13 +1016,16 @@ Error OS_Windows::create_process(const String &p_path, const List<String> &p_arg if (r_child_id) { *r_child_id = pid; } + process_map_mutex.lock(); process_map->insert(pid, pi); + process_map_mutex.unlock(); return OK; } Error OS_Windows::kill(const ProcessID &p_pid) { int ret = 0; + MutexLock lock(process_map_mutex); if (process_map->has(p_pid)) { const PROCESS_INFORMATION pi = (*process_map)[p_pid].pi; process_map->erase(p_pid); @@ -1046,24 +1051,58 @@ int OS_Windows::get_process_id() const { } bool OS_Windows::is_process_running(const ProcessID &p_pid) const { + MutexLock lock(process_map_mutex); if (!process_map->has(p_pid)) { return false; } - const PROCESS_INFORMATION &pi = (*process_map)[p_pid].pi; + const ProcessInfo &info = (*process_map)[p_pid]; + if (!info.is_running) { + return false; + } + const PROCESS_INFORMATION &pi = info.pi; DWORD dw_exit_code = 0; if (!GetExitCodeProcess(pi.hProcess, &dw_exit_code)) { return false; } if (dw_exit_code != STILL_ACTIVE) { + info.is_running = false; + info.exit_code = dw_exit_code; return false; } return true; } +int OS_Windows::get_process_exit_code(const ProcessID &p_pid) const { + MutexLock lock(process_map_mutex); + if (!process_map->has(p_pid)) { + return -1; + } + + const ProcessInfo &info = (*process_map)[p_pid]; + if (!info.is_running) { + return info.exit_code; + } + + const PROCESS_INFORMATION &pi = info.pi; + + DWORD dw_exit_code = 0; + if (!GetExitCodeProcess(pi.hProcess, &dw_exit_code)) { + return -1; + } + + if (dw_exit_code == STILL_ACTIVE) { + return -1; + } + + info.is_running = false; + info.exit_code = dw_exit_code; + return dw_exit_code; +} + Error OS_Windows::set_cwd(const String &p_cwd) { if (_wchdir((LPCWSTR)(p_cwd.utf16().get_data())) != 0) { return ERR_CANT_OPEN; diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index c506af13b2..288154745f 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -150,8 +150,11 @@ protected: struct ProcessInfo { STARTUPINFO si; PROCESS_INFORMATION pi; + mutable bool is_running = true; + mutable int exit_code = -1; }; HashMap<ProcessID, ProcessInfo> *process_map = nullptr; + Mutex process_map_mutex; public: virtual void alert(const String &p_alert, const String &p_title = "ALERT!") override; @@ -189,6 +192,7 @@ public: virtual Error kill(const ProcessID &p_pid) override; virtual int get_process_id() const override; virtual bool is_process_running(const ProcessID &p_pid) const override; + virtual int get_process_exit_code(const ProcessID &p_pid) const override; virtual bool has_environment(const String &p_var) const override; virtual String get_environment(const String &p_var) const override; diff --git a/scene/2d/navigation_region_2d.h b/scene/2d/navigation_region_2d.h index 87c2365b15..1482617a64 100644 --- a/scene/2d/navigation_region_2d.h +++ b/scene/2d/navigation_region_2d.h @@ -31,7 +31,7 @@ #ifndef NAVIGATION_REGION_2D_H #define NAVIGATION_REGION_2D_H -#include "scene/resources/navigation_polygon.h" +#include "scene/resources/2d/navigation_polygon.h" class NavigationRegion2D : public Node2D { GDCLASS(NavigationRegion2D, Node2D); diff --git a/scene/3d/navigation_region_3d.cpp b/scene/3d/navigation_region_3d.cpp index d8a63c60a2..856c52b5d5 100644 --- a/scene/3d/navigation_region_3d.cpp +++ b/scene/3d/navigation_region_3d.cpp @@ -30,7 +30,7 @@ #include "navigation_region_3d.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "servers/navigation_server_3d.h" RID NavigationRegion3D::get_rid() const { diff --git a/scene/animation/animation_mixer.cpp b/scene/animation/animation_mixer.cpp index 01e1de8f23..5a3a5f9bc0 100644 --- a/scene/animation/animation_mixer.cpp +++ b/scene/animation/animation_mixer.cpp @@ -698,9 +698,15 @@ bool AnimationMixer::_update_caches() { if (has_reset_anim) { int rt = reset_anim->find_track(path, track_src_type); if (rt >= 0) { - track_value->init_use_continuous = track_value->init_use_continuous || (reset_anim->value_track_get_update_mode(rt) != Animation::UPDATE_DISCRETE); // Take precedence Force Continuous. - if (reset_anim->track_get_key_count(rt) > 0) { - track_value->init_value = track_src_type == Animation::TYPE_VALUE ? reset_anim->track_get_key_value(rt, 0) : (reset_anim->track_get_key_value(rt, 0).operator Array())[0]; + if (track_src_type == Animation::TYPE_VALUE) { + track_value->init_use_continuous = track_value->init_use_continuous || (reset_anim->value_track_get_update_mode(rt) != Animation::UPDATE_DISCRETE); // Take precedence Force Continuous. + if (reset_anim->track_get_key_count(rt) > 0) { + track_value->init_value = reset_anim->track_get_key_value(rt, 0); + } + } else { + if (reset_anim->track_get_key_count(rt) > 0) { + track_value->init_value = (reset_anim->track_get_key_value(rt, 0).operator Array())[0]; + } } } } @@ -875,7 +881,7 @@ bool AnimationMixer::_update_caches() { if (track_value->init_value.is_string() && anim->value_track_get_update_mode(i) != Animation::UPDATE_DISCRETE) { WARN_PRINT_ONCE_ED(mixer_name + ": '" + String(E) + "', Value Track: '" + String(path) + "' blends String types. This is an experimental algorithm."); } - track_value->is_using_angle |= anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_LINEAR_ANGLE || anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_CUBIC_ANGLE; + track_value->is_using_angle = track_value->is_using_angle || anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_LINEAR_ANGLE || anim->track_get_interpolation_type(i) == Animation::INTERPOLATION_CUBIC_ANGLE; } if (check_angle_interpolation && (was_using_angle != track_value->is_using_angle)) { WARN_PRINT_ED(mixer_name + ": '" + String(E) + "', Value Track: '" + String(path) + "' has different interpolation types for rotation between some animations which may be blended together. Blending prioritizes angle interpolation, so the blending result uses the shortest path referenced to the initial (RESET animation) value."); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 04dd38fb5d..c465a3385f 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -1752,7 +1752,7 @@ SceneTree::SceneTree() { root = memnew(Window); root->set_min_size(Size2i(64, 64)); // Define a very small minimum window size to prevent bugs such as GH-37242. root->set_process_mode(Node::PROCESS_MODE_PAUSABLE); - root->set_auto_translate_mode(Node::AUTO_TRANSLATE_MODE_ALWAYS); + root->set_auto_translate_mode(GLOBAL_GET("internationalization/rendering/root_node_auto_translate") ? Node::AUTO_TRANSLATE_MODE_ALWAYS : Node::AUTO_TRANSLATE_MODE_DISABLED); root->set_name("root"); root->set_title(GLOBAL_GET("application/config/name")); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 0e3f309ca2..1c8833494d 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -128,9 +128,6 @@ #include "scene/resources/mesh_texture.h" #include "scene/resources/multimesh.h" #include "scene/resources/navigation_mesh.h" -#include "scene/resources/navigation_mesh_source_geometry_data_2d.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" -#include "scene/resources/navigation_polygon.h" #include "scene/resources/packed_scene.h" #include "scene/resources/particle_process_material.h" #include "scene/resources/physics_material.h" @@ -213,6 +210,8 @@ #include "scene/resources/2d/circle_shape_2d.h" #include "scene/resources/2d/concave_polygon_shape_2d.h" #include "scene/resources/2d/convex_polygon_shape_2d.h" +#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h" +#include "scene/resources/2d/navigation_polygon.h" #include "scene/resources/2d/polygon_path_finder.h" #include "scene/resources/2d/rectangle_shape_2d.h" #include "scene/resources/2d/segment_shape_2d.h" @@ -299,6 +298,7 @@ #include "scene/resources/3d/height_map_shape_3d.h" #include "scene/resources/3d/importer_mesh.h" #include "scene/resources/3d/mesh_library.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "scene/resources/3d/primitive_meshes.h" #include "scene/resources/3d/separation_ray_shape_3d.h" #include "scene/resources/3d/sky_material.h" @@ -883,6 +883,7 @@ void register_scene_types() { BaseMaterial3D::init_shaders(); GDREGISTER_CLASS(MeshLibrary); + GDREGISTER_CLASS(NavigationMeshSourceGeometryData3D); OS::get_singleton()->yield(); // may take time to init @@ -1004,7 +1005,6 @@ void register_scene_types() { GDREGISTER_CLASS(NavigationMesh); GDREGISTER_CLASS(NavigationMeshSourceGeometryData2D); - GDREGISTER_CLASS(NavigationMeshSourceGeometryData3D); GDREGISTER_CLASS(NavigationPolygon); GDREGISTER_CLASS(NavigationRegion2D); GDREGISTER_CLASS(NavigationAgent2D); diff --git a/scene/resources/navigation_mesh_source_geometry_data_2d.cpp b/scene/resources/2d/navigation_mesh_source_geometry_data_2d.cpp index d613b498a1..d613b498a1 100644 --- a/scene/resources/navigation_mesh_source_geometry_data_2d.cpp +++ b/scene/resources/2d/navigation_mesh_source_geometry_data_2d.cpp diff --git a/scene/resources/navigation_mesh_source_geometry_data_2d.h b/scene/resources/2d/navigation_mesh_source_geometry_data_2d.h index 0e321fbeb9..11fc5d3850 100644 --- a/scene/resources/navigation_mesh_source_geometry_data_2d.h +++ b/scene/resources/2d/navigation_mesh_source_geometry_data_2d.h @@ -33,7 +33,7 @@ #include "core/os/rw_lock.h" #include "scene/2d/node_2d.h" -#include "scene/resources/navigation_polygon.h" +#include "scene/resources/2d/navigation_polygon.h" class NavigationMeshSourceGeometryData2D : public Resource { GDCLASS(NavigationMeshSourceGeometryData2D, Resource); diff --git a/scene/resources/navigation_polygon.cpp b/scene/resources/2d/navigation_polygon.cpp index 274b13a487..274b13a487 100644 --- a/scene/resources/navigation_polygon.cpp +++ b/scene/resources/2d/navigation_polygon.cpp diff --git a/scene/resources/navigation_polygon.h b/scene/resources/2d/navigation_polygon.h index b9816f900c..b9816f900c 100644 --- a/scene/resources/navigation_polygon.h +++ b/scene/resources/2d/navigation_polygon.h diff --git a/scene/resources/2d/tile_set.h b/scene/resources/2d/tile_set.h index dceda1a791..e6d3f7e15d 100644 --- a/scene/resources/2d/tile_set.h +++ b/scene/resources/2d/tile_set.h @@ -38,8 +38,8 @@ #include "scene/2d/light_occluder_2d.h" #include "scene/main/canvas_item.h" #include "scene/resources/2d/convex_polygon_shape_2d.h" +#include "scene/resources/2d/navigation_polygon.h" #include "scene/resources/image_texture.h" -#include "scene/resources/navigation_polygon.h" #include "scene/resources/packed_scene.h" #include "scene/resources/physics_material.h" diff --git a/scene/resources/navigation_mesh_source_geometry_data_3d.cpp b/scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp index 39a17946fa..39a17946fa 100644 --- a/scene/resources/navigation_mesh_source_geometry_data_3d.cpp +++ b/scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp diff --git a/scene/resources/navigation_mesh_source_geometry_data_3d.h b/scene/resources/3d/navigation_mesh_source_geometry_data_3d.h index 79e2f3740d..79e2f3740d 100644 --- a/scene/resources/navigation_mesh_source_geometry_data_3d.h +++ b/scene/resources/3d/navigation_mesh_source_geometry_data_3d.h diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h index 876b09d549..39d4c19064 100644 --- a/servers/navigation_server_2d.h +++ b/servers/navigation_server_2d.h @@ -34,8 +34,8 @@ #include "core/object/class_db.h" #include "core/templates/rid.h" -#include "scene/resources/navigation_mesh_source_geometry_data_2d.h" -#include "scene/resources/navigation_polygon.h" +#include "scene/resources/2d/navigation_mesh_source_geometry_data_2d.h" +#include "scene/resources/2d/navigation_polygon.h" #include "servers/navigation/navigation_path_query_parameters_2d.h" #include "servers/navigation/navigation_path_query_result_2d.h" diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp index 7b54a24b59..fda26aacc1 100644 --- a/servers/navigation_server_3d.cpp +++ b/servers/navigation_server_3d.cpp @@ -181,10 +181,12 @@ void NavigationServer3D::_bind_methods() { ClassDB::bind_method(D_METHOD("obstacle_set_avoidance_layers", "obstacle", "layers"), &NavigationServer3D::obstacle_set_avoidance_layers); ClassDB::bind_method(D_METHOD("obstacle_get_avoidance_layers", "obstacle"), &NavigationServer3D::obstacle_get_avoidance_layers); +#ifndef _3D_DISABLED ClassDB::bind_method(D_METHOD("parse_source_geometry_data", "navigation_mesh", "source_geometry_data", "root_node", "callback"), &NavigationServer3D::parse_source_geometry_data, DEFVAL(Callable())); ClassDB::bind_method(D_METHOD("bake_from_source_geometry_data", "navigation_mesh", "source_geometry_data", "callback"), &NavigationServer3D::bake_from_source_geometry_data, DEFVAL(Callable())); ClassDB::bind_method(D_METHOD("bake_from_source_geometry_data_async", "navigation_mesh", "source_geometry_data", "callback"), &NavigationServer3D::bake_from_source_geometry_data_async, DEFVAL(Callable())); ClassDB::bind_method(D_METHOD("is_baking_navigation_mesh", "navigation_mesh"), &NavigationServer3D::is_baking_navigation_mesh); +#endif // _3D_DISABLED ClassDB::bind_method(D_METHOD("simplify_path", "path", "epsilon"), &NavigationServer3D::simplify_path); diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h index c23da78299..5a93c662b2 100644 --- a/servers/navigation_server_3d.h +++ b/servers/navigation_server_3d.h @@ -34,8 +34,8 @@ #include "core/object/class_db.h" #include "core/templates/rid.h" +#include "scene/resources/3d/navigation_mesh_source_geometry_data_3d.h" #include "scene/resources/navigation_mesh.h" -#include "scene/resources/navigation_mesh_source_geometry_data_3d.h" #include "servers/navigation/navigation_path_query_parameters_3d.h" #include "servers/navigation/navigation_path_query_result_3d.h" @@ -344,10 +344,12 @@ public: virtual NavigationUtilities::PathQueryResult _query_path(const NavigationUtilities::PathQueryParameters &p_parameters) const = 0; +#ifndef _3D_DISABLED virtual void parse_source_geometry_data(const Ref<NavigationMesh> &p_navigation_mesh, const Ref<NavigationMeshSourceGeometryData3D> &p_source_geometry_data, Node *p_root_node, const Callable &p_callback = Callable()) = 0; virtual void bake_from_source_geometry_data(const Ref<NavigationMesh> &p_navigation_mesh, const Ref<NavigationMeshSourceGeometryData3D> &p_source_geometry_data, const Callable &p_callback = Callable()) = 0; virtual void bake_from_source_geometry_data_async(const Ref<NavigationMesh> &p_navigation_mesh, const Ref<NavigationMeshSourceGeometryData3D> &p_source_geometry_data, const Callable &p_callback = Callable()) = 0; virtual bool is_baking_navigation_mesh(Ref<NavigationMesh> p_navigation_mesh) const = 0; +#endif // _3D_DISABLED virtual Vector<Vector3> simplify_path(const Vector<Vector3> &p_path, real_t p_epsilon) = 0; diff --git a/servers/navigation_server_3d_dummy.h b/servers/navigation_server_3d_dummy.h index d98a0edb01..7079aa66be 100644 --- a/servers/navigation_server_3d_dummy.h +++ b/servers/navigation_server_3d_dummy.h @@ -175,10 +175,12 @@ public: void obstacle_set_avoidance_layers(RID p_obstacle, uint32_t p_layers) override {} uint32_t obstacle_get_avoidance_layers(RID p_obstacle) const override { return 0; } +#ifndef _3D_DISABLED void parse_source_geometry_data(const Ref<NavigationMesh> &p_navigation_mesh, const Ref<NavigationMeshSourceGeometryData3D> &p_source_geometry_data, Node *p_root_node, const Callable &p_callback = Callable()) override {} void bake_from_source_geometry_data(const Ref<NavigationMesh> &p_navigation_mesh, const Ref<NavigationMeshSourceGeometryData3D> &p_source_geometry_data, const Callable &p_callback = Callable()) override {} void bake_from_source_geometry_data_async(const Ref<NavigationMesh> &p_navigation_mesh, const Ref<NavigationMeshSourceGeometryData3D> &p_source_geometry_data, const Callable &p_callback = Callable()) override {} bool is_baking_navigation_mesh(Ref<NavigationMesh> p_navigation_mesh) const override { return false; } +#endif // _3D_DISABLED Vector<Vector3> simplify_path(const Vector<Vector3> &p_path, real_t p_epsilon) override { return Vector<Vector3>(); } diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index 8fbad346a4..99b3f54379 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -5029,6 +5029,10 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons Vector<Expression> expression; //Vector<TokenType> operators; +#ifdef DEBUG_ENABLED + bool check_position_write = check_warnings && HAS_WARNING(ShaderWarning::MAGIC_POSITION_WRITE_FLAG); + check_position_write = check_position_write && String(shader_type_identifier) == "spatial" && current_function == "vertex"; +#endif while (true) { Node *expr = nullptr; @@ -5589,6 +5593,24 @@ ShaderLanguage::Node *ShaderLanguage::_parse_expression(BlockNode *p_block, cons _set_error(vformat(RTR("Can't use function as identifier: '%s'."), String(identifier))); return nullptr; } +#ifdef DEBUG_ENABLED + if (check_position_write && ident_type == IDENTIFIER_BUILTIN_VAR) { + if (String(identifier) == "POSITION") { + // Check if the user wrote "POSITION = vec4(VERTEX," and warn if they did. + TkPos prev_pos = _get_tkpos(); + if (_get_token().type == TK_OP_ASSIGN && + _get_token().type == TK_TYPE_VEC4 && + _get_token().type == TK_PARENTHESIS_OPEN && + _get_token().text == "VERTEX" && + _get_token().type == TK_COMMA) { + _add_line_warning(ShaderWarning::MAGIC_POSITION_WRITE); + } + + // Reset the position so compiling can continue as normal. + _set_tkpos(prev_pos); + } + } +#endif if (is_const) { last_type = IDENTIFIER_CONSTANT; } else { diff --git a/servers/rendering/shader_warnings.cpp b/servers/rendering/shader_warnings.cpp index dce8f6cff1..3b99f6c2bf 100644 --- a/servers/rendering/shader_warnings.cpp +++ b/servers/rendering/shader_warnings.cpp @@ -65,6 +65,8 @@ String ShaderWarning::get_message() const { return subject; case DEVICE_LIMIT_EXCEEDED: return vformat(RTR("The total size of the %s for this shader on this device has been exceeded (%d/%d). The shader may not work correctly."), subject, (int)extra_args[0], (int)extra_args[1]); + case MAGIC_POSITION_WRITE: + return vformat(RTR("You are attempting to assign the VERTEX position in model space to the vertex POSITION in clip space. The definition of clip space changed in version 4.3, so if this code was written prior to 4.3, it will not continue to work. Consider specifying the clip space z-component directly i.e. use `vec4(VERTEX.xy, 1.0, 1.0)`.")); default: break; } @@ -92,6 +94,7 @@ String ShaderWarning::get_name_from_code(Code p_code) { "UNUSED_LOCAL_VARIABLE", "FORMATTING_ERROR", "DEVICE_LIMIT_EXCEEDED", + "MAGIC_POSITION_WRITE", }; static_assert((sizeof(names) / sizeof(*names)) == WARNING_MAX, "Amount of warning types don't match the amount of warning names."); @@ -122,6 +125,7 @@ static void init_code_to_flags_map() { code_to_flags_map->insert(ShaderWarning::UNUSED_LOCAL_VARIABLE, ShaderWarning::UNUSED_LOCAL_VARIABLE_FLAG); code_to_flags_map->insert(ShaderWarning::FORMATTING_ERROR, ShaderWarning::FORMATTING_ERROR_FLAG); code_to_flags_map->insert(ShaderWarning::DEVICE_LIMIT_EXCEEDED, ShaderWarning::DEVICE_LIMIT_EXCEEDED_FLAG); + code_to_flags_map->insert(ShaderWarning::MAGIC_POSITION_WRITE, ShaderWarning::MAGIC_POSITION_WRITE_FLAG); } ShaderWarning::CodeFlags ShaderWarning::get_flags_from_codemap(const HashMap<Code, bool> &p_map) { diff --git a/servers/rendering/shader_warnings.h b/servers/rendering/shader_warnings.h index ed28ebdd2b..69d684850f 100644 --- a/servers/rendering/shader_warnings.h +++ b/servers/rendering/shader_warnings.h @@ -51,6 +51,7 @@ public: UNUSED_LOCAL_VARIABLE, FORMATTING_ERROR, DEVICE_LIMIT_EXCEEDED, + MAGIC_POSITION_WRITE, WARNING_MAX, }; @@ -65,6 +66,7 @@ public: UNUSED_LOCAL_VARIABLE_FLAG = 64U, FORMATTING_ERROR_FLAG = 128U, DEVICE_LIMIT_EXCEEDED_FLAG = 256U, + MAGIC_POSITION_WRITE_FLAG = 512U, }; private: |