diff options
-rw-r--r-- | .mailmap | 1 | ||||
-rw-r--r-- | AUTHORS.md | 3 | ||||
-rw-r--r-- | DONORS.md | 128 | ||||
-rw-r--r-- | core/math/color.cpp | 2 | ||||
-rw-r--r-- | core/math/color.h | 13 | ||||
-rw-r--r-- | core/variant/variant.cpp | 2 | ||||
-rw-r--r-- | core/variant/variant_construct.cpp | 2 | ||||
-rw-r--r-- | doc/classes/Color.xml | 22 | ||||
-rw-r--r-- | drivers/vulkan/vulkan_context.cpp | 8 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 9 | ||||
-rw-r--r-- | editor/project_manager.cpp | 28 | ||||
-rw-r--r-- | main/main.cpp | 25 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/math_defs.h | 1 | ||||
-rw-r--r-- | modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs | 101 | ||||
-rw-r--r-- | modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml | 14 | ||||
-rw-r--r-- | modules/visual_script/visual_script_builtin_funcs.cpp | 23 | ||||
-rw-r--r-- | modules/visual_script/visual_script_builtin_funcs.h | 1 | ||||
-rw-r--r-- | platform/iphone/os_iphone.mm | 4 |
18 files changed, 241 insertions, 146 deletions
@@ -116,6 +116,7 @@ Theo Hallenius <redsymbzone@hotmail.com> Thomas Herzog <therzog@mail.de> Thomas Herzog <therzog@mail.de> <thomas.herzog@mail.com> Thomas Herzog <therzog@mail.de> <thomas.herzog@simedis.com> +Tomasz Chabora <kobewi4e@gmail.com> Twarit <wtwarit@gmail.com> V.VamsiKrishna <vk@bsb.in> <vamsikrishna.v@gmail.com> Wilhem Barbier <nounoursheureux@openmailbox.org> <wilhem.b@free.fr> diff --git a/AUTHORS.md b/AUTHORS.md index 97c66a014c..1ebef77509 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -57,7 +57,9 @@ name is available. Daniel J. Ramirez (djrm) Daniel Rakos (aqnuep) dankan1890 + Danil Alexeev (dalexeev) David Sichma (DavidSichma) + David Snopek (dsnopek) Dharkael (lupoDharkael) Dmitry Koteroff (Krakean) Dominik Jasiński (dreamsComeTrue) @@ -99,6 +101,7 @@ name is available. Jérôme Gully (Nutriz) Jia Jun Chai (SkyLucilfer) Joan Fons Sanchez (JFonS) + Johannes Witt (HaSa1002) Johan Manuel (29jm) Joshua Grams (JoshuaGrams) Juan Linietsky (reduz) @@ -48,7 +48,6 @@ generous deed immortalized in the next stable release of Godot Engine. Digital Grows Dov Zimring Edward Flick - Franz Silva Gamechuck GameDev.net Hein-Pieter van Braam @@ -81,6 +80,7 @@ generous deed immortalized in the next stable release of Godot Engine. Acheron albinaask + Alvaro A Baena R Asher Glick Bernhard Werner Carlo Cabanilla @@ -89,6 +89,7 @@ generous deed immortalized in the next stable release of Godot Engine. Daniel James David Gehrig David Snopek + Don B Ed Morley Ellen Poe Florian Neumann @@ -103,7 +104,6 @@ generous deed immortalized in the next stable release of Godot Engine. Joan Fons Johnny IV Young Jon Woodward - Kai Klyden Karl Werf Klavdij Voncina Lex Steers @@ -136,6 +136,7 @@ generous deed immortalized in the next stable release of Godot Engine. Tom Langwaldt Tricky Fat Cat tukon + Vitaliy Sapronenko William Wold xagonist Xeno Coliseum @@ -144,17 +145,24 @@ generous deed immortalized in the next stable release of Godot Engine. Aaron Winter Adam Nakonieczny Adrian Adamiak + Aleksey Korotkevich Alexander J Maynard Alex de la Mare + Alexey Dyadchenko Alex Khayrullin alice gambrell Andreas Funke André Frélicot + Andrew Cunningham + Anm + Antanas Paskauskas Antoni Batchelli Arisaka Mayuki + Arthur S. Muszynski Aubin Detrez Barugon Ben Botwin + Caleb Sizemore Can Eris Charlie Whitfield Chase Taranto @@ -166,16 +174,19 @@ generous deed immortalized in the next stable release of Godot Engine. Conrad Curry Craig Ostrin Craig Smith + Cristopher D + dan didenko Darrian Little + Dennis Belfrage Dev To be curious Digital Denizen + Dimitri Nüscheler Donn Eddy Easypete Edgar Sun Eugenio Hugo Salgüero Jáñez flesk - Francisco Arámburo F S Gabrielius Vaiškūnas Gary Hulst @@ -189,11 +200,14 @@ generous deed immortalized in the next stable release of Godot Engine. Horváth Péter Hu Hund Idilio Alfaro + Jake Burga James Couzens Jared Jared White + Jesús Chicharro Joel Fivat Joel Höglund + Johnathan Kupferer Jose Malheiro Joseph Crane Joshie Sparks @@ -208,10 +222,12 @@ generous deed immortalized in the next stable release of Godot Engine. Kelteseth kickmaniac kinfox - kuku + Kos Lachie Lain Ballard + Laszlo Kiss Leo Fidel R Liban + Liam Smyth Luc-Frédéric Langis luka duren MadScientistCarl @@ -220,17 +236,23 @@ generous deed immortalized in the next stable release of Godot Engine. Marcus Richter Marisa Clardy Mark Barrett + Mark Diaz Markus Fehr Martin Eigel Martin Kotz Martin Soucek Matt Eunson Matt Greene + Matthias Toepp + medecau Michael Michael Dürwald + Michael Noll + Michael Policastro MikadoSC MuffinManKen Nick Abousselam + Nick Barovic Oliver Dick Oscar Campos Patrick Brock @@ -245,32 +267,37 @@ generous deed immortalized in the next stable release of Godot Engine. Raymond Harris Raz A Ricardo Alcantara + Robert Larnach Robert Willes Rob McInroy Rocknight Studios Rodrigo Favarete Ronnie Ashlock Ronny Mühle - Ryan Wilson + Ryan Scott + Ryszard Sommefeldt Samuel Judd Scott Pilet Sean Morgan + Sebastian Hutter Sébastien Serban Serafimescu Sergey Minakov Shishir Tandale SKison + Song Junwoo spilldata Stephan Hennion Steven Landow Stoned Xander - TheLevelOfDetail . + TheLevelOfDetail Thomas Bjarnelöf Thomas Kurz Tim Howard + tinyBigGAMES LLC Tobias Bocanegra - Trent Fehl Turntsnaco + tweaklab Valryia Vincent Cloutier Vlad Ceru Opran @@ -287,7 +314,6 @@ generous deed immortalized in the next stable release of Godot Engine. ## Silver donors 1D_Inc - Aaron Passchier Abraham Haskins Adam Adam Brunnmeier @@ -305,24 +331,24 @@ generous deed immortalized in the next stable release of Godot Engine. AJ Austinson Aki Mimoto Alan Beauchamp + Alberto Vilches Albin Jonasson Svärdsby Alder Stefano AleMax Alessandro Senese Alexander Erlemann + Alexander Ryndin + Alexander Walter (SilvanuZ) Alexandre Beaudoin alex clavelle - Ali Al-Khalifa Allan Davis Allen Schade Ancient Phoenix Anders Marstein Kruke Andreas Krampitz - André Simões Andre Stackhouse andrew james morris Andrew Mansuetti - Andrew Rosenwinkel Andrew Thomas Ano Nim Anthony Avina @@ -330,16 +356,14 @@ generous deed immortalized in the next stable release of Godot Engine. AP Condomines Arch Toasty Arda Erol + Aria Armin Preiml Arseniy M - Arthur S. Muszynski Ashley Claymore Astier Mickael Aubrey Falconer AzulCrescent - B A Balázs Batári - Balázs Kondákor Bartosz Bielecki Bekhoucha Danyl Benedikt @@ -347,6 +371,7 @@ generous deed immortalized in the next stable release of Godot Engine. Bernd Jänichen Bjarne Voigtländer Black Block + blackjacksike Blair Allen Bobby CC Wong Borkzilla @@ -356,6 +381,7 @@ generous deed immortalized in the next stable release of Godot Engine. Brian Klein Brodie Fairhall Bronson Zgeb + Bùi Việt Thành Burney Waring Caleb Gartner Cameron Meyer @@ -364,7 +390,9 @@ generous deed immortalized in the next stable release of Godot Engine. Carwyn Edwards Cas Brugman Cassidy James + Cédric Givord Chad Steadman + Charles Alston Chris Chapin Chris Jagusch Chris Langford @@ -377,8 +405,9 @@ generous deed immortalized in the next stable release of Godot Engine. Christoph Woinke Chris Truebe Clay Heaton + Cody Parker Conall O - Cyrelouyea + Craig Post CzechBlueBear Daniel Cheney Daniel Johnson @@ -398,10 +427,10 @@ generous deed immortalized in the next stable release of Godot Engine. Dr.Raccoon Duobix Duodecimal + DurrDiss Eduardo Teixeira Edward Herbert Edward Swartz - Eelco F Hillenius Egon Elbre Elgenzay Elias Nykrem @@ -409,7 +438,6 @@ generous deed immortalized in the next stable release of Godot Engine. Eric Ellingson Eric Williams Erkki Seppälä - ET Garcia Evan Rose Fain Faisal Alkubaisi @@ -423,6 +451,7 @@ generous deed immortalized in the next stable release of Godot Engine. FuDiggity Gadzhi Kharkharov gamedev by Celio + Game Endeavor Gary Thomas George Marques Gerard Ruiz Torruella @@ -438,19 +467,16 @@ generous deed immortalized in the next stable release of Godot Engine. Hal A helija Heribert Hirth - Hoai Nam Tran + Hieu Thanh Hunter Jones - Hylpher Ian Williams Iiari - iKlem IndustrialRobot + Ivan Nikolaev iveks - Ivica Šimić Jackson Harmer Jacob Jaguar - Jaiden Gerig Jaime Ruiz-Borau Vizárraga Jake D Jake Huxell @@ -461,12 +487,13 @@ generous deed immortalized in the next stable release of Godot Engine. Jamiee H Jamie Massey JARKKO PARVIAINEN + Jasiek Vetulani Jason Uechi Jean-Baptiste LEPESME Jeff Hungerford Jennifer Graves Jesse Dubay - Joe Alden + Jhon Adams Joe Klemmer John Gabriel Jonas @@ -483,42 +510,41 @@ generous deed immortalized in the next stable release of Godot Engine. Jorge Javier Araya Navarro Jose C. Rubio Joseph Catrambone - Josh Mitchell Josh Taylor - Joshua Southerland + Josue David Juanfran Jueast Julian Murgia June Little - JungleRobba + Justin Hamilton Justin Oaksford Justin Spedding KaDokta Kalin - Karel Němec Kauzig Keedong Park Keinan Powers Keith Bradner Kenji Kawabata + Ken Minardo Kenneth Lee Kent Jofur + Ketafuki Kevin McPhillips Kiri Jolly - Kiyohiro Kawamura (kyorohiro) Kjetil Haugland + Konstantin Goncharov + Kridsada Thanabulpong Kristian Nygaard Jensen KsyTek Games - Kuan Cheang kycho Kyle Jacobs Kyle Szklenski Kyuppin Laurent CHEA Laurent Tréguier - Lee Meichin + Laxman Pradhan LEMMiNO - Lenny Leonardo Dimano Lin Chear Linus Lind Lundgren @@ -527,13 +553,13 @@ generous deed immortalized in the next stable release of Godot Engine. Luis Gaemperle Luis M LunaticInAHat - Lurkars Major Haul makoto asano Malcolm Marco Lardelli Mark Jad Mark Krenz + Mark Malone Markus Martin Markus Michael Egger Martin FIbik @@ -550,8 +576,10 @@ generous deed immortalized in the next stable release of Godot Engine. Maxwell Megasploot Melissa Mears + Merlyn Morgan-Graham mewin Michael + Michael Bruce-Lockhart Michael Haney Michał Skwarek Mikayla @@ -566,27 +594,27 @@ generous deed immortalized in the next stable release of Godot Engine. Nathaniel Natrim nee + neighty Neil Blakey-Milner Neil Wang Nerdforge Nerdyninja Nicholas - Nicholas Girga Nick Allen Nick Macholl Niclas Eriksen Nicolas Goll-Perrier - Nicolás Montaña + Nicolas Rosset Nicolas SAN AGUSTIN Nima Farid NZ + oceoh OKV Oleg Reva Oleksandr Kryvonos Olivier Omar Delarosa Oscar Domingo - Oscar Norlander Parinya Teerakasemsuk patricio lara briones Patrick Dully @@ -595,24 +623,27 @@ generous deed immortalized in the next stable release of Godot Engine. Paul Mason Paweł Kowal Paweł Łyczkowski - Pedro Assuncao + Peter Höglund Petrus Prinsloo Philip Cohoe + Phillip Zolla Piotr Góral + Pipo Point08 Preethi Vaidyanathan - Price Comstock pwab + pyacier + Rad Cat Rafa Laguna Raffaele Aramo + RAMupgrade Remi Rampin Rémi Verschelde Reneator - Richard Diss + Riccardo Marini Richard Ivánek Riley Robert Farr (Larington) - Robert Larnach Rob Ruana Roger Smith Roland Rząsa @@ -623,19 +654,19 @@ generous deed immortalized in the next stable release of Godot Engine. Ryan Groom Sam Edson Samuele Zolfanelli - sayaks + scapegoat57 Scott D. Yelich Scott Longley - ScottMakesGames + Sean Lynch Sebastian Michailidis Sebastian Vetter SeongWan Kim Sergiy Onenko - Shaher Shane Shane Sicienski Shane Spoor Siim Raidma + simdee Simon Jonas Larsen Simon Schoenenberger Simon Wenner @@ -644,20 +675,20 @@ generous deed immortalized in the next stable release of Godot Engine. smo1704 soft circles Squirrel - Stefano Caronia Steve Cloete + summerblind Sung soo Choi Svenne Krap tadashi endo tannhauser_gate + Tarch Terry Theodore Lindsey - TheTrainDoctor TheVoiceInMyHead thomas Thomas Bechtold Thomas Detoy - Thomas Kelly + Thomas Horwath Tim Drumheller Tim Erskine Tim Gleason @@ -671,7 +702,6 @@ generous deed immortalized in the next stable release of Godot Engine. Travis O'Brien Trent Skinner tril zerobyte - Triptych Triumph263 . Troy Bonneau Tryggve Sollid @@ -684,8 +714,6 @@ generous deed immortalized in the next stable release of Godot Engine. Victor Vigilant Watch Viktor Ismagilov - Vitaliy Sapronenko - Vitor Balbio Vladimir Savin Vladislav Smirnov Výrus Hemomancer @@ -693,17 +721,15 @@ generous deed immortalized in the next stable release of Godot Engine. Wayne Haak werner mendizabal Wiley Thompson - Will William Edwards William F Siqueira William Hogben Wyatt Goodin + Xaver Fischer xenomat Yegor Smirnov - YiYin Gu Zack Yang Zak Stephens - ΒΑΣΙΛΗΣ ΓΕΩΡΓΑΚΟΠΟΥΛΟΣ 蕭惟允 郝晨煜 diff --git a/core/math/color.cpp b/core/math/color.cpp index 0398d43838..e1b45cac9c 100644 --- a/core/math/color.cpp +++ b/core/math/color.cpp @@ -408,6 +408,8 @@ Color Color::get_named_color(int p_idx) { return named_colors[p_idx].color; } +// For a version that errors on invalid values instead of returning +// a default color, use the Color(String) constructor instead. Color Color::from_string(const String &p_string, const Color &p_default) { if (html_is_valid(p_string)) { return html(p_string); diff --git a/core/math/color.h b/core/math/color.h index d3b27a9c65..5eb8b1119a 100644 --- a/core/math/color.h +++ b/core/math/color.h @@ -241,6 +241,19 @@ struct Color { b = p_c.b; a = p_a; } + + Color(const String &p_code) { + if (html_is_valid(p_code)) { + *this = html(p_code); + } else { + *this = named(p_code); + } + } + + Color(const String &p_code, float p_a) { + *this = Color(p_code); + a = p_a; + } }; bool Color::operator<(const Color &p_color) const { diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 7824776fdb..015cee09a7 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -2023,7 +2023,7 @@ Variant::operator Color() const { if (type == COLOR) { return *reinterpret_cast<const Color *>(_data._mem); } else if (type == STRING) { - return Color::html(operator String()); + return Color(operator String()); } else if (type == INT) { return Color::hex(operator int()); } else { diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp index 9835734583..52f9f6060e 100644 --- a/core/variant/variant_construct.cpp +++ b/core/variant/variant_construct.cpp @@ -688,6 +688,8 @@ void Variant::_register_variant_constructors() { add_constructor<VariantConstructor<Color, Color, double>>(sarray("from", "alpha")); add_constructor<VariantConstructor<Color, double, double, double>>(sarray("r", "g", "b")); add_constructor<VariantConstructor<Color, double, double, double, double>>(sarray("r", "g", "b", "a")); + add_constructor<VariantConstructor<Color, String>>(sarray("code")); + add_constructor<VariantConstructor<Color, String, double>>(sarray("code", "alpha")); add_constructor<VariantConstructNoArgs<StringName>>(sarray()); add_constructor<VariantConstructor<StringName, StringName>>(sarray("from")); diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index 8af5f29b65..ce88e0ae88 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -5,7 +5,7 @@ </brief_description> <description> A color represented by red, green, blue, and alpha (RGBA) components. The alpha component is often used for transparency. Values are in floating-point and usually range from 0 to 1. Some properties (such as CanvasItem.modulate) may accept values greater than 1 (overbright or HDR colors). - You can also create a color from standardized color names by using [code]ColorN[/code] ([b]FIXME:[/b] No longer true, a Color(String) constructor should be re-implemented for that) or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url]. + You can also create a color from standardized color names by using the string constructor or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url]. If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8]. [b]Note:[/b] In a boolean context, a Color will evaluate to [code]false[/code] if it's equal to [code]Color(0, 0, 0, 1)[/code] (opaque black). Otherwise, a Color will always evaluate to [code]true[/code]. [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/color_constants.png]Color constants cheatsheet[/url] @@ -54,6 +54,26 @@ <method name="Color" qualifiers="constructor"> <return type="Color"> </return> + <argument index="0" name="code" type="String"> + </argument> + <argument index="1" name="alpha" type="float"> + </argument> + <description> + Constructs a [Color] either from an HTML color code or from a standardized color name, with [code]alpha[/code] on the range of 0 to 1. Supported color names are the same as the constants. + </description> + </method> + <method name="Color" qualifiers="constructor"> + <return type="Color"> + </return> + <argument index="0" name="code" type="String"> + </argument> + <description> + Constructs a [Color] either from an HTML color code or from a standardized color name. Supported color names are the same as the constants. + </description> + </method> + <method name="Color" qualifiers="constructor"> + <return type="Color"> + </return> <argument index="0" name="r" type="float"> </argument> <argument index="1" name="g" type="float"> diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 1a631f4a2c..98966477a5 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -331,7 +331,7 @@ Error VulkanContext::_create_physical_device() { * function to register the final callback. */ VkDebugUtilsMessengerCreateInfoEXT dbg_messenger_create_info; - if (use_validation_layers) { + if (enabled_debug_utils) { // VK_EXT_debug_utils style dbg_messenger_create_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; dbg_messenger_create_info.pNext = nullptr; @@ -1593,7 +1593,8 @@ void VulkanContext::command_begin_label(VkCommandBuffer p_command_buffer, String VkDebugUtilsLabelEXT label; label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; label.pNext = nullptr; - label.pLabelName = p_label_name.utf8().get_data(); + CharString label_name = p_label_name.utf8(); + label.pLabelName = label_name.get_data(); label.color[0] = p_color[0]; label.color[1] = p_color[1]; label.color[2] = p_color[2]; @@ -1608,7 +1609,8 @@ void VulkanContext::command_insert_label(VkCommandBuffer p_command_buffer, Strin VkDebugUtilsLabelEXT label; label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; label.pNext = nullptr; - label.pLabelName = p_label_name.utf8().get_data(); + CharString label_name = p_label_name.utf8(); + label.pLabelName = label_name.get_data(); label.color[0] = p_color[0]; label.color[1] = p_color[1]; label.color[2] = p_color[2]; diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index ea6afe7f84..5061067ded 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -4473,10 +4473,17 @@ void VisualShaderNodePortPreview::_shader_changed() { for (int i = EditorNode::get_singleton()->get_editor_history()->get_path_size() - 1; i >= 0; i--) { Object *object = ObjectDB::get_instance(EditorNode::get_singleton()->get_editor_history()->get_path_object(i)); + ShaderMaterial *src_mat; if (!object) { continue; } - ShaderMaterial *src_mat = Object::cast_to<ShaderMaterial>(object); + if (object->has_method("get_material_override")) { // trying getting material from MeshInstance + src_mat = Object::cast_to<ShaderMaterial>(object->call("get_material_override")); + } else if (object->has_method("get_material")) { // from CanvasItem/Node2D + src_mat = Object::cast_to<ShaderMaterial>(object->call("get_material")); + } else { + src_mat = Object::cast_to<ShaderMaterial>(object); + } if (src_mat && src_mat->get_shader().is_valid()) { List<PropertyInfo> params; src_mat->get_shader()->get_param_list(¶ms); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index a0eb923bc5..5951373af9 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -2157,8 +2157,9 @@ void ProjectManager::_run_project() { } void ProjectManager::_scan_dir(const String &path, List<String> *r_projects) { - DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - da->change_dir(path); + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + Error error = da->change_dir(path); + ERR_FAIL_COND_MSG(error != OK, "Could not scan directory at: " + path); da->list_dir_begin(); String n = da->get_next(); while (n != String()) { @@ -2170,7 +2171,6 @@ void ProjectManager::_scan_dir(const String &path, List<String> *r_projects) { n = da->get_next(); } da->list_dir_end(); - memdelete(da); } void ProjectManager::_scan_begin(const String &p_base) { @@ -2683,8 +2683,26 @@ ProjectManager::ProjectManager() { _load_recent_projects(); - if (EditorSettings::get_singleton()->get("filesystem/directories/autoscan_project_path")) { - _scan_begin(EditorSettings::get_singleton()->get("filesystem/directories/autoscan_project_path")); + DirAccessRef dir_access = DirAccess::create(DirAccess::AccessType::ACCESS_FILESYSTEM); + + String default_project_path = EditorSettings::get_singleton()->get("filesystem/directories/default_project_path"); + if (!dir_access->dir_exists(default_project_path)) { + Error error = dir_access->make_dir_recursive(default_project_path); + if (error != OK) { + ERR_PRINT("Could not create default project directory at: " + default_project_path); + } + } + + String autoscan_path = EditorSettings::get_singleton()->get("filesystem/directories/autoscan_project_path"); + if (autoscan_path != "") { + if (dir_access->dir_exists(autoscan_path)) { + _scan_begin(autoscan_path); + } else { + Error error = dir_access->make_dir_recursive(autoscan_path); + if (error != OK) { + ERR_PRINT("Could not create project autoscan directory at: " + autoscan_path); + } + } } SceneTree::get_singleton()->get_root()->connect("files_dropped", callable_mp(this, &ProjectManager::_files_dropped)); diff --git a/main/main.cpp b/main/main.cpp index 657a6ad822..d70f0eb291 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1634,7 +1634,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) { register_server_types(); - MAIN_PRINT("Main: Load Remaps"); + MAIN_PRINT("Main: Load Boot Image"); Color clear = GLOBAL_DEF("rendering/environment/default_clear_color", Color(0.3, 0.3, 0.3)); RenderingServer::get_singleton()->set_default_clear_color(clear); @@ -1690,7 +1690,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) { MAIN_PRINT("Main: DCC"); RenderingServer::get_singleton()->set_default_clear_color( GLOBAL_DEF("rendering/environment/default_clear_color", Color(0.3, 0.3, 0.3))); - MAIN_PRINT("Main: END"); GLOBAL_DEF("application/config/icon", String()); ProjectSettings::get_singleton()->set_custom_property_info("application/config/icon", @@ -1728,7 +1727,16 @@ Error Main::setup2(Thread::ID p_main_tid_override) { id->set_emulate_mouse_from_touch(bool(GLOBAL_DEF("input_devices/pointing/emulate_mouse_from_touch", true))); } - MAIN_PRINT("Main: Load Remaps"); + MAIN_PRINT("Main: Load Translations and Remaps"); + + translation_server->setup(); //register translations, load them, etc. + if (locale != "") { + translation_server->set_locale(locale); + } + translation_server->load_translations(); + ResourceLoader::load_translation_remaps(); //load remaps for resources + + ResourceLoader::load_path_remaps(); MAIN_PRINT("Main: Load Scene Types"); @@ -1774,17 +1782,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) { // This loads global classes, so it must happen before custom loaders and savers are registered ScriptServer::init_languages(); - MAIN_PRINT("Main: Load Translations"); - - translation_server->setup(); //register translations, load them, etc. - if (locale != "") { - translation_server->set_locale(locale); - } - translation_server->load_translations(); - ResourceLoader::load_translation_remaps(); //load remaps for resources - - ResourceLoader::load_path_remaps(); - audio_server->load_default_bus_layout(); if (use_debug_profiler && EngineDebugger::is_active()) { diff --git a/modules/gdnative/include/gdnative/math_defs.h b/modules/gdnative/include/gdnative/math_defs.h index 05de157dd0..b5cf389506 100644 --- a/modules/gdnative/include/gdnative/math_defs.h +++ b/modules/gdnative/include/gdnative/math_defs.h @@ -35,6 +35,7 @@ extern "C" { #endif +#include <stdbool.h> #include <stdint.h> ////// bool diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs index 90141928ca..0c333d06ef 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Color.cs @@ -104,7 +104,7 @@ namespace Godot /// <summary> /// The HSV hue of this color, on the range 0 to 1. /// </summary> - /// <value>Getting is a long process, refer to the source code for details. Setting uses <see cref="FromHsv"/>.</value> + /// <value>Getting is a long process, refer to the source code for details. Setting uses <see cref="FromHSV"/>.</value> public float h { get @@ -145,14 +145,14 @@ namespace Godot } set { - this = FromHsv(value, s, v, a); + this = FromHSV(value, s, v, a); } } /// <summary> /// The HSV saturation of this color, on the range 0 to 1. /// </summary> - /// <value>Getting is equivalent to the ratio between the min and max RGB value. Setting uses <see cref="FromHsv"/>.</value> + /// <value>Getting is equivalent to the ratio between the min and max RGB value. Setting uses <see cref="FromHSV"/>.</value> public float s { get @@ -166,14 +166,14 @@ namespace Godot } set { - this = FromHsv(h, value, v, a); + this = FromHSV(h, value, v, a); } } /// <summary> /// The HSV value (brightness) of this color, on the range 0 to 1. /// </summary> - /// <value>Getting is equivalent to using `Max()` on the RGB components. Setting uses <see cref="FromHsv"/>.</value> + /// <value>Getting is equivalent to using `Max()` on the RGB components. Setting uses <see cref="FromHSV"/>.</value> public float v { get @@ -182,7 +182,7 @@ namespace Godot } set { - this = FromHsv(h, s, value, a); + this = FromHSV(h, s, value, a); } } @@ -455,7 +455,7 @@ namespace Godot /// </summary> /// <param name="includeAlpha">Whether or not to include alpha. If false, the color is RGB instead of RGBA.</param> /// <returns>A string for the HTML hexadecimal representation of this color.</returns> - public string ToHtml(bool includeAlpha = true) + public string ToHTML(bool includeAlpha = true) { var txt = string.Empty; @@ -532,18 +532,50 @@ namespace Godot } /// <summary> + /// Constructs a color either from an HTML color code or from a + /// standardized color name. Supported + /// color names are the same as the <see cref="Colors"/> constants. + /// </summary> + /// <param name="code">The HTML color code or color name to construct from.</param> + public Color(string code) + { + if (HtmlIsValid(code)) + { + this = FromHTML(code); + } + else + { + this = Named(code); + } + } + + /// <summary> + /// Constructs a color either from an HTML color code or from a + /// standardized color name, with `alpha` on the range of 0 to 1. Supported + /// color names are the same as the <see cref="Colors"/> constants. + /// </summary> + /// <param name="code">The HTML color code or color name to construct from.</param> + /// <param name="alpha">The alpha (transparency) value, typically on the range of 0 to 1.</param> + public Color(string code, float alpha) + { + this = new Color(code); + a = alpha; + } + + /// <summary> /// Constructs a color from the HTML hexadecimal color string in RGBA format. /// </summary> /// <param name="rgba">A string for the HTML hexadecimal representation of this color.</param> - public Color(string rgba) + private static Color FromHTML(string rgba) { + Color c; if (rgba.Length == 0) { - r = 0f; - g = 0f; - b = 0f; - a = 1.0f; - return; + c.r = 0f; + c.g = 0f; + c.b = 0f; + c.a = 1.0f; + return c; } if (rgba[0] == '#') @@ -577,47 +609,48 @@ namespace Godot throw new ArgumentOutOfRangeException("Invalid color code. Length is " + rgba.Length + " but a length of 6 or 8 is expected: " + rgba); } - a = 1.0f; + c.a = 1.0f; if (isShorthand) { - r = ParseCol4(rgba, 0) / 15f; - g = ParseCol4(rgba, 1) / 15f; - b = ParseCol4(rgba, 2) / 15f; + c.r = ParseCol4(rgba, 0) / 15f; + c.g = ParseCol4(rgba, 1) / 15f; + c.b = ParseCol4(rgba, 2) / 15f; if (alpha) { - a = ParseCol4(rgba, 3) / 15f; + c.a = ParseCol4(rgba, 3) / 15f; } } else { - r = ParseCol8(rgba, 0) / 255f; - g = ParseCol8(rgba, 2) / 255f; - b = ParseCol8(rgba, 4) / 255f; + c.r = ParseCol8(rgba, 0) / 255f; + c.g = ParseCol8(rgba, 2) / 255f; + c.b = ParseCol8(rgba, 4) / 255f; if (alpha) { - a = ParseCol8(rgba, 6) / 255f; + c.a = ParseCol8(rgba, 6) / 255f; } } - if (r < 0) + if (c.r < 0) { throw new ArgumentOutOfRangeException("Invalid color code. Red part is not valid hexadecimal: " + rgba); } - if (g < 0) + if (c.g < 0) { throw new ArgumentOutOfRangeException("Invalid color code. Green part is not valid hexadecimal: " + rgba); } - if (b < 0) + if (c.b < 0) { throw new ArgumentOutOfRangeException("Invalid color code. Blue part is not valid hexadecimal: " + rgba); } - if (a < 0) + if (c.a < 0) { throw new ArgumentOutOfRangeException("Invalid color code. Alpha part is not valid hexadecimal: " + rgba); } + return c; } /// <summary> @@ -640,9 +673,8 @@ namespace Godot /// the constants defined in <see cref="Colors"/>. /// </summary> /// <param name="name">The name of the color.</param> - /// <param name="alpha">The alpha (transparency) component represented on the range of 0 to 1. Default: 1.</param> /// <returns>The constructed color.</returns> - public static Color ColorN(string name, float alpha = 1f) + private static Color Named(string name) { name = name.Replace(" ", String.Empty); name = name.Replace("-", String.Empty); @@ -656,9 +688,7 @@ namespace Godot throw new ArgumentOutOfRangeException($"Invalid Color Name: {name}"); } - Color color = Colors.namedColors[name]; - color.a = alpha; - return color; + return Colors.namedColors[name]; } /// <summary> @@ -671,11 +701,11 @@ namespace Godot /// <param name="value">The HSV value (brightness), typically on the range of 0 to 1.</param> /// <param name="alpha">The alpha (transparency) value, typically on the range of 0 to 1.</param> /// <returns>The constructed color.</returns> - public static Color FromHsv(float hue, float saturation, float value, float alpha = 1.0f) + public static Color FromHSV(float hue, float saturation, float value, float alpha = 1.0f) { if (saturation == 0) { - // acp_hromatic (grey) + // Achromatic (grey) return new Color(value, value, value, alpha); } @@ -715,7 +745,7 @@ namespace Godot /// <param name="hue">Output parameter for the HSV hue.</param> /// <param name="saturation">Output parameter for the HSV saturation.</param> /// <param name="value">Output parameter for the HSV value.</param> - public void ToHsv(out float hue, out float saturation, out float value) + public void ToHSV(out float hue, out float saturation, out float value) { float max = (float)Mathf.Max(r, Mathf.Max(g, b)); float min = (float)Mathf.Min(r, Mathf.Min(g, b)); @@ -803,7 +833,8 @@ namespace Godot } // Check if each hex digit is valid. - for (int i = 0; i < len; i++) { + for (int i = 0; i < len; i++) + { if (ParseCol4(color, i) == -1) { return false; diff --git a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml index 4004f1a04c..219ffd01d3 100644 --- a/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml +++ b/modules/visual_script/doc_classes/VisualScriptBuiltinFunc.xml @@ -202,24 +202,20 @@ <constant name="BYTES_TO_VAR" value="62" enum="BuiltinFunc"> Deserialize a [Variant] from a [PackedByteArray] serialized using [constant VAR_TO_BYTES]. </constant> - <constant name="COLORN" value="63" enum="BuiltinFunc"> - Return the [Color] with the given name and alpha ranging from 0 to 1. - [b]Note:[/b] Names are defined in [code]color_names.inc[/code]. - </constant> - <constant name="MATH_SMOOTHSTEP" value="64" enum="BuiltinFunc"> + <constant name="MATH_SMOOTHSTEP" value="63" enum="BuiltinFunc"> Return a number smoothly interpolated between the first two inputs, based on the third input. Similar to [constant MATH_LERP], but interpolates faster at the beginning and slower at the end. Using Hermite interpolation formula: [codeblock] var t = clamp((weight - from) / (to - from), 0.0, 1.0) return t * t * (3.0 - 2.0 * t) [/codeblock] </constant> - <constant name="MATH_POSMOD" value="65" enum="BuiltinFunc"> + <constant name="MATH_POSMOD" value="64" enum="BuiltinFunc"> </constant> - <constant name="MATH_LERP_ANGLE" value="66" enum="BuiltinFunc"> + <constant name="MATH_LERP_ANGLE" value="65" enum="BuiltinFunc"> </constant> - <constant name="TEXT_ORD" value="67" enum="BuiltinFunc"> + <constant name="TEXT_ORD" value="66" enum="BuiltinFunc"> </constant> - <constant name="FUNC_MAX" value="68" enum="BuiltinFunc"> + <constant name="FUNC_MAX" value="67" enum="BuiltinFunc"> Represents the size of the [enum BuiltinFunc] enum. </constant> </constants> diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 2558c1d7ec..b96311ba6c 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -101,7 +101,6 @@ const char *VisualScriptBuiltinFunc::func_name[VisualScriptBuiltinFunc::FUNC_MAX "str2var", "var2bytes", "bytes2var", - "color_named", "smoothstep", "posmod", "lerp_angle", @@ -200,7 +199,6 @@ int VisualScriptBuiltinFunc::get_func_argument_count(BuiltinFunc p_func) { case LOGIC_MAX: case LOGIC_MIN: case TYPE_CONVERT: - case COLORN: return 2; case MATH_LERP: case MATH_LERP_ANGLE: @@ -476,13 +474,6 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const return PropertyInfo(Variant::BOOL, "allow_objects"); } } break; - case COLORN: { - if (p_idx == 0) { - return PropertyInfo(Variant::STRING, "name"); - } else { - return PropertyInfo(Variant::FLOAT, "alpha"); - } - } break; case FUNC_MAX: { } } @@ -635,9 +626,6 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons t = Variant::BOOL; } } break; - case COLORN: { - t = Variant::COLOR; - } break; case FUNC_MAX: { } } @@ -1176,15 +1164,6 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in *r_return = ret; } break; - case VisualScriptBuiltinFunc::COLORN: { - VALIDATE_ARG_NUM(1); - - Color color = Color::named(*p_inputs[0]); - color.a = *p_inputs[1]; - - *r_return = String(color); - - } break; default: { } } @@ -1292,7 +1271,6 @@ void VisualScriptBuiltinFunc::_bind_methods() { BIND_ENUM_CONSTANT(STR_TO_VAR); BIND_ENUM_CONSTANT(VAR_TO_BYTES); BIND_ENUM_CONSTANT(BYTES_TO_VAR); - BIND_ENUM_CONSTANT(COLORN); BIND_ENUM_CONSTANT(MATH_SMOOTHSTEP); BIND_ENUM_CONSTANT(MATH_POSMOD); BIND_ENUM_CONSTANT(MATH_LERP_ANGLE); @@ -1388,5 +1366,4 @@ void register_visual_script_builtin_func_node() { VisualScriptLanguage::singleton->add_register_func("functions/built_in/str2var", create_builtin_func_node<VisualScriptBuiltinFunc::STR_TO_VAR>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/var2bytes", create_builtin_func_node<VisualScriptBuiltinFunc::VAR_TO_BYTES>); VisualScriptLanguage::singleton->add_register_func("functions/built_in/bytes2var", create_builtin_func_node<VisualScriptBuiltinFunc::BYTES_TO_VAR>); - VisualScriptLanguage::singleton->add_register_func("functions/built_in/color_named", create_builtin_func_node<VisualScriptBuiltinFunc::COLORN>); } diff --git a/modules/visual_script/visual_script_builtin_funcs.h b/modules/visual_script/visual_script_builtin_funcs.h index eaa2ef41e2..1fafaf1d98 100644 --- a/modules/visual_script/visual_script_builtin_funcs.h +++ b/modules/visual_script/visual_script_builtin_funcs.h @@ -101,7 +101,6 @@ public: STR_TO_VAR, VAR_TO_BYTES, BYTES_TO_VAR, - COLORN, MATH_SMOOTHSTEP, MATH_POSMOD, MATH_LERP_ANGLE, diff --git a/platform/iphone/os_iphone.mm b/platform/iphone/os_iphone.mm index 625cbf178e..51c4da2960 100644 --- a/platform/iphone/os_iphone.mm +++ b/platform/iphone/os_iphone.mm @@ -144,8 +144,6 @@ void OSIPhone::deinitialize_modules() { } void OSIPhone::set_main_loop(MainLoop *p_main_loop) { - godot_ios_plugins_initialize(); - main_loop = p_main_loop; if (main_loop) { @@ -179,6 +177,8 @@ bool OSIPhone::iterate() { } void OSIPhone::start() { + godot_ios_plugins_initialize(); + Main::start(); if (joypad_iphone) { |