diff options
187 files changed, 3664 insertions, 2680 deletions
@@ -66,6 +66,7 @@ Juan Linietsky <reduzio@gmail.com> <red@kyoko> Julian Murgia <the.straton@gmail.com> Kanabenki <lucien.menassol@gmail.com> <18357657+Kanabenki@users.noreply.github.com> Kelly Thomas <kelly.thomas@hotmail.com.au> +Kongfa Waroros <gongpha@hotmail.com> K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com> Leon Krause <lk@leonkrause.com> <eska@eska.me> Leon Krause <lk@leonkrause.com> <eska014@users.noreply.github.com> diff --git a/AUTHORS.md b/AUTHORS.md index 8c26d2892b..7c5eb0c56b 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -100,6 +100,7 @@ name is available. James Buck (jbuck3) Jérôme Gully (Nutriz) Jia Jun Chai (SkyLucilfer) + jmb462 Joan Fons Sanchez (JFonS) Johannes Witt (HaSa1002) Johan Manuel (29jm) @@ -108,6 +109,7 @@ name is available. Julian Murgia (StraToN) Justo Delgado (mrcdk) Kelly Thomas (KellyThomas) + Kongfa Waroros (gongpha) Kostadin Damyanov (Max-Might) K. S. Ernest (iFire) Lee (fire) lawnjelly @@ -40,6 +40,7 @@ generous deed immortalized in the next stable release of Godot Engine. Alejandro Saucedo alex brown Andrew Dunai + anti666 Ben Nolan blurp CD @@ -51,6 +52,7 @@ generous deed immortalized in the next stable release of Godot Engine. Digital Grows Dov Zimring Edward Flick + Florian Neumann Gamechuck GameDev.net Hein-Pieter van Braam @@ -78,7 +80,6 @@ generous deed immortalized in the next stable release of Godot Engine. Steve Thomas Krampl Tristan Pemble - VilliHaukka Violin Iliev Xwdit @@ -98,7 +99,6 @@ generous deed immortalized in the next stable release of Godot Engine. Don B Ed Morley Ellen Poe - Florian Neumann Florian Rämisch Forge Gamejunkey @@ -110,6 +110,7 @@ generous deed immortalized in the next stable release of Godot Engine. Jon Woodward Karl Werf Klavdij Voncina + kuku Lex Steers Luke Maciej Pendolski @@ -144,14 +145,12 @@ generous deed immortalized in the next stable release of Godot Engine. 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 Antanas Paskauskas Antoni Batchelli @@ -180,7 +179,9 @@ generous deed immortalized in the next stable release of Godot Engine. Donn Eddy Easypete Edgar Sun + Eric Brand Eugenio Hugo Salgüero Jáñez + EXUREI flesk F S Gabrielius VaiÅ¡kÅ«nas @@ -207,6 +208,7 @@ generous deed immortalized in the next stable release of Godot Engine. Joshie Sparks Joshua Flores Joshua Lesperance + Juan T Chen Juan Velandia Judd Julian Todd @@ -217,7 +219,6 @@ generous deed immortalized in the next stable release of Godot Engine. kickmaniac kinfox Kos - kuku Lachie Lain Ballard Laszlo Kiss @@ -225,7 +226,7 @@ generous deed immortalized in the next stable release of Godot Engine. Leo Fidel R Liban Liam Smyth Luc-Frédéric Langis - luka duren + Åukasz Nowak MadScientistCarl Marcelo Dornbusch Lopes Marcus Dobler @@ -241,13 +242,13 @@ generous deed immortalized in the next stable release of Godot Engine. medecau Michael Michael Dürwald - Michael Noll Michael Policastro MightyPossum MikadoSC MuffinManKen + nate etan Nick Abousselam - Nick Barovic + Nicole Barovic Oliver Dick Oscar Campos Patrick Ting @@ -262,6 +263,7 @@ generous deed immortalized in the next stable release of Godot Engine. Raymond Harris Raz A Rene Tailleur + Rhodochrone Ricardo Alcantara Robert Larnach Robert Willes @@ -282,10 +284,11 @@ generous deed immortalized in the next stable release of Godot Engine. Shishir Tandale SKison Song Junwoo - spilldata + spacechase0 Stephan Hennion Steven Landow Stoned Xander + Sven F. Thomas Bjarnelöf Thomas Kurz Tim Howard @@ -310,6 +313,7 @@ generous deed immortalized in the next stable release of Godot Engine. 1D_Inc Abraham Haskins Adam + Adam Brown Adam Brunnmeier Adam Carr Adam Long @@ -322,7 +326,6 @@ generous deed immortalized in the next stable release of Godot Engine. Agustinus Arya Ahmet Kalyoncu Aidan O'Flannagain - AJ Austinson Aki Mimoto Alan Beauchamp Alberto Vilches @@ -335,7 +338,7 @@ generous deed immortalized in the next stable release of Godot Engine. Alexander Walter (SilvanuZ) Alexandre Beaudoin alex clavelle - Alex Schmidt + Alex (Well Done Games) Allan Davis Allen Schade Anders Marstein Kruke @@ -389,7 +392,6 @@ generous deed immortalized in the next stable release of Godot Engine. Chad Steadman Charles Alston Chris Chapin - Chris Jagusch Chris Langford Christian Clavet Christian Mauduit @@ -413,7 +415,9 @@ generous deed immortalized in the next stable release of Godot Engine. David May David Maziarka David Woodard + deadwithbread Devin Carraway + Diego Pereira Dmitry Fisher Dmytro Korchynskyi Dominik Wetzel @@ -431,20 +435,20 @@ generous deed immortalized in the next stable release of Godot Engine. Elgenzay Elias Nykrem Ephemeral + Eric Stokes Eric Walkingshaw Eric Williams Erkki Seppälä Evan Rose Faisal Alkubaisi Fancy Ants Studios + fby Fekinox Felix Bohmann Flaredown Forty Doubleu Francois Holland Frank - FuDiggity - gamedev by Celio Game Endeavor Gareth Knowles Gary Thomas @@ -477,12 +481,13 @@ generous deed immortalized in the next stable release of Godot Engine. Jako Danar James James A F Manley + James Quincy James Thomas Jamie Massey Jan Vetulani JARKKO PARVIAINEN + Jason Bolton Jason Uechi - Jean-Baptiste LEPESME Jeff Hungerford Jennifer Graves Jesse Dubay @@ -504,8 +509,9 @@ generous deed immortalized in the next stable release of Godot Engine. Jorge Araya Navarro Jose C. Rubio Joseph Catrambone + Josep Sanchez Josh Taylor - Josue David + Joshua Heidrich jromkjrom Juanfran Juan Uys @@ -526,7 +532,6 @@ generous deed immortalized in the next stable release of Godot Engine. Kenneth Lee Kent Jofur Ketafuki - Kevin McPhillips Kiri Jolly Kjetil Haugland Konstantin Goncharov @@ -544,7 +549,6 @@ generous deed immortalized in the next stable release of Godot Engine. Leonardo Dimano Lin Chear Linus Lind Lundgren - Lionel Gaillard Luigi Renna Luis Gaemperle Luis M @@ -564,6 +568,7 @@ generous deed immortalized in the next stable release of Godot Engine. Mathieu Matt Edwards Matthew Booe + Matt Sylvia Max Fiedler Maxime Blade Maxwell @@ -577,15 +582,17 @@ generous deed immortalized in the next stable release of Godot Engine. MichaÅ‚ Skwarek MidoriBunn 'tis BS Mikayla + Mike Mike Birkhead + Mike Copley Mike Cunningham Mitchell J. Wagner + MJacred Molinghu Molly Jameson MrAZIE Nathan Fish Nathaniel - Natrim nee neighty Neil Blakey-Milner @@ -593,7 +600,6 @@ generous deed immortalized in the next stable release of Godot Engine. Nerdforge Nerdyninja Nicholas - Nick Allen Nick Macholl Niclas Eriksen Nicolas Goll-Perrier @@ -602,16 +608,14 @@ generous deed immortalized in the next stable release of Godot Engine. Nima Farid NZ oceoh + Okatima OKV Oleg Reva Oleksandr Kryvonos Omar Delarosa Oriol Muñoz Princep Oscar Domingo - Parinya Teerakasemsuk - patricio lara briones Patrick Brock - Patrick Dully Patrick Nafarrete Paul Gieske PaweÅ‚ Kowal @@ -620,9 +624,9 @@ generous deed immortalized in the next stable release of Godot Engine. Peter Richmond Petrus Prinsloo Philip Cohoe + Philip Ludington (MrPhil) Pierre Caye Piotr Góral - Pipo Point08 Preethi Vaidyanathan pwab @@ -655,7 +659,6 @@ generous deed immortalized in the next stable release of Godot Engine. Sean Lynch Sebastian Michailidis SeongWan Kim - Serenitor Sergey Sergiy Onenko Shane @@ -671,6 +674,7 @@ generous deed immortalized in the next stable release of Godot Engine. smo1704 soft circles Squirrel + Stéphane Roussel Steve Cloete summerblind Sung soo Choi @@ -679,7 +683,6 @@ generous deed immortalized in the next stable release of Godot Engine. tannhauser_gate Tarch Terry - The Liquidator Theodore Lindsey TheVoiceInMyHead thomas @@ -690,12 +693,14 @@ generous deed immortalized in the next stable release of Godot Engine. Tim Erskine Tim Gleason Timothy B. MacDonald + TMoney Tobias Bradtke Tom Coxon Toni Duran Tony Zhao Torgeir Lilleskog Torsten Crass + toupeira Travis O'Brien Trent Skinner tril zerobyte @@ -725,8 +730,8 @@ generous deed immortalized in the next stable release of Godot Engine. x1212 xenomat Yegor Smirnov - Zack Yang Zak Stephens + Ðльдар Будагов è•æƒŸå… ## Bronze donors diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp index 6b3953f588..fe913549c9 100644 --- a/core/crypto/crypto.cpp +++ b/core/crypto/crypto.cpp @@ -157,8 +157,9 @@ RES ResourceFormatLoaderCrypto::load(const String &p_path, const String &p_origi return key; } else if (el == "pub") { CryptoKey *key = CryptoKey::create(); - if (key) + if (key) { key->load(p_path, true); + } return key; } return nullptr; diff --git a/core/input/gamecontrollerdb.txt b/core/input/gamecontrollerdb.txt index f2a3135b05..884fb9550c 100644 --- a/core/input/gamecontrollerdb.txt +++ b/core/input/gamecontrollerdb.txt @@ -65,6 +65,7 @@ 03000000808300000300000000000000,Betop Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b3,y:b0,platform:Windows, 030000006b1400000055000000000000,Bigben PS3 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Windows, 030000006b1400000103000000000000,Bigben PS3 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows, +03000000120c0000210e000000000000,Brook Mars,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Windows, 0300000066f700000500000000000000,BrutalLegendTest,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b3,platform:Windows, 03000000d81d00000b00000000000000,BUFFALO BSGP1601 Series ,a:b5,b:b3,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b13,x:b4,y:b2,platform:Windows, 03000000e82000006058000000000000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Windows, @@ -374,6 +375,8 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000c62400001a89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,leftstick:b15,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b16,righttrigger:a4,rightx:a2,righty:a3,start:b13,x:b3,y:b4,platform:Mac OS X, 03000000c62400001b89000000010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X, 03000000d62000002a79000000010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X, +03000000120c0000200e000000010000,Brook Mars,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Mac OS X, +03000000120c0000210e000000010000,Brook Mars,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Mac OS X, 030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Mac OS X, 03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,platform:Mac OS X, 03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,platform:Mac OS X, @@ -552,6 +555,8 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000c31100000791000011010000,Be1 GC101 GAMEPAD 1.03 mode,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, 030000005e0400008e02000003030000,Be1 GC101 Xbox 360 Controller mode,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, 03000000666600006706000000010000,boom PSX to PC Converter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,platform:Linux, +03000000120c0000200e000011010000,Brook Mars,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,platform:Linux, +03000000120c0000210e000011010000,Brook Mars,a:b1,b:b2,x:b0,y:b3,back:b8,guide:b12,start:b9,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Linux, 03000000ffff0000ffff000000010000,Chinese-made Xbox Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,platform:Linux, 03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,platform:Linux, 030000000b0400003365000000010000,Competition Pro,a:b0,b:b1,back:b2,leftx:a0,lefty:a1,start:b3,platform:Linux, @@ -680,9 +685,11 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 060000007e0500000820000000000000,Nintendo Combined Joy-Cons (joycond),a:b0,b:b1,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, 030000007e0500003703000000016800,Nintendo GameCube Controller,a:b0,b:b2,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1~,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3~,start:b8,x:b1,y:b3,platform:Linux, 03000000790000004618000010010000,Nintendo GameCube Controller Adapter,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a5~,righty:a2~,start:b9,x:b0,y:b3,platform:Linux, +050000007e0500000620000001800000,Nintendo Switch Left Joy-Con,a:b9,b:b8,x:b7,y:b10,back:b5,start:b0,leftstick:b6,leftshoulder:b2,rightshoulder:b4,leftx:a1,lefty:a0~,platform:Linux, +050000007e0500000720000001800000,Nintendo Switch Right Joy-Con,a:b1,b:b2,x:b0,y:b3,back:b9,start:b8,leftstick:b10,leftshoulder:b4,rightshoulder:b6,leftx:a1~,lefty:a0~,platform:Linux, 050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux, -050000007e0500000920000001800000,Nintendo Switch Pro Controller (joycond),a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, -030000007e0500000920000011810000,Nintendo Switch Pro Controller Wired (joycond),a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, +050000007e0500000920000001800000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, +030000007e0500000920000011810000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, 050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Linux, 05000000010000000100000003000000,Nintendo Wiimote,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux, 030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,platform:Linux, @@ -715,7 +722,9 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000c62400000053000000010000,PowerA,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, 03000000c62400003a54000001010000,PowerA 1428124-01,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, 03000000d62000006dca000011010000,PowerA Pro Ex,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux, +03000000d62000000228000001010000,PowerA Wired Controller for Xbox One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, 03000000c62400001a58000001010000,PowerA Xbox One Cabled,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, +03000000c62400001a54000001010000,PowerA Xbox One Mini Wired Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, 030000006d040000d2ca000011010000,Precision Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux, 03000000ff1100004133000010010000,PS2 Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,platform:Linux, 03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Linux, @@ -801,7 +810,8 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux, 03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux, 03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux, -03000000de2800004211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:b18,dpleft:b19,dpright:b20,dpup:b17,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b5,platform:Linux, +03000000de2800000211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:b18,dpleft:b19,dpright:b20,dpup:b17,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b5,platform:Linux, +03000000de2800004211000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:b18,dpleft:b19,dpright:b20,dpup:b17,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b5,platform:Linux, 03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux, 05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux, 05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Linux, @@ -890,6 +900,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 050000003512000020ab000000780f00,8BitDo SNES30 Gamepad,a:b21,b:b20,back:b30,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b26,rightshoulder:b27,start:b31,x:b24,y:b23,platform:Android, 05000000c82d000018900000ffff0f00,8BitDo Zero 2,a:b1,b:b0,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b3,y:b2,platform:Android, 05000000c82d000030320000ffff0f00,8BitDo Zero 2,a:b1,b:b0,back:b4,leftshoulder:b9,leftx:a0,lefty:a1,rightshoulder:b10,start:b6,x:b3,y:b2,platform:Android, +38383337343564366131323064613561,Brook Mars,a:b1,b:b19,x:b0,y:b2,leftshoulder:b3,rightshoulder:b20,lefttrigger:b9,righttrigger:b10,back:b17,start:b18,leftx:a0,lefty:a1,rightx:a2,righty:a3,leftstick:b15,rightstick:b6,platform:Android, 05000000bc20000000550000ffff3f00,GameSir G3w,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android, 05000000d6020000e5890000dfff3f00,GPD XD Plus,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,platform:Android, 0500000031366332860c44aadfff0f00,GS Gamepad,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:b15,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:b16,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android, diff --git a/core/math/dynamic_bvh.cpp b/core/math/dynamic_bvh.cpp index 4639a52278..200095d8cb 100644 --- a/core/math/dynamic_bvh.cpp +++ b/core/math/dynamic_bvh.cpp @@ -61,7 +61,7 @@ DynamicBVH::Node *DynamicBVH::_create_node_with_volume(Node *p_parent, const Vol void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) { if (!bvh_root) { bvh_root = p_leaf; - p_leaf->parent = 0; + p_leaf->parent = nullptr; } else { if (!p_root->is_leaf()) { do { @@ -71,7 +71,7 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) { } while (!p_root->is_leaf()); } Node *prev = p_root->parent; - Node *node = _create_node_with_volume(prev, p_leaf->volume.merge(p_root->volume), 0); + Node *node = _create_node_with_volume(prev, p_leaf->volume.merge(p_root->volume), nullptr); if (prev) { prev->childs[p_root->get_index_in_parent()] = node; node->childs[0] = p_root; @@ -85,7 +85,7 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) { break; } node = prev; - } while (0 != (prev = node->parent)); + } while (nullptr != (prev = node->parent)); } else { node->childs[0] = p_root; p_root->parent = node; @@ -98,8 +98,8 @@ void DynamicBVH::_insert_leaf(Node *p_root, Node *p_leaf) { DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) { if (leaf == bvh_root) { - bvh_root = 0; - return (0); + bvh_root = nullptr; + return (nullptr); } else { Node *parent = leaf->parent; Node *prev = parent->parent; @@ -113,13 +113,14 @@ DynamicBVH::Node *DynamicBVH::_remove_leaf(Node *leaf) { prev->volume = prev->childs[0]->volume.merge(prev->childs[1]->volume); if (pb.is_not_equal_to(prev->volume)) { prev = prev->parent; - } else + } else { break; + } } return (prev ? prev : bvh_root); } else { bvh_root = sibling; - sibling->parent = 0; + sibling->parent = nullptr; _delete_node(parent); return (bvh_root); } @@ -262,10 +263,11 @@ DynamicBVH::Node *DynamicBVH::_node_sort(Node *n, Node *&r) { Node *s = p->childs[j]; Node *q = p->parent; ERR_FAIL_COND_V(n != p->childs[i], nullptr); - if (q) + if (q) { q->childs[p->get_index_in_parent()] = n; - else + } else { r = n; + } s->parent = n; p->parent = n; n->parent = q; @@ -307,8 +309,9 @@ void DynamicBVH::optimize_top_down(int bu_threshold) { } void DynamicBVH::optimize_incremental(int passes) { - if (passes < 0) + if (passes < 0) { passes = total_leaves; + } if (bvh_root && (passes > 0)) { do { Node *node = bvh_root; @@ -345,8 +348,9 @@ void DynamicBVH::_update(Node *leaf, int lookahead) { for (int i = 0; (i < lookahead) && root->parent; ++i) { root = root->parent; } - } else + } else { root = bvh_root; + } } _insert_leaf(root, leaf); } @@ -370,8 +374,9 @@ bool DynamicBVH::update(const ID &p_id, const AABB &p_box) { for (int i = 0; (i < lkhd) && base->parent; ++i) { base = base->parent; } - } else + } else { base = bvh_root; + } } leaf->volume = volume; _insert_leaf(base, leaf); diff --git a/core/math/dynamic_bvh.h b/core/math/dynamic_bvh.h index c71db2d24d..3fb22515a2 100644 --- a/core/math/dynamic_bvh.h +++ b/core/math/dynamic_bvh.h @@ -87,14 +87,16 @@ private: _FORCE_INLINE_ Volume merge(const Volume &b) const { Volume r; for (int i = 0; i < 3; ++i) { - if (min[i] < b.min[i]) + if (min[i] < b.min[i]) { r.min[i] = min[i]; - else + } else { r.min[i] = b.min[i]; - if (max[i] > b.max[i]) + } + if (max[i] > b.max[i]) { r.max[i] = max[i]; - else + } else { r.max[i] = b.max[i]; + } } return r; } @@ -202,10 +204,11 @@ private: // int count_leaves() const { - if (is_internal()) + if (is_internal()) { return childs[0]->count_leaves() + childs[1]->count_leaves(); - else + } else { return (1); + } } bool is_left_of_axis(const Vector3 &org, const Vector3 &axis) const { @@ -254,31 +257,37 @@ private: tymin = (bounds[raySign[1]].y - rayFrom.y) * rayInvDirection.y; tymax = (bounds[1 - raySign[1]].y - rayFrom.y) * rayInvDirection.y; - if ((tmin > tymax) || (tymin > tmax)) + if ((tmin > tymax) || (tymin > tmax)) { return false; + } - if (tymin > tmin) + if (tymin > tmin) { tmin = tymin; + } - if (tymax < tmax) + if (tymax < tmax) { tmax = tymax; + } tzmin = (bounds[raySign[2]].z - rayFrom.z) * rayInvDirection.z; tzmax = (bounds[1 - raySign[2]].z - rayFrom.z) * rayInvDirection.z; - if ((tmin > tzmax) || (tzmin > tmax)) + if ((tmin > tzmax) || (tzmin > tmax)) { return false; - if (tzmin > tmin) + } + if (tzmin > tmin) { tmin = tzmin; - if (tzmax < tmax) + } + if (tzmax < tmax) { tmax = tzmax; + } return ((tmin < lambda_max) && (tmax > lambda_min)); } public: // Methods void clear(); - bool is_empty() const { return (0 == bvh_root); } + bool is_empty() const { return (nullptr == bvh_root); } void optimize_bottom_up(); void optimize_top_down(int bu_threshold = 128); void optimize_incremental(int passes); diff --git a/core/os/os.cpp b/core/os/os.cpp index 182bab4058..ca1b798e11 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -106,10 +106,18 @@ void OS::add_logger(Logger *p_logger) { } void OS::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, Logger::ErrorType p_type) { + if (!_stderr_enabled) { + return; + } + _logger->log_error(p_function, p_file, p_line, p_code, p_rationale, p_type); } void OS::print(const char *p_format, ...) { + if (!_stdout_enabled) { + return; + } + va_list argp; va_start(argp, p_format); @@ -119,6 +127,10 @@ void OS::print(const char *p_format, ...) { } void OS::printerr(const char *p_format, ...) { + if (!_stderr_enabled) { + return; + } + va_list argp; va_start(argp, p_format); @@ -163,6 +175,22 @@ bool OS::is_stdout_debug_enabled() const { return _debug_stdout; } +bool OS::is_stdout_enabled() const { + return _stdout_enabled; +} + +bool OS::is_stderr_enabled() const { + return _stderr_enabled; +} + +void OS::set_stdout_enabled(bool p_enabled) { + _stdout_enabled = p_enabled; +} + +void OS::set_stderr_enabled(bool p_enabled) { + _stderr_enabled = p_enabled; +} + void OS::dump_memory_to_file(const char *p_file) { //Memory::dump_static_mem_to_file(p_file); } diff --git a/core/os/os.h b/core/os/os.h index e41d788e12..7198607237 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -60,6 +60,8 @@ class OS { bool _allow_layered = false; bool _use_vsync; bool _vsync_via_compositor; + bool _stdout_enabled = true; + bool _stderr_enabled = true; char *last_error; @@ -219,6 +221,11 @@ public: bool is_stdout_verbose() const; bool is_stdout_debug_enabled() const; + bool is_stdout_enabled() const; + bool is_stderr_enabled() const; + void set_stdout_enabled(bool p_enabled); + void set_stderr_enabled(bool p_enabled); + virtual void disable_crash_handler() {} virtual bool is_disable_crash_handler() const { return false; } virtual void initialize_debugging() {} diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp index b86ae3ebb2..f319631ce5 100644 --- a/core/variant/variant_setget.cpp +++ b/core/variant/variant_setget.cpp @@ -891,8 +891,9 @@ struct VariantIndexedSetGet_Array { static void ptr_get(const void *base, int64_t index, void *member) { /* avoid ptrconvert for performance*/ const Array &v = *reinterpret_cast<const Array *>(base); - if (index < 0) + if (index < 0) { index += v.size(); + } OOB_TEST(index, v.size()); PtrToArg<Variant>::encode(v[index], member); } @@ -925,8 +926,9 @@ struct VariantIndexedSetGet_Array { static void ptr_set(void *base, int64_t index, const void *member) { /* avoid ptrconvert for performance*/ Array &v = *reinterpret_cast<Array *>(base); - if (index < 0) + if (index < 0) { index += v.size(); + } OOB_TEST(index, v.size()); v.set(index, PtrToArg<Variant>::convert(member)); } diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index f3cecc081a..54bbe7a94b 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -328,13 +328,6 @@ [b]Note:[/b] On large arrays, this method will be slower if the inserted element is close to the beginning of the array (index 0). This is because all elements placed after the newly inserted element have to be reindexed. </description> </method> - <method name="reverse"> - <return type="void"> - </return> - <description> - Reverses the order of the elements in the array. - </description> - </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> @@ -474,6 +467,13 @@ Resizes the array to contain a different number of elements. If the array size is smaller, elements are cleared, if bigger, new elements are [code]null[/code]. </description> </method> + <method name="reverse"> + <return type="void"> + </return> + <description> + Reverses the order of the elements in the array. + </description> + </method> <method name="rfind" qualifiers="const"> <return type="int"> </return> diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml index e2c4ed1430..7c1c4656f8 100644 --- a/doc/classes/ArrayMesh.xml +++ b/doc/classes/ArrayMesh.xml @@ -128,6 +128,16 @@ Will regenerate normal maps for the [ArrayMesh]. </description> </method> + <method name="set_blend_shape_name"> + <return type="void"> + </return> + <argument index="0" name="index" type="int"> + </argument> + <argument index="1" name="name" type="StringName"> + </argument> + <description> + </description> + </method> <method name="surface_find_by_name" qualifiers="const"> <return type="int"> </return> diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index b01af71852..4d0e11fb19 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -48,6 +48,14 @@ [b]Note:[/b] This returns the main editor control containing the whole editor, not the 2D or 3D viewports specifically. </description> </method> + <method name="get_editor_scale" qualifiers="const"> + <return type="float"> + </return> + <description> + Returns the actual scale of the editor UI ([code]1.0[/code] being 100% scale). This can be used to adjust position and dimensions of the UI added by plugins. + [b]Note:[/b] This value is set via the [code]interface/editor/display_scale[/code] and [code]interface/editor/custom_display_scale[/code] editor settings. Editor must be restarted for changes to be properly applied. + </description> + </method> <method name="get_editor_settings"> <return type="EditorSettings"> </return> diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index 8dcffb0b74..61f1761249 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -214,7 +214,7 @@ [gdscript] func forward_canvas_draw_over_viewport(overlay): # Draw a circle at cursor position. - overlay.draw_circle(overlay.get_local_mouse_position(), 64) + overlay.draw_circle(overlay.get_local_mouse_position(), 64, Color.white) func forward_canvas_gui_input(event): if event is InputEventMouseMotion: diff --git a/doc/classes/PackedByteArray.xml b/doc/classes/PackedByteArray.xml index a668c09fda..21f835a53c 100644 --- a/doc/classes/PackedByteArray.xml +++ b/doc/classes/PackedByteArray.xml @@ -157,13 +157,6 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). </description> </method> - <method name="reverse"> - <return type="void"> - </return> - <description> - Reverses the order of the elements in the array. - </description> - </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> @@ -230,6 +223,13 @@ Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. </description> </method> + <method name="reverse"> + <return type="void"> + </return> + <description> + Reverses the order of the elements in the array. + </description> + </method> <method name="set"> <return type="void"> </return> diff --git a/doc/classes/PackedColorArray.xml b/doc/classes/PackedColorArray.xml index 99b0f0486a..38240b3154 100644 --- a/doc/classes/PackedColorArray.xml +++ b/doc/classes/PackedColorArray.xml @@ -79,13 +79,6 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). </description> </method> - <method name="reverse"> - <return type="void"> - </return> - <description> - Reverses the order of the elements in the array. - </description> - </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> @@ -152,6 +145,13 @@ Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. </description> </method> + <method name="reverse"> + <return type="void"> + </return> + <description> + Reverses the order of the elements in the array. + </description> + </method> <method name="set"> <return type="void"> </return> diff --git a/doc/classes/PackedFloat32Array.xml b/doc/classes/PackedFloat32Array.xml index 99c2d3cf7e..6be1d24b5d 100644 --- a/doc/classes/PackedFloat32Array.xml +++ b/doc/classes/PackedFloat32Array.xml @@ -80,13 +80,6 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). </description> </method> - <method name="reverse"> - <return type="void"> - </return> - <description> - Reverses the order of the elements in the array. - </description> - </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> @@ -145,6 +138,13 @@ Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. </description> </method> + <method name="reverse"> + <return type="void"> + </return> + <description> + Reverses the order of the elements in the array. + </description> + </method> <method name="set"> <return type="void"> </return> diff --git a/doc/classes/PackedFloat64Array.xml b/doc/classes/PackedFloat64Array.xml index 5a6d4a48c4..fb7817cb41 100644 --- a/doc/classes/PackedFloat64Array.xml +++ b/doc/classes/PackedFloat64Array.xml @@ -80,13 +80,6 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). </description> </method> - <method name="reverse"> - <return type="void"> - </return> - <description> - Reverses the order of the elements in the array. - </description> - </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> @@ -153,6 +146,13 @@ Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. </description> </method> + <method name="reverse"> + <return type="void"> + </return> + <description> + Reverses the order of the elements in the array. + </description> + </method> <method name="set"> <return type="void"> </return> diff --git a/doc/classes/PackedInt32Array.xml b/doc/classes/PackedInt32Array.xml index a6cf311bc2..4ee428dfbc 100644 --- a/doc/classes/PackedInt32Array.xml +++ b/doc/classes/PackedInt32Array.xml @@ -80,13 +80,6 @@ Inserts a new integer at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). </description> </method> - <method name="reverse"> - <return type="void"> - </return> - <description> - Reverses the order of the elements in the array. - </description> - </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> @@ -153,6 +146,13 @@ Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. </description> </method> + <method name="reverse"> + <return type="void"> + </return> + <description> + Reverses the order of the elements in the array. + </description> + </method> <method name="set"> <return type="void"> </return> diff --git a/doc/classes/PackedInt64Array.xml b/doc/classes/PackedInt64Array.xml index 05c7c0e072..51948fcbc8 100644 --- a/doc/classes/PackedInt64Array.xml +++ b/doc/classes/PackedInt64Array.xml @@ -80,13 +80,6 @@ Inserts a new integer at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). </description> </method> - <method name="reverse"> - <return type="void"> - </return> - <description> - Reverses the order of the elements in the array. - </description> - </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> @@ -153,6 +146,13 @@ Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. </description> </method> + <method name="reverse"> + <return type="void"> + </return> + <description> + Reverses the order of the elements in the array. + </description> + </method> <method name="set"> <return type="void"> </return> diff --git a/doc/classes/PackedStringArray.xml b/doc/classes/PackedStringArray.xml index 9a2ea21624..9748301dae 100644 --- a/doc/classes/PackedStringArray.xml +++ b/doc/classes/PackedStringArray.xml @@ -80,13 +80,6 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). </description> </method> - <method name="reverse"> - <return type="void"> - </return> - <description> - Reverses the order of the elements in the array. - </description> - </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> @@ -153,6 +146,13 @@ Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. </description> </method> + <method name="reverse"> + <return type="void"> + </return> + <description> + Reverses the order of the elements in the array. + </description> + </method> <method name="set"> <return type="void"> </return> diff --git a/doc/classes/PackedVector2Array.xml b/doc/classes/PackedVector2Array.xml index 7549d4a029..1b3201b072 100644 --- a/doc/classes/PackedVector2Array.xml +++ b/doc/classes/PackedVector2Array.xml @@ -80,13 +80,6 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). </description> </method> - <method name="reverse"> - <return type="void"> - </return> - <description> - Reverses the order of the elements in the array. - </description> - </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> @@ -161,6 +154,13 @@ Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. </description> </method> + <method name="reverse"> + <return type="void"> + </return> + <description> + Reverses the order of the elements in the array. + </description> + </method> <method name="set"> <return type="void"> </return> diff --git a/doc/classes/PackedVector3Array.xml b/doc/classes/PackedVector3Array.xml index a55d2eeaed..25d854016a 100644 --- a/doc/classes/PackedVector3Array.xml +++ b/doc/classes/PackedVector3Array.xml @@ -79,13 +79,6 @@ Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]). </description> </method> - <method name="reverse"> - <return type="void"> - </return> - <description> - Reverses the order of the elements in the array. - </description> - </method> <method name="is_empty" qualifiers="const"> <return type="bool"> </return> @@ -160,6 +153,13 @@ Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. </description> </method> + <method name="reverse"> + <return type="void"> + </return> + <description> + Reverses the order of the elements in the array. + </description> + </method> <method name="set"> <return type="void"> </return> diff --git a/doc/classes/Skeleton3D.xml b/doc/classes/Skeleton3D.xml index cb72ae7e4c..c6dd6fb142 100644 --- a/doc/classes/Skeleton3D.xml +++ b/doc/classes/Skeleton3D.xml @@ -245,6 +245,16 @@ [b]Note[/b]: The pose transform needs to be in bone space. Use [method world_transform_to_bone_transform] to convert a world transform, like one you can get from a [Node3D], to bone space. </description> </method> + <method name="set_bone_name"> + <return type="void"> + </return> + <argument index="0" name="bone_idx" type="int"> + </argument> + <argument index="1" name="name" type="String"> + </argument> + <description> + </description> + </method> <method name="set_bone_parent"> <return type="void"> </return> diff --git a/doc/classes/StreamPeerTCP.xml b/doc/classes/StreamPeerTCP.xml index bb85d94bf9..b6d91715ee 100644 --- a/doc/classes/StreamPeerTCP.xml +++ b/doc/classes/StreamPeerTCP.xml @@ -61,8 +61,8 @@ <argument index="0" name="enabled" type="bool"> </argument> <description> - Disables Nagle's algorithm to improve latency for small packets. - [b]Note:[/b] For applications that send large packets or need to transfer a lot of data, this can decrease the total available bandwidth. + If [code]enabled[/code] is [code]true[/code], packets will be sent immediately. If [code]enabled[/code] is [code]false[/code] (the default), packet transfers will be delayed and combined using [url=https://en.wikipedia.org/wiki/Nagle%27s_algorithm]Nagle's algorithm[/url]. + [b]Note:[/b] It's recommended to leave this disabled for applications that send large packets or need to transfer a lot of data, as enabling this can decrease the total available bandwidth. </description> </method> </methods> diff --git a/doc/classes/Texture2D.xml b/doc/classes/Texture2D.xml index b648098a94..c33f32c9e4 100644 --- a/doc/classes/Texture2D.xml +++ b/doc/classes/Texture2D.xml @@ -63,18 +63,18 @@ Draws a part of the texture using a [CanvasItem] with the [RenderingServer] API. </description> </method> - <method name="get_image" qualifiers="const"> - <return type="Image"> + <method name="get_height" qualifiers="const"> + <return type="int"> </return> <description> - Returns an [Image] that is a copy of data from this [Texture2D]. [Image]s can be accessed and manipulated directly. + Returns the texture height. </description> </method> - <method name="get_height" qualifiers="const"> - <return type="int"> + <method name="get_image" qualifiers="const"> + <return type="Image"> </return> <description> - Returns the texture height. + Returns an [Image] that is a copy of data from this [Texture2D]. [Image]s can be accessed and manipulated directly. </description> </method> <method name="get_size" qualifiers="const"> diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 7ed8ad6d4a..205b342ba8 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -174,7 +174,7 @@ Overriding this method also overrides it internally, allowing custom logic to be implemented when tiles are placed/removed: [codeblocks] [gdscript] - func set_cell(x, y, tile, flip_x=false, flip_y=false, transpose=false, autotile_coord=Vector2()) + func set_cell(x, y, tile, flip_x=false, flip_y=false, transpose=false, autotile_coord=Vector2()): # Write your custom logic here. # To call the default method: .set_cell(x, y, tile, flip_x, flip_y, transpose, autotile_coord) diff --git a/doc/classes/VisualShaderNodeComment.xml b/doc/classes/VisualShaderNodeComment.xml new file mode 100644 index 0000000000..8970e2fabb --- /dev/null +++ b/doc/classes/VisualShaderNodeComment.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VisualShaderNodeComment" inherits="VisualShaderNodeResizableBase" version="4.0"> + <brief_description> + A comment node to be placed on visual shader graph. + </brief_description> + <description> + A resizable rectangular area with changeable [member title] and [member description] used for better organizing of other visual shader nodes. + </description> + <tutorials> + </tutorials> + <methods> + </methods> + <members> + <member name="description" type="String" setter="set_description" getter="get_description" default=""""> + An additional description which placed below the title. + </member> + <member name="title" type="String" setter="set_title" getter="get_title" default=""Comment""> + A title of the node. + </member> + </members> + <constants> + </constants> +</class> diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 178110b9e6..504e63392f 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -505,7 +505,7 @@ Error VulkanContext::_check_capabilities() { if (func != nullptr) { VkPhysicalDeviceSubgroupProperties subgroupProperties; subgroupProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES; - subgroupProperties.pNext = NULL; + subgroupProperties.pNext = nullptr; VkPhysicalDeviceProperties2 physicalDeviceProperties; physicalDeviceProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; @@ -993,14 +993,37 @@ Error VulkanContext::_initialize_queues(VkSurfaceKHR surface) { // supported format will be returned. if (formatCount == 1 && surfFormats[0].format == VK_FORMAT_UNDEFINED) { format = VK_FORMAT_B8G8R8A8_UNORM; + color_space = surfFormats[0].colorSpace; } else { + // These should be ordered with the ones we want to use on top and fallback modes further down + // we want an 32bit RGBA unsigned normalised buffer or similar + const VkFormat allowed_formats[] = { + VK_FORMAT_B8G8R8A8_UNORM, + VK_FORMAT_R8G8B8A8_UNORM + }; + uint32_t allowed_formats_count = sizeof(allowed_formats) / sizeof(VkFormat); + if (formatCount < 1) { free(surfFormats); ERR_FAIL_V_MSG(ERR_CANT_CREATE, "formatCount less than 1"); } - format = surfFormats[0].format; + + // Find the first format that we support + format = VK_FORMAT_UNDEFINED; + for (uint32_t af = 0; af < allowed_formats_count && format == VK_FORMAT_UNDEFINED; af++) { + for (uint32_t sf = 0; sf < formatCount && format == VK_FORMAT_UNDEFINED; sf++) { + if (surfFormats[sf].format == allowed_formats[af]) { + format = surfFormats[sf].format; + color_space = surfFormats[sf].colorSpace; + } + } + } + + if (format == VK_FORMAT_UNDEFINED) { + free(surfFormats); + ERR_FAIL_V_MSG(ERR_CANT_CREATE, "No usable surface format found."); + } } - color_space = surfFormats[0].colorSpace; free(surfFormats); diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 92b4683018..ab8ae71904 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -602,6 +602,8 @@ void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int } void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (p_event->is_pressed()) { if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) { duplicate_selection(); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 4274fb993f..4fe2d2bb2a 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1641,6 +1641,8 @@ void AnimationTimelineEdit::_play_position_draw() { } void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) { @@ -2522,6 +2524,8 @@ String AnimationTrackEdit::get_tooltip(const Point2 &p_pos) const { } void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (p_event->is_pressed()) { if (ED_GET_SHORTCUT("animation_editor/duplicate_selection")->is_shortcut(p_event)) { emit_signal("duplicate_request"); diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 1028d34fb2..506a327ffc 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -1036,6 +1036,8 @@ void AnimationTrackEditTypeAudio::drop_data(const Point2 &p_point, const Variant } void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseMotion> mm = p_event; if (!len_resizing && mm.is_valid()) { bool use_hsize_cursor = false; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 11be365f0a..ac8bef817b 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -109,6 +109,8 @@ void FindReplaceBar::_notification(int p_what) { } void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventKey> k = p_event; if (!k.is_valid() || !k->is_pressed()) { return; @@ -691,6 +693,8 @@ FindReplaceBar::FindReplaceBar() { // This function should be used to handle shortcuts that could otherwise // be handled too late if they weren't handled here. void CodeTextEditor::_input(const Ref<InputEvent> &event) { + ERR_FAIL_COND(event.is_null()); + const Ref<InputEventKey> key_event = event; if (!key_event.is_valid() || !key_event->is_pressed() || !text_editor->has_focus()) { return; diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 3a5ebe8e85..e7934bed0a 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -531,6 +531,8 @@ void EditorAudioBus::_effect_add(int p_which) { } void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) { Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y); diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index f78da9569f..75815fa750 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -125,6 +125,8 @@ void EditorFileDialog::_notification(int p_what) { } void EditorFileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventKey> k = p_event; if (k.is_valid()) { diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 283713cd3c..a747652a2f 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -1908,6 +1908,8 @@ void FindBar::_hide_bar() { } void FindBar::_unhandled_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventKey> k = p_event; if (k.is_valid()) { if (k->is_pressed() && (rich_text_label->has_focus() || is_a_parent_of(get_focus_owner()))) { diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 70d1a514b5..738b2f9f82 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -682,6 +682,8 @@ bool EditorProperty::is_selected() const { } void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (property == StringName()) { return; } @@ -1354,6 +1356,8 @@ void EditorInspectorSection::setup(const String &p_section, const String &p_labe } void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!foldable) { return; } @@ -2566,9 +2570,9 @@ void EditorInspector::_update_script_class_properties(const Object &p_object, Li } // Script Variables -> to insert: NodeC..B..A -> bottom (insert_here) - List<PropertyInfo>::Element *script_variables = NULL; - List<PropertyInfo>::Element *bottom = NULL; - List<PropertyInfo>::Element *insert_here = NULL; + List<PropertyInfo>::Element *script_variables = nullptr; + List<PropertyInfo>::Element *bottom = nullptr; + List<PropertyInfo>::Element *insert_here = nullptr; for (List<PropertyInfo>::Element *E = r_list.front(); E; E = E->next()) { PropertyInfo &pi = E->get(); if (pi.name != "Script Variables") { diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 21f1d05304..9ca46cfcc0 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -390,6 +390,8 @@ void EditorNode::_update_title() { } void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventKey> k = p_event; if (k.is_valid() && k->is_pressed() && !k->is_echo()) { EditorPlugin *old_editor = editor_plugin_screen; @@ -792,17 +794,27 @@ void EditorNode::_fs_changed() { } preset.unref(); } + if (preset.is_null()) { - export_error = vformat( - "Invalid export preset name: %s. Make sure `export_presets.cfg` is present in the current directory.", - preset_name); + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + if (da->file_exists("res://export_presets.cfg")) { + export_error = vformat( + "Invalid export preset name: %s.\nThe following presets were detected in this project's `export_presets.cfg`:\n\n", + preset_name); + for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) { + // Write the preset name between double quotes since it needs to be written between quotes on the command line if it contains spaces. + export_error += vformat(" \"%s\"\n", EditorExport::get_singleton()->get_export_preset(i)->get_name()); + } + } else { + export_error = "This project doesn't have an `export_presets.cfg` file at its root.\nCreate an export preset from the \"Project > Export\" dialog and try again."; + } } else { Ref<EditorExportPlatform> platform = preset->get_platform(); const String export_path = export_defer.path.is_empty() ? preset->get_export_path() : export_defer.path; if (export_path.is_empty()) { - export_error = vformat("Export preset '%s' doesn't have a default export path, and none was specified.", preset_name); + export_error = vformat("Export preset \"%s\" doesn't have a default export path, and none was specified.", preset_name); } else if (platform.is_null()) { - export_error = vformat("Export preset '%s' doesn't have a matching platform.", preset_name); + export_error = vformat("Export preset \"%s\" doesn't have a matching platform.", preset_name); } else { Error err = OK; if (export_defer.pack_only) { // Only export .pck or .zip data pack. @@ -815,7 +827,7 @@ void EditorNode::_fs_changed() { String config_error; bool missing_templates; if (!platform->can_export(preset, config_error, missing_templates)) { - ERR_PRINT(vformat("Cannot export project with preset '%s' due to configuration errors:\n%s", preset_name, config_error)); + ERR_PRINT(vformat("Cannot export project with preset \"%s\" due to configuration errors:\n%s", preset_name, config_error)); err = missing_templates ? ERR_FILE_NOT_FOUND : ERR_UNCONFIGURED; } else { err = platform->export_project(preset, export_defer.debug, export_path); @@ -825,13 +837,13 @@ void EditorNode::_fs_changed() { case OK: break; case ERR_FILE_NOT_FOUND: - export_error = vformat("Project export failed for preset '%s', the export template appears to be missing.", preset_name); + export_error = vformat("Project export failed for preset \"%s\". The export template appears to be missing.", preset_name); break; case ERR_FILE_BAD_PATH: - export_error = vformat("Project export failed for preset '%s', the target path '%s' appears to be invalid.", preset_name, export_path); + export_error = vformat("Project export failed for preset \"%s\". The target path \"%s\" appears to be invalid.", preset_name, export_path); break; default: - export_error = vformat("Project export failed with error code %d for preset '%s'.", (int)err, preset_name); + export_error = vformat("Project export failed with error code %d for preset \"%s\".", (int)err, preset_name); break; } } @@ -1377,7 +1389,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { // which would result in an invalid texture. if (c3d == 0 && c2d == 0) { img.instance(); - img->create(1, 1, 0, Image::FORMAT_RGB8); + img->create(1, 1, false, Image::FORMAT_RGB8); } else if (c3d < c2d) { Ref<ViewportTexture> viewport_texture = scene_root->get_texture(); if (viewport_texture->get_width() > 0 && viewport_texture->get_height() > 0) { diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index c0cecbc651..064271fce8 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -262,6 +262,10 @@ Control *EditorInterface::get_base_control() { return EditorNode::get_singleton()->get_gui_base(); } +float EditorInterface::get_editor_scale() const { + return EDSCALE; +} + void EditorInterface::set_plugin_enabled(const String &p_plugin, bool p_enabled) { EditorNode::get_singleton()->set_addon_plugin_enabled(p_plugin, p_enabled, true); } @@ -306,6 +310,7 @@ void EditorInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("get_editor_settings"), &EditorInterface::get_editor_settings); ClassDB::bind_method(D_METHOD("get_script_editor"), &EditorInterface::get_script_editor); ClassDB::bind_method(D_METHOD("get_base_control"), &EditorInterface::get_base_control); + ClassDB::bind_method(D_METHOD("get_editor_scale"), &EditorInterface::get_editor_scale); ClassDB::bind_method(D_METHOD("edit_resource", "resource"), &EditorInterface::edit_resource); ClassDB::bind_method(D_METHOD("open_scene_from_path", "scene_filepath"), &EditorInterface::open_scene_from_path); ClassDB::bind_method(D_METHOD("reload_scene_from_path", "scene_filepath"), &EditorInterface::reload_scene_from_path); diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index ae9fcfb28a..b0713c641b 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -100,6 +100,7 @@ public: FileSystemDock *get_file_system_dock(); Control *get_base_control(); + float get_editor_scale() const; void set_plugin_enabled(const String &p_plugin, bool p_enabled); bool is_plugin_enabled(const String &p_plugin) const; diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index f46d677aec..fa44239e32 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -649,14 +649,16 @@ public: Color color = get_theme_color("highlight_color", "Editor"); for (int i = 0; i < 2; i++) { Point2 ofs(4, vofs); - if (i == 1) + if (i == 1) { ofs.y += bsize + 1; + } ofs += rect.position; for (int j = 0; j < 10; j++) { Point2 o = ofs + Point2(j * (bsize + 1), 0); - if (j >= 5) + if (j >= 5) { o.x += 1; + } const int idx = i * 10 + j; const bool on = value & (1 << idx); @@ -3282,7 +3284,7 @@ void EditorInspectorDefaultPlugin::parse_begin(Object *p_object) { } bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Type p_type, const String &p_path, PropertyHint p_hint, const String &p_hint_text, int p_usage, bool p_wide) { - float default_float_step = EDITOR_GET("interface/inspector/default_float_step"); + double default_float_step = EDITOR_GET("interface/inspector/default_float_step"); switch (p_type) { // atomic types diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index c09d78826c..8577ccb9db 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -47,6 +47,8 @@ String EditorSpinSlider::get_text_value() const { } void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (read_only) { return; } diff --git a/editor/editor_translation_parser.cpp b/editor/editor_translation_parser.cpp index 51bd9b3383..fd36372dde 100644 --- a/editor/editor_translation_parser.cpp +++ b/editor/editor_translation_parser.cpp @@ -38,8 +38,9 @@ EditorTranslationParser *EditorTranslationParser::singleton = nullptr; Error EditorTranslationParserPlugin::parse_file(const String &p_path, Vector<String> *r_ids, Vector<Vector<String>> *r_ids_ctx_plural) { - if (!get_script_instance()) + if (!get_script_instance()) { return ERR_UNAVAILABLE; + } if (get_script_instance()->has_method("parse_file")) { Array ids; @@ -70,8 +71,9 @@ Error EditorTranslationParserPlugin::parse_file(const String &p_path, Vector<Str } void EditorTranslationParserPlugin::get_recognized_extensions(List<String> *r_extensions) const { - if (!get_script_instance()) + if (!get_script_instance()) { return; + } if (get_script_instance()->has_method("get_recognized_extensions")) { Array extensions = get_script_instance()->call("get_recognized_extensions"); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index d6ae901ca9..899070f036 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2621,8 +2621,9 @@ void FileSystemDock::_get_imported_files(const String &p_path, Vector<String> &f } void FileSystemDock::_update_import_dock() { - if (!import_dock_needs_update) + if (!import_dock_needs_update) { return; + } // List selected. Vector<String> selected; @@ -2633,8 +2634,9 @@ void FileSystemDock::_update_import_dock() { } else { // Use the file list. for (int i = 0; i < files->get_item_count(); i++) { - if (!files->is_selected(i)) + if (!files->is_selected(i)) { continue; + } selected.push_back(files->get_item_metadata(i)); } diff --git a/editor/icons/GuiScrollBg.svg b/editor/icons/GuiScrollBg.svg index dd5c60e534..7cfe647368 100644 --- a/editor/icons/GuiScrollBg.svg +++ b/editor/icons/GuiScrollBg.svg @@ -1 +1 @@ -<svg height="12" viewBox="0 0 12 11.999999" width="12" xmlns="http://www.w3.org/2000/svg"/> +<svg height="12" viewBox="0 0 12 11.999999" width="12" xmlns="http://www.w3.org/2000/svg"><circle cx="6" cy="6" fill="#fff" fill-opacity=".082353" r="2"/></svg> diff --git a/editor/icons/GuiScrollGrabber.svg b/editor/icons/GuiScrollGrabber.svg index 16edfb567c..935f9361dd 100644 --- a/editor/icons/GuiScrollGrabber.svg +++ b/editor/icons/GuiScrollGrabber.svg @@ -1 +1 @@ -<svg height="12" viewBox="0 0 12 11.999999" width="12" xmlns="http://www.w3.org/2000/svg"><circle cx="6" cy="6" fill="#fff" fill-opacity=".27451" r="2"/></svg> +<svg height="12" viewBox="0 0 12 11.999999" width="12" xmlns="http://www.w3.org/2000/svg"><circle cx="6" cy="6" fill="#fff" fill-opacity=".294118" r="3"/></svg> diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index 080393e570..d3183e5a8d 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -1688,7 +1688,7 @@ Node *EditorSceneImporterCollada::import_scene(const String &p_path, uint32_t p_ state.use_mesh_builtin_materials = true; state.bake_fps = p_bake_fps; - Error err = state.load(p_path, flags, p_flags & EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS, 0); + Error err = state.load(p_path, flags, p_flags & EditorSceneImporter::IMPORT_GENERATE_TANGENT_ARRAYS, false); if (r_err) { *r_err = err; diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp index 5c522e3176..dd62c72d8a 100644 --- a/editor/import/resource_importer_obj.cpp +++ b/editor/import/resource_importer_obj.cpp @@ -427,7 +427,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh>> &r_meshes, bool p_ Node *EditorOBJImporter::import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err) { List<Ref<Mesh>> meshes; - Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, 0, Vector3(1, 1, 1), Vector3(0, 0, 0), r_missing_deps); + Error err = _parse_obj(p_path, meshes, false, p_flags & IMPORT_GENERATE_TANGENT_ARRAYS, false, Vector3(1, 1, 1), Vector3(0, 0, 0), r_missing_deps); if (err != OK) { if (r_err) { diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 03481dfb38..612a8f30a4 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -1219,6 +1219,8 @@ void AnimationPlayerEditor::_onion_skinning_menu(int p_option) { } void AnimationPlayerEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + Ref<InputEventKey> k = p_ev; if (is_visible_in_tree() && k.is_valid() && k->is_pressed() && !k->is_echo() && !k->get_alt() && !k->get_control() && !k->get_metakey()) { switch (k->get_keycode()) { diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 1345adc8ee..fd47d9964e 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -557,8 +557,15 @@ void EditorAssetLibrary::_notification(int p_what) { error_label->raise(); } break; case NOTIFICATION_VISIBILITY_CHANGED: { - if (is_visible() && initial_loading) { - _repository_changed(0); // Update when shown for the first time. + if (is_visible()) { + // Focus the search box automatically when switching to the Templates tab (in the Project Manager) + // or switching to the AssetLib tab (in the editor). + // The Project Manager's project filter box is automatically focused in the project manager code. + filter->grab_focus(); + + if (initial_loading) { + _repository_changed(0); // Update when shown for the first time. + } } } break; case NOTIFICATION_PROCESS: { @@ -606,6 +613,8 @@ void EditorAssetLibrary::_update_repository_options() { } void EditorAssetLibrary::_unhandled_key_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + const Ref<InputEventKey> key = p_event; if (key.is_valid() && key->is_pressed()) { @@ -1332,6 +1341,11 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) { library_main->add_theme_constant_override("separation", 10 * EDSCALE); filter = memnew(LineEdit); + if (templates_only) { + filter->set_placeholder(TTR("Search templates, projects, and demos")); + } else { + filter->set_placeholder(TTR("Search assets (excluding templates, projects, and demos)")); + } search_hb->add_child(filter); filter->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter->connect("text_changed", callable_mp(this, &EditorAssetLibrary::_search_text_changed)); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index d4e06aa9ca..b678197037 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -472,6 +472,8 @@ float CanvasItemEditor::snap_angle(float p_target, float p_start) const { } void CanvasItemEditor::_unhandled_key_input(const Ref<InputEvent> &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + Ref<InputEventKey> k = p_ev; if (!is_visible_in_tree()) { diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index 77719104b1..9d29c31522 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -33,6 +33,8 @@ #include "editor/editor_scale.h" void MeshEditor::_gui_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseMotion> mm = p_event; if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { rot_x -= mm->get_relative().y * 0.01; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 81c59fc0a9..25fb637fb8 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -185,6 +185,8 @@ void ViewportRotationControl::_get_sorted_axis(Vector<Axis2D> &r_axis) { } void ViewportRotationControl::_gui_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + const Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { Vector2 pos = mb->get_position(); @@ -1277,7 +1279,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { clicked = ObjectID(); clicked_includes_current = false; - if ((spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT && b->get_control()) || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE) { + if ((spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_SELECT && b->get_command()) || spatial_editor->get_tool_mode() == Node3DEditor::TOOL_MODE_ROTATE) { /* HANDLE ROTATION */ if (get_selected_count() == 0) { break; //bye @@ -1472,7 +1474,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { Vector3 ray_pos = _get_ray_pos(m->get_position()); Vector3 ray = _get_ray(m->get_position()); - float snap = EDITOR_GET("interface/inspector/default_float_step"); + double snap = EDITOR_GET("interface/inspector/default_float_step"); int snap_step_decimals = Math::range_step_decimals(snap); switch (_edit.mode) { @@ -1766,7 +1768,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) { Vector3 y_axis = (click - _edit.center).normalized(); Vector3 x_axis = plane.normal.cross(y_axis).normalized(); - float angle = Math::atan2(x_axis.dot(intersection - _edit.center), y_axis.dot(intersection - _edit.center)); + double angle = Math::atan2(x_axis.dot(intersection - _edit.center), y_axis.dot(intersection - _edit.center)); if (_edit.snap || spatial_editor->is_snap_enabled()) { snap = spatial_editor->get_rotate_snap(); @@ -2213,6 +2215,12 @@ void Node3DEditorViewport::scale_cursor_distance(real_t scale) { cursor.distance = CLAMP(cursor.distance * scale, min_distance, max_distance); } + if (cursor.distance == max_distance || cursor.distance == min_distance) { + zoom_failed_attempts_count++; + } else { + zoom_failed_attempts_count = 0; + } + zoom_indicator_delay = ZOOM_FREELOOK_INDICATOR_DELAY_S; surface->update(); } @@ -2394,6 +2402,7 @@ void Node3DEditorViewport::_notification(int p_what) { zoom_indicator_delay -= delta; if (zoom_indicator_delay <= 0) { surface->update(); + zoom_limit_label->hide(); } } @@ -2533,6 +2542,8 @@ void Node3DEditorViewport::_notification(int p_what) { cpu_time += cpu_time_history[i]; } cpu_time /= FRAME_TIME_HISTORY; + // Prevent unrealistically low values. + cpu_time = MAX(0.01, cpu_time); gpu_time_history[gpu_time_history_index] = RS::get_singleton()->viewport_get_measured_render_time_gpu(viewport->get_viewport_rid()); gpu_time_history_index = (gpu_time_history_index + 1) % FRAME_TIME_HISTORY; @@ -2541,16 +2552,19 @@ void Node3DEditorViewport::_notification(int p_what) { gpu_time += gpu_time_history[i]; } gpu_time /= FRAME_TIME_HISTORY; + // Prevent division by zero for the FPS counter (and unrealistically low values). + // This limits the reported FPS to 100000. + gpu_time = MAX(0.01, gpu_time); // Color labels depending on performance level ("good" = green, "OK" = yellow, "bad" = red). // Middle point is at 15 ms. - cpu_time_label->set_text(vformat(TTR("CPU Time: %s ms"), String::num(cpu_time, 1))); + cpu_time_label->set_text(vformat(TTR("CPU Time: %s ms"), rtos(cpu_time).pad_decimals(1))); cpu_time_label->add_theme_color_override( "font_color", frame_time_gradient->get_color_at_offset( Math::range_lerp(cpu_time, 0, 30, 0, 1))); - gpu_time_label->set_text(vformat(TTR("GPU Time: %s ms"), String::num(gpu_time, 1))); + gpu_time_label->set_text(vformat(TTR("GPU Time: %s ms"), rtos(gpu_time).pad_decimals(1))); // Middle point is at 15 ms. gpu_time_label->add_theme_color_override( "font_color", @@ -2768,6 +2782,7 @@ void Node3DEditorViewport::_draw() { } else { // Show zoom + zoom_limit_label->set_visible(zoom_failed_attempts_count > 15); real_t min_distance = MAX(camera->get_near() * 4, ZOOM_FREELOOK_MIN); real_t max_distance = MIN(camera->get_far() / 4, ZOOM_FREELOOK_MAX); @@ -4130,6 +4145,15 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito locked_label->set_text(TTR("View Rotation Locked")); locked_label->hide(); + zoom_limit_label = memnew(Label); + zoom_limit_label->set_anchors_and_offsets_preset(LayoutPreset::PRESET_BOTTOM_LEFT); + zoom_limit_label->set_offset(Side::SIDE_TOP, -28 * EDSCALE); + zoom_limit_label->set_text(TTR("To zoom further, change the camera's clipping planes (View -> Settings...)")); + zoom_limit_label->set_name("ZoomLimitMessageLabel"); + zoom_limit_label->add_theme_color_override("font_color", Color(1, 1, 1, 1)); + zoom_limit_label->hide(); + surface->add_child(zoom_limit_label); + frame_time_gradient = memnew(Gradient); // The color is set when the theme changes. frame_time_gradient->add_point(0.5, Color()); @@ -4192,6 +4216,8 @@ Node3DEditorViewport::~Node3DEditorViewport() { ////////////////////////////////////////////////////////////// void Node3DEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { @@ -6159,6 +6185,8 @@ void Node3DEditor::snap_selected_nodes_to_floor() { } void Node3DEditor::_unhandled_key_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!is_visible_in_tree()) { return; } diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index ff4a941b06..70329f90c7 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -295,6 +295,7 @@ private: Label *info_label; Label *cinema_label; Label *locked_label; + Label *zoom_limit_label; VBoxContainer *top_right_vbox; ViewportRotationControl *rotation_control; @@ -418,6 +419,7 @@ private: void scale_freelook_speed(real_t scale); real_t zoom_indicator_delay; + int zoom_failed_attempts_count = 0; RID move_gizmo_instance[3], move_plane_gizmo_instance[3], rotate_gizmo_instance[4], scale_gizmo_instance[3], scale_plane_gizmo_instance[3]; diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index b298474406..58e6717a3d 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2706,6 +2706,8 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co } void ScriptEditor::_unhandled_key_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!is_visible_in_tree() || !p_event->is_pressed() || p_event->is_echo()) { return; } diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 121ccfa417..ad60984ad1 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -167,16 +167,18 @@ void BoneTransformEditor::_notification(int p_what) { } void BoneTransformEditor::_value_changed(const double p_value) { - if (updating) + if (updating) { return; + } Transform tform = compute_transform_from_vector3s(); _change_transform(tform); } void BoneTransformEditor::_value_changed_vector3(const String p_property_name, const Vector3 p_vector, const StringName p_edited_property_name, const bool p_boolean) { - if (updating) + if (updating) { return; + } Transform tform = compute_transform_from_vector3s(); _change_transform(tform); } @@ -194,8 +196,9 @@ Transform BoneTransformEditor::compute_transform_from_vector3s() const { } void BoneTransformEditor::_value_changed_transform(const String p_property_name, const Transform p_transform, const StringName p_edited_property_name, const bool p_boolean) { - if (updating) + if (updating) { return; + } _change_transform(p_transform); } @@ -222,11 +225,13 @@ void BoneTransformEditor::update_enabled_checkbox() { } void BoneTransformEditor::_update_properties() { - if (updating) + if (updating) { return; + } - if (skeleton == nullptr) + if (skeleton == nullptr) { return; + } updating = true; @@ -235,11 +240,13 @@ void BoneTransformEditor::_update_properties() { } void BoneTransformEditor::_update_custom_pose_properties() { - if (updating) + if (updating) { return; + } - if (skeleton == nullptr) + if (skeleton == nullptr) { return; + } updating = true; @@ -287,14 +294,16 @@ void BoneTransformEditor::set_toggle_enabled(const bool p_enabled) { } void BoneTransformEditor::_key_button_pressed() { - if (skeleton == nullptr) + if (skeleton == nullptr) { return; + } const BoneId bone_id = property.get_slicec('/', 1).to_int(); const String name = skeleton->get_bone_name(bone_id); - if (name.is_empty()) + if (name.is_empty()) { return; + } // Need to normalize the basis before you key it Transform tform = compute_transform_from_vector3s(); @@ -405,8 +414,9 @@ PhysicalBone3D *Skeleton3DEditor::create_physical_bone(int bone_id, int bone_chi Variant Skeleton3DEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) { TreeItem *selected = joint_tree->get_selected(); - if (!selected) + if (!selected) { return Variant(); + } Ref<Texture> icon = selected->get_icon(0); @@ -431,27 +441,32 @@ Variant Skeleton3DEditor::get_drag_data_fw(const Point2 &p_point, Control *p_fro bool Skeleton3DEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { TreeItem *target = joint_tree->get_item_at_position(p_point); - if (!target) + if (!target) { return false; + } const String path = target->get_metadata(0); - if (!path.begins_with("bones/")) + if (!path.begins_with("bones/")) { return false; + } TreeItem *selected = Object::cast_to<TreeItem>(Dictionary(p_data)["node"]); - if (target == selected) + if (target == selected) { return false; + } const String path2 = target->get_metadata(0); - if (!path2.begins_with("bones/")) + if (!path2.begins_with("bones/")) { return false; + } return true; } void Skeleton3DEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { - if (!can_drop_data_fw(p_point, p_data, p_from)) + if (!can_drop_data_fw(p_point, p_data, p_from)) { return; + } TreeItem *target = joint_tree->get_item_at_position(p_point); TreeItem *selected = Object::cast_to<TreeItem>(Dictionary(p_data)["node"]); @@ -510,19 +525,23 @@ void Skeleton3DEditor::_joint_tree_rmb_select(const Vector2 &p_pos) { } void Skeleton3DEditor::_update_properties() { - if (rest_editor) + if (rest_editor) { rest_editor->_update_properties(); - if (pose_editor) + } + if (pose_editor) { pose_editor->_update_properties(); - if (custom_pose_editor) + } + if (custom_pose_editor) { custom_pose_editor->_update_custom_pose_properties(); + } } void Skeleton3DEditor::update_joint_tree() { joint_tree->clear(); - if (skeleton == nullptr) + if (skeleton == nullptr) { return; + } TreeItem *root = joint_tree->create_item(); diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp index 265d4ccc1e..89ed98d53e 100644 --- a/editor/plugins/texture_layered_editor_plugin.cpp +++ b/editor/plugins/texture_layered_editor_plugin.cpp @@ -35,6 +35,8 @@ #include "editor/editor_settings.h" void TextureLayeredEditor::_gui_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseMotion> mm = p_event; if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { y_rot += -mm->get_relative().x * 0.01; diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 69bdc05b3a..b2fa9c540e 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -384,6 +384,20 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { port_offset += 2; } + if (is_resizable) { + Ref<VisualShaderNodeComment> comment_node = Object::cast_to<VisualShaderNodeComment>(vsnode.ptr()); + if (comment_node.is_valid()) { + node->set_comment(true); + + Label *comment_label = memnew(Label); + node->add_child(comment_label); + comment_label->set_h_size_flags(Control::SIZE_EXPAND_FILL); + comment_label->set_v_size_flags(Control::SIZE_EXPAND_FILL); + comment_label->set_mouse_filter(Control::MouseFilter::MOUSE_FILTER_STOP); + comment_label->set_text(comment_node->get_description()); + } + } + Ref<VisualShaderNodeUniform> uniform = vsnode; if (uniform.is_valid()) { VisualShaderEditor::get_singleton()->graph->add_child(node); @@ -1624,6 +1638,92 @@ void VisualShaderEditor::_preview_select_port(int p_node, int p_port) { undo_redo->commit_action(); } +void VisualShaderEditor::_comment_title_popup_show(const Point2 &p_position, int p_node_id) { + VisualShader::Type type = get_current_shader_type(); + Ref<VisualShaderNodeComment> node = visual_shader->get_node(type, p_node_id); + if (node.is_null()) { + return; + } + comment_title_change_edit->set_text(node->get_title()); + comment_title_change_popup->set_meta("id", p_node_id); + comment_title_change_popup->popup(); + comment_title_change_popup->set_position(p_position); +} + +void VisualShaderEditor::_comment_title_text_changed(const String &p_new_text) { + comment_title_change_edit->set_size(Size2(-1, -1)); + comment_title_change_popup->set_size(Size2(-1, -1)); +} + +void VisualShaderEditor::_comment_title_text_entered(const String &p_new_text) { + comment_title_change_popup->hide(); +} + +void VisualShaderEditor::_comment_title_popup_focus_out() { + comment_title_change_popup->hide(); +} + +void VisualShaderEditor::_comment_title_popup_hide() { + ERR_FAIL_COND(!comment_title_change_popup->has_meta("id")); + int node_id = (int)comment_title_change_popup->get_meta("id"); + + VisualShader::Type type = get_current_shader_type(); + Ref<VisualShaderNodeComment> node = visual_shader->get_node(type, node_id); + + ERR_FAIL_COND(node.is_null()); + + if (node->get_title() == comment_title_change_edit->get_text()) { + return; // nothing changed - ignored + } + undo_redo->create_action(TTR("Set Comment Node Title")); + undo_redo->add_do_method(node.ptr(), "set_title", comment_title_change_edit->get_text()); + undo_redo->add_undo_method(node.ptr(), "set_title", node->get_title()); + undo_redo->add_do_method(graph_plugin.ptr(), "update_node", (int)type, node_id); + undo_redo->add_undo_method(graph_plugin.ptr(), "update_node", (int)type, node_id); + undo_redo->commit_action(); +} + +void VisualShaderEditor::_comment_desc_popup_show(const Point2 &p_position, int p_node_id) { + VisualShader::Type type = get_current_shader_type(); + Ref<VisualShaderNodeComment> node = visual_shader->get_node(type, p_node_id); + if (node.is_null()) { + return; + } + comment_desc_change_edit->set_text(node->get_description()); + comment_desc_change_popup->set_meta("id", p_node_id); + comment_desc_change_popup->popup(); + comment_desc_change_popup->set_position(p_position); +} + +void VisualShaderEditor::_comment_desc_text_changed() { + comment_desc_change_edit->set_size(Size2(-1, -1)); + comment_desc_change_popup->set_size(Size2(-1, -1)); +} + +void VisualShaderEditor::_comment_desc_confirm() { + comment_desc_change_popup->hide(); +} + +void VisualShaderEditor::_comment_desc_popup_hide() { + ERR_FAIL_COND(!comment_desc_change_popup->has_meta("id")); + int node_id = (int)comment_desc_change_popup->get_meta("id"); + + VisualShader::Type type = get_current_shader_type(); + Ref<VisualShaderNodeComment> node = visual_shader->get_node(type, node_id); + + ERR_FAIL_COND(node.is_null()); + + if (node->get_description() == comment_desc_change_edit->get_text()) { + return; // nothing changed - ignored + } + undo_redo->create_action(TTR("Set Comment Node Description")); + undo_redo->add_do_method(node.ptr(), "set_description", comment_desc_change_edit->get_text()); + undo_redo->add_undo_method(node.ptr(), "set_description", node->get_title()); + undo_redo->add_do_method(graph_plugin.ptr(), "update_node", (int)type, node_id); + undo_redo->add_undo_method(graph_plugin.ptr(), "update_node", (int)type, node_id); + undo_redo->commit_action(); +} + void VisualShaderEditor::_uniform_line_edit_changed(const String &p_text, int p_node_id) { VisualShader::Type type = get_current_shader_type(); @@ -2507,6 +2607,7 @@ void VisualShaderEditor::_graph_gui_input(const Ref<InputEvent> &p_event) { if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) { selected_constants.clear(); selected_uniforms.clear(); + selected_comment = -1; List<int> to_change; for (int i = 0; i < graph->get_child_count(); i++) { @@ -2517,17 +2618,27 @@ void VisualShaderEditor::_graph_gui_input(const Ref<InputEvent> &p_event) { to_change.push_back(id); Ref<VisualShaderNode> node = visual_shader->get_node(type, id); - VisualShaderNodeConstant *cnode = Object::cast_to<VisualShaderNodeConstant>(node.ptr()); - if (cnode != nullptr) { + + VisualShaderNodeComment *comment_node = Object::cast_to<VisualShaderNodeComment>(node.ptr()); + if (comment_node != nullptr) { + selected_comment = id; + } + VisualShaderNodeConstant *constant_node = Object::cast_to<VisualShaderNodeConstant>(node.ptr()); + if (constant_node != nullptr) { selected_constants.insert(id); } - VisualShaderNodeUniform *unode = Object::cast_to<VisualShaderNodeUniform>(node.ptr()); - if (unode != nullptr) { + VisualShaderNodeUniform *uniform_node = Object::cast_to<VisualShaderNodeUniform>(node.ptr()); + if (uniform_node != nullptr && uniform_node->is_convertible_to_constant()) { selected_uniforms.insert(id); } } } } + + if (to_change.size() > 1) { + selected_comment = -1; + } + if (to_change.is_empty() && copy_nodes_buffer.is_empty()) { _show_members_dialog(true); } else { @@ -2548,16 +2659,34 @@ void VisualShaderEditor::_graph_gui_input(const Ref<InputEvent> &p_event) { if (temp != -1) { popup_menu->remove_item(temp); } + temp = popup_menu->get_item_index(NodeMenuOptions::SEPARATOR3); + if (temp != -1) { + popup_menu->remove_item(temp); + } + temp = popup_menu->get_item_index(NodeMenuOptions::SET_COMMENT_TITLE); + if (temp != -1) { + popup_menu->remove_item(temp); + } + temp = popup_menu->get_item_index(NodeMenuOptions::SET_COMMENT_DESCRIPTION); + if (temp != -1) { + popup_menu->remove_item(temp); + } - if (selected_constants.size() > 0 || selected_uniforms.size() > 0) { + if (selected_comment != -1) { popup_menu->add_separator("", NodeMenuOptions::SEPARATOR2); + popup_menu->add_item(TTR("Set Comment Title"), NodeMenuOptions::SET_COMMENT_TITLE); + popup_menu->add_item(TTR("Set Comment Description"), NodeMenuOptions::SET_COMMENT_DESCRIPTION); + } + + if (selected_constants.size() > 0 || selected_uniforms.size() > 0) { + popup_menu->add_separator("", NodeMenuOptions::SEPARATOR3); if (selected_constants.size() > 0) { popup_menu->add_item(TTR("Convert Constant(s) to Uniform(s)"), NodeMenuOptions::CONVERT_CONSTANTS_TO_UNIFORMS); } if (selected_uniforms.size() > 0) { - popup_menu->add_item(TTR("Convert Uniforms(s) to Constant(s)"), NodeMenuOptions::CONVERT_UNIFORMS_TO_CONSTANTS); + popup_menu->add_item(TTR("Convert Uniform(s) to Constant(s)"), NodeMenuOptions::CONVERT_UNIFORMS_TO_CONSTANTS); } } @@ -3111,6 +3240,12 @@ void VisualShaderEditor::_node_menu_id_pressed(int p_idx) { case NodeMenuOptions::CONVERT_UNIFORMS_TO_CONSTANTS: _convert_constants_to_uniforms(true); break; + case NodeMenuOptions::SET_COMMENT_TITLE: + _comment_title_popup_show(get_global_mouse_position(), selected_comment); + break; + case NodeMenuOptions::SET_COMMENT_DESCRIPTION: + _comment_desc_popup_show(get_global_mouse_position(), selected_comment); + break; default: break; } @@ -3534,6 +3669,35 @@ VisualShaderEditor::VisualShaderEditor() { alert->get_label()->set_custom_minimum_size(Size2(400, 60) * EDSCALE); add_child(alert); + comment_title_change_popup = memnew(PopupPanel); + comment_title_change_edit = memnew(LineEdit); + comment_title_change_edit->set_expand_to_text_length(true); + comment_title_change_edit->connect("text_changed", callable_mp(this, &VisualShaderEditor::_comment_title_text_changed)); + comment_title_change_edit->connect("text_entered", callable_mp(this, &VisualShaderEditor::_comment_title_text_entered)); + comment_title_change_popup->add_child(comment_title_change_edit); + comment_title_change_edit->set_size(Size2(-1, -1)); + comment_title_change_popup->set_size(Size2(-1, -1)); + comment_title_change_popup->connect("focus_exited", callable_mp(this, &VisualShaderEditor::_comment_title_popup_focus_out)); + comment_title_change_popup->connect("popup_hide", callable_mp(this, &VisualShaderEditor::_comment_title_popup_hide)); + add_child(comment_title_change_popup); + + comment_desc_change_popup = memnew(PopupPanel); + VBoxContainer *comment_desc_vbox = memnew(VBoxContainer); + comment_desc_change_popup->add_child(comment_desc_vbox); + comment_desc_change_edit = memnew(TextEdit); + comment_desc_change_edit->connect("text_changed", callable_mp(this, &VisualShaderEditor::_comment_desc_text_changed)); + comment_desc_vbox->add_child(comment_desc_change_edit); + comment_desc_change_edit->set_custom_minimum_size(Size2(300 * EDSCALE, 150 * EDSCALE)); + comment_desc_change_edit->set_size(Size2(-1, -1)); + comment_desc_change_popup->set_size(Size2(-1, -1)); + comment_desc_change_popup->connect("focus_exited", callable_mp(this, &VisualShaderEditor::_comment_desc_confirm)); + comment_desc_change_popup->connect("popup_hide", callable_mp(this, &VisualShaderEditor::_comment_desc_popup_hide)); + Button *comment_desc_confirm_button = memnew(Button); + comment_desc_confirm_button->set_text(TTR("OK")); + comment_desc_vbox->add_child(comment_desc_confirm_button); + comment_desc_confirm_button->connect("pressed", callable_mp(this, &VisualShaderEditor::_comment_desc_confirm)); + add_child(comment_desc_change_popup); + /////////////////////////////////////// // SHADER NODES TREE OPTIONS /////////////////////////////////////// @@ -3971,6 +4135,7 @@ VisualShaderEditor::VisualShaderEditor() { // SPECIAL + add_options.push_back(AddOption("Comment", "Special", "", "VisualShaderNodeComment", TTR("A rectangular area with a description string for better graph organization."))); add_options.push_back(AddOption("Expression", "Special", "", "VisualShaderNodeExpression", TTR("Custom Godot Shader Language expression, with custom amount of input and output ports. This is a direct injection of code into the vertex/fragment/light function, do not use it to write the function declarations inside."))); add_options.push_back(AddOption("Fresnel", "Special", "", "VisualShaderNodeFresnel", TTR("Returns falloff based on the dot product of surface normal and view direction of camera (pass associated inputs to it)."), -1, VisualShaderNode::PORT_TYPE_SCALAR)); add_options.push_back(AddOption("GlobalExpression", "Special", "", "VisualShaderNodeGlobalExpression", TTR("Custom Godot Shader Language expression, which is placed on top of the resulted shader. You can place various function definitions inside and call it later in the Expressions. You can also declare varyings, uniforms and constants."))); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index 182bed6ba6..517dc6056f 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -67,7 +67,7 @@ private: VisualShader::Type type = VisualShader::Type::TYPE_MAX; VisualShaderNode *visual_node = nullptr; GraphNode *graph_node = nullptr; - bool preview_visible = 0; + bool preview_visible = false; int preview_pos = 0; Map<int, InputPort> input_ports; Map<int, Port> output_ports; @@ -161,6 +161,12 @@ class VisualShaderEditor : public VBoxContainer { PopupMenu *popup_menu; MenuButton *tools; + PopupPanel *comment_title_change_popup = nullptr; + LineEdit *comment_title_change_edit = nullptr; + + PopupPanel *comment_desc_change_popup = nullptr; + TextEdit *comment_desc_change_edit = nullptr; + bool preview_first = true; bool preview_showed = false; bool particles_mode; @@ -192,6 +198,9 @@ class VisualShaderEditor : public VBoxContainer { SEPARATOR2, // ignore CONVERT_CONSTANTS_TO_UNIFORMS, CONVERT_UNIFORMS_TO_CONSTANTS, + SEPARATOR3, // ignore + SET_COMMENT_TITLE, + SET_COMMENT_DESCRIPTION, }; Tree *members; @@ -325,6 +334,7 @@ class VisualShaderEditor : public VBoxContainer { Set<int> selected_constants; Set<int> selected_uniforms; + int selected_comment = -1; void _convert_constants_to_uniforms(bool p_vice_versa); void _replace_node(VisualShader::Type p_type_id, int p_node_id, const StringName &p_from, const StringName &p_to); @@ -334,6 +344,17 @@ class VisualShaderEditor : public VBoxContainer { void _connection_to_empty(const String &p_from, int p_from_slot, const Vector2 &p_release_position); void _connection_from_empty(const String &p_to, int p_to_slot, const Vector2 &p_release_position); + void _comment_title_popup_show(const Point2 &p_position, int p_node_id); + void _comment_title_popup_hide(); + void _comment_title_popup_focus_out(); + void _comment_title_text_changed(const String &p_new_text); + void _comment_title_text_entered(const String &p_new_text); + + void _comment_desc_popup_show(const Point2 &p_position, int p_node_id); + void _comment_desc_popup_hide(); + void _comment_desc_confirm(); + void _comment_desc_text_changed(); + void _uniform_line_edit_changed(const String &p_text, int p_node_id); void _uniform_line_edit_focus_out(Object *line_edit, int p_node_id); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index eda9499783..d3def86bd1 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1031,7 +1031,7 @@ public: int get_project_count() const; void select_project(int p_index); void select_first_visible_project(); - void erase_selected_projects(); + void erase_selected_projects(bool p_delete_project_contents); Vector<Item> get_selected_projects() const; const Set<String> &get_selected_project_keys() const; void ensure_project_visible(int p_index); @@ -1686,7 +1686,7 @@ void ProjectList::toggle_select(int p_index) { item.control->update(); } -void ProjectList::erase_selected_projects() { +void ProjectList::erase_selected_projects(bool p_delete_project_contents) { if (_selected_project_keys.size() == 0) { return; } @@ -1697,6 +1697,10 @@ void ProjectList::erase_selected_projects() { EditorSettings::get_singleton()->erase("projects/" + item.project_key); EditorSettings::get_singleton()->erase("favorite_projects/" + item.project_key); + if (p_delete_project_contents) { + OS::get_singleton()->move_to_trash(item.path); + } + memdelete(item.control); _projects.remove(i); --i; @@ -1882,6 +1886,8 @@ void ProjectManager::_update_project_buttons() { } void ProjectManager::_unhandled_key_input(const Ref<InputEvent> &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + Ref<InputEventKey> k = p_ev; if (k.is_valid()) { @@ -2215,7 +2221,7 @@ void ProjectManager::_rename_project() { } void ProjectManager::_erase_project_confirm() { - _project_list->erase_selected_projects(); + _project_list->erase_selected_projects(delete_project_contents->is_pressed()); _update_project_buttons(); } @@ -2233,12 +2239,13 @@ void ProjectManager::_erase_project() { String confirm_message; if (selected_list.size() >= 2) { - confirm_message = vformat(TTR("Remove %d projects from the list?\nThe project folders' contents won't be modified."), selected_list.size()); + confirm_message = vformat(TTR("Remove %d projects from the list?"), selected_list.size()); } else { - confirm_message = TTR("Remove this project from the list?\nThe project folder's contents won't be modified."); + confirm_message = TTR("Remove this project from the list?"); } - erase_ask->set_text(confirm_message); + erase_ask_label->set_text(confirm_message); + delete_project_contents->set_pressed(false); erase_ask->popup_centered(); } @@ -2331,6 +2338,17 @@ void ProjectManager::_on_order_option_changed(int p_idx) { } } +void ProjectManager::_on_tab_changed(int p_tab) { + if (p_tab == 0) { // Projects + // Automatically grab focus when the user moves from the Templates tab + // back to the Projects tab. + search_box->grab_focus(); + } + + // The Templates tab's search field is focused on display in the asset + // library editor plugin code. +} + void ProjectManager::_on_search_term_changed(const String &p_term) { _project_list->set_search_term(p_term); _project_list->sort_projects(); @@ -2456,6 +2474,7 @@ ProjectManager::ProjectManager() { center_box->add_child(tabs); tabs->set_anchors_and_offsets_preset(Control::PRESET_WIDE); tabs->set_tab_align(TabContainer::ALIGN_LEFT); + tabs->connect("tab_changed", callable_mp(this, &ProjectManager::_on_tab_changed)); HBoxContainer *projects_hb = memnew(HBoxContainer); projects_hb->set_name(TTR("Projects")); @@ -2472,8 +2491,8 @@ ProjectManager::ProjectManager() { search_tree_vb->add_child(hb); search_box = memnew(LineEdit); - search_box->set_placeholder(TTR("Search")); - search_box->set_tooltip(TTR("The search box filters projects by name and last path component.\nTo filter projects by name and full path, the query must contain at least one `/` character.")); + search_box->set_placeholder(TTR("Filter projects")); + search_box->set_tooltip(TTR("This field filters projects by name and last path component.\nTo filter projects by name and full path, the query must contain at least one `/` character.")); search_box->connect("text_changed", callable_mp(this, &ProjectManager::_on_search_term_changed)); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(search_box); @@ -2651,6 +2670,16 @@ ProjectManager::ProjectManager() { erase_ask->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_erase_project_confirm)); add_child(erase_ask); + VBoxContainer *erase_ask_vb = memnew(VBoxContainer); + erase_ask->add_child(erase_ask_vb); + + erase_ask_label = memnew(Label); + erase_ask_vb->add_child(erase_ask_label); + + delete_project_contents = memnew(CheckBox); + delete_project_contents->set_text(TTR("Also delete project contents (no undo!)")); + erase_ask_vb->add_child(delete_project_contents); + multi_open_ask = memnew(ConfirmationDialog); multi_open_ask->get_ok_button()->set_text(TTR("Edit")); multi_open_ask->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_open_selected_projects)); diff --git a/editor/project_manager.h b/editor/project_manager.h index 6dc0e67cba..d13315c022 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -67,7 +67,11 @@ class ProjectManager : public Control { FileDialog *scan_dir; ConfirmationDialog *language_restart_ask; + ConfirmationDialog *erase_ask; + Label *erase_ask_label; + CheckBox *delete_project_contents; + ConfirmationDialog *erase_missing_ask; ConfirmationDialog *multi_open_ask; ConfirmationDialog *multi_run_ask; @@ -116,6 +120,7 @@ class ProjectManager : public Control { void _files_dropped(PackedStringArray p_files, int p_screen); void _on_order_option_changed(int p_idx); + void _on_tab_changed(int p_tab); void _on_search_term_changed(const String &p_term); protected: diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 57d517b7e9..c62e9cbe5f 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -61,6 +61,8 @@ void SceneTreeDock::_quick_open() { } void SceneTreeDock::_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) { @@ -69,6 +71,8 @@ void SceneTreeDock::_input(Ref<InputEvent> p_event) { } void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (get_focus_owner() && get_focus_owner()->is_text_field()) { return; } diff --git a/editor/settings_config_dialog.cpp b/editor/settings_config_dialog.cpp index bdb90961eb..81af4996ed 100644 --- a/editor/settings_config_dialog.cpp +++ b/editor/settings_config_dialog.cpp @@ -139,6 +139,8 @@ void EditorSettingsDialog::_notification(int p_what) { } void EditorSettingsDialog::_unhandled_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + const Ref<InputEventKey> k = p_event; if (k.is_valid() && k->is_pressed()) { diff --git a/editor/translations/af.po b/editor/translations/af.po index cfee3af954..a60466f417 100644 --- a/editor/translations/af.po +++ b/editor/translations/af.po @@ -6,12 +6,13 @@ # Julius Stopforth <jjstopforth@gmail.com>, 2018. # Isa Tippens <isatippens2@gmail.com>, 2019. # Henry Geyser <thegoat187@gmail.com>, 2020. +# Henry LeRoux <henry.leroux@ocsbstudent.ca>, 2021. msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2020-12-01 20:29+0000\n" -"Last-Translator: Henry Geyser <thegoat187@gmail.com>\n" +"PO-Revision-Date: 2021-04-05 14:28+0000\n" +"Last-Translator: Henry LeRoux <henry.leroux@ocsbstudent.ca>\n" "Language-Team: Afrikaans <https://hosted.weblate.org/projects/godot-engine/" "godot/af/>\n" "Language: af\n" @@ -19,7 +20,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -216,14 +217,12 @@ msgid "Animation Playback Track" msgstr "" #: editor/animation_track_editor.cpp -#, fuzzy msgid "Animation length (frames)" -msgstr "Animasie lengte (in sekondes)." +msgstr "Animasie lengte (in rame)." #: editor/animation_track_editor.cpp -#, fuzzy msgid "Animation length (seconds)" -msgstr "Animasie lengte (in sekondes)." +msgstr "Animasie lengte (in sekondes)" #: editor/animation_track_editor.cpp #, fuzzy diff --git a/editor/translations/cs.po b/editor/translations/cs.po index bc20742d40..17e44a4863 100644 --- a/editor/translations/cs.po +++ b/editor/translations/cs.po @@ -19,17 +19,18 @@ # Emil Jiřà Tywoniak <emil.tywoniak@gmail.com>, 2020, 2021. # Filip Vincůrek <vincurek.f@gmail.com>, 2020. # Ondrej Pavelka <ondrej.pavelka@outlook.com>, 2020. -# ZbynÄ›k <zbynek.fiala@gmail.com>, 2020. +# ZbynÄ›k <zbynek.fiala@gmail.com>, 2020, 2021. # Daniel KřÞ <Daniel.kriz@protonmail.com>, 2020. # VladimirBlazek <vblazek042@gmail.com>, 2020. # kubajz22 <til.jakubesko@seznam.cz>, 2020. # Václav Blažej <vaclavblazej@seznam.cz>, 2020, 2021. +# ProfJack <profjackcz@gmail.com>, 2021. msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-08 15:33+0000\n" -"Last-Translator: Václav Blažej <vaclavblazej@seznam.cz>\n" +"PO-Revision-Date: 2021-04-05 14:28+0000\n" +"Last-Translator: ProfJack <profjackcz@gmail.com>\n" "Language-Team: Czech <https://hosted.weblate.org/projects/godot-engine/godot/" "cs/>\n" "Language: cs\n" @@ -37,7 +38,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" -"X-Generator: Weblate 4.5.1\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -354,7 +355,7 @@ msgstr "ZmÄ›nit režim interpolace animace" #: editor/animation_track_editor.cpp msgid "Change Animation Loop Mode" -msgstr "ZmÄ›nit režim smyÄky animace" +msgstr "ZmÄ›nit mód smyÄky animace" #: editor/animation_track_editor.cpp msgid "Remove Anim Track" @@ -3677,6 +3678,7 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"Importovánà tohoto souboru bylo zakázáno, takže jej nelze otevÅ™Ãt pro úpravy." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4067,23 +4069,20 @@ msgid "Saving..." msgstr "UkládánÃ..." #: editor/import_defaults_editor.cpp -#, fuzzy msgid "Select Importer" -msgstr "Režim výbÄ›ru" +msgstr "Vybrat Importér" #: editor/import_defaults_editor.cpp -#, fuzzy msgid "Importer:" -msgstr "Import" +msgstr "Importér:" #: editor/import_defaults_editor.cpp -#, fuzzy msgid "Reset to Defaults" -msgstr "NaÄÃst výchozÃ" +msgstr "Obnovit výchozÃ" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Zachovat soubor (bez importu)" #: editor/import_dock.cpp msgid "%d Files" @@ -5092,11 +5091,11 @@ msgstr "Stahovánà tohoto assetu právÄ› probÃhá!" #: editor/plugins/asset_library_editor_plugin.cpp msgid "Recently Updated" -msgstr "Naposledy upravené" +msgstr "Nedávno aktualizované" #: editor/plugins/asset_library_editor_plugin.cpp msgid "Least Recently Updated" -msgstr "Naposledy neupravené" +msgstr "Dlouho neaktualizované" #: editor/plugins/asset_library_editor_plugin.cpp msgid "Name (A-Z)" @@ -5184,7 +5183,7 @@ msgid "" "Can't determine a save path for lightmap images.\n" "Save your scene and try again." msgstr "" -"Nelze urÄit cestu uloženà pro svÄ›telnou mapu obrázku.\n" +"Nelze urÄit cestu pro uloženà obrázků svÄ›telné mapy.\n" "Uložte scénu (obrázky se uložà do stejného adresáře) nebo vyberte cestu pro " "uloženà z vlastnosti BakedLightmap." @@ -7349,9 +7348,8 @@ msgid "Yaw" msgstr "Náklon" #: editor/plugins/spatial_editor_plugin.cpp -#, fuzzy msgid "Size" -msgstr "Velikost: " +msgstr "Velikost" #: editor/plugins/spatial_editor_plugin.cpp msgid "Objects Drawn" @@ -10399,7 +10397,6 @@ msgid "Plugins" msgstr "Pluginy" #: editor/project_settings_editor.cpp -#, fuzzy msgid "Import Defaults" msgstr "NaÄÃst výchozÃ" @@ -10651,9 +10648,8 @@ msgid "Instance Child Scene" msgstr "PÅ™idat instanci scény" #: editor/scene_tree_dock.cpp -#, fuzzy msgid "Can't paste root node into the same scene." -msgstr "Nelze manipulovat s uzly z cizà scény!" +msgstr "Nelze vložit koÅ™enový uzel do stejné scény." #: editor/scene_tree_dock.cpp msgid "Paste Node(s)" @@ -11621,7 +11617,7 @@ msgstr "Následné zpracovánÃ" #: modules/lightmapper_cpu/lightmapper_cpu.cpp #, fuzzy msgid "Plotting lightmaps" -msgstr "Vykreslenà svÄ›tel:" +msgstr "Vykreslovánà svÄ›telných map" #: modules/mono/csharp_script.cpp msgid "Class name can't be a reserved keyword" @@ -12436,11 +12432,11 @@ msgstr "Prázdný CollisionPolygon2D nemá pÅ™i kolizi žádný efekt." #: scene/2d/collision_polygon_2d.cpp msgid "Invalid polygon. At least 3 points are needed in 'Solids' build mode." -msgstr "" +msgstr "Chybný polygon. Alespoň 3 body jsou potÅ™eba v 'Solids' build módu." #: scene/2d/collision_polygon_2d.cpp msgid "Invalid polygon. At least 2 points are needed in 'Segments' build mode." -msgstr "" +msgstr "Chybný polygon. Alespoň 2 body jsou potÅ™eba v 'Segments' build módu." #: scene/2d/collision_shape_2d.cpp msgid "" @@ -13059,6 +13055,8 @@ msgid "" "The sampler port is connected but not used. Consider changing the source to " "'SamplerPort'." msgstr "" +"Sampler port je pÅ™ipojen, ale nenà použitý. Zvažte zmÄ›nu zdroje na " +"'SamplerPort'." #: scene/resources/visual_shader_nodes.cpp msgid "Invalid source for preview." diff --git a/editor/translations/de.po b/editor/translations/de.po index 4521c7fdbc..f70522a365 100644 --- a/editor/translations/de.po +++ b/editor/translations/de.po @@ -71,7 +71,7 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-09 04:13+0000\n" +"PO-Revision-Date: 2021-03-31 03:53+0000\n" "Last-Translator: So Wieso <sowieso@dukun.de>\n" "Language-Team: German <https://hosted.weblate.org/projects/godot-engine/" "godot/de/>\n" @@ -80,7 +80,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.5.1\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -3761,6 +3761,8 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"Für diese Datei wurde die Import-Funktion deaktiviert, sie kann folglich " +"nicht zum Bearbeiten geöffnet werden." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4166,7 +4168,7 @@ msgstr "Auf Standardwerte zurücksetzen" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Datei behalten (kein Import)" #: editor/import_dock.cpp msgid "%d Files" diff --git a/editor/translations/es.po b/editor/translations/es.po index 78a2edd4ce..7fc20c2f14 100644 --- a/editor/translations/es.po +++ b/editor/translations/es.po @@ -63,7 +63,7 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-10 22:14+0000\n" +"PO-Revision-Date: 2021-03-31 03:53+0000\n" "Last-Translator: Javier Ocampos <xavier.ocampos@gmail.com>\n" "Language-Team: Spanish <https://hosted.weblate.org/projects/godot-engine/" "godot/es/>\n" @@ -72,7 +72,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.5.2-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -211,7 +211,7 @@ msgstr "Cambiar Transformación de la Animación" #: editor/animation_track_editor.cpp msgid "Anim Change Keyframe Value" -msgstr "Cambiar Valor de la Clave de Animación" +msgstr "Cambiar Valor de Fotogramas Clave de Animación" #: editor/animation_track_editor.cpp msgid "Anim Change Call" @@ -219,7 +219,7 @@ msgstr "Cambiar Llamada de Animación" #: editor/animation_track_editor.cpp msgid "Anim Multi Change Keyframe Time" -msgstr "Cambiar Tiempo de Múltiples Keyframes de Animación" +msgstr "Cambiar Tiempo de Múltiples Fotogramas Clave de Animación" #: editor/animation_track_editor.cpp msgid "Anim Multi Change Transition" @@ -231,7 +231,7 @@ msgstr "Cambiar Múltiples Transforms de Animación" #: editor/animation_track_editor.cpp msgid "Anim Multi Change Keyframe Value" -msgstr "Cambiar Valor de Múltiples Keyframes de Animación" +msgstr "Cambiar Valor de Múltiples Fotogramas Clave de Animación" #: editor/animation_track_editor.cpp msgid "Anim Multi Change Call" @@ -272,7 +272,7 @@ msgstr "Pista de Reproducción de Animación" #: editor/animation_track_editor.cpp msgid "Animation length (frames)" -msgstr "Duración de la animación (frames)" +msgstr "Duración de la animación (fotogramas)" #: editor/animation_track_editor.cpp msgid "Animation length (seconds)" @@ -3314,7 +3314,7 @@ msgstr "Medida:" #: editor/editor_profiler.cpp msgid "Frame Time (sec)" -msgstr "Duración de Frame (seg)" +msgstr "Duración de Fotogramas (seg)" #: editor/editor_profiler.cpp msgid "Average Time (sec)" @@ -3322,11 +3322,11 @@ msgstr "Tiempo Promedio (seg)" #: editor/editor_profiler.cpp msgid "Frame %" -msgstr "Frame %" +msgstr "Fotograma %" #: editor/editor_profiler.cpp msgid "Physics Frame %" -msgstr "Frames de FÃsica %" +msgstr "Fotogramas de FÃsica %" #: editor/editor_profiler.cpp msgid "Inclusive" @@ -3338,7 +3338,7 @@ msgstr "Propio" #: editor/editor_profiler.cpp msgid "Frame #:" -msgstr "Frame #:" +msgstr "Fotograma #:" #: editor/editor_profiler.cpp msgid "Time" @@ -3759,6 +3759,8 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"Se ha desactivado la importación de este archivo, por lo que no se puede " +"abrir para editarlo." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4163,7 +4165,7 @@ msgstr "Restablecer Valores por Defecto" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Mantener Archivo (No Importar)" #: editor/import_dock.cpp msgid "%d Files" @@ -5805,7 +5807,7 @@ msgstr "Centrar Selección" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Frame Selection" -msgstr "Encuadrar Selección" +msgstr "Seleccionar Fotogramas" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Preview Canvas Scale" @@ -7954,15 +7956,15 @@ msgstr "Configuración:" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "No Frames Selected" -msgstr "No hay Frames Seleccionados" +msgstr "No hay Fotogramas Seleccionados" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Add %d Frame(s)" -msgstr "Añadir %d Frame(s)" +msgstr "Añadir %d Fotograma(s)" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Add Frame" -msgstr "Añadir Frame" +msgstr "Añadir Fotograma" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Unable to load images" @@ -7970,7 +7972,7 @@ msgstr "No se pueden cargar las imágenes" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "ERROR: Couldn't load frame resource!" -msgstr "ERROR: ¡No se pudo cargar el recurso de frames!" +msgstr "ERROR: ¡No se pudo cargar el recurso de fotogramas!" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Resource clipboard is empty or not a texture!" @@ -7978,7 +7980,7 @@ msgstr "¡El portapapeles de recursos esta vacÃo o no es una textura!" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Paste Frame" -msgstr "Pegar Frame" +msgstr "Pegar Fotograma" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Add Empty" @@ -7994,7 +7996,7 @@ msgstr "(vacÃo)" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Move Frame" -msgstr "Mover Frame" +msgstr "Mover Fotograma" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Animations:" @@ -8014,7 +8016,7 @@ msgstr "Loop" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Animation Frames:" -msgstr "Frames de Animación:" +msgstr "Fotogramas de Animación:" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Add a Texture from File" @@ -8022,7 +8024,7 @@ msgstr "Añadir Textura desde Archivo" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Add Frames from a Sprite Sheet" -msgstr "Añadir Frames desde un Sprite Sheet" +msgstr "Añadir Fotogramas desde un Sprite Sheet" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Insert Empty (Before)" @@ -8042,7 +8044,7 @@ msgstr "Mover (Después)" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Select Frames" -msgstr "Seleccionar Frames" +msgstr "Seleccionar Fotogramas" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Horizontal:" @@ -8054,11 +8056,11 @@ msgstr "Vertical:" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Select/Clear All Frames" -msgstr "Seleccionar/Limpiar Todos los Frames" +msgstr "Seleccionar/Limpiar Todos los Fotogramas" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Create Frames from Sprite Sheet" -msgstr "Crear Frames a partir de Sprite Sheet" +msgstr "Crear Fotogramas a partir de un Sprite Sheet" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "SpriteFrames" @@ -11333,7 +11335,7 @@ msgstr "Inspeccionar Instancia Siguiente" #: editor/script_editor_debugger.cpp msgid "Stack Frames" -msgstr "Frames del Stack" +msgstr "Fotogramas Apilados" #: editor/script_editor_debugger.cpp msgid "Profiler" @@ -12570,7 +12572,7 @@ msgid "" "order for AnimatedSprite to display frames." msgstr "" "Se debe crear o establecer un recurso SpriteFrames en la propiedad \"Frames" -"\" para que AnimatedSprite pueda mostrar frames." +"\" para que AnimatedSprite pueda mostrar los fotogramas." #: scene/2d/canvas_modulate.cpp msgid "" @@ -13055,7 +13057,7 @@ msgid "" "order for AnimatedSprite3D to display frames." msgstr "" "Se debe crear o establecer un recurso SpriteFrames en la propiedad \"Frames" -"\" para que AnimatedSprite3D pueda mostrar frames." +"\" para que AnimatedSprite3D pueda mostrar los fotogramas." #: scene/3d/vehicle_body.cpp msgid "" diff --git a/editor/translations/es_AR.po b/editor/translations/es_AR.po index c628655b4d..ef65c1d220 100644 --- a/editor/translations/es_AR.po +++ b/editor/translations/es_AR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-09 04:13+0000\n" +"PO-Revision-Date: 2021-03-31 03:53+0000\n" "Last-Translator: Lisandro Lorea <lisandrolorea@gmail.com>\n" "Language-Team: Spanish (Argentina) <https://hosted.weblate.org/projects/" "godot-engine/godot/es_AR/>\n" @@ -30,7 +30,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.5.1\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -3711,6 +3711,8 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"Se ha desactivado la importación de este archivo, por lo que no se puede " +"abrir para editarlo." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4114,7 +4116,7 @@ msgstr "Restablecer Valores Por Defecto" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Mantener Archivo (No Importar)" #: editor/import_dock.cpp msgid "%d Files" diff --git a/editor/translations/fi.po b/editor/translations/fi.po index 19959ec1f0..c60ab24d1d 100644 --- a/editor/translations/fi.po +++ b/editor/translations/fi.po @@ -11,12 +11,13 @@ # Tapani Niemi <tapani.niemi@kapsi.fi>, 2018, 2019, 2020, 2021. # Tuomas Lähteenmäki <lahtis@gmail.com>, 2019. # Matti Niskanen <matti.t.niskanen@gmail.com>, 2020. +# Severi Vidnäs <severi.vidnas@gmail.com>, 2021. msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-10 22:14+0000\n" -"Last-Translator: Tapani Niemi <tapani.niemi@kapsi.fi>\n" +"PO-Revision-Date: 2021-04-05 14:28+0000\n" +"Last-Translator: Severi Vidnäs <severi.vidnas@gmail.com>\n" "Language-Team: Finnish <https://hosted.weblate.org/projects/godot-engine/" "godot/fi/>\n" "Language: fi\n" @@ -24,7 +25,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.5.2-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -1760,7 +1761,7 @@ msgstr "Uusi" #: editor/editor_feature_profile.cpp editor/editor_node.cpp #: editor/project_manager.cpp msgid "Import" -msgstr "Tuonti" +msgstr "Tuo" #: editor/editor_feature_profile.cpp editor/project_export.cpp msgid "Export" @@ -3669,6 +3670,8 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"Tuonti on poistettu käytöstä tälle tiedostolle, joten sitä ei voi avata " +"muokkausta varten." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4074,7 +4077,7 @@ msgstr "Palauta oletusarvoihin" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Pidä tiedosto (ei tuontia)" #: editor/import_dock.cpp msgid "%d Files" diff --git a/editor/translations/hu.po b/editor/translations/hu.po index cf758b874f..448c79c7f1 100644 --- a/editor/translations/hu.po +++ b/editor/translations/hu.po @@ -15,12 +15,13 @@ # thekeymethod <csokan.andras87@protonmail.ch>, 2020. # Czmorek Dávid <czmdav.soft@gmail.com>, 2020. # Újvári Marcell <mmarci72@gmail.com>, 2021. +# GergÅ‘ Pistai <gergopistai@gmail.com>, 2021. msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-01-22 10:21+0000\n" -"Last-Translator: Újvári Marcell <mmarci72@gmail.com>\n" +"PO-Revision-Date: 2021-03-31 03:53+0000\n" +"Last-Translator: GergÅ‘ Pistai <gergopistai@gmail.com>\n" "Language-Team: Hungarian <https://hosted.weblate.org/projects/godot-engine/" "godot/hu/>\n" "Language: hu\n" @@ -28,7 +29,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.5-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -673,15 +674,15 @@ msgstr "Összes/semmi kijelölése" #: editor/animation_track_editor_plugins.cpp msgid "Add Audio Track Clip" -msgstr "" +msgstr "Hangsávklip hozzáadása" #: editor/animation_track_editor_plugins.cpp msgid "Change Audio Track Clip Start Offset" -msgstr "" +msgstr "Hangsáv klip eltolt kezdési idejének módosÃtása" #: editor/animation_track_editor_plugins.cpp msgid "Change Audio Track Clip End Offset" -msgstr "" +msgstr "Hangsáv klip eltolt befejezési idejének módosÃtása" #: editor/array_property_edit.cpp msgid "Resize Array" @@ -732,9 +733,8 @@ msgid "Replace All" msgstr "Összes cseréje" #: editor/code_editor.cpp -#, fuzzy msgid "Selection Only" -msgstr "Csak a kijelölés" +msgstr "Csak kijelölés" #: editor/code_editor.cpp editor/plugins/script_text_editor.cpp #: editor/plugins/text_editor.cpp @@ -771,7 +771,7 @@ msgstr "Sor és oszlopszámok." #: editor/connections_dialog.cpp msgid "Method in target node must be specified." -msgstr "" +msgstr "Nevezze el a metódust a cél node-ban." #: editor/connections_dialog.cpp msgid "Method name must be a valid identifier." @@ -915,9 +915,8 @@ msgid "Signals" msgstr "Jelzések" #: editor/connections_dialog.cpp -#, fuzzy msgid "Filter signals" -msgstr "Csempék szűrése" +msgstr "Jelek szűrése" #: editor/connections_dialog.cpp msgid "Are you sure you want to remove all connections from this signal?" @@ -1045,14 +1044,14 @@ msgid "Owners Of:" msgstr "Tulajdonosai:" #: editor/dependency_editor.cpp -#, fuzzy msgid "" "Remove selected files from the project? (no undo)\n" "You can find the removed files in the system trash to restore them." -msgstr "EltávolÃtja a kiválasztott fájlokat a projektbÅ‘l? (nem visszavonható)" +msgstr "" +"EltávolÃtja a kiválasztott fájlokat a projektbÅ‘l? (nem visszavonható)\n" +"Az eltávolÃtott fájlokat a lomtárban találja, ha visszaállÃtaná Å‘ket." #: editor/dependency_editor.cpp -#, fuzzy msgid "" "The files being removed are required by other resources in order for them to " "work.\n" @@ -1060,7 +1059,8 @@ msgid "" "You can find the removed files in the system trash to restore them." msgstr "" "Az eltávolÃtandó fájlokat szükségelik más források a működésükhöz.\n" -"EltávolÃtja Å‘ket ennek ellenére? (nem visszavonható)" +"EltávolÃtja Å‘ket ennek ellenére? (nem visszavonható)\n" +"Az eltávolÃtott fájlokat a lomtárban találja, ha visszaállÃtaná Å‘ket." #: editor/dependency_editor.cpp msgid "Cannot remove:" @@ -1202,7 +1202,6 @@ msgid "Third-party Licenses" msgstr "Harmadik féltÅ‘l származó licencek" #: editor/editor_about.cpp -#, fuzzy msgid "" "Godot Engine relies on a number of third-party free and open source " "libraries, all compatible with the terms of its MIT license. The following " @@ -1591,12 +1590,16 @@ msgid "" "Target platform requires 'ETC' texture compression for GLES2. Enable 'Import " "Etc' in Project Settings." msgstr "" +"A célplatformnak 'ETC' textúra tömörÃtésre van szüksége GLES2-höz. " +"Engedélyezze az 'Import Etc' beállÃtást a Projekt BeállÃtásokban." #: editor/editor_export.cpp msgid "" "Target platform requires 'ETC2' texture compression for GLES3. Enable " "'Import Etc 2' in Project Settings." msgstr "" +"A célplatformnak 'ETC2' textúra tömörÃtésre van szüksége GLES3-höz. " +"Engedélyezze az 'Import Etc 2' beállÃtást a Projekt BeállÃtásokban." #: editor/editor_export.cpp msgid "" @@ -1605,18 +1608,27 @@ msgid "" "Enable 'Import Etc' in Project Settings, or disable 'Driver Fallback " "Enabled'." msgstr "" +"A célplatformnak 'ETC' textúra tömörÃtésre van szüksége a tartalék driverhez " +"GLES2-höz.\n" +"Engedélyezze az 'Import Etc' beállÃtást a Projekt BeállÃtásokban, vagy " +"kapcsolja ki a 'Driver Fallback Enabled' beállÃtást." #: editor/editor_export.cpp msgid "" "Target platform requires 'PVRTC' texture compression for GLES2. Enable " "'Import Pvrtc' in Project Settings." msgstr "" +"A célplatformnak 'PVRTC' textúra tömörÃtésre van szüksége GLES2-höz. " +"Engedélyezze az 'Import Pvrtc' beállÃtást a Projekt BeállÃtásokban." #: editor/editor_export.cpp msgid "" "Target platform requires 'ETC2' or 'PVRTC' texture compression for GLES3. " "Enable 'Import Etc 2' or 'Import Pvrtc' in Project Settings." msgstr "" +"A célplatformnak 'ETC2' vagy 'PVRTC' textúra tömörÃtésre van szüksége GLES3-" +"hoz. Engedélyezze az 'Import Etc 2' vagy 'Import Pvrtc' beállÃtást a Projekt " +"BeállÃtásokban." #: editor/editor_export.cpp msgid "" @@ -1625,6 +1637,9 @@ msgid "" "Enable 'Import Pvrtc' in Project Settings, or disable 'Driver Fallback " "Enabled'." msgstr "" +"A célplatformnak 'PVRTC' textúra tömörÃtésre van szüksége GLES2-höz.\n" +"Engedélyezze az 'Import Pvrtc' beállÃtást a Projekt BeállÃtásokban, vagy " +"kapcsolja ki a 'Driver Fallback Enabled' beállÃtást." #: editor/editor_export.cpp platform/android/export/export.cpp #: platform/iphone/export/export.cpp platform/javascript/export/export.cpp @@ -1644,7 +1659,7 @@ msgstr "Sablon fájl nem található:" #: editor/editor_export.cpp msgid "On 32-bit exports the embedded PCK cannot be bigger than 4 GiB." -msgstr "" +msgstr "32-bites exportokon a beágyazott PCK nem lehet nagyobb mint 4 GiB." #: editor/editor_feature_profile.cpp msgid "3D Editor" @@ -1664,12 +1679,11 @@ msgstr "Jelenetfa szerkesztése" #: editor/editor_feature_profile.cpp msgid "Node Dock" -msgstr "" +msgstr "Node dokk" #: editor/editor_feature_profile.cpp -#, fuzzy msgid "FileSystem Dock" -msgstr "Fájlrendszer" +msgstr "Fájlrendszer dokk" #: editor/editor_feature_profile.cpp msgid "Import Dock" @@ -1810,7 +1824,7 @@ msgstr "Válassza ezt a mappát" #: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp msgid "Copy Path" -msgstr "Útvonal másolása" +msgstr "Útvonal Másolása" #: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp msgid "Open in File Manager" @@ -1879,11 +1893,11 @@ msgstr "Ugrás Fel" #: editor/editor_file_dialog.cpp msgid "Toggle Hidden Files" -msgstr "" +msgstr "Rejtett fálok megjelenÃtése/elrejtése" #: editor/editor_file_dialog.cpp msgid "Toggle Favorite" -msgstr "" +msgstr "Kedvencek Mutatása/Elrejtése" #: editor/editor_file_dialog.cpp msgid "Toggle Mode" @@ -1891,7 +1905,7 @@ msgstr "Mód váltása" #: editor/editor_file_dialog.cpp msgid "Focus Path" -msgstr "" +msgstr "Elérési Út Fókuszálása" #: editor/editor_file_dialog.cpp msgid "Move Favorite Up" @@ -1926,7 +1940,6 @@ msgid "Toggle the visibility of hidden files." msgstr "A rejtett fájlok láthatóságának ki- és bekapcsolása." #: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp -#, fuzzy msgid "View items as a grid of thumbnails." msgstr "Az elemek megtekintése bélyegkép-rácsként." @@ -2117,9 +2130,8 @@ msgid "Property:" msgstr "Tulajdonság:" #: editor/editor_inspector.cpp -#, fuzzy msgid "Set" -msgstr "BeállÃtás" +msgstr "BeállÃt" #: editor/editor_inspector.cpp msgid "Set Multiple:" @@ -2272,6 +2284,9 @@ msgid "" "This scene can't be saved because there is a cyclic instancing inclusion.\n" "Please resolve it and then attempt to save again." msgstr "" +"Ezt a jelenetet nem lehet elmenteni, mivel ciklikus peldányosÃtást " +"tartalmaz.\n" +"Kérem oldja meg a problémát, aztán próbáljon meg ismét menteni." #: editor/editor_node.cpp msgid "" @@ -2306,6 +2321,9 @@ msgid "" "An error occurred while trying to save the editor layout.\n" "Make sure the editor's user data path is writable." msgstr "" +"Hiba történt a szerkesztÅ‘ elrendezésének mentése közben.\n" +"Bizonyosodjon meg róla, hogy a szerkesztÅ‘ felhasználói elérési útján " +"engedélyezve van az Ãrás." #: editor/editor_node.cpp msgid "" @@ -2313,16 +2331,19 @@ msgid "" "To restore the Default layout to its base settings, use the Delete Layout " "option and delete the Default layout." msgstr "" +"Alapértelmezett szerkesztÅ‘ elrendezés felülÃrva.\n" +"Hogy visszaállÃtsa az alapértelmezett elrendezést az eredeti beállÃtásokra, " +"használja az Elrendezés Törlése opciót és törölje az alapértelmezett " +"elrendezést." #: editor/editor_node.cpp msgid "Layout name not found!" msgstr "Elrendezés neve nem található!" #: editor/editor_node.cpp -#, fuzzy msgid "Restored the Default layout to its base settings." msgstr "" -"Az alapértelmezett elrendezés vissza lett állÃtva az alap beállÃtásokra." +"Az alapértelmezett elrendezés vissza lett állÃtva az eredeti beállÃtásokra." #: editor/editor_node.cpp msgid "" @@ -2382,7 +2403,7 @@ msgstr "Nincs meghatározva Scene a futtatáshoz." #: editor/editor_node.cpp msgid "Save scene before running..." -msgstr "" +msgstr "Futtatás elÅ‘tt mentse a jelenetet..." #: editor/editor_node.cpp msgid "Could not start subprocess!" @@ -2390,23 +2411,23 @@ msgstr "Az alprocesszt nem lehetett elindÃtani!" #: editor/editor_node.cpp editor/filesystem_dock.cpp msgid "Open Scene" -msgstr "Scene megnyitás" +msgstr "Jelenet megnyitása" #: editor/editor_node.cpp msgid "Open Base Scene" -msgstr "Alap Scene megnyitás" +msgstr "Alap Jelenet Megnyitása" #: editor/editor_node.cpp msgid "Quick Open..." -msgstr "Gyors megnyitás..." +msgstr "Gyors Megnyitás..." #: editor/editor_node.cpp msgid "Quick Open Scene..." -msgstr "Jelenet gyors megnyitása..." +msgstr "Jelenet Gyors Megnyitása..." #: editor/editor_node.cpp msgid "Quick Open Script..." -msgstr "Szkript gyors megnyitás..." +msgstr "Szkript Gyors Megnyitás..." #: editor/editor_node.cpp msgid "Save & Close" @@ -2422,11 +2443,11 @@ msgstr "%s módosÃtott erÅ‘forrás mentve." #: editor/editor_node.cpp msgid "A root node is required to save the scene." -msgstr "" +msgstr "Egy gyökér node szükséges a jelenet mentéséhez." #: editor/editor_node.cpp msgid "Save Scene As..." -msgstr "Scene mentés másként..." +msgstr "Scene Mentése Másként..." #: editor/editor_node.cpp editor/scene_tree_dock.cpp msgid "This operation can't be done without a scene." @@ -2530,7 +2551,6 @@ msgstr "" "megbukott." #: editor/editor_node.cpp -#, fuzzy msgid "Unable to find script field for addon plugin at: '%s'." msgstr "" "Nem található szkript mezÅ‘ az addon pluginnak a következÅ‘ helyen: 'res://" @@ -2737,7 +2757,7 @@ msgstr "Legutóbbi Megnyitása" #: editor/editor_node.cpp msgid "Save Scene" -msgstr "Scene mentés" +msgstr "Jelenet Mentése" #: editor/editor_node.cpp msgid "Save All Scenes" @@ -2763,7 +2783,7 @@ msgstr "Visszavonás" #: editor/editor_node.cpp editor/plugins/script_text_editor.cpp #: scene/gui/line_edit.cpp scene/gui/text_edit.cpp msgid "Redo" -msgstr "Mégis" +msgstr "Újra" #: editor/editor_node.cpp msgid "Miscellaneous project or scene-wide tools." @@ -2834,12 +2854,10 @@ msgid "" msgstr "" #: editor/editor_node.cpp -#, fuzzy msgid "Small Deploy with Network Filesystem" -msgstr "Kis TelepÃtés Hálózati FS-sel" +msgstr "Kis TelepÃtés Hálózati Fájlrendszerrel" #: editor/editor_node.cpp -#, fuzzy msgid "" "When this option is enabled, using one-click deploy for Android will only " "export an executable without the project data.\n" @@ -2860,52 +2878,46 @@ msgid "Visible Collision Shapes" msgstr "Látható Ãœtközési Alakzatok" #: editor/editor_node.cpp -#, fuzzy msgid "" "When this option is enabled, collision shapes and raycast nodes (for 2D and " "3D) will be visible in the running project." msgstr "" -"Az ütközési alakzatok és a fénysugárkövetÅ‘ Node-ok (mind 2D-hez és 3D-hez) " -"láthatóak lesznek a játék futásakor, ha ez az opció be van kapcsolva." +"Ha ez az opció be van kapcsolva, az ütközési alakzatok és a sugárkövetÅ‘ Node-" +"ok (mind 2D-hez és 3D-hez) láthatóak lesznek a játék futásakor." #: editor/editor_node.cpp msgid "Visible Navigation" msgstr "Látható Navigáció" #: editor/editor_node.cpp -#, fuzzy msgid "" "When this option is enabled, navigation meshes and polygons will be visible " "in the running project." msgstr "" -"A navigációs hálók és sokszögek láthatóak lesznek a játék futásakor, ha ez " -"az opció be van kapcsolva." +"Ha ez az opció be van kapcsolva, a navigációs hálók és sokszögek láthatóak " +"lesznek a játék futásakor." #: editor/editor_node.cpp -#, fuzzy msgid "Synchronize Scene Changes" -msgstr "Jelenet változtatások szinkronizálása" +msgstr "Jelenet Változások Szinkronizálása" #: editor/editor_node.cpp -#, fuzzy msgid "" "When this option is enabled, any changes made to the scene in the editor " "will be replicated in the running project.\n" "When used remotely on a device, this is more efficient when the network " "filesystem option is enabled." msgstr "" -"Ha ez a beállÃtás be van kapcsolva, bármilyen változtatás a jeleneten a " -"szerkesztÅ‘ben le lesz másolva a futó játékba.\n" -"Ha egy távoli eszközön használja, sokkal hatékonyabb a hálózati " -"fájlrendszerrel együtt." +"Ha ez a beállÃtás be van kapcsolva, bármely a jeleneten való változtatás a " +"szerkesztbÅ‘l, a futó projekre is alkalmazva lesz.\n" +"Távoli eszköz használatakor hatékonyabb, ha a hálózati fájlrendszer opció " +"engedélyezve van." #: editor/editor_node.cpp -#, fuzzy msgid "Synchronize Script Changes" msgstr "Szkript Változtatások Szinkronizálása" #: editor/editor_node.cpp -#, fuzzy msgid "" "When this option is enabled, any script that is saved will be reloaded in " "the running project.\n" @@ -2914,8 +2926,8 @@ msgid "" msgstr "" "Ha ez a beállÃtás be van kapcsolva, bármilyen szkript, amit elment, újra " "betöltÅ‘dik a futó játékba.\n" -"Ha egy távoli eszközön használja, sokkal hatékonyabb a hálózati " -"fájlrendszerrel együtt." +"Távoli eszköz használatakor hatékonyabb, ha a hálózati fájlrendszer opció " +"engedélyezve van." #: editor/editor_node.cpp editor/script_create_dialog.cpp msgid "Editor" @@ -2950,9 +2962,8 @@ msgid "Open Editor Data/Settings Folder" msgstr "SzerkesztÅ‘ adatok/beállÃtások mappa megnyitása" #: editor/editor_node.cpp -#, fuzzy msgid "Open Editor Data Folder" -msgstr "A szerkesztÅ‘ adatmappájának megnyitása" +msgstr "SzerkesztÅ‘ Adatmappájának Megnyitása" #: editor/editor_node.cpp msgid "Open Editor Settings Folder" @@ -2984,9 +2995,8 @@ msgid "Report a Bug" msgstr "Hiba bejelentése" #: editor/editor_node.cpp -#, fuzzy msgid "Send Docs Feedback" -msgstr "Visszajelzés a Dokumentumokról" +msgstr "Visszajelzé Küldése s A Dokumentumokról" #: editor/editor_node.cpp editor/plugins/asset_library_editor_plugin.cpp msgid "Community" @@ -3022,7 +3032,7 @@ msgstr "Szerkesztett Scene futtatása." #: editor/editor_node.cpp msgid "Play Scene" -msgstr "Scene futtatás" +msgstr "Scene Futtatása" #: editor/editor_node.cpp msgid "Play custom scene" @@ -3081,6 +3091,7 @@ msgstr "Nincs Mentés" #: editor/editor_node.cpp msgid "Android build template is missing, please install relevant templates." msgstr "" +"Hiányzó Android épÃtési-sablon, kérem telepÃtse az ide tartozó sablonokat." #: editor/editor_node.cpp msgid "Manage Templates" @@ -3104,6 +3115,10 @@ msgid "" "Remove the \"res://android/build\" directory manually before attempting this " "operation again." msgstr "" +"Az Android épÃtési-sablon már telepÃtve van a projektbe és nem lesz " +"felülÃrva.\n" +"TávolÃtsa el a(z) \"res://android/build\" könyvtárat manuálisan, mivelÅ‘tt " +"újra megkÃsérelné a műveletet." #: editor/editor_node.cpp msgid "Import Templates From ZIP File" @@ -3126,13 +3141,12 @@ msgid "Open & Run a Script" msgstr "Szkriptet Megnyit és Futtat" #: editor/editor_node.cpp -#, fuzzy msgid "" "The following files are newer on disk.\n" "What action should be taken?" msgstr "" "A alábbi fájlok újabbak a lemezen.\n" -"Mit szeretne lépni?:" +"Mit szeretne tenni?" #: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp #: editor/plugins/shader_editor_plugin.cpp @@ -3154,7 +3168,7 @@ msgstr "Betöltési Hibák" #: editor/editor_node.cpp editor/plugins/tile_map_editor_plugin.cpp msgid "Select" -msgstr "Kiválaszt" +msgstr "Kiválasztás" #: editor/editor_node.cpp msgid "Open 2D Editor" @@ -3385,14 +3399,13 @@ msgid "Add Key/Value Pair" msgstr "Kulcs/érték pár hozzáadása" #: editor/editor_run_native.cpp -#, fuzzy msgid "" "No runnable export preset found for this platform.\n" "Please add a runnable preset in the Export menu or define an existing preset " "as runnable." msgstr "" "Nem található futtatható exportállomány ehhez a platformhoz.\n" -"Adjon hozzá egy futtatható exportállományt az export menüben." +"Kérem adjon hozzá egy futtatható exportállományt az export menüben." #: editor/editor_run_script.cpp msgid "Write your logic in the _run() method." @@ -3553,12 +3566,11 @@ msgid "Cannot remove temporary file:" msgstr "Az ideiglenes fájl nem távolÃtható el:" #: editor/export_template_manager.cpp -#, fuzzy msgid "" "Templates installation failed.\n" "The problematic templates archives can be found at '%s'." msgstr "" -"A sablonok telepÃtése nem sikerült.\n" +"A sablonok telepÃtése sikertelen.\n" "A problémás sablonok archÃvuma megtalálható a következÅ‘ helyen: '%s'." #: editor/export_template_manager.cpp @@ -3792,9 +3804,8 @@ msgid "Duplicate..." msgstr "MegkettÅ‘zés..." #: editor/filesystem_dock.cpp -#, fuzzy msgid "Move to Trash" -msgstr "AutoLoad Ãthelyezése" +msgstr "Lomtárba Helyezés" #: editor/filesystem_dock.cpp editor/plugins/animation_player_editor_plugin.cpp msgid "Rename..." @@ -3903,19 +3914,16 @@ msgid "Searching..." msgstr "Keresés…" #: editor/find_in_files.cpp -#, fuzzy msgid "%d match in %d file." -msgstr "%d egyezés." +msgstr "%d egyezés %d fájlban." #: editor/find_in_files.cpp -#, fuzzy msgid "%d matches in %d file." -msgstr "%d egyezés." +msgstr "%d egyezés %d fájlban." #: editor/find_in_files.cpp -#, fuzzy msgid "%d matches in %d files." -msgstr "%d egyezés." +msgstr "%d egyezések %d fájlban." #: editor/groups_editor.cpp msgid "Add to Group" @@ -4053,19 +4061,16 @@ msgid "Saving..." msgstr "Mentés..." #: editor/import_defaults_editor.cpp -#, fuzzy msgid "Select Importer" -msgstr "Kiválasztó Mód" +msgstr "Importer Kiválasztása" #: editor/import_defaults_editor.cpp -#, fuzzy msgid "Importer:" -msgstr "Importálás" +msgstr "Importáló:" #: editor/import_defaults_editor.cpp -#, fuzzy msgid "Reset to Defaults" -msgstr "Alapértelmezett Betöltése" +msgstr "VisszaállÃtás Alapértelmezettre" #: editor/import_dock.cpp msgid "Keep File (No Import)" @@ -4105,7 +4110,6 @@ msgstr "" "Az importált fájl tÃpusának módosÃtásához a szerkesztÅ‘t újra kell indÃtani." #: editor/import_dock.cpp -#, fuzzy msgid "" "WARNING: Assets exist that use this resource, they may stop loading properly." msgstr "" @@ -4390,7 +4394,6 @@ msgid "BlendSpace2D does not belong to an AnimationTree node." msgstr "" #: editor/plugins/animation_blend_space_2d_editor.cpp -#, fuzzy msgid "No triangles exist, so no blending can take place." msgstr "Nincsenek háromszögek, Ãgy nem történhet keverés." @@ -4820,7 +4823,7 @@ msgstr "Lejátszási mód:" #: editor/plugins/animation_tree_editor_plugin.cpp #: editor/plugins/animation_tree_player_editor_plugin.cpp msgid "AnimationTree" -msgstr "" +msgstr "AnimációFa" #: editor/plugins/animation_tree_player_editor_plugin.cpp msgid "New name:" @@ -5029,9 +5032,8 @@ msgid "Got:" msgstr "Kapott:" #: editor/plugins/asset_library_editor_plugin.cpp -#, fuzzy msgid "Failed SHA-256 hash check" -msgstr "sha256 hash ellenÅ‘rzés megbukott" +msgstr "SHA-256 hash ellenÅ‘rzés megbukot" #: editor/plugins/asset_library_editor_plugin.cpp msgid "Asset Download Error:" @@ -5209,7 +5211,7 @@ msgstr "Fény Besütése" #: editor/plugins/baked_lightmap_editor_plugin.cpp #, fuzzy msgid "Select lightmap bake file:" -msgstr "Válasszon sablonfájlt" +msgstr "Válasszon fénytérkép sablonfájlt:" #: editor/plugins/camera_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp @@ -5281,19 +5283,17 @@ msgid "Set CanvasItem \"%s\" Pivot Offset to (%d, %d)" msgstr "" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Rotate %d CanvasItems" -msgstr "CanvasItem forgatása" +msgstr "%d CanvasItem Forgatása" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Rotate CanvasItem \"%s\" to %d degrees" -msgstr "CanvasItem forgatása" +msgstr "\"%s\" CanvasItem Forgatása %d fokra" #: editor/plugins/canvas_item_editor_plugin.cpp #, fuzzy msgid "Move CanvasItem \"%s\" Anchor" -msgstr "CanvasItem áthelyezése" +msgstr "CanvasItem \"%s\" Horgony Mozgatása" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Scale Node2D \"%s\" to (%s, %s)" @@ -5304,24 +5304,20 @@ msgid "Resize Control \"%s\" to (%d, %d)" msgstr "" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Scale %d CanvasItems" -msgstr "CanvasItem méretezése" +msgstr "%d CanvasItem Méretezése" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Scale CanvasItem \"%s\" to (%s, %s)" -msgstr "CanvasItem méretezése" +msgstr "\"%s\" CanvasItem Méretezése (%s, %s)-ra/re" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Move %d CanvasItems" -msgstr "CanvasItem áthelyezése" +msgstr "%d CanvasItem Ãthelyezése" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Move CanvasItem \"%s\" to (%d, %d)" -msgstr "CanvasItem áthelyezése" +msgstr "%s CanvasItem mozgatása (%d, %d)-ra/re" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "" @@ -5400,9 +5396,8 @@ msgid "HCenter Wide" msgstr "" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Full Rect" -msgstr "Teljes téglalap" +msgstr "Teljes Téglalap" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Keep Ratio" @@ -5422,10 +5417,13 @@ msgstr "Horgonyok MódosÃtása" #: editor/plugins/canvas_item_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp +#, fuzzy msgid "" "Game Camera Override\n" "Overrides game camera with editor viewport camera." msgstr "" +"Játék Kamera FelülÃrás.\n" +"FelülÃrja a játék kamerát szerkesztÅ‘i nézetablak kamerával." #: editor/plugins/canvas_item_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp @@ -5516,12 +5514,12 @@ msgstr "Alt + Jobb Egérgomb: Mélységi lista választás" #: editor/plugins/canvas_item_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp msgid "Move Mode" -msgstr "" +msgstr "Mozgató Mód" #: editor/plugins/canvas_item_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp msgid "Rotate Mode" -msgstr "Forgató mód" +msgstr "Forgató Mód" #: editor/plugins/canvas_item_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp @@ -5864,7 +5862,6 @@ msgid "Emission Colors" msgstr "Kibocsátási szÃnek" #: editor/plugins/cpu_particles_editor_plugin.cpp -#, fuzzy msgid "CPUParticles" msgstr "CPU-részecskék" @@ -5879,7 +5876,6 @@ msgid "Create Emission Points From Node" msgstr "Kibocsátási pontok létrehozása a Node alapján" #: editor/plugins/curve_editor_plugin.cpp -#, fuzzy msgid "Flat 0" msgstr "Lapos 0" @@ -5928,9 +5924,8 @@ msgid "Right Linear" msgstr "Jobb lineáris" #: editor/plugins/curve_editor_plugin.cpp -#, fuzzy msgid "Load Preset" -msgstr "ElÅ‘re beállÃtott betöltése" +msgstr "BeállÃtás Betöltése" #: editor/plugins/curve_editor_plugin.cpp msgid "Remove Curve Point" @@ -6271,7 +6266,6 @@ msgstr "Navigációs Sokszög Létrehozása" #: editor/plugins/particles_2d_editor_plugin.cpp #: editor/plugins/particles_editor_plugin.cpp -#, fuzzy msgid "Convert to CPUParticles" msgstr "Konvertálás CPU-részecskékké" @@ -6288,9 +6282,8 @@ msgid "Can only set point into a ParticlesMaterial process material" msgstr "Csak egy ParticlesMaterial feldolgozó anyagba állÃthat pontot" #: editor/plugins/particles_2d_editor_plugin.cpp -#, fuzzy msgid "Convert to CPUParticles2D" -msgstr "Konvertálás CPU-részecskékké" +msgstr "Konvertálás CPUParticles2D-re" #: editor/plugins/particles_2d_editor_plugin.cpp #: editor/plugins/particles_editor_plugin.cpp @@ -6575,18 +6568,16 @@ msgid "Move Points" msgstr "Pontok mozgatása" #: editor/plugins/polygon_2d_editor_plugin.cpp -#, fuzzy msgid "Command: Rotate" -msgstr "Húzás: Forgatás" +msgstr "Command: Forgatás" #: editor/plugins/polygon_2d_editor_plugin.cpp msgid "Shift: Move All" msgstr "Shift: Mind Mozgatása" #: editor/plugins/polygon_2d_editor_plugin.cpp -#, fuzzy msgid "Shift+Command: Scale" -msgstr "Shift + Ctrl: Skálázás" +msgstr "Shif+Command: Méretezés" #: editor/plugins/polygon_2d_editor_plugin.cpp msgid "Ctrl: Rotate" @@ -6631,14 +6622,12 @@ msgid "Radius:" msgstr "" #: editor/plugins/polygon_2d_editor_plugin.cpp -#, fuzzy msgid "Copy Polygon to UV" -msgstr "Sokszög és UV létrehozása" +msgstr "Sokszög UV-ba másolása" #: editor/plugins/polygon_2d_editor_plugin.cpp -#, fuzzy msgid "Copy UV to Polygon" -msgstr "Csontok szinkronizálása a sokszöggel" +msgstr "UV Másolása Sokszögbe" #: editor/plugins/polygon_2d_editor_plugin.cpp msgid "Clear UV" @@ -6685,9 +6674,8 @@ msgid "Grid Step Y:" msgstr "" #: editor/plugins/polygon_2d_editor_plugin.cpp -#, fuzzy msgid "Sync Bones to Polygon" -msgstr "Csontok szinkronizálása a sokszöggel" +msgstr "Csontok Szinkronizálása Sokszögre" #: editor/plugins/resource_preloader_editor_plugin.cpp msgid "ERROR: Couldn't load resource!" @@ -6847,7 +6835,6 @@ msgid "Filter scripts" msgstr "Szkriptek szűrése" #: editor/plugins/script_editor_plugin.cpp -#, fuzzy msgid "Toggle alphabetical sorting of the method list." msgstr "Ãbécészerinti rendezés változtatása a metóduslistában." @@ -7121,7 +7108,7 @@ msgstr "Ãtváltás Megjegyzésre" #: editor/plugins/script_text_editor.cpp msgid "Fold/Unfold Line" -msgstr "Sor Összezárása / Kibontása" +msgstr "Sor Összezárása/Kibontása" #: editor/plugins/script_text_editor.cpp msgid "Fold All Lines" @@ -7141,7 +7128,7 @@ msgstr "Szimbólum Befejezése" #: editor/plugins/script_text_editor.cpp msgid "Evaluate Selection" -msgstr "" +msgstr "Kijelölés Kiértékelése" #: editor/plugins/script_text_editor.cpp msgid "Trim Trailing Whitespace" @@ -7231,7 +7218,6 @@ msgid "Set Rest Pose to Bones" msgstr "" #: editor/plugins/skeleton_2d_editor_plugin.cpp -#, fuzzy msgid "Skeleton2D" msgstr "Csontváz2D" @@ -7261,27 +7247,27 @@ msgstr "" #: editor/plugins/spatial_editor_plugin.cpp msgid "Orthogonal" -msgstr "" +msgstr "Ortogonális" #: editor/plugins/spatial_editor_plugin.cpp msgid "Perspective" -msgstr "" +msgstr "PerspektÃva" #: editor/plugins/spatial_editor_plugin.cpp msgid "Transform Aborted." -msgstr "" +msgstr "ÃtalakÃtás MegszakÃtva." #: editor/plugins/spatial_editor_plugin.cpp msgid "X-Axis Transform." -msgstr "" +msgstr "X-Tengely Transzformáció." #: editor/plugins/spatial_editor_plugin.cpp msgid "Y-Axis Transform." -msgstr "" +msgstr "Y-tengely Transzformáció." #: editor/plugins/spatial_editor_plugin.cpp msgid "Z-Axis Transform." -msgstr "Z-Tengely transzformáció" +msgstr "Z-Tengely Transzformáció." #: editor/plugins/spatial_editor_plugin.cpp msgid "View Plane Transform." @@ -7316,9 +7302,8 @@ msgid "Yaw" msgstr "" #: editor/plugins/spatial_editor_plugin.cpp -#, fuzzy msgid "Size" -msgstr "Méret: " +msgstr "Méret" #: editor/plugins/spatial_editor_plugin.cpp msgid "Objects Drawn" @@ -7572,7 +7557,7 @@ msgstr "" #: editor/plugins/spatial_editor_plugin.cpp msgid "Insert Animation Key" -msgstr "" +msgstr "Animációs Kulcs Beszúrása" #: editor/plugins/spatial_editor_plugin.cpp msgid "Focus Origin" @@ -7861,9 +7846,8 @@ msgid "Loop" msgstr "Ciklus" #: editor/plugins/sprite_frames_editor_plugin.cpp -#, fuzzy msgid "Animation Frames:" -msgstr "Animációs képkockák:" +msgstr "Animációs Képkockák:" #: editor/plugins/sprite_frames_editor_plugin.cpp msgid "Add a Texture from File" @@ -7918,9 +7902,8 @@ msgid "Set Region Rect" msgstr "" #: editor/plugins/texture_region_editor_plugin.cpp -#, fuzzy msgid "Set Margin" -msgstr "Margó beállÃtása" +msgstr "Margó BeállÃtása" #: editor/plugins/texture_region_editor_plugin.cpp msgid "Snap Mode:" @@ -8044,12 +8027,10 @@ msgid "Submenu" msgstr "" #: editor/plugins/theme_editor_plugin.cpp -#, fuzzy msgid "Subitem 1" msgstr "Alelem 1" #: editor/plugins/theme_editor_plugin.cpp -#, fuzzy msgid "Subitem 2" msgstr "Alelem 2" @@ -8125,7 +8106,7 @@ msgstr "Érvénytelen csempék javÃtása" #: editor/plugins/tile_map_editor_plugin.cpp #: modules/gridmap/grid_map_editor_plugin.cpp msgid "Cut Selection" -msgstr "Kijelölés kivágása" +msgstr "Kijelölés Kivágása" #: editor/plugins/tile_map_editor_plugin.cpp msgid "Paint TileMap" @@ -8153,16 +8134,15 @@ msgstr "Csempe keresése" #: editor/plugins/tile_map_editor_plugin.cpp msgid "Transpose" -msgstr "" +msgstr "Transzpozálás" #: editor/plugins/tile_map_editor_plugin.cpp msgid "Disable Autotile" msgstr "" #: editor/plugins/tile_map_editor_plugin.cpp -#, fuzzy msgid "Enable Priority" -msgstr "Prioritás engedélyezése" +msgstr "Prioritás Engedélyezése" #: editor/plugins/tile_map_editor_plugin.cpp msgid "Filter tiles" @@ -8217,9 +8197,8 @@ msgid "Add Texture(s) to TileSet." msgstr "" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Remove selected Texture from TileSet." -msgstr "TávolÃtsa el a kijelölt textúrát a csempekészletbÅ‘l." +msgstr "Kijelölj textúra eltávolÃtása TileSet-bÅ‘l." #: editor/plugins/tile_set_editor_plugin.cpp msgid "Create from Scene" @@ -8258,7 +8237,6 @@ msgid "Select the previous shape, subtile, or Tile." msgstr "" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Region" msgstr "Régió" @@ -8275,7 +8253,6 @@ msgid "Navigation" msgstr "Navigáció" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Bitmask" msgstr "Bitmaszk" @@ -8336,23 +8313,20 @@ msgid "Create a new rectangle." msgstr "Új téglalap létrehozása." #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "New Rectangle" -msgstr "Új Scene" +msgstr "Új Négyszög" #: editor/plugins/tile_set_editor_plugin.cpp msgid "Create a new polygon." msgstr "Új sokszög létrehozása." #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "New Polygon" -msgstr "Sokszög Mozgatása" +msgstr "Új Sokszög" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Delete Selected Shape" -msgstr "Kijelöltek törlése" +msgstr "Kijelölt Alakzat Törlése" #: editor/plugins/tile_set_editor_plugin.cpp msgid "Keep polygon inside region Rect." @@ -8676,7 +8650,6 @@ msgid "Remove output port" msgstr "Kimeneti port eltávolÃtása" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Set expression" msgstr "Kifejezés beállÃtása" @@ -8697,9 +8670,8 @@ msgid "Add Node to Visual Shader" msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Node(s) Moved" -msgstr "Node eltávolÃtva" +msgstr "Node(ok) Ãthelyezve" #: editor/plugins/visual_shader_editor_plugin.cpp msgid "Duplicate Nodes" @@ -8719,9 +8691,8 @@ msgid "Visual Shader Input Type Changed" msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "UniformRef Name Changed" -msgstr "A paraméter megváltozott" +msgstr "UniformRef Név Megváltozott" #: editor/plugins/visual_shader_editor_plugin.cpp msgid "Vertex" @@ -8744,7 +8715,6 @@ msgid "Create Shader Node" msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Color function." msgstr "SzÃn függvény." @@ -8805,7 +8775,6 @@ msgid "SoftLight operator." msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Color constant." msgstr "SzÃnállandó." @@ -8880,7 +8849,6 @@ msgid "" msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Boolean constant." msgstr "Logikai állandó." @@ -8893,7 +8861,6 @@ msgid "'%s' input parameter for all shader modes." msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Input parameter." msgstr "Bemeneti paraméter." @@ -8922,12 +8889,10 @@ msgid "'%s' input parameter for vertex and fragment shader mode." msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Scalar function." msgstr "Skalárfüggvény." #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Scalar operator." msgstr "Skalár operátor." @@ -9154,9 +9119,8 @@ msgid "Subtracts scalar from scalar." msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Scalar constant." -msgstr "Skaláris állandó." +msgstr "Skalár állandó." #: editor/plugins/visual_shader_editor_plugin.cpp msgid "Scalar uniform." @@ -9234,12 +9198,10 @@ msgid "Transform uniform." msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Vector function." -msgstr "Vektor függvény." +msgstr "Vektorfüggvény." #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Vector operator." msgstr "Vektor operátor." @@ -9358,7 +9320,6 @@ msgid "Subtracts vector from vector." msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Vector constant." msgstr "Vektor állandó." @@ -9499,9 +9460,8 @@ msgid "" msgstr "" #: editor/project_export.cpp -#, fuzzy msgid "Export Path" -msgstr "Exportálási útvonal" +msgstr "Exportálási Útvonal" #: editor/project_export.cpp msgid "Resources" @@ -9541,7 +9501,7 @@ msgstr "" #: editor/project_export.cpp msgid "Features" -msgstr "" +msgstr "Funkciók" #: editor/project_export.cpp msgid "Custom (comma-separated):" @@ -9556,9 +9516,8 @@ msgid "Script" msgstr "Szkript" #: editor/project_export.cpp -#, fuzzy msgid "Script Export Mode:" -msgstr "Szkript exportálás módja:" +msgstr "Szkript Exportálás Mód:" #: editor/project_export.cpp msgid "Text" @@ -9621,9 +9580,8 @@ msgid "The path specified doesn't exist." msgstr "A megadott útvonal nem létezik." #: editor/project_manager.cpp -#, fuzzy msgid "Error opening package file (it's not in ZIP format)." -msgstr "Hiba a csomagfájl megnyitása során (az nem ZIP formátumú)." +msgstr "Hiba a csomagfájl megnyitása során (nem ZIP formátumú)." #: editor/project_manager.cpp msgid "" @@ -9773,12 +9731,10 @@ msgid "Error: Project is missing on the filesystem." msgstr "" #: editor/project_manager.cpp -#, fuzzy msgid "Can't open project at '%s'." msgstr "A projekt nem nyitható meg a(z) %s helyen." #: editor/project_manager.cpp -#, fuzzy msgid "Are you sure to open more than one project?" msgstr "Biztos, hogy egynél több projektet nyit meg?" @@ -9870,9 +9826,8 @@ msgid "Projects" msgstr "Projektek" #: editor/project_manager.cpp -#, fuzzy msgid "Loading, please wait..." -msgstr "Tükrök letöltése, kérjük várjon..." +msgstr "Betöltés, kérem várjon..." #: editor/project_manager.cpp msgid "Last Modified" @@ -9967,10 +9922,9 @@ msgstr "Eszköz" #: editor/project_settings_editor.cpp editor/settings_config_dialog.cpp msgid "Press a Key..." -msgstr "Nyomjon le egy billentyűt" +msgstr "Nyomjon meg egy billentyűt..." #: editor/project_settings_editor.cpp -#, fuzzy msgid "Mouse Button Index:" msgstr "Egérgomb index:" @@ -10051,9 +10005,8 @@ msgid "Middle Button." msgstr "KözépsÅ‘ Egérgomb." #: editor/project_settings_editor.cpp -#, fuzzy msgid "Wheel Up." -msgstr "Felfelé görgetés." +msgstr "Felfelé Görgetés." #: editor/project_settings_editor.cpp msgid "Wheel Down." @@ -10182,7 +10135,6 @@ msgid "Index:" msgstr "Index:" #: editor/project_settings_editor.cpp -#, fuzzy msgid "Localization" msgstr "Lokalizáció" @@ -10400,8 +10352,9 @@ msgid "snake_case to PascalCase" msgstr "" #: editor/rename_dialog.cpp +#, fuzzy msgid "Case" -msgstr "" +msgstr "Eset" #: editor/rename_dialog.cpp msgid "To Lowercase" @@ -10420,45 +10373,46 @@ msgid "Regular Expression Error:" msgstr "Reguláris Kifejezési Hiba:" #: editor/rename_dialog.cpp -#, fuzzy msgid "At character %s" msgstr "A(z) %s karakternél" #: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp msgid "Reparent Node" -msgstr "" +msgstr "Node új szülÅ‘höz rendelése" #: editor/reparent_dialog.cpp msgid "Reparent Location (Select new Parent):" -msgstr "" +msgstr "HelyszÃn új szülÅ‘höz rendelése (Új szülÅ‘ kiválasztása):" #: editor/reparent_dialog.cpp msgid "Keep Global Transform" -msgstr "" +msgstr "Globális Transzformáció Megtartása" #: editor/reparent_dialog.cpp editor/scene_tree_dock.cpp msgid "Reparent" -msgstr "" +msgstr "Új szülÅ‘ hozzárendelése" #: editor/run_settings_dialog.cpp msgid "Run Mode:" -msgstr "" +msgstr "Futás Mód:" #: editor/run_settings_dialog.cpp +#, fuzzy msgid "Current Scene" -msgstr "" +msgstr "Jelenlegi Jelenet" #: editor/run_settings_dialog.cpp msgid "Main Scene" -msgstr "" +msgstr "FÅ‘ Jelenet" #: editor/run_settings_dialog.cpp msgid "Main Scene Arguments:" -msgstr "" +msgstr "FÅ‘ Jelenet Argumentumok:" #: editor/run_settings_dialog.cpp +#, fuzzy msgid "Scene Run Settings" -msgstr "" +msgstr "Jelenet IndÃtási BeállÃtások" #: editor/scene_tree_dock.cpp msgid "No parent to instance the scenes at." @@ -10476,24 +10430,24 @@ msgstr "" #: editor/scene_tree_dock.cpp msgid "Instance Scene(s)" -msgstr "" +msgstr "Jelenet(ek) PéldányosÃtása" #: editor/scene_tree_dock.cpp +#, fuzzy msgid "Replace with Branch Scene" -msgstr "" +msgstr "Kicserélés Ãg Jelenettel" #: editor/scene_tree_dock.cpp msgid "Instance Child Scene" -msgstr "" +msgstr "Gyermek Jelenet PeldányosÃtása" #: editor/scene_tree_dock.cpp msgid "Can't paste root node into the same scene." -msgstr "" +msgstr "Gyökér node nem illeszthetÅ‘ be azonos jelenetbe." #: editor/scene_tree_dock.cpp -#, fuzzy msgid "Paste Node(s)" -msgstr "Node-ok beillesztése" +msgstr "Node(ok) beillesztése" #: editor/scene_tree_dock.cpp msgid "Detach Script" @@ -10513,7 +10467,7 @@ msgstr "" #: editor/scene_tree_dock.cpp msgid "Duplicate Node(s)" -msgstr "" +msgstr "Node(ok) MegkettÅ‘zése" #: editor/scene_tree_dock.cpp msgid "Can't reparent nodes in inherited scenes, order of nodes can't change." @@ -10541,7 +10495,7 @@ msgstr "" #: editor/scene_tree_dock.cpp msgid "Delete the root node \"%s\"?" -msgstr "" +msgstr "Gyökér node törlése \"%s\"?" #: editor/scene_tree_dock.cpp msgid "Delete node \"%s\" and its children?" @@ -10585,23 +10539,23 @@ msgstr "" #: editor/scene_tree_dock.cpp msgid "Create Root Node:" -msgstr "Gyökér node létrehozása:" +msgstr "Gyökér Node Létrehozása:" #: editor/scene_tree_dock.cpp msgid "2D Scene" -msgstr "2D jelenet" +msgstr "2D Jelenet" #: editor/scene_tree_dock.cpp msgid "3D Scene" -msgstr "3D jelenet" +msgstr "3D Jelenet" #: editor/scene_tree_dock.cpp msgid "User Interface" -msgstr "" +msgstr "Felhasználói Felület" #: editor/scene_tree_dock.cpp msgid "Other Node" -msgstr "" +msgstr "Másik Node" #: editor/scene_tree_dock.cpp msgid "Can't operate on nodes from a foreign scene!" @@ -10616,9 +10570,8 @@ msgid "Attach Script" msgstr "" #: editor/scene_tree_dock.cpp -#, fuzzy msgid "Cut Node(s)" -msgstr "Node-ok kivágása" +msgstr "Node(ok) Kivágása" #: editor/scene_tree_dock.cpp msgid "Remove Node(s)" @@ -10744,14 +10697,12 @@ msgid "Unlock Node" msgstr "Node feloldása" #: editor/scene_tree_editor.cpp -#, fuzzy msgid "Button Group" msgstr "Gombcsoport" #: editor/scene_tree_editor.cpp -#, fuzzy msgid "(Connecting From)" -msgstr "(Csatlakozás innen)" +msgstr "(Csatlakozás Innen)" #: editor/scene_tree_editor.cpp msgid "Node configuration warning:" @@ -10834,9 +10785,8 @@ msgid "Path is not local." msgstr "Az útvonal nem helyi." #: editor/script_create_dialog.cpp -#, fuzzy msgid "Invalid base path." -msgstr "Érvénytelen alapútvonal." +msgstr "Érvénytelen Alapútvonal." #: editor/script_create_dialog.cpp msgid "A directory with the same name exists." @@ -11094,7 +11044,7 @@ msgstr "" #: editor/settings_config_dialog.cpp msgid "Erase Shortcut" -msgstr "" +msgstr "Gyorsbillentyű törlése" #: editor/settings_config_dialog.cpp msgid "Restore Shortcut" @@ -11419,29 +11369,24 @@ msgid "Preparing data structures" msgstr "" #: modules/lightmapper_cpu/lightmapper_cpu.cpp -#, fuzzy msgid "Generate buffers" -msgstr "AABB Generálása" +msgstr "Bufferek Generálása" #: modules/lightmapper_cpu/lightmapper_cpu.cpp -#, fuzzy msgid "Direct lighting" -msgstr "Irányok" +msgstr "Közvetlen megvilágÃtás" #: modules/lightmapper_cpu/lightmapper_cpu.cpp -#, fuzzy msgid "Indirect lighting" -msgstr "Behúzás Jobbra" +msgstr "Közvetett megvilágÃtás" #: modules/lightmapper_cpu/lightmapper_cpu.cpp -#, fuzzy msgid "Post processing" -msgstr "Kifejezés beállÃtása" +msgstr "Utófeldolgozás" #: modules/lightmapper_cpu/lightmapper_cpu.cpp -#, fuzzy msgid "Plotting lightmaps" -msgstr "Fénytérképek Létrehozása" +msgstr "Fénytérképek Ãbrázolása" #: modules/mono/csharp_script.cpp msgid "Class name can't be a reserved keyword" @@ -11653,7 +11598,7 @@ msgstr "" #: modules/visual_script/visual_script_editor.cpp msgid "Duplicate VisualScript Nodes" -msgstr "" +msgstr "VisualScript Node-ok MegkettÅ‘zése" #: modules/visual_script/visual_script_editor.cpp msgid "Hold %s to drop a Getter. Hold Shift to drop a generic signature." @@ -12130,7 +12075,6 @@ msgid "Using default boot splash image." msgstr "" #: platform/uwp/export/export.cpp -#, fuzzy msgid "Invalid package short name." msgstr "Érvénytelen rövid csomagnév." @@ -12139,19 +12083,16 @@ msgid "Invalid package unique name." msgstr "Érvénytelen egyedi csomagnév." #: platform/uwp/export/export.cpp -#, fuzzy msgid "Invalid package publisher display name." msgstr "Érvénytelen csomagközzétevÅ‘ megjelenÃtendÅ‘ neve." #: platform/uwp/export/export.cpp -#, fuzzy msgid "Invalid product GUID." -msgstr "Érvénytelen termékazonosÃtó." +msgstr "Érvénytelen termék GUID." #: platform/uwp/export/export.cpp -#, fuzzy msgid "Invalid publisher GUID." -msgstr "Érvénytelen közzétevÅ‘i GUID." +msgstr "Érvénytelen kiadó GUID." #: platform/uwp/export/export.cpp msgid "Invalid background color." @@ -12393,14 +12334,12 @@ msgid "Finding meshes and lights" msgstr "" #: scene/3d/baked_lightmap.cpp -#, fuzzy msgid "Preparing geometry (%d/%d)" -msgstr "Geometria Elemzése…" +msgstr "Geometria ElÅ‘készÃtése (%d/%d)" #: scene/3d/baked_lightmap.cpp -#, fuzzy msgid "Preparing environment" -msgstr "Geometria Elemzése…" +msgstr "Környezet elÅ‘készÃtése" #: scene/3d/baked_lightmap.cpp #, fuzzy @@ -12413,9 +12352,8 @@ msgid "Saving lightmaps" msgstr "Fénytérképek Létrehozása" #: scene/3d/baked_lightmap.cpp -#, fuzzy msgid "Done" -msgstr "Kész!" +msgstr "Kész" #: scene/3d/collision_object.cpp msgid "" @@ -12691,9 +12629,8 @@ msgid "Must use a valid extension." msgstr "Használjon érvényes kiterjesztést." #: scene/gui/graph_edit.cpp -#, fuzzy msgid "Enable grid minimap." -msgstr "Illesztés Engedélyezése" +msgstr "Rács kistérkép engedélyezése." #: scene/gui/popup.cpp msgid "" @@ -12746,7 +12683,6 @@ msgid "" msgstr "" #: scene/resources/visual_shader_nodes.cpp -#, fuzzy msgid "Invalid source for preview." msgstr "Érvénytelen forrás az elÅ‘nézethez." diff --git a/editor/translations/id.po b/editor/translations/id.po index 5a31ccdd6e..6657101598 100644 --- a/editor/translations/id.po +++ b/editor/translations/id.po @@ -30,12 +30,13 @@ # Habib Rohman <revolusi147id@gmail.com>, 2020. # Hanz <hanzhaxors@gmail.com>, 2021. # Reza Almanda <rezaalmanda27@gmail.com>, 2021. +# Naufal Adriansyah <naufaladrn90@gmail.com>, 2021. msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-29 21:57+0000\n" -"Last-Translator: Hanz <hanzhaxors@gmail.com>\n" +"PO-Revision-Date: 2021-04-05 14:28+0000\n" +"Last-Translator: Naufal Adriansyah <naufaladrn90@gmail.com>\n" "Language-Team: Indonesian <https://hosted.weblate.org/projects/godot-engine/" "godot/id/>\n" "Language: id\n" @@ -3693,6 +3694,8 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"Mengimpor telah didisable untuk berkas ini, jadi itu tidak bisa dibuka untuk " +"disunting." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4096,7 +4099,7 @@ msgstr "Kembalikan ke Nilai Baku" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Simpan Berkas (Tanpa Impor)" #: editor/import_dock.cpp msgid "%d Files" diff --git a/editor/translations/ja.po b/editor/translations/ja.po index 5fa91fdc34..6c6340e9b8 100644 --- a/editor/translations/ja.po +++ b/editor/translations/ja.po @@ -36,8 +36,8 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-08 15:33+0000\n" -"Last-Translator: Wataru Onuki <bettawat@yahoo.co.jp>\n" +"PO-Revision-Date: 2021-04-01 02:04+0000\n" +"Last-Translator: nitenook <admin@alterbaum.net>\n" "Language-Team: Japanese <https://hosted.weblate.org/projects/godot-engine/" "godot/ja/>\n" "Language: ja\n" @@ -45,7 +45,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.5.1\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -11258,7 +11258,7 @@ msgstr "グラフを表示ã™ã‚‹ã«ã¯ã€ãƒªã‚¹ãƒˆã‹ã‚‰ã‚¢ã‚¤ãƒ†ãƒ ã‚’1ã¤ä»¥ä¸ #: editor/script_editor_debugger.cpp msgid "List of Video Memory Usage by Resource:" -msgstr "リソースã«ã‚ˆã‚‹ãƒ“デオメモリーã®ä½¿ç”¨ä¸€è¦§:" +msgstr "リソースã«ã‚ˆã‚‹ãƒ“デオメモリーã®æ¶ˆè²»é‡ä¸€è¦§:" #: editor/script_editor_debugger.cpp msgid "Total:" @@ -11282,7 +11282,7 @@ msgstr "フォーマット" #: editor/script_editor_debugger.cpp msgid "Usage" -msgstr "使用法" +msgstr "消費é‡" #: editor/script_editor_debugger.cpp msgid "Misc" diff --git a/editor/translations/ko.po b/editor/translations/ko.po index f2809af204..0fcbd51720 100644 --- a/editor/translations/ko.po +++ b/editor/translations/ko.po @@ -21,12 +21,13 @@ # Jun Hyung Shin <shmishmi79@gmail.com>, 2020. # Yongjin Jo <wnrhd114@gmail.com>, 2020. # Yungjoong Song <yungjoong.song@gmail.com>, 2020. +# Henry LeRoux <henry.leroux@ocsbstudent.ca>, 2021. msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-12 09:17+0000\n" -"Last-Translator: Myeongjin Lee <aranet100@gmail.com>\n" +"PO-Revision-Date: 2021-04-05 14:28+0000\n" +"Last-Translator: Henry LeRoux <henry.leroux@ocsbstudent.ca>\n" "Language-Team: Korean <https://hosted.weblate.org/projects/godot-engine/" "godot/ko/>\n" "Language: ko\n" @@ -34,7 +35,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.5.2-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -3667,6 +3668,7 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"ì´ íŒŒì¼ì— 대해 ê°€ì ¸ 오기가 비활성화ë˜ì—ˆìœ¼ë©° íŽ¸ì§‘ì„ ìœ„í•´ ì—´ 수 없습니다." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." diff --git a/editor/translations/nb.po b/editor/translations/nb.po index df1f7395ce..172439dc43 100644 --- a/editor/translations/nb.po +++ b/editor/translations/nb.po @@ -16,12 +16,13 @@ # Revolution <revosw@gmail.com>, 2019. # Petter Reinholdtsen <pere-weblate@hungry.com>, 2019, 2020. # Patrick Sletvold <patricksletvold@hotmail.com>, 2021. +# Kristoffer <kskau93@gmail.com>, 2021. msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-02-27 00:47+0000\n" -"Last-Translator: Anonymous <GentleSaucepan@protonmail.com>\n" +"PO-Revision-Date: 2021-03-31 03:53+0000\n" +"Last-Translator: Kristoffer <kskau93@gmail.com>\n" "Language-Team: Norwegian BokmÃ¥l <https://hosted.weblate.org/projects/godot-" "engine/godot/nb_NO/>\n" "Language: nb\n" @@ -29,7 +30,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.5\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -663,7 +664,7 @@ msgstr "Velg spor Ã¥ kopiere" #: editor/plugins/sprite_frames_editor_plugin.cpp editor/property_editor.cpp #: editor/scene_tree_dock.cpp scene/gui/line_edit.cpp scene/gui/text_edit.cpp msgid "Copy" -msgstr "Lim inn" +msgstr "Kopier" #: editor/animation_track_editor.cpp #, fuzzy @@ -1591,7 +1592,7 @@ msgstr "Velg en Mappe" #: editor/filesystem_dock.cpp editor/project_manager.cpp #: scene/gui/file_dialog.cpp msgid "Create Folder" -msgstr "Lag mappe" +msgstr "Lag Mappe" #: editor/editor_dir_dialog.cpp editor/editor_file_dialog.cpp #: editor/editor_plugin_settings.cpp editor/filesystem_dock.cpp @@ -1706,9 +1707,8 @@ msgid "3D Editor" msgstr "Redigeringsverktøy" #: editor/editor_feature_profile.cpp -#, fuzzy msgid "Script Editor" -msgstr "Ã…pne SkriptEditor" +msgstr "Skript Redigeringsverktøy" #: editor/editor_feature_profile.cpp msgid "Asset Library" @@ -1724,9 +1724,8 @@ msgid "Node Dock" msgstr "Flytt Modus" #: editor/editor_feature_profile.cpp -#, fuzzy msgid "FileSystem Dock" -msgstr "FilSystem" +msgstr "FilSystem Panel" #: editor/editor_feature_profile.cpp #, fuzzy @@ -1882,7 +1881,7 @@ msgstr "Kutt Noder" #: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp msgid "Copy Path" -msgstr "Kopier Sti" +msgstr "Kopier Bane" #: editor/editor_file_dialog.cpp editor/filesystem_dock.cpp #, fuzzy @@ -1941,27 +1940,27 @@ msgstr "Lagre ei fil" #: editor/editor_file_dialog.cpp msgid "Go Back" -msgstr "GÃ¥ tilbake" +msgstr "GÃ¥ Tilbake" #: editor/editor_file_dialog.cpp msgid "Go Forward" -msgstr "GÃ¥ framover" +msgstr "GÃ¥ Fremover" #: editor/editor_file_dialog.cpp msgid "Go Up" -msgstr "GÃ¥ oppover" +msgstr "GÃ¥ Oppover" #: editor/editor_file_dialog.cpp msgid "Toggle Hidden Files" -msgstr "Veksle visning av skjulte filer" +msgstr "Veksle Visning av Skjulte Filer" #: editor/editor_file_dialog.cpp msgid "Toggle Favorite" -msgstr "Veksle favorittmerkering" +msgstr "Veksle Favorittmarkering" #: editor/editor_file_dialog.cpp msgid "Toggle Mode" -msgstr "Veksle modus" +msgstr "Veksle Modus" #: editor/editor_file_dialog.cpp msgid "Focus Path" @@ -2132,7 +2131,7 @@ msgstr "" #: editor/editor_help_search.cpp editor/editor_node.cpp #: editor/plugins/script_editor_plugin.cpp msgid "Search Help" -msgstr "Søk hjelp" +msgstr "Søk Hjelp" #: editor/editor_help_search.cpp msgid "Case Sensitive" @@ -2244,7 +2243,7 @@ msgstr "Tøm" #: editor/editor_log.cpp msgid "Clear Output" -msgstr "Nullstill resultat" +msgstr "Nullstill Resultat" #: editor/editor_network_profiler.cpp editor/editor_node.cpp #: editor/editor_profiler.cpp @@ -2619,9 +2618,8 @@ msgid "Close Scene" msgstr "Lukk Scene" #: editor/editor_node.cpp -#, fuzzy msgid "Reopen Closed Scene" -msgstr "Lukk Scene" +msgstr "GjenÃ¥pne Lukket Scene" #: editor/editor_node.cpp #, fuzzy @@ -2842,9 +2840,8 @@ msgid "Save Scene" msgstr "Lagre Scene" #: editor/editor_node.cpp -#, fuzzy msgid "Save All Scenes" -msgstr "Lagre alle Scener" +msgstr "Lagre Alle Scener" #: editor/editor_node.cpp msgid "Convert To..." @@ -3036,9 +3033,8 @@ msgid "Editor Layout" msgstr "Redigeringsverktøy Layout" #: editor/editor_node.cpp -#, fuzzy msgid "Take Screenshot" -msgstr "Lagre Scene" +msgstr "Ta Skjermbilde" #: editor/editor_node.cpp msgid "Screenshots are stored in the Editor Data/Settings Folder." @@ -3046,7 +3042,7 @@ msgstr "Skjermavbildninger lagres i redigeringsdata/innstillingsmappen." #: editor/editor_node.cpp msgid "Toggle Fullscreen" -msgstr "Skru av/pÃ¥ Fullskjerm" +msgstr "Veksle Fullskjerm" #: editor/editor_node.cpp #, fuzzy @@ -3119,7 +3115,7 @@ msgstr "" #: editor/editor_node.cpp msgid "Pause Scene" -msgstr "Sett scenen pÃ¥ pause" +msgstr "Sett Scenen PÃ¥ Pause" #: editor/editor_node.cpp msgid "Stop the scene." @@ -3180,9 +3176,8 @@ msgid "Inspector" msgstr "Inspektør" #: editor/editor_node.cpp -#, fuzzy msgid "Expand Bottom Panel" -msgstr "Utvid alle" +msgstr "Utvid Nederste Panel" #: editor/editor_node.cpp msgid "Output" @@ -3282,7 +3277,7 @@ msgstr "Ã…pne 3D-redigeringsverktøy" #: editor/editor_node.cpp msgid "Open Script Editor" -msgstr "Ã…pne SkriptEditor" +msgstr "Ã…pne Skriptredigeringsverktøy" #: editor/editor_node.cpp editor/project_manager.cpp msgid "Open Asset Library" @@ -4014,9 +4009,8 @@ msgid "Create Script" msgstr "Opprett skript" #: editor/find_in_files.cpp editor/plugins/script_editor_plugin.cpp -#, fuzzy msgid "Find in Files" -msgstr "%d flere filer" +msgstr "Finn i Filer" #: editor/find_in_files.cpp #, fuzzy @@ -5766,9 +5760,8 @@ msgstr "" #: editor/plugins/canvas_item_editor_plugin.cpp #: editor/plugins/texture_region_editor_plugin.cpp #: editor/plugins/tile_set_editor_plugin.cpp scene/gui/graph_edit.cpp -#, fuzzy msgid "Zoom Reset" -msgstr "Zoom Ut" +msgstr "Zoom Resett" #: editor/plugins/canvas_item_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp @@ -5804,9 +5797,8 @@ msgstr "Roter Modus" #: editor/plugins/canvas_item_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp -#, fuzzy msgid "Scale Mode" -msgstr "Velg Modus" +msgstr "Skaler Modus" #: editor/plugins/canvas_item_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp @@ -5827,9 +5819,8 @@ msgid "Pan Mode" msgstr "Panorerings-Modus" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Ruler Mode" -msgstr "Velg Modus" +msgstr "Linjal Modus" #: editor/plugins/canvas_item_editor_plugin.cpp #, fuzzy @@ -5837,9 +5828,8 @@ msgid "Toggle smart snapping." msgstr "SlÃ¥ av/pÃ¥ snapping" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Use Smart Snap" -msgstr "Bruk Snap" +msgstr "Bruk Smart Snap" #: editor/plugins/canvas_item_editor_plugin.cpp #, fuzzy @@ -5847,9 +5837,8 @@ msgid "Toggle grid snapping." msgstr "SlÃ¥ av/pÃ¥ snapping" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Use Grid Snap" -msgstr "Bruk Snap" +msgstr "Bruk Rutenett Snap" #: editor/plugins/canvas_item_editor_plugin.cpp #, fuzzy @@ -5957,13 +5946,12 @@ msgid "View" msgstr "Visning" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Always Show Grid" -msgstr "Vis Rutenett" +msgstr "Alltid Vis Rutenett" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Show Helpers" -msgstr "Vis hjelpere" +msgstr "Vis Hjelpere" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Show Rulers" @@ -5971,7 +5959,7 @@ msgstr "Vis linjaler" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Show Guides" -msgstr "Vis veiledere" +msgstr "Vis Veiledere" #: editor/plugins/canvas_item_editor_plugin.cpp #, fuzzy @@ -6045,7 +6033,7 @@ msgstr "Kopier Pose" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Clear Pose" -msgstr "Fjern Pose" +msgstr "Fjern Posering" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Multiply grid step by 2" @@ -6056,9 +6044,8 @@ msgid "Divide grid step by 2" msgstr "Del rutenett-steg med 2" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Pan View" -msgstr "Bakvisning" +msgstr "Panoreringsvisning" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Add %s" @@ -7188,12 +7175,12 @@ msgstr "%s-klassereferanse" #: editor/plugins/script_editor_plugin.cpp #: editor/plugins/script_text_editor.cpp msgid "Find Next" -msgstr "Finn neste" +msgstr "Finn Neste" #: editor/plugins/script_editor_plugin.cpp #: editor/plugins/script_text_editor.cpp msgid "Find Previous" -msgstr "Finn forrige" +msgstr "Finn Forrige" #: editor/plugins/script_editor_plugin.cpp #, fuzzy @@ -7243,13 +7230,12 @@ msgid "Open..." msgstr "Ã…pne" #: editor/plugins/script_editor_plugin.cpp -#, fuzzy msgid "Reopen Closed Script" -msgstr "Kjør Skript" +msgstr "GjenÃ¥pne Lukket Skript" #: editor/plugins/script_editor_plugin.cpp msgid "Save All" -msgstr "Lagre Alle" +msgstr "Lagre Alt" #: editor/plugins/script_editor_plugin.cpp msgid "Soft Reload Script" @@ -7260,9 +7246,8 @@ msgid "Copy Script Path" msgstr "Kopier Skript-Sti" #: editor/plugins/script_editor_plugin.cpp -#, fuzzy msgid "History Previous" -msgstr "Finn forrige" +msgstr "Historie Forrige" #: editor/plugins/script_editor_plugin.cpp msgid "History Next" @@ -7308,7 +7293,7 @@ msgstr "Søk" #: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp msgid "Step Into" -msgstr "Tre inn i" +msgstr "Tre Inn I" #: editor/plugins/script_editor_plugin.cpp editor/script_editor_debugger.cpp msgid "Step Over" @@ -7403,9 +7388,8 @@ msgid "Line" msgstr "Linje:" #: editor/plugins/script_text_editor.cpp -#, fuzzy msgid "Go to Function" -msgstr "Fjern Funksjon" +msgstr "GÃ¥ til Funksjon" #: editor/plugins/script_text_editor.cpp msgid "Only resources from filesystem can be dropped." @@ -7430,7 +7414,7 @@ msgstr "" #: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp msgid "Uppercase" -msgstr "Store versaler" +msgstr "Store bokstaver" #: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp msgid "Lowercase" @@ -7470,9 +7454,8 @@ msgid "Select All" msgstr "Velg Alle" #: editor/plugins/script_text_editor.cpp -#, fuzzy msgid "Delete Line" -msgstr "Slett Valgte" +msgstr "Slett Linje" #: editor/plugins/script_text_editor.cpp msgid "Indent Left" @@ -7484,12 +7467,11 @@ msgstr "Innrykk Høyre" #: editor/plugins/script_text_editor.cpp msgid "Toggle Comment" -msgstr "Veksle kommentar" +msgstr "Veksle Kommentar" #: editor/plugins/script_text_editor.cpp -#, fuzzy msgid "Fold/Unfold Line" -msgstr "Slett Valgte" +msgstr "Veksle Linjebretting" #: editor/plugins/script_text_editor.cpp msgid "Fold All Lines" @@ -7501,34 +7483,31 @@ msgstr "Brett ut alle linjer" #: editor/plugins/script_text_editor.cpp msgid "Clone Down" -msgstr "Klon nedover" +msgstr "Klon Nedover" #: editor/plugins/script_text_editor.cpp msgid "Complete Symbol" msgstr "" #: editor/plugins/script_text_editor.cpp -#, fuzzy msgid "Evaluate Selection" -msgstr "Skaler Utvalg" +msgstr "Evaluer Seleksjon" #: editor/plugins/script_text_editor.cpp msgid "Trim Trailing Whitespace" msgstr "" #: editor/plugins/script_text_editor.cpp -#, fuzzy msgid "Convert Indent to Spaces" -msgstr "Konverter til store versaler" +msgstr "Konverter Innrykk til Mellomrom" #: editor/plugins/script_text_editor.cpp -#, fuzzy msgid "Convert Indent to Tabs" -msgstr "Konverter til store versaler" +msgstr "Konverter Inrykk til Tabs" #: editor/plugins/script_text_editor.cpp msgid "Auto Indent" -msgstr "Automatisk innrykk" +msgstr "Automatisk Innrykk" #: editor/plugins/script_text_editor.cpp #, fuzzy @@ -7540,19 +7519,16 @@ msgid "Contextual Help" msgstr "" #: editor/plugins/script_text_editor.cpp -#, fuzzy msgid "Toggle Bookmark" -msgstr "Veksle kommentar" +msgstr "Veksle Bokmerke" #: editor/plugins/script_text_editor.cpp -#, fuzzy msgid "Go to Next Bookmark" -msgstr "GÃ¥ til Neste Steg" +msgstr "GÃ¥ til Neste Bokmerke" #: editor/plugins/script_text_editor.cpp -#, fuzzy msgid "Go to Previous Bookmark" -msgstr "GÃ¥ til tidligere redigert dokument." +msgstr "GÃ¥ til Forrige Bokmerke" #: editor/plugins/script_text_editor.cpp #, fuzzy @@ -7584,9 +7560,8 @@ msgid "Go to Next Breakpoint" msgstr "GÃ¥ til Neste Steg" #: editor/plugins/script_text_editor.cpp -#, fuzzy msgid "Go to Previous Breakpoint" -msgstr "GÃ¥ til tidligere redigert dokument." +msgstr "GÃ¥ til Forrige Steg" #: editor/plugins/shader_editor_plugin.cpp msgid "" @@ -7959,7 +7934,7 @@ msgstr "Høyrevisning" #: editor/plugins/spatial_editor_plugin.cpp msgid "Switch Perspective/Orthogonal View" -msgstr "Bytt perspektiv/ortogonal fremvisning" +msgstr "Bytt Perspektiv/Ortogonal Fremvisning" #: editor/plugins/spatial_editor_plugin.cpp msgid "Insert Animation Key" @@ -7983,9 +7958,8 @@ msgid "Transform" msgstr "" #: editor/plugins/spatial_editor_plugin.cpp -#, fuzzy msgid "Snap Object to Floor" -msgstr "Snap til rutenett" +msgstr "Snap Objekt til Gulv" #: editor/plugins/spatial_editor_plugin.cpp msgid "Transform Dialog..." @@ -8538,9 +8512,8 @@ msgid "Theme File" msgstr "Tema" #: editor/plugins/tile_map_editor_plugin.cpp -#, fuzzy msgid "Erase Selection" -msgstr "Fjern Utvalg" +msgstr "Fjern Seleksjon" #: editor/plugins/tile_map_editor_plugin.cpp #, fuzzy @@ -8549,9 +8522,8 @@ msgstr "Ugyldig navn." #: editor/plugins/tile_map_editor_plugin.cpp #: modules/gridmap/grid_map_editor_plugin.cpp -#, fuzzy msgid "Cut Selection" -msgstr "Plasser Utvalg I Midten" +msgstr "Klipp ut Seleksjon" #: editor/plugins/tile_map_editor_plugin.cpp msgid "Paint TileMap" @@ -8574,9 +8546,8 @@ msgid "Erase TileMap" msgstr "" #: editor/plugins/tile_map_editor_plugin.cpp -#, fuzzy msgid "Find Tile" -msgstr "Finn neste" +msgstr "Finn Flis" #: editor/plugins/tile_map_editor_plugin.cpp msgid "Transpose" @@ -8621,14 +8592,12 @@ msgid "Pick Tile" msgstr "" #: editor/plugins/tile_map_editor_plugin.cpp -#, fuzzy msgid "Rotate Left" -msgstr "Roter Modus" +msgstr "Roter til Venstre" #: editor/plugins/tile_map_editor_plugin.cpp -#, fuzzy msgid "Rotate Right" -msgstr "Roter Polygon" +msgstr "Roter til Høyre" #: editor/plugins/tile_map_editor_plugin.cpp msgid "Flip Horizontally" @@ -8639,9 +8608,8 @@ msgid "Flip Vertically" msgstr "" #: editor/plugins/tile_map_editor_plugin.cpp -#, fuzzy msgid "Clear Transform" -msgstr "Anim Forandre Omforming" +msgstr "Nullstill Transformasjon" #: editor/plugins/tile_set_editor_plugin.cpp #, fuzzy @@ -8676,18 +8644,16 @@ msgid "New Atlas" msgstr "Ny %s" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Next Coordinate" -msgstr "Neste skript" +msgstr "Neste Koordinat" #: editor/plugins/tile_set_editor_plugin.cpp msgid "Select the next shape, subtile, or Tile." msgstr "" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Previous Coordinate" -msgstr "Forrige skript" +msgstr "Forrige Koordinat" #: editor/plugins/tile_set_editor_plugin.cpp msgid "Select the previous shape, subtile, or Tile." @@ -8709,9 +8675,8 @@ msgid "Occlusion" msgstr "Rediger Poly" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Navigation" -msgstr "Animasjonsnode" +msgstr "Navigasjon" #: editor/plugins/tile_set_editor_plugin.cpp #, fuzzy @@ -8729,44 +8694,36 @@ msgid "Z Index" msgstr "Panorerings-Modus" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Region Mode" -msgstr "Roter Modus" +msgstr "Region Modus" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Collision Mode" -msgstr "Animasjonsnode" +msgstr "Kollisjon Modus" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Occlusion Mode" -msgstr "Rediger Poly" +msgstr "Okklusjon Modus" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Navigation Mode" -msgstr "Animasjonsnode" +msgstr "Navigasjon Modus" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Bitmask Mode" -msgstr "Roter Modus" +msgstr "Bitmaske Modus" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Priority Mode" -msgstr "Eksporter Prosjekt" +msgstr "Prioritet Modus" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Icon Mode" -msgstr "Panorerings-Modus" +msgstr "Ikon Modus" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Z Index Mode" -msgstr "Panorerings-Modus" +msgstr "Z Indeks Modus" #: editor/plugins/tile_set_editor_plugin.cpp msgid "Copy bitmask." @@ -9058,9 +9015,8 @@ msgid "Detect new changes" msgstr "Lag ny %s" #: editor/plugins/version_control_editor_plugin.cpp -#, fuzzy msgid "Changes" -msgstr "Forandre" +msgstr "Endringer" #: editor/plugins/version_control_editor_plugin.cpp msgid "Modified" @@ -10025,7 +9981,7 @@ msgstr "Ressurser" #: editor/project_export.cpp msgid "Export all resources in the project" -msgstr "Eksporter alle ressurser til prosjektet" +msgstr "Eksporter alle ressurser i prosjektet" #: editor/project_export.cpp msgid "Export selected scenes (and dependencies)" @@ -10033,7 +9989,7 @@ msgstr "Eksporter valgte scener (og avhengigheter)" #: editor/project_export.cpp msgid "Export selected resources (and dependencies)" -msgstr "Exporter valgte ressurs (og avhengigheter)" +msgstr "Exporter valgte ressurser (og avhengigheter)" #: editor/project_export.cpp msgid "Export Mode:" @@ -10057,7 +10013,7 @@ msgstr "" #: editor/project_export.cpp msgid "Features" -msgstr "" +msgstr "Egenskaper" #: editor/project_export.cpp msgid "Custom (comma-separated):" @@ -10855,9 +10811,8 @@ msgid "Select Method" msgstr "" #: editor/rename_dialog.cpp editor/scene_tree_dock.cpp -#, fuzzy msgid "Batch Rename" -msgstr "Endre navn" +msgstr "Endre Navn pÃ¥ Parti" #: editor/rename_dialog.cpp msgid "Replace:" @@ -11276,9 +11231,8 @@ msgid "Save Branch as Scene" msgstr "" #: editor/scene_tree_dock.cpp editor/script_editor_debugger.cpp -#, fuzzy msgid "Copy Node Path" -msgstr "Kopier Noder" +msgstr "Kopier Node-bane" #: editor/scene_tree_dock.cpp msgid "Delete (No Confirm)" @@ -12488,24 +12442,20 @@ msgid "Copy Nodes" msgstr "Kopier Noder" #: modules/visual_script/visual_script_editor.cpp -#, fuzzy msgid "Cut Nodes" -msgstr "Kutt Noder" +msgstr "Klipp ut Noder" #: modules/visual_script/visual_script_editor.cpp -#, fuzzy msgid "Make Function" -msgstr "Fjern Funksjon" +msgstr "Lag Funksjon" #: modules/visual_script/visual_script_editor.cpp -#, fuzzy msgid "Refresh Graph" -msgstr "Oppdater" +msgstr "Oppdater Graf" #: modules/visual_script/visual_script_editor.cpp -#, fuzzy msgid "Edit Member" -msgstr "Medlemmer" +msgstr "Rediger Medlem" #: modules/visual_script/visual_script_flow_control.cpp msgid "Input type not iterable: " diff --git a/editor/translations/pl.po b/editor/translations/pl.po index 0679df64ce..7da98bc87c 100644 --- a/editor/translations/pl.po +++ b/editor/translations/pl.po @@ -51,7 +51,7 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-24 23:44+0000\n" +"PO-Revision-Date: 2021-04-01 02:04+0000\n" "Last-Translator: Tomek <kobewi4e@gmail.com>\n" "Language-Team: Polish <https://hosted.weblate.org/projects/godot-engine/" "godot/pl/>\n" @@ -61,7 +61,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.5.2-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -3705,6 +3705,8 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"Importowanie zostaÅ‚o wyÅ‚Ä…czone dla tego pliku, wiÄ™c nie może być otwarty do " +"edytowania." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4110,7 +4112,7 @@ msgstr "Resetuj do domyÅ›lnych" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Zachowaj plik (brak importu)" #: editor/import_dock.cpp msgid "%d Files" diff --git a/editor/translations/pt_BR.po b/editor/translations/pt_BR.po index 0907db141e..45e2050732 100644 --- a/editor/translations/pt_BR.po +++ b/editor/translations/pt_BR.po @@ -113,12 +113,13 @@ # Ricardo Zamarrenho Carvalho Correa <ricardozcc17@gmail.com>, 2021. # Diego dos Reis Macedo <diego_dragon97@hotmail.com>, 2021. # Lucas E. <lukas.ed45@gmail.com>, 2021. +# Gabriel Silveira <gabomfim99@gmail.com>, 2021. msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: 2016-05-30\n" -"PO-Revision-Date: 2021-03-24 23:44+0000\n" -"Last-Translator: Renato Rotenberg <renato.rotenberg@gmail.com>\n" +"PO-Revision-Date: 2021-04-05 14:28+0000\n" +"Last-Translator: Gabriel Silveira <gabomfim99@gmail.com>\n" "Language-Team: Portuguese (Brazil) <https://hosted.weblate.org/projects/" "godot-engine/godot/pt_BR/>\n" "Language: pt_BR\n" @@ -126,7 +127,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.5.2-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -3790,6 +3791,8 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"A importação foi desativada para este arquivo, por isso não pode ser aberto " +"para edição." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4193,7 +4196,7 @@ msgstr "Redefinir para os padrões" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Manter Arquivo (Sem Importação)" #: editor/import_dock.cpp msgid "%d Files" diff --git a/editor/translations/ru.po b/editor/translations/ru.po index 471c8a13b7..193b47de8c 100644 --- a/editor/translations/ru.po +++ b/editor/translations/ru.po @@ -96,8 +96,8 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-16 15:25+0000\n" -"Last-Translator: Danil Alexeev <danil@alexeev.xyz>\n" +"PO-Revision-Date: 2021-04-05 14:28+0000\n" +"Last-Translator: narrnika <narr13niki@gmail.com>\n" "Language-Team: Russian <https://hosted.weblate.org/projects/godot-engine/" "godot/ru/>\n" "Language: ru\n" @@ -106,7 +106,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.5.2-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -3759,6 +3759,8 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"Импорт был отключён Ð´Ð»Ñ Ñтого файла, поÑтому его Ð½ÐµÐ»ÑŒÐ·Ñ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚ÑŒ Ð´Ð»Ñ " +"редактированиÑ." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4162,7 +4164,7 @@ msgstr "СброÑить наÑтройки" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Сохранить файл (без импорта)" #: editor/import_dock.cpp msgid "%d Files" diff --git a/editor/translations/th.po b/editor/translations/th.po index 844bf4b4ac..4ac8875aa6 100644 --- a/editor/translations/th.po +++ b/editor/translations/th.po @@ -4,7 +4,7 @@ # This file is distributed under the same license as the Godot source code. # Kaveeta Vivatchai <goodytong@gmail.com>, 2017. # Poommetee Ketson (Noshyaar) <poommetee@protonmail.com>, 2017-2018. -# Thanachart Monpassorn <nunf_2539@hotmail.com>, 2020. +# Thanachart Monpassorn <nunf_2539@hotmail.com>, 2020, 2021. # Anonymous <noreply@weblate.org>, 2020. # Lon3r <mptube.p@gmail.com>, 2020. # Kongfa Warorot <gongpha@hotmail.com>, 2020, 2021. @@ -12,8 +12,8 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-02-15 10:51+0000\n" -"Last-Translator: Kongfa Warorot <gongpha@hotmail.com>\n" +"PO-Revision-Date: 2021-04-05 14:28+0000\n" +"Last-Translator: Thanachart Monpassorn <nunf_2539@hotmail.com>\n" "Language-Team: Thai <https://hosted.weblate.org/projects/godot-engine/godot/" "th/>\n" "Language: th\n" @@ -21,7 +21,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.5-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -2489,9 +2489,8 @@ msgid "Unable to enable addon plugin at: '%s' parsing of config failed." msgstr "ไม่สามารถเปิดใช้งานปลั๊à¸à¸à¸´à¸™: '%s'" #: editor/editor_node.cpp -#, fuzzy msgid "Unable to find script field for addon plugin at: '%s'." -msgstr "ไม่พบชื่à¸à¸ªà¸„ริปต์ในปลั๊à¸à¸à¸´à¸™: 'res://addons/%s'" +msgstr "ไม่พบไฟล์สคริปต์สำหรับปลั๊à¸à¸à¸´à¸™à¸—ี่: '%s'." #: editor/editor_node.cpp msgid "Unable to load addon script from path: '%s'." @@ -3069,13 +3068,12 @@ msgid "Open & Run a Script" msgstr "เปิดà¹à¸¥à¸°à¸£à¸±à¸™à¸ªà¸„ริปต์" #: editor/editor_node.cpp -#, fuzzy msgid "" "The following files are newer on disk.\n" "What action should be taken?" msgstr "" -"ไฟล์ต่à¸à¹„ปนี้ในดิสà¸à¹Œà¹ƒà¸«à¸¡à¹ˆà¸à¸§à¹ˆà¸²\n" -"จะทำà¸à¸¢à¹ˆà¸²à¸‡à¹„รต่à¸à¹„ป?:" +"ไฟล์เหล่านี้มีความใหม่à¸à¸§à¹ˆà¸²à¸šà¸™à¸”ิสà¸à¹Œ\n" +"ต้à¸à¸‡à¸ˆà¸°à¸—ำà¸à¸¢à¹ˆà¸²à¸‡à¹„รต่à¸à¹„ป?" #: editor/editor_node.cpp editor/plugins/script_editor_plugin.cpp #: editor/plugins/shader_editor_plugin.cpp @@ -3605,7 +3603,7 @@ msgstr "สถานะ: นำเข้าไฟล์ล้มเหลว ภ#: editor/filesystem_dock.cpp msgid "" "Importing has been disabled for this file, so it can't be opened for editing." -msgstr "" +msgstr "à¸à¸²à¸£à¸™à¸³à¹€à¸‚้าไฟล์นี้ถูà¸à¸›à¸´à¸”, ดังนั้นจึงไม่สามารถเปิดเพื่à¸à¹à¸à¹‰à¹„ขใดๆได้" #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -3993,23 +3991,20 @@ msgid "Saving..." msgstr "à¸à¸³à¸¥à¸±à¸‡à¸šà¸±à¸™à¸—ึà¸..." #: editor/import_defaults_editor.cpp -#, fuzzy msgid "Select Importer" -msgstr "โหมดเลืà¸à¸" +msgstr "เลืà¸à¸à¸•à¸±à¸§à¸™à¸³à¹€à¸‚้า" #: editor/import_defaults_editor.cpp -#, fuzzy msgid "Importer:" -msgstr "นำเข้า" +msgstr "ตัวนำเข้า:" #: editor/import_defaults_editor.cpp -#, fuzzy msgid "Reset to Defaults" -msgstr "โหลดค่าเริ่มต้น" +msgstr "รีเซ็ตเป็นค่าเริ่มต้น" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "เà¸à¹‡à¸šà¹„ฟล์ (ไม่นำเข้า)" #: editor/import_dock.cpp msgid "%d Files" @@ -4966,9 +4961,8 @@ msgid "Got:" msgstr "ที่ได้รับ:" #: editor/plugins/asset_library_editor_plugin.cpp -#, fuzzy msgid "Failed SHA-256 hash check" -msgstr "ผิดพลาดในà¸à¸²à¸£à¸•à¸£à¸§à¸ˆà¸ªà¸à¸šà¹à¸®à¸Š SHA256" +msgstr "ผิดพลาดในà¸à¸²à¸£à¸•à¸£à¸§à¸ˆà¸ªà¸à¸šà¹à¸®à¸Š SHA-256" #: editor/plugins/asset_library_editor_plugin.cpp msgid "Asset Download Error:" @@ -5099,13 +5093,12 @@ msgid "Assets ZIP File" msgstr "ทรัพยาà¸à¸£à¹„ฟล์ ZIP" #: editor/plugins/baked_lightmap_editor_plugin.cpp -#, fuzzy msgid "" "Can't determine a save path for lightmap images.\n" "Save your scene and try again." msgstr "" -"ไม่สามารถเลืà¸à¸à¸•à¸³à¹à¸«à¸™à¹ˆà¸‡à¸—ี่จะบันทึà¸à¸ าพ lightmap\n" -"à¸à¸£à¸¸à¸“าบันทึà¸à¸‰à¸²à¸ (เพื่à¸à¸šà¸±à¸™à¸—ึà¸à¸ าพในโฟลเดà¸à¸£à¹Œà¹€à¸”ียวà¸à¸±à¸™) หรืà¸à¸£à¸°à¸šà¸¸à¸•à¸³à¹à¸«à¸™à¹ˆà¸‡à¹ƒà¸™à¸„ุณสมบัติขà¸à¸‡ BakedLightmap" +"ไม่สามารถà¸à¸³à¸«à¸™à¸”ตำà¹à¸«à¸™à¹ˆà¸‡à¸à¸²à¸£à¸šà¸±à¸™à¸—ึà¸à¸ªà¸³à¸«à¸£à¸±à¸šà¸ าพ lightmap\n" +"ลà¸à¸‡à¸šà¸±à¸™à¸—ึà¸à¸‰à¸²à¸à¸‚à¸à¸‡à¸„ุณà¹à¸¥à¹‰à¸§à¸¥à¸à¸‡à¸à¸µà¸à¸„รั้ง" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" @@ -5120,27 +5113,28 @@ msgstr "ผิดพลาดขณะสร้างภาพ lightmap à¸à¸£à¸ #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "Failed determining lightmap size. Maximum lightmap size too small?" -msgstr "" +msgstr "à¸à¸²à¸£à¸à¸³à¸«à¸™à¸”ขนาด lightmap ล้มเหลว ขนาด lightmap สูงสุดเล็à¸à¹€à¸à¸´à¸™à¹„ป?" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" "Some mesh is invalid. Make sure the UV2 channel values are contained within " "the [0.0,1.0] square region." -msgstr "" +msgstr "mesh บางส่วนไม่ถูà¸à¸•à¹‰à¸à¸‡ ตรวจสà¸à¸šà¹ƒà¸«à¹‰à¹à¸™à¹ˆà¹ƒà¸ˆà¸§à¹ˆà¸²à¸„่า UV2 à¸à¸¢à¸¹à¹ˆà¹ƒà¸™à¸žà¸·à¹‰à¸™à¸—ี่สี่เหลี่ยม [0.0,1.0]" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "" "Godot editor was built without ray tracing support, lightmaps can't be baked." msgstr "" +"เà¸à¸”ิเตà¸à¸£à¹Œ Godot ถูà¸à¸ªà¸£à¹‰à¸²à¸‡à¹‚ดยไม่ได้สนับสนุน ray tracing ดังนั้นจึงไม่สามารถ bake lightmaps " +"ได้" #: editor/plugins/baked_lightmap_editor_plugin.cpp msgid "Bake Lightmaps" msgstr "สร้าง Lightmaps" #: editor/plugins/baked_lightmap_editor_plugin.cpp -#, fuzzy msgid "Select lightmap bake file:" -msgstr "เลืà¸à¸à¹„ฟล์เทมเพลต" +msgstr "เลืà¸à¸à¹„ฟล์ bake ขà¸à¸‡ lightmap :" #: editor/plugins/camera_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp @@ -6220,9 +6214,8 @@ msgid "Can only set point into a ParticlesMaterial process material" msgstr "สามารถà¸à¸³à¸«à¸™à¸”จุดให้à¹à¸à¹ˆ ParticlesMaterial เท่านั้น" #: editor/plugins/particles_2d_editor_plugin.cpp -#, fuzzy msgid "Convert to CPUParticles2D" -msgstr "à¹à¸›à¸¥à¸‡à¹€à¸›à¹‡à¸™ CPUParticles" +msgstr "à¹à¸›à¸¥à¸‡à¹€à¸›à¹‡à¸™ CPUParticles2D" #: editor/plugins/particles_2d_editor_plugin.cpp #: editor/plugins/particles_editor_plugin.cpp @@ -7247,9 +7240,8 @@ msgid "Yaw" msgstr "Yaw" #: editor/plugins/spatial_editor_plugin.cpp -#, fuzzy msgid "Size" -msgstr "ขนาด: " +msgstr "ขนาด" #: editor/plugins/spatial_editor_plugin.cpp msgid "Objects Drawn" @@ -9885,9 +9877,8 @@ msgid "Projects" msgstr "โปรเจà¸à¸•à¹Œ" #: editor/project_manager.cpp -#, fuzzy msgid "Loading, please wait..." -msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸£à¸µà¸¢à¸à¸‚้à¸à¸¡à¸¹à¸¥ โปรดรà¸..." +msgstr "à¸à¸³à¸¥à¸±à¸‡à¹‚หลด โปรดรà¸..." #: editor/project_manager.cpp msgid "Last Modified" @@ -10255,9 +10246,8 @@ msgid "Plugins" msgstr "ปลั๊à¸à¸à¸´à¸™" #: editor/project_settings_editor.cpp -#, fuzzy msgid "Import Defaults" -msgstr "โหลดค่าเริ่มต้น" +msgstr "นำเข้าค่าเริ่มต้น" #: editor/property_editor.cpp msgid "Preset..." @@ -10506,12 +10496,10 @@ msgid "Instance Child Scene" msgstr "à¸à¸´à¸™à¸ªà¹à¸•à¸™à¸‹à¹Œà¸‰à¸²à¸à¸¥à¸¹à¸" #: editor/scene_tree_dock.cpp -#, fuzzy msgid "Can't paste root node into the same scene." -msgstr "ทำà¸à¸±à¸šà¹‚หนดขà¸à¸‡à¸‰à¸²à¸à¸à¸·à¹ˆà¸™à¹„ม่ได้!" +msgstr "ไม่สามารถวางโหนดราà¸à¹ƒà¸™à¸‰à¸²à¸à¹€à¸”ียวà¸à¸±à¸™" #: editor/scene_tree_dock.cpp -#, fuzzy msgid "Paste Node(s)" msgstr "วางโหนด" @@ -10641,7 +10629,6 @@ msgid "Attach Script" msgstr "à¹à¸™à¸šà¸ªà¸„ริปต์" #: editor/scene_tree_dock.cpp -#, fuzzy msgid "Cut Node(s)" msgstr "ตัดโหนด" @@ -11446,36 +11433,31 @@ msgstr "มà¸à¸šà¸—รัพยาà¸à¸£ MeshLibrary ให้à¸à¸±à¸š GridMap #: modules/lightmapper_cpu/lightmapper_cpu.cpp msgid "Begin Bake" -msgstr "" +msgstr "เริ่มต้น Bake" #: modules/lightmapper_cpu/lightmapper_cpu.cpp msgid "Preparing data structures" -msgstr "" +msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸•à¸£à¸µà¸¢à¸¡à¹‚ครงสร้างข้à¸à¸¡à¸¹à¸¥" #: modules/lightmapper_cpu/lightmapper_cpu.cpp -#, fuzzy msgid "Generate buffers" -msgstr "สร้าง AABB" +msgstr "สร้างบัฟเฟà¸à¸£à¹Œ" #: modules/lightmapper_cpu/lightmapper_cpu.cpp -#, fuzzy msgid "Direct lighting" -msgstr "ทิศทาง" +msgstr "lighting à¹à¸šà¸šà¸•à¸£à¸‡" #: modules/lightmapper_cpu/lightmapper_cpu.cpp -#, fuzzy msgid "Indirect lighting" -msgstr "ย่à¸à¸«à¸™à¹‰à¸²à¸‚วา" +msgstr "lighting à¹à¸šà¸šà¸à¹‰à¸à¸¡" #: modules/lightmapper_cpu/lightmapper_cpu.cpp -#, fuzzy msgid "Post processing" msgstr "หลังประมวลผล" #: modules/lightmapper_cpu/lightmapper_cpu.cpp -#, fuzzy msgid "Plotting lightmaps" -msgstr "วางà¹à¸™à¸§à¹à¸ªà¸‡:" +msgstr "à¸à¸³à¸¥à¸±à¸‡à¸žà¸¥à¹‡à¸à¸• lightmaps" #: modules/mono/csharp_script.cpp msgid "Class name can't be a reserved keyword" @@ -11975,9 +11957,8 @@ msgid "Select device from the list" msgstr "เลืà¸à¸à¸à¸¸à¸›à¸à¸£à¸“์จาà¸à¸£à¸²à¸¢à¸Šà¸·à¹ˆà¸" #: platform/android/export/export.cpp -#, fuzzy msgid "Unable to find the 'apksigner' tool." -msgstr "ไม่สามารถหา zipalign tool" +msgstr "ไม่สามารถหาเครื่à¸à¸‡à¸¡à¸·à¸ 'apksigner'" #: platform/android/export/export.cpp msgid "" @@ -11994,14 +11975,12 @@ msgid "Release keystore incorrectly configured in the export preset." msgstr "Release keystore à¸à¸³à¸«à¸™à¸”ค่าไว้à¸à¸¢à¹ˆà¸²à¸‡à¹„ม่ถูà¸à¸•à¹‰à¸à¸‡à¹ƒà¸™à¸žà¸£à¸µà¹€à¸‹à¹‡à¸•à¸ªà¸³à¸«à¸£à¸±à¸šà¸à¸²à¸£à¸ªà¹ˆà¸‡à¸à¸à¸" #: platform/android/export/export.cpp -#, fuzzy msgid "A valid Android SDK path is required in Editor Settings." -msgstr "ที่à¸à¸¢à¸¹à¹ˆ Android SDK ผิดพลาดสำหรับà¸à¸²à¸£à¸ªà¸£à¹‰à¸²à¸‡à¹à¸šà¸šà¸à¸³à¸«à¸™à¸”เà¸à¸‡à¹ƒà¸™à¸à¸²à¸£à¸•à¸±à¹‰à¸‡à¸„่าเà¸à¸”ิเตà¸à¸£à¹Œ" +msgstr "ต้à¸à¸‡à¸à¸²à¸£à¸—ี่à¸à¸¢à¸¹à¹ˆà¸‚à¸à¸‡ Android SDK ที่ถูà¸à¸•à¹‰à¸à¸‡ ในà¸à¸²à¸£à¸•à¸±à¹‰à¸‡à¸„่าเà¸à¸”ิเตà¸à¸£à¹Œ" #: platform/android/export/export.cpp -#, fuzzy msgid "Invalid Android SDK path in Editor Settings." -msgstr "ที่à¸à¸¢à¸¹à¹ˆ Android SDK ผิดพลาดสำหรับà¸à¸²à¸£à¸ªà¸£à¹‰à¸²à¸‡à¹à¸šà¸šà¸à¸³à¸«à¸™à¸”เà¸à¸‡à¹ƒà¸™à¸à¸²à¸£à¸•à¸±à¹‰à¸‡à¸„่าเà¸à¸”ิเตà¸à¸£à¹Œ" +msgstr "ที่à¸à¸¢à¸¹à¹ˆ Android SDK ไม่ถูà¸à¸•à¹‰à¸à¸‡à¹ƒà¸™à¸•à¸±à¹‰à¸‡à¸„่าขà¸à¸‡à¹€à¸à¸”ิเตà¸à¸£à¹Œ" #: platform/android/export/export.cpp msgid "Missing 'platform-tools' directory!" @@ -12009,12 +11988,11 @@ msgstr "ไดเร็à¸à¸—à¸à¸£à¸µ 'platform-tools' หายไป!" #: platform/android/export/export.cpp msgid "Unable to find Android SDK platform-tools' adb command." -msgstr "" +msgstr "ไม่พบคำสั่ง adb ขà¸à¸‡ Android SDK platform-tools" #: platform/android/export/export.cpp -#, fuzzy msgid "Please check in the Android SDK directory specified in Editor Settings." -msgstr "ที่à¸à¸¢à¸¹à¹ˆ Android SDK ผิดพลาดสำหรับà¸à¸²à¸£à¸ªà¸£à¹‰à¸²à¸‡à¹à¸šà¸šà¸à¸³à¸«à¸™à¸”เà¸à¸‡à¹ƒà¸™à¸à¸²à¸£à¸•à¸±à¹‰à¸‡à¸„่าเà¸à¸”ิเตà¸à¸£à¹Œ" +msgstr "โปรดตรวจสà¸à¸šà¹ƒà¸™à¹„ดเร็à¸à¸—à¸à¸£à¸µ Android SDK ที่ระบุใตัวตั้งค่าขà¸à¸‡à¹€à¸à¸”ิเตà¸à¸£à¹Œ" #: platform/android/export/export.cpp msgid "Missing 'build-tools' directory!" @@ -12022,7 +12000,7 @@ msgstr "ไดเร็à¸à¸—à¸à¸£à¸µ 'build-tools' หายไป!" #: platform/android/export/export.cpp msgid "Unable to find Android SDK build-tools' apksigner command." -msgstr "" +msgstr "ไม่พบคำสั่ง apksigner ขà¸à¸‡ Android SDK build-tools" #: platform/android/export/export.cpp msgid "Invalid public key for APK expansion." @@ -12270,11 +12248,11 @@ msgstr "CollisionPolygon2D ที่ว่างเปล่าจะไม่ภ#: scene/2d/collision_polygon_2d.cpp msgid "Invalid polygon. At least 3 points are needed in 'Solids' build mode." -msgstr "" +msgstr "โพลีà¸à¸à¸™à¹„ม่ถูà¸à¸•à¹‰à¸à¸‡ ต้à¸à¸‡à¸¡à¸µà¸à¸¢à¹ˆà¸²à¸‡à¸™à¹‰à¸à¸¢ 3 จุด ในโหมดà¸à¸²à¸£à¸ªà¸£à¹‰à¸²à¸‡à¹à¸šà¸š 'Solids'" #: scene/2d/collision_polygon_2d.cpp msgid "Invalid polygon. At least 2 points are needed in 'Segments' build mode." -msgstr "" +msgstr "โพลีà¸à¸à¸™à¹„ม่ถูà¸à¸•à¹‰à¸à¸‡ ต้à¸à¸‡à¸¡à¸µà¸à¸¢à¹ˆà¸²à¸‡à¸™à¹‰à¸à¸¢ 2 จุด ในโหมดà¸à¸²à¸£à¸ªà¸£à¹‰à¸²à¸‡à¹à¸šà¸š 'Segments'" #: scene/2d/collision_shape_2d.cpp msgid "" @@ -12463,27 +12441,23 @@ msgstr "ARVROrigin จำเป็นต้à¸à¸‡à¸¡à¸µ ARVRCamera เป็นà #: scene/3d/baked_lightmap.cpp msgid "Finding meshes and lights" -msgstr "" +msgstr "à¸à¸³à¸¥à¸±à¸‡à¸«à¸² meshes à¹à¸¥à¸° lights" #: scene/3d/baked_lightmap.cpp -#, fuzzy msgid "Preparing geometry (%d/%d)" -msgstr "วิเคราะห์พื้นผิว..." +msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸•à¸£à¸µà¸¢à¸¡à¸£à¸¹à¸›à¹€à¸£à¸‚าคณิต (%d/%d)" #: scene/3d/baked_lightmap.cpp -#, fuzzy msgid "Preparing environment" -msgstr "à¹à¸ªà¸”งสภาพà¹à¸§à¸”ล้à¸à¸¡" +msgstr "à¸à¸³à¸¥à¸±à¸‡à¹€à¸•à¸£à¸µà¸¢à¸¡à¸ªà¸ าพà¹à¸§à¸”ล้à¸à¸¡" #: scene/3d/baked_lightmap.cpp -#, fuzzy msgid "Generating capture" -msgstr "à¸à¸³à¸¥à¸±à¸‡à¸ªà¸£à¹‰à¸²à¸‡ Lightmaps" +msgstr "à¸à¸³à¸¥à¸±à¸‡à¸ªà¸£à¹‰à¸²à¸‡ capture" #: scene/3d/baked_lightmap.cpp -#, fuzzy msgid "Saving lightmaps" -msgstr "à¸à¸³à¸¥à¸±à¸‡à¸ªà¸£à¹‰à¸²à¸‡ Lightmaps" +msgstr "à¸à¸³à¸¥à¸±à¸‡à¸šà¸±à¸™à¸—ึภlightmaps" #: scene/3d/baked_lightmap.cpp msgid "Done" @@ -12855,7 +12829,7 @@ msgstr "ขนาดวิวพà¸à¸£à¹Œà¸•à¸ˆà¸°à¸•à¹‰à¸à¸‡à¸¡à¸²à¸à¸à¸§à¹ˆ msgid "" "The sampler port is connected but not used. Consider changing the source to " "'SamplerPort'." -msgstr "" +msgstr "พà¸à¸£à¹Œà¸•à¸•à¸±à¸§à¸à¸¢à¹ˆà¸²à¸‡à¹€à¸Šà¸·à¹ˆà¸à¸¡à¸•à¹ˆà¸à¸à¸¢à¸¹à¹ˆà¹à¸•à¹ˆà¹„ม่ได้ใช้ ควรที่จะเปลี่ยนเป็น \"SamplerPort\"" #: scene/resources/visual_shader_nodes.cpp msgid "Invalid source for preview." diff --git a/editor/translations/tr.po b/editor/translations/tr.po index b10bf6f02b..619bd94bb1 100644 --- a/editor/translations/tr.po +++ b/editor/translations/tr.po @@ -61,8 +61,8 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-16 10:40+0000\n" -"Last-Translator: furkan atalar <fatalar55@gmail.com>\n" +"PO-Revision-Date: 2021-03-31 03:53+0000\n" +"Last-Translator: OÄŸuz Ersen <oguzersen@protonmail.com>\n" "Language-Team: Turkish <https://hosted.weblate.org/projects/godot-engine/" "godot/tr/>\n" "Language: tr\n" @@ -70,7 +70,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.5.2-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -2579,9 +2579,8 @@ msgstr "" "baÅŸarısız oldu." #: editor/editor_node.cpp -#, fuzzy msgid "Unable to find script field for addon plugin at: '%s'." -msgstr "Eklentideki betik alanı bulunamıyor: 'res://addons/%s'." +msgstr "Eklentide için betik alanı bulunamıyor: '%s'." #: editor/editor_node.cpp msgid "Unable to load addon script from path: '%s'." @@ -3725,6 +3724,8 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"İçe aktarma bu dosya için devre dışı bırakıldı, bu nedenle düzenleme için " +"açılamıyor." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4130,7 +4131,7 @@ msgstr "Varsayılanlara dön" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Dosyayı Koru (İçeri Aktarma Yok)" #: editor/import_dock.cpp msgid "%d Files" @@ -10459,9 +10460,8 @@ msgid "Plugins" msgstr "Eklentiler" #: editor/project_settings_editor.cpp -#, fuzzy msgid "Import Defaults" -msgstr "Varsayılanları İçe Aktar" +msgstr "Öntanımlı İçe Aktarma Ayarları" #: editor/property_editor.cpp msgid "Preset..." @@ -12503,11 +12503,12 @@ msgstr "BoÅŸ bir CollisionPolygon2D'nin çarpışmaya hiçbir etkisi yoktur." #: scene/2d/collision_polygon_2d.cpp msgid "Invalid polygon. At least 3 points are needed in 'Solids' build mode." -msgstr "" +msgstr "Geçersiz çokgen. 'Solids' oluÅŸturma modunda en az 3 nokta gereklidir." #: scene/2d/collision_polygon_2d.cpp msgid "Invalid polygon. At least 2 points are needed in 'Segments' build mode." msgstr "" +"Geçersiz çokgen. 'Segments' oluÅŸturma modunda en az 2 nokta gereklidir." #: scene/2d/collision_shape_2d.cpp msgid "" diff --git a/editor/translations/uk.po b/editor/translations/uk.po index 0fabbe77b4..3dd58a87f4 100644 --- a/editor/translations/uk.po +++ b/editor/translations/uk.po @@ -20,8 +20,8 @@ msgid "" msgstr "" "Project-Id-Version: Ukrainian (Godot Engine)\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-10 22:14+0000\n" -"Last-Translator: Tymofij Lytvynenko <till.svit@gmail.com>\n" +"PO-Revision-Date: 2021-03-31 03:53+0000\n" +"Last-Translator: Yuri Chornoivan <yurchor@ukr.net>\n" "Language-Team: Ukrainian <https://hosted.weblate.org/projects/godot-engine/" "godot/uk/>\n" "Language: uk\n" @@ -30,7 +30,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.5.2-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -3698,6 +3698,8 @@ msgstr "" msgid "" "Importing has been disabled for this file, so it can't be opened for editing." msgstr "" +"Ð†Ð¼Ð¿Ð¾Ñ€Ñ‚ÑƒÐ²Ð°Ð½Ð½Ñ Ð´Ð»Ñ Ñ†ÑŒÐ¾Ð³Ð¾ файла вимкнено, тому його не можна відкрити Ð´Ð»Ñ " +"редагуваннÑ." #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4101,7 +4103,7 @@ msgstr "Відновити типові параметри" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "Зберегти файл (не імпортувати)" #: editor/import_dock.cpp msgid "%d Files" diff --git a/editor/translations/vi.po b/editor/translations/vi.po index d01cefc0c7..fa600ca176 100644 --- a/editor/translations/vi.po +++ b/editor/translations/vi.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: Godot Engine editor\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2021-03-29 21:57+0000\n" +"PO-Revision-Date: 2021-04-05 14:28+0000\n" "Last-Translator: Rev <revolnoom7801@gmail.com>\n" "Language-Team: Vietnamese <https://hosted.weblate.org/projects/godot-engine/" "godot/vi/>\n" @@ -524,7 +524,6 @@ msgid "Group tracks by node or display them as plain list." msgstr "Nhóm các track bởi nút hoặc hiển thị chúng dạng danh sách Ä‘Æ¡n giản." #: editor/animation_track_editor.cpp -#, fuzzy msgid "Snap:" msgstr "DÃnh:" @@ -1571,7 +1570,7 @@ msgstr "LÆ°u trữ tệp tin:" #: editor/editor_export.cpp msgid "No export template found at the expected path:" -msgstr "" +msgstr "Không thấy mẫu xuất nà o ở Ä‘Æ°á»ng dẫn mong đợi:" #: editor/editor_export.cpp msgid "Packing" @@ -1605,22 +1604,20 @@ msgstr "" "Trình Ä‘iá»u khiển Dá»± phòng'." #: editor/editor_export.cpp -#, fuzzy msgid "" "Target platform requires 'PVRTC' texture compression for GLES2. Enable " "'Import Pvrtc' in Project Settings." msgstr "" -"Ná»n tảng yêu cầu dùng kiểu nén 'ETC' cho GLES2. Báºt 'Nháºp ETC' trong Cà i đặt " -"Dá»± án." +"Ná»n tảng yêu cầu dùng kiểu nén 'PVRTC' cho GLES2. Hãy báºt 'Nháºp Pvrtc' trong " +"Cà i đặt Dá»± án." #: editor/editor_export.cpp -#, fuzzy msgid "" "Target platform requires 'ETC2' or 'PVRTC' texture compression for GLES3. " "Enable 'Import Etc 2' or 'Import Pvrtc' in Project Settings." msgstr "" -"Ná»n tảng yêu cầu dùng kiểu nén 'ETC2' cho GLES3. Báºt 'Nháºp ETC2' trong Cà i " -"đặt Dá»± án." +"Ná»n tảng yêu cầu dùng kiểu nén 'ETC2' hoặc 'PVRTC' cho GLES3. Hãy báºt 'Nháºp " +"ETC2' hoặc 'Nháºp Pvrtc' trong Cà i đặt Dá»± án." #: editor/editor_export.cpp #, fuzzy @@ -1643,8 +1640,9 @@ msgstr "Không tìm thấy mẫu gỡ lá»—i tuỳ chỉnh." #: editor/editor_export.cpp platform/android/export/export.cpp #: platform/iphone/export/export.cpp platform/javascript/export/export.cpp #: platform/osx/export/export.cpp platform/uwp/export/export.cpp +#, fuzzy msgid "Custom release template not found." -msgstr "" +msgstr "Không tìm thấy mẫu phát hà nh tùy chỉnh." #: editor/editor_export.cpp platform/javascript/export/export.cpp msgid "Template file not found:" @@ -2534,18 +2532,22 @@ msgstr "" #: editor/editor_node.cpp msgid "Unable to load addon script from path: '%s'." -msgstr "" +msgstr "Không thể nạp tệp lệnh bổ trợ từ Ä‘Æ°á»ng dẫn: '%s'." #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s' There seems to be an error in " "the code, please check the syntax." msgstr "" +"Không thể nạp tệp lệnh bổ trợ từ Ä‘Æ°á»ng dẫn: '%s' Có vẻ có lá»—i trong mã " +"nguồn, hãy kiểm tra lại cú pháp." #: editor/editor_node.cpp msgid "" "Unable to load addon script from path: '%s' Base type is not EditorPlugin." msgstr "" +"Không thể tải script addon từ Ä‘Æ°á»ng dẫn: '%s' Kiểu gốc không phải " +"EditorPlugin." #: editor/editor_node.cpp msgid "Unable to load addon script from path: '%s' Script is not in tool mode." @@ -3222,7 +3224,6 @@ msgid "Average Time (sec)" msgstr "Thá»i gian trung bình (giây)" #: editor/editor_profiler.cpp -#, fuzzy msgid "Frame %" msgstr "Khung hình %" @@ -3255,7 +3256,6 @@ msgid "Edit Text:" msgstr "Sá»a văn bản:" #: editor/editor_properties.cpp editor/script_create_dialog.cpp -#, fuzzy msgid "On" msgstr "Báºt" @@ -3626,7 +3626,6 @@ msgid "Godot Export Templates" msgstr "Các mẫu xuất bản Godot" #: editor/export_template_manager.cpp -#, fuzzy msgid "Export Template Manager" msgstr "Trình quản lý Mẫu Xuất" @@ -4022,14 +4021,12 @@ msgid "Generating Lightmaps" msgstr "" #: editor/import/resource_importer_scene.cpp -#, fuzzy msgid "Generating for Mesh: " msgstr "Tạo cho lÆ°á»›i: " #: editor/import/resource_importer_scene.cpp -#, fuzzy msgid "Running Custom Script..." -msgstr "Chạy Táºp lệnh Tá»± chá»n ..." +msgstr "Chạy Tệp lệnh Tá»± chá»n ..." #: editor/import/resource_importer_scene.cpp msgid "Couldn't load post-import script:" @@ -4152,12 +4149,10 @@ msgid "Open in Help" msgstr "Mở trong Trợ giúp" #: editor/inspector_dock.cpp -#, fuzzy msgid "Create a new resource in memory and edit it." msgstr "Tạo tà i nguyên má»›i trong bá»™ nhá»› rồi chỉnh sá»a." #: editor/inspector_dock.cpp -#, fuzzy msgid "Load an existing resource from disk and edit it." msgstr "Tải tà i nguyên có sẵn trong Ä‘Ä©a rồi chỉnh sá»a." @@ -4343,7 +4338,6 @@ msgstr "" #: editor/plugins/animation_blend_space_1d_editor.cpp #: editor/plugins/animation_blend_space_2d_editor.cpp scene/gui/graph_edit.cpp -#, fuzzy msgid "Enable snap and show grid." msgstr "Báºt DÃnh và hiện lÆ°á»›i." @@ -5001,14 +4995,12 @@ msgid "Request failed, return code:" msgstr "Yêu cầu thất bại, trả lại code:" #: editor/plugins/asset_library_editor_plugin.cpp -#, fuzzy msgid "Request failed." msgstr "Yêu cầu thất bại." #: editor/plugins/asset_library_editor_plugin.cpp -#, fuzzy msgid "Cannot save response to:" -msgstr "Không thể gỡ bá»:" +msgstr "Không thể lÆ°u phản hồi tá»›i:" #: editor/plugins/asset_library_editor_plugin.cpp msgid "Write error." @@ -5093,7 +5085,7 @@ msgstr "Cáºp nháºt gần đây" #: editor/plugins/asset_library_editor_plugin.cpp msgid "Least Recently Updated" -msgstr "" +msgstr "Lâu chÆ°a cáºp nháºt nhất" #: editor/plugins/asset_library_editor_plugin.cpp msgid "Name (A-Z)" @@ -5104,14 +5096,12 @@ msgid "Name (Z-A)" msgstr "Tên (Z-A)" #: editor/plugins/asset_library_editor_plugin.cpp -#, fuzzy msgid "License (A-Z)" -msgstr "Cấp phép" +msgstr "Giấy phép (A-Z)" #: editor/plugins/asset_library_editor_plugin.cpp -#, fuzzy msgid "License (Z-A)" -msgstr "Cấp phép" +msgstr "Giấy phép (Z-A)" #: editor/plugins/asset_library_editor_plugin.cpp msgid "First" @@ -5170,9 +5160,8 @@ msgid "Testing" msgstr "Kiểm tra" #: editor/plugins/asset_library_editor_plugin.cpp -#, fuzzy msgid "Loading..." -msgstr "Nạp ..." +msgstr "Äang tải..." #: editor/plugins/asset_library_editor_plugin.cpp msgid "Assets ZIP File" @@ -5224,7 +5213,6 @@ msgid "Preview" msgstr "Xem thá»" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Configure Snap" msgstr "Cà i đặt DÃnh" @@ -5241,9 +5229,8 @@ msgid "Primary Line Every:" msgstr "ÄÆ°á»ng kẻ chÃnh Má»—i:" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "steps" -msgstr "2 bÆ°á»›c" +msgstr "bÆ°á»›c" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Rotation Offset:" @@ -5254,9 +5241,8 @@ msgid "Rotation Step:" msgstr "BÆ°á»›c xoay:" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Scale Step:" -msgstr "Tá»· lệ:" +msgstr "BÆ°á»›c thu phóng:" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Move Vertical Guide" @@ -5288,58 +5274,49 @@ msgstr "Tạo Ä‘Æ°á»ng căn ngang và dá»c" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Set CanvasItem \"%s\" Pivot Offset to (%d, %d)" -msgstr "" +msgstr "Äặt Ä‘á»™ dá»i của CanvasItem \"%s\" tá»›i (%d, %d)" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Rotate %d CanvasItems" -msgstr "Xoay CanvasItem" +msgstr "Xoay %d CanvasItem" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Rotate CanvasItem \"%s\" to %d degrees" -msgstr "Xoay CanvasItem" +msgstr "Xoay CanvasItem \"%s\" thà nh %d Ä‘á»™" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Move CanvasItem \"%s\" Anchor" -msgstr "Di chuyển CanvasItem" +msgstr "Di chuyển neo CanvasItem \"%s\"" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Scale Node2D \"%s\" to (%s, %s)" -msgstr "" +msgstr "Thu phóng Node2D \"%s\" thà nh (%s, %s)" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Resize Control \"%s\" to (%d, %d)" msgstr "Chỉnh kÃch cỡ Nút Äiá»u khiển \"%s\" thà nh (%d, %d)" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Scale %d CanvasItems" -msgstr "Tỉ lệ CanvasItem" +msgstr "Thu phóng %d CanvasItem" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Scale CanvasItem \"%s\" to (%s, %s)" -msgstr "Tỉ lệ CanvasItem" +msgstr "Thu phóng CanvasItem \"%s\" thà nh (%s, %s)" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Move %d CanvasItems" -msgstr "Di chuyển CanvasItem" +msgstr "Di chuyển %d CanvasItem" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Move CanvasItem \"%s\" to (%d, %d)" -msgstr "Di chuyển CanvasItem" +msgstr "Di chuyển CanvasItem \"%s\" tá»›i (%d, %d)" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "" "Children of containers have their anchors and margins values overridden by " "their parent." -msgstr "" -"Mục con trong thùng chứa có giá trị neo và lá» của chúng được ghi đè bởi cha " -"chúng." +msgstr "Các nút Container sẽ ép các nút con theo neo và lá» mà nó xác định." #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Presets for the anchors and margins values of a Control node." @@ -5350,8 +5327,7 @@ msgid "" "When active, moving Control nodes changes their anchors instead of their " "margins." msgstr "" -"Khi hoạt Ä‘á»™ng, các nút Control di chuyển thay đổi các neo thay vì lá» của " -"chúng." +"Khi báºt, di chuyển các nút Control sẽ thay đổi neo thay vì lá» của chúng." #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Top Left" @@ -5426,7 +5402,7 @@ msgstr "Giữ Tỉ lệ" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Anchors only" -msgstr "Chỉ các neo" +msgstr "Chỉ neo" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Change Anchors and Margins" @@ -5526,9 +5502,8 @@ msgid "Press 'v' to Change Pivot, 'Shift+v' to Drag Pivot (while moving)." msgstr "" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Alt+RMB: Depth list selection" -msgstr "Alt+chuá»™t phải: Chá»n theo thứ tá»± trên dÆ°á»›i" +msgstr "Alt+chuá»™t phải: Chá»n theo tầng" #: editor/plugins/canvas_item_editor_plugin.cpp #: editor/plugins/spatial_editor_plugin.cpp @@ -5572,17 +5547,14 @@ msgid "Toggle smart snapping." msgstr "Báºt tắt DÃnh thông minh." #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Use Smart Snap" msgstr "Sá» dụng DÃnh thông minh" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Toggle grid snapping." msgstr "Báºt tắt DÃnh lÆ°á»›i." #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Use Grid Snap" msgstr "Sá» dụng DÃnh lÆ°á»›i" @@ -5599,7 +5571,6 @@ msgid "Use Scale Snap" msgstr "DÃnh theo bÆ°á»›c tỉ lệ" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Snap Relative" msgstr "DÃnh tÆ°Æ¡ng đối" @@ -5687,7 +5658,6 @@ msgid "Always Show Grid" msgstr "Hiện lÆ°á»›i" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Show Helpers" msgstr "Hiển thị trợ giúp" @@ -5700,9 +5670,8 @@ msgid "Show Guides" msgstr "Hiện Ä‘Æ°á»ng căn" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Show Origin" -msgstr "Hiện Ä‘iểm gốc" +msgstr "Hiện Gốc" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Show Viewport" @@ -5764,7 +5733,6 @@ msgid "Insert Key (Existing Tracks)" msgstr "" #: editor/plugins/canvas_item_editor_plugin.cpp -#, fuzzy msgid "Copy Pose" msgstr "Sao chép TÆ° thế" @@ -5843,9 +5811,8 @@ msgstr "" #: editor/plugins/cpu_particles_editor_plugin.cpp #: editor/plugins/particles_2d_editor_plugin.cpp #: editor/plugins/particles_editor_plugin.cpp -#, fuzzy msgid "Restart" -msgstr "Restart ngay" +msgstr "Khởi Ä‘á»™ng lại" #: editor/plugins/cpu_particles_2d_editor_plugin.cpp #: editor/plugins/particles_2d_editor_plugin.cpp @@ -5989,7 +5956,6 @@ msgid "Gradient Edited" msgstr "" #: editor/plugins/item_list_editor_plugin.cpp -#, fuzzy msgid "Item %d" msgstr "Mục %d" @@ -6176,7 +6142,6 @@ msgid "Create Outline Mesh" msgstr "Tạo lÆ°á»›i viá»n" #: editor/plugins/mesh_instance_editor_plugin.cpp -#, fuzzy msgid "Outline Size:" msgstr "KÃch cỡ viá»n:" @@ -6185,7 +6150,6 @@ msgid "UV Channel Debug" msgstr "" #: editor/plugins/mesh_library_editor_plugin.cpp -#, fuzzy msgid "Remove item %d?" msgstr "Xóa mục %d?" @@ -6342,7 +6306,7 @@ msgstr "Xóa Animation" #: editor/plugins/particles_2d_editor_plugin.cpp #: editor/plugins/particles_editor_plugin.cpp msgid "Generation Time (sec):" -msgstr "" +msgstr "Thá»i gian tạo (giây):" #: editor/plugins/particles_editor_plugin.cpp msgid "The geometry's faces don't contain any area." @@ -6355,7 +6319,7 @@ msgstr "Cảnh không chứa tệp lệnh." #: editor/plugins/particles_editor_plugin.cpp msgid "\"%s\" doesn't inherit from Spatial." -msgstr "" +msgstr "\"%s\" không kế thừa từ Spatial." #: editor/plugins/particles_editor_plugin.cpp msgid "\"%s\" doesn't contain geometry." @@ -6403,7 +6367,7 @@ msgstr "" #: editor/plugins/path_2d_editor_plugin.cpp msgid "Remove Point from Curve" -msgstr "" +msgstr "Xóa Ä‘iểm khá»i Ä‘Æ°á»ng cong" #: editor/plugins/path_2d_editor_plugin.cpp msgid "Remove Out-Control from Curve" @@ -6416,7 +6380,7 @@ msgstr "" #: editor/plugins/path_2d_editor_plugin.cpp #: editor/plugins/path_editor_plugin.cpp msgid "Add Point to Curve" -msgstr "" +msgstr "Thêm Äiểm và o ÄÆ°á»ng cong" #: editor/plugins/path_2d_editor_plugin.cpp msgid "Split Curve" @@ -6424,7 +6388,7 @@ msgstr "Chia Ä‘Æ°á»ng Curve" #: editor/plugins/path_2d_editor_plugin.cpp msgid "Move Point in Curve" -msgstr "" +msgstr "Di chuyển Äiểm trên ÄÆ°á»ng cong" #: editor/plugins/path_2d_editor_plugin.cpp msgid "Move In-Control in Curve" @@ -6451,7 +6415,7 @@ msgstr "Nhấp: Tạo Point" #: editor/plugins/path_2d_editor_plugin.cpp msgid "Left Click: Split Segment (in curve)" -msgstr "" +msgstr "Chuá»™t trái: Phân tách các Ä‘oạn (trong Ä‘Æ°á»ng cong)" #: editor/plugins/path_2d_editor_plugin.cpp #: editor/plugins/path_editor_plugin.cpp @@ -6465,7 +6429,7 @@ msgstr "" #: editor/plugins/path_2d_editor_plugin.cpp #: editor/plugins/path_editor_plugin.cpp msgid "Add Point (in empty space)" -msgstr "" +msgstr "Thêm Ä‘iểm (trong không gian trống)" #: editor/plugins/path_2d_editor_plugin.cpp #: editor/plugins/path_editor_plugin.cpp @@ -6475,31 +6439,33 @@ msgstr "Xóa Point" #: editor/plugins/path_2d_editor_plugin.cpp #: editor/plugins/path_editor_plugin.cpp msgid "Close Curve" -msgstr "" +msgstr "Äóng Ä‘Æ°á»ng cong" #: editor/plugins/path_2d_editor_plugin.cpp #: editor/plugins/path_editor_plugin.cpp editor/plugins/theme_editor_plugin.cpp #: editor/plugins/visual_shader_editor_plugin.cpp editor/project_export.cpp msgid "Options" -msgstr "" +msgstr "Tùy chá»n" #: editor/plugins/path_2d_editor_plugin.cpp #: editor/plugins/path_editor_plugin.cpp +#, fuzzy msgid "Mirror Handle Angles" -msgstr "" +msgstr "Äối xứng góc tay cầm" #: editor/plugins/path_2d_editor_plugin.cpp #: editor/plugins/path_editor_plugin.cpp +#, fuzzy msgid "Mirror Handle Lengths" -msgstr "" +msgstr "Äối xứng Ä‘á»™ dà i tay cầm" #: editor/plugins/path_editor_plugin.cpp msgid "Curve Point #" -msgstr "" +msgstr "Äiểm uốn #" #: editor/plugins/path_editor_plugin.cpp msgid "Set Curve Point Position" -msgstr "" +msgstr "Äặt vị trà điểm uốn" #: editor/plugins/path_editor_plugin.cpp msgid "Set Curve In Position" @@ -6511,7 +6477,7 @@ msgstr "" #: editor/plugins/path_editor_plugin.cpp msgid "Split Path" -msgstr "" +msgstr "Tách Ä‘Æ°á»ng" #: editor/plugins/path_editor_plugin.cpp msgid "Remove Path Point" @@ -6527,7 +6493,7 @@ msgstr "" #: editor/plugins/path_editor_plugin.cpp msgid "Split Segment (in curve)" -msgstr "" +msgstr "Phân tách Ä‘oạn (trong Ä‘Æ°á»ng cong)" #: editor/plugins/physical_bone_plugin.cpp msgid "Move Joint" @@ -6540,7 +6506,7 @@ msgstr "Thuá»™c tÃnh xÆ°Æ¡ng của nút Polygon2D không trỠđến nút Skel #: editor/plugins/polygon_2d_editor_plugin.cpp msgid "Sync Bones" -msgstr "" +msgstr "Äồng bá»™ XÆ°Æ¡ng" #: editor/plugins/polygon_2d_editor_plugin.cpp msgid "" @@ -6572,7 +6538,7 @@ msgstr "" #: editor/plugins/polygon_2d_editor_plugin.cpp msgid "Invalid Polygon (need 3 different vertices)" -msgstr "" +msgstr "Äa giác không hợp lệ (cần 3 đỉnh khác nhau)" #: editor/plugins/polygon_2d_editor_plugin.cpp #, fuzzy @@ -6637,7 +6603,7 @@ msgstr "Shift: Di chuyển tất" #: editor/plugins/polygon_2d_editor_plugin.cpp msgid "Shift+Command: Scale" -msgstr "" +msgstr "Shift+Command: Thu phóng" #: editor/plugins/polygon_2d_editor_plugin.cpp msgid "Ctrl: Rotate" @@ -6645,7 +6611,7 @@ msgstr "Ctrl: Xoay" #: editor/plugins/polygon_2d_editor_plugin.cpp msgid "Shift+Ctrl: Scale" -msgstr "" +msgstr "Shift+Ctrl: Thu phóng" #: editor/plugins/polygon_2d_editor_plugin.cpp msgid "Move Polygon" @@ -6806,7 +6772,7 @@ msgstr "Äóng và lÆ°u thay đổi?" #: editor/plugins/script_editor_plugin.cpp msgid "Error writing TextFile:" -msgstr "" +msgstr "Lá»—i viết TextFile:" #: editor/plugins/script_editor_plugin.cpp #, fuzzy @@ -6850,7 +6816,7 @@ msgstr "LÆ°u Scene vá»›i tên..." #: editor/plugins/script_editor_plugin.cpp msgid "Can't obtain the script for running." -msgstr "" +msgstr "Không thể lấy tệp lệnh để chạy." #: editor/plugins/script_editor_plugin.cpp msgid "Script failed reloading, check console for errors." @@ -6893,7 +6859,7 @@ msgstr "Tìm tiếp" #: editor/plugins/script_editor_plugin.cpp #: editor/plugins/script_text_editor.cpp msgid "Find Previous" -msgstr "" +msgstr "Tìm trÆ°á»›c đó" #: editor/plugins/script_editor_plugin.cpp #, fuzzy @@ -6902,7 +6868,7 @@ msgstr "Lá»c các thuá»™c tÃnh" #: editor/plugins/script_editor_plugin.cpp msgid "Toggle alphabetical sorting of the method list." -msgstr "" +msgstr "Báºt/tắt sắp xếp danh sách phÆ°Æ¡ng thức theo bảng chữ cái." #: editor/plugins/script_editor_plugin.cpp #, fuzzy @@ -7089,7 +7055,7 @@ msgstr "" #: editor/plugins/script_text_editor.cpp msgid "[Ignore]" -msgstr "" +msgstr "[Bá» qua]" #: editor/plugins/script_text_editor.cpp msgid "Line" @@ -7119,15 +7085,15 @@ msgstr "Chá»n mà u" #: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp msgid "Convert Case" -msgstr "" +msgstr "Chuyển đổi Hoa thÆ°á»ng" #: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp msgid "Uppercase" -msgstr "" +msgstr "Chữ hoa" #: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp msgid "Lowercase" -msgstr "" +msgstr "Chữ thÆ°á»ng" #: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp msgid "Capitalize" @@ -7135,12 +7101,12 @@ msgstr "" #: editor/plugins/script_text_editor.cpp editor/plugins/text_editor.cpp msgid "Syntax Highlighter" -msgstr "" +msgstr "Nổi mà u cú pháp" #: editor/plugins/script_text_editor.cpp #: editor/plugins/shader_editor_plugin.cpp editor/plugins/text_editor.cpp msgid "Bookmarks" -msgstr "" +msgstr "Dấu trang" #: editor/plugins/script_text_editor.cpp msgid "Breakpoints" @@ -7149,7 +7115,7 @@ msgstr "Äiểm dừng" #: editor/plugins/script_text_editor.cpp #: editor/plugins/shader_editor_plugin.cpp editor/plugins/text_editor.cpp msgid "Go To" -msgstr "" +msgstr "Äi tá»›i" #: editor/plugins/script_text_editor.cpp editor/scene_tree_dock.cpp #: scene/gui/line_edit.cpp scene/gui/text_edit.cpp @@ -7163,31 +7129,31 @@ msgstr "Chá»n Toà n Bá»™" #: editor/plugins/script_text_editor.cpp msgid "Delete Line" -msgstr "" +msgstr "Xóa dòng" #: editor/plugins/script_text_editor.cpp msgid "Indent Left" -msgstr "" +msgstr "Thụt lá» Trái" #: editor/plugins/script_text_editor.cpp msgid "Indent Right" -msgstr "" +msgstr "Thụt lá» phải" #: editor/plugins/script_text_editor.cpp msgid "Toggle Comment" -msgstr "" +msgstr "Báºt/tắt chú thÃch" #: editor/plugins/script_text_editor.cpp msgid "Fold/Unfold Line" -msgstr "" +msgstr "Cuá»™n/Trải dòng" #: editor/plugins/script_text_editor.cpp msgid "Fold All Lines" -msgstr "" +msgstr "Cuá»™n tất cả các dòng" #: editor/plugins/script_text_editor.cpp msgid "Unfold All Lines" -msgstr "" +msgstr "Trải tất cả các dòng" #: editor/plugins/script_text_editor.cpp msgid "Clone Down" @@ -7204,19 +7170,19 @@ msgstr "Chá»n Scale" #: editor/plugins/script_text_editor.cpp msgid "Trim Trailing Whitespace" -msgstr "" +msgstr "Xóa khoảng trắng cuối dòng" #: editor/plugins/script_text_editor.cpp msgid "Convert Indent to Spaces" -msgstr "" +msgstr "Chuyển thụt lá» thà nh Dấu cách" #: editor/plugins/script_text_editor.cpp msgid "Convert Indent to Tabs" -msgstr "" +msgstr "Chuyển thụt lá» thà nh Tab" #: editor/plugins/script_text_editor.cpp msgid "Auto Indent" -msgstr "" +msgstr "Thụt lá» Tá»± Ä‘á»™ng" #: editor/plugins/script_text_editor.cpp #, fuzzy @@ -7244,7 +7210,7 @@ msgstr "Äến Step trÆ°á»›c đó" #: editor/plugins/script_text_editor.cpp msgid "Remove All Bookmarks" -msgstr "" +msgstr "Xóa hết má»i dấu trang" #: editor/plugins/script_text_editor.cpp msgid "Go to Function..." @@ -7256,12 +7222,13 @@ msgstr "Äến Dòng..." #: editor/plugins/script_text_editor.cpp #: modules/visual_script/visual_script_editor.cpp +#, fuzzy msgid "Toggle Breakpoint" -msgstr "" +msgstr "Tạo Ä‘iểm dừng" #: editor/plugins/script_text_editor.cpp msgid "Remove All Breakpoints" -msgstr "" +msgstr "Xóa hết má»i Ä‘iểm dừng" #: editor/plugins/script_text_editor.cpp #, fuzzy @@ -7298,19 +7265,19 @@ msgstr "" #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "Skeleton2D" -msgstr "" +msgstr "Skeleton2D" #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "Make Rest Pose (From Bones)" -msgstr "" +msgstr "Tạo tÆ° thế nghỉ (Từ XÆ°Æ¡ng)" #: editor/plugins/skeleton_2d_editor_plugin.cpp msgid "Set Bones to Rest Pose" -msgstr "" +msgstr "Äặt XÆ°Æ¡ng thà nh TÆ° thế Nghỉ" #: editor/plugins/skeleton_editor_plugin.cpp msgid "Create physical bones" -msgstr "" +msgstr "Tạo xÆ°Æ¡ng váºt lý" #: editor/plugins/skeleton_editor_plugin.cpp #, fuzzy @@ -7318,8 +7285,9 @@ msgid "Skeleton" msgstr "Xóa Point" #: editor/plugins/skeleton_editor_plugin.cpp +#, fuzzy msgid "Create physical skeleton" -msgstr "" +msgstr "Tạo bá»™ xÆ°Æ¡ng váºt lý" #: editor/plugins/skeleton_ik_editor_plugin.cpp msgid "Play IK" @@ -7462,7 +7430,6 @@ msgid "Align Rotation with View" msgstr "" #: editor/plugins/spatial_editor_plugin.cpp editor/scene_tree_dock.cpp -#, fuzzy msgid "No parent to instance a child at." msgstr "Không có nút mẹ để khởi tạo nút con." @@ -7511,7 +7478,6 @@ msgid "View FPS" msgstr "Xem tốc Ä‘á»™ khung hình" #: editor/plugins/spatial_editor_plugin.cpp -#, fuzzy msgid "Half Resolution" msgstr "Ná»a Ä‘á»™ phân giải" @@ -7593,14 +7559,13 @@ msgstr "" #: editor/plugins/spatial_editor_plugin.cpp #, fuzzy msgid "Snap Nodes To Floor" -msgstr "DÃnh các nút lên Sà n" +msgstr "DÃnh Nút lên Sà n" #: editor/plugins/spatial_editor_plugin.cpp msgid "Couldn't find a solid floor to snap the selection to." msgstr "" #: editor/plugins/spatial_editor_plugin.cpp -#, fuzzy msgid "" "Drag: Rotate\n" "Alt+Drag: Move\n" @@ -7611,7 +7576,6 @@ msgstr "" "Alt+Chuá»™t phải: Chá»n theo tầng" #: editor/plugins/spatial_editor_plugin.cpp -#, fuzzy msgid "Use Local Space" msgstr "Sá» dụng Không gian Cục bá»™" @@ -7670,9 +7634,8 @@ msgid "Transform" msgstr "Biến đổi" #: editor/plugins/spatial_editor_plugin.cpp -#, fuzzy msgid "Snap Object to Floor" -msgstr "DÃnh váºt vá»›i Sà n" +msgstr "DÃnh Váºt lên Sà n" #: editor/plugins/spatial_editor_plugin.cpp #, fuzzy @@ -7778,7 +7741,6 @@ msgid "Pre" msgstr "TrÆ°á»›c" #: editor/plugins/spatial_editor_plugin.cpp -#, fuzzy msgid "Post" msgstr "Sau" @@ -8266,7 +8228,6 @@ msgid "Enable Priority" msgstr "" #: editor/plugins/tile_map_editor_plugin.cpp -#, fuzzy msgid "Filter tiles" msgstr "Lá»c ô" @@ -8596,7 +8557,6 @@ msgid "Clear Tile Bitmask" msgstr "" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Make Polygon Concave" msgstr "Biến thà nh Ä‘a giác lõm" @@ -8628,9 +8588,8 @@ msgid "Edit Tile Priority" msgstr "Chỉnh Ä‘á»™ Æ°u tiên của ô" #: editor/plugins/tile_set_editor_plugin.cpp -#, fuzzy msgid "Edit Tile Z Index" -msgstr "Sá»a chiá»u Z của ô" +msgstr "Sá»a chiá»u sâu (Z) của ô" #: editor/plugins/tile_set_editor_plugin.cpp #, fuzzy @@ -8739,7 +8698,6 @@ msgstr "Äổi" #: editor/plugins/version_control_editor_plugin.cpp #: modules/gdnative/gdnative_library_singleton_editor.cpp -#, fuzzy msgid "Status" msgstr "Trạng thái" @@ -9282,7 +9240,6 @@ msgid "Finds the truncated value of the parameter." msgstr "" #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Adds scalar to scalar." msgstr "Cá»™ng hai số." @@ -9291,7 +9248,6 @@ msgid "Divides scalar by scalar." msgstr "Chia hai số." #: editor/plugins/visual_shader_editor_plugin.cpp -#, fuzzy msgid "Multiplies scalar by scalar." msgstr "Nhân hai số." @@ -10703,7 +10659,6 @@ msgid "Detach Script" msgstr "ÄÃnh kèm Script" #: editor/scene_tree_dock.cpp -#, fuzzy msgid "This operation can't be done on the tree root." msgstr "Thao tác nà y không thể áp dụng lên gốc của cây." @@ -10840,12 +10795,11 @@ msgid "Change type of node(s)" msgstr "Äổi loại của các nút" #: editor/scene_tree_dock.cpp -#, fuzzy msgid "" "Couldn't save new scene. Likely dependencies (instances) couldn't be " "satisfied." msgstr "" -"Không thể lÆ°u cảnh má»›i. Có khi là do không thá»a mãn được các phần phụ thuá»™c." +"Không thể lÆ°u cảnh má»›i. Có vẻ là do không thá»a mãn được các phần phụ thuá»™c." #: editor/scene_tree_dock.cpp msgid "Error saving scene." @@ -10864,9 +10818,8 @@ msgid "Clear Inheritance" msgstr "Xóa Kế thừa" #: editor/scene_tree_dock.cpp -#, fuzzy msgid "Editable Children" -msgstr "Các Con có thể sá»a" +msgstr "Các nút Con có thể sá»a" #: editor/scene_tree_dock.cpp msgid "Load As Placeholder" @@ -10917,7 +10870,6 @@ msgid "Copy Node Path" msgstr "Sao chép Ä‘Æ°á»ng dẫn nút" #: editor/scene_tree_dock.cpp -#, fuzzy msgid "Delete (No Confirm)" msgstr "Xóa (Không há»i lại)" @@ -10948,11 +10900,11 @@ msgstr "" #: editor/scene_tree_dock.cpp msgid "Local" -msgstr "" +msgstr "Cục bá»™" #: editor/scene_tree_dock.cpp msgid "Clear Inheritance? (No Undo!)" -msgstr "" +msgstr "Xóa Kế thừa? (Mất tăm luôn đấy!)" #: editor/scene_tree_editor.cpp msgid "Toggle Visible" @@ -11017,6 +10969,8 @@ msgid "" "Children are not selectable.\n" "Click to make selectable." msgstr "" +"Không thể chá»n Con của nút nà y.\n" +"Bấm và o đây để có thể chá»n chúng." #: editor/scene_tree_editor.cpp msgid "Toggle Visibility" @@ -11027,6 +10981,8 @@ msgid "" "AnimationPlayer is pinned.\n" "Click to unpin." msgstr "" +"AnimationPlayer đã được ghim.\n" +"Bấm để bá» ghim." #: editor/scene_tree_editor.cpp msgid "Invalid node name, the following characters are not allowed:" @@ -11050,11 +11006,11 @@ msgstr "Chá»n má»™t Nút" #: editor/script_create_dialog.cpp msgid "Path is empty." -msgstr "" +msgstr "ÄÆ°á»ng dẫn trống." #: editor/script_create_dialog.cpp msgid "Filename is empty." -msgstr "" +msgstr "Tên tệp trống." #: editor/script_create_dialog.cpp msgid "Path is not local." @@ -11075,17 +11031,16 @@ msgid "File does not exist." msgstr "Tệp không tồn tại." #: editor/script_create_dialog.cpp -#, fuzzy msgid "Invalid extension." msgstr "Tên Ä‘uôi không hợp lệ." #: editor/script_create_dialog.cpp msgid "Wrong extension chosen." -msgstr "" +msgstr "Sai Ä‘uôi mở rá»™ng." #: editor/script_create_dialog.cpp msgid "Error loading template '%s'" -msgstr "" +msgstr "Lá»—i nạp mẫu '%s'" #: editor/script_create_dialog.cpp msgid "Error - Could not create script in filesystem." @@ -11093,7 +11048,7 @@ msgstr "" #: editor/script_create_dialog.cpp msgid "Error loading script from %s" -msgstr "" +msgstr "Lá»—i nạp tệp lệnh từ %s" #: editor/script_create_dialog.cpp #, fuzzy @@ -11101,12 +11056,13 @@ msgid "Overrides" msgstr "Ghi đè" #: editor/script_create_dialog.cpp +#, fuzzy msgid "N/A" -msgstr "" +msgstr "Không có" #: editor/script_create_dialog.cpp msgid "Open Script / Choose Location" -msgstr "" +msgstr "Mở tệp lệnh / Chá»n vị trÃ" #: editor/script_create_dialog.cpp #, fuzzy @@ -11114,8 +11070,9 @@ msgid "Open Script" msgstr "Tạo Script" #: editor/script_create_dialog.cpp +#, fuzzy msgid "File exists, it will be reused." -msgstr "" +msgstr "Tệp tồn tại, và sẽ được dùng lại." #: editor/script_create_dialog.cpp #, fuzzy @@ -11137,11 +11094,11 @@ msgstr "Animation tree khả dụng." #: editor/script_create_dialog.cpp msgid "Allowed: a-z, A-Z, 0-9, _ and ." -msgstr "" +msgstr "Äược dùng: a-z, A-Z, 0-9, _ và ." #: editor/script_create_dialog.cpp msgid "Built-in script (into scene file)." -msgstr "" +msgstr "Tệp lệnh tÃch hợp (và o tệp cảnh)." #: editor/script_create_dialog.cpp msgid "Will create a new script file." @@ -11149,7 +11106,7 @@ msgstr "Sẽ tạo má»™t tệp lệnh má»›i." #: editor/script_create_dialog.cpp msgid "Will load an existing script file." -msgstr "" +msgstr "Sẽ nạp má»™t tệp lệnh đã tồn tại." #: editor/script_create_dialog.cpp #, fuzzy @@ -11161,6 +11118,8 @@ msgid "" "Note: Built-in scripts have some limitations and can't be edited using an " "external editor." msgstr "" +"LÆ°u ý: Tệp lệnh tÃch hợp có má»™t số hạn chế và không thể chỉnh sá»a bằng trình " +"biên soạn bên ngoà i." #: editor/script_create_dialog.cpp msgid "Class Name:" @@ -11184,7 +11143,7 @@ msgstr "" #: editor/script_editor_debugger.cpp msgid "Bytes:" -msgstr "" +msgstr "Bytes:" #: editor/script_editor_debugger.cpp msgid "Warning:" @@ -11212,8 +11171,9 @@ msgid "Source:" msgstr "Nguồn:" #: editor/script_editor_debugger.cpp +#, fuzzy msgid "C++ Source:" -msgstr "" +msgstr "Tệp nguồn C++:" #: editor/script_editor_debugger.cpp msgid "Stack Trace" @@ -11221,7 +11181,7 @@ msgstr "" #: editor/script_editor_debugger.cpp msgid "Errors" -msgstr "" +msgstr "Lá»—i" #: editor/script_editor_debugger.cpp msgid "Child process connected." @@ -11229,7 +11189,7 @@ msgstr "Äã kết nối tiến trình con." #: editor/script_editor_debugger.cpp msgid "Copy Error" -msgstr "" +msgstr "Sao chép lá»—i" #: editor/script_editor_debugger.cpp msgid "Video RAM" @@ -11261,28 +11221,31 @@ msgid "Network Profiler" msgstr "Xuất hồ sÆ¡" #: editor/script_editor_debugger.cpp +#, fuzzy msgid "Monitor" -msgstr "" +msgstr "Mà n hình" #: editor/script_editor_debugger.cpp msgid "Value" -msgstr "" +msgstr "Giá trị" #: editor/script_editor_debugger.cpp +#, fuzzy msgid "Monitors" -msgstr "" +msgstr "Mà n hình" #: editor/script_editor_debugger.cpp msgid "Pick one or more items from the list to display the graph." -msgstr "" +msgstr "Chá»n má»™t hoặc nhiá»u mục từ danh sách để hiển thị biểu đồ." #: editor/script_editor_debugger.cpp msgid "List of Video Memory Usage by Resource:" msgstr "" #: editor/script_editor_debugger.cpp +#, fuzzy msgid "Total:" -msgstr "" +msgstr "Tổng:" #: editor/script_editor_debugger.cpp #, fuzzy @@ -11291,23 +11254,24 @@ msgstr "Xuất hồ sÆ¡" #: editor/script_editor_debugger.cpp msgid "Resource Path" -msgstr "" +msgstr "ÄÆ°á»ng dẫn Tà i nguyên" #: editor/script_editor_debugger.cpp msgid "Type" -msgstr "" +msgstr "Kiểu" #: editor/script_editor_debugger.cpp msgid "Format" -msgstr "" +msgstr "Äịnh dạng" #: editor/script_editor_debugger.cpp msgid "Usage" msgstr "" #: editor/script_editor_debugger.cpp +#, fuzzy msgid "Misc" -msgstr "" +msgstr "Khác" #: editor/script_editor_debugger.cpp msgid "Clicked Control:" @@ -11331,15 +11295,15 @@ msgstr "" #: editor/settings_config_dialog.cpp msgid "Erase Shortcut" -msgstr "" +msgstr "Xóa lối tắt" #: editor/settings_config_dialog.cpp msgid "Restore Shortcut" -msgstr "" +msgstr "Khôi phục lối tắt" #: editor/settings_config_dialog.cpp msgid "Change Shortcut" -msgstr "" +msgstr "Thay đổi Lối tắt" #: editor/settings_config_dialog.cpp msgid "Editor Settings" @@ -11347,7 +11311,7 @@ msgstr "Cà i đặt Trình biên táºp" #: editor/settings_config_dialog.cpp msgid "Shortcuts" -msgstr "" +msgstr "Lối tắt" #: editor/settings_config_dialog.cpp msgid "Binding" @@ -11355,7 +11319,7 @@ msgstr "" #: editor/spatial_editor_gizmos.cpp msgid "Change Light Radius" -msgstr "" +msgstr "Thay đổi bán kÃnh ánh sáng" #: editor/spatial_editor_gizmos.cpp msgid "Change AudioStreamPlayer3D Emission Angle" @@ -11382,8 +11346,9 @@ msgid "Change Probe Extents" msgstr "" #: editor/spatial_editor_gizmos.cpp modules/csg/csg_gizmos.cpp +#, fuzzy msgid "Change Sphere Shape Radius" -msgstr "" +msgstr "Thay đổi bán kÃnh hình cầu" #: editor/spatial_editor_gizmos.cpp modules/csg/csg_gizmos.cpp msgid "Change Box Shape Extents" @@ -11512,7 +11477,6 @@ msgid "Invalid instance dictionary format (invalid script at @path)" msgstr "" #: modules/gdscript/gdscript_functions.cpp -#, fuzzy msgid "Invalid instance dictionary (invalid subclasses)" msgstr "Từ Ä‘iển không hợp lệ (Lá»›p con không hợp lệ)" @@ -12661,13 +12625,15 @@ msgstr "" #: scene/3d/arvr_nodes.cpp msgid "ARVRAnchor must have an ARVROrigin node as its parent." -msgstr "" +msgstr "ARVRAnchor phải là con của nút ARVROrigin." #: scene/3d/arvr_nodes.cpp msgid "" "The anchor ID must not be 0 or this anchor won't be bound to an actual " "anchor." msgstr "" +"ID của neo phải là 0, nếu không thì neo nà y sẽ không bị rà ng buá»™c vá»›i neo " +"thá»±c." #: scene/3d/arvr_nodes.cpp msgid "ARVROrigin requires an ARVRCamera child node." diff --git a/editor/translations/zh_CN.po b/editor/translations/zh_CN.po index a1c1bd4aea..e043d0f05a 100644 --- a/editor/translations/zh_CN.po +++ b/editor/translations/zh_CN.po @@ -81,7 +81,7 @@ msgid "" msgstr "" "Project-Id-Version: Chinese (Simplified) (Godot Engine)\n" "POT-Creation-Date: 2018-01-20 12:15+0200\n" -"PO-Revision-Date: 2021-03-21 12:25+0000\n" +"PO-Revision-Date: 2021-04-05 14:28+0000\n" "Last-Translator: Haoyu Qiu <timothyqiu32@gmail.com>\n" "Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/" "godot-engine/godot/zh_Hans/>\n" @@ -90,7 +90,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.5.2-dev\n" +"X-Generator: Weblate 4.6-dev\n" #: core/math/expression.cpp modules/gdscript/gdscript_functions.cpp #: modules/visual_script/visual_script_builtin_funcs.cpp @@ -1376,7 +1376,7 @@ msgstr "总线选项" #: editor/editor_audio_buses.cpp editor/filesystem_dock.cpp #: editor/plugins/animation_player_editor_plugin.cpp editor/scene_tree_dock.cpp msgid "Duplicate" -msgstr "æ‹·è´" +msgstr "å¤åˆ¶" #: editor/editor_audio_buses.cpp msgid "Reset Volume" @@ -3662,7 +3662,7 @@ msgstr "状æ€ï¼šå¯¼å…¥æ–‡ä»¶å¤±è´¥ã€‚请手动修å¤æ–‡ä»¶åŽé‡æ–°å¯¼å…¥ã€‚" #: editor/filesystem_dock.cpp msgid "" "Importing has been disabled for this file, so it can't be opened for editing." -msgstr "" +msgstr "该文件的导入已被ç¦ç”¨ï¼Œå› æ¤ä¸èƒ½æ‰“开进行编辑。" #: editor/filesystem_dock.cpp msgid "Cannot move/rename resources root." @@ -4063,7 +4063,7 @@ msgstr "é‡ç½®ä¸ºé»˜è®¤å€¼" #: editor/import_dock.cpp msgid "Keep File (No Import)" -msgstr "" +msgstr "ä¿ç•™æ–‡ä»¶ï¼ˆä¸å¯¼å…¥ï¼‰" #: editor/import_dock.cpp msgid "%d Files" @@ -5204,7 +5204,7 @@ msgstr "设置å¸é™„" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Grid Offset:" -msgstr "ç½‘æ ¼å移é‡:" +msgstr "ç½‘æ ¼å移:" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Grid Step:" @@ -5220,7 +5220,7 @@ msgstr "æ¥" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Rotation Offset:" -msgstr "旋转å移é‡:" +msgstr "旋转å移:" #: editor/plugins/canvas_item_editor_plugin.cpp msgid "Rotation Step:" @@ -7502,7 +7502,7 @@ msgstr "" "\n" "ç眼:Gizmo å¯è§ã€‚\n" "é—眼:Gizmo éšè—。\n" -"åŠç眼:Gizmo 也å¯ç©¿è¿‡ä¸é€æ˜Žçš„表é¢å¯è§ï¼ˆâ€œX-Ray - X å…‰â€ï¼‰ã€‚" +"åŠç眼:Gizmo 也å¯ç©¿è¿‡ä¸é€æ˜Žçš„表é¢å¯è§ï¼ˆâ€œX å…‰â€ï¼‰ã€‚" #: editor/plugins/spatial_editor_plugin.cpp msgid "Snap Nodes To Floor" @@ -7931,7 +7931,7 @@ msgstr "自动è£å‰ª" #: editor/plugins/texture_region_editor_plugin.cpp msgid "Offset:" -msgstr "å移é‡ï¼š" +msgstr "å移:" #: editor/plugins/texture_region_editor_plugin.cpp msgid "Step:" diff --git a/main/main.cpp b/main/main.cpp index aa925c508c..4103fad17c 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -365,7 +365,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" <path> should be absolute or relative to the project directory, and include the filename for the binary (e.g. 'builds/game.exe'). The target directory should exist.\n"); OS::get_singleton()->print(" --export-debug <preset> <path> Same as --export, but using the debug template.\n"); OS::get_singleton()->print(" --export-pack <preset> <path> Same as --export, but only export the game pack for the given preset. The <path> extension determines whether it will be in PCK or ZIP format.\n"); - OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n"); + OS::get_singleton()->print(" --doctool [<path>] Dump the engine API reference to the given <path> (defaults to current dir) in XML format, merging if existing files are found.\n"); OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n"); OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects). Implies --editor and requires a valid project to edit.\n"); #ifdef DEBUG_METHODS_ENABLED @@ -1826,8 +1826,7 @@ bool Main::start() { ERR_FAIL_COND_V(!_start_success, false); bool hasicon = false; - String doc_tool; - List<String> removal_docs; + String doc_tool_path; String positional_arg; String game_path; String script; @@ -1881,9 +1880,11 @@ bool Main::start() { script = args[i + 1]; #ifdef TOOLS_ENABLED } else if (args[i] == "--doctool") { - doc_tool = args[i + 1]; - for (int j = i + 2; j < args.size(); j++) { - removal_docs.push_back(args[j]); + doc_tool_path = args[i + 1]; + if (doc_tool_path.begins_with("-")) { + // Assuming other command line arg, so default to cwd. + doc_tool_path = "."; + parsed_pair = false; } } else if (args[i] == "--export") { editor = true; //needs editor @@ -1904,16 +1905,19 @@ bool Main::start() { if (parsed_pair) { i++; } + } else if (args[i] == "--doctool") { + // Handle case where no path is given to --doctool. + doc_tool_path = "."; } } #ifdef TOOLS_ENABLED - if (doc_tool != "") { + if (doc_tool_path != "") { Engine::get_singleton()->set_editor_hint( true); // Needed to instance editor-only classes for their default values { - DirAccessRef da = DirAccess::open(doc_tool); + DirAccessRef da = DirAccess::open(doc_tool_path); ERR_FAIL_COND_V_MSG(!da, false, "Argument supplied to --doctool must be a valid directory path."); } @@ -1943,7 +1947,7 @@ bool Main::start() { // Custom modules are always located by absolute path. String path = _doc_data_class_paths[i].path; if (path.is_rel_path()) { - path = doc_tool.plus_file(path); + path = doc_tool_path.plus_file(path); } String name = _doc_data_class_paths[i].name; doc_data_classes[name] = path; @@ -1960,7 +1964,7 @@ bool Main::start() { } } - String index_path = doc_tool.plus_file("doc/classes"); + String index_path = doc_tool_path.plus_file("doc/classes"); // Create the main documentation directory if it doesn't exist DirAccess *da = DirAccess::create_for_path(index_path); da->make_dir_recursive(index_path); @@ -2533,10 +2537,10 @@ bool Main::iteration() { if (frame > 1000000) { if (editor || project_manager) { if (print_fps) { - print_line("Editor FPS: " + itos(frames)); + print_line(vformat("Editor FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(1))); } } else if (GLOBAL_GET("debug/settings/stdout/print_fps") || print_fps) { - print_line("Game FPS: " + itos(frames)); + print_line(vformat("Project FPS: %d (%s mspf)", frames, rtos(1000.0 / frames).pad_decimals(1))); } Engine::get_singleton()->_fps = frames; diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index ceae3be8bc..bdaec4a09e 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -1235,6 +1235,10 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran continue; } + if (kin_shape.shape->getShapeType() == EMPTY_SHAPE_PROXYTYPE) { + continue; + } + btTransform shape_transform = p_body_position * kin_shape.transform; shape_transform.getOrigin() += r_delta_recover_movement; diff --git a/modules/fbx/editor_scene_importer_fbx.cpp b/modules/fbx/editor_scene_importer_fbx.cpp index e18ebe3930..55d524883f 100644 --- a/modules/fbx/editor_scene_importer_fbx.cpp +++ b/modules/fbx/editor_scene_importer_fbx.cpp @@ -94,7 +94,7 @@ Node3D *EditorSceneImporterFBX::import_scene(const String &p_path, uint32_t p_fl Error err; FileAccessRef f = FileAccess::open(p_path, FileAccess::READ, &err); - ERR_FAIL_COND_V(!f, NULL); + ERR_FAIL_COND_V(!f, nullptr); { PackedByteArray data; @@ -104,6 +104,9 @@ Node3D *EditorSceneImporterFBX::import_scene(const String &p_path, uint32_t p_fl bool is_binary = false; data.resize(f->get_len()); + + ERR_FAIL_COND_V(data.size() < 64, NULL); + f->get_buffer(data.ptrw(), data.size()); PackedByteArray fbx_header; fbx_header.resize(64); @@ -260,8 +263,9 @@ T EditorSceneImporterFBX::_interpolate_track(const Vector<float> &p_times, const //could use binary search, worth it? int idx = -1; for (int i = 0; i < p_times.size(); i++) { - if (p_times[i] > p_time) + if (p_times[i] > p_time) { break; + } idx++; } @@ -334,7 +338,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene( ImportState state; state.is_blender_fbx = p_is_blender_fbx; state.path = p_path; - state.animation_player = NULL; + state.animation_player = nullptr; // create new root node for scene Node3D *scene_root = memnew(Node3D); @@ -610,8 +614,9 @@ Node3D *EditorSceneImporterFBX::_generate_scene( for (const FBXDocParser::Geometry *mesh : geometry) { print_verbose("[doc] [" + itos(mesh->ID()) + "] mesh: " + fbx_node->node_name); - if (mesh == nullptr) + if (mesh == nullptr) { continue; + } const FBXDocParser::MeshGeometry *mesh_geometry = dynamic_cast<const FBXDocParser::MeshGeometry *>(mesh); if (mesh_geometry) { @@ -628,7 +633,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene( mesh_data_precached->mesh_node = fbx_node; // mesh node, mesh id - mesh_node = mesh_data_precached->create_fbx_mesh(state, mesh_geometry, fbx_node->fbx_model, 0); + mesh_node = mesh_data_precached->create_fbx_mesh(state, mesh_geometry, fbx_node->fbx_model, false); if (!state.MeshNodes.has(mesh_id)) { state.MeshNodes.insert(mesh_id, fbx_node); } diff --git a/modules/fbx/editor_scene_importer_fbx.h b/modules/fbx/editor_scene_importer_fbx.h index 39f8648b0f..4bb2c9d21b 100644 --- a/modules/fbx/editor_scene_importer_fbx.h +++ b/modules/fbx/editor_scene_importer_fbx.h @@ -128,7 +128,7 @@ public: virtual void get_extensions(List<String> *r_extensions) const override; virtual uint32_t get_import_flags() const override; - virtual Node3D *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = NULL) override; + virtual Node3D *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, List<String> *r_missing_deps, Error *r_err = nullptr) override; }; #endif // TOOLS_ENABLED diff --git a/modules/fbx/fbx_parser/ByteSwapper.h b/modules/fbx/fbx_parser/ByteSwapper.h index f759c9117c..5c16383974 100644 --- a/modules/fbx/fbx_parser/ByteSwapper.h +++ b/modules/fbx/fbx_parser/ByteSwapper.h @@ -264,8 +264,9 @@ struct Getter { le = !le; if (le) { ByteSwapper<T, (sizeof(T) > 1 ? true : false)>()(inout); - } else + } else { ByteSwapper<T, false>()(inout); + } } }; diff --git a/modules/fbx/fbx_parser/FBXAnimation.cpp b/modules/fbx/fbx_parser/FBXAnimation.cpp index b11e2c7f55..4ab5edebb1 100644 --- a/modules/fbx/fbx_parser/FBXAnimation.cpp +++ b/modules/fbx/fbx_parser/FBXAnimation.cpp @@ -130,7 +130,7 @@ AnimationCurve::~AnimationCurve() { AnimationCurveNode::AnimationCurveNode(uint64_t id, const ElementPtr element, const std::string &name, const Document &doc, const char *const *target_prop_whitelist /*= NULL*/, size_t whitelist_size /*= 0*/) : - Object(id, element, name), target(), doc(doc) { + Object(id, element, name), doc(doc) { const ScopePtr sc = GetRequiredScope(element); // find target node diff --git a/modules/fbx/fbx_parser/FBXDocument.cpp b/modules/fbx/fbx_parser/FBXDocument.cpp index bcf7fa1565..d156db201b 100644 --- a/modules/fbx/fbx_parser/FBXDocument.cpp +++ b/modules/fbx/fbx_parser/FBXDocument.cpp @@ -93,7 +93,7 @@ using namespace Util; // ------------------------------------------------------------------------------------------------ LazyObject::LazyObject(uint64_t id, const ElementPtr element, const Document &doc) : - doc(doc), element(element), id(id), flags() { + doc(doc), element(element), id(id) { // empty } @@ -252,7 +252,7 @@ FileGlobalSettings::~FileGlobalSettings() { // ------------------------------------------------------------------------------------------------ Document::Document(const Parser &parser, const ImportSettings &settings) : - settings(settings), parser(parser), SafeToImport(false) { + settings(settings), parser(parser) { // Cannot use array default initialization syntax because vc8 fails on it for (unsigned int &timeStamp : creationTimeStamp) { timeStamp = 0; diff --git a/modules/fbx/fbx_parser/FBXDocument.h b/modules/fbx/fbx_parser/FBXDocument.h index b810197d7e..20e635a6a4 100644 --- a/modules/fbx/fbx_parser/FBXDocument.h +++ b/modules/fbx/fbx_parser/FBXDocument.h @@ -670,7 +670,7 @@ public: uint8_t *RelinquishContent() { uint8_t *ptr = content; - content = 0; + content = nullptr; return ptr; } diff --git a/modules/fbx/fbx_parser/FBXDocumentUtil.cpp b/modules/fbx/fbx_parser/FBXDocumentUtil.cpp index 835b66ab23..df50a32c39 100644 --- a/modules/fbx/fbx_parser/FBXDocumentUtil.cpp +++ b/modules/fbx/fbx_parser/FBXDocumentUtil.cpp @@ -160,7 +160,7 @@ const PropertyTable *GetPropertyTable(const Document &doc, DOMWarning("property table (Properties70) not found", element); } if (templateProps) { - return templateProps; + return new const PropertyTable(templateProps); } else { return new const PropertyTable(); } diff --git a/modules/fbx/fbx_parser/FBXImportSettings.h b/modules/fbx/fbx_parser/FBXImportSettings.h index 97ce496eaf..b016db174b 100644 --- a/modules/fbx/fbx_parser/FBXImportSettings.h +++ b/modules/fbx/fbx_parser/FBXImportSettings.h @@ -80,60 +80,52 @@ namespace FBXDocParser { /** FBX import settings, parts of which are publicly accessible via their corresponding AI_CONFIG constants */ struct ImportSettings { - ImportSettings() : - strictMode(true), readAllLayers(true), readAllMaterials(true), readMaterials(true), readTextures(true), readCameras(true), readLights(true), readAnimations(true), readWeights(true), preservePivots(true), optimizeEmptyAnimationCurves(true), useLegacyEmbeddedTextureNaming(false), removeEmptyBones(true), convertToMeters(false) { - // empty - } - /** enable strict mode: * - only accept fbx 2012, 2013 files * - on the slightest error, give up. * * Basically, strict mode means that the fbx file will actually - * be validated. Strict mode is off by default. */ - bool strictMode; + * be validated.*/ + bool strictMode = true; /** specifies whether all geometry layers are read and scanned for * usable data channels. The FBX spec indicates that many readers * will only read the first channel and that this is in some way * the recommended way- in reality, however, it happens a lot that - * vertex data is spread among multiple layers. The default - * value for this option is true.*/ - bool readAllLayers; + * vertex data is spread among multiple layers.*/ + bool readAllLayers = true; /** specifies whether all materials are read, or only those that * are referenced by at least one mesh. Reading all materials * may make FBX reading a lot slower since all objects - * need to be processed . - * This bit is ignored unless readMaterials=true*/ - bool readAllMaterials; + * need to be processed. + * This bit is ignored unless readMaterials=true.*/ + bool readAllMaterials = true; /** import materials (true) or skip them and assign a default - * material. The default value is true.*/ - bool readMaterials; + * material.*/ + bool readMaterials = true; - /** import embedded textures? Default value is true.*/ - bool readTextures; + /** import embedded textures?*/ + bool readTextures = true; - /** import cameras? Default value is true.*/ - bool readCameras; + /** import cameras?*/ + bool readCameras = true; - /** import light sources? Default value is true.*/ - bool readLights; + /** import light sources?*/ + bool readLights = true; /** import animations (i.e. animation curves, the node - * skeleton is always imported). Default value is true. */ - bool readAnimations; + * skeleton is always imported).*/ + bool readAnimations = true; - /** read bones (vertex weights and deform info). - * Default value is true. */ - bool readWeights; + /** read bones (vertex weights and deform info).*/ + bool readWeights = true; /** preserve transformation pivots and offsets. Since these can * not directly be represented in assimp, additional dummy * nodes will be generated. Note that settings this to false - * can make animation import a lot slower. The default value - * is true. + * can make animation import a lot slower. * * The naming scheme for the generated nodes is: * <OriginalName>_$AssimpFbx$_<TransformName> @@ -149,24 +141,21 @@ struct ImportSettings { * Scaling * Rotation **/ - bool preservePivots; + bool preservePivots = true; /** do not import animation curves that specify a constant - * values matching the corresponding node transformation. - * The default value is true. */ - bool optimizeEmptyAnimationCurves; + * values matching the corresponding node transformation.*/ + bool optimizeEmptyAnimationCurves = true; - /** use legacy naming for embedded textures eg: (*0, *1, *2) - */ - bool useLegacyEmbeddedTextureNaming; + /** use legacy naming for embedded textures eg: (*0, *1, *2).*/ + bool useLegacyEmbeddedTextureNaming = false; - /** Empty bones shall be removed - */ - bool removeEmptyBones; + /** Empty bones shall be removed.*/ + bool removeEmptyBones = true; - /** Set to true to perform a conversion from cm to meter after the import - */ - bool convertToMeters; + /** Set to true to perform a conversion from cm to meter after + * the import.*/ + bool convertToMeters = false; }; } // namespace FBXDocParser diff --git a/modules/fbx/fbx_parser/FBXMaterial.cpp b/modules/fbx/fbx_parser/FBXMaterial.cpp index 9970a2b0b1..219da1b2f4 100644 --- a/modules/fbx/fbx_parser/FBXMaterial.cpp +++ b/modules/fbx/fbx_parser/FBXMaterial.cpp @@ -171,7 +171,7 @@ Material::~Material() { // ------------------------------------------------------------------------------------------------ Texture::Texture(uint64_t id, const ElementPtr element, const Document &doc, const std::string &name) : - Object(id, element, name), uvScaling(1.0f, 1.0f), media(nullptr) { + Object(id, element, name), uvScaling(1.0f, 1.0f) { const ScopePtr sc = GetRequiredScope(element); const ElementPtr Type = sc->GetElement("Type"); @@ -267,10 +267,10 @@ LayeredTexture::LayeredTexture(uint64_t id, const ElementPtr element, const Docu ElementPtr BlendModes = sc->GetElement("BlendModes"); ElementPtr Alphas = sc->GetElement("Alphas"); - if (BlendModes != 0) { + if (BlendModes != nullptr) { blendMode = (BlendMode)ParseTokenAsInt(GetRequiredToken(BlendModes, 0)); } - if (Alphas != 0) { + if (Alphas != nullptr) { alpha = ParseTokenAsFloat(GetRequiredToken(Alphas, 0)); } } @@ -297,7 +297,7 @@ void LayeredTexture::fillTexture(const Document &doc) { // ------------------------------------------------------------------------------------------------ Video::Video(uint64_t id, const ElementPtr element, const Document &doc, const std::string &name) : - Object(id, element, name), contentLength(0), content(0) { + Object(id, element, name) { const ScopePtr sc = GetRequiredScope(element); const ElementPtr Type = sc->GetElement("Type"); diff --git a/modules/fbx/fbx_parser/FBXMeshGeometry.cpp b/modules/fbx/fbx_parser/FBXMeshGeometry.cpp index ccc06550fe..a28e7565c6 100644 --- a/modules/fbx/fbx_parser/FBXMeshGeometry.cpp +++ b/modules/fbx/fbx_parser/FBXMeshGeometry.cpp @@ -88,7 +88,7 @@ using namespace Util; // ------------------------------------------------------------------------------------------------ Geometry::Geometry(uint64_t id, const ElementPtr element, const std::string &name, const Document &doc) : - Object(id, element, name), skin() { + Object(id, element, name) { const std::vector<const Connection *> &conns = doc.GetConnectionsByDestinationSequenced(ID(), "Deformer"); for (const Connection *con : conns) { const Skin *sk = ProcessSimpleConnection<Skin>(*con, false, "Skin -> Geometry", element); diff --git a/modules/fbx/fbx_parser/FBXParseTools.h b/modules/fbx/fbx_parser/FBXParseTools.h index 21472f5b7b..b4003bbec5 100644 --- a/modules/fbx/fbx_parser/FBXParseTools.h +++ b/modules/fbx/fbx_parser/FBXParseTools.h @@ -61,7 +61,7 @@ inline bool IsLineEnd(char_t c) { // Special version of the function, providing higher accuracy and safety // It is mainly used by fast_atof to prevent ugly and unwanted integer overflows. // ------------------------------------------------------------------------------------ -inline uint64_t strtoul10_64(const char *in, bool &errored, const char **out = 0, unsigned int *max_inout = 0) { +inline uint64_t strtoul10_64(const char *in, bool &errored, const char **out = nullptr, unsigned int *max_inout = nullptr) { unsigned int cur = 0; uint64_t value = 0; diff --git a/modules/fbx/fbx_parser/FBXParser.cpp b/modules/fbx/fbx_parser/FBXParser.cpp index 44c24ff926..166d98bb8c 100644 --- a/modules/fbx/fbx_parser/FBXParser.cpp +++ b/modules/fbx/fbx_parser/FBXParser.cpp @@ -216,7 +216,7 @@ Scope::~Scope() { // ------------------------------------------------------------------------------------------------ Parser::Parser(const TokenList &tokens, bool is_binary) : - tokens(tokens), last(), current(), cursor(tokens.begin()), is_binary(is_binary) { + tokens(tokens), cursor(tokens.begin()), is_binary(is_binary) { root = new_Scope(*this, true); scopes.push_back(root); } diff --git a/modules/fbx/fbx_parser/FBXProperties.cpp b/modules/fbx/fbx_parser/FBXProperties.cpp index 8ab94e1ef4..84e71512d6 100644 --- a/modules/fbx/fbx_parser/FBXProperties.cpp +++ b/modules/fbx/fbx_parser/FBXProperties.cpp @@ -145,8 +145,12 @@ std::string PeekPropertyName(const Element &element) { } // namespace // ------------------------------------------------------------------------------------------------ -PropertyTable::PropertyTable() : - templateProps(), element() { +PropertyTable::PropertyTable() { +} + +// ------------------------------------------------------------------------------------------------ +PropertyTable::PropertyTable(const PropertyTable *templateProps) : + templateProps(templateProps), element() { } // ------------------------------------------------------------------------------------------------ @@ -216,8 +220,9 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const { // Loop through all the lazy properties (which is all the properties) for (const LazyPropertyMap::value_type &element : lazyProps) { // Skip parsed properties - if (props.end() != props.find(element.first)) + if (props.end() != props.find(element.first)) { continue; + } // Read the element's value. // Wrap the naked pointer (since the call site is required to acquire ownership) @@ -225,8 +230,9 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const { Property *prop = ReadTypedProperty(element.second); // Element could not be read. Skip it. - if (!prop) + if (!prop) { continue; + } // Add to result result[element.first] = prop; diff --git a/modules/fbx/fbx_parser/FBXProperties.h b/modules/fbx/fbx_parser/FBXProperties.h index 27cacfaf76..0595b25fa7 100644 --- a/modules/fbx/fbx_parser/FBXProperties.h +++ b/modules/fbx/fbx_parser/FBXProperties.h @@ -137,6 +137,7 @@ class PropertyTable { public: // in-memory property table with no source element PropertyTable(); + PropertyTable(const PropertyTable *templateProps); PropertyTable(const ElementPtr element, const PropertyTable *templateProps); ~PropertyTable(); diff --git a/modules/fbx/fbx_parser/FBXUtil.cpp b/modules/fbx/fbx_parser/FBXUtil.cpp index 80ea5fab4c..4295cb6f5e 100644 --- a/modules/fbx/fbx_parser/FBXUtil.cpp +++ b/modules/fbx/fbx_parser/FBXUtil.cpp @@ -122,8 +122,9 @@ static const uint8_t base64DecodeTable[128] = { uint8_t DecodeBase64(char ch) { const auto idx = static_cast<uint8_t>(ch); - if (idx > 127) + if (idx > 127) { return 255; + } return base64DecodeTable[idx]; } @@ -211,8 +212,9 @@ std::string EncodeBase64(const char *data, size_t length) { EncodeByteBlock(&finalBytes[0], encoded_string, iEncodedByte); // add '=' at the end - for (size_t i = 0; i < 4 * extraBytes / 3; i++) + for (size_t i = 0; i < 4 * extraBytes / 3; i++) { encoded_string[encodedBytes - i - 1] = '='; + } } return encoded_string; } diff --git a/modules/fbx/tools/validation_tools.h b/modules/fbx/tools/validation_tools.h index ced100aed2..fe0c92b22f 100644 --- a/modules/fbx/tools/validation_tools.h +++ b/modules/fbx/tools/validation_tools.h @@ -65,8 +65,9 @@ protected: Error err; FileAccess *file = FileAccess::open(path, FileAccess::WRITE, &err); if (!file || err) { - if (file) + if (file) { memdelete(file); + } print_error("ValidationTracker Error - failed to create file - path: %s\n" + path); return; } diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 5d2117d76c..f795bef59f 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -1727,42 +1727,48 @@ void NativeScriptLanguage::unregister_script(NativeScript *script) { if (S->get().size() == 0) { library_script_users.erase(S); - Map<String, Map<StringName, NativeScriptDesc>>::Element *L = library_classes.find(script->lib_path); - if (L) { - Map<StringName, NativeScriptDesc> classes = L->get(); - - for (Map<StringName, NativeScriptDesc>::Element *C = classes.front(); C; C = C->next()) { - // free property stuff first - for (OrderedHashMap<StringName, NativeScriptDesc::Property>::Element P = C->get().properties.front(); P; P = P.next()) { - if (P.get().getter.free_func) { - P.get().getter.free_func(P.get().getter.method_data); + Map<String, Ref<GDNative>>::Element *G = library_gdnatives.find(script->lib_path); + if (G && G->get()->get_library()->is_reloadable()) { + // ONLY if the library is marked as reloadable, and no more instances of its scripts exist do we unload the library + + // First remove meta data related to the library + Map<String, Map<StringName, NativeScriptDesc>>::Element *L = library_classes.find(script->lib_path); + if (L) { + Map<StringName, NativeScriptDesc> classes = L->get(); + + for (Map<StringName, NativeScriptDesc>::Element *C = classes.front(); C; C = C->next()) { + // free property stuff first + for (OrderedHashMap<StringName, NativeScriptDesc::Property>::Element P = C->get().properties.front(); P; P = P.next()) { + if (P.get().getter.free_func) { + P.get().getter.free_func(P.get().getter.method_data); + } + + if (P.get().setter.free_func) { + P.get().setter.free_func(P.get().setter.method_data); + } } - if (P.get().setter.free_func) { - P.get().setter.free_func(P.get().setter.method_data); + // free method stuff + for (Map<StringName, NativeScriptDesc::Method>::Element *M = C->get().methods.front(); M; M = M->next()) { + if (M->get().method.free_func) { + M->get().method.free_func(M->get().method.method_data); + } } - } - // free method stuff - for (Map<StringName, NativeScriptDesc::Method>::Element *M = C->get().methods.front(); M; M = M->next()) { - if (M->get().method.free_func) { - M->get().method.free_func(M->get().method.method_data); + // free constructor/destructor + if (C->get().create_func.free_func) { + C->get().create_func.free_func(C->get().create_func.method_data); } - } - // free constructor/destructor - if (C->get().create_func.free_func) { - C->get().create_func.free_func(C->get().create_func.method_data); + if (C->get().destroy_func.free_func) { + C->get().destroy_func.free_func(C->get().destroy_func.method_data); + } } - if (C->get().destroy_func.free_func) { - C->get().destroy_func.free_func(C->get().destroy_func.method_data); - } + library_classes.erase(script->lib_path); } - } - Map<String, Ref<GDNative>>::Element *G = library_gdnatives.find(script->lib_path); - if (G && G->get()->get_library()->is_reloadable()) { + // now unload the library G->get()->terminate(); library_gdnatives.erase(G); } diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp index 3721550d71..c9c5d00aa5 100644 --- a/modules/gdscript/gdscript.cpp +++ b/modules/gdscript/gdscript.cpp @@ -2301,7 +2301,7 @@ GDScriptLanguage::~GDScriptLanguage() { script->unreference(); } - singleton = NULL; + singleton = nullptr; } void GDScriptLanguage::add_orphan_subclass(const String &p_qualified_name, const ObjectID &p_subclass) { diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp index dc77eb89df..b553dcede3 100644 --- a/modules/gdscript/gdscript_byte_codegen.cpp +++ b/modules/gdscript/gdscript_byte_codegen.cpp @@ -59,12 +59,7 @@ uint32_t GDScriptByteCodeGenerator::add_local_constant(const StringName &p_name, } uint32_t GDScriptByteCodeGenerator::add_or_get_constant(const Variant &p_constant) { - if (constant_map.has(p_constant)) { - return constant_map[p_constant]; - } - int index = constant_map.size(); - constant_map[p_constant] = index; - return index; + return get_constant_pos(p_constant); } uint32_t GDScriptByteCodeGenerator::add_or_get_name(const StringName &p_name) { @@ -612,7 +607,8 @@ void GDScriptByteCodeGenerator::write_assign(const Address &p_target, const Addr } break; case GDScriptDataType::NATIVE: { int class_idx = GDScriptLanguage::get_singleton()->get_global_map()[p_target.type.native_type]; - class_idx |= (GDScriptFunction::ADDR_TYPE_GLOBAL << GDScriptFunction::ADDR_BITS); + Variant nc = GDScriptLanguage::get_singleton()->get_global_array()[class_idx]; + class_idx = get_constant_pos(nc) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS); append(GDScriptFunction::OPCODE_ASSIGN_TYPED_NATIVE, 3); append(p_target); append(p_source); @@ -621,8 +617,7 @@ void GDScriptByteCodeGenerator::write_assign(const Address &p_target, const Addr case GDScriptDataType::SCRIPT: case GDScriptDataType::GDSCRIPT: { Variant script = p_target.type.script_type; - int idx = get_constant_pos(script); - idx |= (GDScriptFunction::ADDR_TYPE_LOCAL_CONSTANT << GDScriptFunction::ADDR_BITS); + int idx = get_constant_pos(script) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS); append(GDScriptFunction::OPCODE_ASSIGN_TYPED_SCRIPT, 3); append(p_target); @@ -673,6 +668,12 @@ void GDScriptByteCodeGenerator::write_assign_default_parameter(const Address &p_ function->default_arguments.push_back(opcodes.size()); } +void GDScriptByteCodeGenerator::write_store_named_global(const Address &p_dst, const StringName &p_global) { + append(GDScriptFunction::OPCODE_STORE_NAMED_GLOBAL, 1); + append(p_dst); + append(p_global); +} + void GDScriptByteCodeGenerator::write_cast(const Address &p_target, const Address &p_source, const GDScriptDataType &p_type) { int index = 0; @@ -683,16 +684,14 @@ void GDScriptByteCodeGenerator::write_cast(const Address &p_target, const Addres } break; case GDScriptDataType::NATIVE: { int class_idx = GDScriptLanguage::get_singleton()->get_global_map()[p_type.native_type]; - class_idx |= (GDScriptFunction::ADDR_TYPE_GLOBAL << GDScriptFunction::ADDR_BITS); + Variant nc = GDScriptLanguage::get_singleton()->get_global_array()[class_idx]; append(GDScriptFunction::OPCODE_CAST_TO_NATIVE, 3); - index = class_idx; + index = get_constant_pos(nc) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS); } break; case GDScriptDataType::SCRIPT: case GDScriptDataType::GDSCRIPT: { Variant script = p_type.script_type; - int idx = get_constant_pos(script); - idx |= (GDScriptFunction::ADDR_TYPE_LOCAL_CONSTANT << GDScriptFunction::ADDR_BITS); - + int idx = get_constant_pos(script) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS); append(GDScriptFunction::OPCODE_CAST_TO_SCRIPT, 3); index = idx; } break; @@ -903,7 +902,7 @@ void GDScriptByteCodeGenerator::write_call_self(const Address &p_target, const S for (int i = 0; i < p_arguments.size(); i++) { append(p_arguments[i]); } - append(GDScriptFunction::ADDR_TYPE_SELF << GDScriptFunction::ADDR_BITS); + append(GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); append(p_target); append(p_arguments.size()); append(p_function_name); @@ -914,7 +913,7 @@ void GDScriptByteCodeGenerator::write_call_self_async(const Address &p_target, c for (int i = 0; i < p_arguments.size(); i++) { append(p_arguments[i]); } - append(GDScriptFunction::ADDR_TYPE_SELF << GDScriptFunction::ADDR_BITS); + append(GDScriptFunction::ADDR_SELF); append(p_target); append(p_arguments.size()); append(p_function_name); @@ -999,7 +998,7 @@ void GDScriptByteCodeGenerator::write_construct_typed_array(const Address &p_tar if (p_element_type.script_type) { Variant script_type = Ref<Script>(p_element_type.script_type); int addr = get_constant_pos(script_type); - addr |= GDScriptFunction::ADDR_TYPE_LOCAL_CONSTANT << GDScriptFunction::ADDR_BITS; + addr |= GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS; append(addr); } else { append(Address()); // null. @@ -1286,8 +1285,84 @@ void GDScriptByteCodeGenerator::write_newline(int p_line) { } void GDScriptByteCodeGenerator::write_return(const Address &p_return_value) { - append(GDScriptFunction::OPCODE_RETURN, 1); - append(p_return_value); + if (!function->return_type.has_type || p_return_value.type.has_type) { + // Either the function is untyped or the return value is also typed. + + // If this is a typed function, then we need to check for potential conversions. + if (function->return_type.has_type) { + if (function->return_type.kind == GDScriptDataType::BUILTIN && function->return_type.builtin_type == Variant::ARRAY && function->return_type.has_container_element_type()) { + // Typed array. + const GDScriptDataType &element_type = function->return_type.get_container_element_type(); + + Variant script = function->return_type.script_type; + int script_idx = get_constant_pos(script) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS); + + append(GDScriptFunction::OPCODE_RETURN_TYPED_ARRAY, 2); + append(p_return_value); + append(script_idx); + append(element_type.kind == GDScriptDataType::BUILTIN ? element_type.builtin_type : Variant::OBJECT); + append(element_type.native_type); + } else if (function->return_type.kind == GDScriptDataType::BUILTIN && p_return_value.type.kind == GDScriptDataType::BUILTIN && function->return_type.builtin_type != p_return_value.type.builtin_type) { + // Add conversion. + append(GDScriptFunction::OPCODE_RETURN_TYPED_BUILTIN, 1); + append(p_return_value); + append(function->return_type.builtin_type); + } else { + // Just assign. + append(GDScriptFunction::OPCODE_RETURN, 1); + append(p_return_value); + } + } else { + append(GDScriptFunction::OPCODE_RETURN, 1); + append(p_return_value); + } + } else { + switch (function->return_type.kind) { + case GDScriptDataType::BUILTIN: { + if (function->return_type.builtin_type == Variant::ARRAY && function->return_type.has_container_element_type()) { + const GDScriptDataType &element_type = function->return_type.get_container_element_type(); + + Variant script = function->return_type.script_type; + int script_idx = get_constant_pos(script); + script_idx |= (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS); + + append(GDScriptFunction::OPCODE_RETURN_TYPED_ARRAY, 2); + append(p_return_value); + append(script_idx); + append(element_type.kind == GDScriptDataType::BUILTIN ? element_type.builtin_type : Variant::OBJECT); + append(element_type.native_type); + } else { + append(GDScriptFunction::OPCODE_RETURN_TYPED_BUILTIN, 1); + append(p_return_value); + append(function->return_type.builtin_type); + } + } break; + case GDScriptDataType::NATIVE: { + append(GDScriptFunction::OPCODE_RETURN_TYPED_NATIVE, 2); + append(p_return_value); + int class_idx = GDScriptLanguage::get_singleton()->get_global_map()[function->return_type.native_type]; + Variant nc = GDScriptLanguage::get_singleton()->get_global_array()[class_idx]; + class_idx = get_constant_pos(nc) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS); + append(class_idx); + } break; + case GDScriptDataType::GDSCRIPT: + case GDScriptDataType::SCRIPT: { + Variant script = function->return_type.script_type; + int script_idx = get_constant_pos(script) | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS); + + append(GDScriptFunction::OPCODE_RETURN_TYPED_SCRIPT, 2); + append(p_return_value); + append(script_idx); + } break; + default: { + ERR_PRINT("Compiler bug: unresolved return."); + + // Shouldn't get here, but fail-safe to a regular return; + append(GDScriptFunction::OPCODE_RETURN, 1); + append(p_return_value); + } break; + } + } } void GDScriptByteCodeGenerator::write_assert(const Address &p_test, const Address &p_message) { diff --git a/modules/gdscript/gdscript_byte_codegen.h b/modules/gdscript/gdscript_byte_codegen.h index 52d631c430..4b196ed420 100644 --- a/modules/gdscript/gdscript_byte_codegen.h +++ b/modules/gdscript/gdscript_byte_codegen.h @@ -51,11 +51,11 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator { List<Map<StringName, int>> block_identifier_stack; Map<StringName, int> block_identifiers; - int current_stack_size = 0; + int current_stack_size = 3; // First 3 spots are reserved for self, class, and nil. int current_temporaries = 0; int current_locals = 0; int current_line = 0; - int stack_max = 0; + int stack_max = 3; int instr_args_max = 0; int ptrcall_max = 0; @@ -135,7 +135,7 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator { ERR_PRINT("Leaving block with non-zero temporary variables: " + itos(current_temporaries)); } #endif - current_stack_size = current_locals; + current_stack_size = current_locals + 3; // Keep the 3 reserved slots for self, class, and nil. if (debug_stack) { for (Map<StringName, int>::Element *E = block_identifiers.front(); E; E = E->next()) { @@ -163,64 +163,72 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator { } int get_constant_pos(const Variant &p_constant) { - if (constant_map.has(p_constant)) + if (constant_map.has(p_constant)) { return constant_map[p_constant]; + } int pos = constant_map.size(); constant_map[p_constant] = pos; return pos; } int get_operation_pos(const Variant::ValidatedOperatorEvaluator p_operation) { - if (operator_func_map.has(p_operation)) + if (operator_func_map.has(p_operation)) { return operator_func_map[p_operation]; + } int pos = operator_func_map.size(); operator_func_map[p_operation] = pos; return pos; } int get_setter_pos(const Variant::ValidatedSetter p_setter) { - if (setters_map.has(p_setter)) + if (setters_map.has(p_setter)) { return setters_map[p_setter]; + } int pos = setters_map.size(); setters_map[p_setter] = pos; return pos; } int get_getter_pos(const Variant::ValidatedGetter p_getter) { - if (getters_map.has(p_getter)) + if (getters_map.has(p_getter)) { return getters_map[p_getter]; + } int pos = getters_map.size(); getters_map[p_getter] = pos; return pos; } int get_keyed_setter_pos(const Variant::ValidatedKeyedSetter p_keyed_setter) { - if (keyed_setters_map.has(p_keyed_setter)) + if (keyed_setters_map.has(p_keyed_setter)) { return keyed_setters_map[p_keyed_setter]; + } int pos = keyed_setters_map.size(); keyed_setters_map[p_keyed_setter] = pos; return pos; } int get_keyed_getter_pos(const Variant::ValidatedKeyedGetter p_keyed_getter) { - if (keyed_getters_map.has(p_keyed_getter)) + if (keyed_getters_map.has(p_keyed_getter)) { return keyed_getters_map[p_keyed_getter]; + } int pos = keyed_getters_map.size(); keyed_getters_map[p_keyed_getter] = pos; return pos; } int get_indexed_setter_pos(const Variant::ValidatedIndexedSetter p_indexed_setter) { - if (indexed_setters_map.has(p_indexed_setter)) + if (indexed_setters_map.has(p_indexed_setter)) { return indexed_setters_map[p_indexed_setter]; + } int pos = indexed_setters_map.size(); indexed_setters_map[p_indexed_setter] = pos; return pos; } int get_indexed_getter_pos(const Variant::ValidatedIndexedGetter p_indexed_getter) { - if (indexed_getters_map.has(p_indexed_getter)) + if (indexed_getters_map.has(p_indexed_getter)) { return indexed_getters_map[p_indexed_getter]; + } int pos = indexed_getters_map.size(); indexed_getters_map[p_indexed_getter] = pos; return pos; @@ -272,8 +280,9 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator { } void alloc_stack(int p_level) { - if (p_level >= stack_max) + if (p_level >= stack_max) { stack_max = p_level + 1; + } } int increase_stack() { @@ -283,33 +292,27 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator { } void alloc_ptrcall(int p_params) { - if (p_params >= ptrcall_max) + if (p_params >= ptrcall_max) { ptrcall_max = p_params; + } } int address_of(const Address &p_address) { switch (p_address.mode) { case Address::SELF: - return GDScriptFunction::ADDR_TYPE_SELF << GDScriptFunction::ADDR_BITS; + return GDScriptFunction::ADDR_SELF; case Address::CLASS: - return GDScriptFunction::ADDR_TYPE_CLASS << GDScriptFunction::ADDR_BITS; + return GDScriptFunction::ADDR_CLASS; case Address::MEMBER: return p_address.address | (GDScriptFunction::ADDR_TYPE_MEMBER << GDScriptFunction::ADDR_BITS); - case Address::CLASS_CONSTANT: - return p_address.address | (GDScriptFunction::ADDR_TYPE_CLASS_CONSTANT << GDScriptFunction::ADDR_BITS); - case Address::LOCAL_CONSTANT: case Address::CONSTANT: - return p_address.address | (GDScriptFunction::ADDR_TYPE_LOCAL_CONSTANT << GDScriptFunction::ADDR_BITS); + return p_address.address | (GDScriptFunction::ADDR_TYPE_CONSTANT << GDScriptFunction::ADDR_BITS); case Address::LOCAL_VARIABLE: case Address::TEMPORARY: case Address::FUNCTION_PARAMETER: return p_address.address | (GDScriptFunction::ADDR_TYPE_STACK << GDScriptFunction::ADDR_BITS); - case Address::GLOBAL: - return p_address.address | (GDScriptFunction::ADDR_TYPE_GLOBAL << GDScriptFunction::ADDR_BITS); - case Address::NAMED_GLOBAL: - return p_address.address | (GDScriptFunction::ADDR_TYPE_NAMED_GLOBAL << GDScriptFunction::ADDR_BITS); case Address::NIL: - return GDScriptFunction::ADDR_TYPE_NIL << GDScriptFunction::ADDR_BITS; + return GDScriptFunction::ADDR_NIL; } return -1; // Unreachable. } @@ -431,6 +434,7 @@ public: virtual void write_assign_true(const Address &p_target) override; virtual void write_assign_false(const Address &p_target) override; virtual void write_assign_default_parameter(const Address &p_dst, const Address &p_src) override; + virtual void write_store_named_global(const Address &p_dst, const StringName &p_global) override; virtual void write_cast(const Address &p_target, const Address &p_source, const GDScriptDataType &p_type) override; virtual void write_call(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) override; virtual void write_super_call(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) override; diff --git a/modules/gdscript/gdscript_codegen.h b/modules/gdscript/gdscript_codegen.h index 3c05f14cf7..cce4e856c7 100644 --- a/modules/gdscript/gdscript_codegen.h +++ b/modules/gdscript/gdscript_codegen.h @@ -45,13 +45,9 @@ public: CLASS, MEMBER, CONSTANT, - CLASS_CONSTANT, - LOCAL_CONSTANT, LOCAL_VARIABLE, FUNCTION_PARAMETER, TEMPORARY, - GLOBAL, - NAMED_GLOBAL, NIL, }; AddressMode mode = NIL; @@ -123,6 +119,7 @@ public: virtual void write_assign_true(const Address &p_target) = 0; virtual void write_assign_false(const Address &p_target) = 0; virtual void write_assign_default_parameter(const Address &dst, const Address &src) = 0; + virtual void write_store_named_global(const Address &p_dst, const StringName &p_global) = 0; virtual void write_cast(const Address &p_target, const Address &p_source, const GDScriptDataType &p_type) = 0; virtual void write_call(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) = 0; virtual void write_super_call(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) = 0; diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 62bb6a9f9e..abbca899bd 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -262,7 +262,7 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code GDScriptNativeClass *nc = nullptr; while (scr) { if (scr->constants.has(identifier)) { - return GDScriptCodeGenerator::Address(GDScriptCodeGenerator::Address::CLASS_CONSTANT, gen->add_or_get_name(identifier)); // TODO: Get type here. + return codegen.add_constant(scr->constants[identifier]); // TODO: Get type here. } if (scr->native.is_valid()) { nc = scr->native.ptr(); @@ -319,7 +319,8 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code if (GDScriptLanguage::get_singleton()->get_global_map().has(identifier)) { int idx = GDScriptLanguage::get_singleton()->get_global_map()[identifier]; - return GDScriptCodeGenerator::Address(GDScriptCodeGenerator::Address::GLOBAL, idx); // TODO: Get type. + Variant global = GDScriptLanguage::get_singleton()->get_global_array()[idx]; + return codegen.add_constant(global); // TODO: Get type. } // Try global classes. @@ -347,7 +348,9 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code #ifdef TOOLS_ENABLED if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(identifier)) { - return GDScriptCodeGenerator::Address(GDScriptCodeGenerator::Address::NAMED_GLOBAL, gen->add_or_get_name(identifier)); // TODO: Get type. + GDScriptCodeGenerator::Address global = codegen.add_temporary(); // TODO: Get type. + gen->write_store_named_global(global, identifier); + return global; } #endif @@ -778,6 +781,10 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code gen->pop_temporary(); } } + + if (operand.mode == GDScriptCodeGenerator::Address::TEMPORARY) { + gen->pop_temporary(); + } } break; default: { GDScriptCodeGenerator::Address left_operand = _parse_expression(codegen, r_error, binary->left_operand); @@ -2010,6 +2017,8 @@ Error GDScriptCompiler::_parse_setter_getter(GDScript *p_script, const GDScriptP func_name = "@" + p_variable->identifier->name + "_getter"; } + codegen.function_name = func_name; + GDScriptDataType return_type; if (p_is_setter) { return_type.has_type = true; diff --git a/modules/gdscript/gdscript_compiler.h b/modules/gdscript/gdscript_compiler.h index 651391f972..1b0beec0d4 100644 --- a/modules/gdscript/gdscript_compiler.h +++ b/modules/gdscript/gdscript_compiler.h @@ -61,7 +61,7 @@ class GDScriptCompiler { GDScriptCodeGenerator::Address add_local_constant(const StringName &p_name, const Variant &p_value) { uint32_t addr = generator->add_local_constant(p_name, p_value); - locals[p_name] = GDScriptCodeGenerator::Address(GDScriptCodeGenerator::Address::LOCAL_CONSTANT, addr); + locals[p_name] = GDScriptCodeGenerator::Address(GDScriptCodeGenerator::Address::CONSTANT, addr); return locals[p_name]; } diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp index 32adca29ed..74da0ee232 100644 --- a/modules/gdscript/gdscript_disassembler.cpp +++ b/modules/gdscript/gdscript_disassembler.cpp @@ -69,35 +69,23 @@ static String _disassemble_address(const GDScript *p_script, const GDScriptFunct int addr = p_address & GDScriptFunction::ADDR_MASK; switch (p_address >> GDScriptFunction::ADDR_BITS) { - case GDScriptFunction::ADDR_TYPE_SELF: { - return "self"; - } break; - case GDScriptFunction::ADDR_TYPE_CLASS: { - return "class"; - } break; case GDScriptFunction::ADDR_TYPE_MEMBER: { return "member(" + p_script->debug_get_member_by_index(addr) + ")"; } break; - case GDScriptFunction::ADDR_TYPE_CLASS_CONSTANT: { - return "class_const(" + p_function.get_global_name(addr) + ")"; - } break; - case GDScriptFunction::ADDR_TYPE_LOCAL_CONSTANT: { + case GDScriptFunction::ADDR_TYPE_CONSTANT: { return "const(" + _get_variant_string(p_function.get_constant(addr)) + ")"; } break; case GDScriptFunction::ADDR_TYPE_STACK: { - return "stack(" + itos(addr) + ")"; - } break; - case GDScriptFunction::ADDR_TYPE_STACK_VARIABLE: { - return "var_stack(" + itos(addr) + ")"; - } break; - case GDScriptFunction::ADDR_TYPE_GLOBAL: { - return "global(" + _get_variant_string(GDScriptLanguage::get_singleton()->get_global_array()[addr]) + ")"; - } break; - case GDScriptFunction::ADDR_TYPE_NAMED_GLOBAL: { - return "named_global(" + p_function.get_global_name(addr) + ")"; - } break; - case GDScriptFunction::ADDR_TYPE_NIL: { - return "nil"; + switch (addr) { + case GDScriptFunction::ADDR_STACK_SELF: + return "self"; + case GDScriptFunction::ADDR_STACK_CLASS: + return "class"; + case GDScriptFunction::ADDR_STACK_NIL: + return "nil"; + default: + return "stack(" + itos(addr) + ")"; + } } break; } @@ -393,8 +381,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += Variant::get_type_name(t) + "("; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(i + 1); } text += ")"; @@ -410,8 +399,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "<unkown type>("; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(i + 1); } text += ")"; @@ -425,8 +415,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += " = ["; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i); } @@ -458,8 +449,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += " = ["; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i); } @@ -474,8 +466,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += " = {"; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i * 2 + 0); text += ": "; text += DADDR(1 + i * 2 + 1); @@ -509,8 +502,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "("; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i); } text += ")"; @@ -539,8 +533,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "("; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i); } text += ")"; @@ -559,8 +554,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "("; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i); } text += ")"; @@ -636,8 +632,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "("; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i); } text += ")"; @@ -654,8 +651,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "("; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i); } text += ")"; @@ -672,8 +670,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "("; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i); } text += ")"; @@ -690,8 +689,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "("; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i); } text += ")"; @@ -708,8 +708,9 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "("; for (int i = 0; i < argc; i++) { - if (i > 0) + if (i > 0) { text += ", "; + } text += DADDR(1 + i); } text += ")"; @@ -761,6 +762,39 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { incr = 2; } break; + case OPCODE_RETURN_TYPED_BUILTIN: { + text += "return typed builtin ("; + text += Variant::get_type_name((Variant::Type)_code_ptr[ip + 2]); + text += ") "; + text += DADDR(1); + + incr += 3; + } break; + case OPCODE_RETURN_TYPED_ARRAY: { + text += "return typed array "; + text += DADDR(1); + + incr += 5; + } break; + case OPCODE_RETURN_TYPED_NATIVE: { + text += "return typed native ("; + text += DADDR(2); + text += ") "; + text += DADDR(1); + + incr += 3; + } break; + case OPCODE_RETURN_TYPED_SCRIPT: { + Variant script = _constants_ptr[_code_ptr[ip + 2]]; + Script *sc = Object::cast_to<Script>(script.operator Object *()); + + text += "return typed script ("; + text += sc->get_path(); + text += ") "; + text += DADDR(1); + + incr += 3; + } break; #define DISASSEMBLE_ITERATE(m_type) \ case OPCODE_ITERATE_##m_type: { \ @@ -839,6 +873,14 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { incr += 5; } break; DISASSEMBLE_ITERATE_TYPES(DISASSEMBLE_ITERATE); + case OPCODE_STORE_NAMED_GLOBAL: { + text += "store named global "; + text += DADDR(1); + text += " = "; + text += String(_global_names_ptr[_code_ptr[ip + 2]]); + + incr += 3; + } break; case OPCODE_LINE: { int line = _code_ptr[ip + 1] - 1; if (line >= 0 && line < p_code_lines.size()) { diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index d560718dda..ae3b16a9d7 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -1037,7 +1037,7 @@ static void _find_identifiers(GDScriptParser::CompletionContext &p_context, bool static const char *_keywords[] = { "false", "PI", "TAU", "INF", "NAN", "self", "true", "breakpoint", "tool", "super", "break", "continue", "pass", "return", - 0 + nullptr }; const char **kw = _keywords; @@ -1050,7 +1050,7 @@ static void _find_identifiers(GDScriptParser::CompletionContext &p_context, bool static const char *_keywords_with_space[] = { "and", "in", "not", "or", "as", "class", "extends", "is", "func", "signal", "await", "const", "enum", "static", "var", "if", "elif", "else", "for", "match", "while", - 0 + nullptr }; const char **kws = _keywords_with_space; @@ -1063,7 +1063,7 @@ static void _find_identifiers(GDScriptParser::CompletionContext &p_context, bool static const char *_keywords_with_args[] = { "assert", "preload", - 0 + nullptr }; const char **kwa = _keywords_with_args; @@ -1745,8 +1745,8 @@ static bool _guess_identifier_type(GDScriptParser::CompletionContext &p_context, return true; } } - base_type = base_type.class_type->base_type; } + base_type = base_type.class_type->base_type; break; case GDScriptParser::DataType::NATIVE: { if (id_type.is_set() && !id_type.is_variant()) { @@ -2892,7 +2892,7 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co v = v_ref; } else { Callable::CallError err; - Variant::construct(base_type.builtin_type, v, NULL, 0, err); + Variant::construct(base_type.builtin_type, v, nullptr, 0, err); if (err.error != Callable::CallError::CALL_OK) { break; } diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h index 41080ef371..414dfab2e7 100644 --- a/modules/gdscript/gdscript_function.h +++ b/modules/gdscript/gdscript_function.h @@ -306,6 +306,10 @@ public: OPCODE_JUMP_IF_NOT, OPCODE_JUMP_TO_DEF_ARGUMENT, OPCODE_RETURN, + OPCODE_RETURN_TYPED_BUILTIN, + OPCODE_RETURN_TYPED_ARRAY, + OPCODE_RETURN_TYPED_NATIVE, + OPCODE_RETURN_TYPED_SCRIPT, OPCODE_ITERATE_BEGIN, OPCODE_ITERATE_BEGIN_INT, OPCODE_ITERATE_BEGIN_FLOAT, @@ -346,6 +350,7 @@ public: OPCODE_ITERATE_PACKED_VECTOR3_ARRAY, OPCODE_ITERATE_PACKED_COLOR_ARRAY, OPCODE_ITERATE_OBJECT, + OPCODE_STORE_NAMED_GLOBAL, OPCODE_ASSERT, OPCODE_BREAKPOINT, OPCODE_LINE, @@ -356,16 +361,18 @@ public: ADDR_BITS = 24, ADDR_MASK = ((1 << ADDR_BITS) - 1), ADDR_TYPE_MASK = ~ADDR_MASK, - ADDR_TYPE_SELF = 0, - ADDR_TYPE_CLASS = 1, + ADDR_TYPE_STACK = 0, + ADDR_TYPE_CONSTANT = 1, ADDR_TYPE_MEMBER = 2, - ADDR_TYPE_CLASS_CONSTANT = 3, - ADDR_TYPE_LOCAL_CONSTANT = 4, - ADDR_TYPE_STACK = 5, - ADDR_TYPE_STACK_VARIABLE = 6, - ADDR_TYPE_GLOBAL = 7, - ADDR_TYPE_NAMED_GLOBAL = 8, - ADDR_TYPE_NIL = 9 + }; + + enum FixedAddresses { + ADDR_STACK_SELF = 0, + ADDR_STACK_CLASS = 1, + ADDR_STACK_NIL = 2, + ADDR_SELF = ADDR_STACK_SELF | (ADDR_TYPE_STACK << ADDR_BITS), + ADDR_CLASS = ADDR_STACK_CLASS | (ADDR_TYPE_STACK << ADDR_BITS), + ADDR_NIL = ADDR_STACK_NIL | (ADDR_TYPE_STACK << ADDR_BITS), }; enum Instruction { @@ -458,7 +465,7 @@ private: List<StackDebug> stack_debug; - _FORCE_INLINE_ Variant *_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant &static_ref, Variant *p_stack, String &r_error) const; + _FORCE_INLINE_ Variant *_get_variant(int p_address, GDScriptInstance *p_instance, Variant *p_stack, String &r_error) const; _FORCE_INLINE_ String _get_call_error(const Callable::CallError &p_err, const String &p_where, const Variant **argptrs) const; friend class GDScriptLanguage; @@ -493,7 +500,6 @@ public: #endif Vector<uint8_t> stack; int stack_size = 0; - Variant self; uint32_t alloca_size = 0; int ip = 0; int line = 0; diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index ffc871bdcb..8bf6a8b08b 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -34,22 +34,22 @@ #include "core/os/os.h" #include "gdscript.h" -Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant &static_ref, Variant *p_stack, String &r_error) const { +Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_instance, Variant *p_stack, String &r_error) const { int address = p_address & ADDR_MASK; //sequential table (jump table generated by compiler) switch ((p_address & ADDR_TYPE_MASK) >> ADDR_BITS) { - case ADDR_TYPE_SELF: { + case ADDR_TYPE_STACK: { #ifdef DEBUG_ENABLED - if (unlikely(!p_instance)) { - r_error = "Cannot access self without instance."; - return nullptr; - } + ERR_FAIL_INDEX_V(address, _stack_size, nullptr); #endif - return &self; + return &p_stack[address]; } break; - case ADDR_TYPE_CLASS: { - return &static_ref; + case ADDR_TYPE_CONSTANT: { +#ifdef DEBUG_ENABLED + ERR_FAIL_INDEX_V(address, _constant_count, nullptr); +#endif + return &_constants_ptr[address]; } break; case ADDR_TYPE_MEMBER: { #ifdef DEBUG_ENABLED @@ -61,65 +61,6 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta //member indexing is O(1) return &p_instance->members.write[address]; } break; - case ADDR_TYPE_CLASS_CONSTANT: { - //todo change to index! - GDScript *s = p_script; -#ifdef DEBUG_ENABLED - ERR_FAIL_INDEX_V(address, _global_names_count, nullptr); -#endif - const StringName *sn = &_global_names_ptr[address]; - - while (s) { - GDScript *o = s; - while (o) { - Map<StringName, Variant>::Element *E = o->constants.find(*sn); - if (E) { - return &E->get(); - } - o = o->_owner; - } - s = s->_base; - } - - ERR_FAIL_V_MSG(nullptr, "GDScriptCompiler bug."); - } break; - case ADDR_TYPE_LOCAL_CONSTANT: { -#ifdef DEBUG_ENABLED - ERR_FAIL_INDEX_V(address, _constant_count, nullptr); -#endif - return &_constants_ptr[address]; - } break; - case ADDR_TYPE_STACK: - case ADDR_TYPE_STACK_VARIABLE: { -#ifdef DEBUG_ENABLED - ERR_FAIL_INDEX_V(address, _stack_size, nullptr); -#endif - return &p_stack[address]; - } break; - case ADDR_TYPE_GLOBAL: { -#ifdef DEBUG_ENABLED - ERR_FAIL_INDEX_V(address, GDScriptLanguage::get_singleton()->get_global_array_size(), nullptr); -#endif - return &GDScriptLanguage::get_singleton()->get_global_array()[address]; - } break; -#ifdef TOOLS_ENABLED - case ADDR_TYPE_NAMED_GLOBAL: { -#ifdef DEBUG_ENABLED - ERR_FAIL_INDEX_V(address, _global_names_count, nullptr); -#endif - StringName id = _global_names_ptr[address]; - - if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(id)) { - return (Variant *)&GDScriptLanguage::get_singleton()->get_named_globals_map()[id]; - } else { - r_error = "Autoload singleton '" + String(id) + "' has been removed."; - return nullptr; - } - } break; -#endif - case ADDR_TYPE_NIL: { - return &nil; - } break; } ERR_FAIL_V_MSG(nullptr, "Bad code! (unknown addressing mode)."); @@ -128,7 +69,10 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta #ifdef DEBUG_ENABLED static String _get_script_name(const Ref<Script> p_script) { - if (p_script->get_name().is_empty()) { + Ref<GDScript> gdscript = p_script; + if (gdscript.is_valid()) { + return gdscript->get_script_class_name(); + } else if (p_script->get_name().is_empty()) { return p_script->get_path().get_file(); } else { return p_script->get_name(); @@ -293,6 +237,10 @@ String GDScriptFunction::_get_call_error(const Callable::CallError &p_err, const &&OPCODE_JUMP_IF_NOT, \ &&OPCODE_JUMP_TO_DEF_ARGUMENT, \ &&OPCODE_RETURN, \ + &&OPCODE_RETURN_TYPED_BUILTIN, \ + &&OPCODE_RETURN_TYPED_ARRAY, \ + &&OPCODE_RETURN_TYPED_NATIVE, \ + &&OPCODE_RETURN_TYPED_SCRIPT, \ &&OPCODE_ITERATE_BEGIN, \ &&OPCODE_ITERATE_BEGIN_INT, \ &&OPCODE_ITERATE_BEGIN_FLOAT, \ @@ -333,6 +281,7 @@ String GDScriptFunction::_get_call_error(const Callable::CallError &p_err, const &&OPCODE_ITERATE_PACKED_VECTOR3_ARRAY, \ &&OPCODE_ITERATE_PACKED_COLOR_ARRAY, \ &&OPCODE_ITERATE_OBJECT, \ + &&OPCODE_STORE_NAMED_GLOBAL, \ &&OPCODE_ASSERT, \ &&OPCODE_BREAKPOINT, \ &&OPCODE_LINE, \ @@ -408,11 +357,9 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a r_err.error = Callable::CallError::CALL_OK; - Variant self; - Variant static_ref; Variant retvalue; Variant *stack = nullptr; - Variant **instruction_args; + Variant **instruction_args = nullptr; const void **call_args_ptr = nullptr; int defarg = 0; @@ -437,7 +384,6 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a script = p_state->script; p_instance = p_state->instance; defarg = p_state->defarg; - self = p_state->self; } else { if (p_argcount != _argument_count) { @@ -455,55 +401,49 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a } } - alloca_size = sizeof(Variant *) * _instruction_args_size + sizeof(Variant) * _stack_size; - - if (alloca_size) { - uint8_t *aptr = (uint8_t *)alloca(alloca_size); + // Add 3 here for self, class, and nil. + alloca_size = sizeof(Variant *) * 3 + sizeof(Variant *) * _instruction_args_size + sizeof(Variant) * _stack_size; - if (_stack_size) { - stack = (Variant *)aptr; - for (int i = 0; i < p_argcount; i++) { - if (!argument_types[i].has_type) { - memnew_placement(&stack[i], Variant(*p_args[i])); - continue; - } + uint8_t *aptr = (uint8_t *)alloca(alloca_size); + stack = (Variant *)aptr; - if (!argument_types[i].is_type(*p_args[i], true)) { - r_err.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_err.argument = i; - r_err.expected = argument_types[i].kind == GDScriptDataType::BUILTIN ? argument_types[i].builtin_type : Variant::OBJECT; - return Variant(); - } - if (argument_types[i].kind == GDScriptDataType::BUILTIN) { - Variant arg; - Variant::construct(argument_types[i].builtin_type, arg, &p_args[i], 1, r_err); - memnew_placement(&stack[i], Variant(arg)); - } else { - memnew_placement(&stack[i], Variant(*p_args[i])); - } - } - for (int i = p_argcount; i < _stack_size; i++) { - memnew_placement(&stack[i], Variant); - } - } else { - stack = nullptr; + for (int i = 0; i < p_argcount; i++) { + if (!argument_types[i].has_type) { + memnew_placement(&stack[i + 3], Variant(*p_args[i])); + continue; } - if (_instruction_args_size) { - instruction_args = (Variant **)&aptr[sizeof(Variant) * _stack_size]; + if (!argument_types[i].is_type(*p_args[i], true)) { + r_err.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; + r_err.argument = i; + r_err.expected = argument_types[i].kind == GDScriptDataType::BUILTIN ? argument_types[i].builtin_type : Variant::OBJECT; + return Variant(); + } + if (argument_types[i].kind == GDScriptDataType::BUILTIN) { + Variant arg; + Variant::construct(argument_types[i].builtin_type, arg, &p_args[i], 1, r_err); + memnew_placement(&stack[i + 3], Variant(arg)); } else { - instruction_args = nullptr; + memnew_placement(&stack[i + 3], Variant(*p_args[i])); } + } + for (int i = p_argcount + 3; i < _stack_size; i++) { + memnew_placement(&stack[i], Variant); + } + + memnew_placement(&stack[ADDR_STACK_NIL], Variant); + if (_instruction_args_size) { + instruction_args = (Variant **)&aptr[sizeof(Variant) * _stack_size]; } else { - stack = nullptr; instruction_args = nullptr; } if (p_instance) { - self = p_instance->owner; + memnew_placement(&stack[ADDR_STACK_SELF], Variant(p_instance->owner)); script = p_instance->script.ptr(); } else { + memnew_placement(&stack[ADDR_STACK_SELF], Variant); script = _script; } } @@ -513,7 +453,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a call_args_ptr = nullptr; } - static_ref = script; + memnew_placement(&stack[ADDR_STACK_CLASS], Variant(script)); String err_text; @@ -534,10 +474,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a #define CHECK_SPACE(m_space) \ GD_ERR_BREAK((ip + m_space) > _code_size) -#define GET_VARIANT_PTR(m_v, m_code_ofs) \ - Variant *m_v; \ - m_v = _get_variant(_code_ptr[ip + m_code_ofs], p_instance, script, self, static_ref, stack, err_text); \ - if (unlikely(!m_v)) \ +#define GET_VARIANT_PTR(m_v, m_code_ofs) \ + Variant *m_v; \ + m_v = _get_variant(_code_ptr[ip + m_code_ofs], p_instance, stack, err_text); \ + if (unlikely(!m_v)) \ OPCODE_BREAK; #else @@ -545,7 +485,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a #define CHECK_SPACE(m_space) #define GET_VARIANT_PTR(m_v, m_code_ofs) \ Variant *m_v; \ - m_v = _get_variant(_code_ptr[ip + m_code_ofs], p_instance, script, self, static_ref, stack, err_text); + m_v = _get_variant(_code_ptr[ip + m_code_ofs], p_instance, stack, err_text); #endif @@ -569,7 +509,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a #ifdef DEBUG_ENABLED OPCODE_WHILE(ip < _code_size) { - int last_opcode = _code_ptr[ip]; + int last_opcode = _code_ptr[ip] & INSTR_MASK; #else OPCODE_WHILE(true) { #endif @@ -1113,14 +1053,14 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a #ifdef DEBUG_ENABLED err_text = "Trying to assign value of type '" + Variant::get_type_name(src->get_type()) + "' to a variable of type '" + +"'."; - OPCODE_BREAK; #endif + OPCODE_BREAK; } if (!dst_arr->typed_assign(*src)) { #ifdef DEBUG_ENABLED err_text = "Trying to assign a typed array with an array of different type.'"; - OPCODE_BREAK; #endif + OPCODE_BREAK; } ip += 3; @@ -2031,7 +1971,6 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a memnew_placement(&gdfs->state.stack.write[sizeof(Variant) * i], Variant(stack[i])); } gdfs->state.stack_size = _stack_size; - gdfs->state.self = self; gdfs->state.alloca_size = alloca_size; gdfs->state.ip = ip + 2; gdfs->state.line = line; @@ -2143,6 +2082,183 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a OPCODE_BREAK; } + OPCODE(OPCODE_RETURN_TYPED_BUILTIN) { + CHECK_SPACE(3); + GET_INSTRUCTION_ARG(r, 0); + + Variant::Type ret_type = (Variant::Type)_code_ptr[ip + 2]; + GD_ERR_BREAK(ret_type < 0 || ret_type >= Variant::VARIANT_MAX); + + if (r->get_type() != ret_type) { + if (Variant::can_convert_strict(r->get_type(), ret_type)) { + Callable::CallError ce; + Variant::construct(ret_type, retvalue, const_cast<const Variant **>(&r), 1, ce); + } else { +#ifdef DEBUG_ENABLED + err_text = vformat(R"(Trying to return value of type "%s" from a function which the return type is "%s".)", + Variant::get_type_name(r->get_type()), Variant::get_type_name(ret_type)); +#endif // DEBUG_ENABLED + + // Construct a base type anyway so type constraints are met. + Callable::CallError ce; + Variant::construct(ret_type, retvalue, nullptr, 0, ce); + OPCODE_BREAK; + } + } else { + retvalue = *r; + } +#ifdef DEBUG_ENABLED + exit_ok = true; +#endif // DEBUG_ENABLED + OPCODE_BREAK; + } + + OPCODE(OPCODE_RETURN_TYPED_ARRAY) { + CHECK_SPACE(5); + GET_INSTRUCTION_ARG(r, 0); + + GET_INSTRUCTION_ARG(script_type, 1); + Variant::Type builtin_type = (Variant::Type)_code_ptr[ip + 3]; + int native_type_idx = _code_ptr[ip + 4]; + GD_ERR_BREAK(native_type_idx < 0 || native_type_idx >= _global_names_count); + const StringName native_type = _global_names_ptr[native_type_idx]; + + if (r->get_type() != Variant::ARRAY) { +#ifdef DEBUG_ENABLED + err_text = vformat(R"(Trying to return value of type "%s" from a function which the return type is "Array[%s]".)", + Variant::get_type_name(r->get_type()), Variant::get_type_name(builtin_type)); +#endif + OPCODE_BREAK; + } + + Array array; + array.set_typed(builtin_type, native_type, script_type); + +#ifdef DEBUG_ENABLED + bool valid = array.typed_assign(*VariantInternal::get_array(r)); +#else + array.typed_assign(*VariantInternal::get_array(r)); +#endif // DEBUG_ENABLED + + // Assign the return value anyway since we want it to be the valid type. + retvalue = array; + +#ifdef DEBUG_ENABLED + if (!valid) { + err_text = "Trying to return a typed array with an array of different type.'"; + OPCODE_BREAK; + } + + exit_ok = true; +#endif // DEBUG_ENABLED + OPCODE_BREAK; + } + + OPCODE(OPCODE_RETURN_TYPED_NATIVE) { + CHECK_SPACE(3); + GET_INSTRUCTION_ARG(r, 0); + + GET_INSTRUCTION_ARG(type, 1); + GDScriptNativeClass *nc = Object::cast_to<GDScriptNativeClass>(type->operator Object *()); + GD_ERR_BREAK(!nc); + + if (r->get_type() != Variant::OBJECT && r->get_type() != Variant::NIL) { + err_text = vformat(R"(Trying to return value of type "%s" from a function which the return type is "%s".)", + Variant::get_type_name(r->get_type()), nc->get_name()); + OPCODE_BREAK; + } + +#ifdef DEBUG_ENABLED + bool freed = false; + Object *ret_obj = r->get_validated_object_with_check(freed); + + if (freed) { + err_text = "Trying to return a previously freed instance."; + OPCODE_BREAK; + } +#else + Object *ret_obj = r->operator Object *(); +#endif // DEBUG_ENABLED + if (ret_obj && !ClassDB::is_parent_class(ret_obj->get_class_name(), nc->get_name())) { +#ifdef DEBUG_ENABLED + err_text = vformat(R"(Trying to return value of type "%s" from a function which the return type is "%s".)", + ret_obj->get_class_name(), nc->get_name()); +#endif // DEBUG_ENABLED + OPCODE_BREAK; + } + retvalue = *r; + +#ifdef DEBUG_ENABLED + exit_ok = true; +#endif // DEBUG_ENABLED + OPCODE_BREAK; + } + + OPCODE(OPCODE_RETURN_TYPED_SCRIPT) { + CHECK_SPACE(3); + GET_INSTRUCTION_ARG(r, 0); + + GET_INSTRUCTION_ARG(type, 1); + Script *base_type = Object::cast_to<Script>(type->operator Object *()); + GD_ERR_BREAK(!base_type); + + if (r->get_type() != Variant::OBJECT && r->get_type() != Variant::NIL) { +#ifdef DEBUG_ENABLED + err_text = vformat(R"(Trying to return value of type "%s" from a function which the return type is "%s".)", + Variant::get_type_name(r->get_type()), _get_script_name(Ref<Script>(base_type))); +#endif // DEBUG_ENABLED + OPCODE_BREAK; + } + +#ifdef DEBUG_ENABLED + bool freed = false; + Object *ret_obj = r->get_validated_object_with_check(freed); + + if (freed) { + err_text = "Trying to return a previously freed instance."; + OPCODE_BREAK; + } +#else + Object *ret_obj = r->operator Object *(); +#endif // DEBUG_ENABLED + + if (ret_obj) { + ScriptInstance *ret_inst = ret_obj->get_script_instance(); + if (!ret_inst) { +#ifdef DEBUG_ENABLED + err_text = vformat(R"(Trying to return value of type "%s" from a function which the return type is "%s".)", + ret_obj->get_class_name(), _get_script_name(Ref<GDScript>(base_type))); +#endif // DEBUG_ENABLED + OPCODE_BREAK; + } + + Script *ret_type = ret_obj->get_script_instance()->get_script().ptr(); + bool valid = false; + + while (ret_type) { + if (ret_type == base_type) { + valid = true; + break; + } + ret_type = ret_type->get_base_script().ptr(); + } + + if (!valid) { +#ifdef DEBUG_ENABLED + err_text = vformat(R"(Trying to return value of type "%s" from a function which the return type is "%s".)", + _get_script_name(ret_obj->get_script_instance()->get_script()), _get_script_name(Ref<GDScript>(base_type))); +#endif // DEBUG_ENABLED + OPCODE_BREAK; + } + } + retvalue = *r; + +#ifdef DEBUG_ENABLED + exit_ok = true; +#endif // DEBUG_ENABLED + OPCODE_BREAK; + } + OPCODE(OPCODE_ITERATE_BEGIN) { CHECK_SPACE(8); // Space for this and a regular iterate. @@ -2844,6 +2960,19 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a } DISPATCH_OPCODE; + OPCODE(OPCODE_STORE_NAMED_GLOBAL) { + CHECK_SPACE(3); + int globalname_idx = _code_ptr[ip + 2]; + GD_ERR_BREAK(globalname_idx < 0 || globalname_idx >= _global_names_count); + const StringName *globalname = &_global_names_ptr[globalname_idx]; + + GET_INSTRUCTION_ARG(dst, 0); + *dst = GDScriptLanguage::get_singleton()->get_named_globals_map()[*globalname]; + + ip += 3; + } + DISPATCH_OPCODE; + OPCODE(OPCODE_ASSERT) { CHECK_SPACE(3); diff --git a/modules/gltf/editor_scene_importer_gltf.h b/modules/gltf/editor_scene_importer_gltf.h index db961e591d..af1a885f2b 100644 --- a/modules/gltf/editor_scene_importer_gltf.h +++ b/modules/gltf/editor_scene_importer_gltf.h @@ -64,8 +64,8 @@ public: virtual void get_extensions(List<String> *r_extensions) const override; virtual Node *import_scene(const String &p_path, uint32_t p_flags, int p_bake_fps, - List<String> *r_missing_deps = NULL, - Error *r_err = NULL) override; + List<String> *r_missing_deps = nullptr, + Error *r_err = nullptr) override; virtual Ref<Animation> import_animation(const String &p_path, uint32_t p_flags, int p_bake_fps) override; }; @@ -80,7 +80,7 @@ protected: public: virtual void save_scene(Node *p_node, const String &p_path, const String &p_src_path, uint32_t p_flags, int p_bake_fps, - List<String> *r_missing_deps, Error *r_err = NULL); + List<String> *r_missing_deps, Error *r_err = nullptr); virtual void _build_parent_hierachy(Ref<GLTFState> state); virtual Error export_gltf(Node *p_root, String p_path, int32_t p_flags = 0, real_t p_bake_fps = 1000.0f); diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 8fe83436e0..0b70175a24 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -940,22 +940,29 @@ String GLTFDocument::_get_accessor_type_name(const GLTFDocument::GLTFType p_type } GLTFDocument::GLTFType GLTFDocument::_get_type_from_str(const String &p_string) { - if (p_string == "SCALAR") + if (p_string == "SCALAR") { return GLTFDocument::TYPE_SCALAR; + } - if (p_string == "VEC2") + if (p_string == "VEC2") { return GLTFDocument::TYPE_VEC2; - if (p_string == "VEC3") + } + if (p_string == "VEC3") { return GLTFDocument::TYPE_VEC3; - if (p_string == "VEC4") + } + if (p_string == "VEC4") { return GLTFDocument::TYPE_VEC4; + } - if (p_string == "MAT2") + if (p_string == "MAT2") { return GLTFDocument::TYPE_MAT2; - if (p_string == "MAT3") + } + if (p_string == "MAT3") { return GLTFDocument::TYPE_MAT3; - if (p_string == "MAT4") + } + if (p_string == "MAT4") { return GLTFDocument::TYPE_MAT4; + } ERR_FAIL_V(GLTFDocument::TYPE_SCALAR); } @@ -1434,8 +1441,9 @@ Vector<double> GLTFDocument::_decode_accessor(Ref<GLTFState> state, const GLTFAc ERR_FAIL_INDEX_V(a->buffer_view, state->buffer_views.size(), Vector<double>()); const Error err = _decode_buffer_view(state, dst, a->buffer_view, skip_every, skip_bytes, element_size, a->count, a->type, component_count, a->component_type, component_size, a->normalized, a->byte_offset, p_for_vertex); - if (err != OK) + if (err != OK) { return Vector<double>(); + } } else { //fill with zeros, as bufferview is not defined. for (int i = 0; i < (a->count * component_count); i++) { @@ -1450,14 +1458,16 @@ Vector<double> GLTFDocument::_decode_accessor(Ref<GLTFState> state, const GLTFAc const int indices_component_size = _get_component_type_size(a->sparse_indices_component_type); Error err = _decode_buffer_view(state, indices.ptrw(), a->sparse_indices_buffer_view, 0, 0, indices_component_size, a->sparse_count, TYPE_SCALAR, 1, a->sparse_indices_component_type, indices_component_size, false, a->sparse_indices_byte_offset, false); - if (err != OK) + if (err != OK) { return Vector<double>(); + } Vector<double> data; data.resize(component_count * a->sparse_count); err = _decode_buffer_view(state, data.ptrw(), a->sparse_values_buffer_view, skip_every, skip_bytes, element_size, a->sparse_count, a->type, component_count, a->component_type, component_size, a->normalized, a->sparse_values_byte_offset, p_for_vertex); - if (err != OK) + if (err != OK) { return Vector<double>(); + } for (int i = 0; i < indices.size(); i++) { const int write_offset = int(indices[i]) * component_count; @@ -1528,8 +1538,9 @@ Vector<int> GLTFDocument::_decode_accessor_as_ints(Ref<GLTFState> state, const G const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); Vector<int> ret; - if (attribs.size() == 0) + if (attribs.size() == 0) { return ret; + } const double *attribs_ptr = attribs.ptr(); const int ret_size = attribs.size(); @@ -1546,8 +1557,9 @@ Vector<float> GLTFDocument::_decode_accessor_as_floats(Ref<GLTFState> state, con const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); Vector<float> ret; - if (attribs.size() == 0) + if (attribs.size() == 0) { return ret; + } const double *attribs_ptr = attribs.ptr(); const int ret_size = attribs.size(); @@ -1820,8 +1832,9 @@ Vector<Vector2> GLTFDocument::_decode_accessor_as_vec2(Ref<GLTFState> state, con const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); Vector<Vector2> ret; - if (attribs.size() == 0) + if (attribs.size() == 0) { return ret; + } ERR_FAIL_COND_V(attribs.size() % 2 != 0, ret); const double *attribs_ptr = attribs.ptr(); @@ -1998,8 +2011,9 @@ Vector<Vector3> GLTFDocument::_decode_accessor_as_vec3(Ref<GLTFState> state, con const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); Vector<Vector3> ret; - if (attribs.size() == 0) + if (attribs.size() == 0) { return ret; + } ERR_FAIL_COND_V(attribs.size() % 3 != 0, ret); const double *attribs_ptr = attribs.ptr(); @@ -2017,8 +2031,9 @@ Vector<Color> GLTFDocument::_decode_accessor_as_color(Ref<GLTFState> state, cons const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); Vector<Color> ret; - if (attribs.size() == 0) + if (attribs.size() == 0) { return ret; + } const int type = state->accessors[p_accessor]->type; ERR_FAIL_COND_V(!(type == TYPE_VEC3 || type == TYPE_VEC4), ret); @@ -2042,8 +2057,9 @@ Vector<Quat> GLTFDocument::_decode_accessor_as_quat(Ref<GLTFState> state, const const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); Vector<Quat> ret; - if (attribs.size() == 0) + if (attribs.size() == 0) { return ret; + } ERR_FAIL_COND_V(attribs.size() % 4 != 0, ret); const double *attribs_ptr = attribs.ptr(); @@ -2060,8 +2076,9 @@ Vector<Transform2D> GLTFDocument::_decode_accessor_as_xform2d(Ref<GLTFState> sta const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); Vector<Transform2D> ret; - if (attribs.size() == 0) + if (attribs.size() == 0) { return ret; + } ERR_FAIL_COND_V(attribs.size() % 4 != 0, ret); ret.resize(attribs.size() / 4); @@ -2076,8 +2093,9 @@ Vector<Basis> GLTFDocument::_decode_accessor_as_basis(Ref<GLTFState> state, cons const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); Vector<Basis> ret; - if (attribs.size() == 0) + if (attribs.size() == 0) { return ret; + } ERR_FAIL_COND_V(attribs.size() % 9 != 0, ret); ret.resize(attribs.size() / 9); @@ -2093,8 +2111,9 @@ Vector<Transform> GLTFDocument::_decode_accessor_as_xform(Ref<GLTFState> state, const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex); Vector<Transform> ret; - if (attribs.size() == 0) + if (attribs.size() == 0) { return ret; + } ERR_FAIL_COND_V(attribs.size() % 16 != 0, ret); ret.resize(attribs.size() / 16); @@ -3046,8 +3065,9 @@ Error GLTFDocument::_serialize_textures(Ref<GLTFState> state) { } Error GLTFDocument::_parse_textures(Ref<GLTFState> state) { - if (!state->json.has("textures")) + if (!state->json.has("textures")) { return OK; + } const Array &textures = state->json["textures"]; for (GLTFTextureIndex i = 0; i < textures.size(); i++) { @@ -3340,8 +3360,9 @@ Error GLTFDocument::_serialize_materials(Ref<GLTFState> state) { } Error GLTFDocument::_parse_materials(Ref<GLTFState> state) { - if (!state->json.has("materials")) + if (!state->json.has("materials")) { return OK; + } const Array &materials = state->json["materials"]; for (GLTFMaterialIndex i = 0; i < materials.size(); i++) { @@ -3858,8 +3879,9 @@ Error GLTFDocument::_verify_skin(Ref<GLTFState> state, Ref<GLTFSkin> skin) { } Error GLTFDocument::_parse_skins(Ref<GLTFState> state) { - if (!state->json.has("skins")) + if (!state->json.has("skins")) { return OK; + } const Array &skins = state->json["skins"]; @@ -4108,8 +4130,9 @@ Error GLTFDocument::_reparent_to_fake_joint(Ref<GLTFState> state, Ref<GLTFSkelet state->nodes.push_back(fake_joint); // We better not be a joint, or we messed up in our logic - if (node->joint) + if (node->joint) { return FAILED; + } fake_joint->translation = node->translation; fake_joint->rotation = node->rotation; @@ -4528,8 +4551,9 @@ Error GLTFDocument::_parse_lights(Ref<GLTFState> state) { } Error GLTFDocument::_parse_cameras(Ref<GLTFState> state) { - if (!state->json.has("cameras")) + if (!state->json.has("cameras")) { return OK; + } const Array cameras = state->json["cameras"]; @@ -4730,8 +4754,9 @@ Error GLTFDocument::_serialize_animations(Ref<GLTFState> state) { } Error GLTFDocument::_parse_animations(Ref<GLTFState> state) { - if (!state->json.has("animations")) + if (!state->json.has("animations")) { return OK; + } const Array &animations = state->json["animations"]; @@ -4741,8 +4766,9 @@ Error GLTFDocument::_parse_animations(Ref<GLTFState> state) { Ref<GLTFAnimation> animation; animation.instance(); - if (!d.has("channels") || !d.has("samplers")) + if (!d.has("channels") || !d.has("samplers")) { continue; + } Array channels = d["channels"]; Array samplers = d["samplers"]; @@ -4757,8 +4783,9 @@ Error GLTFDocument::_parse_animations(Ref<GLTFState> state) { for (int j = 0; j < channels.size(); j++) { const Dictionary &c = channels[j]; - if (!c.has("target")) + if (!c.has("target")) { continue; + } const Dictionary &t = c["target"]; if (!t.has("node") || !t.has("path")) { @@ -4868,8 +4895,9 @@ void GLTFDocument::_assign_scene_names(Ref<GLTFState> state) { Ref<GLTFNode> n = state->nodes[i]; // Any joints get unique names generated when the skeleton is made, unique to the skeleton - if (n->skeleton >= 0) + if (n->skeleton >= 0) { continue; + } if (n->get_name().is_empty()) { if (n->mesh >= 0) { @@ -5515,8 +5543,9 @@ T GLTFDocument::_interpolate_track(const Vector<float> &p_times, const Vector<T> //could use binary search, worth it? int idx = -1; for (int i = 0; i < p_times.size(); i++) { - if (p_times[i] > p_time) + if (p_times[i] > p_time) { break; + } idx++; } @@ -6356,13 +6385,15 @@ Error GLTFDocument::parse(Ref<GLTFState> state, String p_path, bool p_read_binar //binary file //text file err = _parse_glb(p_path, state); - if (err) + if (err) { return FAILED; + } } else { //text file err = _parse_json(p_path, state); - if (err) + if (err) { return FAILED; + } } f->close(); @@ -6382,68 +6413,81 @@ Error GLTFDocument::parse(Ref<GLTFState> state, String p_path, bool p_read_binar /* STEP 0 PARSE SCENE */ err = _parse_scenes(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 1 PARSE NODES */ err = _parse_nodes(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 2 PARSE BUFFERS */ err = _parse_buffers(state, p_path.get_base_dir()); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 3 PARSE BUFFER VIEWS */ err = _parse_buffer_views(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 4 PARSE ACCESSORS */ err = _parse_accessors(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 5 PARSE IMAGES */ err = _parse_images(state, p_path.get_base_dir()); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 6 PARSE TEXTURES */ err = _parse_textures(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 7 PARSE TEXTURES */ err = _parse_materials(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 9 PARSE SKINS */ err = _parse_skins(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 10 DETERMINE SKELETONS */ err = _determine_skeletons(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 11 CREATE SKELETONS */ err = _create_skeletons(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 12 CREATE SKINS */ err = _create_skins(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 13 PARSE MESHES (we have enough info now) */ err = _parse_meshes(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 14 PARSE LIGHTS */ err = _parse_lights(state); @@ -6453,13 +6497,15 @@ Error GLTFDocument::parse(Ref<GLTFState> state, String p_path, bool p_read_binar /* STEP 15 PARSE CAMERAS */ err = _parse_cameras(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 16 PARSE ANIMATIONS */ err = _parse_animations(state); - if (err != OK) + if (err != OK) { return Error::FAILED; + } /* STEP 17 ASSIGN SCENE NAMES */ _assign_scene_names(state); diff --git a/modules/minimp3/audio_stream_mp3.cpp b/modules/minimp3/audio_stream_mp3.cpp index b128b81000..aaa05a910c 100644 --- a/modules/minimp3/audio_stream_mp3.cpp +++ b/modules/minimp3/audio_stream_mp3.cpp @@ -99,8 +99,9 @@ float AudioStreamPlaybackMP3::get_playback_position() const { } void AudioStreamPlaybackMP3::seek(float p_time) { - if (!active) + if (!active) { return; + } if (p_time >= mp3_stream->get_length()) { p_time = 0; diff --git a/modules/text_server_adv/dynamic_font_adv.cpp b/modules/text_server_adv/dynamic_font_adv.cpp index 19d04bdb02..326af7f0ee 100644 --- a/modules/text_server_adv/dynamic_font_adv.cpp +++ b/modules/text_server_adv/dynamic_font_adv.cpp @@ -231,7 +231,7 @@ Dictionary DynamicFontDataAdvanced::get_feature_list() const { Dictionary out; // Read feature flags. - unsigned int count = hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, NULL, NULL); + unsigned int count = hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, nullptr, nullptr); if (count != 0) { hb_tag_t *feature_tags = (hb_tag_t *)memalloc(count * sizeof(hb_tag_t)); hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, &count, feature_tags); @@ -240,7 +240,7 @@ Dictionary DynamicFontDataAdvanced::get_feature_list() const { } memfree(feature_tags); } - count = hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, NULL, NULL); + count = hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, nullptr, nullptr); if (count != 0) { hb_tag_t *feature_tags = (hb_tag_t *)memalloc(count * sizeof(hb_tag_t)); hb_ot_layout_table_get_feature_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, &count, feature_tags); @@ -639,7 +639,7 @@ bool DynamicFontDataAdvanced::is_script_supported(uint32_t p_script) const { DataAtSize *fds = const_cast<DynamicFontDataAdvanced *>(this)->get_data_for_size(base_size); ERR_FAIL_COND_V(fds == nullptr, false); - unsigned int count = hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, NULL, NULL); + unsigned int count = hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, nullptr, nullptr); if (count != 0) { hb_tag_t *script_tags = (hb_tag_t *)memalloc(count * sizeof(hb_tag_t)); hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GSUB, 0, &count, script_tags); @@ -651,7 +651,7 @@ bool DynamicFontDataAdvanced::is_script_supported(uint32_t p_script) const { } memfree(script_tags); } - count = hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, NULL, NULL); + count = hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, nullptr, nullptr); if (count != 0) { hb_tag_t *script_tags = (hb_tag_t *)memalloc(count * sizeof(hb_tag_t)); hb_ot_layout_table_get_script_tags(hb_font_get_face(fds->hb_handle), HB_OT_TAG_GPOS, 0, &count, script_tags); diff --git a/modules/text_server_adv/script_iterator.cpp b/modules/text_server_adv/script_iterator.cpp index 8f23bb9e02..f9bbd25a5f 100644 --- a/modules/text_server_adv/script_iterator.cpp +++ b/modules/text_server_adv/script_iterator.cpp @@ -75,10 +75,12 @@ ScriptIterator::ScriptIterator(const String &p_string, int p_start, int p_length while (paren_sp >= 0 && paren_stack[paren_sp].pair_index != paired_ch) { paren_sp -= 1; } - if (paren_sp < start_sp) + if (paren_sp < start_sp) { start_sp = paren_sp; - if (paren_sp >= 0) + } + if (paren_sp >= 0) { sc = paren_stack[paren_sp].script_code; + } } } diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 9007c696eb..8b8b6b7cd3 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -1832,8 +1832,9 @@ _FORCE_INLINE_ int _generate_kashida_justification_opportunies(const String &p_d } } } - if (!is_transparent(c)) + if (!is_transparent(c)) { pc = c; + } i++; } diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp index e91ae46a57..6d5fff88d9 100644 --- a/modules/visual_script/visual_script.cpp +++ b/modules/visual_script/visual_script.cpp @@ -784,8 +784,9 @@ ScriptInstance *VisualScript::instance_create(Object *p_this) { variables.get_key_list(&keys); for (const List<StringName>::Element *E = keys.front(); E; E = E->next()) { - if (!variables[E->get()]._export) + if (!variables[E->get()]._export) { continue; + } PropertyInfo p = variables[E->get()].info; p.name = String(E->get()); @@ -2050,12 +2051,12 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o instance->id = F->get(); instance->input_port_count = node->get_input_value_port_count(); - instance->input_ports = NULL; + instance->input_ports = nullptr; instance->output_port_count = node->get_output_value_port_count(); - instance->output_ports = NULL; + instance->output_ports = nullptr; instance->sequence_output_count = node->get_output_sequence_port_count(); instance->sequence_index = function.node_count++; - instance->sequence_outputs = NULL; + instance->sequence_outputs = nullptr; instance->pass_idx = -1; if (instance->input_port_count) { @@ -2075,7 +2076,7 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o if (instance->sequence_output_count) { instance->sequence_outputs = memnew_arr(VisualScriptNodeInstance *, instance->sequence_output_count); for (int i = 0; i < instance->sequence_output_count; i++) { - instance->sequence_outputs[i] = NULL; // If it remains null, flow ends here. + instance->sequence_outputs[i] = nullptr; // If it remains null, flow ends here. } } @@ -2085,10 +2086,11 @@ void VisualScriptInstance::create(const Ref<VisualScript> &p_script, Object *p_o StringName var_name; - if (Object::cast_to<VisualScriptLocalVar>(*node)) + if (Object::cast_to<VisualScriptLocalVar>(*node)) { var_name = String(Object::cast_to<VisualScriptLocalVar>(*node)->get_var_name()).strip_edges(); - else + } else { var_name = String(Object::cast_to<VisualScriptLocalVarSet>(*node)->get_var_name()).strip_edges(); + } if (!local_var_indices.has(var_name)) { local_var_indices[var_name] = function.max_stack; @@ -2252,6 +2254,7 @@ Variant VisualScriptFunctionState::_signal_callback(const Variant **p_args, int } void VisualScriptFunctionState::connect_to_signal(Object *p_obj, const String &p_signal, Array p_binds) { + ERR_FAIL_NULL(p_obj); Vector<Variant> binds; for (int i = 0; i < p_binds.size(); i++) { binds.push_back(p_binds[i]); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index d520837d43..3cdf60708b 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -1826,6 +1826,8 @@ void VisualScriptEditor::_generic_search(String p_base_type, Vector2 pos, bool n } void VisualScriptEditor::_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + // GUI input for VS Editor Plugin Ref<InputEventMouseButton> key = p_event; @@ -3015,9 +3017,9 @@ void VisualScriptEditor::_graph_connect_to_empty(const String &p_from, int p_fro if (!vsn.is_valid()) { return; } - if (vsn->get_output_value_port_count()) - + if (vsn->get_output_value_port_count()) { port_action_pos = p_release_pos; + } if (p_from_slot < vsn->get_output_sequence_port_count()) { port_action_node = p_from.to_int(); diff --git a/modules/websocket/doc_classes/WebSocketClient.xml b/modules/websocket/doc_classes/WebSocketClient.xml index 45db49c913..d362bcc10f 100644 --- a/modules/websocket/doc_classes/WebSocketClient.xml +++ b/modules/websocket/doc_classes/WebSocketClient.xml @@ -28,6 +28,7 @@ If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI], connections to non-Godot servers will not work, and [signal data_received] will not be emitted. If [code]false[/code] is passed instead (default), you must call [PacketPeer] functions ([code]put_packet[/code], [code]get_packet[/code], etc.) on the [WebSocketPeer] returned via [code]get_peer(1)[/code] and not on this object directly (e.g. [code]get_peer(1).put_packet(data)[/code]). You can optionally pass a list of [code]custom_headers[/code] to be added to the handshake HTTP request. + [b]Note:[/b] To avoid mixed content warnings or errors in HTML5, you may have to use a [code]url[/code] that starts with [code]wss://[/code] (secure) instead of [code]ws://[/code]. When doing so, make sure to use the fully qualified domain name that matches the one defined in the server's SSL certificate. Do not connect directly via the IP address for [code]wss://[/code] connections, as it won't match with the SSL certificate. [b]Note:[/b] Specifying [code]custom_headers[/code] is not supported in HTML5 exports due to browsers restrictions. </description> </method> diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 326e513261..5f9f420b59 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -2262,8 +2262,9 @@ public: CharString command_line_argument = command_line_strings[i].utf8(); int base = r_command_line_flags.size(); int length = command_line_argument.length(); - if (length == 0) + if (length == 0) { continue; + } r_command_line_flags.resize(base + 4 + length); encode_uint32(length, &r_command_line_flags.write[base]); copymem(&r_command_line_flags.write[base + 4], command_line_argument.ptr(), length); @@ -2484,7 +2485,7 @@ public: _clear_assets_directory(); if (!apk_expansion) { print_verbose("Exporting project files.."); - err = export_project_files(p_preset, rename_and_store_file_in_gradle_project, NULL, ignore_so_file); + err = export_project_files(p_preset, rename_and_store_file_in_gradle_project, nullptr, ignore_so_file); if (err != OK) { EditorNode::add_io_error("Could not export project files to gradle project\n"); return err; @@ -2615,10 +2616,11 @@ public: } // This is the start of the Legacy build system print_verbose("Starting legacy build system.."); - if (p_debug) + if (p_debug) { src_apk = p_preset->get("custom_template/debug"); - else + } else { src_apk = p_preset->get("custom_template/release"); + } src_apk = src_apk.strip_edges(); if (src_apk == "") { if (p_debug) { @@ -2813,11 +2815,11 @@ public: zipOpenNewFileInZip(unaligned_apk, "assets/_cl_", &zipfi, - NULL, + nullptr, 0, - NULL, + nullptr, 0, - NULL, + nullptr, 0, // No compress (little size gain and potentially slower startup) Z_DEFAULT_COMPRESSION); zipWriteInFileInZip(unaligned_apk, command_line_flags.ptr(), command_line_flags.size()); diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index 097a2391ee..40b8e90c6f 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -47,20 +47,21 @@ const String godot_project_name_xml_string = R"(<?xml version="1.0" encoding="ut DisplayServer::ScreenOrientation _get_screen_orientation() { String orientation_settings = ProjectSettings::get_singleton()->get("display/window/handheld/orientation"); DisplayServer::ScreenOrientation screen_orientation; - if (orientation_settings == "portrait") + if (orientation_settings == "portrait") { screen_orientation = DisplayServer::SCREEN_PORTRAIT; - else if (orientation_settings == "reverse_landscape") + } else if (orientation_settings == "reverse_landscape") { screen_orientation = DisplayServer::SCREEN_REVERSE_LANDSCAPE; - else if (orientation_settings == "reverse_portrait") + } else if (orientation_settings == "reverse_portrait") { screen_orientation = DisplayServer::SCREEN_REVERSE_PORTRAIT; - else if (orientation_settings == "sensor_landscape") + } else if (orientation_settings == "sensor_landscape") { screen_orientation = DisplayServer::SCREEN_SENSOR_LANDSCAPE; - else if (orientation_settings == "sensor_portrait") + } else if (orientation_settings == "sensor_portrait") { screen_orientation = DisplayServer::SCREEN_SENSOR_PORTRAIT; - else if (orientation_settings == "sensor") + } else if (orientation_settings == "sensor") { screen_orientation = DisplayServer::SCREEN_SENSOR; - else + } else { screen_orientation = DisplayServer::SCREEN_LANDSCAPE; + } return screen_orientation; } diff --git a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java index ec2ace4821..4eac2d08d1 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java +++ b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java @@ -34,7 +34,6 @@ import android.content.Intent; import android.os.Bundle; import android.view.KeyEvent; -import androidx.annotation.CallSuper; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.FragmentActivity; @@ -63,30 +62,9 @@ public abstract class FullScreenGodotApp extends FragmentActivity implements God @Override public void onNewIntent(Intent intent) { + super.onNewIntent(intent); if (godotFragment != null) { godotFragment.onNewIntent(intent); - } else { - super.onNewIntent(intent); - } - } - - @CallSuper - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (godotFragment != null) { - godotFragment.onActivityResult(requestCode, resultCode, data); - } else { - super.onActivityResult(requestCode, resultCode, data); - } - } - - @CallSuper - @Override - public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { - if (godotFragment != null) { - godotFragment.onRequestPermissionsResult(requestCode, permissions, grantResults); - } else { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); } } diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index 1e89e144cc..3f04bedea2 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -550,7 +550,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese if (f) { file_sizes[pck_path.get_file()] = (uint64_t)f->get_len(); memdelete(f); - f = NULL; + f = nullptr; } _fix_html(html, p_preset, p_path.get_file().get_basename(), p_debug, p_flags, shared_objects, file_sizes); f = FileAccess::open(p_path, FileAccess::WRITE); diff --git a/platform/javascript/godot_js.h b/platform/javascript/godot_js.h index 4448a35670..8927a83cb3 100644 --- a/platform/javascript/godot_js.h +++ b/platform/javascript/godot_js.h @@ -71,6 +71,7 @@ extern int godot_js_display_fullscreen_exit(); extern void godot_js_display_compute_position(int p_x, int p_y, int32_t *r_x, int32_t *r_y); extern void godot_js_display_window_title_set(const char *p_text); extern void godot_js_display_window_icon_set(const uint8_t *p_ptr, int p_len); +extern int godot_js_display_has_webgl(int p_version); // Display clipboard extern int godot_js_display_clipboard_set(const char *p_text); diff --git a/platform/javascript/js/engine/preloader.js b/platform/javascript/js/engine/preloader.js index 3535fdb361..564c68d264 100644 --- a/platform/javascript/js/engine/preloader.js +++ b/platform/javascript/js/engine/preloader.js @@ -1,22 +1,5 @@ const Preloader = /** @constructor */ function () { // eslint-disable-line no-unused-vars function getTrackedResponse(response, load_status) { - let clen = 0; - let compressed = false; - response.headers.forEach(function (value, header) { - const h = header.toLowerCase().trim(); - // We can't accurately compute compressed stream length. - if (h === 'content-encoding') { - compressed = true; - } else if (h === 'content-length') { - const length = parseInt(value, 10); - if (!Number.isNaN(length) && length > 0) { - clen = length; - } - } - }); - if (!compressed && clen) { - load_status.total = clen; - } function onloadprogress(reader, controller) { return reader.read().then(function (result) { if (load_status.done) { diff --git a/platform/javascript/js/libs/library_godot_display.js b/platform/javascript/js/libs/library_godot_display.js index 00e6a01679..91cab5eacc 100644 --- a/platform/javascript/js/libs/library_godot_display.js +++ b/platform/javascript/js/libs/library_godot_display.js @@ -719,6 +719,17 @@ const GodotDisplay = { GodotRuntime.setHeapValue(r_y, (y - rect.y) * rh, 'i32'); }, + godot_js_display_has_webgl__sig: 'ii', + godot_js_display_has_webgl: function (p_version) { + if (p_version !== 1 && p_version !== 2) { + return false; + } + try { + return !!document.createElement('canvas').getContext(p_version === 2 ? 'webgl2' : 'webgl'); + } catch (e) { /* Not available */ } + return false; + }, + /* * Canvas */ diff --git a/platform/javascript/js/libs/library_godot_fetch.js b/platform/javascript/js/libs/library_godot_fetch.js index 4ae6a23593..de5ae2b1ae 100644 --- a/platform/javascript/js/libs/library_godot_fetch.js +++ b/platform/javascript/js/libs/library_godot_fetch.js @@ -49,25 +49,14 @@ const GodotFetch = { if (!obj) { return; } - let size = -1; - let compressed = false; let chunked = false; response.headers.forEach(function (value, header) { const v = value.toLowerCase().trim(); const h = header.toLowerCase().trim(); - if (h === 'content-encoding') { - compressed = true; - size = -1; - } else if (h === 'content-length') { - const len = Number.parseInt(value, 10); - if (!Number.isNaN(len) && !compressed) { - size = len; - } - } else if (h === 'transfer-encoding' && v === 'chunked') { + if (h === 'transfer-encoding' && v === 'chunked') { chunked = true; } }); - obj.bodySize = size; obj.status = response.status; obj.response = response; obj.reader = response.body.getReader(); diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index d6ed416d7c..8dc1b41702 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -2012,7 +2012,7 @@ int DisplayServerX11::keyboard_get_layout_count() const { XkbGetNames(x11_display, XkbSymbolsNameMask, kbd); const Atom *groups = kbd->names->groups; - if (kbd->ctrls != NULL) { + if (kbd->ctrls != nullptr) { _group_count = kbd->ctrls->num_groups; } else { while (_group_count < XkbNumKbdGroups && groups[_group_count] != None) { @@ -2046,7 +2046,7 @@ String DisplayServerX11::keyboard_get_layout_language(int p_index) const { int _group_count = 0; const Atom *groups = kbd->names->groups; - if (kbd->ctrls != NULL) { + if (kbd->ctrls != nullptr) { _group_count = kbd->ctrls->num_groups; } else { while (_group_count < XkbNumKbdGroups && groups[_group_count] != None) { @@ -2085,7 +2085,7 @@ String DisplayServerX11::keyboard_get_layout_name(int p_index) const { int _group_count = 0; const Atom *groups = kbd->names->groups; - if (kbd->ctrls != NULL) { + if (kbd->ctrls != nullptr) { _group_count = kbd->ctrls->num_groups; } else { while (_group_count < XkbNumKbdGroups && groups[_group_count] != None) { @@ -2684,7 +2684,7 @@ bool DisplayServerX11::_wait_for_events() const { tv.tv_sec = 1; // Wait for next event or timeout. - int num_ready_fds = select(x11_fd + 1, &in_fds, NULL, NULL, &tv); + int num_ready_fds = select(x11_fd + 1, &in_fds, nullptr, nullptr, &tv); if (num_ready_fds > 0) { // Event received. diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index 8ea0f6c246..e8f4352dff 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -178,17 +178,18 @@ void JoypadLinux::monitor_joypads(udev *p_udev) { select() ensured that this will not block. */ dev = udev_monitor_receive_device(mon); - if (dev && udev_device_get_devnode(dev) != 0) { + if (dev && udev_device_get_devnode(dev) != nullptr) { MutexLock lock(joy_mutex); String action = udev_device_get_action(dev); const char *devnode = udev_device_get_devnode(dev); if (devnode) { String devnode_str = devnode; if (devnode_str.find(ignore_str) == -1) { - if (action == "add") + if (action == "add") { open_joypad(devnode); - else if (String(action) == "remove") + } else if (String(action) == "remove") { close_joypad(get_joy_from_path(devnode)); + } } } @@ -212,7 +213,7 @@ void JoypadLinux::monitor_joypads() { struct dirent *current; char fname[64]; - while ((current = readdir(input_directory)) != NULL) { + while ((current = readdir(input_directory)) != nullptr) { if (strncmp(current->d_name, "event", 5) != 0) { continue; } diff --git a/scene/2d/animated_sprite_2d.cpp b/scene/2d/animated_sprite_2d.cpp index dfc08583f2..4aa079b013 100644 --- a/scene/2d/animated_sprite_2d.cpp +++ b/scene/2d/animated_sprite_2d.cpp @@ -382,12 +382,11 @@ bool AnimatedSprite2D::_is_playing() const { } void AnimatedSprite2D::play(const StringName &p_animation, const bool p_backwards) { - ERR_FAIL_NULL_MSG(frames, "Can't play AnimatedSprite2D without a valid SpriteFrames resource."); backwards = p_backwards; if (p_animation) { set_animation(p_animation); - if (backwards && get_frame() == 0) { + if (frames.is_valid() && backwards && get_frame() == 0) { set_frame(frames->get_frame_count(p_animation) - 1); } } diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp index 9d6868a1b2..4e58984b37 100644 --- a/scene/2d/touch_screen_button.cpp +++ b/scene/2d/touch_screen_button.cpp @@ -189,6 +189,8 @@ String TouchScreenButton::get_action() const { } void TouchScreenButton::_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!get_tree()) { return; } diff --git a/scene/3d/skeleton_ik_3d.cpp b/scene/3d/skeleton_ik_3d.cpp index 85da546430..6cde6a9b17 100644 --- a/scene/3d/skeleton_ik_3d.cpp +++ b/scene/3d/skeleton_ik_3d.cpp @@ -255,9 +255,22 @@ void FabrikInverseKinematic::make_goal(Task *p_task, const Transform &p_inverse_ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool override_tip_basis, bool p_use_magnet, const Vector3 &p_magnet_position) { if (blending_delta <= 0.01f) { + // Before skipping, make sure we undo the global pose overrides + ChainItem *ci(&p_task->chain.chain_root); + while (ci) { + p_task->skeleton->set_bone_global_pose_override(ci->bone, ci->initial_transform, 0.0, false); + + if (!ci->children.is_empty()) { + ci = &ci->children.write[0]; + } else { + ci = nullptr; + } + } + return; // Skip solving } + // This line below is part of the problem - removing it fixes the issue with BoneAttachment nodes... p_task->skeleton->set_bone_global_pose_override(p_task->chain.chain_root.bone, Transform(), 0.0, true); if (p_task->chain.middle_chain_item) { @@ -268,9 +281,9 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove p_task->skeleton->set_bone_global_pose_override(p_task->chain.tips[i].chain_item->bone, Transform(), 0.0, true); } - // Update the initial root transform - p_task->chain.chain_root.initial_transform = p_task->skeleton->get_bone_global_pose(p_task->chain.chain_root.bone); - p_task->chain.chain_root.current_pos = p_task->chain.chain_root.initial_transform.origin; + // Update the transforms to their global poses + // (Needed to sync IK with animation) + _update_chain(p_task->skeleton, &p_task->chain.chain_root); make_goal(p_task, p_task->skeleton->get_global_transform().affine_inverse(), blending_delta); @@ -286,22 +299,48 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove Transform new_bone_pose(ci->initial_transform); new_bone_pose.origin = ci->current_pos; - if (!ci->children.is_empty()) { - /// Rotate basis - const Vector3 initial_ori((ci->children[0].initial_transform.origin - ci->initial_transform.origin).normalized()); - const Vector3 rot_axis(initial_ori.cross(ci->current_ori).normalized()); - - if (rot_axis[0] != 0 && rot_axis[1] != 0 && rot_axis[2] != 0) { - const real_t rot_angle(Math::acos(CLAMP(initial_ori.dot(ci->current_ori), -1, 1))); - new_bone_pose.basis.rotate(rot_axis, rot_angle); + // The root bone needs to be rotated differently so it isn't frozen in place. + if (ci == &p_task->chain.chain_root && !ci->children.is_empty()) { + new_bone_pose = new_bone_pose.looking_at(ci->children[0].current_pos); + const Vector3 bone_rest_dir = p_task->skeleton->get_bone_rest(ci->children[0].bone).origin.normalized().abs(); + const Vector3 bone_rest_dir_abs = bone_rest_dir.abs(); + if (bone_rest_dir_abs.x > bone_rest_dir_abs.y && bone_rest_dir_abs.x > bone_rest_dir_abs.z) { + if (bone_rest_dir.x < 0) { + new_bone_pose.basis.rotate_local(Vector3(0, 1, 0), -Math_PI / 2.0f); + } else { + new_bone_pose.basis.rotate_local(Vector3(0, 1, 0), Math_PI / 2.0f); + } + } else if (bone_rest_dir_abs.y > bone_rest_dir_abs.x && bone_rest_dir_abs.y > bone_rest_dir_abs.z) { + if (bone_rest_dir.y < 0) { + new_bone_pose.basis.rotate_local(Vector3(1, 0, 0), Math_PI / 2.0f); + } else { + new_bone_pose.basis.rotate_local(Vector3(1, 0, 0), -Math_PI / 2.0f); + } + } else { + if (bone_rest_dir.z < 0) { + // Do nothing! + } else { + new_bone_pose.basis.rotate_local(Vector3(0, 0, 1), Math_PI); + } } - } else { - // Set target orientation to tip - if (override_tip_basis) { - new_bone_pose.basis = p_task->chain.tips[0].end_effector->goal_transform.basis; + if (!ci->children.is_empty()) { + /// Rotate basis + const Vector3 initial_ori((ci->children[0].initial_transform.origin - ci->initial_transform.origin).normalized()); + const Vector3 rot_axis(initial_ori.cross(ci->current_ori).normalized()); + + if (rot_axis[0] != 0 && rot_axis[1] != 0 && rot_axis[2] != 0) { + const real_t rot_angle(Math::acos(CLAMP(initial_ori.dot(ci->current_ori), -1, 1))); + new_bone_pose.basis.rotate(rot_axis, rot_angle); + } + } else { - new_bone_pose.basis = new_bone_pose.basis * p_task->chain.tips[0].end_effector->goal_transform.basis; + // Set target orientation to tip + if (override_tip_basis) { + new_bone_pose.basis = p_task->chain.tips[0].end_effector->goal_transform.basis; + } else { + new_bone_pose.basis = new_bone_pose.basis * p_task->chain.tips[0].end_effector->goal_transform.basis; + } } } @@ -319,6 +358,20 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove } } +void FabrikInverseKinematic::_update_chain(const Skeleton3D *p_sk, ChainItem *p_chain_item) { + if (!p_chain_item) { + return; + } + + p_chain_item->initial_transform = p_sk->get_bone_global_pose(p_chain_item->bone); + p_chain_item->current_pos = p_chain_item->initial_transform.origin; + + ChainItem *items = p_chain_item->children.ptrw(); + for (int i = 0; i < p_chain_item->children.size(); i += 1) { + _update_chain(p_sk, items + i); + } +} + void SkeletonIK3D::_validate_property(PropertyInfo &property) const { if (property.name == "root_bone" || property.name == "tip_bone") { if (skeleton) { diff --git a/scene/3d/skeleton_ik_3d.h b/scene/3d/skeleton_ik_3d.h index c98f55804c..9255e18b72 100644 --- a/scene/3d/skeleton_ik_3d.h +++ b/scene/3d/skeleton_ik_3d.h @@ -118,6 +118,8 @@ public: static void set_goal(Task *p_task, const Transform &p_goal); static void make_goal(Task *p_task, const Transform &p_inverse_transf, real_t blending_delta); static void solve(Task *p_task, real_t blending_delta, bool override_tip_basis, bool p_use_magnet, const Vector3 &p_magnet_position); + + static void _update_chain(const Skeleton3D *p_skeleton, ChainItem *p_chain_item); }; class SkeletonIK3D : public Node { diff --git a/scene/3d/sprite_3d.h b/scene/3d/sprite_3d.h index b48660eb2d..d1bc8dc737 100644 --- a/scene/3d/sprite_3d.h +++ b/scene/3d/sprite_3d.h @@ -203,8 +203,8 @@ class AnimatedSprite3D : public SpriteBase3D { float timeout = 0.0; - bool hflip = 1; - bool vflip = 1; + bool hflip = true; + bool vflip = true; Color modulate; diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index db13b9b11f..826fd0189b 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -53,6 +53,8 @@ void BaseButton::_unpress_group() { } void BaseButton::_gui_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (status.disabled) { // no interaction with disabled button return; } @@ -323,6 +325,8 @@ Ref<Shortcut> BaseButton::get_shortcut() const { } void BaseButton::_unhandled_key_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!_is_focus_owner_in_shorcut_context()) { return; } diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 1a9ad23434..78524a856a 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -115,19 +115,22 @@ void ColorPicker::_update_controls() { if (raw_mode_enabled) { for (int i = 0; i < 3; i++) { - scroll[i]->add_theme_icon_override("grabber", Ref<Texture2D>()); - scroll[i]->add_theme_icon_override("grabber_highlight", Ref<Texture2D>()); - scroll[i]->add_theme_style_override("slider", Ref<StyleBox>()); - scroll[i]->add_theme_style_override("grabber_area", Ref<StyleBox>()); - scroll[i]->add_theme_style_override("grabber_area_highlight", Ref<StyleBox>()); + scroll[i]->remove_theme_icon_override("grabber"); + scroll[i]->remove_theme_icon_override("grabber_highlight"); + scroll[i]->remove_theme_style_override("slider"); + scroll[i]->remove_theme_style_override("grabber_area"); + scroll[i]->remove_theme_style_override("grabber_area_highlight"); } } else { - for (int i = 0; i < 3; i++) { - scroll[i]->add_theme_icon_override("grabber", get_theme_icon("bar_arrow")); - scroll[i]->add_theme_icon_override("grabber_highlight", get_theme_icon("bar_arrow")); - scroll[i]->add_theme_style_override("slider", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); - scroll[i]->add_theme_style_override("grabber_area", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); - scroll[i]->add_theme_style_override("grabber_area_highlight", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); + Ref<StyleBoxEmpty> style_box_empty(memnew(StyleBoxEmpty)); + Ref<Texture2D> bar_arrow = get_theme_icon("bar_arrow"); + + for (int i = 0; i < 4; i++) { + scroll[i]->add_theme_icon_override("grabber", bar_arrow); + scroll[i]->add_theme_icon_override("grabber_highlight", bar_arrow); + scroll[i]->add_theme_style_override("slider", style_box_empty); + scroll[i]->add_theme_style_override("grabber_area", style_box_empty); + scroll[i]->add_theme_style_override("grabber_area_highlight", style_box_empty); } } @@ -887,12 +890,8 @@ ColorPicker::ColorPicker() : vbr->add_child(hbc); } + labels[3]->set_text("A"); - scroll[3]->add_theme_icon_override("grabber", get_theme_icon("bar_arrow")); - scroll[3]->add_theme_icon_override("grabber_highlight", get_theme_icon("bar_arrow")); - scroll[3]->add_theme_style_override("slider", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); - scroll[3]->add_theme_style_override("grabber_area", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); - scroll[3]->add_theme_style_override("grabber_area_highlight", Ref<StyleBoxEmpty>(memnew(StyleBoxEmpty))); HBoxContainer *hhb = memnew(HBoxContainer); vbr->add_child(hhb); diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 7ac8dbccca..5409b44b9e 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -96,6 +96,8 @@ void FileDialog::_notification(int p_what) { } void FileDialog::_unhandled_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventKey> k = p_event; if (k.is_valid() && has_focus()) { if (k->is_pressed()) { diff --git a/scene/gui/gradient_edit.cpp b/scene/gui/gradient_edit.cpp index 36b383f16c..e72709e847 100644 --- a/scene/gui/gradient_edit.cpp +++ b/scene/gui/gradient_edit.cpp @@ -92,6 +92,8 @@ GradientEdit::~GradientEdit() { } void GradientEdit::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventKey> k = p_event; if (k.is_valid() && k->is_pressed() && k->get_keycode() == KEY_DELETE && grabbed != -1) { diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index b93391ee4c..06c9cf1b63 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -154,6 +154,8 @@ Vector2 GraphEditMinimap::_convert_to_graph_position(const Vector2 &p_position) } void GraphEditMinimap::_gui_input(const Ref<InputEvent> &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + if (!ge->is_minimap_enabled()) { return; } @@ -1066,6 +1068,8 @@ void GraphEdit::set_selected(Node *p_child) { } void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + Ref<InputEventMouseMotion> mm = p_ev; if (mm.is_valid() && (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE || (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) { h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x); @@ -1319,9 +1323,9 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) { } if (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { - set_zoom(zoom * ZOOM_SCALE); + set_zoom_custom(zoom * ZOOM_SCALE, b->get_position()); } else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) { - set_zoom(zoom / ZOOM_SCALE); + set_zoom_custom(zoom / ZOOM_SCALE, b->get_position()); } else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8); } else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) { diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index 8eba473d57..7d5c53effe 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -804,6 +804,8 @@ Color GraphNode::get_connection_output_color(int p_idx) { } void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) { + ERR_FAIL_COND(p_ev.is_null()); + Ref<InputEventMouseButton> mb = p_ev; if (mb.is_valid()) { ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node."); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 482560d29d..86d070f9b1 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -530,6 +530,8 @@ Size2 ItemList::Item::get_icon_size() const { } void ItemList::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + double prev_scroll = scroll_bar->get_value(); Ref<InputEventMouseMotion> mm = p_event; diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index d1cd73c803..2d8eb3191c 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -215,6 +215,8 @@ void LineEdit::_delete(bool p_word, bool p_all_to_right) { } void LineEdit::_gui_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseButton> b = p_event; if (b.is_valid()) { diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 5acc7e808a..1e9baa77fc 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -34,6 +34,8 @@ #include "scene/main/window.h" void MenuButton::_unhandled_key_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!_is_focus_owner_in_shorcut_context()) { return; } diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index bfbd46a9f0..44df8eafdc 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -252,6 +252,8 @@ void PopupMenu::_submenu_timeout() { } void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (p_event->is_action("ui_down") && p_event->is_pressed()) { int search_from = mouse_over + 1; if (search_from >= items.size()) { diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 09f6578295..c763ae6bd6 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1469,6 +1469,8 @@ Control::CursorShape RichTextLabel::get_cursor_shape(const Point2 &p_pos) const } void RichTextLabel::_gui_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseButton> b = p_event; if (b.is_valid()) { diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index a56bf15507..62276e3af0 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -42,6 +42,8 @@ void ScrollBar::set_can_focus_by_default(bool p_can_focus) { } void ScrollBar::_gui_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseMotion> m = p_event; if (!m.is_valid() || drag.active) { emit_signal("scrolling"); diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 90a528482f..757a0841ea 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -88,6 +88,8 @@ void ScrollContainer::_cancel_drag() { } void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) { + ERR_FAIL_COND(p_gui_input.is_null()); + double prev_v_scroll = v_scroll->get_value(); double prev_h_scroll = h_scroll->get_value(); diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index 7f1d19a87a..a407ef21cb 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -46,6 +46,8 @@ Size2 Slider::get_minimum_size() const { } void Slider::_gui_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!editable) { return; } diff --git a/scene/gui/spin_box.cpp b/scene/gui/spin_box.cpp index 50b25fa7b4..9dc2afdb2d 100644 --- a/scene/gui/spin_box.cpp +++ b/scene/gui/spin_box.cpp @@ -100,6 +100,8 @@ void SpinBox::_release_mouse() { } void SpinBox::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (!is_editable()) { return; } diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp index c80120f87d..13ff2c5b86 100644 --- a/scene/gui/split_container.cpp +++ b/scene/gui/split_container.cpp @@ -207,6 +207,8 @@ void SplitContainer::_notification(int p_what) { } void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (collapsed || !_getch(0) || !_getch(1) || dragger_visibility != DRAGGER_VISIBLE) { return; } diff --git a/scene/gui/subviewport_container.cpp b/scene/gui/subviewport_container.cpp index 8ffdd269a4..bfc7e29f9c 100644 --- a/scene/gui/subviewport_container.cpp +++ b/scene/gui/subviewport_container.cpp @@ -140,6 +140,8 @@ void SubViewportContainer::_notification(int p_what) { } void SubViewportContainer::_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (Engine::get_singleton()->is_editor_hint()) { return; } @@ -165,6 +167,8 @@ void SubViewportContainer::_input(const Ref<InputEvent> &p_event) { } void SubViewportContainer::_unhandled_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + if (Engine::get_singleton()->is_editor_hint()) { return; } diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 1e31f9e206..ff9dafa0f9 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -72,6 +72,8 @@ int TabContainer::_get_top_margin() const { } void TabContainer::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseButton> mb = p_event; Popup *popup = get_popup(); diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index 38a5588b7e..6cbc5890ce 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -91,6 +91,8 @@ Size2 Tabs::get_minimum_size() const { } void Tabs::_gui_input(const Ref<InputEvent> &p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventMouseMotion> mm = p_event; if (mm.is_valid()) { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 74c530f1b0..f54ab004c6 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2854,6 +2854,8 @@ void TextEdit::_get_minimap_mouse_row(const Point2i &p_mouse, int &r_row) const } void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { + ERR_FAIL_COND(p_gui_input.is_null()); + double prev_v_scroll = v_scroll->get_value(); double prev_h_scroll = h_scroll->get_value(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index abfea241f3..73fd9dbcd7 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2402,6 +2402,8 @@ void Tree::_go_down() { } void Tree::_gui_input(Ref<InputEvent> p_event) { + ERR_FAIL_COND(p_event.is_null()); + Ref<InputEventKey> k = p_event; bool is_command = k.is_valid() && k->get_command(); diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index e4ed5c6e6c..64df37654b 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -454,7 +454,7 @@ void HTTPRequest::_request_done(int p_status, int p_code, const PackedStringArra is_compressed = false; } - const PackedByteArray *data = NULL; + const PackedByteArray *data = nullptr; if (accept_gzip && is_compressed && p_data.size() > 0) { // Decompress request body diff --git a/scene/main/node.cpp b/scene/main/node.cpp index b406d800dc..27712242d1 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1968,8 +1968,9 @@ Node *Node::get_deepest_editable_node(Node *p_start_node) const { Node *node = p_start_node; while (iterated_item->get_owner() && iterated_item->get_owner() != this) { - if (!is_editable_instance(iterated_item->get_owner())) + if (!is_editable_instance(iterated_item->get_owner())) { node = iterated_item->get_owner(); + } iterated_item = iterated_item->get_owner(); } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 5df35d1e6a..a3effef99a 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2399,29 +2399,27 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { if (from && p_event->is_pressed()) { Control *next = nullptr; - Input *input = Input::get_singleton(); - - if (p_event->is_action_pressed("ui_focus_next") && input->is_action_just_pressed("ui_focus_next")) { + if (p_event->is_action_pressed("ui_focus_next", true)) { next = from->find_next_valid_focus(); } - if (p_event->is_action_pressed("ui_focus_prev") && input->is_action_just_pressed("ui_focus_prev")) { + if (p_event->is_action_pressed("ui_focus_prev", true)) { next = from->find_prev_valid_focus(); } - if (!mods && p_event->is_action_pressed("ui_up") && input->is_action_just_pressed("ui_up")) { + if (!mods && p_event->is_action_pressed("ui_up", true)) { next = from->_get_focus_neighbor(SIDE_TOP); } - if (!mods && p_event->is_action_pressed("ui_left") && input->is_action_just_pressed("ui_left")) { + if (!mods && p_event->is_action_pressed("ui_left", true)) { next = from->_get_focus_neighbor(SIDE_LEFT); } - if (!mods && p_event->is_action_pressed("ui_right") && input->is_action_just_pressed("ui_right")) { + if (!mods && p_event->is_action_pressed("ui_right", true)) { next = from->_get_focus_neighbor(SIDE_RIGHT); } - if (!mods && p_event->is_action_pressed("ui_down") && input->is_action_just_pressed("ui_down")) { + if (!mods && p_event->is_action_pressed("ui_down", true)) { next = from->_get_focus_neighbor(SIDE_BOTTOM); } @@ -3067,6 +3065,7 @@ void Viewport::input(const Ref<InputEvent> &p_event, bool p_local_coords) { } void Viewport::unhandled_input(const Ref<InputEvent> &p_event, bool p_local_coords) { + ERR_FAIL_COND(p_event.is_null()); ERR_FAIL_COND(!is_inside_tree()); if (disable_input || !_can_consume_input_events()) { @@ -3227,8 +3226,9 @@ Viewport::ScreenSpaceAA Viewport::get_screen_space_aa() const { } void Viewport::set_use_debanding(bool p_use_debanding) { - if (use_debanding == p_use_debanding) + if (use_debanding == p_use_debanding) { return; + } use_debanding = p_use_debanding; RS::get_singleton()->viewport_set_use_debanding(viewport, p_use_debanding); } diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index 93964db8da..232ad278dd 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -532,6 +532,7 @@ void register_scene_types() { ClassDB::register_virtual_class<VisualShaderNodeResizableBase>(); ClassDB::register_virtual_class<VisualShaderNodeGroupBase>(); ClassDB::register_virtual_class<VisualShaderNodeConstant>(); + ClassDB::register_class<VisualShaderNodeComment>(); ClassDB::register_class<VisualShaderNodeFloatConstant>(); ClassDB::register_class<VisualShaderNodeIntConstant>(); ClassDB::register_class<VisualShaderNodeBooleanConstant>(); diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 0d02bde90d..5647856736 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -829,16 +829,26 @@ void BaseMaterial3D::_update_shader() { } if (flags[FLAG_UV1_USE_TRIPLANAR]) { - code += "\tuv1_power_normal=pow(abs(NORMAL),vec3(uv1_blend_sharpness));\n"; + if (flags[FLAG_UV1_USE_WORLD_TRIPLANAR]) { + code += "\tuv1_power_normal=pow(abs(mat3(WORLD_MATRIX) * NORMAL),vec3(uv1_blend_sharpness));\n"; + code += "\tuv1_triplanar_pos = (WORLD_MATRIX * vec4(VERTEX, 1.0f)).xyz * uv1_scale + uv1_offset;\n"; + } else { + code += "\tuv1_power_normal=pow(abs(NORMAL),vec3(uv1_blend_sharpness));\n"; + code += "\tuv1_triplanar_pos = VERTEX * uv1_scale + uv1_offset;\n"; + } code += "\tuv1_power_normal/=dot(uv1_power_normal,vec3(1.0));\n"; - code += "\tuv1_triplanar_pos = VERTEX * uv1_scale + uv1_offset;\n"; code += "\tuv1_triplanar_pos *= vec3(1.0,-1.0, 1.0);\n"; } if (flags[FLAG_UV2_USE_TRIPLANAR]) { - code += "\tuv2_power_normal=pow(abs(NORMAL), vec3(uv2_blend_sharpness));\n"; + if (flags[FLAG_UV2_USE_WORLD_TRIPLANAR]) { + code += "\tuv2_power_normal=pow(abs(mat3(WORLD_MATRIX) * NORMAL), vec3(uv2_blend_sharpness));\n"; + code += "\tuv2_triplanar_pos = (WORLD_MATRIX * vec4(VERTEX, 1.0f)).xyz * uv2_scale + uv2_offset;\n"; + } else { + code += "\tuv2_power_normal=pow(abs(NORMAL), vec3(uv2_blend_sharpness));\n"; + code += "\tuv2_triplanar_pos = VERTEX * uv2_scale + uv2_offset;\n"; + } code += "\tuv2_power_normal/=dot(uv2_power_normal,vec3(1.0));\n"; - code += "\tuv2_triplanar_pos = VERTEX * uv2_scale + uv2_offset;\n"; code += "\tuv2_triplanar_pos *= vec3(1.0,-1.0, 1.0);\n"; } diff --git a/scene/resources/text_paragraph.cpp b/scene/resources/text_paragraph.cpp index 012d36cc35..341f5abd80 100644 --- a/scene/resources/text_paragraph.cpp +++ b/scene/resources/text_paragraph.cpp @@ -620,11 +620,13 @@ int TextParagraph::hit_test(const Point2 &p_coords) const { const_cast<TextParagraph *>(this)->_shape_lines(); Vector2 ofs; if (TS->shaped_text_get_orientation(rid) == TextServer::ORIENTATION_HORIZONTAL) { - if (ofs.y < 0) + if (ofs.y < 0) { return 0; + } } else { - if (ofs.x < 0) + if (ofs.x < 0) { return 0; + } } for (int i = 0; i < lines.size(); i++) { if (TS->shaped_text_get_orientation(lines[i]) == TextServer::ORIENTATION_HORIZONTAL) { diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 859546694f..e1e24ddab2 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -2667,6 +2667,70 @@ VisualShaderNodeResizableBase::VisualShaderNodeResizableBase() { set_allow_v_resize(true); } +////////////// Comment + +String VisualShaderNodeComment::get_caption() const { + return title; +} + +int VisualShaderNodeComment::get_input_port_count() const { + return 0; +} + +VisualShaderNodeComment::PortType VisualShaderNodeComment::get_input_port_type(int p_port) const { + return PortType::PORT_TYPE_SCALAR; +} + +String VisualShaderNodeComment::get_input_port_name(int p_port) const { + return String(); +} + +int VisualShaderNodeComment::get_output_port_count() const { + return 0; +} + +VisualShaderNodeComment::PortType VisualShaderNodeComment::get_output_port_type(int p_port) const { + return PortType::PORT_TYPE_SCALAR; +} + +String VisualShaderNodeComment::get_output_port_name(int p_port) const { + return String(); +} + +void VisualShaderNodeComment::set_title(const String &p_title) { + title = p_title; +} + +String VisualShaderNodeComment::get_title() const { + return title; +} + +void VisualShaderNodeComment::set_description(const String &p_description) { + description = p_description; +} + +String VisualShaderNodeComment::get_description() const { + return description; +} + +String VisualShaderNodeComment::generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview) const { + return String(); +} + +void VisualShaderNodeComment::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_title", "title"), &VisualShaderNodeComment::set_title); + ClassDB::bind_method(D_METHOD("get_title"), &VisualShaderNodeComment::get_title); + + ClassDB::bind_method(D_METHOD("set_description", "description"), &VisualShaderNodeComment::set_description); + ClassDB::bind_method(D_METHOD("get_description"), &VisualShaderNodeComment::get_description); + + ADD_PROPERTY(PropertyInfo(Variant::STRING, "title"), "set_title", "get_title"); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "description"), "set_description", "get_description"); +} + +VisualShaderNodeComment::VisualShaderNodeComment() { +} + ////////////// GroupBase void VisualShaderNodeGroupBase::set_inputs(const String &p_inputs) { diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index ef724c7650..54a5c19049 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -421,6 +421,7 @@ public: bool is_global_code_generated() const; virtual bool is_qualifier_supported(Qualifier p_qual) const = 0; + virtual bool is_convertible_to_constant() const = 0; virtual Vector<StringName> get_editable_properties() const override; virtual String get_warning(Shader::Mode p_mode, VisualShader::Type p_type) const override; @@ -510,6 +511,38 @@ public: VisualShaderNodeResizableBase(); }; +class VisualShaderNodeComment : public VisualShaderNodeResizableBase { + GDCLASS(VisualShaderNodeComment, VisualShaderNodeResizableBase); + +protected: + String title = "Comment"; + String description = ""; + +protected: + static void _bind_methods(); + +public: + virtual String get_caption() const override; + + virtual int get_input_port_count() const override; + virtual PortType get_input_port_type(int p_port) const override; + virtual String get_input_port_name(int p_port) const override; + + virtual int get_output_port_count() const override; + virtual PortType get_output_port_type(int p_port) const override; + virtual String get_output_port_name(int p_port) const override; + + virtual String generate_code(Shader::Mode p_mode, VisualShader::Type p_type, int p_id, const String *p_input_vars, const String *p_output_vars, bool p_for_preview = false) const override; + + void set_title(const String &p_title); + String get_title() const; + + void set_description(const String &p_description); + String get_description() const; + + VisualShaderNodeComment(); +}; + class VisualShaderNodeGroupBase : public VisualShaderNodeResizableBase { GDCLASS(VisualShaderNodeGroupBase, VisualShaderNodeResizableBase); diff --git a/scene/resources/visual_shader_nodes.cpp b/scene/resources/visual_shader_nodes.cpp index a99c09e89c..7943b95177 100644 --- a/scene/resources/visual_shader_nodes.cpp +++ b/scene/resources/visual_shader_nodes.cpp @@ -3744,6 +3744,10 @@ bool VisualShaderNodeFloatUniform::is_qualifier_supported(Qualifier p_qual) cons return true; // all qualifiers are supported } +bool VisualShaderNodeFloatUniform::is_convertible_to_constant() const { + return true; // conversion is allowed +} + Vector<StringName> VisualShaderNodeFloatUniform::get_editable_properties() const { Vector<StringName> props = VisualShaderNodeUniform::get_editable_properties(); props.push_back("hint"); @@ -3911,6 +3915,10 @@ bool VisualShaderNodeIntUniform::is_qualifier_supported(Qualifier p_qual) const return true; // all qualifiers are supported } +bool VisualShaderNodeIntUniform::is_convertible_to_constant() const { + return true; // conversion is allowed +} + Vector<StringName> VisualShaderNodeIntUniform::get_editable_properties() const { Vector<StringName> props = VisualShaderNodeUniform::get_editable_properties(); props.push_back("hint"); @@ -4019,6 +4027,10 @@ bool VisualShaderNodeBooleanUniform::is_qualifier_supported(Qualifier p_qual) co return true; // all qualifiers are supported } +bool VisualShaderNodeBooleanUniform::is_convertible_to_constant() const { + return true; // conversion is allowed +} + Vector<StringName> VisualShaderNodeBooleanUniform::get_editable_properties() const { Vector<StringName> props = VisualShaderNodeUniform::get_editable_properties(); props.push_back("default_value_enabled"); @@ -4113,6 +4125,10 @@ bool VisualShaderNodeColorUniform::is_qualifier_supported(Qualifier p_qual) cons return true; // all qualifiers are supported } +bool VisualShaderNodeColorUniform::is_convertible_to_constant() const { + return true; // conversion is allowed +} + Vector<StringName> VisualShaderNodeColorUniform::get_editable_properties() const { Vector<StringName> props = VisualShaderNodeUniform::get_editable_properties(); props.push_back("default_value_enabled"); @@ -4209,6 +4225,10 @@ bool VisualShaderNodeVec3Uniform::is_qualifier_supported(Qualifier p_qual) const return true; // all qualifiers are supported } +bool VisualShaderNodeVec3Uniform::is_convertible_to_constant() const { + return true; // conversion is allowed +} + Vector<StringName> VisualShaderNodeVec3Uniform::get_editable_properties() const { Vector<StringName> props = VisualShaderNodeUniform::get_editable_properties(); props.push_back("default_value_enabled"); @@ -4309,6 +4329,10 @@ bool VisualShaderNodeTransformUniform::is_qualifier_supported(Qualifier p_qual) return true; // all qualifiers are supported } +bool VisualShaderNodeTransformUniform::is_convertible_to_constant() const { + return true; // conversion is allowed +} + Vector<StringName> VisualShaderNodeTransformUniform::get_editable_properties() const { Vector<StringName> props = VisualShaderNodeUniform::get_editable_properties(); props.push_back("default_value_enabled"); @@ -4494,6 +4518,10 @@ bool VisualShaderNodeTextureUniform::is_qualifier_supported(Qualifier p_qual) co return false; } +bool VisualShaderNodeTextureUniform::is_convertible_to_constant() const { + return false; // conversion is not allowed +} + VisualShaderNodeTextureUniform::VisualShaderNodeTextureUniform() { simple_decl = false; } @@ -4632,16 +4660,18 @@ String VisualShaderNodeTexture2DArrayUniform::generate_global(Shader::Mode p_mod switch (texture_type) { case TYPE_DATA: - if (color_default == COLOR_DEFAULT_BLACK) + if (color_default == COLOR_DEFAULT_BLACK) { code += " : hint_black;\n"; - else + } else { code += ";\n"; + } break; case TYPE_COLOR: - if (color_default == COLOR_DEFAULT_BLACK) + if (color_default == COLOR_DEFAULT_BLACK) { code += " : hint_black_albedo;\n"; - else + } else { code += " : hint_albedo;\n"; + } break; case TYPE_NORMAL_MAP: code += " : hint_normal;\n"; @@ -4700,16 +4730,18 @@ String VisualShaderNodeTexture3DUniform::generate_global(Shader::Mode p_mode, Vi switch (texture_type) { case TYPE_DATA: - if (color_default == COLOR_DEFAULT_BLACK) + if (color_default == COLOR_DEFAULT_BLACK) { code += " : hint_black;\n"; - else + } else { code += ";\n"; + } break; case TYPE_COLOR: - if (color_default == COLOR_DEFAULT_BLACK) + if (color_default == COLOR_DEFAULT_BLACK) { code += " : hint_black_albedo;\n"; - else + } else { code += " : hint_albedo;\n"; + } break; case TYPE_NORMAL_MAP: code += " : hint_normal;\n"; diff --git a/scene/resources/visual_shader_nodes.h b/scene/resources/visual_shader_nodes.h index a5d0fe4649..594a494cf1 100644 --- a/scene/resources/visual_shader_nodes.h +++ b/scene/resources/visual_shader_nodes.h @@ -1574,6 +1574,7 @@ public: float get_default_value() const; bool is_qualifier_supported(Qualifier p_qual) const override; + bool is_convertible_to_constant() const override; virtual Vector<StringName> get_editable_properties() const override; @@ -1639,6 +1640,7 @@ public: int get_default_value() const; bool is_qualifier_supported(Qualifier p_qual) const override; + bool is_convertible_to_constant() const override; virtual Vector<StringName> get_editable_properties() const override; @@ -1683,6 +1685,7 @@ public: bool get_default_value() const; bool is_qualifier_supported(Qualifier p_qual) const override; + bool is_convertible_to_constant() const override; virtual Vector<StringName> get_editable_properties() const override; @@ -1724,6 +1727,7 @@ public: Color get_default_value() const; bool is_qualifier_supported(Qualifier p_qual) const override; + bool is_convertible_to_constant() const override; virtual Vector<StringName> get_editable_properties() const override; @@ -1766,6 +1770,7 @@ public: Vector3 get_default_value() const; bool is_qualifier_supported(Qualifier p_qual) const override; + bool is_convertible_to_constant() const override; virtual Vector<StringName> get_editable_properties() const override; @@ -1808,6 +1813,7 @@ public: Transform get_default_value() const; bool is_qualifier_supported(Qualifier p_qual) const override; + bool is_convertible_to_constant() const override; virtual Vector<StringName> get_editable_properties() const override; @@ -1865,6 +1871,7 @@ public: ColorDefault get_color_default() const; bool is_qualifier_supported(Qualifier p_qual) const override; + bool is_convertible_to_constant() const override; VisualShaderNodeTextureUniform(); }; diff --git a/servers/physics_2d/shape_2d_sw.cpp b/servers/physics_2d/shape_2d_sw.cpp index 6e7e802a8b..6cc086b9b7 100644 --- a/servers/physics_2d/shape_2d_sw.cpp +++ b/servers/physics_2d/shape_2d_sw.cpp @@ -502,6 +502,7 @@ Variant CapsuleShape2DSW::get_data() const { void ConvexPolygonShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_supports, int &r_amount) const { int support_idx = -1; real_t d = -1e10; + r_amount = 0; for (int i = 0; i < point_count; i++) { //test point @@ -520,7 +521,7 @@ void ConvexPolygonShape2DSW::get_supports(const Vector2 &p_normal, Vector2 *r_su } } - ERR_FAIL_COND(support_idx == -1); + ERR_FAIL_COND_MSG(support_idx == -1, "Convex polygon shape support not found."); r_amount = 1; r_supports[0] = points[support_idx].pos; @@ -580,6 +581,7 @@ bool ConvexPolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Vec } real_t ConvexPolygonShape2DSW::get_moment_of_inertia(real_t p_mass, const Size2 &p_scale) const { + ERR_FAIL_COND_V_MSG(point_count == 0, 0, "Convex polygon shape has no points."); Rect2 aabb; aabb.position = points[0].pos * p_scale; for (int i = 0; i < point_count; i++) { @@ -691,6 +693,10 @@ bool ConcavePolygonShape2DSW::contains_point(const Vector2 &p_point) const { } bool ConcavePolygonShape2DSW::intersect_segment(const Vector2 &p_begin, const Vector2 &p_end, Vector2 &r_point, Vector2 &r_normal) const { + if (segments.size() == 0 || points.size() == 0) { + return false; + } + uint32_t *stack = (uint32_t *)alloca(sizeof(int) * bvh_depth); enum { diff --git a/servers/physics_3d/shape_3d_sw.cpp b/servers/physics_3d/shape_3d_sw.cpp index bf0946a0e2..4c14cb3162 100644 --- a/servers/physics_3d/shape_3d_sw.cpp +++ b/servers/physics_3d/shape_3d_sw.cpp @@ -891,6 +891,9 @@ void ConvexPolygonShape3DSW::get_supports(const Vector3 &p_normal, int p_max, Ve const Vector3 *vertices = mesh.vertices.ptr(); int vc = mesh.vertices.size(); + r_amount = 0; + ERR_FAIL_COND_MSG(vc == 0, "Convex polygon shape has no vertices."); + //find vertex first real_t max = 0; int vtx = 0; diff --git a/servers/physics_3d/step_3d_sw.cpp b/servers/physics_3d/step_3d_sw.cpp index 9a73e11562..2133a38670 100644 --- a/servers/physics_3d/step_3d_sw.cpp +++ b/servers/physics_3d/step_3d_sw.cpp @@ -229,10 +229,11 @@ void Step3DSW::step(Space3DSW *p_space, real_t p_delta, int p_iterations) { while (sb) { for (const Set<Constraint3DSW *>::Element *E = sb->self()->get_constraints().front(); E; E = E->next()) { Constraint3DSW *c = E->get(); - if (c->get_island_step() == _step) + if (c->get_island_step() == _step) { continue; + } c->set_island_step(_step); - c->set_island_next(NULL); + c->set_island_next(nullptr); c->set_island_list_next(constraint_island_list); constraint_island_list = c; } diff --git a/servers/rendering/renderer_rd/SCsub b/servers/rendering/renderer_rd/SCsub index 6a2e682c67..9c95f538ac 100644 --- a/servers/rendering/renderer_rd/SCsub +++ b/servers/rendering/renderer_rd/SCsub @@ -4,4 +4,5 @@ Import("env") env.add_source_files(env.servers_sources, "*.cpp") +SConscript("forward_clustered/SCsub") SConscript("shaders/SCsub") diff --git a/servers/rendering/renderer_rd/forward_clustered/SCsub b/servers/rendering/renderer_rd/forward_clustered/SCsub new file mode 100644 index 0000000000..86681f9c74 --- /dev/null +++ b/servers/rendering/renderer_rd/forward_clustered/SCsub @@ -0,0 +1,5 @@ +#!/usr/bin/env python + +Import("env") + +env.add_source_files(env.servers_sources, "*.cpp") diff --git a/servers/rendering/renderer_rd/renderer_scene_render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp index 7a19495f48..bcdefea567 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* renderer_scene_render_forward_clustered.cpp */ +/* render_forward_clustered.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,508 +28,18 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "renderer_scene_render_forward_clustered.h" +#include "render_forward_clustered.h" #include "core/config/project_settings.h" #include "servers/rendering/rendering_device.h" #include "servers/rendering/rendering_server_default.h" -/* SCENE SHADER */ -void RendererSceneRenderForwardClustered::ShaderData::set_code(const String &p_code) { - //compile +using namespace RendererSceneRenderImplementation; - code = p_code; - valid = false; - ubo_size = 0; - uniforms.clear(); - uses_screen_texture = false; - - if (code == String()) { - return; //just invalid, but no error - } - - ShaderCompilerRD::GeneratedCode gen_code; - - int blend_mode = BLEND_MODE_MIX; - int depth_testi = DEPTH_TEST_ENABLED; - int alpha_antialiasing_mode = ALPHA_ANTIALIASING_OFF; - int cull = CULL_BACK; - - uses_point_size = false; - uses_alpha = false; - uses_blend_alpha = false; - uses_depth_pre_pass = false; - uses_discard = false; - uses_roughness = false; - uses_normal = false; - bool wireframe = false; - - unshaded = false; - uses_vertex = false; - uses_sss = false; - uses_transmittance = false; - uses_screen_texture = false; - uses_depth_texture = false; - uses_normal_texture = false; - uses_time = false; - writes_modelview_or_projection = false; - uses_world_coordinates = false; - - int depth_drawi = DEPTH_DRAW_OPAQUE; - - ShaderCompilerRD::IdentifierActions actions; - - actions.render_mode_values["blend_add"] = Pair<int *, int>(&blend_mode, BLEND_MODE_ADD); - actions.render_mode_values["blend_mix"] = Pair<int *, int>(&blend_mode, BLEND_MODE_MIX); - actions.render_mode_values["blend_sub"] = Pair<int *, int>(&blend_mode, BLEND_MODE_SUB); - actions.render_mode_values["blend_mul"] = Pair<int *, int>(&blend_mode, BLEND_MODE_MUL); - - actions.render_mode_values["alpha_to_coverage"] = Pair<int *, int>(&alpha_antialiasing_mode, ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE); - actions.render_mode_values["alpha_to_coverage_and_one"] = Pair<int *, int>(&alpha_antialiasing_mode, ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE); - - actions.render_mode_values["depth_draw_never"] = Pair<int *, int>(&depth_drawi, DEPTH_DRAW_DISABLED); - actions.render_mode_values["depth_draw_opaque"] = Pair<int *, int>(&depth_drawi, DEPTH_DRAW_OPAQUE); - actions.render_mode_values["depth_draw_always"] = Pair<int *, int>(&depth_drawi, DEPTH_DRAW_ALWAYS); - - actions.render_mode_values["depth_test_disabled"] = Pair<int *, int>(&depth_testi, DEPTH_TEST_DISABLED); - - actions.render_mode_values["cull_disabled"] = Pair<int *, int>(&cull, CULL_DISABLED); - actions.render_mode_values["cull_front"] = Pair<int *, int>(&cull, CULL_FRONT); - actions.render_mode_values["cull_back"] = Pair<int *, int>(&cull, CULL_BACK); - - actions.render_mode_flags["unshaded"] = &unshaded; - actions.render_mode_flags["wireframe"] = &wireframe; - - actions.usage_flag_pointers["ALPHA"] = &uses_alpha; - actions.render_mode_flags["depth_prepass_alpha"] = &uses_depth_pre_pass; - - actions.usage_flag_pointers["SSS_STRENGTH"] = &uses_sss; - actions.usage_flag_pointers["SSS_TRANSMITTANCE_DEPTH"] = &uses_transmittance; - - actions.usage_flag_pointers["SCREEN_TEXTURE"] = &uses_screen_texture; - actions.usage_flag_pointers["DEPTH_TEXTURE"] = &uses_depth_texture; - actions.usage_flag_pointers["NORMAL_TEXTURE"] = &uses_normal_texture; - actions.usage_flag_pointers["DISCARD"] = &uses_discard; - actions.usage_flag_pointers["TIME"] = &uses_time; - actions.usage_flag_pointers["ROUGHNESS"] = &uses_roughness; - actions.usage_flag_pointers["NORMAL"] = &uses_normal; - actions.usage_flag_pointers["NORMAL_MAP"] = &uses_normal; - - actions.usage_flag_pointers["POINT_SIZE"] = &uses_point_size; - actions.usage_flag_pointers["POINT_COORD"] = &uses_point_size; - - actions.write_flag_pointers["MODELVIEW_MATRIX"] = &writes_modelview_or_projection; - actions.write_flag_pointers["PROJECTION_MATRIX"] = &writes_modelview_or_projection; - actions.write_flag_pointers["VERTEX"] = &uses_vertex; - - actions.uniforms = &uniforms; - - RendererSceneRenderForwardClustered *scene_singleton = (RendererSceneRenderForwardClustered *)RendererSceneRenderForwardClustered::singleton; - - Error err = scene_singleton->shader.compiler.compile(RS::SHADER_SPATIAL, code, &actions, path, gen_code); - - ERR_FAIL_COND(err != OK); - - if (version.is_null()) { - version = scene_singleton->shader.scene_shader.version_create(); - } - - depth_draw = DepthDraw(depth_drawi); - depth_test = DepthTest(depth_testi); - -#if 0 - print_line("**compiling shader:"); - print_line("**defines:\n"); - for (int i = 0; i < gen_code.defines.size(); i++) { - print_line(gen_code.defines[i]); - } - print_line("\n**uniforms:\n" + gen_code.uniforms); - print_line("\n**vertex_globals:\n" + gen_code.vertex_global); - print_line("\n**vertex_code:\n" + gen_code.vertex); - print_line("\n**fragment_globals:\n" + gen_code.fragment_global); - print_line("\n**fragment_code:\n" + gen_code.fragment); - print_line("\n**light_code:\n" + gen_code.light); -#endif - scene_singleton->shader.scene_shader.version_set_code(version, gen_code.uniforms, gen_code.vertex_global, gen_code.vertex, gen_code.fragment_global, gen_code.light, gen_code.fragment, gen_code.defines); - ERR_FAIL_COND(!scene_singleton->shader.scene_shader.version_is_valid(version)); - - ubo_size = gen_code.uniform_total_size; - ubo_offsets = gen_code.uniform_offsets; - texture_uniforms = gen_code.texture_uniforms; - - //blend modes - - // if any form of Alpha Antialiasing is enabled, set the blend mode to alpha to coverage - if (alpha_antialiasing_mode != ALPHA_ANTIALIASING_OFF) { - blend_mode = BLEND_MODE_ALPHA_TO_COVERAGE; - } - - RD::PipelineColorBlendState::Attachment blend_attachment; - - switch (blend_mode) { - case BLEND_MODE_MIX: { - blend_attachment.enable_blend = true; - blend_attachment.alpha_blend_op = RD::BLEND_OP_ADD; - blend_attachment.color_blend_op = RD::BLEND_OP_ADD; - blend_attachment.src_color_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; - blend_attachment.dst_color_blend_factor = RD::BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; - blend_attachment.src_alpha_blend_factor = RD::BLEND_FACTOR_ONE; - blend_attachment.dst_alpha_blend_factor = RD::BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; - - } break; - case BLEND_MODE_ADD: { - blend_attachment.enable_blend = true; - blend_attachment.alpha_blend_op = RD::BLEND_OP_ADD; - blend_attachment.color_blend_op = RD::BLEND_OP_ADD; - blend_attachment.src_color_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; - blend_attachment.dst_color_blend_factor = RD::BLEND_FACTOR_ONE; - blend_attachment.src_alpha_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; - blend_attachment.dst_alpha_blend_factor = RD::BLEND_FACTOR_ONE; - uses_blend_alpha = true; //force alpha used because of blend - - } break; - case BLEND_MODE_SUB: { - blend_attachment.enable_blend = true; - blend_attachment.alpha_blend_op = RD::BLEND_OP_SUBTRACT; - blend_attachment.color_blend_op = RD::BLEND_OP_SUBTRACT; - blend_attachment.src_color_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; - blend_attachment.dst_color_blend_factor = RD::BLEND_FACTOR_ONE; - blend_attachment.src_alpha_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; - blend_attachment.dst_alpha_blend_factor = RD::BLEND_FACTOR_ONE; - uses_blend_alpha = true; //force alpha used because of blend - - } break; - case BLEND_MODE_MUL: { - blend_attachment.enable_blend = true; - blend_attachment.alpha_blend_op = RD::BLEND_OP_ADD; - blend_attachment.color_blend_op = RD::BLEND_OP_ADD; - blend_attachment.src_color_blend_factor = RD::BLEND_FACTOR_DST_COLOR; - blend_attachment.dst_color_blend_factor = RD::BLEND_FACTOR_ZERO; - blend_attachment.src_alpha_blend_factor = RD::BLEND_FACTOR_DST_ALPHA; - blend_attachment.dst_alpha_blend_factor = RD::BLEND_FACTOR_ZERO; - uses_blend_alpha = true; //force alpha used because of blend - } break; - case BLEND_MODE_ALPHA_TO_COVERAGE: { - blend_attachment.enable_blend = true; - blend_attachment.alpha_blend_op = RD::BLEND_OP_ADD; - blend_attachment.color_blend_op = RD::BLEND_OP_ADD; - blend_attachment.src_color_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; - blend_attachment.dst_color_blend_factor = RD::BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; - blend_attachment.src_alpha_blend_factor = RD::BLEND_FACTOR_ONE; - blend_attachment.dst_alpha_blend_factor = RD::BLEND_FACTOR_ZERO; - } - } - - RD::PipelineColorBlendState blend_state_blend; - blend_state_blend.attachments.push_back(blend_attachment); - RD::PipelineColorBlendState blend_state_opaque = RD::PipelineColorBlendState::create_disabled(1); - RD::PipelineColorBlendState blend_state_opaque_specular = RD::PipelineColorBlendState::create_disabled(2); - RD::PipelineColorBlendState blend_state_depth_normal_roughness = RD::PipelineColorBlendState::create_disabled(1); - RD::PipelineColorBlendState blend_state_depth_normal_roughness_giprobe = RD::PipelineColorBlendState::create_disabled(2); - - //update pipelines - - RD::PipelineDepthStencilState depth_stencil_state; - - if (depth_test != DEPTH_TEST_DISABLED) { - depth_stencil_state.enable_depth_test = true; - depth_stencil_state.depth_compare_operator = RD::COMPARE_OP_LESS_OR_EQUAL; - depth_stencil_state.enable_depth_write = depth_draw != DEPTH_DRAW_DISABLED ? true : false; - } - - for (int i = 0; i < CULL_VARIANT_MAX; i++) { - RD::PolygonCullMode cull_mode_rd_table[CULL_VARIANT_MAX][3] = { - { RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_FRONT, RD::POLYGON_CULL_BACK }, - { RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_BACK, RD::POLYGON_CULL_FRONT }, - { RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_DISABLED } - }; - - RD::PolygonCullMode cull_mode_rd = cull_mode_rd_table[i][cull]; - - for (int j = 0; j < RS::PRIMITIVE_MAX; j++) { - RD::RenderPrimitive primitive_rd_table[RS::PRIMITIVE_MAX] = { - RD::RENDER_PRIMITIVE_POINTS, - RD::RENDER_PRIMITIVE_LINES, - RD::RENDER_PRIMITIVE_LINESTRIPS, - RD::RENDER_PRIMITIVE_TRIANGLES, - RD::RENDER_PRIMITIVE_TRIANGLE_STRIPS, - }; - - RD::RenderPrimitive primitive_rd = uses_point_size ? RD::RENDER_PRIMITIVE_POINTS : primitive_rd_table[j]; - - for (int k = 0; k < SHADER_VERSION_MAX; k++) { - if (!static_cast<RendererSceneRenderForwardClustered *>(singleton)->shader.scene_shader.is_variant_enabled(k)) { - continue; - } - RD::PipelineRasterizationState raster_state; - raster_state.cull_mode = cull_mode_rd; - raster_state.wireframe = wireframe; - - RD::PipelineColorBlendState blend_state; - RD::PipelineDepthStencilState depth_stencil = depth_stencil_state; - RD::PipelineMultisampleState multisample_state; - - if (uses_alpha || uses_blend_alpha) { - // only allow these flags to go through if we have some form of msaa - if (alpha_antialiasing_mode == ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE) { - multisample_state.enable_alpha_to_coverage = true; - } else if (alpha_antialiasing_mode == ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE) { - multisample_state.enable_alpha_to_coverage = true; - multisample_state.enable_alpha_to_one = true; - } - - if (k == SHADER_VERSION_COLOR_PASS || k == SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS) { - blend_state = blend_state_blend; - if (depth_draw == DEPTH_DRAW_OPAQUE) { - depth_stencil.enable_depth_write = false; //alpha does not draw depth - } - } else if (uses_depth_pre_pass && (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP || k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS || k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL)) { - if (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP) { - //none, blend state contains nothing - } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL) { - blend_state = RD::PipelineColorBlendState::create_disabled(5); //writes to normal and roughness in opaque way - } else { - blend_state = blend_state_opaque; //writes to normal and roughness in opaque way - } - } else { - pipelines[i][j][k].clear(); - continue; // do not use this version (will error if using it is attempted) - } - } else { - if (k == SHADER_VERSION_COLOR_PASS || k == SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS) { - blend_state = blend_state_opaque; - } else if (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP) { - //none, leave empty - } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS) { - blend_state = blend_state_depth_normal_roughness; - } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_GIPROBE) { - blend_state = blend_state_depth_normal_roughness_giprobe; - } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL) { - blend_state = RD::PipelineColorBlendState::create_disabled(5); //writes to normal and roughness in opaque way - } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_SDF) { - blend_state = RD::PipelineColorBlendState(); //no color targets for SDF - } else { - //specular write - blend_state = blend_state_opaque_specular; - depth_stencil.enable_depth_test = false; - depth_stencil.enable_depth_write = false; - } - } - - RID shader_variant = scene_singleton->shader.scene_shader.version_get_shader(version, k); - pipelines[i][j][k].setup(shader_variant, primitive_rd, raster_state, multisample_state, depth_stencil, blend_state, 0); - } - } - } - - valid = true; -} - -void RendererSceneRenderForwardClustered::ShaderData::set_default_texture_param(const StringName &p_name, RID p_texture) { - if (!p_texture.is_valid()) { - default_texture_params.erase(p_name); - } else { - default_texture_params[p_name] = p_texture; - } -} - -void RendererSceneRenderForwardClustered::ShaderData::get_param_list(List<PropertyInfo> *p_param_list) const { - Map<int, StringName> order; - - for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = uniforms.front(); E; E = E->next()) { - if (E->get().scope != ShaderLanguage::ShaderNode::Uniform::SCOPE_LOCAL) { - continue; - } - - if (E->get().texture_order >= 0) { - order[E->get().texture_order + 100000] = E->key(); - } else { - order[E->get().order] = E->key(); - } - } - - for (Map<int, StringName>::Element *E = order.front(); E; E = E->next()) { - PropertyInfo pi = ShaderLanguage::uniform_to_property_info(uniforms[E->get()]); - pi.name = E->get(); - p_param_list->push_back(pi); - } -} - -void RendererSceneRenderForwardClustered::ShaderData::get_instance_param_list(List<RendererStorage::InstanceShaderParam> *p_param_list) const { - for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = uniforms.front(); E; E = E->next()) { - if (E->get().scope != ShaderLanguage::ShaderNode::Uniform::SCOPE_INSTANCE) { - continue; - } - - RendererStorage::InstanceShaderParam p; - p.info = ShaderLanguage::uniform_to_property_info(E->get()); - p.info.name = E->key(); //supply name - p.index = E->get().instance_index; - p.default_value = ShaderLanguage::constant_value_to_variant(E->get().default_value, E->get().type, E->get().hint); - p_param_list->push_back(p); - } -} - -bool RendererSceneRenderForwardClustered::ShaderData::is_param_texture(const StringName &p_param) const { - if (!uniforms.has(p_param)) { - return false; - } - - return uniforms[p_param].texture_order >= 0; -} - -bool RendererSceneRenderForwardClustered::ShaderData::is_animated() const { - return false; -} - -bool RendererSceneRenderForwardClustered::ShaderData::casts_shadows() const { - return false; -} - -Variant RendererSceneRenderForwardClustered::ShaderData::get_default_parameter(const StringName &p_parameter) const { - if (uniforms.has(p_parameter)) { - ShaderLanguage::ShaderNode::Uniform uniform = uniforms[p_parameter]; - Vector<ShaderLanguage::ConstantNode::Value> default_value = uniform.default_value; - return ShaderLanguage::constant_value_to_variant(default_value, uniform.type, uniform.hint); - } - return Variant(); -} - -RS::ShaderNativeSourceCode RendererSceneRenderForwardClustered::ShaderData::get_native_source_code() const { - RendererSceneRenderForwardClustered *scene_singleton = (RendererSceneRenderForwardClustered *)RendererSceneRenderForwardClustered::singleton; - - return scene_singleton->shader.scene_shader.version_get_native_source_code(version); -} - -RendererSceneRenderForwardClustered::ShaderData::ShaderData() { - valid = false; - uses_screen_texture = false; -} - -RendererSceneRenderForwardClustered::ShaderData::~ShaderData() { - RendererSceneRenderForwardClustered *scene_singleton = (RendererSceneRenderForwardClustered *)RendererSceneRenderForwardClustered::singleton; - ERR_FAIL_COND(!scene_singleton); - //pipeline variants will clear themselves if shader is gone - if (version.is_valid()) { - scene_singleton->shader.scene_shader.version_free(version); - } -} - -RendererStorageRD::ShaderData *RendererSceneRenderForwardClustered::_create_shader_func() { - ShaderData *shader_data = memnew(ShaderData); - return shader_data; -} - -void RendererSceneRenderForwardClustered::MaterialData::set_render_priority(int p_priority) { - priority = p_priority - RS::MATERIAL_RENDER_PRIORITY_MIN; //8 bits -} - -void RendererSceneRenderForwardClustered::MaterialData::set_next_pass(RID p_pass) { - next_pass = p_pass; -} - -void RendererSceneRenderForwardClustered::MaterialData::update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) { - RendererSceneRenderForwardClustered *scene_singleton = (RendererSceneRenderForwardClustered *)RendererSceneRenderForwardClustered::singleton; - - if ((uint32_t)ubo_data.size() != shader_data->ubo_size) { - p_uniform_dirty = true; - if (uniform_buffer.is_valid()) { - RD::get_singleton()->free(uniform_buffer); - uniform_buffer = RID(); - } - - ubo_data.resize(shader_data->ubo_size); - if (ubo_data.size()) { - uniform_buffer = RD::get_singleton()->uniform_buffer_create(ubo_data.size()); - memset(ubo_data.ptrw(), 0, ubo_data.size()); //clear - } - - //clear previous uniform set - if (uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(uniform_set)) { - RD::get_singleton()->free(uniform_set); - uniform_set = RID(); - } - } - - //check whether buffer changed - if (p_uniform_dirty && ubo_data.size()) { - update_uniform_buffer(shader_data->uniforms, shader_data->ubo_offsets.ptr(), p_parameters, ubo_data.ptrw(), ubo_data.size(), false); - RD::get_singleton()->buffer_update(uniform_buffer, 0, ubo_data.size(), ubo_data.ptrw(), RD::BARRIER_MASK_RASTER); - } - - uint32_t tex_uniform_count = shader_data->texture_uniforms.size(); - - if ((uint32_t)texture_cache.size() != tex_uniform_count) { - texture_cache.resize(tex_uniform_count); - p_textures_dirty = true; - - //clear previous uniform set - if (uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(uniform_set)) { - RD::get_singleton()->free(uniform_set); - uniform_set = RID(); - } - } - - if (p_textures_dirty && tex_uniform_count) { - update_textures(p_parameters, shader_data->default_texture_params, shader_data->texture_uniforms, texture_cache.ptrw(), true); - } - - if (shader_data->ubo_size == 0 && shader_data->texture_uniforms.size() == 0) { - // This material does not require an uniform set, so don't create it. - return; - } - - if (!p_textures_dirty && uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(uniform_set)) { - //no reason to update uniform set, only UBO (or nothing) was needed to update - return; - } - - Vector<RD::Uniform> uniforms; - - { - if (shader_data->ubo_size) { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_UNIFORM_BUFFER; - u.binding = 0; - u.ids.push_back(uniform_buffer); - uniforms.push_back(u); - } - - const RID *textures = texture_cache.ptrw(); - for (uint32_t i = 0; i < tex_uniform_count; i++) { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; - u.binding = 1 + i; - u.ids.push_back(textures[i]); - uniforms.push_back(u); - } - } - - uniform_set = RD::get_singleton()->uniform_set_create(uniforms, scene_singleton->shader.scene_shader.version_get_shader(shader_data->version, 0), MATERIAL_UNIFORM_SET); -} - -RendererSceneRenderForwardClustered::MaterialData::~MaterialData() { - if (uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(uniform_set)) { - RD::get_singleton()->free(uniform_set); - } - - if (uniform_buffer.is_valid()) { - RD::get_singleton()->free(uniform_buffer); - } -} - -RendererStorageRD::MaterialData *RendererSceneRenderForwardClustered::_create_material_func(ShaderData *p_shader) { - MaterialData *material_data = memnew(MaterialData); - material_data->shader_data = p_shader; - material_data->last_frame = false; - //update will happen later anyway so do nothing. - return material_data; -} - -RendererSceneRenderForwardClustered::RenderBufferDataForward::~RenderBufferDataForward() { +RenderForwardClustered::RenderBufferDataForwardClustered::~RenderBufferDataForwardClustered() { clear(); } -void RendererSceneRenderForwardClustered::RenderBufferDataForward::ensure_specular() { +void RenderForwardClustered::RenderBufferDataForwardClustered::ensure_specular() { if (!specular.is_valid()) { RD::TextureFormat tf; tf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT; @@ -583,7 +93,7 @@ void RendererSceneRenderForwardClustered::RenderBufferDataForward::ensure_specul } } -void RendererSceneRenderForwardClustered::RenderBufferDataForward::ensure_giprobe() { +void RenderForwardClustered::RenderBufferDataForwardClustered::ensure_giprobe() { if (!giprobe_buffer.is_valid()) { RD::TextureFormat tf; tf.format = RD::DATA_FORMAT_R8G8_UINT; @@ -619,7 +129,7 @@ void RendererSceneRenderForwardClustered::RenderBufferDataForward::ensure_giprob } } -void RendererSceneRenderForwardClustered::RenderBufferDataForward::clear() { +void RenderForwardClustered::RenderBufferDataForwardClustered::clear() { if (giprobe_buffer != RID()) { RD::get_singleton()->free(giprobe_buffer); giprobe_buffer = RID(); @@ -673,7 +183,7 @@ void RendererSceneRenderForwardClustered::RenderBufferDataForward::clear() { } } -void RendererSceneRenderForwardClustered::RenderBufferDataForward::configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa) { +void RenderForwardClustered::RenderBufferDataForwardClustered::configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa) { clear(); msaa = p_msaa; @@ -740,7 +250,7 @@ void RendererSceneRenderForwardClustered::RenderBufferDataForward::configure(RID } } -void RendererSceneRenderForwardClustered::_allocate_normal_roughness_texture(RenderBufferDataForward *rb) { +void RenderForwardClustered::_allocate_normal_roughness_texture(RenderBufferDataForwardClustered *rb) { if (rb->normal_roughness_buffer.is_valid()) { return; } @@ -778,11 +288,11 @@ void RendererSceneRenderForwardClustered::_allocate_normal_roughness_texture(Ren _render_buffers_clear_uniform_set(rb); } -RendererSceneRenderRD::RenderBufferData *RendererSceneRenderForwardClustered::_create_render_buffer_data() { - return memnew(RenderBufferDataForward); +RendererSceneRenderRD::RenderBufferData *RenderForwardClustered::_create_render_buffer_data() { + return memnew(RenderBufferDataForwardClustered); } -bool RendererSceneRenderForwardClustered::free(RID p_rid) { +bool RenderForwardClustered::free(RID p_rid) { if (RendererSceneRenderRD::free(p_rid)) { return true; } @@ -791,15 +301,15 @@ bool RendererSceneRenderForwardClustered::free(RID p_rid) { /// RENDERING /// -template <RendererSceneRenderForwardClustered::PassMode p_pass_mode> -void RendererSceneRenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element) { +template <RenderForwardClustered::PassMode p_pass_mode> +void RenderForwardClustered::_render_list_template(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element) { RD::DrawListID draw_list = p_draw_list; RD::FramebufferFormatID framebuffer_format = p_framebuffer_Format; //global scope bindings RD::get_singleton()->draw_list_bind_uniform_set(draw_list, render_base_uniform_set, SCENE_UNIFORM_SET); RD::get_singleton()->draw_list_bind_uniform_set(draw_list, p_params->render_pass_uniform_set, RENDER_PASS_UNIFORM_SET); - RD::get_singleton()->draw_list_bind_uniform_set(draw_list, default_vec4_xform_uniform_set, TRANSFORMS_UNIFORM_SET); + RD::get_singleton()->draw_list_bind_uniform_set(draw_list, scene_shader.default_vec4_xform_uniform_set, TRANSFORMS_UNIFORM_SET); RID prev_material_uniform_set; @@ -826,7 +336,7 @@ void RendererSceneRenderForwardClustered::_render_list_template(RenderingDevice: push_constant.base_index = i + p_params->element_offset; RID material_uniform_set; - ShaderData *shader; + SceneShaderForwardClustered::ShaderData *shader; void *mesh_surface; if (shadow_pass || p_params->pass_mode == PASS_MODE_DEPTH) { //regular depth pass can use these too @@ -845,59 +355,59 @@ void RendererSceneRenderForwardClustered::_render_list_template(RenderingDevice: } //find cull variant - ShaderData::CullVariant cull_variant; + SceneShaderForwardClustered::ShaderData::CullVariant cull_variant; if (p_params->pass_mode == PASS_MODE_DEPTH_MATERIAL || p_params->pass_mode == PASS_MODE_SDF || ((p_params->pass_mode == PASS_MODE_SHADOW || p_params->pass_mode == PASS_MODE_SHADOW_DP) && surf->flags & GeometryInstanceSurfaceDataCache::FLAG_USES_DOUBLE_SIDED_SHADOWS)) { - cull_variant = ShaderData::CULL_VARIANT_DOUBLE_SIDED; + cull_variant = SceneShaderForwardClustered::ShaderData::CULL_VARIANT_DOUBLE_SIDED; } else { bool mirror = surf->owner->mirror; if (p_params->reverse_cull) { mirror = !mirror; } - cull_variant = mirror ? ShaderData::CULL_VARIANT_REVERSED : ShaderData::CULL_VARIANT_NORMAL; + cull_variant = mirror ? SceneShaderForwardClustered::ShaderData::CULL_VARIANT_REVERSED : SceneShaderForwardClustered::ShaderData::CULL_VARIANT_NORMAL; } RS::PrimitiveType primitive = surf->primitive; RID xforms_uniform_set = surf->owner->transforms_uniform_set; - ShaderVersion shader_version = SHADER_VERSION_MAX; // Assigned to silence wrong -Wmaybe-initialized. + SceneShaderForwardClustered::ShaderVersion shader_version = SceneShaderForwardClustered::SHADER_VERSION_MAX; // Assigned to silence wrong -Wmaybe-initialized. switch (p_params->pass_mode) { case PASS_MODE_COLOR: case PASS_MODE_COLOR_TRANSPARENT: { if (element_info.uses_lightmap) { - shader_version = SHADER_VERSION_LIGHTMAP_COLOR_PASS; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_LIGHTMAP_COLOR_PASS; } else if (element_info.uses_forward_gi) { - shader_version = SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI; } else { - shader_version = SHADER_VERSION_COLOR_PASS; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_COLOR_PASS; } } break; case PASS_MODE_COLOR_SPECULAR: { if (element_info.uses_lightmap) { - shader_version = SHADER_VERSION_LIGHTMAP_COLOR_PASS_WITH_SEPARATE_SPECULAR; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_LIGHTMAP_COLOR_PASS_WITH_SEPARATE_SPECULAR; } else { - shader_version = SHADER_VERSION_COLOR_PASS_WITH_SEPARATE_SPECULAR; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_COLOR_PASS_WITH_SEPARATE_SPECULAR; } } break; case PASS_MODE_SHADOW: case PASS_MODE_DEPTH: { - shader_version = SHADER_VERSION_DEPTH_PASS; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_DEPTH_PASS; } break; case PASS_MODE_SHADOW_DP: { - shader_version = SHADER_VERSION_DEPTH_PASS_DP; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_DEPTH_PASS_DP; } break; case PASS_MODE_DEPTH_NORMAL_ROUGHNESS: { - shader_version = SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS; } break; case PASS_MODE_DEPTH_NORMAL_ROUGHNESS_GIPROBE: { - shader_version = SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_GIPROBE; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_GIPROBE; } break; case PASS_MODE_DEPTH_MATERIAL: { - shader_version = SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL; } break; case PASS_MODE_SDF: { - shader_version = SHADER_VERSION_DEPTH_PASS_WITH_SDF; + shader_version = SceneShaderForwardClustered::SHADER_VERSION_DEPTH_PASS_WITH_SDF; } break; } @@ -961,7 +471,7 @@ void RendererSceneRenderForwardClustered::_render_list_template(RenderingDevice: } } -void RendererSceneRenderForwardClustered::_render_list(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element) { +void RenderForwardClustered::_render_list(RenderingDevice::DrawListID p_draw_list, RenderingDevice::FramebufferFormatID p_framebuffer_Format, RenderListParameters *p_params, uint32_t p_from_element, uint32_t p_to_element) { //use template for faster performance (pass mode comparisons are inlined) switch (p_params->pass_mode) { @@ -998,7 +508,7 @@ void RendererSceneRenderForwardClustered::_render_list(RenderingDevice::DrawList } } -void RendererSceneRenderForwardClustered::_render_list_thread_function(uint32_t p_thread, RenderListParameters *p_params) { +void RenderForwardClustered::_render_list_thread_function(uint32_t p_thread, RenderListParameters *p_params) { uint32_t render_total = p_params->element_count; uint32_t total_threads = RendererThreadPool::singleton->thread_work_pool.get_thread_count(); uint32_t render_from = p_thread * render_total / total_threads; @@ -1006,7 +516,7 @@ void RendererSceneRenderForwardClustered::_render_list_thread_function(uint32_t _render_list(thread_draw_lists[p_thread], p_params->framebuffer_format, p_params, render_from, render_to); } -void RendererSceneRenderForwardClustered::_render_list_with_threads(RenderListParameters *p_params, RID p_framebuffer, RD::InitialAction p_initial_color_action, RD::FinalAction p_final_color_action, RD::InitialAction p_initial_depth_action, RD::FinalAction p_final_depth_action, const Vector<Color> &p_clear_color_values, float p_clear_depth, uint32_t p_clear_stencil, const Rect2 &p_region, const Vector<RID> &p_storage_textures) { +void RenderForwardClustered::_render_list_with_threads(RenderListParameters *p_params, RID p_framebuffer, RD::InitialAction p_initial_color_action, RD::FinalAction p_final_color_action, RD::InitialAction p_initial_depth_action, RD::FinalAction p_final_depth_action, const Vector<Color> &p_clear_color_values, float p_clear_depth, uint32_t p_clear_stencil, const Rect2 &p_region, const Vector<RID> &p_storage_textures) { RD::FramebufferFormatID fb_format = RD::get_singleton()->framebuffer_get_format(p_framebuffer); p_params->framebuffer_format = fb_format; @@ -1014,7 +524,7 @@ void RendererSceneRenderForwardClustered::_render_list_with_threads(RenderListPa //multi threaded thread_draw_lists.resize(RendererThreadPool::singleton->thread_work_pool.get_thread_count()); RD::get_singleton()->draw_list_begin_split(p_framebuffer, thread_draw_lists.size(), thread_draw_lists.ptr(), p_initial_color_action, p_final_color_action, p_initial_depth_action, p_final_depth_action, p_clear_color_values, p_clear_depth, p_clear_stencil, p_region, p_storage_textures); - RendererThreadPool::singleton->thread_work_pool.do_work(thread_draw_lists.size(), this, &RendererSceneRenderForwardClustered::_render_list_thread_function, p_params); + RendererThreadPool::singleton->thread_work_pool.do_work(thread_draw_lists.size(), this, &RenderForwardClustered::_render_list_thread_function, p_params); RD::get_singleton()->draw_list_end(p_params->barrier); } else { //single threaded @@ -1024,7 +534,7 @@ void RendererSceneRenderForwardClustered::_render_list_with_threads(RenderListPa } } -void RendererSceneRenderForwardClustered::_setup_environment(RID p_environment, RID p_render_buffers, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform, RID p_reflection_probe, bool p_no_fog, const Size2i &p_screen_size, uint32_t p_cluster_size, uint32_t p_max_cluster_elements, RID p_shadow_atlas, bool p_flip_y, const Color &p_default_bg_color, float p_znear, float p_zfar, bool p_opaque_render_buffers, bool p_pancake_shadows, int p_index) { +void RenderForwardClustered::_setup_environment(RID p_environment, RID p_render_buffers, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform, RID p_reflection_probe, bool p_no_fog, const Size2i &p_screen_size, uint32_t p_cluster_size, uint32_t p_max_cluster_elements, RID p_shadow_atlas, bool p_flip_y, const Color &p_default_bg_color, float p_znear, float p_zfar, bool p_opaque_render_buffers, bool p_pancake_shadows, int p_index) { //CameraMatrix projection = p_cam_projection; //projection.flip_y(); // Vulkan and modern APIs use Y-Down CameraMatrix correction; @@ -1083,7 +593,7 @@ void RendererSceneRenderForwardClustered::_setup_environment(RID p_environment, scene_state.ubo.fog_enabled = false; if (p_render_buffers.is_valid()) { - RenderBufferDataForward *render_buffers = (RenderBufferDataForward *)render_buffers_get_data(p_render_buffers); + RenderBufferDataForwardClustered *render_buffers = (RenderBufferDataForwardClustered *)render_buffers_get_data(p_render_buffers); if (render_buffers->msaa != RS::VIEWPORT_MSAA_DISABLED) { scene_state.ubo.gi_upscale_for_msaa = true; } @@ -1274,7 +784,7 @@ void RendererSceneRenderForwardClustered::_setup_environment(RID p_environment, RD::get_singleton()->buffer_update(scene_state.uniform_buffers[p_index], 0, sizeof(SceneState::UBO), &scene_state.ubo, RD::BARRIER_MASK_RASTER); } -void RendererSceneRenderForwardClustered::_update_instance_data_buffer(RenderListType p_render_list) { +void RenderForwardClustered::_update_instance_data_buffer(RenderListType p_render_list) { if (scene_state.instance_data[p_render_list].size() > 0) { if (scene_state.instance_buffer[p_render_list] == RID() || scene_state.instance_buffer_size[p_render_list] < scene_state.instance_data[p_render_list].size()) { if (scene_state.instance_buffer[p_render_list] != RID()) { @@ -1287,7 +797,7 @@ void RendererSceneRenderForwardClustered::_update_instance_data_buffer(RenderLis RD::get_singleton()->buffer_update(scene_state.instance_buffer[p_render_list], 0, sizeof(SceneState::InstanceData) * scene_state.instance_data[p_render_list].size(), scene_state.instance_data[p_render_list].ptr(), RD::BARRIER_MASK_RASTER); } } -void RendererSceneRenderForwardClustered::_fill_instance_data(RenderListType p_render_list, uint32_t p_offset, int32_t p_max_elements, bool p_update_buffer) { +void RenderForwardClustered::_fill_instance_data(RenderListType p_render_list, uint32_t p_offset, int32_t p_max_elements, bool p_update_buffer) { RenderList *rl = &render_list[p_render_list]; uint32_t element_total = p_max_elements >= 0 ? uint32_t(p_max_elements) : rl->elements.size(); @@ -1355,7 +865,7 @@ void RendererSceneRenderForwardClustered::_fill_instance_data(RenderListType p_r } } -void RendererSceneRenderForwardClustered::_fill_render_list(RenderListType p_render_list, const PagedArray<GeometryInstance *> &p_instances, PassMode p_pass_mode, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform, bool p_using_sdfgi, bool p_using_opaque_gi, const Plane &p_lod_plane, float p_lod_distance_multiplier, float p_screen_lod_threshold, bool p_append) { +void RenderForwardClustered::_fill_render_list(RenderListType p_render_list, const PagedArray<GeometryInstance *> &p_instances, PassMode p_pass_mode, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform, bool p_using_sdfgi, bool p_using_opaque_gi, const Plane &p_lod_plane, float p_lod_distance_multiplier, float p_screen_lod_threshold, bool p_append) { if (p_render_list == RENDER_LIST_OPAQUE) { scene_state.used_sss = false; scene_state.used_screen_texture = false; @@ -1431,7 +941,7 @@ void RendererSceneRenderForwardClustered::_fill_render_list(RenderListType p_ren uses_lightmap = true; } - } else if (!low_end) { + } else { if (p_using_opaque_gi) { flags |= INSTANCE_DATA_FLAG_USE_GI_BUFFERS; } @@ -1549,14 +1059,14 @@ void RendererSceneRenderForwardClustered::_fill_render_list(RenderListType p_ren } } -void RendererSceneRenderForwardClustered::_setup_giprobes(const PagedArray<RID> &p_giprobes) { +void RenderForwardClustered::_setup_giprobes(const PagedArray<RID> &p_giprobes) { scene_state.giprobes_used = MIN(p_giprobes.size(), uint32_t(MAX_GI_PROBES)); for (uint32_t i = 0; i < scene_state.giprobes_used; i++) { scene_state.giprobe_ids[i] = p_giprobes[i]; } } -void RendererSceneRenderForwardClustered::_setup_lightmaps(const PagedArray<RID> &p_lightmaps, const Transform &p_cam_transform) { +void RenderForwardClustered::_setup_lightmaps(const PagedArray<RID> &p_lightmaps, const Transform &p_cam_transform) { scene_state.lightmaps_used = 0; for (int i = 0; i < (int)p_lightmaps.size(); i++) { if (i >= (int)scene_state.max_lightmaps) { @@ -1578,10 +1088,10 @@ void RendererSceneRenderForwardClustered::_setup_lightmaps(const PagedArray<RID> } } -void RendererSceneRenderForwardClustered::_render_scene(RID p_render_buffer, const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_gi_probes, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_cluster_buffer, uint32_t p_cluster_size, uint32_t p_max_cluster_elements, RID p_camera_effects, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, const Color &p_default_bg_color, float p_screen_lod_threshold) { - RenderBufferDataForward *render_buffer = nullptr; +void RenderForwardClustered::_render_scene(RID p_render_buffer, const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, const PagedArray<RID> &p_gi_probes, const PagedArray<RID> &p_lightmaps, RID p_environment, RID p_cluster_buffer, uint32_t p_cluster_size, uint32_t p_max_cluster_elements, RID p_camera_effects, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass, const Color &p_default_bg_color, float p_screen_lod_threshold) { + RenderBufferDataForwardClustered *render_buffer = nullptr; if (p_render_buffer.is_valid()) { - render_buffer = (RenderBufferDataForward *)render_buffers_get_data(p_render_buffer); + render_buffer = (RenderBufferDataForwardClustered *)render_buffers_get_data(p_render_buffer); } RendererSceneEnvironmentRD *env = get_environment(p_environment); @@ -1623,7 +1133,7 @@ void RendererSceneRenderForwardClustered::_render_scene(RID p_render_buffer, con opaque_framebuffer = render_buffer->color_fb; - if (!low_end && p_gi_probes.size() > 0) { + if (p_gi_probes.size() > 0) { using_giprobe = true; } @@ -1702,7 +1212,7 @@ void RendererSceneRenderForwardClustered::_render_scene(RID p_render_buffer, con RD::get_singleton()->draw_command_end_label(); - bool using_sss = !low_end && render_buffer && scene_state.used_sss && sub_surface_scattering_get_quality() != RS::SUB_SURFACE_SCATTERING_QUALITY_DISABLED; + bool using_sss = render_buffer && scene_state.used_sss && sub_surface_scattering_get_quality() != RS::SUB_SURFACE_SCATTERING_QUALITY_DISABLED; if (using_sss) { using_separate_specular = true; @@ -1786,7 +1296,7 @@ void RendererSceneRenderForwardClustered::_render_scene(RID p_render_buffer, con bool debug_giprobes = get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_ALBEDO || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_LIGHTING || get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_PROBE_EMISSION; bool debug_sdfgi_probes = get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_SDFGI_PROBES; - bool depth_pre_pass = !low_end && depth_framebuffer.is_valid(); + bool depth_pre_pass = depth_framebuffer.is_valid(); bool using_ssao = depth_pre_pass && p_render_buffer.is_valid() && p_environment.is_valid() && environment_is_ssao_enabled(p_environment); bool continue_depth = false; @@ -1981,7 +1491,7 @@ void RendererSceneRenderForwardClustered::_render_scene(RID p_render_buffer, con RD::get_singleton()->draw_command_end_label(); } -void RendererSceneRenderForwardClustered::_render_shadow_begin() { +void RenderForwardClustered::_render_shadow_begin() { scene_state.shadow_passes.clear(); RD::get_singleton()->draw_command_begin_label("Shadow Setup"); _update_render_base_uniform_set(); @@ -1989,7 +1499,7 @@ void RendererSceneRenderForwardClustered::_render_shadow_begin() { render_list[RENDER_LIST_SECONDARY].clear(); scene_state.instance_data[RENDER_LIST_SECONDARY].clear(); } -void RendererSceneRenderForwardClustered::_render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane, float p_lod_distance_multiplier, float p_screen_lod_threshold, const Rect2i &p_rect, bool p_flip_y, bool p_clear_region, bool p_begin, bool p_end) { +void RenderForwardClustered::_render_shadow_append(RID p_framebuffer, const PagedArray<GeometryInstance *> &p_instances, const CameraMatrix &p_projection, const Transform &p_transform, float p_zfar, float p_bias, float p_normal_bias, bool p_use_dp, bool p_use_dp_flip, bool p_use_pancake, const Plane &p_camera_plane, float p_lod_distance_multiplier, float p_screen_lod_threshold, const Rect2i &p_rect, bool p_flip_y, bool p_clear_region, bool p_begin, bool p_end) { uint32_t shadow_pass_index = scene_state.shadow_passes.size(); SceneState::ShadowPass shadow_pass; @@ -2036,7 +1546,7 @@ void RendererSceneRenderForwardClustered::_render_shadow_append(RID p_framebuffe } } -void RendererSceneRenderForwardClustered::_render_shadow_process() { +void RenderForwardClustered::_render_shadow_process() { _update_instance_data_buffer(RENDER_LIST_SECONDARY); //render shadows one after the other, so this can be done un-barriered and the driver can optimize (as well as allow us to run compute at the same time) @@ -2048,7 +1558,7 @@ void RendererSceneRenderForwardClustered::_render_shadow_process() { RD::get_singleton()->draw_command_end_label(); } -void RendererSceneRenderForwardClustered::_render_shadow_end(uint32_t p_barrier) { +void RenderForwardClustered::_render_shadow_end(uint32_t p_barrier) { RD::get_singleton()->draw_command_begin_label("Shadow Render"); for (uint32_t i = 0; i < scene_state.shadow_passes.size(); i++) { @@ -2063,7 +1573,7 @@ void RendererSceneRenderForwardClustered::_render_shadow_end(uint32_t p_barrier) RD::get_singleton()->draw_command_end_label(); } -void RendererSceneRenderForwardClustered::_render_particle_collider_heightfield(RID p_fb, const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, const PagedArray<GeometryInstance *> &p_instances) { +void RenderForwardClustered::_render_particle_collider_heightfield(RID p_fb, const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, const PagedArray<GeometryInstance *> &p_instances) { RENDER_TIMESTAMP("Setup Render Collider Heightfield"); RD::get_singleton()->draw_command_begin_label("Render Collider Heightfield"); @@ -2091,7 +1601,7 @@ void RendererSceneRenderForwardClustered::_render_particle_collider_heightfield( RD::get_singleton()->draw_command_end_label(); } -void RendererSceneRenderForwardClustered::_render_material(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) { +void RenderForwardClustered::_render_material(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) { RENDER_TIMESTAMP("Setup Rendering Material"); RD::get_singleton()->draw_command_begin_label("Render Material"); @@ -2129,7 +1639,7 @@ void RendererSceneRenderForwardClustered::_render_material(const Transform &p_ca RD::get_singleton()->draw_command_end_label(); } -void RendererSceneRenderForwardClustered::_render_uv2(const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) { +void RenderForwardClustered::_render_uv2(const PagedArray<GeometryInstance *> &p_instances, RID p_framebuffer, const Rect2i &p_region) { RENDER_TIMESTAMP("Setup Rendering UV2"); RD::get_singleton()->draw_command_begin_label("Render UV2"); @@ -2191,14 +1701,14 @@ void RendererSceneRenderForwardClustered::_render_uv2(const PagedArray<GeometryI RD::get_singleton()->draw_command_end_label(); } -void RendererSceneRenderForwardClustered::_render_sdfgi(RID p_render_buffers, const Vector3i &p_from, const Vector3i &p_size, const AABB &p_bounds, const PagedArray<GeometryInstance *> &p_instances, const RID &p_albedo_texture, const RID &p_emission_texture, const RID &p_emission_aniso_texture, const RID &p_geom_facing_texture) { +void RenderForwardClustered::_render_sdfgi(RID p_render_buffers, const Vector3i &p_from, const Vector3i &p_size, const AABB &p_bounds, const PagedArray<GeometryInstance *> &p_instances, const RID &p_albedo_texture, const RID &p_emission_texture, const RID &p_emission_aniso_texture, const RID &p_geom_facing_texture) { RENDER_TIMESTAMP("Render SDFGI"); RD::get_singleton()->draw_command_begin_label("Render SDFGI Voxel"); _update_render_base_uniform_set(); - RenderBufferDataForward *render_buffer = (RenderBufferDataForward *)render_buffers_get_data(p_render_buffers); + RenderBufferDataForwardClustered *render_buffer = (RenderBufferDataForwardClustered *)render_buffers_get_data(p_render_buffers); ERR_FAIL_COND(!render_buffer); PassMode pass_mode = PASS_MODE_SDF; @@ -2272,14 +1782,14 @@ void RendererSceneRenderForwardClustered::_render_sdfgi(RID p_render_buffers, co RD::get_singleton()->draw_command_end_label(); } -void RendererSceneRenderForwardClustered::_base_uniforms_changed() { +void RenderForwardClustered::_base_uniforms_changed() { if (!render_base_uniform_set.is_null() && RD::get_singleton()->uniform_set_is_valid(render_base_uniform_set)) { RD::get_singleton()->free(render_base_uniform_set); } render_base_uniform_set = RID(); } -void RendererSceneRenderForwardClustered::_update_render_base_uniform_set() { +void RenderForwardClustered::_update_render_base_uniform_set() { if (render_base_uniform_set.is_null() || !RD::get_singleton()->uniform_set_is_valid(render_base_uniform_set) || (lightmap_texture_array_version != storage->lightmap_array_get_version())) { if (render_base_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(render_base_uniform_set)) { RD::get_singleton()->free(render_base_uniform_set); @@ -2314,7 +1824,7 @@ void RendererSceneRenderForwardClustered::_update_render_base_uniform_set() { RD::Uniform u; u.binding = 2; u.uniform_type = RD::UNIFORM_TYPE_SAMPLER; - u.ids.push_back(shadow_sampler); + u.ids.push_back(scene_shader.shadow_sampler); uniforms.push_back(u); } @@ -2393,7 +1903,7 @@ void RendererSceneRenderForwardClustered::_update_render_base_uniform_set() { uniforms.push_back(u); } - if (!low_end) { + { RD::Uniform u; u.uniform_type = RD::UNIFORM_TYPE_UNIFORM_BUFFER; u.binding = 13; @@ -2401,17 +1911,17 @@ void RendererSceneRenderForwardClustered::_update_render_base_uniform_set() { uniforms.push_back(u); } - render_base_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, default_shader_rd, SCENE_UNIFORM_SET); + render_base_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, scene_shader.default_shader_rd, SCENE_UNIFORM_SET); } } -RID RendererSceneRenderForwardClustered::_setup_render_pass_uniform_set(RenderListType p_render_list, RID p_render_buffers, RID p_radiance_texture, RID p_shadow_atlas, RID p_reflection_atlas, RID p_cluster_buffer, const PagedArray<RID> &p_gi_probes, const PagedArray<RID> &p_lightmaps, bool p_use_directional_shadow_atlas, int p_index) { +RID RenderForwardClustered::_setup_render_pass_uniform_set(RenderListType p_render_list, RID p_render_buffers, RID p_radiance_texture, RID p_shadow_atlas, RID p_reflection_atlas, RID p_cluster_buffer, const PagedArray<RID> &p_gi_probes, const PagedArray<RID> &p_lightmaps, bool p_use_directional_shadow_atlas, int p_index) { //there should always be enough uniform buffers for render passes, otherwise bugs ERR_FAIL_INDEX_V(p_index, (int)scene_state.uniform_buffers.size(), RID()); - RenderBufferDataForward *rb = nullptr; + RenderBufferDataForwardClustered *rb = nullptr; if (p_render_buffers.is_valid()) { - rb = (RenderBufferDataForward *)render_buffers_get_data(p_render_buffers); + rb = (RenderBufferDataForwardClustered *)render_buffers_get_data(p_render_buffers); } //default render buffer and scene state uniform set @@ -2431,7 +1941,7 @@ RID RendererSceneRenderForwardClustered::_setup_render_pass_uniform_set(RenderLi u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER; RID instance_buffer = scene_state.instance_buffer[p_render_list]; if (instance_buffer == RID()) { - instance_buffer = default_vec4_xform_buffer; // any buffer will do since its not used + instance_buffer = scene_shader.default_vec4_xform_buffer; // any buffer will do since its not used } u.ids.push_back(instance_buffer); uniforms.push_back(u); @@ -2532,7 +2042,7 @@ RID RendererSceneRenderForwardClustered::_setup_render_pass_uniform_set(RenderLi RD::Uniform u; u.binding = 8; u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER; - RID cb = p_cluster_buffer.is_valid() ? p_cluster_buffer : default_vec4_xform_buffer; + RID cb = p_cluster_buffer.is_valid() ? p_cluster_buffer : scene_shader.default_vec4_xform_buffer; u.ids.push_back(cb); uniforms.push_back(u); } @@ -2555,7 +2065,7 @@ RID RendererSceneRenderForwardClustered::_setup_render_pass_uniform_set(RenderLi uniforms.push_back(u); } - if (!low_end) { + { { RD::Uniform u; u.binding = 11; @@ -2651,11 +2161,11 @@ RID RendererSceneRenderForwardClustered::_setup_render_pass_uniform_set(RenderLi RD::get_singleton()->free(render_pass_uniform_sets[p_index]); } - render_pass_uniform_sets[p_index] = RD::get_singleton()->uniform_set_create(uniforms, default_shader_rd, RENDER_PASS_UNIFORM_SET); + render_pass_uniform_sets[p_index] = RD::get_singleton()->uniform_set_create(uniforms, scene_shader.default_shader_rd, RENDER_PASS_UNIFORM_SET); return render_pass_uniform_sets[p_index]; } -RID RendererSceneRenderForwardClustered::_setup_sdfgi_render_pass_uniform_set(RID p_albedo_texture, RID p_emission_texture, RID p_emission_aniso_texture, RID p_geom_facing_texture) { +RID RenderForwardClustered::_setup_sdfgi_render_pass_uniform_set(RID p_albedo_texture, RID p_emission_texture, RID p_emission_aniso_texture, RID p_geom_facing_texture) { if (sdfgi_pass_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(sdfgi_pass_uniform_set)) { RD::get_singleton()->free(sdfgi_pass_uniform_set); } @@ -2748,7 +2258,7 @@ RID RendererSceneRenderForwardClustered::_setup_sdfgi_render_pass_uniform_set(RI RD::Uniform u; u.binding = 8; u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER; - RID cb = default_vec4_xform_buffer; + RID cb = scene_shader.default_vec4_xform_buffer; u.ids.push_back(cb); uniforms.push_back(u); } @@ -2784,28 +2294,28 @@ RID RendererSceneRenderForwardClustered::_setup_sdfgi_render_pass_uniform_set(RI uniforms.push_back(u); } - sdfgi_pass_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, default_shader_sdfgi_rd, RENDER_PASS_UNIFORM_SET); + sdfgi_pass_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, scene_shader.default_shader_sdfgi_rd, RENDER_PASS_UNIFORM_SET); return sdfgi_pass_uniform_set; } -void RendererSceneRenderForwardClustered::_render_buffers_clear_uniform_set(RenderBufferDataForward *rb) { +void RenderForwardClustered::_render_buffers_clear_uniform_set(RenderBufferDataForwardClustered *rb) { } -void RendererSceneRenderForwardClustered::_render_buffers_uniform_set_changed(RID p_render_buffers) { - RenderBufferDataForward *rb = (RenderBufferDataForward *)render_buffers_get_data(p_render_buffers); +void RenderForwardClustered::_render_buffers_uniform_set_changed(RID p_render_buffers) { + RenderBufferDataForwardClustered *rb = (RenderBufferDataForwardClustered *)render_buffers_get_data(p_render_buffers); _render_buffers_clear_uniform_set(rb); } -RID RendererSceneRenderForwardClustered::_render_buffers_get_normal_texture(RID p_render_buffers) { - RenderBufferDataForward *rb = (RenderBufferDataForward *)render_buffers_get_data(p_render_buffers); +RID RenderForwardClustered::_render_buffers_get_normal_texture(RID p_render_buffers) { + RenderBufferDataForwardClustered *rb = (RenderBufferDataForwardClustered *)render_buffers_get_data(p_render_buffers); return rb->normal_roughness_buffer; } -RendererSceneRenderForwardClustered *RendererSceneRenderForwardClustered::singleton = nullptr; +RenderForwardClustered *RenderForwardClustered::singleton = nullptr; -void RendererSceneRenderForwardClustered::_geometry_instance_mark_dirty(GeometryInstance *p_geometry_instance) { +void RenderForwardClustered::_geometry_instance_mark_dirty(GeometryInstance *p_geometry_instance) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); if (ginstance->dirty_list_element.in_list()) { return; @@ -2825,7 +2335,7 @@ void RendererSceneRenderForwardClustered::_geometry_instance_mark_dirty(Geometry geometry_instance_dirty_list.add(&ginstance->dirty_list_element); } -void RendererSceneRenderForwardClustered::_geometry_instance_add_surface_with_material(GeometryInstanceForwardClustered *ginstance, uint32_t p_surface, MaterialData *p_material, uint32_t p_material_id, uint32_t p_shader_id, RID p_mesh) { +void RenderForwardClustered::_geometry_instance_add_surface_with_material(GeometryInstanceForwardClustered *ginstance, uint32_t p_surface, SceneShaderForwardClustered::MaterialData *p_material, uint32_t p_material_id, uint32_t p_shader_id, RID p_mesh) { bool has_read_screen_alpha = p_material->shader_data->uses_screen_texture || p_material->shader_data->uses_depth_texture || p_material->shader_data->uses_normal_texture; bool has_base_alpha = (p_material->shader_data->uses_alpha || has_read_screen_alpha); bool has_blend_alpha = p_material->shader_data->uses_blend_alpha; @@ -2853,10 +2363,10 @@ void RendererSceneRenderForwardClustered::_geometry_instance_add_surface_with_ma flags |= GeometryInstanceSurfaceDataCache::FLAG_USES_DOUBLE_SIDED_SHADOWS; } - if (has_alpha || has_read_screen_alpha || p_material->shader_data->depth_draw == ShaderData::DEPTH_DRAW_DISABLED || p_material->shader_data->depth_test == ShaderData::DEPTH_TEST_DISABLED) { + if (has_alpha || has_read_screen_alpha || p_material->shader_data->depth_draw == SceneShaderForwardClustered::ShaderData::DEPTH_DRAW_DISABLED || p_material->shader_data->depth_test == SceneShaderForwardClustered::ShaderData::DEPTH_TEST_DISABLED) { //material is only meant for alpha pass flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_ALPHA; - if (p_material->shader_data->uses_depth_pre_pass && !(p_material->shader_data->depth_draw == ShaderData::DEPTH_DRAW_DISABLED || p_material->shader_data->depth_test == ShaderData::DEPTH_TEST_DISABLED)) { + if (p_material->shader_data->uses_depth_pre_pass && !(p_material->shader_data->depth_draw == SceneShaderForwardClustered::ShaderData::DEPTH_DRAW_DISABLED || p_material->shader_data->depth_test == SceneShaderForwardClustered::ShaderData::DEPTH_TEST_DISABLED)) { flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_DEPTH; flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_SHADOW; } @@ -2866,11 +2376,11 @@ void RendererSceneRenderForwardClustered::_geometry_instance_add_surface_with_ma flags |= GeometryInstanceSurfaceDataCache::FLAG_PASS_SHADOW; } - MaterialData *material_shadow = nullptr; + SceneShaderForwardClustered::MaterialData *material_shadow = nullptr; void *surface_shadow = nullptr; if (!p_material->shader_data->writes_modelview_or_projection && !p_material->shader_data->uses_vertex && !p_material->shader_data->uses_discard && !p_material->shader_data->uses_depth_pre_pass) { flags |= GeometryInstanceSurfaceDataCache::FLAG_USES_SHARED_SHADOW_MATERIAL; - material_shadow = (MaterialData *)storage->material_get_data(default_material, RendererStorageRD::SHADER_TYPE_3D); + material_shadow = (SceneShaderForwardClustered::MaterialData *)storage->material_get_data(scene_shader.default_material, RendererStorageRD::SHADER_TYPE_3D); RID shadow_mesh = storage->mesh_get_shadow_mesh(p_mesh); @@ -2921,15 +2431,15 @@ void RendererSceneRenderForwardClustered::_geometry_instance_add_surface_with_ma sdcache->sort.priority = p_material->priority; } -void RendererSceneRenderForwardClustered::_geometry_instance_add_surface(GeometryInstanceForwardClustered *ginstance, uint32_t p_surface, RID p_material, RID p_mesh) { +void RenderForwardClustered::_geometry_instance_add_surface(GeometryInstanceForwardClustered *ginstance, uint32_t p_surface, RID p_material, RID p_mesh) { RID m_src; m_src = ginstance->data->material_override.is_valid() ? ginstance->data->material_override : p_material; - MaterialData *material = nullptr; + SceneShaderForwardClustered::MaterialData *material = nullptr; if (m_src.is_valid()) { - material = (MaterialData *)storage->material_get_data(m_src, RendererStorageRD::SHADER_TYPE_3D); + material = (SceneShaderForwardClustered::MaterialData *)storage->material_get_data(m_src, RendererStorageRD::SHADER_TYPE_3D); if (!material || !material->shader_data->valid) { material = nullptr; } @@ -2940,8 +2450,8 @@ void RendererSceneRenderForwardClustered::_geometry_instance_add_surface(Geometr storage->material_update_dependency(m_src, &ginstance->data->dependency_tracker); } } else { - material = (MaterialData *)storage->material_get_data(default_material, RendererStorageRD::SHADER_TYPE_3D); - m_src = default_material; + material = (SceneShaderForwardClustered::MaterialData *)storage->material_get_data(scene_shader.default_material, RendererStorageRD::SHADER_TYPE_3D); + m_src = scene_shader.default_material; } ERR_FAIL_COND(!material); @@ -2950,7 +2460,7 @@ void RendererSceneRenderForwardClustered::_geometry_instance_add_surface(Geometr while (material->next_pass.is_valid()) { RID next_pass = material->next_pass; - material = (MaterialData *)storage->material_get_data(next_pass, RendererStorageRD::SHADER_TYPE_3D); + material = (SceneShaderForwardClustered::MaterialData *)storage->material_get_data(next_pass, RendererStorageRD::SHADER_TYPE_3D); if (!material || !material->shader_data->valid) { break; } @@ -2961,7 +2471,7 @@ void RendererSceneRenderForwardClustered::_geometry_instance_add_surface(Geometr } } -void RendererSceneRenderForwardClustered::_geometry_instance_update(GeometryInstance *p_geometry_instance) { +void RenderForwardClustered::_geometry_instance_update(GeometryInstance *p_geometry_instance) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); if (ginstance->data->dirty_dependencies) { @@ -3022,8 +2532,9 @@ void RendererSceneRenderForwardClustered::_geometry_instance_update(GeometryInst for (int j = 0; j < draw_passes; j++) { RID mesh = storage->particles_get_draw_pass_mesh(ginstance->data->base, j); - if (!mesh.is_valid()) + if (!mesh.is_valid()) { continue; + } const RID *materials = nullptr; uint32_t surface_count; @@ -3067,7 +2578,7 @@ void RendererSceneRenderForwardClustered::_geometry_instance_update(GeometryInst } ginstance->base_flags |= (stride << INSTANCE_DATA_FLAGS_MULTIMESH_STRIDE_SHIFT); - ginstance->transforms_uniform_set = storage->multimesh_get_3d_uniform_set(ginstance->data->base, default_shader_rd, TRANSFORMS_UNIFORM_SET); + ginstance->transforms_uniform_set = storage->multimesh_get_3d_uniform_set(ginstance->data->base, scene_shader.default_shader_rd, TRANSFORMS_UNIFORM_SET); } else if (ginstance->data->base_type == RS::INSTANCE_PARTICLES) { ginstance->base_flags |= INSTANCE_DATA_FLAG_MULTIMESH; @@ -3090,12 +2601,12 @@ void RendererSceneRenderForwardClustered::_geometry_instance_update(GeometryInst if (!storage->particles_is_using_local_coords(ginstance->data->base)) { store_transform = false; } - ginstance->transforms_uniform_set = storage->particles_get_instance_buffer_uniform_set(ginstance->data->base, default_shader_rd, TRANSFORMS_UNIFORM_SET); + ginstance->transforms_uniform_set = storage->particles_get_instance_buffer_uniform_set(ginstance->data->base, scene_shader.default_shader_rd, TRANSFORMS_UNIFORM_SET); } else if (ginstance->data->base_type == RS::INSTANCE_MESH) { if (storage->skeleton_is_valid(ginstance->data->skeleton)) { ginstance->base_flags |= INSTANCE_DATA_FLAG_SKELETON; - ginstance->transforms_uniform_set = storage->skeleton_get_3d_uniform_set(ginstance->data->skeleton, default_shader_rd, TRANSFORMS_UNIFORM_SET); + ginstance->transforms_uniform_set = storage->skeleton_get_3d_uniform_set(ginstance->data->skeleton, scene_shader.default_shader_rd, TRANSFORMS_UNIFORM_SET); if (ginstance->data->dirty_dependencies) { storage->skeleton_update_dependency(ginstance->data->skeleton, &ginstance->data->dependency_tracker); } @@ -3105,7 +2616,7 @@ void RendererSceneRenderForwardClustered::_geometry_instance_update(GeometryInst ginstance->store_transform_cache = store_transform; ginstance->can_sdfgi = false; - if (!lightmap_instance_is_valid(ginstance->lightmap_instance) && !low_end) { + if (!lightmap_instance_is_valid(ginstance->lightmap_instance)) { if (ginstance->gi_probes[0].is_null() && (ginstance->data->use_baked_light || ginstance->data->use_dynamic_gi)) { ginstance->can_sdfgi = true; } @@ -3119,24 +2630,24 @@ void RendererSceneRenderForwardClustered::_geometry_instance_update(GeometryInst ginstance->dirty_list_element.remove_from_list(); } -void RendererSceneRenderForwardClustered::_update_dirty_geometry_instances() { +void RenderForwardClustered::_update_dirty_geometry_instances() { while (geometry_instance_dirty_list.first()) { _geometry_instance_update(geometry_instance_dirty_list.first()->self()); } } -void RendererSceneRenderForwardClustered::_geometry_instance_dependency_changed(RendererStorage::DependencyChangedNotification p_notification, RendererStorage::DependencyTracker *p_tracker) { +void RenderForwardClustered::_geometry_instance_dependency_changed(RendererStorage::DependencyChangedNotification p_notification, RendererStorage::DependencyTracker *p_tracker) { switch (p_notification) { case RendererStorage::DEPENDENCY_CHANGED_MATERIAL: case RendererStorage::DEPENDENCY_CHANGED_MESH: case RendererStorage::DEPENDENCY_CHANGED_MULTIMESH: case RendererStorage::DEPENDENCY_CHANGED_SKELETON_DATA: { - static_cast<RendererSceneRenderForwardClustered *>(singleton)->_geometry_instance_mark_dirty(static_cast<GeometryInstance *>(p_tracker->userdata)); + static_cast<RenderForwardClustered *>(singleton)->_geometry_instance_mark_dirty(static_cast<GeometryInstance *>(p_tracker->userdata)); } break; case RendererStorage::DEPENDENCY_CHANGED_MULTIMESH_VISIBLE_INSTANCES: { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_tracker->userdata); if (ginstance->data->base_type == RS::INSTANCE_MULTIMESH) { - ginstance->instance_count = static_cast<RendererSceneRenderForwardClustered *>(singleton)->storage->multimesh_get_instances_to_draw(ginstance->data->base); + ginstance->instance_count = static_cast<RenderForwardClustered *>(singleton)->storage->multimesh_get_instances_to_draw(ginstance->data->base); } } break; default: { @@ -3144,11 +2655,11 @@ void RendererSceneRenderForwardClustered::_geometry_instance_dependency_changed( } break; } } -void RendererSceneRenderForwardClustered::_geometry_instance_dependency_deleted(const RID &p_dependency, RendererStorage::DependencyTracker *p_tracker) { - static_cast<RendererSceneRenderForwardClustered *>(singleton)->_geometry_instance_mark_dirty(static_cast<GeometryInstance *>(p_tracker->userdata)); +void RenderForwardClustered::_geometry_instance_dependency_deleted(const RID &p_dependency, RendererStorage::DependencyTracker *p_tracker) { + static_cast<RenderForwardClustered *>(singleton)->_geometry_instance_mark_dirty(static_cast<GeometryInstance *>(p_tracker->userdata)); } -RendererSceneRender::GeometryInstance *RendererSceneRenderForwardClustered::geometry_instance_create(RID p_base) { +RendererSceneRender::GeometryInstance *RenderForwardClustered::geometry_instance_create(RID p_base) { RS::InstanceType type = storage->get_base_type(p_base); ERR_FAIL_COND_V(!((1 << type) & RS::INSTANCE_GEOMETRY_MASK), nullptr); @@ -3165,34 +2676,34 @@ RendererSceneRender::GeometryInstance *RendererSceneRenderForwardClustered::geom return ginstance; } -void RendererSceneRenderForwardClustered::geometry_instance_set_skeleton(GeometryInstance *p_geometry_instance, RID p_skeleton) { +void RenderForwardClustered::geometry_instance_set_skeleton(GeometryInstance *p_geometry_instance, RID p_skeleton) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->data->skeleton = p_skeleton; _geometry_instance_mark_dirty(ginstance); ginstance->data->dirty_dependencies = true; } -void RendererSceneRenderForwardClustered::geometry_instance_set_material_override(GeometryInstance *p_geometry_instance, RID p_override) { +void RenderForwardClustered::geometry_instance_set_material_override(GeometryInstance *p_geometry_instance, RID p_override) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->data->material_override = p_override; _geometry_instance_mark_dirty(ginstance); ginstance->data->dirty_dependencies = true; } -void RendererSceneRenderForwardClustered::geometry_instance_set_surface_materials(GeometryInstance *p_geometry_instance, const Vector<RID> &p_materials) { +void RenderForwardClustered::geometry_instance_set_surface_materials(GeometryInstance *p_geometry_instance, const Vector<RID> &p_materials) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->data->surface_materials = p_materials; _geometry_instance_mark_dirty(ginstance); ginstance->data->dirty_dependencies = true; } -void RendererSceneRenderForwardClustered::geometry_instance_set_mesh_instance(GeometryInstance *p_geometry_instance, RID p_mesh_instance) { +void RenderForwardClustered::geometry_instance_set_mesh_instance(GeometryInstance *p_geometry_instance, RID p_mesh_instance) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->mesh_instance = p_mesh_instance; _geometry_instance_mark_dirty(ginstance); } -void RendererSceneRenderForwardClustered::geometry_instance_set_transform(GeometryInstance *p_geometry_instance, const Transform &p_transform, const AABB &p_aabb, const AABB &p_transformed_aabb) { +void RenderForwardClustered::geometry_instance_set_transform(GeometryInstance *p_geometry_instance, const Transform &p_transform, const AABB &p_aabb, const AABB &p_transformed_aabb) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->transform = p_transform; @@ -3209,24 +2720,24 @@ void RendererSceneRenderForwardClustered::geometry_instance_set_transform(Geomet ginstance->lod_model_scale = max_scale; } -void RendererSceneRenderForwardClustered::geometry_instance_set_lod_bias(GeometryInstance *p_geometry_instance, float p_lod_bias) { +void RenderForwardClustered::geometry_instance_set_lod_bias(GeometryInstance *p_geometry_instance, float p_lod_bias) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->lod_bias = p_lod_bias; } -void RendererSceneRenderForwardClustered::geometry_instance_set_use_baked_light(GeometryInstance *p_geometry_instance, bool p_enable) { +void RenderForwardClustered::geometry_instance_set_use_baked_light(GeometryInstance *p_geometry_instance, bool p_enable) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->data->use_baked_light = p_enable; _geometry_instance_mark_dirty(ginstance); } -void RendererSceneRenderForwardClustered::geometry_instance_set_use_dynamic_gi(GeometryInstance *p_geometry_instance, bool p_enable) { +void RenderForwardClustered::geometry_instance_set_use_dynamic_gi(GeometryInstance *p_geometry_instance, bool p_enable) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->data->use_dynamic_gi = p_enable; _geometry_instance_mark_dirty(ginstance); } -void RendererSceneRenderForwardClustered::geometry_instance_set_use_lightmap(GeometryInstance *p_geometry_instance, RID p_lightmap_instance, const Rect2 &p_lightmap_uv_scale, int p_lightmap_slice_index) { +void RenderForwardClustered::geometry_instance_set_use_lightmap(GeometryInstance *p_geometry_instance, RID p_lightmap_instance, const Rect2 &p_lightmap_uv_scale, int p_lightmap_slice_index) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->lightmap_instance = p_lightmap_instance; @@ -3234,7 +2745,7 @@ void RendererSceneRenderForwardClustered::geometry_instance_set_use_lightmap(Geo ginstance->lightmap_slice_index = p_lightmap_slice_index; _geometry_instance_mark_dirty(ginstance); } -void RendererSceneRenderForwardClustered::geometry_instance_set_lightmap_capture(GeometryInstance *p_geometry_instance, const Color *p_sh9) { +void RenderForwardClustered::geometry_instance_set_lightmap_capture(GeometryInstance *p_geometry_instance, const Color *p_sh9) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); if (p_sh9) { @@ -3251,13 +2762,13 @@ void RendererSceneRenderForwardClustered::geometry_instance_set_lightmap_capture } _geometry_instance_mark_dirty(ginstance); } -void RendererSceneRenderForwardClustered::geometry_instance_set_instance_shader_parameters_offset(GeometryInstance *p_geometry_instance, int32_t p_offset) { +void RenderForwardClustered::geometry_instance_set_instance_shader_parameters_offset(GeometryInstance *p_geometry_instance, int32_t p_offset) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->shader_parameters_offset = p_offset; _geometry_instance_mark_dirty(ginstance); } -void RendererSceneRenderForwardClustered::geometry_instance_set_cast_double_sided_shadows(GeometryInstance *p_geometry_instance, bool p_enable) { +void RenderForwardClustered::geometry_instance_set_cast_double_sided_shadows(GeometryInstance *p_geometry_instance, bool p_enable) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); @@ -3265,13 +2776,13 @@ void RendererSceneRenderForwardClustered::geometry_instance_set_cast_double_side _geometry_instance_mark_dirty(ginstance); } -void RendererSceneRenderForwardClustered::geometry_instance_set_layer_mask(GeometryInstance *p_geometry_instance, uint32_t p_layer_mask) { +void RenderForwardClustered::geometry_instance_set_layer_mask(GeometryInstance *p_geometry_instance, uint32_t p_layer_mask) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); ginstance->layer_mask = p_layer_mask; } -void RendererSceneRenderForwardClustered::geometry_instance_free(GeometryInstance *p_geometry_instance) { +void RenderForwardClustered::geometry_instance_free(GeometryInstance *p_geometry_instance) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); if (ginstance->lightmap_sh != nullptr) { @@ -3287,28 +2798,28 @@ void RendererSceneRenderForwardClustered::geometry_instance_free(GeometryInstanc geometry_instance_alloc.free(ginstance); } -uint32_t RendererSceneRenderForwardClustered::geometry_instance_get_pair_mask() { +uint32_t RenderForwardClustered::geometry_instance_get_pair_mask() { return (1 << RS::INSTANCE_GI_PROBE); } -void RendererSceneRenderForwardClustered::geometry_instance_pair_light_instances(GeometryInstance *p_geometry_instance, const RID *p_light_instances, uint32_t p_light_instance_count) { +void RenderForwardClustered::geometry_instance_pair_light_instances(GeometryInstance *p_geometry_instance, const RID *p_light_instances, uint32_t p_light_instance_count) { } -void RendererSceneRenderForwardClustered::geometry_instance_pair_reflection_probe_instances(GeometryInstance *p_geometry_instance, const RID *p_reflection_probe_instances, uint32_t p_reflection_probe_instance_count) { +void RenderForwardClustered::geometry_instance_pair_reflection_probe_instances(GeometryInstance *p_geometry_instance, const RID *p_reflection_probe_instances, uint32_t p_reflection_probe_instance_count) { } -void RendererSceneRenderForwardClustered::geometry_instance_pair_decal_instances(GeometryInstance *p_geometry_instance, const RID *p_decal_instances, uint32_t p_decal_instance_count) { +void RenderForwardClustered::geometry_instance_pair_decal_instances(GeometryInstance *p_geometry_instance, const RID *p_decal_instances, uint32_t p_decal_instance_count) { } -Transform RendererSceneRenderForwardClustered::geometry_instance_get_transform(GeometryInstance *p_instance) { +Transform RenderForwardClustered::geometry_instance_get_transform(GeometryInstance *p_instance) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_instance); ERR_FAIL_COND_V(!ginstance, Transform()); return ginstance->transform; } -AABB RendererSceneRenderForwardClustered::geometry_instance_get_aabb(GeometryInstance *p_instance) { +AABB RenderForwardClustered::geometry_instance_get_aabb(GeometryInstance *p_instance) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_instance); ERR_FAIL_COND_V(!ginstance, AABB()); return ginstance->data->aabb; } -void RendererSceneRenderForwardClustered::geometry_instance_pair_gi_probe_instances(GeometryInstance *p_geometry_instance, const RID *p_gi_probe_instances, uint32_t p_gi_probe_instance_count) { +void RenderForwardClustered::geometry_instance_pair_gi_probe_instances(GeometryInstance *p_geometry_instance, const RID *p_gi_probe_instances, uint32_t p_gi_probe_instance_count) { GeometryInstanceForwardClustered *ginstance = static_cast<GeometryInstanceForwardClustered *>(p_geometry_instance); ERR_FAIL_COND(!ginstance); if (p_gi_probe_instance_count > 0) { @@ -3324,19 +2835,14 @@ void RendererSceneRenderForwardClustered::geometry_instance_pair_gi_probe_instan } } -RendererSceneRenderForwardClustered::RendererSceneRenderForwardClustered(RendererStorageRD *p_storage) : +RenderForwardClustered::RenderForwardClustered(RendererStorageRD *p_storage) : RendererSceneRenderRD(p_storage) { singleton = this; - low_end = is_low_end(); /* SCENE SHADER */ { String defines; - if (low_end) { - defines += "\n#define LOW_END_MODE \n"; - } - defines += "\n#define MAX_ROUGHNESS_LOD " + itos(get_roughness_layers() - 1) + ".0\n"; if (is_using_radiance_cubemap_array()) { defines += "\n#define USE_RADIANCE_CUBEMAP_ARRAY \n"; @@ -3346,7 +2852,7 @@ RendererSceneRenderForwardClustered::RendererSceneRenderForwardClustered(Rendere { //lightmaps - scene_state.max_lightmaps = low_end ? 2 : MAX_LIGHTMAPS; + scene_state.max_lightmaps = MAX_LIGHTMAPS; defines += "\n#define MAX_LIGHTMAP_TEXTURES " + itos(scene_state.max_lightmaps) + "\n"; defines += "\n#define MAX_LIGHTMAPS " + itos(scene_state.max_lightmaps) + "\n"; @@ -3362,267 +2868,13 @@ RendererSceneRenderForwardClustered::RendererSceneRenderForwardClustered(Rendere defines += "\n#define MATERIAL_UNIFORM_SET " + itos(MATERIAL_UNIFORM_SET) + "\n"; } - Vector<String> shader_versions; - shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n"); - shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_DUAL_PARABOLOID\n"); - shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_NORMAL_ROUGHNESS\n"); - shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_NORMAL_ROUGHNESS\n#define MODE_RENDER_GIPROBE\n"); - shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_MATERIAL\n"); - shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_SDF\n"); - shader_versions.push_back(""); - shader_versions.push_back("\n#define USE_FORWARD_GI\n"); - shader_versions.push_back("\n#define MODE_MULTIPLE_RENDER_TARGETS\n"); - shader_versions.push_back("\n#define USE_LIGHTMAP\n"); - shader_versions.push_back("\n#define MODE_MULTIPLE_RENDER_TARGETS\n#define USE_LIGHTMAP\n"); - shader.scene_shader.initialize(shader_versions, defines); - - if (is_low_end()) { - //disable the high end versions - shader.scene_shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS, false); - shader.scene_shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_GIPROBE, false); - shader.scene_shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_SDF, false); - shader.scene_shader.set_variant_enabled(SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI, false); - shader.scene_shader.set_variant_enabled(SHADER_VERSION_COLOR_PASS_WITH_SEPARATE_SPECULAR, false); - shader.scene_shader.set_variant_enabled(SHADER_VERSION_LIGHTMAP_COLOR_PASS_WITH_SEPARATE_SPECULAR, false); - } - } - - storage->shader_set_data_request_function(RendererStorageRD::SHADER_TYPE_3D, _create_shader_funcs); - storage->material_set_data_request_function(RendererStorageRD::SHADER_TYPE_3D, _create_material_funcs); - - { - //shader compiler - ShaderCompilerRD::DefaultIdentifierActions actions; - - actions.renames["WORLD_MATRIX"] = "world_matrix"; - actions.renames["WORLD_NORMAL_MATRIX"] = "world_normal_matrix"; - actions.renames["INV_CAMERA_MATRIX"] = "scene_data.inv_camera_matrix"; - actions.renames["CAMERA_MATRIX"] = "scene_data.camera_matrix"; - actions.renames["PROJECTION_MATRIX"] = "projection_matrix"; - actions.renames["INV_PROJECTION_MATRIX"] = "scene_data.inv_projection_matrix"; - actions.renames["MODELVIEW_MATRIX"] = "modelview"; - actions.renames["MODELVIEW_NORMAL_MATRIX"] = "modelview_normal"; - - actions.renames["VERTEX"] = "vertex"; - actions.renames["NORMAL"] = "normal"; - actions.renames["TANGENT"] = "tangent"; - actions.renames["BINORMAL"] = "binormal"; - actions.renames["POSITION"] = "position"; - actions.renames["UV"] = "uv_interp"; - actions.renames["UV2"] = "uv2_interp"; - actions.renames["COLOR"] = "color_interp"; - actions.renames["POINT_SIZE"] = "gl_PointSize"; - actions.renames["INSTANCE_ID"] = "gl_InstanceIndex"; - - actions.renames["ALPHA_SCISSOR_THRESHOLD"] = "alpha_scissor_threshold"; - actions.renames["ALPHA_HASH_SCALE"] = "alpha_hash_scale"; - actions.renames["ALPHA_ANTIALIASING_EDGE"] = "alpha_antialiasing_edge"; - actions.renames["ALPHA_TEXTURE_COORDINATE"] = "alpha_texture_coordinate"; - - //builtins - - actions.renames["TIME"] = "scene_data.time"; - actions.renames["VIEWPORT_SIZE"] = "scene_data.viewport_size"; - - actions.renames["FRAGCOORD"] = "gl_FragCoord"; - actions.renames["FRONT_FACING"] = "gl_FrontFacing"; - actions.renames["NORMAL_MAP"] = "normal_map"; - actions.renames["NORMAL_MAP_DEPTH"] = "normal_map_depth"; - actions.renames["ALBEDO"] = "albedo"; - actions.renames["ALPHA"] = "alpha"; - actions.renames["METALLIC"] = "metallic"; - actions.renames["SPECULAR"] = "specular"; - actions.renames["ROUGHNESS"] = "roughness"; - actions.renames["RIM"] = "rim"; - actions.renames["RIM_TINT"] = "rim_tint"; - actions.renames["CLEARCOAT"] = "clearcoat"; - actions.renames["CLEARCOAT_GLOSS"] = "clearcoat_gloss"; - actions.renames["ANISOTROPY"] = "anisotropy"; - actions.renames["ANISOTROPY_FLOW"] = "anisotropy_flow"; - actions.renames["SSS_STRENGTH"] = "sss_strength"; - actions.renames["SSS_TRANSMITTANCE_COLOR"] = "transmittance_color"; - actions.renames["SSS_TRANSMITTANCE_DEPTH"] = "transmittance_depth"; - actions.renames["SSS_TRANSMITTANCE_CURVE"] = "transmittance_curve"; - actions.renames["SSS_TRANSMITTANCE_BOOST"] = "transmittance_boost"; - actions.renames["BACKLIGHT"] = "backlight"; - actions.renames["AO"] = "ao"; - actions.renames["AO_LIGHT_AFFECT"] = "ao_light_affect"; - actions.renames["EMISSION"] = "emission"; - actions.renames["POINT_COORD"] = "gl_PointCoord"; - actions.renames["INSTANCE_CUSTOM"] = "instance_custom"; - actions.renames["SCREEN_UV"] = "screen_uv"; - actions.renames["SCREEN_TEXTURE"] = "color_buffer"; - actions.renames["DEPTH_TEXTURE"] = "depth_buffer"; - actions.renames["NORMAL_ROUGHNESS_TEXTURE"] = "normal_roughness_buffer"; - actions.renames["DEPTH"] = "gl_FragDepth"; - actions.renames["OUTPUT_IS_SRGB"] = "true"; - actions.renames["FOG"] = "custom_fog"; - actions.renames["RADIANCE"] = "custom_radiance"; - actions.renames["IRRADIANCE"] = "custom_irradiance"; - actions.renames["BONE_INDICES"] = "bone_attrib"; - actions.renames["BONE_WEIGHTS"] = "weight_attrib"; - actions.renames["CUSTOM0"] = "custom0_attrib"; - actions.renames["CUSTOM1"] = "custom1_attrib"; - actions.renames["CUSTOM2"] = "custom2_attrib"; - actions.renames["CUSTOM3"] = "custom3_attrib"; - - //for light - actions.renames["VIEW"] = "view"; - actions.renames["LIGHT_COLOR"] = "light_color"; - actions.renames["LIGHT"] = "light"; - actions.renames["ATTENUATION"] = "attenuation"; - actions.renames["SHADOW_ATTENUATION"] = "shadow_attenuation"; - actions.renames["DIFFUSE_LIGHT"] = "diffuse_light"; - actions.renames["SPECULAR_LIGHT"] = "specular_light"; - - actions.usage_defines["NORMAL"] = "#define NORMAL_USED\n"; - actions.usage_defines["TANGENT"] = "#define TANGENT_USED\n"; - actions.usage_defines["BINORMAL"] = "@TANGENT"; - actions.usage_defines["RIM"] = "#define LIGHT_RIM_USED\n"; - actions.usage_defines["RIM_TINT"] = "@RIM"; - actions.usage_defines["CLEARCOAT"] = "#define LIGHT_CLEARCOAT_USED\n"; - actions.usage_defines["CLEARCOAT_GLOSS"] = "@CLEARCOAT"; - actions.usage_defines["ANISOTROPY"] = "#define LIGHT_ANISOTROPY_USED\n"; - actions.usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY"; - actions.usage_defines["AO"] = "#define AO_USED\n"; - actions.usage_defines["AO_LIGHT_AFFECT"] = "#define AO_USED\n"; - actions.usage_defines["UV"] = "#define UV_USED\n"; - actions.usage_defines["UV2"] = "#define UV2_USED\n"; - actions.usage_defines["BONE_INDICES"] = "#define BONES_USED\n"; - actions.usage_defines["BONE_WEIGHTS"] = "#define WEIGHTS_USED\n"; - actions.usage_defines["CUSTOM0"] = "#define CUSTOM0\n"; - actions.usage_defines["CUSTOM1"] = "#define CUSTOM1\n"; - actions.usage_defines["CUSTOM2"] = "#define CUSTOM2\n"; - actions.usage_defines["CUSTOM3"] = "#define CUSTOM3\n"; - actions.usage_defines["NORMAL_MAP"] = "#define NORMAL_MAP_USED\n"; - actions.usage_defines["NORMAL_MAP_DEPTH"] = "@NORMAL_MAP"; - actions.usage_defines["COLOR"] = "#define COLOR_USED\n"; - actions.usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n"; - actions.usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n"; - - actions.usage_defines["ALPHA_SCISSOR_THRESHOLD"] = "#define ALPHA_SCISSOR_USED\n"; - actions.usage_defines["ALPHA_HASH_SCALE"] = "#define ALPHA_HASH_USED\n"; - actions.usage_defines["ALPHA_ANTIALIASING_EDGE"] = "#define ALPHA_ANTIALIASING_EDGE_USED\n"; - actions.usage_defines["ALPHA_TEXTURE_COORDINATE"] = "@ALPHA_ANTIALIASING_EDGE"; - - actions.usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n"; - actions.usage_defines["SSS_TRANSMITTANCE_DEPTH"] = "#define ENABLE_TRANSMITTANCE\n"; - actions.usage_defines["BACKLIGHT"] = "#define LIGHT_BACKLIGHT_USED\n"; - actions.usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n"; - actions.usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n"; - - actions.usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n"; - actions.usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n"; - - actions.usage_defines["FOG"] = "#define CUSTOM_FOG_USED\n"; - actions.usage_defines["RADIANCE"] = "#define CUSTOM_RADIANCE_USED\n"; - actions.usage_defines["IRRADIANCE"] = "#define CUSTOM_IRRADIANCE_USED\n"; - - actions.render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n"; - actions.render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n"; - actions.render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n"; - actions.render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n"; - actions.render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n"; - - bool force_lambert = GLOBAL_GET("rendering/shading/overrides/force_lambert_over_burley"); - - if (!force_lambert) { - actions.render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n"; - } - - actions.render_mode_defines["diffuse_oren_nayar"] = "#define DIFFUSE_OREN_NAYAR\n"; - actions.render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n"; - actions.render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n"; - - actions.render_mode_defines["sss_mode_skin"] = "#define SSS_MODE_SKIN\n"; - - bool force_blinn = GLOBAL_GET("rendering/shading/overrides/force_blinn_over_ggx"); - - if (!force_blinn) { - actions.render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n"; - } else { - actions.render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_BLINN\n"; - } - - actions.render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n"; - actions.render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n"; - actions.render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n"; - actions.render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n"; - actions.render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n"; - actions.render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n"; - actions.render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n"; - actions.render_mode_defines["unshaded"] = "#define MODE_UNSHADED\n"; - - actions.sampler_array_name = "material_samplers"; - actions.base_texture_binding_index = 1; - actions.texture_layout_set = MATERIAL_UNIFORM_SET; - actions.base_uniform_string = "material."; - actions.base_varying_index = 10; - - actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP; - actions.default_repeat = ShaderLanguage::REPEAT_ENABLE; - actions.global_buffer_array_variable = "global_variables.data"; - actions.instance_uniform_index_variable = "draw_call.instance_uniforms_ofs"; - - shader.compiler.initialize(actions); - } - - { - //default material and shader - default_shader = storage->shader_allocate(); - storage->shader_initialize(default_shader); - storage->shader_set_code(default_shader, "shader_type spatial; void vertex() { ROUGHNESS = 0.8; } void fragment() { ALBEDO=vec3(0.6); ROUGHNESS=0.8; METALLIC=0.2; } \n"); - default_material = storage->material_allocate(); - storage->material_initialize(default_material); - storage->material_set_shader(default_material, default_shader); - - MaterialData *md = (MaterialData *)storage->material_get_data(default_material, RendererStorageRD::SHADER_TYPE_3D); - default_shader_rd = shader.scene_shader.version_get_shader(md->shader_data->version, SHADER_VERSION_COLOR_PASS); - if (!low_end) { - default_shader_sdfgi_rd = shader.scene_shader.version_get_shader(md->shader_data->version, SHADER_VERSION_DEPTH_PASS_WITH_SDF); - } - } - - { - overdraw_material_shader = storage->shader_allocate(); - storage->shader_initialize(overdraw_material_shader); - storage->shader_set_code(overdraw_material_shader, "shader_type spatial;\nrender_mode blend_add,unshaded;\n void fragment() { ALBEDO=vec3(0.4,0.8,0.8); ALPHA=0.2; }"); - overdraw_material = storage->material_allocate(); - storage->material_initialize(overdraw_material); - storage->material_set_shader(overdraw_material, overdraw_material_shader); - - wireframe_material_shader = storage->shader_allocate(); - storage->shader_initialize(wireframe_material_shader); - storage->shader_set_code(wireframe_material_shader, "shader_type spatial;\nrender_mode wireframe,unshaded;\n void fragment() { ALBEDO=vec3(0.0,0.0,0.0); }"); - wireframe_material = storage->material_allocate(); - storage->material_initialize(wireframe_material); - storage->material_set_shader(wireframe_material, wireframe_material_shader); - } - - { - default_vec4_xform_buffer = RD::get_singleton()->storage_buffer_create(256); - Vector<RD::Uniform> uniforms; - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER; - u.ids.push_back(default_vec4_xform_buffer); - u.binding = 0; - uniforms.push_back(u); - - default_vec4_xform_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, default_shader_rd, TRANSFORMS_UNIFORM_SET); - } - { - RD::SamplerState sampler; - sampler.mag_filter = RD::SAMPLER_FILTER_LINEAR; - sampler.min_filter = RD::SAMPLER_FILTER_LINEAR; - sampler.enable_compare = true; - sampler.compare_op = RD::COMPARE_OP_LESS; - shadow_sampler = RD::get_singleton()->sampler_create(sampler); + scene_shader.init(p_storage, defines); } render_list_thread_threshold = GLOBAL_GET("rendering/limits/forward_renderer/threaded_render_minimum_instances"); } -RendererSceneRenderForwardClustered::~RendererSceneRenderForwardClustered() { +RenderForwardClustered::~RenderForwardClustered() { directional_shadow_atlas_set_size(0); //clear base uniform set if still valid @@ -3636,17 +2888,6 @@ RendererSceneRenderForwardClustered::~RendererSceneRenderForwardClustered() { RD::get_singleton()->free(sdfgi_pass_uniform_set); } - RD::get_singleton()->free(default_vec4_xform_buffer); - RD::get_singleton()->free(shadow_sampler); - - storage->free(wireframe_material_shader); - storage->free(overdraw_material_shader); - storage->free(default_shader); - - storage->free(wireframe_material); - storage->free(overdraw_material); - storage->free(default_material); - { for (uint32_t i = 0; i < scene_state.uniform_buffers.size(); i++) { RD::get_singleton()->free(scene_state.uniform_buffers[i]); diff --git a/servers/rendering/renderer_rd/renderer_scene_render_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h index 98e2a7efcc..72e84a6f24 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_forward_clustered.h +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* renderer_scene_render_forward_clustered.h */ +/* render_forward_clustered.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -32,12 +32,17 @@ #define RENDERING_SERVER_SCENE_RENDER_FORWARD_CLUSTERED_H #include "core/templates/paged_allocator.h" +#include "servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h" #include "servers/rendering/renderer_rd/pipeline_cache_rd.h" #include "servers/rendering/renderer_rd/renderer_scene_render_rd.h" #include "servers/rendering/renderer_rd/renderer_storage_rd.h" #include "servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl.gen.h" -class RendererSceneRenderForwardClustered : public RendererSceneRenderRD { +namespace RendererSceneRenderImplementation { + +class RenderForwardClustered : public RendererSceneRenderRD { + friend SceneShaderForwardClustered; + enum { SCENE_UNIFORM_SET = 0, RENDER_PASS_UNIFORM_SET = 1, @@ -63,155 +68,11 @@ class RendererSceneRenderForwardClustered : public RendererSceneRenderRD { /* Scene Shader */ - enum ShaderVersion { - SHADER_VERSION_DEPTH_PASS, - SHADER_VERSION_DEPTH_PASS_DP, - SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS, - SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_GIPROBE, - SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL, - SHADER_VERSION_DEPTH_PASS_WITH_SDF, - SHADER_VERSION_COLOR_PASS, - SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI, - SHADER_VERSION_COLOR_PASS_WITH_SEPARATE_SPECULAR, - SHADER_VERSION_LIGHTMAP_COLOR_PASS, - SHADER_VERSION_LIGHTMAP_COLOR_PASS_WITH_SEPARATE_SPECULAR, - SHADER_VERSION_MAX - }; - - struct { - SceneForwardClusteredShaderRD scene_shader; - ShaderCompilerRD compiler; - } shader; - - /* Material */ - - struct ShaderData : public RendererStorageRD::ShaderData { - enum BlendMode { //used internally - BLEND_MODE_MIX, - BLEND_MODE_ADD, - BLEND_MODE_SUB, - BLEND_MODE_MUL, - BLEND_MODE_ALPHA_TO_COVERAGE - }; - - enum DepthDraw { - DEPTH_DRAW_DISABLED, - DEPTH_DRAW_OPAQUE, - DEPTH_DRAW_ALWAYS - }; - - enum DepthTest { - DEPTH_TEST_DISABLED, - DEPTH_TEST_ENABLED - }; - - enum Cull { - CULL_DISABLED, - CULL_FRONT, - CULL_BACK - }; - - enum CullVariant { - CULL_VARIANT_NORMAL, - CULL_VARIANT_REVERSED, - CULL_VARIANT_DOUBLE_SIDED, - CULL_VARIANT_MAX - - }; - - enum AlphaAntiAliasing { - ALPHA_ANTIALIASING_OFF, - ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE, - ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE - }; - - bool valid; - RID version; - uint32_t vertex_input_mask; - PipelineCacheRD pipelines[CULL_VARIANT_MAX][RS::PRIMITIVE_MAX][SHADER_VERSION_MAX]; - - String path; - - Map<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms; - Vector<ShaderCompilerRD::GeneratedCode::Texture> texture_uniforms; - - Vector<uint32_t> ubo_offsets; - uint32_t ubo_size; - - String code; - Map<StringName, RID> default_texture_params; - - DepthDraw depth_draw; - DepthTest depth_test; - - bool uses_point_size; - bool uses_alpha; - bool uses_blend_alpha; - bool uses_alpha_clip; - bool uses_depth_pre_pass; - bool uses_discard; - bool uses_roughness; - bool uses_normal; - - bool unshaded; - bool uses_vertex; - bool uses_sss; - bool uses_transmittance; - bool uses_screen_texture; - bool uses_depth_texture; - bool uses_normal_texture; - bool uses_time; - bool writes_modelview_or_projection; - bool uses_world_coordinates; - - uint64_t last_pass = 0; - uint32_t index = 0; - - virtual void set_code(const String &p_Code); - virtual void set_default_texture_param(const StringName &p_name, RID p_texture); - virtual void get_param_list(List<PropertyInfo> *p_param_list) const; - void get_instance_param_list(List<RendererStorage::InstanceShaderParam> *p_param_list) const; - - virtual bool is_param_texture(const StringName &p_param) const; - virtual bool is_animated() const; - virtual bool casts_shadows() const; - virtual Variant get_default_parameter(const StringName &p_parameter) const; - virtual RS::ShaderNativeSourceCode get_native_source_code() const; - - ShaderData(); - virtual ~ShaderData(); - }; - - RendererStorageRD::ShaderData *_create_shader_func(); - static RendererStorageRD::ShaderData *_create_shader_funcs() { - return static_cast<RendererSceneRenderForwardClustered *>(singleton)->_create_shader_func(); - } - - struct MaterialData : public RendererStorageRD::MaterialData { - uint64_t last_frame; - ShaderData *shader_data; - RID uniform_buffer; - RID uniform_set; - Vector<RID> texture_cache; - Vector<uint8_t> ubo_data; - uint64_t last_pass = 0; - uint32_t index = 0; - RID next_pass; - uint8_t priority; - virtual void set_render_priority(int p_priority); - virtual void set_next_pass(RID p_pass); - virtual void update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty); - virtual ~MaterialData(); - }; - - RendererStorageRD::MaterialData *_create_material_func(ShaderData *p_shader); - static RendererStorageRD::MaterialData *_create_material_funcs(RendererStorageRD::ShaderData *p_shader) { - return static_cast<RendererSceneRenderForwardClustered *>(singleton)->_create_material_func(static_cast<ShaderData *>(p_shader)); - } + SceneShaderForwardClustered scene_shader; /* Framebuffer */ - struct RenderBufferDataForward : public RenderBufferData { + struct RenderBufferDataForwardClustered : public RenderBufferData { //for rendering, may be MSAAd RID color; @@ -244,13 +105,12 @@ class RendererSceneRenderForwardClustered : public RendererSceneRenderRD { void clear(); virtual void configure(RID p_color_buffer, RID p_depth_buffer, int p_width, int p_height, RS::ViewportMSAA p_msaa); - ~RenderBufferDataForward(); + ~RenderBufferDataForwardClustered(); }; virtual RenderBufferData *_create_render_buffer_data(); - void _allocate_normal_roughness_texture(RenderBufferDataForward *rb); + void _allocate_normal_roughness_texture(RenderBufferDataForwardClustered *rb); - RID shadow_sampler; RID render_base_uniform_set; LocalVector<RID> render_pass_uniform_sets; RID sdfgi_pass_uniform_set; @@ -258,7 +118,7 @@ class RendererSceneRenderForwardClustered : public RendererSceneRenderRD { uint64_t lightmap_texture_array_version = 0xFFFFFFFF; virtual void _base_uniforms_changed(); - void _render_buffers_clear_uniform_set(RenderBufferDataForward *rb); + void _render_buffers_clear_uniform_set(RenderBufferDataForwardClustered *rb); virtual void _render_buffers_uniform_set_changed(RID p_render_buffers); virtual RID _render_buffers_get_normal_texture(RID p_render_buffers); @@ -488,19 +348,7 @@ class RendererSceneRenderForwardClustered : public RendererSceneRenderRD { } scene_state; - static RendererSceneRenderForwardClustered *singleton; - - RID default_shader; - RID default_material; - RID overdraw_material_shader; - RID overdraw_material; - RID wireframe_material_shader; - RID wireframe_material; - RID default_shader_rd; - RID default_shader_sdfgi_rd; - - RID default_vec4_xform_buffer; - RID default_vec4_xform_uniform_set; + static RenderForwardClustered *singleton; void _setup_environment(RID p_environment, RID p_render_buffers, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform, RID p_reflection_probe, bool p_no_fog, const Size2i &p_screen_size, uint32_t p_cluster_size, uint32_t p_max_cluster_elements, RID p_shadow_atlas, bool p_flip_y, const Color &p_default_bg_color, float p_znear, float p_zfar, bool p_opaque_render_buffers = false, bool p_pancake_shadows = false, int p_index = 0); void _setup_giprobes(const PagedArray<RID> &p_giprobes); @@ -578,11 +426,11 @@ class RendererSceneRenderForwardClustered : public RendererSceneRenderRD { void *surface = nullptr; RID material_uniform_set; - ShaderData *shader = nullptr; + SceneShaderForwardClustered::ShaderData *shader = nullptr; void *surface_shadow = nullptr; RID material_uniform_set_shadow; - ShaderData *shader_shadow = nullptr; + SceneShaderForwardClustered::ShaderData *shader_shadow = nullptr; GeometryInstanceSurfaceDataCache *next = nullptr; GeometryInstanceForwardClustered *owner = nullptr; @@ -650,14 +498,12 @@ class RendererSceneRenderForwardClustered : public RendererSceneRenderRD { PagedAllocator<GeometryInstanceSurfaceDataCache> geometry_instance_surface_alloc; PagedAllocator<GeometryInstanceLightmapSH> geometry_instance_lightmap_sh; - void _geometry_instance_add_surface_with_material(GeometryInstanceForwardClustered *ginstance, uint32_t p_surface, MaterialData *p_material, uint32_t p_material_id, uint32_t p_shader_id, RID p_mesh); + void _geometry_instance_add_surface_with_material(GeometryInstanceForwardClustered *ginstance, uint32_t p_surface, SceneShaderForwardClustered::MaterialData *p_material, uint32_t p_material_id, uint32_t p_shader_id, RID p_mesh); void _geometry_instance_add_surface(GeometryInstanceForwardClustered *ginstance, uint32_t p_surface, RID p_material, RID p_mesh); void _geometry_instance_mark_dirty(GeometryInstance *p_geometry_instance); void _geometry_instance_update(GeometryInstance *p_geometry_instance); void _update_dirty_geometry_instances(); - bool low_end = false; - /* Render List */ struct RenderList { @@ -760,7 +606,8 @@ public: virtual bool free(RID p_rid); - RendererSceneRenderForwardClustered(RendererStorageRD *p_storage); - ~RendererSceneRenderForwardClustered(); + RenderForwardClustered(RendererStorageRD *p_storage); + ~RenderForwardClustered(); }; +} // namespace RendererSceneRenderImplementation #endif // !RENDERING_SERVER_SCENE_RENDER_FORWARD_CLUSTERED_H diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp new file mode 100644 index 0000000000..45f6384b5e --- /dev/null +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp @@ -0,0 +1,807 @@ +/*************************************************************************/ +/* scene_shader_forward_clustered.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "scene_shader_forward_clustered.h" +#include "core/config/project_settings.h" +#include "render_forward_clustered.h" + +using namespace RendererSceneRenderImplementation; + +void SceneShaderForwardClustered::ShaderData::set_code(const String &p_code) { + //compile + + code = p_code; + valid = false; + ubo_size = 0; + uniforms.clear(); + uses_screen_texture = false; + + if (code == String()) { + return; //just invalid, but no error + } + + ShaderCompilerRD::GeneratedCode gen_code; + + int blend_mode = BLEND_MODE_MIX; + int depth_testi = DEPTH_TEST_ENABLED; + int alpha_antialiasing_mode = ALPHA_ANTIALIASING_OFF; + int cull = CULL_BACK; + + uses_point_size = false; + uses_alpha = false; + uses_blend_alpha = false; + uses_depth_pre_pass = false; + uses_discard = false; + uses_roughness = false; + uses_normal = false; + bool wireframe = false; + + unshaded = false; + uses_vertex = false; + uses_sss = false; + uses_transmittance = false; + uses_screen_texture = false; + uses_depth_texture = false; + uses_normal_texture = false; + uses_time = false; + writes_modelview_or_projection = false; + uses_world_coordinates = false; + + int depth_drawi = DEPTH_DRAW_OPAQUE; + + ShaderCompilerRD::IdentifierActions actions; + + actions.render_mode_values["blend_add"] = Pair<int *, int>(&blend_mode, BLEND_MODE_ADD); + actions.render_mode_values["blend_mix"] = Pair<int *, int>(&blend_mode, BLEND_MODE_MIX); + actions.render_mode_values["blend_sub"] = Pair<int *, int>(&blend_mode, BLEND_MODE_SUB); + actions.render_mode_values["blend_mul"] = Pair<int *, int>(&blend_mode, BLEND_MODE_MUL); + + actions.render_mode_values["alpha_to_coverage"] = Pair<int *, int>(&alpha_antialiasing_mode, ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE); + actions.render_mode_values["alpha_to_coverage_and_one"] = Pair<int *, int>(&alpha_antialiasing_mode, ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE); + + actions.render_mode_values["depth_draw_never"] = Pair<int *, int>(&depth_drawi, DEPTH_DRAW_DISABLED); + actions.render_mode_values["depth_draw_opaque"] = Pair<int *, int>(&depth_drawi, DEPTH_DRAW_OPAQUE); + actions.render_mode_values["depth_draw_always"] = Pair<int *, int>(&depth_drawi, DEPTH_DRAW_ALWAYS); + + actions.render_mode_values["depth_test_disabled"] = Pair<int *, int>(&depth_testi, DEPTH_TEST_DISABLED); + + actions.render_mode_values["cull_disabled"] = Pair<int *, int>(&cull, CULL_DISABLED); + actions.render_mode_values["cull_front"] = Pair<int *, int>(&cull, CULL_FRONT); + actions.render_mode_values["cull_back"] = Pair<int *, int>(&cull, CULL_BACK); + + actions.render_mode_flags["unshaded"] = &unshaded; + actions.render_mode_flags["wireframe"] = &wireframe; + + actions.usage_flag_pointers["ALPHA"] = &uses_alpha; + actions.render_mode_flags["depth_prepass_alpha"] = &uses_depth_pre_pass; + + actions.usage_flag_pointers["SSS_STRENGTH"] = &uses_sss; + actions.usage_flag_pointers["SSS_TRANSMITTANCE_DEPTH"] = &uses_transmittance; + + actions.usage_flag_pointers["SCREEN_TEXTURE"] = &uses_screen_texture; + actions.usage_flag_pointers["DEPTH_TEXTURE"] = &uses_depth_texture; + actions.usage_flag_pointers["NORMAL_TEXTURE"] = &uses_normal_texture; + actions.usage_flag_pointers["DISCARD"] = &uses_discard; + actions.usage_flag_pointers["TIME"] = &uses_time; + actions.usage_flag_pointers["ROUGHNESS"] = &uses_roughness; + actions.usage_flag_pointers["NORMAL"] = &uses_normal; + actions.usage_flag_pointers["NORMAL_MAP"] = &uses_normal; + + actions.usage_flag_pointers["POINT_SIZE"] = &uses_point_size; + actions.usage_flag_pointers["POINT_COORD"] = &uses_point_size; + + actions.write_flag_pointers["MODELVIEW_MATRIX"] = &writes_modelview_or_projection; + actions.write_flag_pointers["PROJECTION_MATRIX"] = &writes_modelview_or_projection; + actions.write_flag_pointers["VERTEX"] = &uses_vertex; + + actions.uniforms = &uniforms; + + SceneShaderForwardClustered *shader_singleton = (SceneShaderForwardClustered *)SceneShaderForwardClustered::singleton; + Error err = shader_singleton->compiler.compile(RS::SHADER_SPATIAL, code, &actions, path, gen_code); + + ERR_FAIL_COND(err != OK); + + if (version.is_null()) { + version = shader_singleton->shader.version_create(); + } + + depth_draw = DepthDraw(depth_drawi); + depth_test = DepthTest(depth_testi); + +#if 0 + print_line("**compiling shader:"); + print_line("**defines:\n"); + for (int i = 0; i < gen_code.defines.size(); i++) { + print_line(gen_code.defines[i]); + } + print_line("\n**uniforms:\n" + gen_code.uniforms); + print_line("\n**vertex_globals:\n" + gen_code.vertex_global); + print_line("\n**vertex_code:\n" + gen_code.vertex); + print_line("\n**fragment_globals:\n" + gen_code.fragment_global); + print_line("\n**fragment_code:\n" + gen_code.fragment); + print_line("\n**light_code:\n" + gen_code.light); +#endif + shader_singleton->shader.version_set_code(version, gen_code.uniforms, gen_code.vertex_global, gen_code.vertex, gen_code.fragment_global, gen_code.light, gen_code.fragment, gen_code.defines); + ERR_FAIL_COND(!shader_singleton->shader.version_is_valid(version)); + + ubo_size = gen_code.uniform_total_size; + ubo_offsets = gen_code.uniform_offsets; + texture_uniforms = gen_code.texture_uniforms; + + //blend modes + + // if any form of Alpha Antialiasing is enabled, set the blend mode to alpha to coverage + if (alpha_antialiasing_mode != ALPHA_ANTIALIASING_OFF) { + blend_mode = BLEND_MODE_ALPHA_TO_COVERAGE; + } + + RD::PipelineColorBlendState::Attachment blend_attachment; + + switch (blend_mode) { + case BLEND_MODE_MIX: { + blend_attachment.enable_blend = true; + blend_attachment.alpha_blend_op = RD::BLEND_OP_ADD; + blend_attachment.color_blend_op = RD::BLEND_OP_ADD; + blend_attachment.src_color_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; + blend_attachment.dst_color_blend_factor = RD::BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; + blend_attachment.src_alpha_blend_factor = RD::BLEND_FACTOR_ONE; + blend_attachment.dst_alpha_blend_factor = RD::BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; + + } break; + case BLEND_MODE_ADD: { + blend_attachment.enable_blend = true; + blend_attachment.alpha_blend_op = RD::BLEND_OP_ADD; + blend_attachment.color_blend_op = RD::BLEND_OP_ADD; + blend_attachment.src_color_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; + blend_attachment.dst_color_blend_factor = RD::BLEND_FACTOR_ONE; + blend_attachment.src_alpha_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; + blend_attachment.dst_alpha_blend_factor = RD::BLEND_FACTOR_ONE; + uses_blend_alpha = true; //force alpha used because of blend + + } break; + case BLEND_MODE_SUB: { + blend_attachment.enable_blend = true; + blend_attachment.alpha_blend_op = RD::BLEND_OP_SUBTRACT; + blend_attachment.color_blend_op = RD::BLEND_OP_SUBTRACT; + blend_attachment.src_color_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; + blend_attachment.dst_color_blend_factor = RD::BLEND_FACTOR_ONE; + blend_attachment.src_alpha_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; + blend_attachment.dst_alpha_blend_factor = RD::BLEND_FACTOR_ONE; + uses_blend_alpha = true; //force alpha used because of blend + + } break; + case BLEND_MODE_MUL: { + blend_attachment.enable_blend = true; + blend_attachment.alpha_blend_op = RD::BLEND_OP_ADD; + blend_attachment.color_blend_op = RD::BLEND_OP_ADD; + blend_attachment.src_color_blend_factor = RD::BLEND_FACTOR_DST_COLOR; + blend_attachment.dst_color_blend_factor = RD::BLEND_FACTOR_ZERO; + blend_attachment.src_alpha_blend_factor = RD::BLEND_FACTOR_DST_ALPHA; + blend_attachment.dst_alpha_blend_factor = RD::BLEND_FACTOR_ZERO; + uses_blend_alpha = true; //force alpha used because of blend + } break; + case BLEND_MODE_ALPHA_TO_COVERAGE: { + blend_attachment.enable_blend = true; + blend_attachment.alpha_blend_op = RD::BLEND_OP_ADD; + blend_attachment.color_blend_op = RD::BLEND_OP_ADD; + blend_attachment.src_color_blend_factor = RD::BLEND_FACTOR_SRC_ALPHA; + blend_attachment.dst_color_blend_factor = RD::BLEND_FACTOR_ONE_MINUS_SRC_ALPHA; + blend_attachment.src_alpha_blend_factor = RD::BLEND_FACTOR_ONE; + blend_attachment.dst_alpha_blend_factor = RD::BLEND_FACTOR_ZERO; + } + } + + RD::PipelineColorBlendState blend_state_blend; + blend_state_blend.attachments.push_back(blend_attachment); + RD::PipelineColorBlendState blend_state_opaque = RD::PipelineColorBlendState::create_disabled(1); + RD::PipelineColorBlendState blend_state_opaque_specular = RD::PipelineColorBlendState::create_disabled(2); + RD::PipelineColorBlendState blend_state_depth_normal_roughness = RD::PipelineColorBlendState::create_disabled(1); + RD::PipelineColorBlendState blend_state_depth_normal_roughness_giprobe = RD::PipelineColorBlendState::create_disabled(2); + + //update pipelines + + RD::PipelineDepthStencilState depth_stencil_state; + + if (depth_test != DEPTH_TEST_DISABLED) { + depth_stencil_state.enable_depth_test = true; + depth_stencil_state.depth_compare_operator = RD::COMPARE_OP_LESS_OR_EQUAL; + depth_stencil_state.enable_depth_write = depth_draw != DEPTH_DRAW_DISABLED ? true : false; + } + + for (int i = 0; i < CULL_VARIANT_MAX; i++) { + RD::PolygonCullMode cull_mode_rd_table[CULL_VARIANT_MAX][3] = { + { RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_FRONT, RD::POLYGON_CULL_BACK }, + { RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_BACK, RD::POLYGON_CULL_FRONT }, + { RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_DISABLED, RD::POLYGON_CULL_DISABLED } + }; + + RD::PolygonCullMode cull_mode_rd = cull_mode_rd_table[i][cull]; + + for (int j = 0; j < RS::PRIMITIVE_MAX; j++) { + RD::RenderPrimitive primitive_rd_table[RS::PRIMITIVE_MAX] = { + RD::RENDER_PRIMITIVE_POINTS, + RD::RENDER_PRIMITIVE_LINES, + RD::RENDER_PRIMITIVE_LINESTRIPS, + RD::RENDER_PRIMITIVE_TRIANGLES, + RD::RENDER_PRIMITIVE_TRIANGLE_STRIPS, + }; + + RD::RenderPrimitive primitive_rd = uses_point_size ? RD::RENDER_PRIMITIVE_POINTS : primitive_rd_table[j]; + + for (int k = 0; k < SHADER_VERSION_MAX; k++) { + if (!static_cast<SceneShaderForwardClustered *>(singleton)->shader.is_variant_enabled(k)) { + continue; + } + RD::PipelineRasterizationState raster_state; + raster_state.cull_mode = cull_mode_rd; + raster_state.wireframe = wireframe; + + RD::PipelineColorBlendState blend_state; + RD::PipelineDepthStencilState depth_stencil = depth_stencil_state; + RD::PipelineMultisampleState multisample_state; + + if (uses_alpha || uses_blend_alpha) { + // only allow these flags to go through if we have some form of msaa + if (alpha_antialiasing_mode == ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE) { + multisample_state.enable_alpha_to_coverage = true; + } else if (alpha_antialiasing_mode == ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE) { + multisample_state.enable_alpha_to_coverage = true; + multisample_state.enable_alpha_to_one = true; + } + + if (k == SHADER_VERSION_COLOR_PASS || k == SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS) { + blend_state = blend_state_blend; + if (depth_draw == DEPTH_DRAW_OPAQUE) { + depth_stencil.enable_depth_write = false; //alpha does not draw depth + } + } else if (uses_depth_pre_pass && (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP || k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS || k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL)) { + if (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP) { + //none, blend state contains nothing + } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL) { + blend_state = RD::PipelineColorBlendState::create_disabled(5); //writes to normal and roughness in opaque way + } else { + blend_state = blend_state_opaque; //writes to normal and roughness in opaque way + } + } else { + pipelines[i][j][k].clear(); + continue; // do not use this version (will error if using it is attempted) + } + } else { + if (k == SHADER_VERSION_COLOR_PASS || k == SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI || k == SHADER_VERSION_LIGHTMAP_COLOR_PASS) { + blend_state = blend_state_opaque; + } else if (k == SHADER_VERSION_DEPTH_PASS || k == SHADER_VERSION_DEPTH_PASS_DP) { + //none, leave empty + } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS) { + blend_state = blend_state_depth_normal_roughness; + } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_GIPROBE) { + blend_state = blend_state_depth_normal_roughness_giprobe; + } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL) { + blend_state = RD::PipelineColorBlendState::create_disabled(5); //writes to normal and roughness in opaque way + } else if (k == SHADER_VERSION_DEPTH_PASS_WITH_SDF) { + blend_state = RD::PipelineColorBlendState(); //no color targets for SDF + } else { + //specular write + blend_state = blend_state_opaque_specular; + depth_stencil.enable_depth_test = false; + depth_stencil.enable_depth_write = false; + } + } + + RID shader_variant = shader_singleton->shader.version_get_shader(version, k); + pipelines[i][j][k].setup(shader_variant, primitive_rd, raster_state, multisample_state, depth_stencil, blend_state, 0); + } + } + } + + valid = true; +} + +void SceneShaderForwardClustered::ShaderData::set_default_texture_param(const StringName &p_name, RID p_texture) { + if (!p_texture.is_valid()) { + default_texture_params.erase(p_name); + } else { + default_texture_params[p_name] = p_texture; + } +} + +void SceneShaderForwardClustered::ShaderData::get_param_list(List<PropertyInfo> *p_param_list) const { + Map<int, StringName> order; + + for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = uniforms.front(); E; E = E->next()) { + if (E->get().scope != ShaderLanguage::ShaderNode::Uniform::SCOPE_LOCAL) { + continue; + } + + if (E->get().texture_order >= 0) { + order[E->get().texture_order + 100000] = E->key(); + } else { + order[E->get().order] = E->key(); + } + } + + for (Map<int, StringName>::Element *E = order.front(); E; E = E->next()) { + PropertyInfo pi = ShaderLanguage::uniform_to_property_info(uniforms[E->get()]); + pi.name = E->get(); + p_param_list->push_back(pi); + } +} + +void SceneShaderForwardClustered::ShaderData::get_instance_param_list(List<RendererStorage::InstanceShaderParam> *p_param_list) const { + for (Map<StringName, ShaderLanguage::ShaderNode::Uniform>::Element *E = uniforms.front(); E; E = E->next()) { + if (E->get().scope != ShaderLanguage::ShaderNode::Uniform::SCOPE_INSTANCE) { + continue; + } + + RendererStorage::InstanceShaderParam p; + p.info = ShaderLanguage::uniform_to_property_info(E->get()); + p.info.name = E->key(); //supply name + p.index = E->get().instance_index; + p.default_value = ShaderLanguage::constant_value_to_variant(E->get().default_value, E->get().type, E->get().hint); + p_param_list->push_back(p); + } +} + +bool SceneShaderForwardClustered::ShaderData::is_param_texture(const StringName &p_param) const { + if (!uniforms.has(p_param)) { + return false; + } + + return uniforms[p_param].texture_order >= 0; +} + +bool SceneShaderForwardClustered::ShaderData::is_animated() const { + return false; +} + +bool SceneShaderForwardClustered::ShaderData::casts_shadows() const { + return false; +} + +Variant SceneShaderForwardClustered::ShaderData::get_default_parameter(const StringName &p_parameter) const { + if (uniforms.has(p_parameter)) { + ShaderLanguage::ShaderNode::Uniform uniform = uniforms[p_parameter]; + Vector<ShaderLanguage::ConstantNode::Value> default_value = uniform.default_value; + return ShaderLanguage::constant_value_to_variant(default_value, uniform.type, uniform.hint); + } + return Variant(); +} + +RS::ShaderNativeSourceCode SceneShaderForwardClustered::ShaderData::get_native_source_code() const { + SceneShaderForwardClustered *shader_singleton = (SceneShaderForwardClustered *)SceneShaderForwardClustered::singleton; + + return shader_singleton->shader.version_get_native_source_code(version); +} + +SceneShaderForwardClustered::ShaderData::ShaderData() { + valid = false; + uses_screen_texture = false; +} + +SceneShaderForwardClustered::ShaderData::~ShaderData() { + SceneShaderForwardClustered *shader_singleton = (SceneShaderForwardClustered *)SceneShaderForwardClustered::singleton; + ERR_FAIL_COND(!shader_singleton); + //pipeline variants will clear themselves if shader is gone + if (version.is_valid()) { + shader_singleton->shader.version_free(version); + } +} + +RendererStorageRD::ShaderData *SceneShaderForwardClustered::_create_shader_func() { + ShaderData *shader_data = memnew(ShaderData); + return shader_data; +} + +void SceneShaderForwardClustered::MaterialData::set_render_priority(int p_priority) { + priority = p_priority - RS::MATERIAL_RENDER_PRIORITY_MIN; //8 bits +} + +void SceneShaderForwardClustered::MaterialData::set_next_pass(RID p_pass) { + next_pass = p_pass; +} + +void SceneShaderForwardClustered::MaterialData::update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty) { + SceneShaderForwardClustered *shader_singleton = (SceneShaderForwardClustered *)SceneShaderForwardClustered::singleton; + + if ((uint32_t)ubo_data.size() != shader_data->ubo_size) { + p_uniform_dirty = true; + if (uniform_buffer.is_valid()) { + RD::get_singleton()->free(uniform_buffer); + uniform_buffer = RID(); + } + + ubo_data.resize(shader_data->ubo_size); + if (ubo_data.size()) { + uniform_buffer = RD::get_singleton()->uniform_buffer_create(ubo_data.size()); + memset(ubo_data.ptrw(), 0, ubo_data.size()); //clear + } + + //clear previous uniform set + if (uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(uniform_set)) { + RD::get_singleton()->free(uniform_set); + uniform_set = RID(); + } + } + + //check whether buffer changed + if (p_uniform_dirty && ubo_data.size()) { + update_uniform_buffer(shader_data->uniforms, shader_data->ubo_offsets.ptr(), p_parameters, ubo_data.ptrw(), ubo_data.size(), false); + RD::get_singleton()->buffer_update(uniform_buffer, 0, ubo_data.size(), ubo_data.ptrw(), RD::BARRIER_MASK_RASTER); + } + + uint32_t tex_uniform_count = shader_data->texture_uniforms.size(); + + if ((uint32_t)texture_cache.size() != tex_uniform_count) { + texture_cache.resize(tex_uniform_count); + p_textures_dirty = true; + + //clear previous uniform set + if (uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(uniform_set)) { + RD::get_singleton()->free(uniform_set); + uniform_set = RID(); + } + } + + if (p_textures_dirty && tex_uniform_count) { + update_textures(p_parameters, shader_data->default_texture_params, shader_data->texture_uniforms, texture_cache.ptrw(), true); + } + + if (shader_data->ubo_size == 0 && shader_data->texture_uniforms.size() == 0) { + // This material does not require an uniform set, so don't create it. + return; + } + + if (!p_textures_dirty && uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(uniform_set)) { + //no reason to update uniform set, only UBO (or nothing) was needed to update + return; + } + + Vector<RD::Uniform> uniforms; + + { + if (shader_data->ubo_size) { + RD::Uniform u; + u.uniform_type = RD::UNIFORM_TYPE_UNIFORM_BUFFER; + u.binding = 0; + u.ids.push_back(uniform_buffer); + uniforms.push_back(u); + } + + const RID *textures = texture_cache.ptrw(); + for (uint32_t i = 0; i < tex_uniform_count; i++) { + RD::Uniform u; + u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; + u.binding = 1 + i; + u.ids.push_back(textures[i]); + uniforms.push_back(u); + } + } + + uniform_set = RD::get_singleton()->uniform_set_create(uniforms, shader_singleton->shader.version_get_shader(shader_data->version, 0), RenderForwardClustered::MATERIAL_UNIFORM_SET); +} + +SceneShaderForwardClustered::MaterialData::~MaterialData() { + if (uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(uniform_set)) { + RD::get_singleton()->free(uniform_set); + } + + if (uniform_buffer.is_valid()) { + RD::get_singleton()->free(uniform_buffer); + } +} + +RendererStorageRD::MaterialData *SceneShaderForwardClustered::_create_material_func(ShaderData *p_shader) { + MaterialData *material_data = memnew(MaterialData); + material_data->shader_data = p_shader; + material_data->last_frame = false; + //update will happen later anyway so do nothing. + return material_data; +} + +SceneShaderForwardClustered *SceneShaderForwardClustered::singleton = nullptr; + +SceneShaderForwardClustered::SceneShaderForwardClustered() { + // there should be only one of these, contained within our RenderFM singleton. + singleton = this; +} + +SceneShaderForwardClustered::~SceneShaderForwardClustered() { + RD::get_singleton()->free(default_vec4_xform_buffer); + RD::get_singleton()->free(shadow_sampler); + + storage->free(wireframe_material_shader); + storage->free(overdraw_material_shader); + storage->free(default_shader); + + storage->free(wireframe_material); + storage->free(overdraw_material); + storage->free(default_material); +} + +void SceneShaderForwardClustered::init(RendererStorageRD *p_storage, const String p_defines) { + storage = p_storage; + + { + Vector<String> shader_versions; + shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n"); + shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_DUAL_PARABOLOID\n"); + shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_NORMAL_ROUGHNESS\n"); + shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_NORMAL_ROUGHNESS\n#define MODE_RENDER_GIPROBE\n"); + shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_MATERIAL\n"); + shader_versions.push_back("\n#define MODE_RENDER_DEPTH\n#define MODE_RENDER_SDF\n"); + shader_versions.push_back(""); + shader_versions.push_back("\n#define USE_FORWARD_GI\n"); + shader_versions.push_back("\n#define MODE_MULTIPLE_RENDER_TARGETS\n"); + shader_versions.push_back("\n#define USE_LIGHTMAP\n"); + shader_versions.push_back("\n#define MODE_MULTIPLE_RENDER_TARGETS\n#define USE_LIGHTMAP\n"); + shader.initialize(shader_versions, p_defines); + + /* + if (p_is_low_end) { + //disable the high end versions + shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS, false); + shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_GIPROBE, false); + shader.set_variant_enabled(SHADER_VERSION_DEPTH_PASS_WITH_SDF, false); + shader.set_variant_enabled(SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI, false); + shader.set_variant_enabled(SHADER_VERSION_COLOR_PASS_WITH_SEPARATE_SPECULAR, false); + shader.set_variant_enabled(SHADER_VERSION_LIGHTMAP_COLOR_PASS_WITH_SEPARATE_SPECULAR, false); + } + */ + } + + storage->shader_set_data_request_function(RendererStorageRD::SHADER_TYPE_3D, _create_shader_funcs); + storage->material_set_data_request_function(RendererStorageRD::SHADER_TYPE_3D, _create_material_funcs); + + { + //shader compiler + ShaderCompilerRD::DefaultIdentifierActions actions; + + actions.renames["WORLD_MATRIX"] = "world_matrix"; + actions.renames["WORLD_NORMAL_MATRIX"] = "world_normal_matrix"; + actions.renames["INV_CAMERA_MATRIX"] = "scene_data.inv_camera_matrix"; + actions.renames["CAMERA_MATRIX"] = "scene_data.camera_matrix"; + actions.renames["PROJECTION_MATRIX"] = "projection_matrix"; + actions.renames["INV_PROJECTION_MATRIX"] = "scene_data.inv_projection_matrix"; + actions.renames["MODELVIEW_MATRIX"] = "modelview"; + actions.renames["MODELVIEW_NORMAL_MATRIX"] = "modelview_normal"; + + actions.renames["VERTEX"] = "vertex"; + actions.renames["NORMAL"] = "normal"; + actions.renames["TANGENT"] = "tangent"; + actions.renames["BINORMAL"] = "binormal"; + actions.renames["POSITION"] = "position"; + actions.renames["UV"] = "uv_interp"; + actions.renames["UV2"] = "uv2_interp"; + actions.renames["COLOR"] = "color_interp"; + actions.renames["POINT_SIZE"] = "gl_PointSize"; + actions.renames["INSTANCE_ID"] = "gl_InstanceIndex"; + + actions.renames["ALPHA_SCISSOR_THRESHOLD"] = "alpha_scissor_threshold"; + actions.renames["ALPHA_HASH_SCALE"] = "alpha_hash_scale"; + actions.renames["ALPHA_ANTIALIASING_EDGE"] = "alpha_antialiasing_edge"; + actions.renames["ALPHA_TEXTURE_COORDINATE"] = "alpha_texture_coordinate"; + + //builtins + + actions.renames["TIME"] = "scene_data.time"; + actions.renames["VIEWPORT_SIZE"] = "scene_data.viewport_size"; + + actions.renames["FRAGCOORD"] = "gl_FragCoord"; + actions.renames["FRONT_FACING"] = "gl_FrontFacing"; + actions.renames["NORMAL_MAP"] = "normal_map"; + actions.renames["NORMAL_MAP_DEPTH"] = "normal_map_depth"; + actions.renames["ALBEDO"] = "albedo"; + actions.renames["ALPHA"] = "alpha"; + actions.renames["METALLIC"] = "metallic"; + actions.renames["SPECULAR"] = "specular"; + actions.renames["ROUGHNESS"] = "roughness"; + actions.renames["RIM"] = "rim"; + actions.renames["RIM_TINT"] = "rim_tint"; + actions.renames["CLEARCOAT"] = "clearcoat"; + actions.renames["CLEARCOAT_GLOSS"] = "clearcoat_gloss"; + actions.renames["ANISOTROPY"] = "anisotropy"; + actions.renames["ANISOTROPY_FLOW"] = "anisotropy_flow"; + actions.renames["SSS_STRENGTH"] = "sss_strength"; + actions.renames["SSS_TRANSMITTANCE_COLOR"] = "transmittance_color"; + actions.renames["SSS_TRANSMITTANCE_DEPTH"] = "transmittance_depth"; + actions.renames["SSS_TRANSMITTANCE_CURVE"] = "transmittance_curve"; + actions.renames["SSS_TRANSMITTANCE_BOOST"] = "transmittance_boost"; + actions.renames["BACKLIGHT"] = "backlight"; + actions.renames["AO"] = "ao"; + actions.renames["AO_LIGHT_AFFECT"] = "ao_light_affect"; + actions.renames["EMISSION"] = "emission"; + actions.renames["POINT_COORD"] = "gl_PointCoord"; + actions.renames["INSTANCE_CUSTOM"] = "instance_custom"; + actions.renames["SCREEN_UV"] = "screen_uv"; + actions.renames["SCREEN_TEXTURE"] = "color_buffer"; + actions.renames["DEPTH_TEXTURE"] = "depth_buffer"; + actions.renames["NORMAL_ROUGHNESS_TEXTURE"] = "normal_roughness_buffer"; + actions.renames["DEPTH"] = "gl_FragDepth"; + actions.renames["OUTPUT_IS_SRGB"] = "true"; + actions.renames["FOG"] = "custom_fog"; + actions.renames["RADIANCE"] = "custom_radiance"; + actions.renames["IRRADIANCE"] = "custom_irradiance"; + actions.renames["BONE_INDICES"] = "bone_attrib"; + actions.renames["BONE_WEIGHTS"] = "weight_attrib"; + actions.renames["CUSTOM0"] = "custom0_attrib"; + actions.renames["CUSTOM1"] = "custom1_attrib"; + actions.renames["CUSTOM2"] = "custom2_attrib"; + actions.renames["CUSTOM3"] = "custom3_attrib"; + + //for light + actions.renames["VIEW"] = "view"; + actions.renames["LIGHT_COLOR"] = "light_color"; + actions.renames["LIGHT"] = "light"; + actions.renames["ATTENUATION"] = "attenuation"; + actions.renames["SHADOW_ATTENUATION"] = "shadow_attenuation"; + actions.renames["DIFFUSE_LIGHT"] = "diffuse_light"; + actions.renames["SPECULAR_LIGHT"] = "specular_light"; + + actions.usage_defines["NORMAL"] = "#define NORMAL_USED\n"; + actions.usage_defines["TANGENT"] = "#define TANGENT_USED\n"; + actions.usage_defines["BINORMAL"] = "@TANGENT"; + actions.usage_defines["RIM"] = "#define LIGHT_RIM_USED\n"; + actions.usage_defines["RIM_TINT"] = "@RIM"; + actions.usage_defines["CLEARCOAT"] = "#define LIGHT_CLEARCOAT_USED\n"; + actions.usage_defines["CLEARCOAT_GLOSS"] = "@CLEARCOAT"; + actions.usage_defines["ANISOTROPY"] = "#define LIGHT_ANISOTROPY_USED\n"; + actions.usage_defines["ANISOTROPY_FLOW"] = "@ANISOTROPY"; + actions.usage_defines["AO"] = "#define AO_USED\n"; + actions.usage_defines["AO_LIGHT_AFFECT"] = "#define AO_USED\n"; + actions.usage_defines["UV"] = "#define UV_USED\n"; + actions.usage_defines["UV2"] = "#define UV2_USED\n"; + actions.usage_defines["BONE_INDICES"] = "#define BONES_USED\n"; + actions.usage_defines["BONE_WEIGHTS"] = "#define WEIGHTS_USED\n"; + actions.usage_defines["CUSTOM0"] = "#define CUSTOM0\n"; + actions.usage_defines["CUSTOM1"] = "#define CUSTOM1\n"; + actions.usage_defines["CUSTOM2"] = "#define CUSTOM2\n"; + actions.usage_defines["CUSTOM3"] = "#define CUSTOM3\n"; + actions.usage_defines["NORMAL_MAP"] = "#define NORMAL_MAP_USED\n"; + actions.usage_defines["NORMAL_MAP_DEPTH"] = "@NORMAL_MAP"; + actions.usage_defines["COLOR"] = "#define COLOR_USED\n"; + actions.usage_defines["INSTANCE_CUSTOM"] = "#define ENABLE_INSTANCE_CUSTOM\n"; + actions.usage_defines["POSITION"] = "#define OVERRIDE_POSITION\n"; + + actions.usage_defines["ALPHA_SCISSOR_THRESHOLD"] = "#define ALPHA_SCISSOR_USED\n"; + actions.usage_defines["ALPHA_HASH_SCALE"] = "#define ALPHA_HASH_USED\n"; + actions.usage_defines["ALPHA_ANTIALIASING_EDGE"] = "#define ALPHA_ANTIALIASING_EDGE_USED\n"; + actions.usage_defines["ALPHA_TEXTURE_COORDINATE"] = "@ALPHA_ANTIALIASING_EDGE"; + + actions.usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n"; + actions.usage_defines["SSS_TRANSMITTANCE_DEPTH"] = "#define ENABLE_TRANSMITTANCE\n"; + actions.usage_defines["BACKLIGHT"] = "#define LIGHT_BACKLIGHT_USED\n"; + actions.usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n"; + actions.usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n"; + + actions.usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n"; + actions.usage_defines["SPECULAR_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n"; + + actions.usage_defines["FOG"] = "#define CUSTOM_FOG_USED\n"; + actions.usage_defines["RADIANCE"] = "#define CUSTOM_RADIANCE_USED\n"; + actions.usage_defines["IRRADIANCE"] = "#define CUSTOM_IRRADIANCE_USED\n"; + + actions.render_mode_defines["skip_vertex_transform"] = "#define SKIP_TRANSFORM_USED\n"; + actions.render_mode_defines["world_vertex_coords"] = "#define VERTEX_WORLD_COORDS_USED\n"; + actions.render_mode_defines["ensure_correct_normals"] = "#define ENSURE_CORRECT_NORMALS\n"; + actions.render_mode_defines["cull_front"] = "#define DO_SIDE_CHECK\n"; + actions.render_mode_defines["cull_disabled"] = "#define DO_SIDE_CHECK\n"; + + bool force_lambert = GLOBAL_GET("rendering/shading/overrides/force_lambert_over_burley"); + + if (!force_lambert) { + actions.render_mode_defines["diffuse_burley"] = "#define DIFFUSE_BURLEY\n"; + } + + actions.render_mode_defines["diffuse_oren_nayar"] = "#define DIFFUSE_OREN_NAYAR\n"; + actions.render_mode_defines["diffuse_lambert_wrap"] = "#define DIFFUSE_LAMBERT_WRAP\n"; + actions.render_mode_defines["diffuse_toon"] = "#define DIFFUSE_TOON\n"; + + actions.render_mode_defines["sss_mode_skin"] = "#define SSS_MODE_SKIN\n"; + + bool force_blinn = GLOBAL_GET("rendering/shading/overrides/force_blinn_over_ggx"); + + if (!force_blinn) { + actions.render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_SCHLICK_GGX\n"; + } else { + actions.render_mode_defines["specular_schlick_ggx"] = "#define SPECULAR_BLINN\n"; + } + + actions.render_mode_defines["specular_blinn"] = "#define SPECULAR_BLINN\n"; + actions.render_mode_defines["specular_phong"] = "#define SPECULAR_PHONG\n"; + actions.render_mode_defines["specular_toon"] = "#define SPECULAR_TOON\n"; + actions.render_mode_defines["specular_disabled"] = "#define SPECULAR_DISABLED\n"; + actions.render_mode_defines["shadows_disabled"] = "#define SHADOWS_DISABLED\n"; + actions.render_mode_defines["ambient_light_disabled"] = "#define AMBIENT_LIGHT_DISABLED\n"; + actions.render_mode_defines["shadow_to_opacity"] = "#define USE_SHADOW_TO_OPACITY\n"; + actions.render_mode_defines["unshaded"] = "#define MODE_UNSHADED\n"; + + actions.sampler_array_name = "material_samplers"; + actions.base_texture_binding_index = 1; + actions.texture_layout_set = RenderForwardClustered::MATERIAL_UNIFORM_SET; + actions.base_uniform_string = "material."; + actions.base_varying_index = 10; + + actions.default_filter = ShaderLanguage::FILTER_LINEAR_MIPMAP; + actions.default_repeat = ShaderLanguage::REPEAT_ENABLE; + actions.global_buffer_array_variable = "global_variables.data"; + actions.instance_uniform_index_variable = "draw_call.instance_uniforms_ofs"; + + compiler.initialize(actions); + } + + { + //default material and shader + default_shader = storage->shader_allocate(); + storage->shader_initialize(default_shader); + storage->shader_set_code(default_shader, "shader_type spatial; void vertex() { ROUGHNESS = 0.8; } void fragment() { ALBEDO=vec3(0.6); ROUGHNESS=0.8; METALLIC=0.2; } \n"); + default_material = storage->material_allocate(); + storage->material_initialize(default_material); + storage->material_set_shader(default_material, default_shader); + + MaterialData *md = (MaterialData *)storage->material_get_data(default_material, RendererStorageRD::SHADER_TYPE_3D); + default_shader_rd = shader.version_get_shader(md->shader_data->version, SHADER_VERSION_COLOR_PASS); + default_shader_sdfgi_rd = shader.version_get_shader(md->shader_data->version, SHADER_VERSION_DEPTH_PASS_WITH_SDF); + } + + { + overdraw_material_shader = storage->shader_allocate(); + storage->shader_initialize(overdraw_material_shader); + storage->shader_set_code(overdraw_material_shader, "shader_type spatial;\nrender_mode blend_add,unshaded;\n void fragment() { ALBEDO=vec3(0.4,0.8,0.8); ALPHA=0.2; }"); + overdraw_material = storage->material_allocate(); + storage->material_initialize(overdraw_material); + storage->material_set_shader(overdraw_material, overdraw_material_shader); + + wireframe_material_shader = storage->shader_allocate(); + storage->shader_initialize(wireframe_material_shader); + storage->shader_set_code(wireframe_material_shader, "shader_type spatial;\nrender_mode wireframe,unshaded;\n void fragment() { ALBEDO=vec3(0.0,0.0,0.0); }"); + wireframe_material = storage->material_allocate(); + storage->material_initialize(wireframe_material); + storage->material_set_shader(wireframe_material, wireframe_material_shader); + } + + { + default_vec4_xform_buffer = RD::get_singleton()->storage_buffer_create(256); + Vector<RD::Uniform> uniforms; + RD::Uniform u; + u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER; + u.ids.push_back(default_vec4_xform_buffer); + u.binding = 0; + uniforms.push_back(u); + + default_vec4_xform_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, default_shader_rd, RenderForwardClustered::TRANSFORMS_UNIFORM_SET); + } + { + RD::SamplerState sampler; + sampler.mag_filter = RD::SAMPLER_FILTER_LINEAR; + sampler.min_filter = RD::SAMPLER_FILTER_LINEAR; + sampler.enable_compare = true; + sampler.compare_op = RD::COMPARE_OP_LESS; + shadow_sampler = RD::get_singleton()->sampler_create(sampler); + } +} diff --git a/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h new file mode 100644 index 0000000000..953a5291c8 --- /dev/null +++ b/servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.h @@ -0,0 +1,210 @@ +/*************************************************************************/ +/* scene_shader_forward_clustered.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef RSSR_SCENE_SHADER_FC_H +#define RSSR_SCENE_SHADER_FC_H + +#include "servers/rendering/renderer_rd/renderer_scene_render_rd.h" +#include "servers/rendering/renderer_rd/renderer_storage_rd.h" +#include "servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl.gen.h" + +namespace RendererSceneRenderImplementation { + +class SceneShaderForwardClustered { +private: + static SceneShaderForwardClustered *singleton; + +public: + RendererStorageRD *storage; + + enum ShaderVersion { + SHADER_VERSION_DEPTH_PASS, + SHADER_VERSION_DEPTH_PASS_DP, + SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS, + SHADER_VERSION_DEPTH_PASS_WITH_NORMAL_AND_ROUGHNESS_AND_GIPROBE, + SHADER_VERSION_DEPTH_PASS_WITH_MATERIAL, + SHADER_VERSION_DEPTH_PASS_WITH_SDF, + SHADER_VERSION_COLOR_PASS, + SHADER_VERSION_COLOR_PASS_WITH_FORWARD_GI, + SHADER_VERSION_COLOR_PASS_WITH_SEPARATE_SPECULAR, + SHADER_VERSION_LIGHTMAP_COLOR_PASS, + SHADER_VERSION_LIGHTMAP_COLOR_PASS_WITH_SEPARATE_SPECULAR, + SHADER_VERSION_MAX + }; + + struct ShaderData : public RendererStorageRD::ShaderData { + enum BlendMode { //used internally + BLEND_MODE_MIX, + BLEND_MODE_ADD, + BLEND_MODE_SUB, + BLEND_MODE_MUL, + BLEND_MODE_ALPHA_TO_COVERAGE + }; + + enum DepthDraw { + DEPTH_DRAW_DISABLED, + DEPTH_DRAW_OPAQUE, + DEPTH_DRAW_ALWAYS + }; + + enum DepthTest { + DEPTH_TEST_DISABLED, + DEPTH_TEST_ENABLED + }; + + enum Cull { + CULL_DISABLED, + CULL_FRONT, + CULL_BACK + }; + + enum CullVariant { + CULL_VARIANT_NORMAL, + CULL_VARIANT_REVERSED, + CULL_VARIANT_DOUBLE_SIDED, + CULL_VARIANT_MAX + + }; + + enum AlphaAntiAliasing { + ALPHA_ANTIALIASING_OFF, + ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE, + ALPHA_ANTIALIASING_ALPHA_TO_COVERAGE_AND_TO_ONE + }; + + bool valid; + RID version; + uint32_t vertex_input_mask; + PipelineCacheRD pipelines[CULL_VARIANT_MAX][RS::PRIMITIVE_MAX][SHADER_VERSION_MAX]; + + String path; + + Map<StringName, ShaderLanguage::ShaderNode::Uniform> uniforms; + Vector<ShaderCompilerRD::GeneratedCode::Texture> texture_uniforms; + + Vector<uint32_t> ubo_offsets; + uint32_t ubo_size; + + String code; + Map<StringName, RID> default_texture_params; + + DepthDraw depth_draw; + DepthTest depth_test; + + bool uses_point_size; + bool uses_alpha; + bool uses_blend_alpha; + bool uses_alpha_clip; + bool uses_depth_pre_pass; + bool uses_discard; + bool uses_roughness; + bool uses_normal; + + bool unshaded; + bool uses_vertex; + bool uses_sss; + bool uses_transmittance; + bool uses_screen_texture; + bool uses_depth_texture; + bool uses_normal_texture; + bool uses_time; + bool writes_modelview_or_projection; + bool uses_world_coordinates; + + uint64_t last_pass = 0; + uint32_t index = 0; + + virtual void set_code(const String &p_Code); + virtual void set_default_texture_param(const StringName &p_name, RID p_texture); + virtual void get_param_list(List<PropertyInfo> *p_param_list) const; + void get_instance_param_list(List<RendererStorage::InstanceShaderParam> *p_param_list) const; + + virtual bool is_param_texture(const StringName &p_param) const; + virtual bool is_animated() const; + virtual bool casts_shadows() const; + virtual Variant get_default_parameter(const StringName &p_parameter) const; + virtual RS::ShaderNativeSourceCode get_native_source_code() const; + + ShaderData(); + virtual ~ShaderData(); + }; + + RendererStorageRD::ShaderData *_create_shader_func(); + static RendererStorageRD::ShaderData *_create_shader_funcs() { + return static_cast<SceneShaderForwardClustered *>(singleton)->_create_shader_func(); + } + + struct MaterialData : public RendererStorageRD::MaterialData { + uint64_t last_frame; + ShaderData *shader_data; + RID uniform_buffer; + RID uniform_set; + Vector<RID> texture_cache; + Vector<uint8_t> ubo_data; + uint64_t last_pass = 0; + uint32_t index = 0; + RID next_pass; + uint8_t priority; + virtual void set_render_priority(int p_priority); + virtual void set_next_pass(RID p_pass); + virtual void update_parameters(const Map<StringName, Variant> &p_parameters, bool p_uniform_dirty, bool p_textures_dirty); + virtual ~MaterialData(); + }; + + RendererStorageRD::MaterialData *_create_material_func(ShaderData *p_shader); + static RendererStorageRD::MaterialData *_create_material_funcs(RendererStorageRD::ShaderData *p_shader) { + return static_cast<SceneShaderForwardClustered *>(singleton)->_create_material_func(static_cast<ShaderData *>(p_shader)); + } + + SceneForwardClusteredShaderRD shader; + ShaderCompilerRD compiler; + + RID default_shader; + RID default_material; + RID overdraw_material_shader; + RID overdraw_material; + RID wireframe_material_shader; + RID wireframe_material; + RID default_shader_rd; + RID default_shader_sdfgi_rd; + + RID default_vec4_xform_buffer; + RID default_vec4_xform_uniform_set; + + RID shadow_sampler; + + SceneShaderForwardClustered(); + ~SceneShaderForwardClustered(); + + void init(RendererStorageRD *p_storage, const String p_defines); +}; + +} // namespace RendererSceneRenderImplementation +#endif // !RSSR_SCENE_SHADER_FM_H diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp index d5ac05d1d1..2247b841c9 100644 --- a/servers/rendering/renderer_rd/renderer_compositor_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_compositor_rd.cpp @@ -175,5 +175,5 @@ RendererCompositorRD::RendererCompositorRD() { storage = memnew(RendererStorageRD); canvas = memnew(RendererCanvasRenderRD(storage)); - scene = memnew(RendererSceneRenderForwardClustered(storage)); + scene = memnew(RendererSceneRenderImplementation::RenderForwardClustered(storage)); } diff --git a/servers/rendering/renderer_rd/renderer_compositor_rd.h b/servers/rendering/renderer_rd/renderer_compositor_rd.h index 67a843452b..5b5f3ad0cb 100644 --- a/servers/rendering/renderer_rd/renderer_compositor_rd.h +++ b/servers/rendering/renderer_rd/renderer_compositor_rd.h @@ -34,8 +34,8 @@ #include "core/os/os.h" #include "core/templates/thread_work_pool.h" #include "servers/rendering/renderer_compositor.h" +#include "servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h" #include "servers/rendering/renderer_rd/renderer_canvas_render_rd.h" -#include "servers/rendering/renderer_rd/renderer_scene_render_forward_clustered.h" #include "servers/rendering/renderer_rd/renderer_storage_rd.h" class RendererCompositorRD : public RendererCompositor { diff --git a/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp index 4e4e553605..3856f38457 100644 --- a/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_gi_rd.cpp @@ -2992,6 +2992,7 @@ void RendererSceneGIRD::init(RendererStorageRD *p_storage, RendererSceneSkyRD *p } } default_giprobe_buffer = RD::get_singleton()->uniform_buffer_create(sizeof(GIProbeData) * MAX_GIPROBES); + half_resolution = GLOBAL_GET("rendering/global_illumination/gi/use_half_resolution"); } void RendererSceneGIRD::free() { @@ -3097,10 +3098,10 @@ void RendererSceneGIRD::setup_giprobes(RID p_render_buffers, const Transform &p_ } if (giprobes_changed) { - if (RD::get_singleton()->uniform_set_is_valid(rb->gi_uniform_set)) { - RD::get_singleton()->free(rb->gi_uniform_set); + if (RD::get_singleton()->uniform_set_is_valid(rb->gi.uniform_set)) { + RD::get_singleton()->free(rb->gi.uniform_set); } - rb->gi_uniform_set = RID(); + rb->gi.uniform_set = RID(); if (rb->volumetric_fog) { if (RD::get_singleton()->uniform_set_is_valid(rb->volumetric_fog->uniform_set)) { RD::get_singleton()->free(rb->volumetric_fog->uniform_set); @@ -3125,7 +3126,7 @@ void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_ ERR_FAIL_COND(rb == nullptr); RendererSceneEnvironmentRD *env = p_scene_render->environment_owner.getornull(p_environment); - if (rb->ambient_buffer.is_null() || rb->using_half_size_gi != half_resolution) { + if (rb->ambient_buffer.is_null() || rb->gi.using_half_size_gi != half_resolution) { if (rb->ambient_buffer.is_valid()) { RD::get_singleton()->free(rb->ambient_buffer); RD::get_singleton()->free(rb->reflection_buffer); @@ -3142,7 +3143,7 @@ void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_ tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; rb->reflection_buffer = RD::get_singleton()->texture_create(tf, RD::TextureView()); rb->ambient_buffer = RD::get_singleton()->texture_create(tf, RD::TextureView()); - rb->using_half_size_gi = half_resolution; + rb->gi.using_half_size_gi = half_resolution; p_scene_render->_render_buffers_uniform_set_changed(p_render_buffers); } @@ -3187,7 +3188,7 @@ void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_ push_constant.cam_rotation[10] = p_transform.basis[2][2]; push_constant.cam_rotation[11] = 0; - if (rb->gi_uniform_set.is_null() || !RD::get_singleton()->uniform_set_is_valid(rb->gi_uniform_set)) { + if (rb->gi.uniform_set.is_null() || !RD::get_singleton()->uniform_set_is_valid(rb->gi.uniform_set)) { Vector<RD::Uniform> uniforms; { RD::Uniform u; @@ -3340,22 +3341,22 @@ void RendererSceneGIRD::process_gi(RID p_render_buffers, RID p_normal_roughness_ uniforms.push_back(u); } - rb->gi_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, shader.version_get_shader(shader_version, 0), 0); + rb->gi.uniform_set = RD::get_singleton()->uniform_set_create(uniforms, shader.version_get_shader(shader_version, 0), 0); } Mode mode; - if (rb->using_half_size_gi) { + if (rb->gi.using_half_size_gi) { mode = (use_sdfgi && use_giprobes) ? MODE_HALF_RES_COMBINED : (use_sdfgi ? MODE_HALF_RES_SDFGI : MODE_HALF_RES_GIPROBE); } else { mode = (use_sdfgi && use_giprobes) ? MODE_COMBINED : (use_sdfgi ? MODE_SDFGI : MODE_GIPROBE); } RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin(true); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, pipelines[mode]); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, rb->gi_uniform_set, 0); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, rb->gi.uniform_set, 0); RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(PushConstant)); - if (rb->using_half_size_gi) { + if (rb->gi.using_half_size_gi) { RD::get_singleton()->compute_list_dispatch_threads(compute_list, rb->width >> 1, rb->height >> 1, 1); } else { RD::get_singleton()->compute_list_dispatch_threads(compute_list, rb->width, rb->height, 1); diff --git a/servers/rendering/renderer_rd/renderer_scene_gi_rd.h b/servers/rendering/renderer_rd/renderer_scene_gi_rd.h index c0f3318538..df20011b23 100644 --- a/servers/rendering/renderer_rd/renderer_scene_gi_rd.h +++ b/servers/rendering/renderer_rd/renderer_scene_gi_rd.h @@ -561,6 +561,9 @@ public: RID full_buffer; RID full_dispatch; RID full_mask; + + RID uniform_set; + bool using_half_size_gi = false; }; struct SDFGIData { diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 4cf296f0db..ca9e014c95 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -317,7 +317,7 @@ void RendererSceneRenderRD::environment_set_sdfgi(RID p_env, bool p_enable, RS:: RendererSceneEnvironmentRD *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - if (low_end) { + if (!is_dynamic_gi_supported()) { return; } @@ -379,7 +379,7 @@ void RendererSceneRenderRD::environment_set_volumetric_fog(RID p_env, bool p_ena RendererSceneEnvironmentRD *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - if (low_end) { + if (!is_volumetric_supported()) { return; } @@ -410,10 +410,6 @@ void RendererSceneRenderRD::environment_set_ssr(RID p_env, bool p_enable, int p_ RendererSceneEnvironmentRD *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - if (low_end) { - return; - } - env->set_ssr(p_enable, p_max_steps, p_fade_int, p_fade_out, p_depth_tolerance); } @@ -429,10 +425,6 @@ void RendererSceneRenderRD::environment_set_ssao(RID p_env, bool p_enable, float RendererSceneEnvironmentRD *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); - if (low_end) { - return; - } - env->set_ssao(p_enable, p_radius, p_intensity, p_power, p_detail, p_horizon, p_sharpness, p_light_affect, p_ao_channel_affect); } @@ -522,9 +514,13 @@ RID RendererSceneRenderRD::reflection_atlas_create() { ra.count = GLOBAL_GET("rendering/reflections/reflection_atlas/reflection_count"); ra.size = GLOBAL_GET("rendering/reflections/reflection_atlas/reflection_size"); - ra.cluster_builder = memnew(ClusterBuilderRD); - ra.cluster_builder->set_shared(&cluster_builder_shared); - ra.cluster_builder->setup(Size2i(ra.size, ra.size), max_cluster_elements, RID(), RID(), RID()); + if (is_clustered_enabled()) { + ra.cluster_builder = memnew(ClusterBuilderRD); + ra.cluster_builder->set_shared(&cluster_builder_shared); + ra.cluster_builder->setup(Size2i(ra.size, ra.size), max_cluster_elements, RID(), RID(), RID()); + } else { + ra.cluster_builder = nullptr; + } return reflection_atlas_owner.make_rid(ra); } @@ -537,7 +533,10 @@ void RendererSceneRenderRD::reflection_atlas_set_size(RID p_ref_atlas, int p_ref return; //no changes } - ra->cluster_builder->setup(Size2i(ra->size, ra->size), max_cluster_elements, RID(), RID(), RID()); + if (ra->cluster_builder) { + // only if we're using our cluster + ra->cluster_builder->setup(Size2i(ra->size, ra->size), max_cluster_elements, RID(), RID(), RID()); + } ra->size = p_reflection_size; ra->count = p_reflection_count; @@ -1340,7 +1339,7 @@ void RendererSceneRenderRD::gi_probe_instance_set_transform_to_data(RID p_probe, } bool RendererSceneRenderRD::gi_probe_needs_update(RID p_probe) const { - if (low_end) { + if (!is_dynamic_gi_supported()) { return false; } @@ -1348,7 +1347,7 @@ bool RendererSceneRenderRD::gi_probe_needs_update(RID p_probe) const { } void RendererSceneRenderRD::gi_probe_update(RID p_probe, bool p_update_light_instances, const Vector<RID> &p_light_instances, const PagedArray<GeometryInstance *> &p_dynamic_objects) { - if (low_end) { + if (!is_dynamic_gi_supported()) { return; } @@ -2124,10 +2123,13 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p rb->msaa = p_msaa; rb->screen_space_aa = p_screen_space_aa; rb->use_debanding = p_use_debanding; - if (rb->cluster_builder == nullptr) { - rb->cluster_builder = memnew(ClusterBuilderRD); + + if (is_clustered_enabled()) { + if (rb->cluster_builder == nullptr) { + rb->cluster_builder = memnew(ClusterBuilderRD); + } + rb->cluster_builder->set_shared(&cluster_builder_shared); } - rb->cluster_builder->set_shared(&cluster_builder_shared); _free_render_buffer_data(rb); @@ -2170,7 +2172,9 @@ void RendererSceneRenderRD::render_buffers_configure(RID p_render_buffers, RID p rb->data->configure(rb->texture, rb->depth_texture, p_width, p_height, p_msaa); _render_buffers_uniform_set_changed(p_render_buffers); - rb->cluster_builder->setup(Size2i(p_width, p_height), max_cluster_elements, rb->depth_texture, storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED), rb->texture); + if (is_clustered_enabled()) { + rb->cluster_builder->setup(Size2i(p_width, p_height), max_cluster_elements, rb->depth_texture, storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED), rb->texture); + } } void RendererSceneRenderRD::gi_set_use_half_resolution(bool p_enable) { @@ -2943,6 +2947,7 @@ void RendererSceneRenderRD::_volumetric_fog_erase(RenderBuffers *rb) { } void RendererSceneRenderRD::_update_volumetric_fog(RID p_render_buffers, RID p_environment, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform, RID p_shadow_atlas, int p_directional_light_count, bool p_use_directional_shadows, int p_positional_light_count, int p_gi_probe_count) { + ERR_FAIL_COND(!is_clustered_enabled()); // can't use volumetric fog without clustered RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers); ERR_FAIL_COND(!rb); RendererSceneEnvironmentRD *env = environment_owner.getornull(p_environment); @@ -3505,7 +3510,9 @@ void RendererSceneRenderRD::_pre_opaque_render(bool p_use_ssao, bool p_use_gi, R break; } } - _update_volumetric_fog(render_state.render_buffers, render_state.environment, render_state.cam_projection, render_state.cam_transform, render_state.shadow_atlas, directional_light_count, directional_shadows, positional_light_count, render_state.gi_probe_count); + if (is_volumetric_supported()) { + _update_volumetric_fog(render_state.render_buffers, render_state.environment, render_state.cam_projection, render_state.cam_transform, render_state.shadow_atlas, directional_light_count, directional_shadows, positional_light_count, render_state.gi_probe_count); + } } } @@ -3578,8 +3585,8 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const Transform & } if (render_buffers_owner.owns(render_state.render_buffers)) { - RenderBuffers *rs_rb = render_buffers_owner.getornull(render_state.render_buffers); - current_cluster_builder = rs_rb->cluster_builder; + // render_state.render_buffers == p_render_buffers so we can use our already retrieved rb + current_cluster_builder = rb->cluster_builder; } else if (reflection_probe_instance_owner.owns(render_state.reflection_probe)) { ReflectionProbeInstance *rpi = reflection_probe_instance_owner.getornull(render_state.reflection_probe); ReflectionAtlas *ra = reflection_atlas_owner.getornull(rpi->atlas); @@ -3590,7 +3597,7 @@ void RendererSceneRenderRD::render_scene(RID p_render_buffers, const Transform & current_cluster_builder = ra->cluster_builder; } } else { - ERR_PRINT("No cluster builder, bug"); //should never happen, will crash + ERR_PRINT("No render buffer nor reflection atlas, bug"); //should never happen, will crash current_cluster_builder = nullptr; } @@ -4076,8 +4083,19 @@ int RendererSceneRenderRD::get_max_directional_lights() const { return cluster.max_directional_lights; } -bool RendererSceneRenderRD::is_low_end() const { - return low_end; +bool RendererSceneRenderRD::is_dynamic_gi_supported() const { + // usable by default (unless low end = true) + return true; +} + +bool RendererSceneRenderRD::is_clustered_enabled() const { + // used by default. + return true; +} + +bool RendererSceneRenderRD::is_volumetric_supported() const { + // usable by default (unless low end = true) + return true; } RendererSceneRenderRD::RendererSceneRenderRD(RendererStorageRD *p_storage) { @@ -4089,21 +4107,13 @@ RendererSceneRenderRD::RendererSceneRenderRD(RendererStorageRD *p_storage) { directional_shadow.size = GLOBAL_GET("rendering/shadows/directional_shadow/size"); directional_shadow.use_16_bits = GLOBAL_GET("rendering/shadows/directional_shadow/16_bits"); - uint32_t textures_per_stage = RD::get_singleton()->limit_get(RD::LIMIT_MAX_TEXTURES_PER_SHADER_STAGE); - - low_end = GLOBAL_GET("rendering/driver/rd_renderer/use_low_end_renderer"); - - if (textures_per_stage < 48) { - low_end = true; - } - /* SKY SHADER */ sky.init(storage); /* GI */ - if (!low_end) { + if (is_dynamic_gi_supported()) { gi.init(storage, &sky); } @@ -4141,7 +4151,7 @@ RendererSceneRenderRD::RendererSceneRenderRD(RendererStorageRD *p_storage) { cluster.directional_light_buffer = RD::get_singleton()->uniform_buffer_create(directional_light_buffer_size); } - if (!low_end) { + if (is_volumetric_supported()) { String defines = "\n#define MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS " + itos(cluster.max_directional_lights) + "\n"; Vector<String> volumetric_fog_modes; volumetric_fog_modes.push_back("\n#define MODE_DENSITY\n"); @@ -4188,8 +4198,6 @@ RendererSceneRenderRD::RendererSceneRenderRD(RendererStorageRD *p_storage) { environment_set_volumetric_fog_filter_active(GLOBAL_GET("rendering/environment/volumetric_fog/use_filter")); cull_argument.set_page_pool(&cull_argument_pool); - - gi.half_resolution = GLOBAL_GET("rendering/global_illumination/gi/use_half_resolution"); } RendererSceneRenderRD::~RendererSceneRenderRD() { @@ -4201,7 +4209,7 @@ RendererSceneRenderRD::~RendererSceneRenderRD() { RD::get_singleton()->free(sky.sky_scene_state.uniform_set); } - if (!low_end) { + if (is_dynamic_gi_supported()) { gi.free(); volumetric_fog.shader.version_free(volumetric_fog.shader_version); diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.h b/servers/rendering/renderer_rd/renderer_scene_render_rd.h index 001cfeb74d..884bf2a744 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.h +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.h @@ -383,9 +383,9 @@ private: RID texture; //main texture for rendering to, must be filled after done rendering RID depth_texture; //main depth texture - RID gi_uniform_set; RendererSceneGIRD::SDFGI *sdfgi = nullptr; VolumetricFog *volumetric_fog = nullptr; + RendererSceneGIRD::RenderBuffersGI gi; ClusterBuilderRD *cluster_builder = nullptr; @@ -428,9 +428,6 @@ private: RID ambient_buffer; RID reflection_buffer; - bool using_half_size_gi = false; - - RendererSceneGIRD::RenderBuffersGI gi; }; /* GI */ @@ -719,7 +716,6 @@ private: */ uint32_t max_cluster_elements = 512; - bool low_end = false; void _render_shadow_pass(RID p_light, RID p_shadow_atlas, int p_pass, const PagedArray<GeometryInstance *> &p_instances, const Plane &p_camera_plane = Plane(), float p_lod_distance_multiplier = 0, float p_screen_lod_threshold = 0.0, bool p_open_pass = true, bool p_close_pass = true, bool p_clear_region = true); @@ -1193,7 +1189,9 @@ public: void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir); - bool is_low_end() const; + virtual bool is_dynamic_gi_supported() const; + virtual bool is_clustered_enabled() const; + virtual bool is_volumetric_supported() const; RendererSceneRenderRD(RendererStorageRD *p_storage); ~RendererSceneRenderRD(); diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp index ba5ace8f31..b984f850a0 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp @@ -4692,10 +4692,11 @@ void RendererStorageRD::update_particles() { if (particles->clear && particles->pre_process_time > 0.0) { float frame_time; - if (particles->fixed_fps > 0) + if (particles->fixed_fps > 0) { frame_time = 1.0 / particles->fixed_fps; - else + } else { frame_time = 1.0 / 30.0; + } float todo = particles->pre_process_time; @@ -4731,10 +4732,11 @@ void RendererStorageRD::update_particles() { particles->frame_remainder = todo; } else { - if (zero_time_scale) + if (zero_time_scale) { _particles_process(particles, 0.0); - else + } else { _particles_process(particles, RendererCompositorRD::singleton->get_frame_delta_time()); + } } //copy particles to instance buffer diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.h b/servers/rendering/renderer_rd/renderer_storage_rd.h index cd3d4604eb..6405bb75b0 100644 --- a/servers/rendering/renderer_rd/renderer_storage_rd.h +++ b/servers/rendering/renderer_rd/renderer_storage_rd.h @@ -691,21 +691,21 @@ private: }; struct Particles { - bool inactive; - float inactive_time; - bool emitting; - bool one_shot; - int amount; - float lifetime; - float pre_process_time; - float explosiveness; - float randomness; - bool restart_request; - AABB custom_aabb; - bool use_local_coords; + bool inactive = true; + float inactive_time = 0.0; + bool emitting = false; + bool one_shot = false; + int amount = 0; + float lifetime = 1.0; + float pre_process_time = 0.0; + float explosiveness = 0.0; + float randomness = 0.0; + bool restart_request = false; + AABB custom_aabb = AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8)); + bool use_local_coords = true; RID process_material; - RS::ParticlesDrawOrder draw_order; + RS::ParticlesDrawOrder draw_order = RS::PARTICLES_DRAW_ORDER_INDEX; Vector<RID> draw_passes; @@ -730,21 +730,21 @@ private: RID sub_emitter; - float phase; - float prev_phase; - uint64_t prev_ticks; - uint32_t random_seed; + float phase = 0.0; + float prev_phase = 0.0; + uint64_t prev_ticks = 0; + uint32_t random_seed = 0; - uint32_t cycle_number; + uint32_t cycle_number = 0; - float speed_scale; + float speed_scale = 1.0; - int fixed_fps; - bool fractional_delta; - float frame_remainder; - float collision_base_size; + int fixed_fps = 0; + bool fractional_delta = false; + float frame_remainder = 0; + float collision_base_size = 0.01; - bool clear; + bool clear = true; bool force_sub_emit = false; @@ -757,31 +757,6 @@ private: Set<RID> collisions; - Particles() : - inactive(true), - inactive_time(0.0), - emitting(false), - one_shot(false), - amount(0), - lifetime(1.0), - pre_process_time(0.0), - explosiveness(0.0), - randomness(0.0), - restart_request(false), - custom_aabb(AABB(Vector3(-4, -4, -4), Vector3(8, 8, 8))), - use_local_coords(true), - draw_order(RS::PARTICLES_DRAW_ORDER_INDEX), - prev_ticks(0), - random_seed(0), - cycle_number(0), - speed_scale(1.0), - fixed_fps(0), - fractional_delta(false), - frame_remainder(0), - collision_base_size(0.01), - clear(true) { - } - Dependency dependency; ParticlesFrameParams frame_params; diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl index 7b86dac143..76edec1cb6 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered.glsl @@ -1735,8 +1735,6 @@ void sdfgi_process(uint cascade, vec3 cascade_pos, vec3 cam_pos, vec3 cam_normal #ifndef MODE_RENDER_DEPTH -#ifndef LOW_END_MODE - vec4 volumetric_fog_process(vec2 screen_uv, float z) { vec3 fog_pos = vec3(screen_uv, z * scene_data.volumetric_fog_inv_length); if (fog_pos.z < 0.0) { @@ -1747,7 +1745,6 @@ vec4 volumetric_fog_process(vec2 screen_uv, float z) { return texture(sampler3D(volumetric_fog_texture, material_samplers[SAMPLER_LINEAR_CLAMP]), fog_pos); } -#endif vec4 fog_process(vec3 vertex) { vec3 fog_color = scene_data.fog_light_color; @@ -2019,7 +2016,6 @@ FRAGMENT_SHADER_CODE fog = fog_process(vertex); } -#ifndef LOW_END_MODE if (scene_data.volumetric_fog_enabled) { vec4 volumetric_fog = volumetric_fog_process(screen_uv, -vertex.z); if (scene_data.fog_enabled) { @@ -2037,7 +2033,6 @@ FRAGMENT_SHADER_CODE fog = volumetric_fog; } } -#endif //!LOW_END_MODE #endif //!CUSTOM_FOG_USED uint fog_rg = packHalf2x16(fog.rg); @@ -2377,7 +2372,7 @@ FRAGMENT_SHADER_CODE specular_light = spec_accum.rgb; ambient_light = amb_accum.rgb; } -#elif !defined(LOW_END_MODE) +#else if (bool(instances.data[instance_index].flags & INSTANCE_FLAGS_USE_GI_BUFFERS)) { //use GI buffers @@ -2412,13 +2407,11 @@ FRAGMENT_SHADER_CODE } #endif -#ifndef LOW_END_MODE if (scene_data.ssao_enabled) { float ssao = texture(sampler2D(ao_buffer, material_samplers[SAMPLER_LINEAR_CLAMP]), screen_uv).r; ao = min(ao, ssao); ao_light_affect = mix(ao_light_affect, max(ao_light_affect, scene_data.ssao_light_affect), scene_data.ssao_ao_affect); } -#endif //LOW_END_MODE { // process reflections diff --git a/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl b/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl index 4ea05c9ccc..e064a90ae0 100644 --- a/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/scene_forward_clustered_inc.glsl @@ -122,8 +122,6 @@ layout(set = 0, binding = 12, std430) restrict readonly buffer GlobalVariableDat } global_variables; -#ifndef LOW_END_MODE - struct SDFGIProbeCascadeData { vec3 position; float to_probe; @@ -159,8 +157,6 @@ layout(set = 0, binding = 13, std140) uniform SDFGI { } sdfgi; -#endif //LOW_END_MODE - /* Set 2: Render Pass (changes per render pass) */ layout(set = 1, binding = 0, std140) uniform SceneData { @@ -280,9 +276,7 @@ layout(set = 1, binding = 5) uniform texture2D directional_shadow_atlas; layout(set = 1, binding = 6) uniform texture2DArray lightmap_textures[MAX_LIGHTMAP_TEXTURES]; -#ifndef LOW_END_MOD layout(set = 1, binding = 7) uniform texture3D gi_probe_textures[MAX_GI_PROBES]; -#endif layout(set = 1, binding = 8, std430) buffer restrict readonly ClusterBuffer { uint data[]; @@ -306,8 +300,6 @@ layout(r32ui, set = 1, binding = 12) uniform restrict uimage3D geom_facing_grid; layout(set = 1, binding = 9) uniform texture2D depth_buffer; layout(set = 1, binding = 10) uniform texture2D color_buffer; -#ifndef LOW_END_MODE - layout(set = 1, binding = 11) uniform texture2D normal_roughness_buffer; layout(set = 1, binding = 12) uniform texture2D ao_buffer; layout(set = 1, binding = 13) uniform texture2D ambient_buffer; @@ -338,8 +330,6 @@ gi_probes; layout(set = 1, binding = 18) uniform texture3D volumetric_fog_texture; -#endif // LOW_END_MODE - #endif /* Set 2 Skeleton & Instancing (can change per item) */ diff --git a/servers/rendering/renderer_scene_render.h b/servers/rendering/renderer_scene_render.h index 1dea3580b6..9ca9574f6f 100644 --- a/servers/rendering/renderer_scene_render.h +++ b/servers/rendering/renderer_scene_render.h @@ -241,8 +241,6 @@ public: virtual void sdfgi_set_debug_probe_select(const Vector3 &p_position, const Vector3 &p_dir) = 0; - virtual bool is_low_end() const = 0; - virtual void update() = 0; virtual ~RendererSceneRender() {} }; diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp index df1a7d58d0..4ae0eda232 100644 --- a/servers/rendering/shader_language.cpp +++ b/servers/rendering/shader_language.cpp @@ -6825,7 +6825,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct } else { _set_tkpos(pos2); - Node *n = _parse_and_reduce_expression(NULL, FunctionInfo()); + Node *n = _parse_and_reduce_expression(nullptr, FunctionInfo()); if (!n || n->type != Node::TYPE_CONSTANT || n->get_datatype() != TYPE_INT) { _set_error("Expected single integer constant > 0"); return ERR_PARSE_ERROR; @@ -6906,7 +6906,7 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct if (tk.type == TK_PARENTHESIS_OPEN || curly) { // initialization while (true) { - Node *n = _parse_and_reduce_expression(NULL, FunctionInfo()); + Node *n = _parse_and_reduce_expression(nullptr, FunctionInfo()); if (!n) { return ERR_PARSE_ERROR; } @@ -6932,10 +6932,11 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct decl.initializer.push_back(n); break; } else { - if (curly) + if (curly) { _set_error("Expected '}' or ','"); - else + } else { _set_error("Expected ')' or ','"); + } return ERR_PARSE_ERROR; } } @@ -6961,9 +6962,10 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct constant.initializer = static_cast<ConstantNode *>(expr); } else { //variable created with assignment! must parse an expression - Node *expr = _parse_and_reduce_expression(NULL, FunctionInfo()); - if (!expr) + Node *expr = _parse_and_reduce_expression(nullptr, FunctionInfo()); + if (!expr) { return ERR_PARSE_ERROR; + } if (expr->type == Node::TYPE_OPERATOR && ((OperatorNode *)expr)->op == OP_CALL) { _set_error("Expected constant expression after '='"); return ERR_PARSE_ERROR; |