diff options
148 files changed, 4534 insertions, 3741 deletions
diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index 46a9228616..0000a061d7 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -78,8 +78,8 @@ jobs: - name: Linux dependencies for tests if: ${{ matrix.proj-test }} run: | + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list sudo add-apt-repository ppa:kisak/kisak-mesa - sudo apt-get update sudo apt-get install -qq mesa-vulkan-drivers - name: Setup Godot build cache diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml index a3722e19ce..6c92922185 100644 --- a/.github/workflows/static_checks.yml +++ b/.github/workflows/static_checks.yml @@ -15,9 +15,9 @@ jobs: - name: Install dependencies run: | + sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" - sudo apt-get update sudo apt-get install -qq dos2unix clang-format-15 libxml2-utils python3-pip moreutils sudo update-alternatives --remove-all clang-format || true sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 100 diff --git a/core/core_bind.cpp b/core/core_bind.cpp index c752bdd057..f2eb7823e2 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -1590,8 +1590,12 @@ Vector<String> Engine::get_singleton_list() const { return ret; } -void Engine::register_script_language(ScriptLanguage *p_language) { - ScriptServer::register_language(p_language); +Error Engine::register_script_language(ScriptLanguage *p_language) { + return ScriptServer::register_language(p_language); +} + +Error Engine::unregister_script_language(const ScriptLanguage *p_language) { + return ScriptServer::unregister_language(p_language); } int Engine::get_script_language_count() { @@ -1662,6 +1666,7 @@ void Engine::_bind_methods() { ClassDB::bind_method(D_METHOD("get_singleton_list"), &Engine::get_singleton_list); ClassDB::bind_method(D_METHOD("register_script_language", "language"), &Engine::register_script_language); + ClassDB::bind_method(D_METHOD("unregister_script_language", "language"), &Engine::unregister_script_language); ClassDB::bind_method(D_METHOD("get_script_language_count"), &Engine::get_script_language_count); ClassDB::bind_method(D_METHOD("get_script_language", "index"), &Engine::get_script_language); diff --git a/core/core_bind.h b/core/core_bind.h index 8852463234..675da48591 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -499,7 +499,8 @@ public: void unregister_singleton(const StringName &p_name); Vector<String> get_singleton_list() const; - void register_script_language(ScriptLanguage *p_language); + Error register_script_language(ScriptLanguage *p_language); + Error unregister_script_language(const ScriptLanguage *p_language); int get_script_language_count(); ScriptLanguage *get_script_language(int p_index) const; diff --git a/core/input/gamecontrollerdb.txt b/core/input/gamecontrollerdb.txt index dcb6aefb00..59461959d5 100644 --- a/core/input/gamecontrollerdb.txt +++ b/core/input/gamecontrollerdb.txt @@ -69,7 +69,7 @@ 03000000c82d00000121000000000000,8BitDo SN30 Pro for Android,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:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows, 03000000c82d00000260000000000000,8BitDo SN30 Pro Plus,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows, 03000000c82d00000261000000000000,8BitDo SN30 Pro Plus,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Windows, -03000000c82d00001130000000000000,8BitDo Ultimate Wired,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:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows, +03000000c82d00001130000000000000,8BitDo Ultimate Wired,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:b8,leftx:a0,lefty:a1,misc1:b26,paddle1:b24,paddle2:b25,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows, 03000000c82d00001230000000000000,8BitDo Ultimate Wireless,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:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows, 03000000c82d00001330000000000000,8BitDo Ultimate Wireless,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,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Windows, 03000000a00500003232000000000000,8BitDo Zero,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Windows, @@ -383,7 +383,7 @@ 0300000079000000d218000000000000,Mayflash Magic NS,a:b2,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:b0,platform:Windows, 03000000d620000010a7000000000000,Mayflash Magic NS,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:Windows, 03000000790000007918000000000000,Mayflash N64 Controller Adapter,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,righttrigger:b7,rightx:a3,righty:a2,start:b8,platform:Windows, -030000008f0e00001030000000000000,Mayflash Sega Saturn Adapter,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b5,rightshoulder:b2,righttrigger:b7,start:b9,x:b3,y:b4,platform:Windows, +030000008f0e00001030000000000000,Mayflash Saturn Adapter,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,lefttrigger:b7,rightshoulder:b6,righttrigger:b2,start:b9,x:b3,y:b4,platform:Windows, 0300000025090000e803000000000000,Mayflash Wii Classic Adapter,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:a5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Windows, 03000000790000000318000000000000,Mayflash Wii DolphinBar,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,platform:Windows, 03000000790000000018000000000000,Mayflash Wii U Pro Adapter,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:Windows, @@ -407,7 +407,6 @@ 03000000c62400002b89000000000000,Moga XP5A 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:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows, 03000000c62400001a89000000000000,Moga XP5X 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:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows, 03000000c62400001b89000000000000,Moga XP5X 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:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows, -03000000efbe0000edfe000000000000,Monect Virtual Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b0,platform:Windows, 03000000250900006688000000000000,MP-8866 Super Dual Box,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,platform:Windows, 03000000091200004488000000000000,MUSIA PlayStation 2 Input Display,a:b0,b:b2,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b8,leftstick:b6,lefttrigger:b10,leftx:a0,lefty:a1,rightshoulder:b9,rightstick:b7,righttrigger:b11,rightx:a2,righty:a3,start:b5,x:b1,y:b3,platform:Windows, 03000000f70600000100000000000000,N64 Adaptoid,+rightx:b2,+righty:b1,-rightx:b4,-righty:b5,a:b0,b:b3,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,leftshoulder:b6,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b7,start:b8,platform:Windows, @@ -484,8 +483,8 @@ 030000004c0500006802000000000000,PS3 Controller,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b10,lefttrigger:a3~,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:a4~,rightx:a2,righty:a5,start:b8,x:b3,y:b0,platform:Windows, 030000004f1f00000800000000000000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Windows, 03000000632500007505000000000000,PS3 Controller,a:b2,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:b0,platform:Windows, -03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,platform:Windows, -03000000888800000804000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,leftshoulder:b10,leftstick:b1,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows, +03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b3,y:b0,platform:Windows, +03000000888800000804000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,platform:Windows, 030000008f0e00000300000000000000,PS3 Controller,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:a5,start:b9,x:b3,y:b0,platform:Windows, 030000008f0e00001431000000000000,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:Windows, 03000000ba2200002010000000000000,PS3 Controller,a:b0,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:a5,righty:a2,start:b9,x:b3,y:b2,platform:Windows, @@ -542,8 +541,9 @@ 030000009b2800005600000000000000,Raphnet SNES Adapter,a:b1,b:b4,back:b2,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b3,x:b0,y:b5,platform:Windows, 030000009b2800005700000000000000,Raphnet SNES Adapter,a:b1,b:b4,back:b2,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b3,x:b0,y:b5,platform:Windows, 030000009b2800001e00000000000000,Raphnet Vectrex Adapter,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftx:a1,lefty:a2,x:b2,y:b3,platform:Windows, -030000009b2800002b00000000000000,Raphnet Wii Classic Adapter,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a3,righty:a4,start:b3,x:b0,y:b5,platform:Windows, -030000009b2800002c00000000000000,Raphnet Wii Classic Adapter,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a3,righty:a4,start:b3,x:b0,y:b5,platform:Windows, +030000009b2800002b00000000000000,Raphnet Wii Classic Adapter,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b10,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a3,righty:a4,start:b3,x:b0,y:b5,platform:Windows, +030000009b2800002c00000000000000,Raphnet Wii Classic Adapter,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b10,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a3,righty:a4,start:b3,x:b0,y:b5,platform:Windows, +030000009b2800008000000000000000,Raphnet Wii Classic Adapter,a:b1,b:b4,x:b0,y:b5,back:b2,guide:b10,start:b3,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpleft:b14,dpdown:b13,dpright:b15,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:b8,righttrigger:b9,platform:Windows, 03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Windows, 03000000321500000204000000000000,Razer Panthera 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:Windows, 03000000321500000104000000000000,Razer Panthera PS4,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:Windows, @@ -574,7 +574,7 @@ 030000006f0e00001e01000000000000,Rock Candy 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:Windows, 030000006f0e00002801000000000000,Rock Candy 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:Windows, 030000006f0e00002f01000000000000,Rock Candy 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:Windows, -030000006f0e00008701000000000000,Rock Candy Switch Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b13,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Windows, +030000006f0e00008701000000000000,Rock Candy Switch Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b13,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,platform:Windows, 03000000050b0000e318000000000000,ROG Chakram,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,platform:Windows, 03000000050b0000e518000000000000,ROG Chakram,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,platform:Windows, 03000000050b00005819000000000000,ROG Chakram Core,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,platform:Windows, @@ -678,7 +678,7 @@ 030000004f04000087b6000000000000,TWCS Throttle,dpdown:b8,dpleft:b9,dpright:b7,dpup:b6,leftstick:b5,lefttrigger:-a5,leftx:a0,lefty:a1,righttrigger:+a5,platform:Windows, 03000000411200000450000000000000,Twin Shock,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a4,start:b11,x:b3,y:b0,platform:Windows, 03000000d90400000200000000000000,TwinShock PS2 Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Windows, -03000000151900005678000000000000,Uniplay U6,a:b0,b:b1,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b14,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a3,righty:a4,start:b10,x:b3,y:b4,platform:Windows, +03000000151900005678000000000000,Uniplay U6,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,platform:Windows, 03000000101c0000171c000000000000,uRage 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:a3,start:b9,x:b3,y:b0,platform:Windows, 030000000b0400003065000000000000,USB Controller,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:a5,start:b9,x:b3,y:b0,platform:Windows, 03000000242f00006e00000000000000,USB Controller,a:b1,b:b4,back:b10,leftshoulder:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b9,righttrigger:b7,rightx:a2,righty:a5,start:b11,x:b0,y:b3,platform:Windows, @@ -798,7 +798,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000c82d00000161000000010000,8BitDo SN30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a5,start:b11,x:b4,y:b3,platform:Mac OS X, 03000000c82d00000260000001000000,8BitDo SN30 Pro Plus,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X, 03000000c82d00000261000000010000,8BitDo SN30 Pro Plus,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Mac OS X, -03000000c82d00001130000000020000,8BitDo Ultimate Wired,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, +03000000c82d00001130000000020000,8BitDo Ultimate Wired,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,misc1:b26,paddle1:b24,paddle2:b25,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X, 03000000c82d00001330000001000000,8BitDo Ultimate Wireless,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,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X, 03000000c82d00001330000000020000,8BitDo Ultimate Wireless Controller,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,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Mac OS X, 03000000a00500003232000008010000,8BitDo Zero,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,platform:Mac OS X, @@ -843,6 +843,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 030000000d0f00005e00000000010000,Hori Fighting Commander 4 PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,platform:Mac OS X, 030000000d0f00008400000000010000,Hori Fighting Commander PS3,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, 030000000d0f00008500000000010000,Hori Fighting Commander PS3,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:Mac OS X, +03000000341a00000302000014010000,Hori Fighting Stick Mini,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X, 030000000d0f00008800000000010000,Hori Fighting Stick mini 4 (PS3),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,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X, 030000000d0f00008700000000010000,Hori Fighting Stick mini 4 (PS4),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,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X, 030000000d0f00004d00000000000000,Hori Gem Pad 3,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:Mac OS X, @@ -881,6 +882,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000242f00007300000000020000,Mayflash Magic NS,a:b1,b:b4,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b0,y:b3,platform:Mac OS X, 0300000079000000d218000026010000,Mayflash Magic NS,a:b2,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:b0,platform:Mac OS X, 03000000d620000010a7000003010000,Mayflash Magic NS,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:Mac OS X, +030000008f0e00001030000011010000,Mayflash Saturn Adapter,a:b0,b:b2,dpdown:b28,dpleft:b30,dpright:b26,dpup:b24,leftshoulder:b10,lefttrigger:b14,rightshoulder:b12,righttrigger:b4,start:b18,x:b6,y:b8,platform:Mac OS X, 0300000025090000e803000000000000,Mayflash Wii Classic Adapter,a:b1,b:b0,back:b8,dpdown:b13,dpleft:b12,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Mac OS X, 03000000790000000318000000010000,Mayflash Wii DolphinBar,a:b8,b:b12,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b44,leftshoulder:b16,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b4,platform:Mac OS X, 03000000790000000018000000000000,Mayflash Wii U Pro Adapter,a:b4,b:b8,back:b32,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b16,leftstick:b40,lefttrigger:b24,leftx:a0,lefty:a4,rightshoulder:b20,rightstick:b44,righttrigger:b28,rightx:a8,righty:a12,start:b36,x:b0,y:b12,platform:Mac OS X, @@ -897,6 +899,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000d620000011a7000010050000,Nintendo Switch PowerA 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:Mac OS X, 030000007e0500000920000000000000,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:Mac OS X, 030000007e0500000920000001000000,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:Mac OS X, +050000007e05000009200000ff070000,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b3,y:b2,platform:Mac OS X, 030000007e0500001920000001000000,NSO N64 Controller,+rightx:b8,+righty:b7,-rightx:b3,-righty:b2,a:b1,b:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,misc1:b13,rightshoulder:b5,righttrigger:b10,start:b9,platform:Mac OS X, 030000007e0500001720000001000000,NSO SNES Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b15,start:b9,x:b2,y:b3,platform:Mac OS X, 03000000550900001472000025050000,NVIDIA Controller,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b4,leftstick:b7,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b8,righttrigger:a4,rightx:a2,righty:a5,start:b6,x:b2,y:b3,platform:Mac OS X, @@ -919,6 +922,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 030000004c050000f20d000000010000,PS5 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:a3,leftx:a0,lefty:a1,misc1:b14,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,touchpad:b13,x:b0,y:b3,platform:Mac OS X, 050000004c050000e60c000000010000,PS5 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:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,touchpad:b13,x:b0,y:b3,platform:Mac OS X, 050000004c050000f20d000000010000,PS5 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:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,touchpad:b13,x:b0,y:b3,platform:Mac OS X, +030000005e040000e002000001000000,PXN P30 Pro Mobile,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Mac OS X, 03000000222c00000225000000010000,Qanba Dragon Arcade Joystick (PS3),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:Mac OS X, 03000000222c00000020000000010000,Qanba Drone Arcade Stick,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, 030000008916000000fd000000000000,Razer Onza TE,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X, @@ -940,7 +944,9 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000341200000400000000000000,RetroUSB N64 RetroPort,+rightx:b8,+righty:b10,-rightx:b9,-righty:b11,a:b7,b:b6,dpdown:b2,dpleft:b1,dpright:b0,dpup:b3,leftshoulder:b13,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b12,start:b4,platform:Mac OS X, 030000006b140000010d000000010000,Revolution Pro 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: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, 030000006b140000130d000000010000,Revolution Pro Controller 3,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, +030000004c0500006802000002100000,Rii RK707,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b2,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b3,righttrigger:b9,rightx:a2,righty:a3,start:b1,x:b15,y:b12,platform:Mac OS X, 03000000c6240000fefa000000000000,Rock Candy PS3,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X, +030000006f0e00008701000005010000,Rock Candy Switch 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:Mac OS X, 03000000730700000401000000010000,Sanwa PlayOnline Mobile,a:b0,b:b1,back:b2,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,start:b3,platform:Mac OS X, 03000000a30c00002500000006020000,Sega Genesis Mini 3B Controller,a:b2,b:b1,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,righttrigger:b5,start:b9,platform:Mac OS X, 03000000811700007e05000000000000,Sega Saturn,a:b2,b:b4,dpdown:b16,dpleft:b15,dpright:b14,dpup:b17,leftshoulder:b8,lefttrigger:a5,leftx:a0,lefty:a2,rightshoulder:b9,righttrigger:a4,start:b13,x:b0,y:b6,platform:Mac OS X, @@ -973,6 +979,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 030000005f140000c501000000020000,Trust Gamepad,a:b2,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:b0,platform:Mac OS X, 03000000100800000100000000000000,Twin USB Joystick,a:b4,b:b2,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b12,leftstick:b20,lefttrigger:b8,leftx:a0,lefty:a2,rightshoulder:b14,rightstick:b22,righttrigger:b10,rightx:a6,righty:a4,start:b18,x:b6,y:b0,platform:Mac OS X, 03000000632500002605000000010000,Uberwith Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,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, +03000000151900005678000010010000,Uniplay U6,a:b3,b:b6,back:b25,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b17,leftstick:b31,lefttrigger:b21,leftx:a1,lefty:a3,rightshoulder:b19,rightstick:b33,righttrigger:b23,rightx:a4,righty:a5,start:b27,x:b11,y:b13,platform:Mac OS X, 030000006f0e00000302000025040000,Victrix PS4 Pro Fightstick,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X, 030000006f0e00000702000003060000,Victrix PS4 Pro Fightstick,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,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Mac OS X, 050000005769696d6f74652028303000,Wii Remote,a:b4,b:b5,back:b7,dpdown:b3,dpleft:b0,dpright:b1,dpup:b2,guide:b8,leftshoulder:b11,lefttrigger:b12,leftx:a0,lefty:a1,start:b6,x:b10,y:b9,platform:Mac OS X, @@ -985,6 +992,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 030000005e040000130b000011050000,Xbox One Controller,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, 030000005e040000200b000011050000,Xbox One Controller,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, 030000005e040000200b000013050000,Xbox One Controller,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, +030000005e040000200b000015050000,Xbox One Controller,a:b0,b:b1,x:b3,y:b4,back:b10,guide:b12,start:b11,leftstick:b13,rightstick:b14,leftshoulder:b6,rightshoulder:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Mac OS X, 030000005e040000d102000000000000,Xbox One Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X, 030000005e040000dd02000000000000,Xbox One Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,platform:Mac OS X, 030000005e040000e002000000000000,Xbox One Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Mac OS X, @@ -1029,8 +1037,11 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000c82d00000751000000010000,8BitDo P30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:a8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, 05000000c82d00000851000000010000,8BitDo P30,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:a8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, 03000000c82d00000660000011010000,8BitDo Pro 2,a:b1,b:b0,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:b4,y:b3,platform:Linux, -03000000c82d00001030000011010000,8BitDo Pro 2,a:b1,b:b0,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:b4,y:b3,platform:Linux, 05000000c82d00000660000000010000,8BitDo Pro 2,a:b1,b:b0,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:b4,y:b3,platform:Linux, +03000000c82d00000631000014010000,8BitDo Pro 2 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, +03000000c82d00001030000011010000,8BitDo Pro 2 Wired Controller,a:b1,b:b0,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:b4,y:b3,platform:Linux, +03000000c82d00000020000000000000,8BitDo Pro 2 Wired Controller for Xbox,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, +06000000c82d00000020000006010000,8BitDo Pro 2 Wired Controller for Xbox,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, 03000000c82d00000131000011010000,8BitDo Receiver,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, 03000000c82d00000231000011010000,8BitDo Receiver,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, 03000000c82d00000331000011010000,8BitDo Receiver,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b2,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, @@ -1053,7 +1064,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000c82d00000260000011010000,8BitDo SN30 Pro Plus,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, 05000000c82d00000261000000010000,8BitDo SN30 Pro Plus,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, 05000000202800000900000000010000,8BitDo SNES30,a:b1,b:b0,back:b10,dpdown:b122,dpleft:b119,dpright:b120,dpup:b117,leftshoulder:b6,rightshoulder:b7,start:b11,x:b4,y:b3,platform:Linux, -03000000c82d00001130000011010000,8BitDo Ultimate Wired,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, +03000000c82d00001130000011010000,8BitDo Ultimate Wired,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,misc1:b26,paddle1:b24,paddle2:b25,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, 03000000c82d00000760000011010000,8BitDo Ultimate Wireless,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b4,y:b3,platform:Linux, 03000000c82d00001230000011010000,8BitDo Ultimate Wireless,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, 03000000c82d00001330000011010000,8BitDo Ultimate Wireless,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,misc1:b26,paddle1:b23,paddle2:b19,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, @@ -1116,12 +1127,14 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000430b00000300000000010000,EMS Production PS2 Adapter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a5,righty:a2,start:b9,x:b3,y:b0,platform:Linux, 03000000b40400001124000011010000,Flydigi Vader 2,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b12,lefttrigger:a5,leftx:a0,lefty:a1,paddle1:b2,paddle2:b5,paddle4:b17,rightshoulder:b7,rightstick:b13,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, 05000000151900004000000001000000,Flydigi Vader 2,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux, +030000007e0500003703000000000000,GameCube Adapter,a:b0,b:b1,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,platform:Linux, 19000000030000000300000002030000,GameForce Controller,a:b1,b:b0,back:b8,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,guide:b16,leftshoulder:b4,leftstick:b14,lefttrigger:b6,leftx:a1,lefty:a0,rightshoulder:b5,rightstick:b15,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b2,y:b3,platform:Linux, 03000000ac0500005b05000010010000,GameSir G3w,a:b2,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:b0,platform:Linux, 03000000bc2000000055000011010000,GameSir G3w,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,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, 03000000558500001b06000010010000,GameSir G4 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b3,y:b4,platform:Linux, 05000000ac0500002d0200001b010000,GameSir G4s,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b33,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, 03000000bc2000005656000011010000,GameSir T4w,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, +03000000ac0500001a06000011010000,GameSir-T3 2.02,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,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, 0500000047532047616d657061640000,GameStop Gamepad,a:b0,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:b2,y:b3,platform:Linux, 030000006f0e00000104000000010000,Gamestop Logic3 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, 030000008f0e00000800000010010000,Gasia PlayStation 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:a3,start:b9,x:b3,y:b0,platform:Linux, @@ -1149,6 +1162,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 030000000d0f00005001000009040000,Hori Fighting Commander OCTA 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, 030000000d0f00008500000010010000,Hori Fighting Commander PS3,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, 030000000d0f00008600000002010000,Hori Fighting Commander Xbox 360,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, +030000000d0f00003701000013010000,Hori Fighting Stick Mini,a:b1,b:b0,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:a2,rightshoulder:b5,righttrigger:a5,start:b7,x:b3,y:b2,platform:Linux, 030000000d0f00008800000011010000,Hori Fighting Stick mini 4 (PS3),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,rightshoulder:b5,rightstick:b11,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux, 030000000d0f00008700000011010000,Hori Fighting Stick mini 4 (PS4),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,rightshoulder:b5,rightstick:b11,righttrigger:a4,start:b9,x:b0,y:b3,platform:Linux, 030000000d0f00001000000011010000,Hori Fightstick 3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux, @@ -1173,6 +1187,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 05000000242e00000b20000001000000,Hyperkin Admiral N64 Controller,+rightx:b11,+righty:b13,-rightx:b8,-righty:b12,a:b1,b:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b5,start:b9,platform:Linux, 03000000242e0000ff0b000011010000,Hyperkin N64 Adapter,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a2,righty:a3,start:b9,platform:Linux, 03000000242e00008816000001010000,Hyperkin X91,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, +03000000f00300008d03000011010000,HyperX Clutch,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, 03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,platform:Linux, 050000006964726f69643a636f6e0000,idroidcon 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, 03000000b50700001503000010010000,Impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux, @@ -1230,8 +1245,10 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 0300000079000000d218000011010000,Mayflash Magic NS,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, 03000000d620000010a7000011010000,Mayflash Magic NS,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, 03000000242f0000f700000001010000,Mayflash Magic S Pro,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, +030000008f0e00001030000010010000,Mayflash Saturn Adapter,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,lefttrigger:b7,rightshoulder:b6,righttrigger:b2,start:b9,x:b3,y:b4,platform:Linux, 0300000025090000e803000001010000,Mayflash Wii Classic Adapter,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:a4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:a5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,platform:Linux, 03000000790000000318000011010000,Mayflash Wii DolphinBar,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b11,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b1,platform:Linux, +03000000790000000018000011010000,Mayflash Wii U Pro Adapter,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, 03000000b50700001203000010010000,Mega World Logic 3 Controller,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,platform:Linux, 03000000780000000600000010010000,Microntek Joystick,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, 030000005e0400002800000000010000,Microsoft Dual Strike,a:b3,b:b2,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,rightshoulder:b7,rightx:a0,righty:a1~,start:b5,x:b1,y:b0,platform:Linux, @@ -1276,12 +1293,14 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 030000009b2800008000000020020000,Nintendo Classic Controller,a:b1,b:b4,back:b2,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,leftshoulder:b6,rightshoulder:b7,start:b3,x:b0,y:b5,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:b0,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:b2,y:b3,platform:Linux, +060000004e696e74656e646f20537700,Nintendo Switch Combined Joy-Cons,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,misc1:b4,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, 060000007e0500000620000000000000,Nintendo Switch Combined Joy-Cons,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,misc1:b4,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, 060000007e0500000820000000000000,Nintendo Switch Combined Joy-Cons,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,misc1:b4,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, 050000004c69632050726f20436f6e00,Nintendo Switch 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,misc1:b13,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,platform:Linux, 050000007e0500000620000001800000,Nintendo Switch Left Joy-Con,a:b16,b:b15,back:b4,leftshoulder:b6,leftstick:b12,leftx:a1,lefty:a0~,rightshoulder:b8,start:b9,x:b14,y:b17,platform:Linux, 03000000d620000013a7000011010000,Nintendo Switch PowerA 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, 03000000d620000011a7000011010000,Nintendo Switch PowerA Core Plus 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, +030000007e0500000920000000026803,Nintendo Switch Pro Controller,a:b1,b:b0,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,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,misc1:b4,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,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,misc1:b4,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,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,misc1:b4,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b3,y:b2,platform:Linux, @@ -1312,7 +1331,6 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 030000006f0e0000c802000012010000,PDP Kingdom Hearts 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, 030000006f0e00008501000011010000,PDP Nintendo Switch Fightpad Pro,a:b2,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:b0,platform:Linux, 030000006f0e00002801000011010000,PDP PS3 Rock Candy 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, -030000006f0e00008701000011010000,PDP Rock Nintendo Switch Candy Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,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, 030000006f0e00000901000011010000,PDP Versus Fighting,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,platform:Linux, 030000006f0e0000a802000023020000,PDP Xbox One Controller,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, 030000006f0e0000a702000023020000,PDP Xbox One Raven Black,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, @@ -1330,6 +1348,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000d62000000228000001010000,PowerA Xbox One 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, 03000000c62400001a54000001010000,PowerA Xbox One Mini 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, 03000000d62000000240000001010000,PowerA Xbox One Spectra Infinity,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,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, +03000000d62000000f20000001010000,PowerA Xbox Series Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,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, @@ -1369,6 +1388,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000300f00001211000011010000,Qanba Arcade Joystick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,platform:Linux, 03000000222c00000225000011010000,Qanba Dragon Arcade Joystick (PS3),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, 03000000222c00000025000011010000,Qanba Dragon Arcade Joystick (PS4),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:Linux, +03000000222c00000020000011010000,Qanba Drone Arcade PS4 Joystick,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,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,platform:Linux, 03000000300f00001210000010010000,Qanba Joystick Plus,a:b0,b:b1,back:b8,leftshoulder:b5,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b4,righttrigger:b6,start:b9,x:b2,y:b3,platform:Linux, 03000000222c00000223000011010000,Qanba Obsidian Arcade Joystick (PS3),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, 03000000222c00000023000011010000,Qanba Obsidian Arcade Joystick (PS4),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:Linux, @@ -1400,6 +1420,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 030000006b140000130d000011010000,Revolution Pro Controller 3,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:Linux, 030000006f0e00001f01000000010000,Rock Candy,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, 030000006f0e00001e01000011010000,Rock Candy 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, +030000006f0e00008701000011010000,Rock Candy Switch Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,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, 03000000c6240000fefa000000010000,Rock Candy Xbox 360 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, 030000006f0e00004601000001010000,Rock Candy Xbox One 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, 03000000a306000023f6000011010000,Saitek Cyborg V1 PlayStation 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:a4,start:b9,x:b0,y:b3,platform:Linux, @@ -1429,6 +1450,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 030000005e0400008e02000073050000,Speedlink Torid,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, 030000005e0400008e02000020200000,SpeedLink Xeox Pro Analog,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, 03000000d11800000094000011010000,Stadia 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:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux, +05000000d11800000094000000010000,Stadia 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:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,platform:Linux, 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, 03000000de2800000112000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,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, @@ -1482,6 +1504,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 03000000f00600000300000003000000,TRBot Virtual Joypad,a:b11,b:b12,back:b15,dpdown:b6,dpleft:b3,dpright:b4,dpup:b5,leftshoulder:b17,leftstick:b21,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b22,righttrigger:a2,rightx:a3,righty:a4,start:b16,x:b13,y:b14,platform:Linux, 030000005f140000c501000010010000,Trust Gamepad,a:b2,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:b0,platform:Linux, 03000000100800000100000010010000,Twin PS2 Adapter,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux, +03000000151900005678000010010000,Uniplay U6,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,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, 03000000100800000300000010010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a3,righty:a2,start:b9,x:b3,y:b0,platform:Linux, 03000000790000000600000007010000,USB 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:a3,righty:a4,start:b9,x:b3,y:b0,platform:Linux, 03000000790000001100000000010000,USB Gamepad,a:b2,b:b1,back:b8,dpdown:a0,dpleft:a1,dpright:a2,dpup:a4,start:b9,platform:Linux, @@ -1656,9 +1679,11 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 6d6179666c617368206c696d69746564,Mayflash GameCube Adapter,a:b22,b:b21,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:b25,leftx:a0,lefty:a1,rightshoulder:b28,righttrigger:b26,rightx:a5,righty:a2,start:b30,x:b23,y:b24,platform:Android, 436f6e74726f6c6c6572000000000000,Mayflash N64 Adapter,a:b1,b:b19,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b3,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b20,rightx:a2,righty:a3,start:b18,platform:Android, 65666330633838383061313633326461,Mayflash N64 Adapter,a:b1,b:b19,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b3,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b20,rightx:a2,righty:a3,start:b18,platform:Android, +37316565396364386635383230353365,Mayflash Saturn Adapter,a:b21,b:b22,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b26,lefttrigger:b28,rightshoulder:b27,righttrigger:b23,start:b30,x:b24,y:b25,platform:Android, +4875694a696120205553422047616d65,Mayflash Saturn Adapter,a:b21,b:b22,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b26,lefttrigger:b28,rightshoulder:b27,righttrigger:b23,start:b30,x:b24,y:b25,platform:Android, 535a4d792d706f776572204c54442043,Mayflash Wii Classic Adapter,a:b23,b:b22,back:b29,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b31,leftshoulder:b27,lefttrigger:b25,leftx:a0,lefty:a1,rightshoulder:b28,righttrigger:b26,rightx:a2,righty:a3,start:b30,x:b24,y:b21,platform:Android, 30653962643666303631376438373532,Mayflash Wii DolphinBar,a:b23,b:b24,back:b29,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b0,leftshoulder:b25,lefttrigger:b27,leftx:a0,lefty:a1,rightshoulder:b26,righttrigger:b28,rightx:a2,righty:a3,start:b30,x:b21,y:b22,platform:Android, -484a5a204d6179666c61736820576969,Mayflash Wii DolphinBar,a:b23,b:b24,back:b29,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b0,leftshoulder:b25,lefttrigger:b27,leftx:a0,lefty:a1,rightshoulder:b26,righttrigger:b28,rightx:a2,righty:a3,start:b30,x:b21,y:b22,platform:Android, +39346131396233376535393665363161,Mayflash Wii U Pro Adapter,a:b22,b:b23,back:b29,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b25,leftstick:b31,lefttrigger:b27,rightshoulder:b26,rightstick:b0,righttrigger:b28,rightx:a0,righty:a1,start:b30,x:b21,y:b24,platform:Android, 31323564663862633234646330373138,Mega Drive,a:b23,b:b22,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,rightshoulder:b25,righttrigger:b26,start:b30,x:b24,y:b21,platform:Android, 37333564393261653735306132613061,Mega Drive,a:b21,b:b22,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b26,lefttrigger:b28,rightshoulder:b27,righttrigger:b23,start:b30,x:b24,y:b25,platform:Android, 64363363336633363736393038313464,Mega Drive,a:b1,b:b0,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,start:b9,x:b2,y:b3,platform:Android, @@ -1737,10 +1762,10 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 5365616c6965436f6d707574696e6720,RetroUSB N64 RetroPort,+rightx:b17,+righty:b15,-rightx:b18,-righty:b6,a:b10,b:b9,dpdown:b19,dpleft:b1,dpright:b0,dpup:b2,leftshoulder:b7,lefttrigger:b20,leftx:a0,lefty:a1,rightshoulder:b5,start:b3,platform:Android, 526574726f5553422e636f6d20534e45,RetroUSB SNES RetroPort,a:b1,b:b20,back:b19,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b9,rightshoulder:b10,start:b2,x:b0,y:b3,platform:Android, 64643037633038386238303966376137,RetroUSB SNES RetroPort,a:b1,b:b20,back:b19,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b9,rightshoulder:b10,start:b2,x:b0,y:b3,platform:Android, +37656564346533643138636436356230,Rock Candy Switch Controller,a:b1,b:b19,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b3,leftstick:b15,lefttrigger:b9,leftx:a0,lefty:a1,misc1:b7,rightshoulder:b20,rightstick:b6,righttrigger:b10,rightx:a2,righty:a3,start:b18,x:b0,y:b2,platform:Android, 33373336396634316434323337666361,RumblePad 2,a:b22,b:b23,back:b29,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b25,lefttrigger:b27,leftx:a0,lefty:a1,rightshoulder:b26,righttrigger:b28,rightx:a2,righty:a3,start:b30,x:b21,y:b24,platform:Android, 66386565396238363534313863353065,Sanwa PlayOnline Mobile,a:b21,b:b22,back:b23,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,start:b24,platform:Android, 32383165316333383766336338373261,Saturn,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,lefttrigger:b10,leftx:a0,lefty:a1,rightshoulder:a4,righttrigger:a5,x:b2,y:b3,platform:Android, -37316565396364386635383230353365,Saturn,a:b21,b:b22,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b26,lefttrigger:b28,rightshoulder:b27,righttrigger:b23,start:b30,x:b24,y:b25,platform:Android, 38613865396530353338373763623431,Saturn,a:b0,b:b1,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b9,lefttrigger:b10,rightshoulder:b20,righttrigger:b19,start:b17,x:b2,y:b3,platform:Android, 61316232336262373631343137633631,Saturn,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,lefttrigger:b10,leftx:a0,lefty:a1,rightshoulder:a4,righttrigger:a5,x:b2,y:b3,platform:Android, 30353835333338613130373363646337,SG H510,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b3,leftstick:b17,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b20,rightstick:b18,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b19,y:b2,platform:Android, @@ -1753,6 +1778,7 @@ xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2, 63303964303462366136616266653561,Sony PSP,a:b21,b:b22,back:b27,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b25,leftx:a0,lefty:a1,rightshoulder:b26,start:b28,x:b23,y:b24,platform:Android, 63376637643462343766333462383235,Sony Vita,a:b1,b:b19,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftshoulder:b3,leftx:a0,lefty:a1,rightshoulder:b20,rightx:a3,righty:a4,start:b18,x:b0,y:b2,platform:Android, 476f6f676c65204c4c43205374616469,Stadia Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android, +5374616469614e3848532d6532633400,Stadia Controller,a:b0,b:b1,back:b15,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,platform:Android, 05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Android, 05000000de2800000611000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,platform:Android, 0500000011010000201400000f7e0f00,SteelSeries Nimbus,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b3,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b20,righttrigger:b10,rightx:a2,righty:a3,x:b19,y:b2,platform:Android, diff --git a/core/input/godotcontrollerdb.txt b/core/input/godotcontrollerdb.txt index e11099f380..eb4a1a1578 100644 --- a/core/input/godotcontrollerdb.txt +++ b/core/input/godotcontrollerdb.txt @@ -32,7 +32,7 @@ Linux046dc216,046d-c216-Logitech Logitech Dual Action,a:b1,b:b2,y:b3,x:b0,start: Linux20d6a713,Bensussen Deutsch & Associates Inc.(BDA) NSW Wired controller,a:b1,b:b2,y:b3,x:b0,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:-a5,dpleft:-a4,dpdown:+a5,dpright:+a4,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7,platform:Web Linux054c05c4,Sony Computer Entertainment Wireless Controller,a:b0,b:b1,y:b2,x:b3,start:b9,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web Linux18d19400,18d1-9400-Google LLC Stadia Controller rev. A,a:b0,b:b1,y:b3,x:b2,start:b7,back:b6,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:-a7,dpleft:-a6,dpdown:+a7,dpright:+a6,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,platform:Web -Linux054c0268,054c-0268-Sony PLAYSTATION(R)3 Controller,a:b0,b:b1,y:b2,x:b3,start:b9,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b15,dpdown:b14,dpright:b16,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web +Linux054c0268,054c-0268-Sony PLAYSTATION(R)3 Controller,a:b0,b:b1,y:b2,x:b3,start:b9,guide:b10,back:b8,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b5,dpup:b13,dpleft:b15,dpdown:b14,dpright:b16,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Web # UWP __UWP_GAMEPAD__,Xbox Controller,a:b2,b:b3,x:b4,y:b5,start:b0,back:b1,leftstick:b12,rightstick:b13,leftshoulder:b10,rightshoulder:b11,dpup:b6,dpdown:b7,dpleft:b8,dpright:b9,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:UWP, diff --git a/core/input/input.cpp b/core/input/input.cpp index c04fc894c8..b2164b8e76 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -1365,8 +1365,9 @@ void Input::parse_mapping(String p_mapping) { JoyButton output_button = _get_output_button(output); JoyAxis output_axis = _get_output_axis(output); - ERR_CONTINUE_MSG(output_button == JoyButton::INVALID && output_axis == JoyAxis::INVALID, - vformat("Unrecognized output string \"%s\" in mapping:\n%s", output, p_mapping)); + if (output_button == JoyButton::INVALID && output_axis == JoyAxis::INVALID) { + print_verbose(vformat("Unrecognized output string \"%s\" in mapping:\n%s", output, p_mapping)); + } ERR_CONTINUE_MSG(output_button != JoyButton::INVALID && output_axis != JoyAxis::INVALID, vformat("Output string \"%s\" matched both button and axis in mapping:\n%s", output, p_mapping)); diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 0fa82bb8c1..078320d620 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -31,6 +31,7 @@ #ifndef MATH_FUNCS_H #define MATH_FUNCS_H +#include "core/error/error_macros.h" #include "core/math/math_defs.h" #include "core/math/random_pcg.h" #include "core/typedefs.h" @@ -225,6 +226,7 @@ public: } static _ALWAYS_INLINE_ int64_t posmod(int64_t p_x, int64_t p_y) { + ERR_FAIL_COND_V_MSG(p_y == 0, 0, "Division by zero in posmod is undefined. Returning 0 as fallback."); int64_t value = p_x % p_y; if (((value < 0) && (p_y > 0)) || ((value > 0) && (p_y < 0))) { value += p_y; diff --git a/core/math/vector3.h b/core/math/vector3.h index bd8739d024..18943a820f 100644 --- a/core/math/vector3.h +++ b/core/math/vector3.h @@ -76,6 +76,14 @@ struct _NO_DISCARD_ Vector3 { return x < y ? (y < z ? Vector3::AXIS_Z : Vector3::AXIS_Y) : (x < z ? Vector3::AXIS_Z : Vector3::AXIS_X); } + Vector3 min(const Vector3 &p_vector3) const { + return Vector3(MIN(x, p_vector3.x), MIN(y, p_vector3.y), MIN(z, p_vector3.z)); + } + + Vector3 max(const Vector3 &p_vector3) const { + return Vector3(MAX(x, p_vector3.x), MAX(y, p_vector3.y), MAX(z, p_vector3.z)); + } + _FORCE_INLINE_ real_t length() const; _FORCE_INLINE_ real_t length_squared() const; diff --git a/core/math/vector3i.h b/core/math/vector3i.h index 96f9beef12..53d3829a99 100644 --- a/core/math/vector3i.h +++ b/core/math/vector3i.h @@ -69,6 +69,14 @@ struct _NO_DISCARD_ Vector3i { Vector3i::Axis min_axis_index() const; Vector3i::Axis max_axis_index() const; + Vector3i min(const Vector3i &p_vector3i) const { + return Vector3i(MIN(x, p_vector3i.x), MIN(y, p_vector3i.y), MIN(z, p_vector3i.z)); + } + + Vector3i max(const Vector3i &p_vector3i) const { + return Vector3i(MAX(x, p_vector3i.x), MAX(y, p_vector3i.y), MAX(z, p_vector3i.z)); + } + _FORCE_INLINE_ int64_t length_squared() const; _FORCE_INLINE_ double length() const; diff --git a/core/math/vector4.h b/core/math/vector4.h index 0509261f33..f16b040317 100644 --- a/core/math/vector4.h +++ b/core/math/vector4.h @@ -68,6 +68,14 @@ struct _NO_DISCARD_ Vector4 { Vector4::Axis min_axis_index() const; Vector4::Axis max_axis_index() const; + Vector4 min(const Vector4 &p_vector4) const { + return Vector4(MIN(x, p_vector4.x), MIN(y, p_vector4.y), MIN(z, p_vector4.z), MIN(w, p_vector4.w)); + } + + Vector4 max(const Vector4 &p_vector4) const { + return Vector4(MAX(x, p_vector4.x), MAX(y, p_vector4.y), MAX(z, p_vector4.z), MAX(w, p_vector4.w)); + } + _FORCE_INLINE_ real_t length_squared() const; bool is_equal_approx(const Vector4 &p_vec4) const; bool is_zero_approx() const; diff --git a/core/math/vector4i.h b/core/math/vector4i.h index d38a9de6f1..b815aa8e76 100644 --- a/core/math/vector4i.h +++ b/core/math/vector4i.h @@ -71,6 +71,14 @@ struct _NO_DISCARD_ Vector4i { Vector4i::Axis min_axis_index() const; Vector4i::Axis max_axis_index() const; + Vector4i min(const Vector4i &p_vector4i) const { + return Vector4i(MIN(x, p_vector4i.x), MIN(y, p_vector4i.y), MIN(z, p_vector4i.z), MIN(w, p_vector4i.w)); + } + + Vector4i max(const Vector4i &p_vector4i) const { + return Vector4i(MAX(x, p_vector4i.x), MAX(y, p_vector4i.y), MAX(z, p_vector4i.z), MAX(w, p_vector4i.w)); + } + _FORCE_INLINE_ int64_t length_squared() const; _FORCE_INLINE_ double length() const; diff --git a/core/object/class_db.h b/core/object/class_db.h index 0e408e8845..0b62cf40f7 100644 --- a/core/object/class_db.h +++ b/core/object/class_db.h @@ -40,6 +40,8 @@ #include "core/object/callable_method_pointer.h" #include "core/templates/hash_set.h" +#include <type_traits> + #define DEFVAL(m_defval) (m_defval) #ifdef DEBUG_METHODS_ENABLED @@ -241,6 +243,24 @@ public: static uint64_t get_api_hash(APIType p_api); + template <typename> + struct member_function_traits; + + template <typename R, typename T, typename... Args> + struct member_function_traits<R (T::*)(Args...)> { + using return_type = R; + }; + + template <typename R, typename T, typename... Args> + struct member_function_traits<R (T::*)(Args...) const> { + using return_type = R; + }; + + template <typename R, typename... Args> + struct member_function_traits<R (*)(Args...)> { + using return_type = R; + }; + template <class N, class M, typename... VarArgs> static MethodBind *bind_method(N p_method_name, M p_method, VarArgs... p_args) { Variant args[sizeof...(p_args) + 1] = { p_args..., Variant() }; // +1 makes sure zero sized arrays are also supported. @@ -249,6 +269,9 @@ public: argptrs[i] = &args[i]; } MethodBind *bind = create_method_bind(p_method); + if constexpr (std::is_same<typename member_function_traits<M>::return_type, Object *>::value) { + bind->set_return_type_is_raw_object_ptr(true); + } return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, sizeof...(p_args) == 0 ? nullptr : (const Variant **)argptrs, sizeof...(p_args)); } @@ -261,6 +284,9 @@ public: } MethodBind *bind = create_static_method_bind(p_method); bind->set_instance_class(p_class); + if constexpr (std::is_same<typename member_function_traits<M>::return_type, Object *>::value) { + bind->set_return_type_is_raw_object_ptr(true); + } return bind_methodfi(METHOD_FLAGS_DEFAULT, bind, p_method_name, sizeof...(p_args) == 0 ? nullptr : (const Variant **)argptrs, sizeof...(p_args)); } @@ -273,6 +299,9 @@ public: bind->set_name(p_name); bind->set_default_arguments(p_default_args); + if constexpr (std::is_same<typename member_function_traits<M>::return_type, Object *>::value) { + bind->set_return_type_is_raw_object_ptr(true); + } String instance_type = bind->get_instance_class(); diff --git a/core/object/message_queue.cpp b/core/object/message_queue.cpp index ebed6c21e9..decf030e27 100644 --- a/core/object/message_queue.cpp +++ b/core/object/message_queue.cpp @@ -55,9 +55,9 @@ Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Vari if (ObjectDB::get_instance(p_id)) { type = ObjectDB::get_instance(p_id)->get_class(); } - print_line("Failed set: " + type + ":" + p_prop + " target ID: " + itos(p_id)); + ERR_PRINT("Failed set: " + type + ":" + p_prop + " target ID: " + itos(p_id) + ". Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings."); statistics(); - ERR_FAIL_V_MSG(ERR_OUT_OF_MEMORY, "Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings."); + return ERR_OUT_OF_MEMORY; } Message *msg = memnew_placement(&buffer[buffer_end], Message); @@ -82,9 +82,9 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) { uint8_t room_needed = sizeof(Message); if ((buffer_end + room_needed) >= buffer_size) { - print_line("Failed notification: " + itos(p_notification) + " target ID: " + itos(p_id)); + ERR_PRINT("Failed notification: " + itos(p_notification) + " target ID: " + itos(p_id) + ". Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings."); statistics(); - ERR_FAIL_V_MSG(ERR_OUT_OF_MEMORY, "Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings."); + return ERR_OUT_OF_MEMORY; } Message *msg = memnew_placement(&buffer[buffer_end], Message); @@ -117,9 +117,9 @@ Error MessageQueue::push_callablep(const Callable &p_callable, const Variant **p int room_needed = sizeof(Message) + sizeof(Variant) * p_argcount; if ((buffer_end + room_needed) >= buffer_size) { - print_line("Failed method: " + p_callable); + ERR_PRINT("Failed method: " + p_callable + ". Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings."); statistics(); - ERR_FAIL_V_MSG(ERR_OUT_OF_MEMORY, "Message queue out of memory. Try increasing 'memory/limits/message_queue/max_size_kb' in project settings."); + return ERR_OUT_OF_MEMORY; } Message *msg = memnew_placement(&buffer[buffer_end], Message); diff --git a/core/object/method_bind.h b/core/object/method_bind.h index 8334a7eef6..d37479f45b 100644 --- a/core/object/method_bind.h +++ b/core/object/method_bind.h @@ -49,6 +49,7 @@ class MethodBind { bool _static = false; bool _const = false; bool _returns = false; + bool _returns_raw_obj_ptr = false; protected: Variant::Type *argument_types = nullptr; @@ -121,6 +122,9 @@ public: _FORCE_INLINE_ bool has_return() const { return _returns; } virtual bool is_vararg() const { return false; } + _FORCE_INLINE_ bool is_return_type_raw_object_ptr() { return _returns_raw_obj_ptr; } + _FORCE_INLINE_ void set_return_type_is_raw_object_ptr(bool p_returns_raw_obj) { _returns_raw_obj_ptr = p_returns_raw_obj; } + void set_default_arguments(const Vector<Variant> &p_defargs); uint32_t get_hash() const; diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index 1d53cf66d4..71f40660f4 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -165,22 +165,30 @@ ScriptLanguage *ScriptServer::get_language(int p_idx) { return _languages[p_idx]; } -void ScriptServer::register_language(ScriptLanguage *p_language) { - ERR_FAIL_NULL(p_language); - ERR_FAIL_COND(_language_count >= MAX_LANGUAGES); +Error ScriptServer::register_language(ScriptLanguage *p_language) { + ERR_FAIL_NULL_V(p_language, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V_MSG(_language_count >= MAX_LANGUAGES, ERR_UNAVAILABLE, "Script languages limit has been reach, cannot register more."); + for (int i = 0; i < _language_count; i++) { + const ScriptLanguage *other_language = _languages[i]; + ERR_FAIL_COND_V_MSG(other_language->get_extension() == p_language->get_extension(), ERR_ALREADY_EXISTS, "A script language with extension '" + p_language->get_extension() + "' is already registered."); + ERR_FAIL_COND_V_MSG(other_language->get_name() == p_language->get_name(), ERR_ALREADY_EXISTS, "A script language with name '" + p_language->get_name() + "' is already registered."); + ERR_FAIL_COND_V_MSG(other_language->get_type() == p_language->get_type(), ERR_ALREADY_EXISTS, "A script language with type '" + p_language->get_type() + "' is already registered."); + } _languages[_language_count++] = p_language; + return OK; } -void ScriptServer::unregister_language(const ScriptLanguage *p_language) { +Error ScriptServer::unregister_language(const ScriptLanguage *p_language) { for (int i = 0; i < _language_count; i++) { if (_languages[i] == p_language) { _language_count--; if (i < _language_count) { SWAP(_languages[i], _languages[_language_count]); } - return; + return OK; } } + return ERR_DOES_NOT_EXIST; } void ScriptServer::init_languages() { diff --git a/core/object/script_language.h b/core/object/script_language.h index 14cc30e029..3ef121a8e7 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -70,8 +70,8 @@ public: static bool is_scripting_enabled(); _FORCE_INLINE_ static int get_language_count() { return _language_count; } static ScriptLanguage *get_language(int p_idx); - static void register_language(ScriptLanguage *p_language); - static void unregister_language(const ScriptLanguage *p_language); + static Error register_language(ScriptLanguage *p_language); + static Error unregister_language(const ScriptLanguage *p_language); static void set_reload_scripts_on_save(bool p_enable); static bool is_reload_scripts_on_save_enabled(); diff --git a/core/string/translation_po.cpp b/core/string/translation_po.cpp index 2d3a9c7575..6b1595174a 100644 --- a/core/string/translation_po.cpp +++ b/core/string/translation_po.cpp @@ -254,11 +254,6 @@ StringName TranslationPO::get_plural_message(const StringName &p_src_text, const } ERR_FAIL_COND_V_MSG(translation_map[p_context][p_src_text].is_empty(), StringName(), "Source text \"" + String(p_src_text) + "\" is registered but doesn't have a translation. Please report this bug."); - if (translation_map[p_context][p_src_text].size() == 1) { - WARN_PRINT("Source string \"" + String(p_src_text) + "\" doesn't have plural translations. Use singular translation API for such as tr(), TTR() to translate \"" + String(p_src_text) + "\""); - return translation_map[p_context][p_src_text][0]; - } - int plural_index = _get_plural_index(p_n); ERR_FAIL_COND_V_MSG(plural_index < 0 || translation_map[p_context][p_src_text].size() < plural_index + 1, StringName(), "Plural index returned or number of plural translations is not valid. Please report this bug."); diff --git a/core/variant/variant.h b/core/variant/variant.h index b2f31a6d57..f694e59051 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -346,6 +346,10 @@ public: bool is_one() const; bool is_null() const; + // Make sure Variant is not implicitly cast when accessing it with bracket notation (GH-49469). + Variant &operator[](const Variant &p_key) = delete; + const Variant &operator[](const Variant &p_key) const = delete; + operator bool() const; operator signed int() const; operator unsigned int() const; // this is the real one diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index 59f562865d..33c285dc6d 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -1105,8 +1105,11 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { evaluate(OP_IN, p_index, *this, ret, valid); if (r_valid) { *r_valid = valid; + } + if (valid) { + ERR_FAIL_COND_V(ret.type != BOOL, false); + return *VariantGetInternalPtr<bool>::get_ptr(&ret); + } else { return false; } - ERR_FAIL_COND_V(ret.type != BOOL, false); - return *VariantGetInternalPtr<bool>::get_ptr(&ret); } diff --git a/doc/classes/AnimationNodeAnimation.xml b/doc/classes/AnimationNodeAnimation.xml index 5a8bac1629..93839c6782 100644 --- a/doc/classes/AnimationNodeAnimation.xml +++ b/doc/classes/AnimationNodeAnimation.xml @@ -21,8 +21,10 @@ </members> <constants> <constant name="PLAY_MODE_FORWARD" value="0" enum="PlayMode"> + Plays animation in forward direction. </constant> <constant name="PLAY_MODE_BACKWARD" value="1" enum="PlayMode"> + Plays animation in backward direction. </constant> </constants> </class> diff --git a/doc/classes/AnimationNodeOneShot.xml b/doc/classes/AnimationNodeOneShot.xml index 9e8193868c..713296069d 100644 --- a/doc/classes/AnimationNodeOneShot.xml +++ b/doc/classes/AnimationNodeOneShot.xml @@ -5,6 +5,35 @@ </brief_description> <description> A resource to add to an [AnimationNodeBlendTree]. This node will execute a sub-animation and return once it finishes. Blend times for fading in and out can be customized, as well as filters. + After setting the request and changing the animation playback, the one-shot node automatically clears the request on the next process frame by setting its [code]request[/code] value to [constant ONE_SHOT_REQUEST_NONE]. + [codeblocks] + [gdscript] + # Play child animation connected to "shot" port. + animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) + # Alternative syntax (same result as above). + animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE + + # Abort child animation connected to "shot" port. + animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT) + # Alternative syntax (same result as above). + animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT + + # Get current state (read-only). + animation_tree.get("parameters/OneShot/active")) + # Alternative syntax (same result as above). + animation_tree["parameters/OneShot/active"] + [/gdscript] + [csharp] + // Play child animation connected to "shot" port. + animationTree.Set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE); + + // Abort child animation connected to "shot" port. + animationTree.Set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT); + + // Get current state (read-only). + animationTree.Get("parameters/OneShot/active"); + [/csharp] + [/codeblocks] </description> <tutorials> <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> @@ -13,6 +42,7 @@ <members> <member name="autorestart" type="bool" setter="set_autorestart" getter="has_autorestart" default="false"> If [code]true[/code], the sub-animation will restart automatically after finishing. + In other words, to start auto restarting, the animation must be played once with the [constant ONE_SHOT_REQUEST_FIRE] request. The [constant ONE_SHOT_REQUEST_ABORT] request stops the auto restarting, but it does not disable the [member autorestart] itself. So, the [constant ONE_SHOT_REQUEST_FIRE] request will start auto restarting again. </member> <member name="autorestart_delay" type="float" setter="set_autorestart_delay" getter="get_autorestart_delay" default="1.0"> The delay after which the automatic restart is triggered, in seconds. @@ -21,22 +51,30 @@ If [member autorestart] is [code]true[/code], a random additional delay (in seconds) between 0 and this value will be added to [member autorestart_delay]. </member> <member name="fadein_time" type="float" setter="set_fadein_time" getter="get_fadein_time" default="0.0"> + The fade-in duration. For example, setting this to [code]1.0[/code] for a 5 second length animation will produce a crossfade that starts at 0 second and ends at 1 second during the animation. </member> <member name="fadeout_time" type="float" setter="set_fadeout_time" getter="get_fadeout_time" default="0.0"> + The fade-out duration. For example, setting this to [code]1.0[/code] for a 5 second length animation will produce a crossfade that starts at 4 second and ends at 5 second during the animation. </member> <member name="mix_mode" type="int" setter="set_mix_mode" getter="get_mix_mode" enum="AnimationNodeOneShot.MixMode" default="0"> + The blend type. </member> </members> <constants> <constant name="ONE_SHOT_REQUEST_NONE" value="0" enum="OneShotRequest"> + The default state of the request. Nothing is done. </constant> <constant name="ONE_SHOT_REQUEST_FIRE" value="1" enum="OneShotRequest"> + The request to play the animation connected to "shot" port. </constant> <constant name="ONE_SHOT_REQUEST_ABORT" value="2" enum="OneShotRequest"> + The request to stop the animation connected to "shot" port. </constant> <constant name="MIX_MODE_BLEND" value="0" enum="MixMode"> + Blends two animations. See also [AnimationNodeBlend2]. </constant> <constant name="MIX_MODE_ADD" value="1" enum="MixMode"> + Blends two animations additively. See also [AnimationNodeAdd2]. </constant> </constants> </class> diff --git a/doc/classes/AnimationNodeStateMachinePlayback.xml b/doc/classes/AnimationNodeStateMachinePlayback.xml index 17a946bb3e..4772c1d819 100644 --- a/doc/classes/AnimationNodeStateMachinePlayback.xml +++ b/doc/classes/AnimationNodeStateMachinePlayback.xml @@ -24,12 +24,15 @@ <method name="get_current_length" qualifiers="const"> <return type="float" /> <description> + Returns the current state length. + [b]Note:[/b] It is possible that any [AnimationRootNode] can be nodes as well as animations. This means that there can be multiple animations within a single state. Which animation length has priority depends on the nodes connected inside it. Also, if a transition does not reset, the remaining length at that point will be returned. </description> </method> <method name="get_current_node" qualifiers="const"> <return type="StringName" /> <description> Returns the currently playing animation state. + [b]Note:[/b] When using a cross-fade, the current state changes to the next state immediately after the cross-fade begins. </description> </method> <method name="get_current_play_position" qualifiers="const"> diff --git a/doc/classes/AnimationNodeStateMachineTransition.xml b/doc/classes/AnimationNodeStateMachineTransition.xml index bccab4613a..537120aec5 100644 --- a/doc/classes/AnimationNodeStateMachineTransition.xml +++ b/doc/classes/AnimationNodeStateMachineTransition.xml @@ -1,8 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeStateMachineTransition" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + A resource to connect each node to make a path for [AnimationNodeStateMachine]. </brief_description> <description> + The path generated when using [method AnimationNodeStateMachinePlayback.travel] is limited to the nodes connected by [AnimationNodeStateMachineTransition]. + You can set the timing and conditions of the transition in detail. </description> <tutorials> <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> diff --git a/doc/classes/AnimationNodeSync.xml b/doc/classes/AnimationNodeSync.xml index 21cac11d50..c0e7741ac0 100644 --- a/doc/classes/AnimationNodeSync.xml +++ b/doc/classes/AnimationNodeSync.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationNodeSync" inherits="AnimationNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + The base class for [AnimationNode] which has more than two input ports and needs to synchronize them. </brief_description> <description> </description> diff --git a/doc/classes/AnimationNodeTimeSeek.xml b/doc/classes/AnimationNodeTimeSeek.xml index 0a7da8ba07..5033059927 100644 --- a/doc/classes/AnimationNodeTimeSeek.xml +++ b/doc/classes/AnimationNodeTimeSeek.xml @@ -4,25 +4,26 @@ A time-seeking animation node to be used with [AnimationTree]. </brief_description> <description> - This node can be used to cause a seek command to happen to any sub-children of the animation graph. Use this node type to play an [Animation] from the start or a certain playback position inside the [AnimationNodeBlendTree]. After setting the time and changing the animation playback, the seek node automatically goes into sleep mode on the next process frame by setting its [code]seek_position[/code] value to [code]-1.0[/code]. + This node can be used to cause a seek command to happen to any sub-children of the animation graph. Use this node type to play an [Animation] from the start or a certain playback position inside the [AnimationNodeBlendTree]. + After setting the time and changing the animation playback, the time seek node automatically goes into sleep mode on the next process frame by setting its [code]seek_request[/code] value to [code]-1.0[/code]. [codeblocks] [gdscript] # Play child animation from the start. - animation_tree.set("parameters/Seek/seek_position", 0.0) + animation_tree.set("parameters/TimeSeek/seek_request", 0.0) # Alternative syntax (same result as above). - animation_tree["parameters/Seek/seek_position"] = 0.0 + animation_tree["parameters/TimeSeek/seek_request"] = 0.0 # Play child animation from 12 second timestamp. - animation_tree.set("parameters/Seek/seek_position", 12.0) + animation_tree.set("parameters/TimeSeek/seek_request", 12.0) # Alternative syntax (same result as above). - animation_tree["parameters/Seek/seek_position"] = 12.0 + animation_tree["parameters/TimeSeek/seek_request"] = 12.0 [/gdscript] [csharp] // Play child animation from the start. - animationTree.Set("parameters/Seek/seek_position", 0.0); + animationTree.Set("parameters/TimeSeek/seek_request", 0.0); // Play child animation from 12 second timestamp. - animationTree.Set("parameters/Seek/seek_position", 12.0); + animationTree.Set("parameters/TimeSeek/seek_request", 12.0); [/csharp] [/codeblocks] </description> diff --git a/doc/classes/AnimationNodeTransition.xml b/doc/classes/AnimationNodeTransition.xml index bc3e5716dd..4eeaf15b53 100644 --- a/doc/classes/AnimationNodeTransition.xml +++ b/doc/classes/AnimationNodeTransition.xml @@ -5,6 +5,36 @@ </brief_description> <description> Simple state machine for cases which don't require a more advanced [AnimationNodeStateMachine]. Animations can be connected to the inputs and transition times can be specified. + After setting the request and changing the animation playback, the transition node automatically clears the request on the next process frame by setting its [code]transition_request[/code] value to empty. + [b]Note:[/b] When using a cross-fade, [code]current_state[/code] and [code]current_index[/code] change to the next state immediately after the cross-fade begins. + [codeblocks] + [gdscript] + # Play child animation connected to "state_2" port. + animation_tree.set("parameters/Transition/transition_request", "state_2") + # Alternative syntax (same result as above). + animation_tree["parameters/Transition/transition_request"] = "state_2" + + # Get current state name (read-only). + animation_tree.get("parameters/Transition/current_state") + # Alternative syntax (same result as above). + animation_tree["parameters/Transition/current_state"] + + # Get current state index (read-only). + animation_tree.get("parameters/Transition/current_index")) + # Alternative syntax (same result as above). + animation_tree["parameters/Transition/current_index"] + [/gdscript] + [csharp] + // Play child animation connected to "state_2" port. + animationTree.Set("parameters/Transition/transition_request", "state_2"); + + // Get current state name (read-only). + animationTree.Get("parameters/Transition/current_state"); + + // Get current state index (read-only). + animationTree.Get("parameters/Transition/current_index"); + [/csharp] + [/codeblocks] </description> <tutorials> <link title="AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link> diff --git a/doc/classes/AnimationRootNode.xml b/doc/classes/AnimationRootNode.xml index d364c15f77..cdcec3787a 100644 --- a/doc/classes/AnimationRootNode.xml +++ b/doc/classes/AnimationRootNode.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AnimationRootNode" inherits="AnimationNode" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + The [AnimationNode] which can be set as the root of an [AnimationTree]. </brief_description> <description> </description> diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml index 8a98921a60..100a71abef 100644 --- a/doc/classes/Area2D.xml +++ b/doc/classes/Area2D.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Area2D" inherits="CollisionObject2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - 2D area for detection and physics and audio influence. + 2D area for detection, as well as physics and audio influence. </brief_description> <description> 2D area that detects [CollisionObject2D] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping) and route audio to custom audio buses. diff --git a/doc/classes/Area3D.xml b/doc/classes/Area3D.xml index bd046b7cb8..cf9e865064 100644 --- a/doc/classes/Area3D.xml +++ b/doc/classes/Area3D.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="Area3D" inherits="CollisionObject3D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - 3D area for detection and physics and audio influence. + 3D area for detection, as well as physics and audio influence. </brief_description> <description> 3D area that detects [CollisionObject3D] nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping) and route audio to custom audio buses. diff --git a/doc/classes/CPUParticles3D.xml b/doc/classes/CPUParticles3D.xml index 3a15a117f5..df31fa9621 100644 --- a/doc/classes/CPUParticles3D.xml +++ b/doc/classes/CPUParticles3D.xml @@ -143,7 +143,7 @@ Maximum damping. </member> <member name="damping_min" type="float" setter="set_param_min" getter="get_param_min" default="0.0"> - Minimum damping + Minimum damping. </member> <member name="direction" type="Vector3" setter="set_direction" getter="get_direction" default="Vector3(1, 0, 0)"> Unit vector specifying the particles' emission direction. diff --git a/doc/classes/CodeEdit.xml b/doc/classes/CodeEdit.xml index df40d2a4cf..1bc214aea7 100644 --- a/doc/classes/CodeEdit.xml +++ b/doc/classes/CodeEdit.xml @@ -486,7 +486,7 @@ Sets whether line folding is allowed. </member> <member name="line_length_guidelines" type="int[]" setter="set_line_length_guidelines" getter="get_line_length_guidelines" default="[]"> - Draws vertical lines at the provided columns. The first entry is considered a main hard guideline and is draw more prominently + Draws vertical lines at the provided columns. The first entry is considered a main hard guideline and is draw more prominently. </member> <member name="symbol_lookup_on_click" type="bool" setter="set_symbol_lookup_on_click_enabled" getter="is_symbol_lookup_on_click_enabled" default="false"> Set when a validated word from [signal symbol_validate] is clicked, the [signal symbol_lookup] should be emitted. diff --git a/doc/classes/DirectionalLight2D.xml b/doc/classes/DirectionalLight2D.xml index f825a9e082..eb710efda2 100644 --- a/doc/classes/DirectionalLight2D.xml +++ b/doc/classes/DirectionalLight2D.xml @@ -5,6 +5,7 @@ </brief_description> <description> A directional light is a type of [Light2D] node that models an infinite number of parallel rays covering the entire scene. It is used for lights with strong intensity that are located far away from the scene (for example: to model sunlight or moonlight). + [b]Note:[/b] [DirectionalLight2D] does not support light cull masks (but it supports shadow cull masks). It will always light up 2D nodes, regardless of the 2D node's [member CanvasItem.light_mask]. </description> <tutorials> <link title="2D lights and shadows">$DOCS_URL/tutorials/2d/2d_lights_and_shadows.html</link> diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index 55ba1f4f0c..8d2bbc4d29 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -651,7 +651,7 @@ <param index="1" name="idx" type="int" /> <param index="2" name="checkable" type="bool" /> <description> - Sets the type of the item at the specified index [param idx] to radio button. If [code]false[/code], sets the type of the item to plain text + Sets the type of the item at the specified index [param idx] to radio button. If [code]false[/code], sets the type of the item to plain text. [b]Note:[/b] This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups. [b]Note:[/b] This method is implemented on macOS. </description> @@ -1615,7 +1615,7 @@ I-beam cursor shape. This is used by default when hovering a control that accepts text input, such as [LineEdit] or [TextEdit]. </constant> <constant name="CURSOR_POINTING_HAND" value="2" enum="CursorShape"> - Pointing hand cursor shape. This is used by default when hovering a [LinkButton] or an URL tag in a [RichTextLabel].â‹… + Pointing hand cursor shape. This is used by default when hovering a [LinkButton] or an URL tag in a [RichTextLabel]. </constant> <constant name="CURSOR_CROSS" value="3" enum="CursorShape"> Crosshair cursor. This is intended to be displayed when the user needs precise aim over an element, such as a rectangle selection tool or a color picker. diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index d583e07f59..461ffcb2e0 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -244,10 +244,14 @@ </description> </method> <method name="register_script_language"> - <return type="void" /> + <return type="int" enum="Error" /> <param index="0" name="language" type="ScriptLanguage" /> <description> Registers a [ScriptLanguage] instance to be available with [code]ScriptServer[/code]. + Returns: + - [constant OK] on success + - [constant ERR_UNAVAILABLE] if [code]ScriptServer[/code] has reached it limit and cannot register any new language + - [constant ERR_ALREADY_EXISTS] if [code]ScriptServer[/code] already contains a language with similar extension/name/type </description> </method> <method name="register_singleton"> @@ -258,6 +262,16 @@ Registers the given object as a singleton, globally available under [param name]. </description> </method> + <method name="unregister_script_language"> + <return type="int" enum="Error" /> + <param index="0" name="language" type="ScriptLanguage" /> + <description> + Unregisters the [ScriptLanguage] instance from [code]ScriptServer[/code]. + Returns: + - [constant OK] on success + - [constant ERR_DOES_NOT_EXIST] if the language is already not registered in [code]ScriptServer[/code] + </description> + </method> <method name="unregister_singleton"> <return type="void" /> <param index="0" name="name" type="StringName" /> diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml index 761e75339a..2f1c68c322 100644 --- a/doc/classes/Font.xml +++ b/doc/classes/Font.xml @@ -238,7 +238,7 @@ <param index="5" name="direction" type="int" enum="TextServer.Direction" default="0" /> <param index="6" name="orientation" type="int" enum="TextServer.Orientation" default="0" /> <description> - Returns the size of a bounding box of a single-line string, taking kerning and advance into account. See also [method get_multiline_string_size] and [method draw_string]. + Returns the size of a bounding box of a single-line string, taking kerning, advance and subpixel positioning into account. See also [method get_multiline_string_size] and [method draw_string]. For example, to get the string size as displayed by a single-line Label, use: [codeblocks] [gdscript] @@ -249,6 +249,7 @@ Vector2 stringSize = label.GetThemeFont("font").GetStringSize(label.Text, HorizontalAlignment.Left, -1, label.GetThemeFontSize("font_size")); [/csharp] [/codeblocks] + [b]Note:[/b] Since kerning, advance and subpixel positioning are taken into account by [method get_string_size], using separate [method get_string_size] calls on substrings of a string then adding the results together will return a different result compared to using a single [method get_string_size] call on the full string. [b]Note:[/b] Real height of the string is context-dependent and can be significantly different from the value returned by [method get_height]. </description> </method> diff --git a/doc/classes/FontVariation.xml b/doc/classes/FontVariation.xml index 5bc2606adb..11286e46a4 100644 --- a/doc/classes/FontVariation.xml +++ b/doc/classes/FontVariation.xml @@ -49,7 +49,7 @@ Extra spacing at the bottom of the line in pixels. </member> <member name="spacing_glyph" type="int" setter="set_spacing" getter="get_spacing" default="0"> - Extra spacing between graphical glyphs + Extra spacing between graphical glyphs. </member> <member name="spacing_space" type="int" setter="set_spacing" getter="get_spacing" default="0"> Extra width of the space glyphs. diff --git a/doc/classes/Light2D.xml b/doc/classes/Light2D.xml index 062d532464..9f1b1af60d 100644 --- a/doc/classes/Light2D.xml +++ b/doc/classes/Light2D.xml @@ -41,7 +41,8 @@ The Light2D's energy value. The larger the value, the stronger the light. </member> <member name="range_item_cull_mask" type="int" setter="set_item_cull_mask" getter="get_item_cull_mask" default="1"> - The layer mask. Only objects with a matching mask will be affected by the Light2D. + The layer mask. Only objects with a matching [member CanvasItem.light_mask] will be affected by the Light2D. See also [member shadow_item_cull_mask], which affects which objects can cast shadows. + [b]Note:[/b] [member range_item_cull_mask] is ignored by [DirectionalLight2D], which will always light a 2D node regardless of the 2D node's [member CanvasItem.light_mask]. </member> <member name="range_layer_max" type="int" setter="set_layer_range_max" getter="get_layer_range_max" default="0"> Maximum layer value of objects that are affected by the Light2D. @@ -68,7 +69,7 @@ Smoothing value for shadows. Higher values will result in softer shadows, at the cost of visible streaks that can appear in shadow rendering. [member shadow_filter_smooth] only has an effect if [member shadow_filter] is [constant SHADOW_FILTER_PCF5] or [constant SHADOW_FILTER_PCF13]. </member> <member name="shadow_item_cull_mask" type="int" setter="set_item_shadow_cull_mask" getter="get_item_shadow_cull_mask" default="1"> - The shadow mask. Used with [LightOccluder2D] to cast shadows. Only occluders with a matching light mask will cast shadows. + The shadow mask. Used with [LightOccluder2D] to cast shadows. Only occluders with a matching [member CanvasItem.light_mask] will cast shadows. See also [member range_item_cull_mask], which affects which objects can [i]receive[/i] the light. </member> </members> <constants> diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index 7270a19b4d..e7a2b99172 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="NavigationServer2D" inherits="Object" is_experimental="true" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Server interface for low-level 2D navigation access + Server interface for low-level 2D navigation access. </brief_description> <description> NavigationServer2D is the server responsible for all 2D navigation. It handles several objects, namely maps, regions and agents. diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index 340821d41e..16b850866a 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="NavigationServer3D" inherits="Object" is_experimental="true" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Server interface for low-level 3D navigation access + Server interface for low-level 3D navigation access. </brief_description> <description> NavigationServer3D is the server responsible for all 3D navigation. It handles several objects, namely maps, regions and agents. diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index ab7ae82875..226a1948e1 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -345,7 +345,7 @@ node.Callv(Node3D.MethodName.Rotate, new Godot.Collections.Array { new Vector3(1f, 0f, 0f), 1.571f }); [/csharp] [/codeblocks] - [b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new [StringName] on each call + [b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new [StringName] on each call. </description> </method> <method name="can_translate_messages" qualifiers="const"> diff --git a/doc/classes/PhysicsDirectSpaceState3D.xml b/doc/classes/PhysicsDirectSpaceState3D.xml index cc1cf8a323..f7bc74d9ad 100644 --- a/doc/classes/PhysicsDirectSpaceState3D.xml +++ b/doc/classes/PhysicsDirectSpaceState3D.xml @@ -21,7 +21,7 @@ </description> </method> <method name="collide_shape"> - <return type="PackedVector2Array[]" /> + <return type="PackedVector3Array[]" /> <param index="0" name="parameters" type="PhysicsShapeQueryParameters3D" /> <param index="1" name="max_results" type="int" default="32" /> <description> diff --git a/doc/classes/PhysicsServer2D.xml b/doc/classes/PhysicsServer2D.xml index c3387cf6bd..1fbe77b64b 100644 --- a/doc/classes/PhysicsServer2D.xml +++ b/doc/classes/PhysicsServer2D.xml @@ -4,7 +4,14 @@ Server interface for low-level 2D physics access. </brief_description> <description> - PhysicsServer2D is the server responsible for all 2D physics. It can create many kinds of physics objects, but does not insert them on the node tree. + PhysicsServer2D is the server responsible for all 2D physics. It can directly create and manipulate all physics objects: + - A [i]space[/i] is a self-contained world for a physics simulation. It contains bodies, areas, and joints. Its state can be queried for collision and intersection information, and several parameters of the simulation can be modified. + - A [i]shape[/i] is a geometric figure such as a circle, a rectangle, a capsule, or a polygon. It can be used for collision detection by adding it to a body/area, possibly with an extra transformation relative to the body/area's origin. Bodies/areas can have multiple (transformed) shapes added to them, and a single shape can be added to bodies/areas multiple times with different local transformations. + - A [i]body[/i] is a physical object which can be in static, kinematic, or rigid mode. Its state (such as position and velocity) can be queried and updated. A force integration callback can be set to customize the body's physics. + - An [i]area[/i] is a region in space which can be used to detect bodies and areas entering and exiting it. A body monitoring callback can be set to report entering/exiting body shapes, and similarly an area monitoring callback can be set. Gravity and damping can be overridden within the area by setting area parameters. + - A [i]joint[/i] is a constraint, either between two bodies or on one body relative to a point. Parameters such as the joint bias and the rest length of a spring joint can be adjusted. + Physics objects in the physics server may be created and manipulated independently; they do not have to be tied to nodes in the scene tree. + [b]Note:[/b] All the physics nodes use the physics server internally. Adding a physics node to the scene tree will cause a corresponding physics object to be created in the physics server. A rigid body node registers a callback that updates the node's transform with the transform of the respective body object in the physics server (every physics update). An area node registers a callback to inform the area node about overlaps with the respective area object in the physics server. The raycast node queries the direct state of the relevant space in the physics server. </description> <tutorials> </tutorials> @@ -16,7 +23,7 @@ <param index="2" name="transform" type="Transform2D" default="Transform2D(1, 0, 0, 1, 0, 0)" /> <param index="3" name="disabled" type="bool" default="false" /> <description> - Adds a shape to the area, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. + Adds a shape to the area, with the given local transform. The shape (together with its [param transform] and [param disabled] properties) is added to an array of shapes, and the shapes of an area are usually referenced by their index in this array. </description> </method> <method name="area_attach_canvas_instance_id"> @@ -24,6 +31,7 @@ <param index="0" name="area" type="RID" /> <param index="1" name="id" type="int" /> <description> + Attaches the [code]ObjectID[/code] of a canvas to the area. Use [method Object.get_instance_id] to get the [code]ObjectID[/code] of a [CanvasLayer]. </description> </method> <method name="area_attach_object_instance_id"> @@ -31,47 +39,48 @@ <param index="0" name="area" type="RID" /> <param index="1" name="id" type="int" /> <description> - Assigns the area to a descendant of [Object], so it can exist in the node tree. + Attaches the [code]ObjectID[/code] of an [Object] to the area. Use [method Object.get_instance_id] to get the [code]ObjectID[/code] of a [CollisionObject2D]. </description> </method> <method name="area_clear_shapes"> <return type="void" /> <param index="0" name="area" type="RID" /> <description> - Removes all shapes from an area. It does not delete the shapes, so they can be reassigned later. + Removes all shapes from the area. This does not delete the shapes themselves, so they can continue to be used elsewhere or added back later. </description> </method> <method name="area_create"> <return type="RID" /> <description> - Creates an [Area2D]. After creating an [Area2D] with this method, assign it to a space using [method area_set_space] to use the created [Area2D] in the physics world. + Creates a 2D area object in the physics server, and returns the [RID] that identifies it. Use [method area_add_shape] to add shapes to it, use [method area_set_transform] to set its transform, and use [method area_set_space] to add the area to a space. </description> </method> <method name="area_get_canvas_instance_id" qualifiers="const"> <return type="int" /> <param index="0" name="area" type="RID" /> <description> + Returns the [code]ObjectID[/code] of the canvas attached to the area. Use [method @GlobalScope.instance_from_id] to retrieve a [CanvasLayer] from a nonzero [code]ObjectID[/code]. </description> </method> <method name="area_get_collision_layer" qualifiers="const"> <return type="int" /> <param index="0" name="area" type="RID" /> <description> - Returns the physics layer or layers an area belongs to. + Returns the physics layer or layers the area belongs to, as a bitmask. </description> </method> <method name="area_get_collision_mask" qualifiers="const"> <return type="int" /> <param index="0" name="area" type="RID" /> <description> - Returns the physics layer or layers an area can contact with. + Returns the physics layer or layers the area can contact with, as a bitmask. </description> </method> <method name="area_get_object_instance_id" qualifiers="const"> <return type="int" /> <param index="0" name="area" type="RID" /> <description> - Gets the instance ID of the object the area is assigned to. + Returns the [code]ObjectID[/code] attached to the area. Use [method @GlobalScope.instance_from_id] to retrieve an [Object] from a nonzero [code]ObjectID[/code]. </description> </method> <method name="area_get_param" qualifiers="const"> @@ -79,7 +88,7 @@ <param index="0" name="area" type="RID" /> <param index="1" name="param" type="int" enum="PhysicsServer2D.AreaParameter" /> <description> - Returns an area parameter value. See [enum AreaParameter] for a list of available parameters. + Returns the value of the given area parameter. See [enum AreaParameter] for the list of available parameters. </description> </method> <method name="area_get_shape" qualifiers="const"> @@ -87,14 +96,14 @@ <param index="0" name="area" type="RID" /> <param index="1" name="shape_idx" type="int" /> <description> - Returns the [RID] of the nth shape of an area. + Returns the [RID] of the shape with the given index in the area's array of shapes. </description> </method> <method name="area_get_shape_count" qualifiers="const"> <return type="int" /> <param index="0" name="area" type="RID" /> <description> - Returns the number of shapes assigned to an area. + Returns the number of shapes added to the area. </description> </method> <method name="area_get_shape_transform" qualifiers="const"> @@ -102,21 +111,21 @@ <param index="0" name="area" type="RID" /> <param index="1" name="shape_idx" type="int" /> <description> - Returns the transform matrix of a shape within an area. + Returns the local transform matrix of the shape with the given index in the area's array of shapes. </description> </method> <method name="area_get_space" qualifiers="const"> <return type="RID" /> <param index="0" name="area" type="RID" /> <description> - Returns the space assigned to the area. + Returns the [RID] of the space assigned to the area. Returns [code]RID()[/code] if no space is assigned. </description> </method> <method name="area_get_transform" qualifiers="const"> <return type="Transform2D" /> <param index="0" name="area" type="RID" /> <description> - Returns the transform matrix for an area. + Returns the transform matrix of the area. </description> </method> <method name="area_remove_shape"> @@ -124,7 +133,7 @@ <param index="0" name="area" type="RID" /> <param index="1" name="shape_idx" type="int" /> <description> - Removes a shape from an area. It does not delete the shape, so it can be reassigned later. + Removes the shape with the given index from the area's array of shapes. The shape itself is not deleted, so it can continue to be used elsewhere or added back later. As a result of this operation, the area's shapes which used to have indices higher than [param shape_idx] will have their index decreased by one. </description> </method> <method name="area_set_area_monitor_callback"> @@ -132,6 +141,13 @@ <param index="0" name="area" type="RID" /> <param index="1" name="callback" type="Callable" /> <description> + Sets the area's area monitor callback. This callback will be called when any other (shape of an) area enters or exits (a shape of) the given area, and must take the following five parameters: + 1. an integer [code]status[/code]: either [constant AREA_BODY_ADDED] or [constant AREA_BODY_REMOVED] depending on whether the other area's shape entered or exited the area, + 2. an [RID] [code]area_rid[/code]: the [RID] of the other area that entered or exited the area, + 3. an integer [code]instance_id[/code]: the [code]ObjectID[/code] attached to the other area, + 4. an integer [code]area_shape_idx[/code]: the index of the shape of the other area that entered or exited the area, + 5. an integer [code]self_shape_idx[/code]: the index of the shape of the area where the other area entered or exited. + By counting (or keeping track of) the shapes that enter and exit, it can be determined if an area (with all its shapes) is entering for the first time or exiting for the last time. </description> </method> <method name="area_set_collision_layer"> @@ -139,7 +155,7 @@ <param index="0" name="area" type="RID" /> <param index="1" name="layer" type="int" /> <description> - Assigns the area to one or many physics layers. + Assigns the area to one or many physics layers, via a bitmask. </description> </method> <method name="area_set_collision_mask"> @@ -147,7 +163,7 @@ <param index="0" name="area" type="RID" /> <param index="1" name="mask" type="int" /> <description> - Sets which physics layers the area will monitor. + Sets which physics layers the area will monitor, via a bitmask. </description> </method> <method name="area_set_monitor_callback"> @@ -155,12 +171,13 @@ <param index="0" name="area" type="RID" /> <param index="1" name="callback" type="Callable" /> <description> - Sets the function to call when any body/area enters or exits the area. This callback will be called for any object interacting with the area, and takes five parameters: - 1: [constant AREA_BODY_ADDED] or [constant AREA_BODY_REMOVED], depending on whether the object entered or exited the area. - 2: [RID] of the object that entered/exited the area. - 3: Instance ID of the object that entered/exited the area. - 4: The shape index of the object that entered/exited the area. - 5: The shape index of the area where the object entered/exited. + Sets the area's body monitor callback. This callback will be called when any other (shape of a) body enters or exits (a shape of) the given area, and must take the following five parameters: + 1. an integer [code]status[/code]: either [constant AREA_BODY_ADDED] or [constant AREA_BODY_REMOVED] depending on whether the other body shape entered or exited the area, + 2. an [RID] [code]body_rid[/code]: the [RID] of the body that entered or exited the area, + 3. an integer [code]instance_id[/code]: the [code]ObjectID[/code] attached to the body, + 4. an integer [code]body_shape_idx[/code]: the index of the shape of the body that entered or exited the area, + 5. an integer [code]self_shape_idx[/code]: the index of the shape of the area where the body entered or exited. + By counting (or keeping track of) the shapes that enter and exit, it can be determined if a body (with all its shapes) is entering for the first time or exiting for the last time. </description> </method> <method name="area_set_monitorable"> @@ -168,6 +185,7 @@ <param index="0" name="area" type="RID" /> <param index="1" name="monitorable" type="bool" /> <description> + Sets whether the area is monitorable or not. If [param monitorable] is [code]true[/code], the area monitoring callback of other areas will be called when this area enters or exits them. </description> </method> <method name="area_set_param"> @@ -176,7 +194,7 @@ <param index="1" name="param" type="int" enum="PhysicsServer2D.AreaParameter" /> <param index="2" name="value" type="Variant" /> <description> - Sets the value for an area parameter. See [enum AreaParameter] for a list of available parameters. + Sets the value of the given area parameter. See [enum AreaParameter] for the list of available parameters. </description> </method> <method name="area_set_shape"> @@ -185,7 +203,7 @@ <param index="1" name="shape_idx" type="int" /> <param index="2" name="shape" type="RID" /> <description> - Substitutes a given area shape by another. The old shape is selected by its index, the new one by its [RID]. + Replaces the area's shape at the given index by another shape, while not affecting the [code]transform[/code] and [code]disabled[/code] properties at the same index. </description> </method> <method name="area_set_shape_disabled"> @@ -194,7 +212,7 @@ <param index="1" name="shape_idx" type="int" /> <param index="2" name="disabled" type="bool" /> <description> - Disables a given shape in an area. + Sets the disabled property of the area's shape with the given index. If [param disabled] is [code]true[/code], then the shape will not detect any other shapes entering or exiting it. </description> </method> <method name="area_set_shape_transform"> @@ -203,7 +221,7 @@ <param index="1" name="shape_idx" type="int" /> <param index="2" name="transform" type="Transform2D" /> <description> - Sets the transform matrix for an area shape. + Sets the local transform matrix of the area's shape with the given index. </description> </method> <method name="area_set_space"> @@ -211,7 +229,8 @@ <param index="0" name="area" type="RID" /> <param index="1" name="space" type="RID" /> <description> - Assigns a space to the area. + Adds the area to the given space, after removing the area from the previously assigned space (if any). + [b]Note:[/b] To remove an area from a space without immediately adding it back elsewhere, use [code]PhysicsServer2D.area_set_space(area, RID())[/code]. </description> </method> <method name="area_set_transform"> @@ -219,7 +238,7 @@ <param index="0" name="area" type="RID" /> <param index="1" name="transform" type="Transform2D" /> <description> - Sets the transform matrix for an area. + Sets the transform matrix of the area. </description> </method> <method name="body_add_collision_exception"> @@ -227,7 +246,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="excepted_body" type="RID" /> <description> - Adds a body to the list of bodies exempt from collisions. + Adds [param excepted_body] to the body's list of collision exceptions, so that collisions with it are ignored. </description> </method> <method name="body_add_constant_central_force"> @@ -235,7 +254,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="force" type="Vector2" /> <description> - Adds a constant directional force without affecting rotation that keeps being applied over time until cleared with [code]body_set_constant_force(body, Vector2(0, 0))[/code]. + Adds a constant directional force to the body. The force does not affect rotation. The force remains applied over time until cleared with [code]PhysicsServer2D.body_set_constant_force(body, Vector2(0, 0))[/code]. This is equivalent to using [method body_add_constant_force] at the body's center of mass. </description> </method> @@ -245,7 +264,7 @@ <param index="1" name="force" type="Vector2" /> <param index="2" name="position" type="Vector2" default="Vector2(0, 0)" /> <description> - Adds a constant positioned force to the body that keeps being applied over time until cleared with [code]body_set_constant_force(body, Vector2(0, 0))[/code]. + Adds a constant positioned force to the body. The force can affect rotation if [param position] is different from the body's center of mass. The force remains applied over time until cleared with [code]PhysicsServer2D.body_set_constant_force(body, Vector2(0, 0))[/code]. [param position] is the offset from the body origin in global coordinates. </description> </method> @@ -254,7 +273,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="torque" type="float" /> <description> - Adds a constant rotational force without affecting position that keeps being applied over time until cleared with [code]body_set_constant_torque(body, 0)[/code]. + Adds a constant rotational force to the body. The force does not affect position. The force remains applied over time until cleared with [code]PhysicsServer2D.body_set_constant_torque(body, 0)[/code]. </description> </method> <method name="body_add_shape"> @@ -264,7 +283,7 @@ <param index="2" name="transform" type="Transform2D" default="Transform2D(1, 0, 0, 1, 0, 0)" /> <param index="3" name="disabled" type="bool" default="false" /> <description> - Adds a shape to the body, along with a transform matrix. Shapes are usually referenced by their index, so you should track which shape has a given index. + Adds a shape to the area, with the given local transform. The shape (together with its [param transform] and [param disabled] properties) is added to an array of shapes, and the shapes of a body are usually referenced by their index in this array. </description> </method> <method name="body_apply_central_force"> @@ -272,7 +291,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="force" type="Vector2" /> <description> - Applies a directional force without affecting rotation. A force is time dependent and meant to be applied every physics update. + Applies a directional force to the body, at the body's center of mass. The force does not affect rotation. A force is time dependent and meant to be applied every physics update. This is equivalent to using [method body_apply_force] at the body's center of mass. </description> </method> @@ -281,7 +300,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="impulse" type="Vector2" /> <description> - Applies a directional impulse without affecting rotation. + Applies a directional impulse to the body, at the body's center of mass. The impulse does not affect rotation. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). This is equivalent to using [method body_apply_impulse] at the body's center of mass. </description> @@ -292,7 +311,7 @@ <param index="1" name="force" type="Vector2" /> <param index="2" name="position" type="Vector2" default="Vector2(0, 0)" /> <description> - Applies a positioned force to the body. A force is time dependent and meant to be applied every physics update. + Applies a positioned force to the body. The force can affect rotation if [param position] is different from the body's center of mass. A force is time dependent and meant to be applied every physics update. [param position] is the offset from the body origin in global coordinates. </description> </method> @@ -302,7 +321,7 @@ <param index="1" name="impulse" type="Vector2" /> <param index="2" name="position" type="Vector2" default="Vector2(0, 0)" /> <description> - Applies a positioned impulse to the body. + Applies a positioned impulse to the body. The impulse can affect rotation if [param position] is different from the body's center of mass. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). [param position] is the offset from the body origin in global coordinates. </description> @@ -312,7 +331,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="torque" type="float" /> <description> - Applies a rotational force without affecting position. A force is time dependent and meant to be applied every physics update. + Applies a rotational force to the body. The force does not affect position. A force is time dependent and meant to be applied every physics update. </description> </method> <method name="body_apply_torque_impulse"> @@ -320,7 +339,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="impulse" type="float" /> <description> - Applies a rotational impulse to the body without affecting the position. + Applies a rotational impulse to the body. The impulse does not affect position. An impulse is time-independent! Applying an impulse every frame would result in a framerate-dependent force. For this reason, it should only be used when simulating one-time impacts (use the "_force" functions otherwise). </description> </method> @@ -329,6 +348,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="id" type="int" /> <description> + Attaches the [code]ObjectID[/code] of a canvas to the body. Use [method Object.get_instance_id] to get the [code]ObjectID[/code] of a [CanvasLayer]. </description> </method> <method name="body_attach_object_instance_id"> @@ -336,54 +356,55 @@ <param index="0" name="body" type="RID" /> <param index="1" name="id" type="int" /> <description> - Assigns the area to a descendant of [Object], so it can exist in the node tree. + Attaches the [code]ObjectID[/code] of an [Object] to the body. Use [method Object.get_instance_id] to get the [code]ObjectID[/code] of a [CollisionObject2D]. </description> </method> <method name="body_clear_shapes"> <return type="void" /> <param index="0" name="body" type="RID" /> <description> - Removes all shapes from a body. + Removes all shapes from the body. This does not delete the shapes themselves, so they can continue to be used elsewhere or added back later. </description> </method> <method name="body_create"> <return type="RID" /> <description> - Creates a physics body. + Creates a 2D body object in the physics server, and returns the [RID] that identifies it. Use [method body_add_shape] to add shapes to it, use [method body_set_state] to set its transform, and use [method body_set_space] to add the body to a space. </description> </method> <method name="body_get_canvas_instance_id" qualifiers="const"> <return type="int" /> <param index="0" name="body" type="RID" /> <description> + Returns the [code]ObjectID[/code] of the canvas attached to the body. Use [method @GlobalScope.instance_from_id] to retrieve a [CanvasLayer] from a nonzero [code]ObjectID[/code]. </description> </method> <method name="body_get_collision_layer" qualifiers="const"> <return type="int" /> <param index="0" name="body" type="RID" /> <description> - Returns the physics layer or layers a body belongs to. + Returns the physics layer or layers the body belongs to, as a bitmask. </description> </method> <method name="body_get_collision_mask" qualifiers="const"> <return type="int" /> <param index="0" name="body" type="RID" /> <description> - Returns the physics layer or layers a body can collide with. + Returns the physics layer or layers the body can collide with, as a bitmask. </description> </method> <method name="body_get_collision_priority" qualifiers="const"> <return type="float" /> <param index="0" name="body" type="RID" /> <description> - Returns the body's collision priority. + Returns the body's collision priority. This is used in the depenetration phase of [method body_test_motion]. The higher the priority is, the lower the penetration into the body will be. </description> </method> <method name="body_get_constant_force" qualifiers="const"> <return type="Vector2" /> <param index="0" name="body" type="RID" /> <description> - Returns the body's total constant positional forces applied during each physics update. + Returns the body's total constant positional force applied during each physics update. See [method body_add_constant_force] and [method body_add_constant_central_force]. </description> </method> @@ -391,7 +412,7 @@ <return type="float" /> <param index="0" name="body" type="RID" /> <description> - Returns the body's total constant rotational forces applied during each physics update. + Returns the body's total constant rotational force applied during each physics update. See [method body_add_constant_torque]. </description> </method> @@ -399,35 +420,35 @@ <return type="int" enum="PhysicsServer2D.CCDMode" /> <param index="0" name="body" type="RID" /> <description> - Returns the continuous collision detection mode. + Returns the body's continuous collision detection mode (see [enum CCDMode]). </description> </method> <method name="body_get_direct_state"> <return type="PhysicsDirectBodyState2D" /> <param index="0" name="body" type="RID" /> <description> - Returns the [PhysicsDirectBodyState2D] of the body. Returns [code]null[/code] if the body is destroyed or removed from the physics space. + Returns the [PhysicsDirectBodyState2D] of the body. Returns [code]null[/code] if the body is destroyed or not assigned to a space. </description> </method> <method name="body_get_max_contacts_reported" qualifiers="const"> <return type="int" /> <param index="0" name="body" type="RID" /> <description> - Returns the maximum contacts that can be reported. See [method body_set_max_contacts_reported]. + Returns the maximum number of contacts that the body can report. See [method body_set_max_contacts_reported]. </description> </method> <method name="body_get_mode" qualifiers="const"> <return type="int" enum="PhysicsServer2D.BodyMode" /> <param index="0" name="body" type="RID" /> <description> - Returns the body mode. + Returns the body's mode (see [enum BodyMode]). </description> </method> <method name="body_get_object_instance_id" qualifiers="const"> <return type="int" /> <param index="0" name="body" type="RID" /> <description> - Gets the instance ID of the object the area is assigned to. + Returns the [code]ObjectID[/code] attached to the body. Use [method @GlobalScope.instance_from_id] to retrieve an [Object] from a nonzero [code]ObjectID[/code]. </description> </method> <method name="body_get_param" qualifiers="const"> @@ -435,7 +456,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="param" type="int" enum="PhysicsServer2D.BodyParameter" /> <description> - Returns the value of a body parameter. See [enum BodyParameter] for a list of available parameters. + Returns the value of the given body parameter. See [enum BodyParameter] for the list of available parameters. </description> </method> <method name="body_get_shape" qualifiers="const"> @@ -443,14 +464,14 @@ <param index="0" name="body" type="RID" /> <param index="1" name="shape_idx" type="int" /> <description> - Returns the [RID] of the nth shape of a body. + Returns the [RID] of the shape with the given index in the body's array of shapes. </description> </method> <method name="body_get_shape_count" qualifiers="const"> <return type="int" /> <param index="0" name="body" type="RID" /> <description> - Returns the number of shapes assigned to a body. + Returns the number of shapes added to the body. </description> </method> <method name="body_get_shape_transform" qualifiers="const"> @@ -458,14 +479,14 @@ <param index="0" name="body" type="RID" /> <param index="1" name="shape_idx" type="int" /> <description> - Returns the transform matrix of a body shape. + Returns the local transform matrix of the shape with the given index in the area's array of shapes. </description> </method> <method name="body_get_space" qualifiers="const"> <return type="RID" /> <param index="0" name="body" type="RID" /> <description> - Returns the [RID] of the space assigned to a body. + Returns the [RID] of the space assigned to the body. Returns [code]RID()[/code] if no space is assigned. </description> </method> <method name="body_get_state" qualifiers="const"> @@ -473,14 +494,14 @@ <param index="0" name="body" type="RID" /> <param index="1" name="state" type="int" enum="PhysicsServer2D.BodyState" /> <description> - Returns a body state. + Returns the value of the given state of the body. See [enum BodyState] for the list of available states. </description> </method> <method name="body_is_omitting_force_integration" qualifiers="const"> <return type="bool" /> <param index="0" name="body" type="RID" /> <description> - Returns whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). + Returns [code]true[/code] if the body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). </description> </method> <method name="body_remove_collision_exception"> @@ -488,7 +509,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="excepted_body" type="RID" /> <description> - Removes a body from the list of bodies exempt from collisions. + Removes [param excepted_body] from the body's list of collision exceptions, so that collisions with it are no longer ignored. </description> </method> <method name="body_remove_shape"> @@ -496,14 +517,14 @@ <param index="0" name="body" type="RID" /> <param index="1" name="shape_idx" type="int" /> <description> - Removes a shape from a body. The shape is not deleted, so it can be reused afterwards. + Removes the shape with the given index from the body's array of shapes. The shape itself is not deleted, so it can continue to be used elsewhere or added back later. As a result of this operation, the body's shapes which used to have indices higher than [param shape_idx] will have their index decreased by one. </description> </method> <method name="body_reset_mass_properties"> <return type="void" /> <param index="0" name="body" type="RID" /> <description> - Restores the default inertia and center of mass based on shapes to cancel any custom values previously set using [method body_set_param]. + Restores the default inertia and center of mass of the body based on its shapes. This undoes any custom values previously set using [method body_set_param]. </description> </method> <method name="body_set_axis_velocity"> @@ -511,7 +532,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="axis_velocity" type="Vector2" /> <description> - Sets an axis velocity. The velocity in the given vector axis will be set as the given vector length. This is useful for jumping behavior. + Modifies the body's linear velocity so that its projection to the axis [code]axis_velocity.normalized()[/code] is exactly [code]axis_velocity.length()[/code]. This is useful for jumping behavior. </description> </method> <method name="body_set_collision_layer"> @@ -519,7 +540,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="layer" type="int" /> <description> - Sets the physics layer or layers a body belongs to. + Sets the physics layer or layers the body belongs to, via a bitmask. </description> </method> <method name="body_set_collision_mask"> @@ -527,7 +548,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="mask" type="int" /> <description> - Sets the physics layer or layers a body can collide with. + Sets the physics layer or layers the body can collide with, via a bitmask. </description> </method> <method name="body_set_collision_priority"> @@ -535,7 +556,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="priority" type="float" /> <description> - Sets the body's collision priority. + Sets the body's collision priority. This is used in the depenetration phase of [method body_test_motion]. The higher the priority is, the lower the penetration into the body will be. </description> </method> <method name="body_set_constant_force"> @@ -543,7 +564,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="force" type="Vector2" /> <description> - Sets the body's total constant positional forces applied during each physics update. + Sets the body's total constant positional force applied during each physics update. See [method body_add_constant_force] and [method body_add_constant_central_force]. </description> </method> @@ -552,7 +573,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="torque" type="float" /> <description> - Sets the body's total constant rotational forces applied during each physics update. + Sets the body's total constant rotational force applied during each physics update. See [method body_add_constant_torque]. </description> </method> @@ -562,7 +583,7 @@ <param index="1" name="mode" type="int" enum="PhysicsServer2D.CCDMode" /> <description> Sets the continuous collision detection mode using one of the [enum CCDMode] constants. - Continuous collision detection tries to predict where a moving body will collide, instead of moving it and correcting its movement if it collided. + Continuous collision detection tries to predict where a moving body would collide in between physics updates, instead of moving it and correcting its movement if it collided. </description> </method> <method name="body_set_force_integration_callback"> @@ -571,10 +592,11 @@ <param index="1" name="callable" type="Callable" /> <param index="2" name="userdata" type="Variant" default="null" /> <description> - Sets the function used to calculate physics for an object, if that object allows it (see [method body_set_omit_force_integration]). - The force integration function takes 2 arguments: - [code]state:[/code] [PhysicsDirectBodyState2D] used to retrieve and modify the body's state. - [code]userdata:[/code] Optional user data, if it was passed when calling [code]body_set_force_integration_callback[/code]. + Sets the function used to calculate physics for the body, if that body allows it (see [method body_set_omit_force_integration]). + The force integration function takes the following two parameters: + 1. a [PhysicsDirectBodyState2D] [code]state[/code]: used to retrieve and modify the body's state, + 2. a [Variant] [code]userdata[/code]: optional user data. + [b]Note:[/b] This callback is currently not called in Godot Physics. </description> </method> <method name="body_set_max_contacts_reported"> @@ -582,7 +604,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="amount" type="int" /> <description> - Sets the maximum contacts to report. Bodies can keep a log of the contacts with other bodies. This is enabled by setting the maximum number of contacts reported to a number greater than 0. + Sets the maximum number of contacts that the body can report. If [param amount] is greater than zero, then the body will keep track of at most this many contacts with other bodies. </description> </method> <method name="body_set_mode"> @@ -590,7 +612,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="mode" type="int" enum="PhysicsServer2D.BodyMode" /> <description> - Sets the body mode using one of the [enum BodyMode] constants. + Sets the body's mode. See [enum BodyMode] for the list of available modes. </description> </method> <method name="body_set_omit_force_integration"> @@ -598,7 +620,7 @@ <param index="0" name="body" type="RID" /> <param index="1" name="enable" type="bool" /> <description> - Sets whether a body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). + Sets whether the body uses a callback function to calculate its own physics (see [method body_set_force_integration_callback]). </description> </method> <method name="body_set_param"> @@ -607,7 +629,7 @@ <param index="1" name="param" type="int" enum="PhysicsServer2D.BodyParameter" /> <param index="2" name="value" type="Variant" /> <description> - Sets a body parameter. See [enum BodyParameter] for a list of available parameters. + Sets the value of the given body parameter. See [enum BodyParameter] for the list of available parameters. </description> </method> <method name="body_set_shape"> @@ -616,7 +638,7 @@ <param index="1" name="shape_idx" type="int" /> <param index="2" name="shape" type="RID" /> <description> - Substitutes a given body shape by another. The old shape is selected by its index, the new one by its [RID]. + Replaces the body's shape at the given index by another shape, while not affecting the [code]transform[/code], [code]disabled[/code], and one-way collision properties at the same index. </description> </method> <method name="body_set_shape_as_one_way_collision"> @@ -626,7 +648,7 @@ <param index="2" name="enable" type="bool" /> <param index="3" name="margin" type="float" /> <description> - Enables one way collision on body if [param enable] is [code]true[/code]. + Sets the one-way collision properties of the body's shape with the given index. If [param enable] is [code]true[/code], the one-way collision direction given by the shape's local upward axis [code]body_get_shape_transform(body, shape_idx).y[/code] will be used to ignore collisions with the shape in the opposite direction, and to ensure depenetration of kinematic bodies happens in this direction. </description> </method> <method name="body_set_shape_disabled"> @@ -635,7 +657,7 @@ <param index="1" name="shape_idx" type="int" /> <param index="2" name="disabled" type="bool" /> <description> - Disables shape in body if [param disabled] is [code]true[/code]. + Sets the disabled property of the body's shape with the given index. If [param disabled] is [code]true[/code], then the shape will be ignored in all collision detection. </description> </method> <method name="body_set_shape_transform"> @@ -644,7 +666,7 @@ <param index="1" name="shape_idx" type="int" /> <param index="2" name="transform" type="Transform2D" /> <description> - Sets the transform matrix for a body shape. + Sets the local transform matrix of the body's shape with the given index. </description> </method> <method name="body_set_space"> @@ -652,7 +674,10 @@ <param index="0" name="body" type="RID" /> <param index="1" name="space" type="RID" /> <description> - Assigns a space to the body (see [method space_create]). + Adds the body to the given space, after removing the body from the previously assigned space (if any). If the body's mode is set to [constant BODY_MODE_RIGID], then adding the body to a space will have the following additional effects: + - If the parameter [constant BODY_PARAM_CENTER_OF_MASS] has never been set explicitly, then the value of that parameter will be recalculated based on the body's shapes. + - If the parameter [constant BODY_PARAM_INERTIA] is set to a value [code]<= 0.0[/code], then the value of that parameter will be recalculated based on the body's shapes, mass, and center of mass. + [b]Note:[/b] To remove a body from a space without immediately adding it back elsewhere, use [code]PhysicsServer2D.body_set_space(body, RID())[/code]. </description> </method> <method name="body_set_state"> @@ -661,8 +686,8 @@ <param index="1" name="state" type="int" enum="PhysicsServer2D.BodyState" /> <param index="2" name="value" type="Variant" /> <description> - Sets a body state using one of the [enum BodyState] constants. - Note that the method doesn't take effect immediately. The state will change on the next physics frame. + Sets the value of a body's state. See [enum BodyState] for the list of available states. + [b]Note:[/b] The state change doesn't take effect immediately. The state will change on the next physics frame. </description> </method> <method name="body_test_motion"> @@ -671,27 +696,31 @@ <param index="1" name="parameters" type="PhysicsTestMotionParameters2D" /> <param index="2" name="result" type="PhysicsTestMotionResult2D" default="null" /> <description> - Returns [code]true[/code] if a collision would result from moving along a motion vector from a given point in space. [PhysicsTestMotionParameters2D] is passed to set motion parameters. [PhysicsTestMotionResult2D] can be passed to return additional information. + Returns [code]true[/code] if a collision would result from moving the body along a motion vector from a given point in space. See [PhysicsTestMotionParameters2D] for the available motion parameters. Optionally a [PhysicsTestMotionResult2D] object can be passed, which will be used to store the information about the resulting collision. </description> </method> <method name="capsule_shape_create"> <return type="RID" /> <description> + Creates a 2D capsule shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the capsule's height and radius. </description> </method> <method name="circle_shape_create"> <return type="RID" /> <description> + Creates a 2D circle shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the circle's radius. </description> </method> <method name="concave_polygon_shape_create"> <return type="RID" /> <description> + Creates a 2D concave polygon shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the concave polygon's segments. </description> </method> <method name="convex_polygon_shape_create"> <return type="RID" /> <description> + Creates a 2D convex polygon shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the convex polygon's points. </description> </method> <method name="damped_spring_joint_get_param" qualifiers="const"> @@ -699,7 +728,7 @@ <param index="0" name="joint" type="RID" /> <param index="1" name="param" type="int" enum="PhysicsServer2D.DampedSpringParam" /> <description> - Returns the value of a damped spring joint parameter. See [enum DampedSpringParam] for a list of available parameters. + Returns the value of the given damped spring joint parameter. See [enum DampedSpringParam] for the list of available parameters. </description> </method> <method name="damped_spring_joint_set_param"> @@ -708,32 +737,34 @@ <param index="1" name="param" type="int" enum="PhysicsServer2D.DampedSpringParam" /> <param index="2" name="value" type="float" /> <description> - Sets a damped spring joint parameter. See [enum DampedSpringParam] for a list of available parameters. + Sets the value of the given damped spring joint parameter. See [enum DampedSpringParam] for the list of available parameters. </description> </method> <method name="free_rid"> <return type="void" /> <param index="0" name="rid" type="RID" /> <description> - Destroys any of the objects created by PhysicsServer2D. If the [RID] passed is not one of the objects that can be created by PhysicsServer2D, an error will be sent to the console. + Destroys any of the objects created by PhysicsServer2D. If the [RID] passed is not one of the objects that can be created by PhysicsServer2D, an error will be printed to the console. </description> </method> <method name="get_process_info"> <return type="int" /> <param index="0" name="process_info" type="int" enum="PhysicsServer2D.ProcessInfo" /> <description> - Returns information about the current state of the 2D physics engine. See [enum ProcessInfo] for a list of available states. + Returns information about the current state of the 2D physics engine. See [enum ProcessInfo] for the list of available states. </description> </method> <method name="joint_clear"> <return type="void" /> <param index="0" name="joint" type="RID" /> <description> + Destroys the joint with the given [RID], creates a new uninitialized joint, and makes the [RID] refer to this new joint. </description> </method> <method name="joint_create"> <return type="RID" /> <description> + Creates a 2D joint in the physics server, and returns the [RID] that identifies it. To set the joint type, use [method joint_make_damped_spring], [method joint_make_groove] or [method joint_make_pin]. Use [method joint_set_param] to set generic joint parameters. </description> </method> <method name="joint_disable_collisions_between_bodies"> @@ -749,14 +780,14 @@ <param index="0" name="joint" type="RID" /> <param index="1" name="param" type="int" enum="PhysicsServer2D.JointParam" /> <description> - Returns the value of a joint parameter. + Returns the value of the given joint parameter. See [enum JointParam] for the list of available parameters. </description> </method> <method name="joint_get_type" qualifiers="const"> <return type="int" enum="PhysicsServer2D.JointType" /> <param index="0" name="joint" type="RID" /> <description> - Returns a joint's type (see [enum JointType]). + Returns the joint's type (see [enum JointType]). </description> </method> <method name="joint_is_disabled_collisions_between_bodies" qualifiers="const"> @@ -774,6 +805,7 @@ <param index="3" name="body_a" type="RID" /> <param index="4" name="body_b" type="RID" /> <description> + Makes the joint a damped spring joint, attached at the point [param anchor_a] (given in global coordinates) on the body [param body_a] and at the point [param anchor_b] (given in global coordinates) on the body [param body_b]. To set the parameters which are specific to the damped spring, see [method damped_spring_joint_set_param]. </description> </method> <method name="joint_make_groove"> @@ -785,6 +817,7 @@ <param index="4" name="body_a" type="RID" /> <param index="5" name="body_b" type="RID" /> <description> + Makes the joint a groove joint. </description> </method> <method name="joint_make_pin"> @@ -794,6 +827,7 @@ <param index="2" name="body_a" type="RID" /> <param index="3" name="body_b" type="RID" /> <description> + Makes the joint a pin joint. If [param body_b] is [code]RID()[/code], then [param body_a] is pinned to the point [param anchor] (given in global coordinates); otherwise, [param body_a] is pinned to [param body_b] at the point [param anchor] (given in global coordinates). To set the parameters which are specific to the pin joint, see [method pin_joint_set_param]. </description> </method> <method name="joint_set_param"> @@ -802,7 +836,7 @@ <param index="1" name="param" type="int" enum="PhysicsServer2D.JointParam" /> <param index="2" name="value" type="float" /> <description> - Sets a joint parameter. See [enum JointParam] for a list of available parameters. + Sets the value of the given joint parameter. See [enum JointParam] for the list of available parameters. </description> </method> <method name="pin_joint_get_param" qualifiers="const"> @@ -825,37 +859,40 @@ <method name="rectangle_shape_create"> <return type="RID" /> <description> + Creates a 2D rectangle shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the rectangle's half-extents. </description> </method> <method name="segment_shape_create"> <return type="RID" /> <description> + Creates a 2D segment shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the segment's start and end points. </description> </method> <method name="separation_ray_shape_create"> <return type="RID" /> <description> + Creates a 2D separation ray shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the shape's [code]length[/code] and [code]slide_on_slope[/code] properties. </description> </method> <method name="set_active"> <return type="void" /> <param index="0" name="active" type="bool" /> <description> - Activates or deactivates the 2D physics engine. + Activates or deactivates the 2D physics server. If [param active] is [code]false[/code], then the physics server will not do anything in its physics step. </description> </method> <method name="shape_get_data" qualifiers="const"> <return type="Variant" /> <param index="0" name="shape" type="RID" /> <description> - Returns the shape data. + Returns the shape data that defines the configuration of the shape, such as the half-extents of a rectangle or the segments of a concave shape. See [method shape_set_data] for the precise format of this data in each case. </description> </method> <method name="shape_get_type" qualifiers="const"> <return type="int" enum="PhysicsServer2D.ShapeType" /> <param index="0" name="shape" type="RID" /> <description> - Returns a shape's type (see [enum ShapeType]). + Returns the shape's type (see [enum ShapeType]). </description> </method> <method name="shape_set_data"> @@ -863,20 +900,29 @@ <param index="0" name="shape" type="RID" /> <param index="1" name="data" type="Variant" /> <description> - Sets the shape data that defines its shape and size. The data to be passed depends on the kind of shape created [method shape_get_type]. + Sets the shape data that defines the configuration of the shape. The [param data] to be passed depends on the shape's type (see [method shape_get_type]): + - [constant SHAPE_WORLD_BOUNDARY]: an array of length two containing a [Vector2] [code]normal[/code] direction and a [code]float[/code] distance [code]d[/code], + - [constant SHAPE_SEPARATION_RAY]: a dictionary containing the key [code]length[/code] with a [code]float[/code] value and the key [code]slide_on_slope[/code] with a [code]bool[/code] value, + - [constant SHAPE_SEGMENT]: a [Rect2] [code]rect[/code] containing the first point of the segment in [code]rect.position[/code] and the second point of the segment in [code]rect.size[/code], + - [constant SHAPE_CIRCLE]: a [code]float[/code] [code]radius[/code], + - [constant SHAPE_RECTANGLE]: a [Vector2] [code]half_extents[/code], + - [constant SHAPE_CAPSULE]: an array of length two (or a [Vector2]) containing a [code]float[/code] [code]height[/code] and a [code]float[/code] [code]radius[/code], + - [constant SHAPE_CONVEX_POLYGON]: either a [PackedVector2Array] of points defining a convex polygon in counterclockwise order (the clockwise outward normal of each segment formed by consecutive points is calculated internally), or a [PackedFloat32Array] of length divisible by four so that every 4-tuple of [code]float[/code]s contains the coordinates of a point followed by the coordinates of the clockwise outward normal vector to the segment between the current point and the next point, + - [constant SHAPE_CONCAVE_POLYGON]: a [PackedVector2Array] of length divisible by two (each pair of points forms one segment). + [b]Warning[/b]: In the case of [constant SHAPE_CONVEX_POLYGON], this method does not check if the points supplied actually form a convex polygon (unlike the [member CollisionPolygon2D.polygon] property). </description> </method> <method name="space_create"> <return type="RID" /> <description> - Creates a space. A space is a collection of parameters for the physics engine that can be assigned to an area or a body. It can be assigned to an area with [method area_set_space], or to a body with [method body_set_space]. + Creates a 2D space in the physics server, and returns the [RID] that identifies it. A space contains bodies and areas, and controls the stepping of the physics simulation of the objects in it. </description> </method> <method name="space_get_direct_state"> <return type="PhysicsDirectSpaceState2D" /> <param index="0" name="space" type="RID" /> <description> - Returns the state of a space, a [PhysicsDirectSpaceState2D]. This object can be used to make collision/intersection queries. + Returns the state of a space, a [PhysicsDirectSpaceState2D]. This object can be used for collision/intersection queries. </description> </method> <method name="space_get_param" qualifiers="const"> @@ -884,14 +930,14 @@ <param index="0" name="space" type="RID" /> <param index="1" name="param" type="int" enum="PhysicsServer2D.SpaceParameter" /> <description> - Returns the value of a space parameter. + Returns the value of the given space parameter. See [enum SpaceParameter] for the list of available parameters. </description> </method> <method name="space_is_active" qualifiers="const"> <return type="bool" /> <param index="0" name="space" type="RID" /> <description> - Returns whether the space is active. + Returns [code]true[/code] if the space is active. </description> </method> <method name="space_set_active"> @@ -899,7 +945,7 @@ <param index="0" name="space" type="RID" /> <param index="1" name="active" type="bool" /> <description> - Marks a space as active. It will not have an effect, unless it is assigned to an area or body. + Activates or deactivates the space. If [param active] is [code]false[/code], then the physics server will not do anything with this space in its physics step. </description> </method> <method name="space_set_param"> @@ -908,42 +954,43 @@ <param index="1" name="param" type="int" enum="PhysicsServer2D.SpaceParameter" /> <param index="2" name="value" type="float" /> <description> - Sets the value for a space parameter. See [enum SpaceParameter] for a list of available parameters. + Sets the value of the given space parameter. See [enum SpaceParameter] for the list of available parameters. </description> </method> <method name="world_boundary_shape_create"> <return type="RID" /> <description> + Creates a 2D world boundary shape in the physics server, and returns the [RID] that identifies it. Use [method shape_set_data] to set the shape's normal direction and distance properties. </description> </method> </methods> <constants> <constant name="SPACE_PARAM_CONTACT_RECYCLE_RADIUS" value="0" enum="SpaceParameter"> - Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated. + Constant to set/get the maximum distance a pair of bodies has to move before their collision status has to be recalculated. The default value of this parameter is [member ProjectSettings.physics/2d/solver/contact_recycle_radius]. </constant> <constant name="SPACE_PARAM_CONTACT_MAX_SEPARATION" value="1" enum="SpaceParameter"> - Constant to set/get the maximum distance a shape can be from another before they are considered separated and the contact is discarded. + Constant to set/get the maximum distance a shape can be from another before they are considered separated and the contact is discarded. The default value of this parameter is [member ProjectSettings.physics/2d/solver/contact_max_separation]. </constant> <constant name="SPACE_PARAM_CONTACT_MAX_ALLOWED_PENETRATION" value="2" enum="SpaceParameter"> - Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision. + Constant to set/get the maximum distance a shape can penetrate another shape before it is considered a collision. The default value of this parameter is [member ProjectSettings.physics/2d/solver/contact_max_allowed_penetration]. </constant> <constant name="SPACE_PARAM_CONTACT_DEFAULT_BIAS" value="3" enum="SpaceParameter"> - Constant to set/get the default solver bias for all physics contacts. A solver bias is a factor controlling how much two objects "rebound", after overlapping, to avoid leaving them in that state because of numerical imprecision. + Constant to set/get the default solver bias for all physics contacts. A solver bias is a factor controlling how much two objects "rebound", after overlapping, to avoid leaving them in that state because of numerical imprecision. The default value of this parameter is [member ProjectSettings.physics/2d/solver/default_contact_bias]. </constant> <constant name="SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_THRESHOLD" value="4" enum="SpaceParameter"> - Constant to set/get the threshold linear velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. + Constant to set/get the threshold linear velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. The default value of this parameter is [member ProjectSettings.physics/2d/sleep_threshold_linear]. </constant> <constant name="SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_THRESHOLD" value="5" enum="SpaceParameter"> - Constant to set/get the threshold angular velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. + Constant to set/get the threshold angular velocity of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after the time given. The default value of this parameter is [member ProjectSettings.physics/2d/sleep_threshold_angular]. </constant> <constant name="SPACE_PARAM_BODY_TIME_TO_SLEEP" value="6" enum="SpaceParameter"> - Constant to set/get the maximum time of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after this time. + Constant to set/get the maximum time of activity. A body marked as potentially inactive for both linear and angular velocity will be put to sleep after this time. The default value of this parameter is [member ProjectSettings.physics/2d/time_before_sleep]. </constant> <constant name="SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS" value="7" enum="SpaceParameter"> - Constant to set/get the default solver bias for all physics constraints. A solver bias is a factor controlling how much two objects "rebound", after violating a constraint, to avoid leaving them in that state because of numerical imprecision. + Constant to set/get the default solver bias for all physics constraints. A solver bias is a factor controlling how much two objects "rebound", after violating a constraint, to avoid leaving them in that state because of numerical imprecision. The default value of this parameter is [member ProjectSettings.physics/2d/solver/default_constraint_bias]. </constant> <constant name="SPACE_PARAM_SOLVER_ITERATIONS" value="8" enum="SpaceParameter"> - Constant to set/get the number of solver iterations for all contacts and constraints. The greater the number of iterations, the more accurate the collisions will be. However, a greater number of iterations requires more CPU power, which can decrease performance. + Constant to set/get the number of solver iterations for all contacts and constraints. The greater the number of iterations, the more accurate the collisions will be. However, a greater number of iterations requires more CPU power, which can decrease performance. The default value of this parameter is [member ProjectSettings.physics/2d/solver/solver_iterations]. </constant> <constant name="SHAPE_WORLD_BOUNDARY" value="0" enum="ShapeType"> This is the constant for creating world boundary shapes. A world boundary shape is an [i]infinite[/i] line with an origin point, and a normal. Thus, it can be used for front/behind checks. @@ -964,7 +1011,7 @@ This is the constant for creating capsule shapes. A capsule shape is defined by a radius and a length. It can be used for intersections and inside/outside checks. </constant> <constant name="SHAPE_CONVEX_POLYGON" value="6" enum="ShapeType"> - This is the constant for creating convex polygon shapes. A polygon is defined by a list of points. It can be used for intersections and inside/outside checks. Unlike the [member CollisionPolygon2D.polygon] property, polygons modified with [method shape_set_data] do not verify that the points supplied form is a convex polygon. + This is the constant for creating convex polygon shapes. A polygon is defined by a list of points. It can be used for intersections and inside/outside checks. </constant> <constant name="SHAPE_CONCAVE_POLYGON" value="7" enum="ShapeType"> This is the constant for creating concave polygon shapes. A polygon is defined by a list of points. It can be used for intersections checks, but not for inside/outside checks. @@ -973,35 +1020,35 @@ This constant is used internally by the engine. Any attempt to create this kind of shape results in an error. </constant> <constant name="AREA_PARAM_GRAVITY_OVERRIDE_MODE" value="0" enum="AreaParameter"> - Constant to set/get gravity override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. + Constant to set/get gravity override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. The default value of this parameter is [constant AREA_SPACE_OVERRIDE_DISABLED]. </constant> <constant name="AREA_PARAM_GRAVITY" value="1" enum="AreaParameter"> - Constant to set/get gravity strength in an area. + Constant to set/get gravity strength in an area. The default value of this parameter is [code]9.80665[/code]. </constant> <constant name="AREA_PARAM_GRAVITY_VECTOR" value="2" enum="AreaParameter"> - Constant to set/get gravity vector/center in an area. + Constant to set/get gravity vector/center in an area. The default value of this parameter is [code]Vector2(0, -1)[/code]. </constant> <constant name="AREA_PARAM_GRAVITY_IS_POINT" value="3" enum="AreaParameter"> - Constant to set/get whether the gravity vector of an area is a direction, or a center point. + Constant to set/get whether the gravity vector of an area is a direction, or a center point. The default value of this parameter is [code]false[/code]. </constant> <constant name="AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE" value="4" enum="AreaParameter"> Constant to set/get the distance at which the gravity strength is equal to the gravity controlled by [constant AREA_PARAM_GRAVITY]. For example, on a planet 100 pixels in radius with a surface gravity of 4.0 px/s², set the gravity to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 pixels from the center the gravity will be 1.0 px/s² (twice the distance, 1/4th the gravity), at 50 pixels it will be 16.0 px/s² (half the distance, 4x the gravity), and so on. - The above is true only when the unit distance is a positive number. When the unit distance is set to 0.0, the gravity will be constant regardless of distance. + The above is true only when the unit distance is a positive number. When the unit distance is set to 0.0, the gravity will be constant regardless of distance. The default value of this parameter is [code]0.0[/code]. </constant> <constant name="AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE" value="5" enum="AreaParameter"> - Constant to set/get linear damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. + Constant to set/get linear damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. The default value of this parameter is [constant AREA_SPACE_OVERRIDE_DISABLED]. </constant> <constant name="AREA_PARAM_LINEAR_DAMP" value="6" enum="AreaParameter"> - Constant to set/get the linear damping factor of an area. + Constant to set/get the linear damping factor of an area. The default value of this parameter is [code]0.1[/code]. </constant> <constant name="AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE" value="7" enum="AreaParameter"> - Constant to set/get angular damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. + Constant to set/get angular damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. The default value of this parameter is [constant AREA_SPACE_OVERRIDE_DISABLED]. </constant> <constant name="AREA_PARAM_ANGULAR_DAMP" value="8" enum="AreaParameter"> - Constant to set/get the angular damping factor of an area. + Constant to set/get the angular damping factor of an area. The default value of this parameter is [code]1.0[/code]. </constant> <constant name="AREA_PARAM_PRIORITY" value="9" enum="AreaParameter"> - Constant to set/get the priority (order of processing) of an area. + Constant to set/get the priority (order of processing) of an area. The default value of this parameter is [code]0[/code]. </constant> <constant name="AREA_SPACE_OVERRIDE_DISABLED" value="0" enum="AreaSpaceOverrideMode"> This area does not affect gravity/damp. These are generally areas that exist only to detect collisions, and objects entering or exiting them. @@ -1031,34 +1078,36 @@ Constant for linear rigid bodies. In this mode, a body can not rotate, and only its linear velocity is affected by external forces. </constant> <constant name="BODY_PARAM_BOUNCE" value="0" enum="BodyParameter"> - Constant to set/get a body's bounce factor. + Constant to set/get a body's bounce factor. The default value of this parameter is [code]0.0[/code]. </constant> <constant name="BODY_PARAM_FRICTION" value="1" enum="BodyParameter"> - Constant to set/get a body's friction. + Constant to set/get a body's friction. The default value of this parameter is [code]1.0[/code]. </constant> <constant name="BODY_PARAM_MASS" value="2" enum="BodyParameter"> - Constant to set/get a body's mass. + Constant to set/get a body's mass. The default value of this parameter is [code]1.0[/code]. If the body's mode is set to [constant BODY_MODE_RIGID], then setting this parameter will have the following additional effects: + - If the parameter [constant BODY_PARAM_CENTER_OF_MASS] has never been set explicitly, then the value of that parameter will be recalculated based on the body's shapes. + - If the parameter [constant BODY_PARAM_INERTIA] is set to a value [code]<= 0.0[/code], then the value of that parameter will be recalculated based on the body's shapes, mass, and center of mass. </constant> <constant name="BODY_PARAM_INERTIA" value="3" enum="BodyParameter"> - Constant to set/get a body's inertia. + Constant to set/get a body's inertia. The default value of this parameter is [code]0.0[/code]. If the body's inertia is set to a value [code]<= 0.0[/code], then the inertia will be recalculated based on the body's shapes, mass, and center of mass. </constant> <constant name="BODY_PARAM_CENTER_OF_MASS" value="4" enum="BodyParameter"> - Constant to set/get a body's center of mass position in the body's local coordinate system. + Constant to set/get a body's center of mass position in the body's local coordinate system. The default value of this parameter is [code]Vector2(0,0)[/code]. If this parameter is never set explicitly, then it is recalculated based on the body's shapes when setting the parameter [constant BODY_PARAM_MASS] or when calling [method body_set_space]. </constant> <constant name="BODY_PARAM_GRAVITY_SCALE" value="5" enum="BodyParameter"> - Constant to set/get a body's gravity multiplier. + Constant to set/get a body's gravity multiplier. The default value of this parameter is [code]1.0[/code]. </constant> <constant name="BODY_PARAM_LINEAR_DAMP_MODE" value="6" enum="BodyParameter"> - Constant to set/get a body's linear damping mode. See [enum BodyDampMode] for possible values. + Constant to set/get a body's linear damping mode. See [enum BodyDampMode] for possible values. The default value of this parameter is [constant BODY_DAMP_MODE_COMBINE]. </constant> <constant name="BODY_PARAM_ANGULAR_DAMP_MODE" value="7" enum="BodyParameter"> - Constant to set/get a body's angular damping mode. See [enum BodyDampMode] for possible values. + Constant to set/get a body's angular damping mode. See [enum BodyDampMode] for possible values. The default value of this parameter is [constant BODY_DAMP_MODE_COMBINE]. </constant> <constant name="BODY_PARAM_LINEAR_DAMP" value="8" enum="BodyParameter"> - Constant to set/get a body's linear damping factor. + Constant to set/get a body's linear damping factor. The default value of this parameter is [code]0.0[/code]. </constant> <constant name="BODY_PARAM_ANGULAR_DAMP" value="9" enum="BodyParameter"> - Constant to set/get a body's angular damping factor. + Constant to set/get a body's angular damping factor. The default value of this parameter is [code]0.0[/code]. </constant> <constant name="BODY_PARAM_MAX" value="10" enum="BodyParameter"> Represents the size of the [enum BodyParameter] enum. @@ -1097,24 +1146,31 @@ Represents the size of the [enum JointType] enum. </constant> <constant name="JOINT_PARAM_BIAS" value="0" enum="JointParam"> + Constant to set/get how fast the joint pulls the bodies back to satisfy the joint constraint. The lower the value, the more the two bodies can pull on the joint. The default value of this parameter is [code]0.0[/code]. + [b]Note:[/b] In Godot Physics, this parameter is only used for pin joints and groove joints. </constant> <constant name="JOINT_PARAM_MAX_BIAS" value="1" enum="JointParam"> + Constant to set/get the maximum speed with which the joint can apply corrections. The default value of this parameter is [code]3.40282e+38[/code]. + [b]Note:[/b] In Godot Physics, this parameter is only used for groove joints. </constant> <constant name="JOINT_PARAM_MAX_FORCE" value="2" enum="JointParam"> + Constant to set/get the maximum force that the joint can use to act on the two bodies. The default value of this parameter is [code]3.40282e+38[/code]. + [b]Note:[/b] In Godot Physics, this parameter is only used for groove joints. </constant> <constant name="PIN_JOINT_SOFTNESS" value="0" enum="PinJointParam"> + Constant to set/get a how much the bond of the pin joint can flex. The default value of this parameter is [code]0.0[/code]. </constant> <constant name="DAMPED_SPRING_REST_LENGTH" value="0" enum="DampedSpringParam"> - Sets the resting length of the spring joint. The joint will always try to go to back this length when pulled apart. + Sets the resting length of the spring joint. The joint will always try to go to back this length when pulled apart. The default value of this parameter is the distance between the joint's anchor points. </constant> <constant name="DAMPED_SPRING_STIFFNESS" value="1" enum="DampedSpringParam"> - Sets the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length. + Sets the stiffness of the spring joint. The joint applies a force equal to the stiffness times the distance from its resting length. The default value of this parameter is [code]20.0[/code]. </constant> <constant name="DAMPED_SPRING_DAMPING" value="2" enum="DampedSpringParam"> - Sets the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping). + Sets the damping ratio of the spring joint. A value of 0 indicates an undamped spring, while 1 causes the system to reach equilibrium as fast as possible (critical damping). The default value of this parameter is [code]1.5[/code]. </constant> <constant name="CCD_MODE_DISABLED" value="0" enum="CCDMode"> - Disables continuous collision detection. This is the fastest way to detect body collisions, but can miss small, fast-moving objects. + Disables continuous collision detection. This is the fastest way to detect body collisions, but it can miss small and/or fast-moving objects. </constant> <constant name="CCD_MODE_CAST_RAY" value="1" enum="CCDMode"> Enables continuous collision detection by raycasting. It is faster than shapecasting, but less precise. diff --git a/doc/classes/PointLight2D.xml b/doc/classes/PointLight2D.xml index 0c51a78e49..dd61082876 100644 --- a/doc/classes/PointLight2D.xml +++ b/doc/classes/PointLight2D.xml @@ -4,7 +4,7 @@ Positional 2D light source. </brief_description> <description> - Casts light in a 2D environment. This light's shape is defined by a (usually grayscale) texture + Casts light in a 2D environment. This light's shape is defined by a (usually grayscale) texture. </description> <tutorials> <link title="2D lights and shadows">$DOCS_URL/tutorials/2d/2d_lights_and_shadows.html</link> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 21be5e4bee..0b589b4e57 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -803,7 +803,7 @@ Path to a custom [Font] resource to use as default for all GUI elements of the project. </member> <member name="gui/theme/default_font_antialiasing" type="int" setter="" getter="" default="1"> - Font anti-aliasing mode. See [member FontFile.antialiasing], + Font anti-aliasing mode. See [member FontFile.antialiasing]. </member> <member name="gui/theme/default_font_generate_mipmaps" type="bool" setter="" getter="" default="false"> If set to [code]true[/code], the default font will have mipmaps generated. This prevents text from looking grainy when a [Control] is scaled down, or when a [Label3D] is viewed from a long distance (if [member Label3D.texture_filter] is set to a mode that displays mipmaps). @@ -957,16 +957,16 @@ macOS specific override for the shortcut to delete a word. </member> <member name="input/ui_text_caret_add_above" type="Dictionary" setter="" getter=""> - Default [InputEventAction] to add an additional caret above every caret of a text + Default [InputEventAction] to add an additional caret above every caret of a text. </member> <member name="input/ui_text_caret_add_above.macos" type="Dictionary" setter="" getter=""> - macOS specific override for the shortcut to add a caret above every caret + macOS specific override for the shortcut to add a caret above every caret. </member> <member name="input/ui_text_caret_add_below" type="Dictionary" setter="" getter=""> - Default [InputEventAction] to add an additional caret below every caret of a text + Default [InputEventAction] to add an additional caret below every caret of a text. </member> <member name="input/ui_text_caret_add_below.macos" type="Dictionary" setter="" getter=""> - macOS specific override for the shortcut to add a caret below every caret + macOS specific override for the shortcut to add a caret below every caret. </member> <member name="input/ui_text_caret_document_end" type="Dictionary" setter="" getter=""> Default [InputEventAction] to move the text cursor the the end of the text. @@ -1663,7 +1663,7 @@ Optional name for the 3D render layer 13. If left empty, the layer will display as "Layer 13". </member> <member name="layer_names/3d_render/layer_14" type="String" setter="" getter="" default=""""> - Optional name for the 3D render layer 14. If left empty, the layer will display as "Layer 14" + Optional name for the 3D render layer 14. If left empty, the layer will display as "Layer 14". </member> <member name="layer_names/3d_render/layer_15" type="String" setter="" getter="" default=""""> Optional name for the 3D render layer 15. If left empty, the layer will display as "Layer 15". diff --git a/doc/classes/RigidBody2D.xml b/doc/classes/RigidBody2D.xml index 6e3535f14a..937d0910ec 100644 --- a/doc/classes/RigidBody2D.xml +++ b/doc/classes/RigidBody2D.xml @@ -176,6 +176,28 @@ <member name="inertia" type="float" setter="set_inertia" getter="get_inertia" default="0.0"> The body's moment of inertia. This is like mass, but for rotation: it determines how much torque it takes to rotate the body. The moment of inertia is usually computed automatically from the mass and the shapes, but this property allows you to set a custom value. If set to [code]0[/code], inertia is automatically computed (default value). + [b]Note:[/b] This value does not change when inertia is automatically computed. Use [PhysicsServer2D] to get the computed inertia. + [codeblocks] + [gdscript] + @onready var ball = $Ball + + func get_ball_inertia(): + return 1.0 / PhysicsServer2D.body_get_direct_state(ball.get_rid()).inverse_inertia + [/gdscript] + [csharp] + private RigidBody2D _ball; + + public override void _Ready() + { + _ball = GetNode<RigidBody2D>("Ball"); + } + + private float GetBallInertia() + { + return 1.0f / PhysicsServer2D.BodyGetDirectState(_ball.GetRid()).InverseInertia; + } + [/csharp] + [/codeblocks] </member> <member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp" default="0.0"> Damps the body's movement. By default, the body will use the [b]Default Linear Damp[/b] in [b]Project > Project Settings > Physics > 2d[/b] or any value override set by an [Area2D] the body is in. Depending on [member linear_damp_mode], you can set [member linear_damp] to be added to or to replace the body's damping value. diff --git a/doc/classes/RigidBody3D.xml b/doc/classes/RigidBody3D.xml index 148cdf96ee..a066254b4f 100644 --- a/doc/classes/RigidBody3D.xml +++ b/doc/classes/RigidBody3D.xml @@ -183,6 +183,28 @@ <member name="inertia" type="Vector3" setter="set_inertia" getter="get_inertia" default="Vector3(0, 0, 0)"> The body's moment of inertia. This is like mass, but for rotation: it determines how much torque it takes to rotate the body on each axis. The moment of inertia is usually computed automatically from the mass and the shapes, but this property allows you to set a custom value. If set to [code]Vector3.ZERO[/code], inertia is automatically computed (default value). + [b]Note:[/b] This value does not change when inertia is automatically computed. Use [PhysicsServer3D] to get the computed inertia. + [codeblocks] + [gdscript] + @onready var ball = $Ball + + func get_ball_inertia(): + return PhysicsServer3D.body_get_direct_state(ball.get_rid()).inverse_inertia.inverse() + [/gdscript] + [csharp] + private RigidBody3D _ball; + + public override void _Ready() + { + _ball = GetNode<RigidBody3D>("Ball"); + } + + private Vector3 GetBallInertia() + { + return PhysicsServer3D.BodyGetDirectState(_ball.GetRid()).InverseInertia.Inverse(); + } + [/csharp] + [/codeblocks] </member> <member name="linear_damp" type="float" setter="set_linear_damp" getter="get_linear_damp" default="0.0"> Damps the body's movement. By default, the body will use the [b]Default Linear Damp[/b] in [b]Project > Project Settings > Physics > 3d[/b] or any value override set by an [Area3D] the body is in. Depending on [member linear_damp_mode], you can set [member linear_damp] to be added to or to replace the body's damping value. diff --git a/doc/classes/Skeleton3D.xml b/doc/classes/Skeleton3D.xml index 70986ba06a..bdd3495798 100644 --- a/doc/classes/Skeleton3D.xml +++ b/doc/classes/Skeleton3D.xml @@ -240,7 +240,7 @@ <description> Sets the global pose transform, [param pose], for the bone at [param bone_idx]. [param amount] is the interpolation strength that will be used when applying the pose, and [param persistent] determines if the applied pose will remain. - [b]Note:[/b] The pose transform needs to be a global pose! To convert a world transform from a [Node3D] to a global bone pose, multiply the [method Transform3D.affine_inverse] of the node's [member Node3D.global_transform] by the desired world transform + [b]Note:[/b] The pose transform needs to be a global pose! To convert a world transform from a [Node3D] to a global bone pose, multiply the [method Transform3D.affine_inverse] of the node's [member Node3D.global_transform] by the desired world transform. </description> </method> <method name="set_bone_name"> diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index c309026aaa..be8c4c2485 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -436,7 +436,7 @@ <return type="int" /> <param index="0" name="position" type="Vector2i" /> <description> - Returns the equivalent minimap line at [param position] + Returns the equivalent minimap line at [param position]. </description> </method> <method name="get_minimap_visible_lines" qualifiers="const"> @@ -483,7 +483,7 @@ <method name="get_saved_version" qualifiers="const"> <return type="int" /> <description> - Returns the last tagged saved version from [method tag_saved_version] + Returns the last tagged saved version from [method tag_saved_version]. </description> </method> <method name="get_scroll_pos_for_line" qualifiers="const"> @@ -1054,7 +1054,7 @@ <return type="void" /> <param index="0" name="callback" type="Callable" /> <description> - Provide custom tooltip text. The callback method must take the following args: [code]hovered_word: String[/code] + Provide custom tooltip text. The callback method must take the following args: [code]hovered_word: String[/code]. </description> </method> <method name="start_action"> diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 5dedea50d0..413cf62f7d 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -168,6 +168,15 @@ Returns the number of layers in the TileMap. </description> </method> + <method name="get_navigation_map" qualifiers="const"> + <return type="RID" /> + <param index="0" name="layer" type="int" /> + <description> + Returns the [NavigationServer2D] navigation map [RID] currently assigned to the specified TileMap [param layer]. + By default the TileMap uses the default [World2D] navigation map for the first TileMap layer. For each additional TileMap layer a new navigation map is created for the additional layer. + In order to make [NavigationAgent2D] switch between TileMap layer navigation maps use [method NavigationAgent2D.set_navigation_map] with the navigation map received from [method get_navigation_map]. + </description> + </method> <method name="get_neighbor_cell" qualifiers="const"> <return type="Vector2i" /> <param index="0" name="coords" type="Vector2i" /> @@ -188,7 +197,7 @@ <return type="Vector2i[]" /> <param index="0" name="coords" type="Vector2i" /> <description> - Returns the list of all neighbourings cells to the one at [param coords] + Returns the list of all neighbourings cells to the one at [param coords]. </description> </method> <method name="get_used_cells" qualifiers="const"> @@ -243,7 +252,7 @@ <param index="1" name="coords_in_pattern" type="Vector2i" /> <param index="2" name="pattern" type="TileMapPattern" /> <description> - Returns for the given coordinate [param coords_in_pattern] in a [TileMapPattern] the corresponding cell coordinates if the pattern was pasted at the [param position_in_tilemap] coordinates (see [method set_pattern]). This mapping is required as in half-offset tile shapes, the mapping might not work by calculating [code]position_in_tile_map + coords_in_pattern[/code] + Returns for the given coordinate [param coords_in_pattern] in a [TileMapPattern] the corresponding cell coordinates if the pattern was pasted at the [param position_in_tilemap] coordinates (see [method set_pattern]). This mapping is required as in half-offset tile shapes, the mapping might not work by calculating [code]position_in_tile_map + coords_in_pattern[/code]. </description> </method> <method name="map_to_local" qualifiers="const"> @@ -366,6 +375,16 @@ If [code]layer[/code] is negative, the layers are accessed from the last one. </description> </method> + <method name="set_navigation_map"> + <return type="void" /> + <param index="0" name="layer" type="int" /> + <param index="1" name="map" type="RID" /> + <description> + Assigns a [NavigationServer2D] navigation map [RID] to the specified TileMap [param layer]. + By default the TileMap uses the default [World2D] navigation map for the first TileMap layer. For each additional TileMap layer a new navigation map is created for the additional layer. + In order to make [NavigationAgent2D] switch between TileMap layer navigation maps use [method NavigationAgent2D.set_navigation_map] with the navigation map received from [method get_navigation_map]. + </description> + </method> <method name="set_pattern"> <return type="void" /> <param index="0" name="layer" type="int" /> diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index 14e705a7e6..92050eaa34 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -358,6 +358,7 @@ <description> Popups the [Window] at the center of the current screen, with optionally given minimum size. If the [Window] is embedded, it will be centered in the parent [Viewport] instead. + [b]Note:[/b] Calling it with the default value of [param minsize] is equivalent to calling it with [member size]. </description> </method> <method name="popup_centered_clamped"> @@ -367,6 +368,7 @@ <description> Popups the [Window] centered inside its parent [Window]. [code]fallback_ratio[/code] determines the maximum size of the [Window], in relation to its parent. + [b]Note:[/b] Calling it with the default value of [param minsize] is equivalent to calling it with [member size]. </description> </method> <method name="popup_centered_ratio"> diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp index 36b34dd8a2..1adba019ba 100644 --- a/drivers/gles3/storage/mesh_storage.cpp +++ b/drivers/gles3/storage/mesh_storage.cpp @@ -1686,6 +1686,8 @@ void MeshStorage::multimesh_set_buffer(RID p_multimesh, const Vector<float> &p_b uint32_t old_stride = multimesh->xform_format == RS::MULTIMESH_TRANSFORM_2D ? 8 : 12; old_stride += multimesh->uses_colors ? 4 : 0; old_stride += multimesh->uses_custom_data ? 4 : 0; + ERR_FAIL_COND(p_buffer.size() != (multimesh->instances * (int)old_stride)); + for (int i = 0; i < multimesh->instances; i++) { { float *dataptr = w + i * old_stride; diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index 9c9c39cc0e..ce66943328 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -806,6 +806,7 @@ void TextureStorage::texture_2d_update(RID p_texture, const Ref<Image> &p_image, texture_set_data(p_texture, p_image, p_layer); #ifdef TOOLS_ENABLED Texture *tex = texture_owner.get_or_null(p_texture); + ERR_FAIL_COND(!tex); tex->image_cache_2d.unref(); #endif diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index 327f067e65..91a746636a 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -8462,14 +8462,17 @@ void RenderingDeviceVulkan::set_resource_name(RID p_id, const String p_name) { } void RenderingDeviceVulkan::draw_command_begin_label(String p_label_name, const Color p_color) { + _THREAD_SAFE_METHOD_ context->command_begin_label(frames[frame].draw_command_buffer, p_label_name, p_color); } void RenderingDeviceVulkan::draw_command_insert_label(String p_label_name, const Color p_color) { + _THREAD_SAFE_METHOD_ context->command_insert_label(frames[frame].draw_command_buffer, p_label_name, p_color); } void RenderingDeviceVulkan::draw_command_end_label() { + _THREAD_SAFE_METHOD_ context->command_end_label(frames[frame].draw_command_buffer); } diff --git a/drivers/vulkan/vulkan_context.cpp b/drivers/vulkan/vulkan_context.cpp index 179de8227a..b8cea7136d 100644 --- a/drivers/vulkan/vulkan_context.cpp +++ b/drivers/vulkan/vulkan_context.cpp @@ -1871,7 +1871,10 @@ Error VulkanContext::_update_swap_chain(Window *window) { // Set the windows present mode if it is available, otherwise FIFO is used (guaranteed supported). if (present_mode_available) { - window->presentMode = requested_present_mode; + if (window->presentMode != requested_present_mode) { + window->presentMode = requested_present_mode; + print_verbose("Using present mode: " + String(string_VkPresentModeKHR(window->presentMode))); + } } else { String present_mode_string; switch (window->vsync_mode) { @@ -1892,8 +1895,6 @@ Error VulkanContext::_update_swap_chain(Window *window) { window->vsync_mode = DisplayServer::VSYNC_ENABLED; // Set to default. } - print_verbose("Using present mode: " + String(string_VkPresentModeKHR(window->presentMode))); - free(presentModes); // Determine the number of VkImages to use in the swap chain. diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index 3233bd79d5..9f3893a5db 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -2003,7 +2003,6 @@ void AnimationTrackEdit::_notification(int p_what) { draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2)); update_mode_rect.size.x += down_icon->get_width(); } else if (animation->track_get_type(track) == Animation::TYPE_BEZIER) { - Ref<Texture2D> bezier_icon = get_theme_icon(SNAME("EditBezier"), SNAME("EditorIcons")); update_mode_rect.size.x += down_icon->get_width(); update_mode_rect = Rect2(); } else { @@ -3311,25 +3310,15 @@ void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim, bool p_re snap->set_disabled(false); snap_mode->set_disabled(false); - bezier_edit_icon->set_disabled(true); - imported_anim_warning->hide(); - bool import_warning_done = false; - bool bezier_done = false; for (int i = 0; i < animation->get_track_count(); i++) { if (animation->track_is_imported(i)) { imported_anim_warning->show(); - import_warning_done = true; - } - if (animation->track_get_type(i) == Animation::TrackType::TYPE_BEZIER) { - bezier_edit_icon->set_disabled(false); - bezier_done = true; - } - if (import_warning_done && bezier_done) { break; } } + _check_bezier_exist(); } else { hscroll->hide(); edit->set_disabled(true); @@ -3343,6 +3332,24 @@ void AnimationTrackEditor::set_animation(const Ref<Animation> &p_anim, bool p_re } } +void AnimationTrackEditor::_check_bezier_exist() { + bool is_exist = false; + for (int i = 0; i < animation->get_track_count(); i++) { + if (animation->track_get_type(i) == Animation::TrackType::TYPE_BEZIER) { + is_exist = true; + break; + } + } + if (is_exist) { + bezier_edit_icon->set_disabled(false); + } else { + if (bezier_edit->is_visible()) { + _cancel_bezier_edit(); + } + bezier_edit_icon->set_disabled(true); + } +} + Ref<Animation> AnimationTrackEditor::get_current_animation() const { return animation; } @@ -4292,6 +4299,8 @@ void AnimationTrackEditor::_update_tracks() { memdelete(track_vbox->get_child(0)); } + timeline->set_track_edit(nullptr); + track_edits.clear(); groups.clear(); @@ -4490,6 +4499,8 @@ void AnimationTrackEditor::_animation_changed() { return; // All will be updated, don't bother with anything. } + _check_bezier_exist(); + if (key_edit) { if (key_edit->setting) { // If editing a key, just redraw the edited track, makes refresh less costly. @@ -4710,7 +4721,6 @@ void AnimationTrackEditor::_new_track_node_selected(NodePath p_path) { adding_track_path = path_to; prop_selector->set_type_filter(filter); prop_selector->select_property_from_instance(node); - bezier_edit_icon->set_disabled(false); } break; case Animation::TYPE_AUDIO: { if (!node->is_class("AudioStreamPlayer") && !node->is_class("AudioStreamPlayer2D") && !node->is_class("AudioStreamPlayer3D")) { diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index 2a59bda2a4..c733f397e3 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -399,6 +399,7 @@ class AnimationTrackEditor : public VBoxContainer { void _update_tracks(); void _redraw_tracks(); void _redraw_groups(); + void _check_bezier_exist(); void _name_limit_changed(); void _timeline_changed(float p_new_pos, bool p_drag, bool p_timeline_only); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index b217cd57bf..97a73d89e7 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1312,20 +1312,15 @@ void CodeTextEditor::move_lines_up() { Vector<int> new_group{ c }; Pair<int, int> group_border; - if (text_editor->has_selection(c)) { - group_border.first = text_editor->get_selection_from_line(c); - group_border.second = text_editor->get_selection_to_line(c); - } else { - group_border.first = text_editor->get_caret_line(c); - group_border.second = text_editor->get_caret_line(c); - } + group_border.first = _get_affected_lines_from(c); + group_border.second = _get_affected_lines_to(c); for (int j = i; j < caret_edit_order.size() - 1; j++) { int c_current = caret_edit_order[j]; int c_next = caret_edit_order[j + 1]; - int next_start_pos = text_editor->has_selection(c_next) ? text_editor->get_selection_from_line(c_next) : text_editor->get_caret_line(c_next); - int next_end_pos = text_editor->has_selection(c_next) ? text_editor->get_selection_to_line(c_next) : text_editor->get_caret_line(c_next); + int next_start_pos = _get_affected_lines_from(c_next); + int next_end_pos = _get_affected_lines_to(c_next); int current_start_pos = text_editor->has_selection(c_current) ? text_editor->get_selection_from_line(c_current) : text_editor->get_caret_line(c_current); @@ -1405,27 +1400,22 @@ void CodeTextEditor::move_lines_down() { // Lists of carets representing each group Vector<Vector<int>> caret_groups; Vector<Pair<int, int>> group_borders; - + Vector<int> group_border_ends; // Search for groups of carets and their selections residing on the same lines for (int i = 0; i < caret_edit_order.size(); i++) { int c = caret_edit_order[i]; Vector<int> new_group{ c }; Pair<int, int> group_border; - if (text_editor->has_selection(c)) { - group_border.first = text_editor->get_selection_from_line(c); - group_border.second = text_editor->get_selection_to_line(c); - } else { - group_border.first = text_editor->get_caret_line(c); - group_border.second = text_editor->get_caret_line(c); - } + group_border.first = _get_affected_lines_from(c); + group_border.second = _get_affected_lines_to(c); for (int j = i; j < caret_edit_order.size() - 1; j++) { int c_current = caret_edit_order[j]; int c_next = caret_edit_order[j + 1]; - int next_start_pos = text_editor->has_selection(c_next) ? text_editor->get_selection_from_line(c_next) : text_editor->get_caret_line(c_next); - int next_end_pos = text_editor->has_selection(c_next) ? text_editor->get_selection_to_line(c_next) : text_editor->get_caret_line(c_next); + int next_start_pos = _get_affected_lines_from(c_next); + int next_end_pos = _get_affected_lines_to(c_next); int current_start_pos = text_editor->has_selection(c_current) ? text_editor->get_selection_from_line(c_current) : text_editor->get_caret_line(c_current); @@ -1442,16 +1432,17 @@ void CodeTextEditor::move_lines_down() { } } group_borders.push_back(group_border); + group_border_ends.push_back(text_editor->has_selection(c) ? text_editor->get_selection_to_line(c) : text_editor->get_caret_line(c)); caret_groups.push_back(new_group); } for (int i = 0; i < group_borders.size(); i++) { - if (group_borders[i].second + 1 > text_editor->get_line_count() - 1) { + if (group_border_ends[i] + 1 > text_editor->get_line_count() - 1) { continue; } // If the group starts overlapping with the upper group don't move it - if (i > 0 && group_borders[i].second + 1 >= group_borders[i - 1].first) { + if (i > 0 && group_border_ends[i] + 1 >= group_borders[i - 1].first) { continue; } @@ -1498,87 +1489,44 @@ void CodeTextEditor::move_lines_down() { text_editor->queue_redraw(); } -void CodeTextEditor::_delete_line(int p_line, int p_caret) { - // this is currently intended to be called within delete_lines() - // so `begin_complex_operation` is omitted here - text_editor->set_line(p_line, ""); - if (p_line == 0 && text_editor->get_line_count() > 1) { - text_editor->set_caret_line(1, p_caret == 0, true, 0, p_caret); - text_editor->set_caret_column(0, p_caret == 0, p_caret); - } - text_editor->backspace(p_caret); - if (p_line < text_editor->get_line_count()) { - text_editor->unfold_line(p_line); - } - text_editor->set_caret_line(p_line, p_caret == 0, true, 0, p_caret); -} - void CodeTextEditor::delete_lines() { text_editor->begin_complex_operation(); - Vector<int> carets_to_remove; - Vector<int> caret_edit_order = text_editor->get_caret_index_edit_order(); - for (int i = 0; i < caret_edit_order.size(); i++) { - int c = caret_edit_order[i]; - int cl = text_editor->get_caret_line(c); - - bool swaped_caret = false; - for (int j = i + 1; j < caret_edit_order.size(); j++) { - if (text_editor->has_selection(caret_edit_order[j])) { - if (text_editor->get_selection_from_line() == cl) { - carets_to_remove.push_back(caret_edit_order[j]); - continue; - } - - if (text_editor->get_selection_to_line() == cl) { - if (text_editor->has_selection(c)) { - if (text_editor->get_selection_to_line(c) != cl) { - text_editor->select(cl + 1, 0, text_editor->get_selection_to_line(c), text_editor->get_selection_to_column(c), c); - break; - } - } - - carets_to_remove.push_back(c); - i = j - 1; - swaped_caret = true; - break; - } - break; - } - - if (text_editor->get_caret_line(caret_edit_order[j]) == cl) { - carets_to_remove.push_back(caret_edit_order[j]); - i = j; + Vector<int> lines; + int last_line = INT_MAX; + for (const int &c : caret_edit_order) { + for (int line = _get_affected_lines_to(c); line >= _get_affected_lines_from(c); line--) { + if (line >= last_line) { continue; } - break; + last_line = line; + lines.append(line); } + } - if (swaped_caret) { - continue; + for (const int &line : lines) { + if (line != text_editor->get_line_count() - 1) { + text_editor->remove_text(line, 0, line + 1, 0); + } else { + text_editor->remove_text(line - 1, text_editor->get_line(line - 1).length(), line, text_editor->get_line(line).length()); } - - if (text_editor->has_selection(c)) { - int to_line = text_editor->get_selection_to_line(c); - int from_line = text_editor->get_selection_from_line(c); - int count = Math::abs(to_line - from_line) + 1; - - text_editor->set_caret_line(from_line, false, true, 0, c); - text_editor->deselect(c); - for (int j = 0; j < count; j++) { - _delete_line(from_line, c); + // Readjust carets. + int new_line = MIN(line, text_editor->get_line_count() - 1); + text_editor->unfold_line(new_line); + for (const int &c : caret_edit_order) { + if (text_editor->get_caret_line(c) == line || (text_editor->get_caret_line(c) == line + 1 && text_editor->get_caret_column(c) == 0)) { + text_editor->deselect(c); + text_editor->set_caret_line(new_line, c == 0, true, 0, c); + continue; } - } else { - _delete_line(text_editor->get_caret_line(c), c); + if (text_editor->get_caret_line(c) > line) { + text_editor->set_caret_line(text_editor->get_caret_line(c) - 1, c == 0, true, 0, c); + continue; + } + break; } } - - // Sort and remove backwards to preserve indexes. - carets_to_remove.sort(); - for (int i = carets_to_remove.size() - 1; i >= 0; i--) { - text_editor->remove_caret(carets_to_remove[i]); - } text_editor->merge_overlapping_carets(); text_editor->end_complex_operation(); } @@ -1634,77 +1582,67 @@ void CodeTextEditor::toggle_inline_comment(const String &delimiter) { text_editor->begin_complex_operation(); Vector<int> caret_edit_order = text_editor->get_caret_index_edit_order(); - for (const int &c : caret_edit_order) { - if (text_editor->has_selection(c)) { - int begin = text_editor->get_selection_from_line(c); - int end = text_editor->get_selection_to_line(c); - - // End of selection ends on the first column of the last line, ignore it. - if (text_editor->get_selection_to_column(c) == 0) { - end -= 1; + caret_edit_order.reverse(); + int last_line = -1; + for (const int &c1 : caret_edit_order) { + int from = _get_affected_lines_from(c1); + from += from == last_line ? 1 : 0; + int to = _get_affected_lines_to(c1); + last_line = to; + // Check first if there's any uncommented lines in selection. + bool is_commented = true; + for (int line = from; line <= to; line++) { + if (!text_editor->get_line(line).begins_with(delimiter)) { + is_commented = false; + break; } + } - int col_to = text_editor->get_selection_to_column(c); - int cursor_pos = text_editor->get_caret_column(c); - - // Check if all lines in the selected block are commented. - bool is_commented = true; - for (int i = begin; i <= end; i++) { - if (!text_editor->get_line(i).begins_with(delimiter)) { - is_commented = false; - break; - } + // Caret positions need to be saved since they could be moved at the eol. + Vector<int> caret_cols; + Vector<int> selection_to_cols; + for (const int &c2 : caret_edit_order) { + if (text_editor->get_caret_line(c2) >= from && text_editor->get_caret_line(c2) <= to) { + caret_cols.append(text_editor->get_caret_column(c2)); } - for (int i = begin; i <= end; i++) { - String line_text = text_editor->get_line(i); - - if (line_text.strip_edges().is_empty()) { - line_text = delimiter; - } else { - if (is_commented) { - line_text = line_text.substr(delimiter.length(), line_text.length()); - } else { - line_text = delimiter + line_text; - } - } - text_editor->set_line(i, line_text); + if (text_editor->has_selection(c2) && text_editor->get_selection_to_line(c2) >= from && text_editor->get_selection_to_line(c2) <= to) { + selection_to_cols.append(text_editor->get_selection_to_column(c2)); } + } - // Adjust selection & cursor position. - int offset = (is_commented ? -1 : 1) * delimiter.length(); - int col_from = text_editor->get_selection_from_column(c) > 0 ? text_editor->get_selection_from_column(c) + offset : 0; - - if (is_commented && text_editor->get_caret_column(c) == text_editor->get_line(text_editor->get_caret_line(c)).length() + 1) { - cursor_pos += 1; + // Comment/uncomment. + for (int line = from; line <= to; line++) { + String line_text = text_editor->get_line(line); + if (line_text.strip_edges().is_empty()) { + text_editor->set_line(line, delimiter); + continue; } - - if (text_editor->get_selection_to_column(c) != 0 && col_to != text_editor->get_line(text_editor->get_selection_to_line(c)).length() + 1) { - col_to += offset; + if (is_commented) { + text_editor->set_line(line, line_text.substr(delimiter.length(), line_text.length())); + continue; } + text_editor->set_line(line, delimiter + line_text); + } - if (text_editor->get_caret_column(c) != 0) { - cursor_pos += offset; + // Readjust carets and selections. + int caret_i = 0; + int selection_i = 0; + int offset = (is_commented ? -1 : 1) * delimiter.length(); + for (const int &c2 : caret_edit_order) { + if (text_editor->get_caret_line(c2) >= from && text_editor->get_caret_line(c2) <= to) { + int caret_col = caret_cols[caret_i++]; + caret_col += (caret_col == 0) ? 0 : offset; + text_editor->set_caret_column(caret_col, c2 == 0, c2); } - - text_editor->select(begin, col_from, text_editor->get_selection_to_line(c), col_to, c); - text_editor->set_caret_column(cursor_pos, c == 0, c); - - } else { - int begin = text_editor->get_caret_line(c); - String line_text = text_editor->get_line(begin); - int delimiter_length = delimiter.length(); - - int col = text_editor->get_caret_column(c); - if (line_text.begins_with(delimiter)) { - line_text = line_text.substr(delimiter_length, line_text.length()); - col -= delimiter_length; - } else { - line_text = delimiter + line_text; - col += delimiter_length; + if (text_editor->has_selection(c2) && text_editor->get_selection_to_line(c2) >= from && text_editor->get_selection_to_line(c2) <= to) { + int from_col = text_editor->get_selection_from_column(c2); + from_col += (from_col == 0) ? 0 : offset; + int to_col = selection_to_cols[selection_i++]; + to_col += (to_col == 0) ? 0 : offset; + text_editor->select( + text_editor->get_selection_from_line(c2), from_col, + text_editor->get_selection_to_line(c2), to_col, c2); } - - text_editor->set_line(begin, line_text); - text_editor->set_caret_column(col, c == 0, c); } } text_editor->merge_overlapping_carets(); @@ -1942,6 +1880,22 @@ void CodeTextEditor::_toggle_scripts_pressed() { update_toggle_scripts_button(); } +int CodeTextEditor::_get_affected_lines_from(int p_caret) { + return text_editor->has_selection(p_caret) ? text_editor->get_selection_from_line(p_caret) : text_editor->get_caret_line(p_caret); +} + +int CodeTextEditor::_get_affected_lines_to(int p_caret) { + if (!text_editor->has_selection(p_caret)) { + return text_editor->get_caret_line(p_caret); + } + int line = text_editor->get_selection_to_line(p_caret); + // Don't affect a line with no selected characters + if (text_editor->get_selection_to_column(p_caret) == 0) { + line--; + } + return line; +} + void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) { Ref<InputEventMouseButton> mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) { @@ -2010,9 +1964,36 @@ void CodeTextEditor::set_warning_count(int p_warning_count) { } void CodeTextEditor::toggle_bookmark() { - for (int i = 0; i < text_editor->get_caret_count(); i++) { - int line = text_editor->get_caret_line(i); - text_editor->set_line_as_bookmarked(line, !text_editor->is_line_bookmarked(line)); + Vector<int> caret_edit_order = text_editor->get_caret_index_edit_order(); + caret_edit_order.reverse(); + int last_line = -1; + for (const int &c : caret_edit_order) { + int from = text_editor->has_selection(c) ? text_editor->get_selection_from_line(c) : text_editor->get_caret_line(c); + from += from == last_line ? 1 : 0; + int to = text_editor->has_selection(c) ? text_editor->get_selection_to_line(c) : text_editor->get_caret_line(c); + if (to < from) { + continue; + } + // Check first if there's any bookmarked lines in the selection. + bool selection_has_bookmarks = false; + for (int line = from; line <= to; line++) { + if (text_editor->is_line_bookmarked(line)) { + selection_has_bookmarks = true; + break; + } + } + + // Set bookmark on caret or remove all bookmarks from the selection. + if (!selection_has_bookmarks) { + if (text_editor->get_caret_line(c) != last_line) { + text_editor->set_line_as_bookmarked(text_editor->get_caret_line(c), true); + } + } else { + for (int line = from; line <= to; line++) { + text_editor->set_line_as_bookmarked(line, false); + } + } + last_line = to; } } diff --git a/editor/code_editor.h b/editor/code_editor.h index fe2a31a7a7..343720637b 100644 --- a/editor/code_editor.h +++ b/editor/code_editor.h @@ -198,9 +198,11 @@ class CodeTextEditor : public VBoxContainer { void _update_status_bar_theme(); - void _delete_line(int p_line, int p_caret); void _toggle_scripts_pressed(); + int _get_affected_lines_from(int p_caret); + int _get_affected_lines_to(int p_caret); + protected: virtual void _load_theme_settings() {} virtual void _validate_script() {} diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 88831e0c33..8a595be6e6 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1237,10 +1237,23 @@ void EditorFileSystem::_notification(int p_what) { case NOTIFICATION_PROCESS: { if (use_threads) { + /** This hack exists because of the EditorProgress nature + * of processing events recursively. This needs to be rewritten + * at some point entirely, but in the meantime the following + * hack prevents deadlock on import. + */ + + static bool prevent_recursive_process_hack = false; + if (prevent_recursive_process_hack) { + break; + } + + prevent_recursive_process_hack = true; + + bool done_importing = false; + if (scanning_changes) { if (scanning_changes_done) { - scanning_changes = false; - set_process(false); thread_sources.wait_to_finish(); @@ -1251,6 +1264,8 @@ void EditorFileSystem::_notification(int p_what) { } emit_signal(SNAME("sources_changed"), sources_changed.size() > 0); first_scan = false; + scanning_changes = false; // Changed to false here to prevent recursive triggering of scan thread. + done_importing = true; } } else if (!scanning && thread.is_started()) { set_process(false); @@ -1268,10 +1283,12 @@ void EditorFileSystem::_notification(int p_what) { first_scan = false; } - if (!is_processing() && scan_changes_pending) { + if (done_importing && scan_changes_pending) { scan_changes_pending = false; scan_changes(); } + + prevent_recursive_process_hack = false; } } break; } @@ -2180,6 +2197,7 @@ void EditorFileSystem::_reimport_thread(uint32_t p_index, ImportThreadData *p_im } void EditorFileSystem::reimport_files(const Vector<String> &p_files) { + ERR_FAIL_COND_MSG(importing, "Attempted to call reimport_files() recursively, this is not allowed."); importing = true; Vector<String> reloads; diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index bb7098643a..0c7ea33b54 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -45,15 +45,34 @@ DocTools *EditorHelp::doc = nullptr; -void EditorHelp::_update_theme() { - text_color = get_theme_color(SNAME("text_color"), SNAME("EditorHelp")); - title_color = get_theme_color(SNAME("title_color"), SNAME("EditorHelp")); - headline_color = get_theme_color(SNAME("headline_color"), SNAME("EditorHelp")); - comment_color = get_theme_color(SNAME("comment_color"), SNAME("EditorHelp")); - symbol_color = get_theme_color(SNAME("symbol_color"), SNAME("EditorHelp")); - value_color = get_theme_color(SNAME("value_color"), SNAME("EditorHelp")); - qualifier_color = get_theme_color(SNAME("qualifier_color"), SNAME("EditorHelp")); - type_color = get_theme_color(SNAME("type_color"), SNAME("EditorHelp")); +void EditorHelp::_update_theme_item_cache() { + VBoxContainer::_update_theme_item_cache(); + + theme_cache.text_color = get_theme_color(SNAME("text_color"), SNAME("EditorHelp")); + theme_cache.title_color = get_theme_color(SNAME("title_color"), SNAME("EditorHelp")); + theme_cache.headline_color = get_theme_color(SNAME("headline_color"), SNAME("EditorHelp")); + theme_cache.comment_color = get_theme_color(SNAME("comment_color"), SNAME("EditorHelp")); + theme_cache.symbol_color = get_theme_color(SNAME("symbol_color"), SNAME("EditorHelp")); + theme_cache.value_color = get_theme_color(SNAME("value_color"), SNAME("EditorHelp")); + theme_cache.qualifier_color = get_theme_color(SNAME("qualifier_color"), SNAME("EditorHelp")); + theme_cache.type_color = get_theme_color(SNAME("type_color"), SNAME("EditorHelp")); + + theme_cache.doc_font = get_theme_font(SNAME("doc"), SNAME("EditorFonts")); + theme_cache.doc_bold_font = get_theme_font(SNAME("doc_bold"), SNAME("EditorFonts")); + theme_cache.doc_italic_font = get_theme_font(SNAME("doc_italic"), SNAME("EditorFonts")); + theme_cache.doc_title_font = get_theme_font(SNAME("doc_title"), SNAME("EditorFonts")); + theme_cache.doc_code_font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts")); + theme_cache.doc_kbd_font = get_theme_font(SNAME("doc_keyboard"), SNAME("EditorFonts")); + + theme_cache.doc_font_size = get_theme_font_size(SNAME("doc_size"), SNAME("EditorFonts")); + theme_cache.doc_title_font_size = get_theme_font_size(SNAME("doc_title_size"), SNAME("EditorFonts")); + theme_cache.doc_code_font_size = get_theme_font_size(SNAME("doc_source_size"), SNAME("EditorFonts")); + theme_cache.doc_kbd_font_size = get_theme_font_size(SNAME("doc_keyboard_size"), SNAME("EditorFonts")); + + theme_cache.background_style = get_theme_stylebox(SNAME("background"), SNAME("EditorHelp")); + + class_desc->add_theme_font_override("normal_font", theme_cache.doc_font); + class_desc->add_theme_font_size_override("normal_font_size", theme_cache.doc_font_size); class_desc->add_theme_color_override("selection_color", get_theme_color(SNAME("selection_color"), SNAME("EditorHelp"))); class_desc->add_theme_constant_override("line_separation", get_theme_constant(SNAME("line_separation"), SNAME("EditorHelp"))); @@ -61,13 +80,6 @@ void EditorHelp::_update_theme() { class_desc->add_theme_constant_override("table_v_separation", get_theme_constant(SNAME("table_v_separation"), SNAME("EditorHelp"))); class_desc->add_theme_constant_override("text_highlight_h_padding", get_theme_constant(SNAME("text_highlight_h_padding"), SNAME("EditorHelp"))); class_desc->add_theme_constant_override("text_highlight_v_padding", get_theme_constant(SNAME("text_highlight_v_padding"), SNAME("EditorHelp"))); - - doc_font = get_theme_font(SNAME("doc"), SNAME("EditorFonts")); - doc_bold_font = get_theme_font(SNAME("doc_bold"), SNAME("EditorFonts")); - doc_title_font = get_theme_font(SNAME("doc_title"), SNAME("EditorFonts")); - doc_code_font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts")); - - doc_title_font_size = get_theme_font_size(SNAME("doc_title_size"), SNAME("EditorFonts")); } void EditorHelp::_search(bool p_search_previous) { @@ -187,14 +199,12 @@ void EditorHelp::_class_desc_input(const Ref<InputEvent> &p_input) { void EditorHelp::_class_desc_resized(bool p_force_update_theme) { // Add extra horizontal margins for better readability. // The margins increase as the width of the editor help container increases. - Ref<Font> font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts")); - int font_size = get_theme_font_size(SNAME("doc_source_size"), SNAME("EditorFonts")); - real_t char_width = font->get_char_size('x', font_size).width; + real_t char_width = theme_cache.doc_code_font->get_char_size('x', theme_cache.doc_code_font_size).width; const int new_display_margin = MAX(30 * EDSCALE, get_parent_anchorable_rect().size.width - char_width * 120 * EDSCALE) * 0.5; if (display_margin != new_display_margin || p_force_update_theme) { display_margin = new_display_margin; - Ref<StyleBox> class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_theme_stylebox(SNAME("background"), SNAME("EditorHelp"))->duplicate(); + Ref<StyleBox> class_desc_stylebox = theme_cache.background_style->duplicate(); class_desc_stylebox->set_content_margin(SIDE_LEFT, display_margin); class_desc_stylebox->set_content_margin(SIDE_RIGHT, display_margin); class_desc->add_theme_style_override("normal", class_desc_stylebox); @@ -204,7 +214,7 @@ void EditorHelp::_class_desc_resized(bool p_force_update_theme) { void EditorHelp::_add_type(const String &p_type, const String &p_enum) { if (p_type.is_empty() || p_type == "void") { - class_desc->push_color(Color(type_color, 0.5)); + class_desc->push_color(Color(theme_cache.type_color, 0.5)); class_desc->push_hint(TTR("No return value.")); class_desc->add_text("void"); class_desc->pop(); @@ -224,7 +234,7 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { } } - class_desc->push_color(type_color); + class_desc->push_color(theme_cache.type_color); bool add_array = false; if (can_ref) { if (t.ends_with("[]")) { @@ -333,7 +343,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview class_desc->push_meta("@method " + p_method.name); } - class_desc->push_color(headline_color); + class_desc->push_color(theme_cache.headline_color); _add_text(p_method.name); class_desc->pop(); @@ -341,12 +351,12 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview class_desc->pop(); //meta } - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text("("); class_desc->pop(); for (int j = 0; j < p_method.arguments.size(); j++) { - class_desc->push_color(text_color); + class_desc->push_color(theme_cache.text_color); if (j > 0) { class_desc->add_text(", "); } @@ -355,10 +365,10 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview class_desc->add_text(": "); _add_type(p_method.arguments[j].type, p_method.arguments[j].enumeration); if (!p_method.arguments[j].default_value.is_empty()) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" = "); class_desc->pop(); - class_desc->push_color(value_color); + class_desc->push_color(theme_cache.value_color); _add_text(_fix_constant(p_method.arguments[j].default_value)); class_desc->pop(); } @@ -367,21 +377,21 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview } if (is_vararg) { - class_desc->push_color(text_color); + class_desc->push_color(theme_cache.text_color); if (p_method.arguments.size()) { class_desc->add_text(", "); } - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text("..."); class_desc->pop(); class_desc->pop(); } - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(")"); class_desc->pop(); if (!p_method.qualifiers.is_empty()) { - class_desc->push_color(qualifier_color); + class_desc->push_color(theme_cache.qualifier_color); PackedStringArray qualifiers = p_method.qualifiers.split_spaces(); for (const String &qualifier : qualifiers) { @@ -426,6 +436,38 @@ void EditorHelp::_add_bulletpoint() { class_desc->add_text(String(prefix)); } +void EditorHelp::_push_normal_font() { + class_desc->push_font(theme_cache.doc_font); + class_desc->push_font_size(theme_cache.doc_font_size); +} + +void EditorHelp::_pop_normal_font() { + class_desc->pop(); + class_desc->pop(); +} + +void EditorHelp::_push_title_font() { + class_desc->push_color(theme_cache.title_color); + class_desc->push_font(theme_cache.doc_title_font); + class_desc->push_font_size(theme_cache.doc_title_font_size); +} + +void EditorHelp::_pop_title_font() { + class_desc->pop(); + class_desc->pop(); + class_desc->pop(); +} + +void EditorHelp::_push_code_font() { + class_desc->push_font(theme_cache.doc_code_font); + class_desc->push_font_size(theme_cache.doc_code_font_size); +} + +void EditorHelp::_pop_code_font() { + class_desc->pop(); + class_desc->pop(); +} + Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { if (!doc->class_list.has(p_class)) { return ERR_DOES_NOT_EXIST; @@ -447,13 +489,9 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { } void EditorHelp::_update_method_list(const Vector<DocData::MethodDoc> p_methods) { - Ref<Font> font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts")); - class_desc->pop(); // title font size - class_desc->pop(); // title font - class_desc->pop(); // title color - class_desc->add_newline(); - class_desc->push_font(font); + + _push_code_font(); class_desc->push_indent(1); class_desc->push_table(2); class_desc->set_table_column_expand(1, true); @@ -504,18 +542,14 @@ void EditorHelp::_update_method_list(const Vector<DocData::MethodDoc> p_methods) class_desc->pop(); //table class_desc->pop(); - class_desc->pop(); // font + _pop_code_font(); + class_desc->add_newline(); class_desc->add_newline(); } void EditorHelp::_update_method_descriptions(const DocData::ClassDoc p_classdoc, const Vector<DocData::MethodDoc> p_methods, const String &p_method_type) { - Ref<Font> font = get_theme_font(SNAME("doc"), SNAME("EditorFonts")); - Ref<Font> code_font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts")); - String link_color_text = title_color.to_html(false); - class_desc->pop(); // title font size - class_desc->pop(); // title font - class_desc->pop(); // title color + String link_color_text = theme_cache.title_color.to_html(false); class_desc->add_newline(); class_desc->add_newline(); @@ -531,15 +565,15 @@ void EditorHelp::_update_method_descriptions(const DocData::ClassDoc p_classdoc, } for (int i = 0; i < methods_filtered.size(); i++) { - class_desc->push_font(code_font); + _push_code_font(); _add_method(methods_filtered[i], false); - class_desc->pop(); + _pop_code_font(); class_desc->add_newline(); class_desc->add_newline(); - class_desc->push_color(text_color); - class_desc->push_font(font); + class_desc->push_color(theme_cache.text_color); + _push_normal_font(); class_desc->push_indent(1); if (methods_filtered[i].errors_returned.size()) { class_desc->append_text(TTR("Error codes returned:")); @@ -571,7 +605,7 @@ void EditorHelp::_update_method_descriptions(const DocData::ClassDoc p_classdoc, } else { class_desc->add_image(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); class_desc->add_text(" "); - class_desc->push_color(comment_color); + class_desc->push_color(theme_cache.comment_color); if (p_classdoc.is_script_doc) { class_desc->append_text(vformat(TTR("There is currently no description for this %s."), p_method_type)); } else { @@ -581,8 +615,9 @@ void EditorHelp::_update_method_descriptions(const DocData::ClassDoc p_classdoc, } class_desc->pop(); + _pop_normal_font(); class_desc->pop(); - class_desc->pop(); + class_desc->add_newline(); class_desc->add_newline(); class_desc->add_newline(); @@ -601,25 +636,20 @@ void EditorHelp::_update_doc() { method_line.clear(); section_line.clear(); - _update_theme(); - String link_color_text = title_color.to_html(false); + String link_color_text = theme_cache.title_color.to_html(false); DocData::ClassDoc cd = doc->class_list[edited_class]; // Make a copy, so we can sort without worrying. // Class name section_line.push_back(Pair<String, int>(TTR("Top"), 0)); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); - class_desc->push_color(title_color); + _push_title_font(); class_desc->add_text(TTR("Class:") + " "); - _add_type_icon(edited_class, doc_title_font_size); + _add_type_icon(edited_class, theme_cache.doc_title_font_size); class_desc->add_text(" "); - class_desc->push_color(headline_color); + class_desc->push_color(theme_cache.headline_color); _add_text(edited_class); class_desc->pop(); // color - class_desc->pop(); // color - class_desc->pop(); // font size - class_desc->pop(); // font + _pop_title_font(); if (cd.is_deprecated) { class_desc->add_text(" "); @@ -639,8 +669,8 @@ void EditorHelp::_update_doc() { // Ascendents if (!cd.inherits.is_empty()) { - class_desc->push_color(title_color); - class_desc->push_font(doc_font); + class_desc->push_color(theme_cache.title_color); + _push_normal_font(); class_desc->add_text(TTR("Inherits:") + " "); String inherits = cd.inherits; @@ -657,7 +687,7 @@ void EditorHelp::_update_doc() { } } - class_desc->pop(); + _pop_normal_font(); class_desc->pop(); class_desc->add_newline(); } @@ -667,11 +697,11 @@ void EditorHelp::_update_doc() { bool found = false; bool prev = false; - class_desc->push_font(doc_font); + _push_normal_font(); for (const KeyValue<String, DocData::ClassDoc> &E : doc->class_list) { if (E.value.inherits == cd.name) { if (!found) { - class_desc->push_color(title_color); + class_desc->push_color(theme_cache.title_color); class_desc->add_text(TTR("Inherited by:") + " "); found = true; } @@ -685,7 +715,7 @@ void EditorHelp::_update_doc() { prev = true; } } - class_desc->pop(); + _pop_normal_font(); if (found) { class_desc->pop(); @@ -722,13 +752,14 @@ void EditorHelp::_update_doc() { if (!cd.brief_description.strip_edges().is_empty()) { has_description = true; - class_desc->push_color(text_color); - class_desc->push_font(doc_bold_font); + class_desc->push_color(theme_cache.text_color); + class_desc->push_font(theme_cache.doc_bold_font); class_desc->push_indent(1); _add_text(DTR(cd.brief_description)); class_desc->pop(); class_desc->pop(); class_desc->pop(); + class_desc->add_newline(); class_desc->add_newline(); class_desc->add_newline(); @@ -740,23 +771,20 @@ void EditorHelp::_update_doc() { section_line.push_back(Pair<String, int>(TTR("Description"), class_desc->get_paragraph_count() - 2)); description_line = class_desc->get_paragraph_count() - 2; - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Description")); - class_desc->pop(); // font size - class_desc->pop(); // font - class_desc->pop(); // color + _pop_title_font(); class_desc->add_newline(); class_desc->add_newline(); - class_desc->push_color(text_color); - class_desc->push_font(doc_font); + class_desc->push_color(theme_cache.text_color); + _push_normal_font(); class_desc->push_indent(1); _add_text(DTR(cd.description)); class_desc->pop(); + _pop_normal_font(); class_desc->pop(); - class_desc->pop(); + class_desc->add_newline(); class_desc->add_newline(); class_desc->add_newline(); @@ -765,7 +793,7 @@ void EditorHelp::_update_doc() { if (!has_description) { class_desc->add_image(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); class_desc->add_text(" "); - class_desc->push_color(comment_color); + class_desc->push_color(theme_cache.comment_color); if (cd.is_script_doc) { class_desc->append_text(TTR("There is currently no description for this class.")); @@ -780,18 +808,15 @@ void EditorHelp::_update_doc() { // Online tutorials if (cd.tutorials.size()) { - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Online Tutorials")); - class_desc->pop(); // font size - class_desc->pop(); // font - class_desc->pop(); // color + _pop_title_font(); - class_desc->push_indent(1); - class_desc->push_font(doc_code_font); class_desc->add_newline(); + class_desc->push_indent(1); + _push_code_font(); + for (int i = 0; i < cd.tutorials.size(); i++) { const String link = DTR(cd.tutorials[i].link); String linktxt = (cd.tutorials[i].title.is_empty()) ? link : DTR(cd.tutorials[i].title); @@ -800,14 +825,15 @@ void EditorHelp::_update_doc() { linktxt = link.substr(seppos + 2); } - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->append_text("[url=" + link + "]" + linktxt + "[/url]"); class_desc->pop(); class_desc->add_newline(); } + _pop_code_font(); class_desc->pop(); - class_desc->pop(); + class_desc->add_newline(); class_desc->add_newline(); } @@ -829,16 +855,13 @@ void EditorHelp::_update_doc() { if (has_properties) { section_line.push_back(Pair<String, int>(TTR("Properties"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Properties")); - class_desc->pop(); // font size - class_desc->pop(); // font - class_desc->pop(); // color + _pop_title_font(); class_desc->add_newline(); - class_desc->push_font(doc_code_font); + + _push_code_font(); class_desc->push_indent(1); class_desc->push_table(4); class_desc->set_table_column_expand(1, true); @@ -853,9 +876,9 @@ void EditorHelp::_update_doc() { // Property type. class_desc->push_cell(); class_desc->push_paragraph(HORIZONTAL_ALIGNMENT_RIGHT, Control::TEXT_DIRECTION_AUTO, ""); - class_desc->push_font(doc_code_font); + _push_code_font(); _add_type(cd.properties[i].type, cd.properties[i].enumeration); - class_desc->pop(); + _pop_code_font(); class_desc->pop(); class_desc->pop(); // cell @@ -880,8 +903,8 @@ void EditorHelp::_update_doc() { // Property name. class_desc->push_cell(); - class_desc->push_font(doc_code_font); - class_desc->push_color(headline_color); + _push_code_font(); + class_desc->push_color(theme_cache.headline_color); if (describe) { class_desc->push_meta("@member " + cd.properties[i].name); @@ -894,15 +917,15 @@ void EditorHelp::_update_doc() { } class_desc->pop(); - class_desc->pop(); + _pop_code_font(); class_desc->pop(); // cell // Property value. class_desc->push_cell(); - class_desc->push_font(doc_code_font); + _push_code_font(); if (!cd.properties[i].default_value.is_empty()) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); if (cd.properties[i].overridden) { class_desc->add_text(" ["); class_desc->push_meta("@member " + cd.properties[i].overrides + "." + cd.properties[i].name); @@ -914,11 +937,11 @@ void EditorHelp::_update_doc() { } class_desc->pop(); - class_desc->push_color(value_color); + class_desc->push_color(theme_cache.value_color); _add_text(_fix_constant(cd.properties[i].default_value)); class_desc->pop(); - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text("]"); class_desc->pop(); } @@ -930,46 +953,47 @@ void EditorHelp::_update_doc() { EXPERIMENTAL_DOC_TAG; } - class_desc->pop(); + _pop_code_font(); class_desc->pop(); // cell // Property setters and getters. class_desc->push_cell(); - class_desc->push_font(doc_code_font); + _push_code_font(); if (cd.is_script_doc && (!cd.properties[i].setter.is_empty() || !cd.properties[i].getter.is_empty())) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" [" + TTR("property:") + " "); class_desc->pop(); // color if (!cd.properties[i].setter.is_empty()) { - class_desc->push_color(value_color); + class_desc->push_color(theme_cache.value_color); class_desc->add_text("setter"); class_desc->pop(); // color } if (!cd.properties[i].getter.is_empty()) { if (!cd.properties[i].setter.is_empty()) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(", "); class_desc->pop(); // color } - class_desc->push_color(value_color); + class_desc->push_color(theme_cache.value_color); class_desc->add_text("getter"); class_desc->pop(); // color } - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text("]"); class_desc->pop(); // color } - class_desc->pop(); + _pop_code_font(); class_desc->pop(); // cell } class_desc->pop(); // table class_desc->pop(); - class_desc->pop(); // font + _pop_code_font(); + class_desc->add_newline(); class_desc->add_newline(); } @@ -998,10 +1022,10 @@ void EditorHelp::_update_doc() { } section_line.push_back(Pair<String, int>(TTR("Constructors"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Constructors")); + _pop_title_font(); + _update_method_list(cd.constructors); } @@ -1011,10 +1035,10 @@ void EditorHelp::_update_doc() { } section_line.push_back(Pair<String, int>(TTR("Methods"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Methods")); + _pop_title_font(); + _update_method_list(methods); } @@ -1024,23 +1048,19 @@ void EditorHelp::_update_doc() { } section_line.push_back(Pair<String, int>(TTR("Operators"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Operators")); + _pop_title_font(); + _update_method_list(cd.operators); } // Theme properties if (!cd.theme_properties.is_empty()) { section_line.push_back(Pair<String, int>(TTR("Theme Properties"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Theme Properties")); - class_desc->pop(); // font size - class_desc->pop(); // font - class_desc->pop(); // color + _pop_title_font(); class_desc->add_newline(); class_desc->add_newline(); @@ -1062,59 +1082,55 @@ void EditorHelp::_update_doc() { if (theme_data_type != cd.theme_properties[i].data_type) { theme_data_type = cd.theme_properties[i].data_type; - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); if (data_type_names.has(theme_data_type)) { class_desc->add_text(data_type_names[theme_data_type]); } else { class_desc->add_text(""); } - class_desc->pop(); // font size - class_desc->pop(); // font - class_desc->pop(); // color + _pop_title_font(); class_desc->add_newline(); class_desc->add_newline(); } // Theme item header. - class_desc->push_font(doc_code_font); + _push_code_font(); _add_bulletpoint(); // Theme item object type. _add_type(cd.theme_properties[i].type); // Theme item name. - class_desc->push_color(headline_color); + class_desc->push_color(theme_cache.headline_color); class_desc->add_text(" "); _add_text(cd.theme_properties[i].name); class_desc->pop(); // Theme item default value. if (!cd.theme_properties[i].default_value.is_empty()) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" [" + TTR("default:") + " "); class_desc->pop(); - class_desc->push_color(value_color); + class_desc->push_color(theme_cache.value_color); _add_text(_fix_constant(cd.theme_properties[i].default_value)); class_desc->pop(); - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text("]"); class_desc->pop(); } - class_desc->pop(); // monofont + _pop_code_font(); // Theme item description. if (!cd.theme_properties[i].description.strip_edges().is_empty()) { - class_desc->push_font(doc_font); - class_desc->push_color(comment_color); + class_desc->push_color(theme_cache.comment_color); + _push_normal_font(); class_desc->push_indent(1); _add_text(DTR(cd.theme_properties[i].description)); class_desc->pop(); // indent + _pop_normal_font(); class_desc->pop(); // color - class_desc->pop(); // font } class_desc->add_newline(); @@ -1132,13 +1148,9 @@ void EditorHelp::_update_doc() { } section_line.push_back(Pair<String, int>(TTR("Signals"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Signals")); - class_desc->pop(); // font size - class_desc->pop(); // font - class_desc->pop(); // color + _pop_title_font(); class_desc->add_newline(); class_desc->add_newline(); @@ -1148,16 +1160,16 @@ void EditorHelp::_update_doc() { for (int i = 0; i < cd.signals.size(); i++) { signal_line[cd.signals[i].name] = class_desc->get_paragraph_count() - 2; // Gets overridden if description. - class_desc->push_font(doc_code_font); // monofont + _push_code_font(); _add_bulletpoint(); - class_desc->push_color(headline_color); + class_desc->push_color(theme_cache.headline_color); _add_text(cd.signals[i].name); class_desc->pop(); - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text("("); class_desc->pop(); for (int j = 0; j < cd.signals[i].arguments.size(); j++) { - class_desc->push_color(text_color); + class_desc->push_color(theme_cache.text_color); if (j > 0) { class_desc->add_text(", "); } @@ -1166,7 +1178,7 @@ void EditorHelp::_update_doc() { class_desc->add_text(": "); _add_type(cd.signals[i].arguments[j].type); if (!cd.signals[i].arguments[j].default_value.is_empty()) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" = "); class_desc->pop(); _add_text(cd.signals[i].arguments[j].default_value); @@ -1175,7 +1187,7 @@ void EditorHelp::_update_doc() { class_desc->pop(); } - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(")"); if (cd.signals[i].is_deprecated) { @@ -1186,16 +1198,18 @@ void EditorHelp::_update_doc() { } class_desc->pop(); - class_desc->pop(); // end monofont + _pop_code_font(); + if (!cd.signals[i].description.strip_edges().is_empty()) { - class_desc->push_font(doc_font); - class_desc->push_color(comment_color); + class_desc->push_color(theme_cache.comment_color); + _push_normal_font(); class_desc->push_indent(1); _add_text(DTR(cd.signals[i].description)); class_desc->pop(); // indent - class_desc->pop(); - class_desc->pop(); // font + _pop_normal_font(); + class_desc->pop(); // color } + class_desc->add_newline(); class_desc->add_newline(); } @@ -1228,13 +1242,9 @@ void EditorHelp::_update_doc() { // Enums if (enums.size()) { section_line.push_back(Pair<String, int>(TTR("Enumerations"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Enumerations")); - class_desc->pop(); // font size - class_desc->pop(); // font - class_desc->pop(); // color + _pop_title_font(); class_desc->push_indent(1); class_desc->add_newline(); @@ -1242,24 +1252,26 @@ void EditorHelp::_update_doc() { for (KeyValue<String, Vector<DocData::ConstantDoc>> &E : enums) { enum_line[E.key] = class_desc->get_paragraph_count() - 2; - class_desc->push_font(doc_code_font); - class_desc->push_color(title_color); + _push_code_font(); + class_desc->push_color(theme_cache.title_color); if (E.value.size() && E.value[0].is_bitfield) { class_desc->add_text("flags "); } else { class_desc->add_text("enum "); } class_desc->pop(); + String e = E.key; if ((e.get_slice_count(".") > 1) && (e.get_slice(".", 0) == edited_class)) { e = e.get_slice(".", 1); } - class_desc->push_color(headline_color); + class_desc->push_color(theme_cache.headline_color); class_desc->add_text(e); class_desc->pop(); - class_desc->pop(); - class_desc->push_color(symbol_color); + _pop_code_font(); + + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(":"); class_desc->pop(); @@ -1268,13 +1280,14 @@ void EditorHelp::_update_doc() { // Enum description. if (e != "@unnamed_enums" && cd.enums.has(e)) { - class_desc->push_color(text_color); - class_desc->push_font(doc_font); + class_desc->push_color(theme_cache.text_color); + _push_normal_font(); class_desc->push_indent(1); _add_text(cd.enums[e]); class_desc->pop(); + _pop_normal_font(); class_desc->pop(); - class_desc->pop(); + class_desc->add_newline(); class_desc->add_newline(); } @@ -1293,18 +1306,18 @@ void EditorHelp::_update_doc() { // Add the enum constant line to the constant_line map so we can locate it as a constant. constant_line[enum_list[i].name] = class_desc->get_paragraph_count() - 2; - class_desc->push_font(doc_code_font); + _push_code_font(); _add_bulletpoint(); - class_desc->push_color(headline_color); + class_desc->push_color(theme_cache.headline_color); _add_text(enum_list[i].name); class_desc->pop(); - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" = "); class_desc->pop(); - class_desc->push_color(value_color); + class_desc->push_color(theme_cache.value_color); _add_text(_fix_constant(enum_list[i].value)); class_desc->pop(); - class_desc->pop(); + _pop_code_font(); if (enum_list[i].is_deprecated) { DEPRECATED_DOC_TAG; @@ -1317,10 +1330,10 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); if (!enum_list[i].description.strip_edges().is_empty()) { - class_desc->push_font(doc_font); - class_desc->push_color(comment_color); + class_desc->push_color(theme_cache.comment_color); + _push_normal_font(); _add_text(DTR(enum_list[i].description)); - class_desc->pop(); + _pop_normal_font(); class_desc->pop(); if (DTR(enum_list[i].description).find("\n") > 0) { class_desc->add_newline(); @@ -1346,20 +1359,17 @@ void EditorHelp::_update_doc() { // Constants if (constants.size()) { section_line.push_back(Pair<String, int>(TTR("Constants"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Constants")); - class_desc->pop(); // font size - class_desc->pop(); // font - class_desc->pop(); // color + _pop_title_font(); class_desc->push_indent(1); class_desc->add_newline(); for (int i = 0; i < constants.size(); i++) { constant_line[constants[i].name] = class_desc->get_paragraph_count() - 2; - class_desc->push_font(doc_code_font); + + _push_code_font(); if (constants[i].value.begins_with("Color(") && constants[i].value.ends_with(")")) { String stripped = constants[i].value.replace(" ", "").replace("Color(", "").replace(")", ""); @@ -1373,17 +1383,17 @@ void EditorHelp::_update_doc() { _add_bulletpoint(); } - class_desc->push_color(headline_color); + class_desc->push_color(theme_cache.headline_color); _add_text(constants[i].name); class_desc->pop(); - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" = "); class_desc->pop(); - class_desc->push_color(value_color); + class_desc->push_color(theme_cache.value_color); _add_text(_fix_constant(constants[i].value)); class_desc->pop(); - class_desc->pop(); + _pop_code_font(); if (constants[i].is_deprecated) { DEPRECATED_DOC_TAG; @@ -1396,10 +1406,10 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); if (!constants[i].description.strip_edges().is_empty()) { - class_desc->push_font(doc_font); - class_desc->push_color(comment_color); + class_desc->push_color(theme_cache.comment_color); + _push_normal_font(); _add_text(DTR(constants[i].description)); - class_desc->pop(); + _pop_normal_font(); class_desc->pop(); if (DTR(constants[i].description).find("\n") > 0) { class_desc->add_newline(); @@ -1421,13 +1431,9 @@ void EditorHelp::_update_doc() { } section_line.push_back(Pair<String, int>(TTR("Annotations"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Annotations")); - class_desc->pop(); // font size - class_desc->pop(); // font - class_desc->pop(); // color + _pop_title_font(); class_desc->add_newline(); class_desc->add_newline(); @@ -1437,18 +1443,18 @@ void EditorHelp::_update_doc() { for (int i = 0; i < cd.annotations.size(); i++) { annotation_line[cd.annotations[i].name] = class_desc->get_paragraph_count() - 2; // Gets overridden if description. - class_desc->push_font(doc_code_font); // monofont + _push_code_font(); _add_bulletpoint(); - class_desc->push_color(headline_color); + class_desc->push_color(theme_cache.headline_color); _add_text(cd.annotations[i].name); class_desc->pop(); if (cd.annotations[i].arguments.size() > 0) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text("("); class_desc->pop(); for (int j = 0; j < cd.annotations[i].arguments.size(); j++) { - class_desc->push_color(text_color); + class_desc->push_color(theme_cache.text_color); if (j > 0) { class_desc->add_text(", "); } @@ -1457,7 +1463,7 @@ void EditorHelp::_update_doc() { class_desc->add_text(": "); _add_type(cd.annotations[i].arguments[j].type); if (!cd.annotations[i].arguments[j].default_value.is_empty()) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" = "); class_desc->pop(); _add_text(cd.annotations[i].arguments[j].default_value); @@ -1467,43 +1473,43 @@ void EditorHelp::_update_doc() { } if (cd.annotations[i].qualifiers.contains("vararg")) { - class_desc->push_color(text_color); + class_desc->push_color(theme_cache.text_color); if (cd.annotations[i].arguments.size()) { class_desc->add_text(", "); } - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text("..."); class_desc->pop(); class_desc->pop(); } - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(")"); class_desc->pop(); } if (!cd.annotations[i].qualifiers.is_empty()) { - class_desc->push_color(qualifier_color); + class_desc->push_color(theme_cache.qualifier_color); class_desc->add_text(" "); _add_text(cd.annotations[i].qualifiers); class_desc->pop(); } - class_desc->pop(); // end monofont + _pop_code_font(); if (!cd.annotations[i].description.strip_edges().is_empty()) { - class_desc->push_font(doc_font); - class_desc->push_color(comment_color); + class_desc->push_color(theme_cache.comment_color); + _push_normal_font(); class_desc->push_indent(1); _add_text(DTR(cd.annotations[i].description)); class_desc->pop(); // indent - class_desc->pop(); - class_desc->pop(); // font + _pop_normal_font(); + class_desc->pop(); // color } else { class_desc->push_indent(1); class_desc->add_image(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); class_desc->add_text(" "); - class_desc->push_color(comment_color); + class_desc->push_color(theme_cache.comment_color); if (cd.is_script_doc) { class_desc->append_text(TTR("There is currently no description for this annotation.")); } else { @@ -1523,13 +1529,9 @@ void EditorHelp::_update_doc() { // Property descriptions if (has_properties) { section_line.push_back(Pair<String, int>(TTR("Property Descriptions"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Property Descriptions")); - class_desc->pop(); // font size - class_desc->pop(); // font - class_desc->pop(); // color + _pop_title_font(); class_desc->add_newline(); class_desc->add_newline(); @@ -1545,30 +1547,30 @@ void EditorHelp::_update_doc() { class_desc->set_table_column_expand(1, true); class_desc->push_cell(); - class_desc->push_font(doc_code_font); + _push_code_font(); _add_bulletpoint(); _add_type(cd.properties[i].type, cd.properties[i].enumeration); class_desc->add_text(" "); - class_desc->pop(); // font + _pop_code_font(); class_desc->pop(); // cell class_desc->push_cell(); - class_desc->push_font(doc_code_font); - class_desc->push_color(headline_color); + _push_code_font(); + class_desc->push_color(theme_cache.headline_color); _add_text(cd.properties[i].name); class_desc->pop(); // color if (!cd.properties[i].default_value.is_empty()) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" [" + TTR("default:") + " "); class_desc->pop(); // color - class_desc->push_color(value_color); + class_desc->push_color(theme_cache.value_color); _add_text(_fix_constant(cd.properties[i].default_value)); class_desc->pop(); // color - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text("]"); class_desc->pop(); // color } @@ -1581,32 +1583,32 @@ void EditorHelp::_update_doc() { } if (cd.is_script_doc && (!cd.properties[i].setter.is_empty() || !cd.properties[i].getter.is_empty())) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(" [" + TTR("property:") + " "); class_desc->pop(); // color if (!cd.properties[i].setter.is_empty()) { - class_desc->push_color(value_color); + class_desc->push_color(theme_cache.value_color); class_desc->add_text("setter"); class_desc->pop(); // color } if (!cd.properties[i].getter.is_empty()) { if (!cd.properties[i].setter.is_empty()) { - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text(", "); class_desc->pop(); // color } - class_desc->push_color(value_color); + class_desc->push_color(theme_cache.value_color); class_desc->add_text("getter"); class_desc->pop(); // color } - class_desc->push_color(symbol_color); + class_desc->push_color(theme_cache.symbol_color); class_desc->add_text("]"); class_desc->pop(); // color } - class_desc->pop(); // font + _pop_code_font(); class_desc->pop(); // cell // Script doc doesn't have setter, getter. @@ -1621,8 +1623,9 @@ void EditorHelp::_update_doc() { class_desc->pop(); // cell class_desc->push_cell(); - class_desc->push_font(doc_code_font); - class_desc->push_color(text_color); + _push_code_font(); + class_desc->push_color(theme_cache.text_color); + if (method_map[cd.properties[i].setter].arguments.size() > 1) { // Setters with additional arguments are exposed in the method list, so we link them here for quick access. class_desc->push_meta("@method " + cd.properties[i].setter); @@ -1631,12 +1634,14 @@ void EditorHelp::_update_doc() { } else { class_desc->add_text(cd.properties[i].setter + TTR("(value)")); } + class_desc->pop(); // color - class_desc->push_color(comment_color); + class_desc->push_color(theme_cache.comment_color); class_desc->add_text(" setter"); class_desc->pop(); // color - class_desc->pop(); // font + _pop_code_font(); class_desc->pop(); // cell + method_line[cd.properties[i].setter] = property_line[cd.properties[i].name]; } @@ -1645,8 +1650,9 @@ void EditorHelp::_update_doc() { class_desc->pop(); // cell class_desc->push_cell(); - class_desc->push_font(doc_code_font); - class_desc->push_color(text_color); + _push_code_font(); + class_desc->push_color(theme_cache.text_color); + if (method_map[cd.properties[i].getter].arguments.size() > 0) { // Getters with additional arguments are exposed in the method list, so we link them here for quick access. class_desc->push_meta("@method " + cd.properties[i].getter); @@ -1655,12 +1661,14 @@ void EditorHelp::_update_doc() { } else { class_desc->add_text(cd.properties[i].getter + "()"); } - class_desc->pop(); //color - class_desc->push_color(comment_color); + + class_desc->pop(); // color + class_desc->push_color(theme_cache.comment_color); class_desc->add_text(" getter"); - class_desc->pop(); //color - class_desc->pop(); //font - class_desc->pop(); //cell + class_desc->pop(); // color + _pop_code_font(); + class_desc->pop(); // cell + method_line[cd.properties[i].getter] = property_line[cd.properties[i].name]; } } @@ -1670,15 +1678,15 @@ void EditorHelp::_update_doc() { class_desc->add_newline(); class_desc->add_newline(); - class_desc->push_color(text_color); - class_desc->push_font(doc_font); + class_desc->push_color(theme_cache.text_color); + _push_normal_font(); class_desc->push_indent(1); if (!cd.properties[i].description.strip_edges().is_empty()) { _add_text(DTR(cd.properties[i].description)); } else { class_desc->add_image(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); class_desc->add_text(" "); - class_desc->push_color(comment_color); + class_desc->push_color(theme_cache.comment_color); if (cd.is_script_doc) { class_desc->append_text(TTR("There is currently no description for this property.")); } else { @@ -1687,8 +1695,9 @@ void EditorHelp::_update_doc() { class_desc->pop(); } class_desc->pop(); + _pop_normal_font(); class_desc->pop(); - class_desc->pop(); + class_desc->add_newline(); class_desc->add_newline(); class_desc->add_newline(); @@ -1698,30 +1707,30 @@ void EditorHelp::_update_doc() { // Constructor descriptions if (!cd.constructors.is_empty()) { section_line.push_back(Pair<String, int>(TTR("Constructor Descriptions"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Constructor Descriptions")); + _pop_title_font(); + _update_method_descriptions(cd, cd.constructors, "constructor"); } // Method descriptions if (!methods.is_empty()) { section_line.push_back(Pair<String, int>(TTR("Method Descriptions"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Method Descriptions")); + _pop_title_font(); + _update_method_descriptions(cd, methods, "method"); } // Operator descriptions if (!cd.operators.is_empty()) { section_line.push_back(Pair<String, int>(TTR("Operator Descriptions"), class_desc->get_paragraph_count() - 2)); - class_desc->push_color(title_color); - class_desc->push_font(doc_title_font); - class_desc->push_font_size(doc_title_font_size); + _push_title_font(); class_desc->add_text(TTR("Operator Descriptions")); + _pop_title_font(); + _update_method_descriptions(cd, cd.operators, "operator"); } @@ -1816,6 +1825,9 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control Ref<Font> doc_code_font = p_owner_node->get_theme_font(SNAME("doc_source"), SNAME("EditorFonts")); Ref<Font> doc_kbd_font = p_owner_node->get_theme_font(SNAME("doc_keyboard"), SNAME("EditorFonts")); + int doc_code_font_size = p_owner_node->get_theme_font_size(SNAME("doc_source_size"), SNAME("EditorFonts")); + int doc_kbd_font_size = p_owner_node->get_theme_font_size(SNAME("doc_keyboard_size"), SNAME("EditorFonts")); + const Color type_color = p_owner_node->get_theme_color(SNAME("type_color"), SNAME("EditorHelp")); const Color code_color = p_owner_node->get_theme_color(SNAME("code_color"), SNAME("EditorHelp")); const Color kbd_color = p_owner_node->get_theme_color(SNAME("kbd_color"), SNAME("EditorHelp")); @@ -1939,10 +1951,12 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control if (tag != "/img") { p_rt->pop(); if (code_tag) { + p_rt->pop(); // font size // Pop both color and background color. p_rt->pop(); p_rt->pop(); } else if (codeblock_tag) { + p_rt->pop(); // font size // Pop color, cell and table. p_rt->pop(); p_rt->pop(); @@ -1964,6 +1978,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control // Use monospace font to make clickable references // easier to distinguish from inline code and other text. p_rt->push_font(doc_code_font); + p_rt->push_font_size(doc_code_font_size); Color target_color = link_color; if (link_tag == "method") { @@ -1978,7 +1993,9 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control p_rt->add_text(link_target + (link_tag == "method" ? "()" : "")); p_rt->pop(); p_rt->pop(); - p_rt->pop(); + + p_rt->pop(); // font size + p_rt->pop(); // font pos = brk_end + 1; } else if (tag.begins_with("param ")) { @@ -1987,13 +2004,16 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control // Use monospace font with translucent background color to make code easier to distinguish from other text. p_rt->push_font(doc_code_font); + p_rt->push_font_size(doc_code_font_size); + p_rt->push_bgcolor(param_bg_color); p_rt->push_color(code_color); p_rt->add_text(param_name); p_rt->pop(); p_rt->pop(); - p_rt->pop(); + p_rt->pop(); // font size + p_rt->pop(); // font pos = brk_end + 1; } else if (doc->class_list.has(tag)) { @@ -2001,29 +2021,37 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control // Use monospace font to make clickable references // easier to distinguish from inline code and other text. p_rt->push_font(doc_code_font); + p_rt->push_font_size(doc_code_font_size); + p_rt->push_color(type_color); p_rt->push_meta("#" + tag); p_rt->add_text(tag); p_rt->pop(); p_rt->pop(); - p_rt->pop(); + + p_rt->pop(); // font size + p_rt->pop(); // font pos = brk_end + 1; } else if (tag == "b") { // Use bold font. p_rt->push_font(doc_bold_font); + pos = brk_end + 1; tag_stack.push_front(tag); } else if (tag == "i") { // Use italics font. p_rt->push_font(doc_italic_font); + pos = brk_end + 1; tag_stack.push_front(tag); } else if (tag == "code") { // Use monospace font with darkened background color to make code easier to distinguish from other text. p_rt->push_font(doc_code_font); + p_rt->push_font_size(doc_code_font_size); p_rt->push_bgcolor(code_bg_color); p_rt->push_color(code_color.lerp(p_owner_node->get_theme_color(SNAME("error_color"), SNAME("Editor")), 0.6)); + code_tag = true; pos = brk_end + 1; tag_stack.push_front(tag); @@ -2032,22 +2060,28 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control // Use a single-column table with cell row background color instead of `[bgcolor]`. // This makes the background color highlight cover the entire block, rather than individual lines. p_rt->push_font(doc_code_font); + p_rt->push_font_size(doc_code_font_size); + p_rt->push_table(1); p_rt->push_cell(); p_rt->set_cell_row_background_color(code_bg_color, Color(code_bg_color, 0.99)); p_rt->set_cell_padding(Rect2(10 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE)); p_rt->push_color(code_dark_color); + codeblock_tag = true; pos = brk_end + 1; tag_stack.push_front(tag); } else if (tag == "kbd") { // Use keyboard font with custom color and background color. p_rt->push_font(doc_kbd_font); + p_rt->push_font_size(doc_kbd_font_size); p_rt->push_bgcolor(kbd_bg_color); p_rt->push_color(kbd_color); + code_tag = true; // Though not strictly a code tag, logic is similar. pos = brk_end + 1; tag_stack.push_front(tag); + } else if (tag == "center") { // Align to center. p_rt->push_paragraph(HORIZONTAL_ALIGNMENT_CENTER, Control::TEXT_DIRECTION_AUTO, ""); @@ -2081,6 +2115,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control } else if (tag.begins_with("url=")) { String url = tag.substr(4, tag.length()); p_rt->push_meta(url); + pos = brk_end + 1; tag_stack.push_front("url"); } else if (tag == "img") { @@ -2101,6 +2136,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control String col = tag.substr(6, tag.length()); Color color = Color::from_string(col, Color()); p_rt->push_color(color); + pos = brk_end + 1; tag_stack.push_front("color"); @@ -2163,6 +2199,11 @@ void EditorHelp::_toggle_scripts_pressed() { void EditorHelp::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_POSTINITIALIZE: { + // Requires theme to be up to date. + _class_desc_resized(false); + } break; + case NOTIFICATION_READY: case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { _wait_for_thread(); @@ -2275,13 +2316,11 @@ EditorHelp::EditorHelp() { add_child(class_desc); class_desc->set_threaded(true); class_desc->set_v_size_flags(SIZE_EXPAND_FILL); - class_desc->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4)); class_desc->connect("finished", callable_mp(this, &EditorHelp::_class_desc_finished)); class_desc->connect("meta_clicked", callable_mp(this, &EditorHelp::_class_desc_select)); class_desc->connect("gui_input", callable_mp(this, &EditorHelp::_class_desc_input)); class_desc->connect("resized", callable_mp(this, &EditorHelp::_class_desc_resized).bind(false)); - _class_desc_resized(false); // Added second so it opens at the bottom so it won't offset the entire widget. find_bar = memnew(FindBar); @@ -2431,7 +2470,6 @@ void FindBar::popup_search() { void FindBar::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons"))); find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons"))); diff --git a/editor/editor_help.h b/editor/editor_help.h index 81cd6d6674..b2ffe3bc29 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -125,25 +125,33 @@ class EditorHelp : public VBoxContainer { String base_path; - Color text_color; - Color title_color; - Color headline_color; - Color comment_color; - Color symbol_color; - Color value_color; - Color qualifier_color; - Color type_color; - - Ref<Font> doc_font; - Ref<Font> doc_bold_font; - Ref<Font> doc_title_font; - Ref<Font> doc_code_font; - - int doc_title_font_size; + struct ThemeCache { + Ref<StyleBox> background_style; + + Color text_color; + Color title_color; + Color headline_color; + Color comment_color; + Color symbol_color; + Color value_color; + Color qualifier_color; + Color type_color; + + Ref<Font> doc_font; + Ref<Font> doc_bold_font; + Ref<Font> doc_italic_font; + Ref<Font> doc_title_font; + Ref<Font> doc_code_font; + Ref<Font> doc_kbd_font; + + int doc_font_size = 0; + int doc_title_font_size = 0; + int doc_code_font_size = 0; + int doc_kbd_font_size = 0; + } theme_cache; int scroll_to = -1; - void _update_theme(); void _help_callback(const String &p_topic); void _add_text(const String &p_bbcode); @@ -156,6 +164,13 @@ class EditorHelp : public VBoxContainer { void _add_bulletpoint(); + void _push_normal_font(); + void _pop_normal_font(); + void _push_title_font(); + void _pop_title_font(); + void _push_code_font(); + void _pop_code_font(); + void _class_desc_finished(); void _class_list_select(const String &p_select); void _class_desc_select(const String &p_select); @@ -181,6 +196,8 @@ class EditorHelp : public VBoxContainer { static void _gen_doc_thread(void *p_udata); protected: + virtual void _update_theme_item_cache() override; + void _notification(int p_what); static void _bind_methods(); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 275e47e370..dd912eac42 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -2566,12 +2566,13 @@ bool EditorInspector::_is_property_disabled_by_feature_profile(const StringName } void EditorInspector::update_tree() { - //to update properly if all is refreshed + // Store currently selected and focused elements to restore after the update. + // TODO: Can be useful to store more context for the focusable, such as the caret position in LineEdit. StringName current_selected = property_selected; int current_focusable = -1; if (property_focusable != -1) { - //check focusable is really focusable + // Check that focusable is actually focusable. bool restore_focus = false; Control *focused = get_viewport() ? get_viewport()->gui_get_focus_owner() : nullptr; if (focused) { @@ -2579,8 +2580,8 @@ void EditorInspector::update_tree() { while (parent) { EditorInspector *inspector = Object::cast_to<EditorInspector>(parent); if (inspector) { - restore_focus = inspector == this; //may be owned by another inspector - break; //exit after the first inspector is found, since there may be nested ones + restore_focus = inspector == this; // May be owned by another inspector. + break; // Exit after the first inspector is found, since there may be nested ones. } parent = parent->get_parent(); } @@ -2591,7 +2592,9 @@ void EditorInspector::update_tree() { } } - _clear(); + // Only hide plugins if we are not editing any object. + // This should be handled outside of the update_tree call anyway (see EditorInspector::edit), but might as well keep it safe. + _clear(!object); if (!object) { return; @@ -3301,17 +3304,19 @@ void EditorInspector::update_property(const String &p_prop) { } } -void EditorInspector::_clear() { +void EditorInspector::_clear(bool p_hide_plugins) { while (main_vbox->get_child_count()) { memdelete(main_vbox->get_child(0)); } + property_selected = StringName(); property_focusable = -1; editor_property_map.clear(); sections.clear(); pending.clear(); restart_request_props.clear(); - if (_is_main_editor_inspector()) { + + if (p_hide_plugins && _is_main_editor_inspector()) { EditorNode::get_singleton()->hide_unused_editors(this); } } @@ -3405,7 +3410,6 @@ void EditorInspector::register_text_enter(Node *p_line_edit) { } void EditorInspector::_filter_changed(const String &p_text) { - _clear(); update_tree(); } diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index eab495ef3d..37ff2e9b52 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -451,7 +451,7 @@ class EditorInspector : public ScrollContainer { List<EditorInspectorSection *> sections; HashSet<StringName> pending; - void _clear(); + void _clear(bool p_hide_plugins = true); Object *object = nullptr; // diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 3adebb2f8e..a0e876315c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -691,10 +691,11 @@ void EditorNode::_notification(int p_what) { bool theme_changed = EditorSettings::get_singleton()->check_changed_settings_in_group("interface/theme") || - EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") || EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/font") || EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/main_font") || EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor/code_font") || + EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/theme") || + EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor/help/help") || EditorSettings::get_singleton()->check_changed_settings_in_group("filesystem/file_dialog/thumbnail_size"); if (theme_changed) { @@ -3685,7 +3686,7 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) { Node *editor_node = SceneTreeDock::get_singleton()->get_tree_editor()->get_selected(); editor_node = editor_node == nullptr ? get_edited_scene() : editor_node; - if (Object::cast_to<Node2D>(editor_node) || Object::cast_to<Control>(editor_node)) { + if (Object::cast_to<CanvasItem>(editor_node)) { editor_select(EDITOR_2D); } else if (Object::cast_to<Node3D>(editor_node)) { editor_select(EDITOR_3D); diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 24cfa7ad7b..80ebd32295 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -1009,6 +1009,14 @@ void EditorPropertyDictionary::update_property() { prop = memnew(EditorPropertyRID); } break; + case Variant::SIGNAL: { + prop = memnew(EditorPropertySignal); + + } break; + case Variant::CALLABLE: { + prop = memnew(EditorPropertyCallable); + + } break; case Variant::OBJECT: { if (Object::cast_to<EncodedObjectAsID>(value)) { EditorPropertyObjectID *editor = memnew(EditorPropertyObjectID); diff --git a/editor/editor_property_name_processor.cpp b/editor/editor_property_name_processor.cpp index a183e62618..b62615adcc 100644 --- a/editor/editor_property_name_processor.cpp +++ b/editor/editor_property_name_processor.cpp @@ -137,6 +137,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["bptc"] = "BPTC"; capitalize_string_remaps["bvh"] = "BVH"; capitalize_string_remaps["ca"] = "CA"; + capitalize_string_remaps["ccdik"] = "CCDIK"; capitalize_string_remaps["cd"] = "CD"; capitalize_string_remaps["cpu"] = "CPU"; capitalize_string_remaps["csg"] = "CSG"; @@ -148,6 +149,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["erp"] = "ERP"; capitalize_string_remaps["etc"] = "ETC"; capitalize_string_remaps["etc2"] = "ETC2"; + capitalize_string_remaps["fabrik"] = "FABRIK"; capitalize_string_remaps["fbx"] = "FBX"; capitalize_string_remaps["fbx2gltf"] = "FBX2glTF"; capitalize_string_remaps["fft"] = "FFT"; @@ -165,6 +167,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["glb"] = "GLB"; capitalize_string_remaps["gles2"] = "GLES2"; capitalize_string_remaps["gles3"] = "GLES3"; + capitalize_string_remaps["gltf"] = "glTF"; capitalize_string_remaps["gpu"] = "GPU"; capitalize_string_remaps["gui"] = "GUI"; capitalize_string_remaps["guid"] = "GUID"; @@ -196,6 +199,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["lcd"] = "LCD"; capitalize_string_remaps["ldr"] = "LDR"; capitalize_string_remaps["lod"] = "LOD"; + capitalize_string_remaps["lods"] = "LODs"; capitalize_string_remaps["lowpass"] = "Low-pass"; capitalize_string_remaps["macos"] = "macOS"; capitalize_string_remaps["mb"] = "(MB)"; // Unit. diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 8eb2551843..dd84f3b9e1 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -586,9 +586,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { // Help _initial_set("text_editor/help/show_help_index", true); - EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_font_size", 15, "8,48,1") - EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_source_font_size", 14, "8,48,1") - EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_title_font_size", 23, "8,48,1") + EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_font_size", 16, "8,48,1") + EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_source_font_size", 15, "8,48,1") + EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "text_editor/help/help_title_font_size", 23, "8,64,1") EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "text_editor/help/class_reference_examples", 0, "GDScript,C#,GDScript and C#") /* Editors */ diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 2981862291..cf8555d07d 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -232,8 +232,8 @@ void MeshLibraryEditor::_menu_cbk(int p_option) { } break; case MENU_OPTION_REMOVE_ITEM: { String p = InspectorDock::get_inspector_singleton()->get_selected_path(); - if (p.begins_with("/MeshLibrary/item") && p.get_slice_count("/") >= 3) { - to_erase = p.get_slice("/", 3).to_int(); + if (p.begins_with("item") && p.get_slice_count("/") >= 2) { + to_erase = p.get_slice("/", 1).to_int(); cd_remove->set_text(vformat(TTR("Remove item %d?"), to_erase)); cd_remove->popup_centered(Size2(300, 60)); } diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 6b4e7184d9..9fe1d8af99 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1362,11 +1362,36 @@ void ScriptTextEditor::_edit_option(int p_op) { code_editor->remove_all_bookmarks(); } break; case DEBUG_TOGGLE_BREAKPOINT: { - for (int caret_idx = 0; caret_idx < tx->get_caret_count(); caret_idx++) { - int line = tx->get_caret_line(caret_idx); - bool dobreak = !tx->is_line_breakpointed(line); - tx->set_line_as_breakpoint(line, dobreak); - EditorDebuggerNode::get_singleton()->set_breakpoint(script->get_path(), line + 1, dobreak); + Vector<int> caret_edit_order = tx->get_caret_index_edit_order(); + caret_edit_order.reverse(); + int last_line = -1; + for (const int &c : caret_edit_order) { + int from = tx->has_selection(c) ? tx->get_selection_from_line(c) : tx->get_caret_line(c); + from += from == last_line ? 1 : 0; + int to = tx->has_selection(c) ? tx->get_selection_to_line(c) : tx->get_caret_line(c); + if (to < from) { + continue; + } + // Check first if there's any lines with breakpoints in the selection. + bool selection_has_breakpoints = false; + for (int line = from; line <= to; line++) { + if (tx->is_line_breakpointed(line)) { + selection_has_breakpoints = true; + break; + } + } + + // Set breakpoint on caret or remove all bookmarks from the selection. + if (!selection_has_breakpoints) { + if (tx->get_caret_line(c) != last_line) { + tx->set_line_as_breakpoint(tx->get_caret_line(c), true); + } + } else { + for (int line = from; line <= to; line++) { + tx->set_line_as_breakpoint(line, false); + } + } + last_line = to; } } break; case DEBUG_REMOVE_ALL_BREAKPOINTS: { @@ -1820,30 +1845,72 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) { color_position.x = row; color_position.y = col; - int begin = 0; - int end = 0; - bool valid = false; + int begin = -1; + int end = -1; + enum EXPRESSION_PATTERNS { + NOT_PARSED, + RGBA_PARAMETER, // Color(float,float,float) or Color(float,float,float,float) + COLOR_NAME, // Color.COLOR_NAME + } expression_pattern = NOT_PARSED; + for (int i = col; i < line.length(); i++) { if (line[i] == '(') { + if (expression_pattern == NOT_PARSED) { + begin = i; + expression_pattern = RGBA_PARAMETER; + } else { + // Method call or '(' appearing twice. + expression_pattern = NOT_PARSED; + + break; + } + } else if (expression_pattern == RGBA_PARAMETER && line[i] == ')' && end < 0) { + end = i + 1; + + break; + } else if (expression_pattern == NOT_PARSED && line[i] == '.') { begin = i; + expression_pattern = COLOR_NAME; + } else if (expression_pattern == COLOR_NAME && end < 0 && (line[i] == ' ' || line[i] == '\t')) { + // Including '.' and spaces. continue; - } else if (line[i] == ')') { - end = i + 1; - valid = true; + } else if (expression_pattern == COLOR_NAME && !(line[i] == '_' || ('A' <= line[i] && line[i] <= 'Z'))) { + end = i; + break; } } - if (valid) { - color_args = line.substr(begin, end - begin); - String stripped = color_args.replace(" ", "").replace("(", "").replace(")", ""); - PackedFloat64Array color = stripped.split_floats(","); - if (color.size() > 2) { - float alpha = color.size() > 3 ? color[3] : 1.0f; - color_picker->set_pick_color(Color(color[0], color[1], color[2], alpha)); - } + + switch (expression_pattern) { + case RGBA_PARAMETER: { + color_args = line.substr(begin, end - begin); + String stripped = color_args.replace(" ", "").replace("\t", "").replace("(", "").replace(")", ""); + PackedFloat64Array color = stripped.split_floats(","); + if (color.size() > 2) { + float alpha = color.size() > 3 ? color[3] : 1.0f; + color_picker->set_pick_color(Color(color[0], color[1], color[2], alpha)); + } + } break; + case COLOR_NAME: { + if (end < 0) { + end = line.length(); + } + color_args = line.substr(begin, end - begin); + const String color_name = color_args.replace(" ", "").replace("\t", "").replace(".", ""); + const int color_index = Color::find_named_color(color_name); + if (0 <= color_index) { + const Color color_constant = Color::get_named_color(color_index); + color_picker->set_pick_color(color_constant); + } else { + has_color = false; + } + } break; + default: + has_color = false; + break; + } + if (has_color) { color_panel->set_position(get_screen_position() + local_pos); - } else { - has_color = false; } } _make_context_menu(tx->has_selection(), has_color, foldable, open_docs, goto_definition, local_pos); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 7f43de3240..120cfbdefb 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -1276,8 +1276,6 @@ int Skeleton3DGizmoPlugin::subgizmos_intersect_ray(const EditorNode3DGizmo *p_gi } if (closest_idx >= 0) { - WARN_PRINT("ray:"); - WARN_PRINT(itos(closest_idx)); se->select_bone(closest_idx); return closest_idx; } diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 14ff59b442..073adb467a 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -3705,82 +3705,13 @@ ThemeEditor::ThemeEditor() { void ThemeEditorPlugin::edit(Object *p_node) { if (Object::cast_to<Theme>(p_node)) { theme_editor->edit(Object::cast_to<Theme>(p_node)); - } else if (Object::cast_to<Font>(p_node) || Object::cast_to<StyleBox>(p_node) || Object::cast_to<Texture2D>(p_node)) { - // Do nothing, keep editing the existing theme. } else { theme_editor->edit(Ref<Theme>()); } } bool ThemeEditorPlugin::handles(Object *p_node) const { - if (Object::cast_to<Theme>(p_node)) { - return true; - } - - Ref<Theme> edited_theme = theme_editor->get_edited_theme(); - if (edited_theme.is_null()) { - return false; - } - - // If we are editing a theme already and this particular resource happens to belong to it, - // then we just keep editing it, despite not being able to directly handle it. - // This only goes one layer deep, but if required this can be extended to support, say, Font inside of Font. - bool belongs_to_theme = false; - - if (Object::cast_to<Font>(p_node)) { - Ref<Font> font_item = Object::cast_to<Font>(p_node); - List<StringName> types; - List<StringName> names; - - edited_theme->get_font_type_list(&types); - for (const StringName &E : types) { - names.clear(); - edited_theme->get_font_list(E, &names); - - for (const StringName &F : names) { - if (font_item == edited_theme->get_font(F, E)) { - belongs_to_theme = true; - break; - } - } - } - } else if (Object::cast_to<StyleBox>(p_node)) { - Ref<StyleBox> stylebox_item = Object::cast_to<StyleBox>(p_node); - List<StringName> types; - List<StringName> names; - - edited_theme->get_stylebox_type_list(&types); - for (const StringName &E : types) { - names.clear(); - edited_theme->get_stylebox_list(E, &names); - - for (const StringName &F : names) { - if (stylebox_item == edited_theme->get_stylebox(F, E)) { - belongs_to_theme = true; - break; - } - } - } - } else if (Object::cast_to<Texture2D>(p_node)) { - Ref<Texture2D> icon_item = Object::cast_to<Texture2D>(p_node); - List<StringName> types; - List<StringName> names; - - edited_theme->get_icon_type_list(&types); - for (const StringName &E : types) { - names.clear(); - edited_theme->get_icon_list(E, &names); - - for (const StringName &F : names) { - if (icon_item == edited_theme->get_icon(F, E)) { - belongs_to_theme = true; - break; - } - } - } - } - - return belongs_to_theme; + return Object::cast_to<Theme>(p_node) != nullptr; } void ThemeEditorPlugin::make_visible(bool p_visible) { diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index 706466a974..d1f3c3902a 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -32,1781 +32,19 @@ #ifndef DISABLE_DEPRECATED -const int ERROR_CODE = 77; - #include "modules/modules_enabled.gen.h" // For regex. #ifdef MODULE_REGEX_ENABLED -#include "modules/regex/regex.h" - +#include "core/error/error_macros.h" #include "core/io/dir_access.h" +#include "core/io/file_access.h" +#include "core/object/ref_counted.h" #include "core/os/time.h" #include "core/templates/hash_map.h" #include "core/templates/list.h" -#include "core/templates/local_vector.h" - -const char *ProjectConverter3To4::enum_renames[][2] = { - //// constants - { "TYPE_COLOR_ARRAY", "TYPE_PACKED_COLOR_ARRAY" }, - { "TYPE_FLOAT64_ARRAY", "TYPE_PACKED_FLOAT64_ARRAY" }, - { "TYPE_INT64_ARRAY", "TYPE_PACKED_INT64_ARRAY" }, - { "TYPE_INT_ARRAY", "TYPE_PACKED_INT32_ARRAY" }, - { "TYPE_QUAT", "TYPE_QUATERNION" }, - { "TYPE_RAW_ARRAY", "TYPE_PACKED_BYTE_ARRAY" }, - { "TYPE_REAL", "TYPE_FLOAT" }, - { "TYPE_REAL_ARRAY", "TYPE_PACKED_FLOAT32_ARRAY" }, - { "TYPE_STRING_ARRAY", "TYPE_PACKED_STRING_ARRAY" }, - { "TYPE_TRANSFORM", "TYPE_TRANSFORM3D" }, - { "TYPE_VECTOR2_ARRAY", "TYPE_PACKED_VECTOR2_ARRAY" }, - { "TYPE_VECTOR3_ARRAY", "TYPE_PACKED_VECTOR3_ARRAY" }, - - // {"FLAG_MAX", "PARTICLE_FLAG_MAX"}, // CPUParticles2D - used in more classes - { "ALIGN_BEGIN", "ALIGNMENT_BEGIN" }, //AspectRatioContainer - { "ALIGN_CENTER", "ALIGNMENT_CENTER" }, //AspectRatioContainer - { "ALIGN_END", "ALIGNMENT_END" }, //AspectRatioContainer - { "ARRAY_COMPRESS_BASE", "ARRAY_COMPRESS_FLAGS_BASE" }, // Mesh - { "ARVR_AR", "XR_AR" }, // XRInterface - { "ARVR_EXCESSIVE_MOTION", "XR_EXCESSIVE_MOTION" }, // XRInterface - { "ARVR_EXTERNAL", "XR_EXTERNAL" }, // XRInterface - { "ARVR_INSUFFICIENT_FEATURES", "XR_INSUFFICIENT_FEATURES" }, // XRInterface - { "ARVR_MONO", "XR_MONO" }, // XRInterface - { "ARVR_NONE", "XR_NONE" }, // XRInterface - { "ARVR_NORMAL_TRACKING", "XR_NORMAL_TRACKING" }, // XRInterface - { "ARVR_NOT_TRACKING", "XR_NOT_TRACKING" }, // XRInterface - { "ARVR_STEREO", "XR_STEREO" }, // XRInterface - { "ARVR_UNKNOWN_TRACKING", "XR_UNKNOWN_TRACKING" }, // XRInterface - { "BAKE_ERROR_INVALID_MESH", "BAKE_ERROR_MESHES_INVALID" }, // LightmapGI - { "BODY_MODE_CHARACTER", "BODY_MODE_RIGID_LINEAR" }, // PhysicsServer - { "BUTTON_LEFT", "MOUSE_BUTTON_LEFT" }, // Globals - { "BUTTON_MASK_LEFT", "MOUSE_BUTTON_MASK_LEFT" }, // Globals - { "BUTTON_MASK_MIDDLE", "MOUSE_BUTTON_MASK_MIDDLE" }, // Globals - { "BUTTON_MASK_RIGHT", "MOUSE_BUTTON_MASK_RIGHT" }, // Globals - { "BUTTON_MASK_XBUTTON1", "MOUSE_BUTTON_MASK_XBUTTON1" }, // Globals - { "BUTTON_MASK_XBUTTON2", "MOUSE_BUTTON_MASK_XBUTTON2" }, // Globals - { "BUTTON_MIDDLE", "MOUSE_BUTTON_MIDDLE" }, // Globals - { "BUTTON_RIGHT", "MOUSE_BUTTON_RIGHT" }, // Globals - { "BUTTON_WHEEL_DOWN", "MOUSE_BUTTON_WHEEL_DOWN" }, // Globals - { "BUTTON_WHEEL_LEFT", "MOUSE_BUTTON_WHEEL_LEFT" }, // Globals - { "BUTTON_WHEEL_RIGHT", "MOUSE_BUTTON_WHEEL_RIGHT" }, // Globals - { "BUTTON_WHEEL_UP", "MOUSE_BUTTON_WHEEL_UP" }, // Globals - { "BUTTON_XBUTTON1", "MOUSE_BUTTON_XBUTTON1" }, // Globals - { "BUTTON_XBUTTON2", "MOUSE_BUTTON_XBUTTON2" }, // Globals - { "CLEAR_MODE_ONLY_NEXT_FRAME", "CLEAR_MODE_ONCE" }, // SubViewport - { "COMPRESS_PVRTC4", "COMPRESS_PVRTC1_4" }, // Image - { "CONNECT_ONESHOT", "CONNECT_ONE_SHOT" }, // Object - { "CONTAINER_PROPERTY_EDITOR_BOTTOM", "CONTAINER_INSPECTOR_BOTTOM" }, // EditorPlugin - { "CUBEMAP_BACK", "CUBEMAP_LAYER_BACK" }, // RenderingServer - { "CUBEMAP_BOTTOM", "CUBEMAP_LAYER_BOTTOM" }, // RenderingServer - { "CUBEMAP_FRONT", "CUBEMAP_LAYER_FRONT" }, // RenderingServer - { "CUBEMAP_LEFT", "CUBEMAP_LAYER_LEFT" }, // RenderingServer - { "CUBEMAP_RIGHT", "CUBEMAP_LAYER_RIGHT" }, // RenderingServer - { "CUBEMAP_TOP", "CUBEMAP_LAYER_TOP" }, // RenderingServer - { "DAMPED_STRING_DAMPING", "DAMPED_SPRING_DAMPING" }, // PhysicsServer2D - { "DAMPED_STRING_REST_LENGTH", "DAMPED_SPRING_REST_LENGTH" }, // PhysicsServer2D - { "DAMPED_STRING_STIFFNESS", "DAMPED_SPRING_STIFFNESS" }, // PhysicsServer2D - { "FLAG_ALIGN_Y_TO_VELOCITY", "PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY" }, // CPUParticles2D - { "FLAG_DISABLE_Z", "PARTICLE_FLAG_DISABLE_Z" }, // CPUParticles2D - { "FLAG_ROTATE_Y", "PARTICLE_FLAG_ROTATE_Y" }, // CPUParticles2D - { "FLAG_USE_BAKED_LIGHT", "GI_MODE_BAKED" }, // GeometryInstance3D - { "FORMAT_PVRTC2", "FORMAT_PVRTC1_2" }, // Image - { "FORMAT_PVRTC2A", "FORMAT_PVRTC1_2A" }, // Image - { "FORMAT_PVRTC4", "FORMAT_PVRTC1_4" }, // Image - { "FORMAT_PVRTC4A", "FORMAT_PVRTC1_4A" }, // Image - { "FUNC_FRAC", "FUNC_FRACT" }, // VisualShaderNodeVectorFunc - { "INSTANCE_LIGHTMAP_CAPTURE", "INSTANCE_LIGHTMAP" }, // RenderingServer - { "JOINT_6DOF", "JOINT_TYPE_6DOF" }, // PhysicsServer3D - { "JOINT_CONE_TWIST", "JOINT_TYPE_CONE_TWIST" }, // PhysicsServer3D - { "JOINT_DAMPED_SPRING", "JOINT_TYPE_DAMPED_SPRING" }, // PhysicsServer2D - { "JOINT_GROOVE", "JOINT_TYPE_GROOVE" }, // PhysicsServer2D - { "JOINT_HINGE", "JOINT_TYPE_HINGE" }, // PhysicsServer3D - { "JOINT_PIN", "JOINT_TYPE_PIN" }, // PhysicsServer2D - { "JOINT_SLIDER", "JOINT_TYPE_SLIDER" }, // PhysicsServer3D - { "KEY_CONTROL", "KEY_CTRL" }, // Globals - { "LOOP_PING_PONG", "LOOP_PINGPONG" }, // AudioStreamWAV - { "MODE_KINEMATIC", "FREEZE_MODE_KINEMATIC" }, // RigidBody - { "MODE_OPEN_ANY", "FILE_MODE_OPEN_ANY" }, // FileDialog - { "MODE_OPEN_DIR", "FILE_MODE_OPEN_DIR" }, // FileDialog - { "MODE_OPEN_FILE", "FILE_MODE_OPEN_FILE" }, // FileDialog - { "MODE_OPEN_FILES", "FILE_MODE_OPEN_FILES" }, // FileDialog - { "MODE_SAVE_FILE", "FILE_MODE_SAVE_FILE" }, // FileDialog - { "MODE_STATIC", "FREEZE_MODE_STATIC" }, // RigidBody - { "NOTIFICATION_APP_PAUSED", "NOTIFICATION_APPLICATION_PAUSED" }, // MainLoop - { "NOTIFICATION_APP_RESUMED", "NOTIFICATION_APPLICATION_RESUMED" }, // MainLoop - { "NOTIFICATION_INSTANCED", "NOTIFICATION_SCENE_INSTANTIATED" }, // Node - { "NOTIFICATION_PATH_CHANGED", "NOTIFICATION_PATH_RENAMED" }, //Node - { "NOTIFICATION_WM_FOCUS_IN", "NOTIFICATION_APPLICATION_FOCUS_IN" }, // MainLoop - { "NOTIFICATION_WM_FOCUS_OUT", "NOTIFICATION_APPLICATION_FOCUS_OUT" }, // MainLoop - { "NOTIFICATION_WM_UNFOCUS_REQUEST", "NOTIFICATION_WM_WINDOW_FOCUS_OUT" }, //Node - { "PAUSE_MODE_INHERIT", "PROCESS_MODE_INHERIT" }, // Node - { "PAUSE_MODE_PROCESS", "PROCESS_MODE_ALWAYS" }, // Node - { "PAUSE_MODE_STOP", "PROCESS_MODE_PAUSABLE" }, // Node - { "RENDER_DRAW_CALLS_IN_FRAME", "RENDER_TOTAL_DRAW_CALLS_IN_FRAME" }, // Performance - { "RENDER_OBJECTS_IN_FRAME", "RENDER_TOTAL_OBJECTS_IN_FRAME" }, // Performance - { "SIDE_BOTTOM", "MARGIN_BOTTOM" }, // Globals - { "SIDE_LEFT", "MARGIN_LEFT" }, // Globals - { "SIDE_RIGHT", "MARGIN_RIGHT" }, // Globals - { "SIDE_TOP", "MARGIN_TOP" }, // Globals - { "TEXTURE_TYPE_2D_ARRAY", "TEXTURE_LAYERED_2D_ARRAY" }, // RenderingServer - { "TEXTURE_TYPE_CUBEMAP", "TEXTURE_LAYERED_CUBEMAP_ARRAY" }, // RenderingServer - { "TRACKER_LEFT_HAND", "TRACKER_HAND_LEFT" }, // XRPositionalTracker - { "TRACKER_RIGHT_HAND", "TRACKER_HAND_RIGHT" }, // XRPositionalTracker - { "TYPE_NORMALMAP", "TYPE_NORMAL_MAP" }, // VisualShaderNodeCubemap - - /// enums - { "AlignMode", "AlignmentMode" }, //AspectRatioContainer - { "AnimationProcessMode", "AnimationProcessCallback" }, // AnimationTree, AnimationPlayer - { "Camera2DProcessMode", "Camera2DProcessCallback" }, // Camera2D - { "CubeMapSide", "CubeMapLayer" }, // RenderingServer - { "DampedStringParam", "DampedSpringParam" }, // PhysicsServer2D - { "FFT_Size", "FFTSize" }, // AudioEffectPitchShift,AudioEffectSpectrumAnalyzer - { "PauseMode", "ProcessMode" }, // Node - { "TimerProcessMode", "TimerProcessCallback" }, // Timer - { "Tracking_status", "TrackingStatus" }, // XRInterface - { nullptr, nullptr }, -}; - -const char *ProjectConverter3To4::gdscript_function_renames[][2] = { - // { "_set_name", "get_tracker_name"}, // XRPositionalTracker - CameraFeed use this - // { "_unhandled_input", "_unhandled_key_input"}, // BaseButton, ViewportContainer broke Node, FileDialog,SubViewportContainer - // { "create_gizmo", "_create_gizmo"}, // EditorNode3DGizmoPlugin - may be used - // { "get_dependencies", "_get_dependencies" }, // ResourceFormatLoader broke ResourceLoader - // { "get_extents", "get_size" }, // BoxShape, RectangleShape broke Decal, VoxelGI, GPUParticlesCollisionBox, GPUParticlesCollisionSDF, GPUParticlesCollisionHeightField, GPUParticlesAttractorBox, GPUParticlesAttractorVectorField, FogVolume - // { "get_h_offset", "get_drag_horizontal_offset"}, // Camera2D, broke PathFollow, Camera - // { "get_mode", "get_file_mode"}, // FileDialog broke Panel, Shader, CSGPolygon, Tilemap - // { "get_motion", "get_travel"}, // PhysicsTestMotionResult2D broke ParalaxLayer - // { "get_name", "get_tracker_name"}, // XRPositionalTracker broke OS, Node - // { "get_network_connected_peers", "get_peers"}, // MultiplayerAPI broke SceneTree - // { "get_network_peer", "has_multiplayer_peer"}, // MultiplayerAPI broke SceneTree - // { "get_network_unique_id", "get_unique_id"}, // MultiplayerAPI broke SceneTree - // { "get_offset", "get_position_offset" }, // GraphNode broke Gradient - // { "get_peer_port", "get_peer" }, // ENetMultiplayerPeer broke WebSocketServer - // { "get_process_mode", "get_process_callback" }, // ClippedCamera3D broke Node, Sky - // { "get_render_info", "get_rendering_info" }, // RenderingServer broke Viewport - // { "get_type", "get_tracker_type"}, // XRPositionalTracker broke GLTFAccessor, GLTFLight - // { "get_v_offset", "get_drag_vertical_offset"}, // Camera2D, broke PathFollow, Camera - // { "has_network_peer", "has_multiplayer_peer"}, // MultiplayerAPI broke SceneTree - // { "instance", "instantiate" }, // PackedScene, ClassDB - Broke FileSystemDock signal and also tscn files - [instance=ExtResource( 17 )] - this is implemented as custom rule - // { "is_listening", "is_bound"}, // PacketPeerUDP broke TCPServer, UDPServer - // { "is_refusing_new_network_connections", "is_refusing_new_connections"}, // MultiplayerAPI broke SceneTree - // { "is_valid", "has_valid_event" }, // Shortcut broke e.g. Callable - // { "listen", "bound"}, // PacketPeerUDP broke TCPServer, UDPServer - // { "load", "_load"}, // ResourceFormatLoader broke ConfigFile, Image, StreamTexture2D - // { "make_current", "set_current" }, // Camera2D broke Camera3D, Listener2D - // { "process", "_process" }, // AnimationNode - This word is commonly used - // { "save", "_save"}, // ResourceFormatLoader broke ConfigFile, Image, StreamTexture2D - // { "set_autowrap", "set_autowrap_mode" }, // AcceptDialog broke Label - Cyclic Rename - // { "set_color", "surface_set_color"}, // ImmediateMesh broke Light2D, Theme, SurfaceTool - // { "set_event", "set_shortcut" }, // BaseButton - Cyclic Rename - // { "set_extents", "set_size"}, // BoxShape, RectangleShape broke ReflectionProbe - // { "set_flag", "set_particle_flag"}, // ParticleProcessMaterial broke Window, HingeJoint3D - // { "set_h_offset", "set_drag_horizontal_offset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D - // { "set_margin", "set_offset" }, // Control broke Shape3D, AtlasTexture - // { "set_mode", "set_mode_file_mode" }, // FileDialog broke Panel, Shader, CSGPolygon, Tilemap - // { "set_normal", "surface_set_normal"}, // ImmediateGeometry broke SurfaceTool, WorldMarginShape2D - // { "set_offset", "set_progress" }, // PathFollow2D, PathFollow3D - Too common - // { "set_process_mode", "set_process_callback" }, // AnimationTree broke Node, Tween, Sky - // { "set_refuse_new_network_connections", "set_refuse_new_connections"}, // MultiplayerAPI broke SceneTree - // { "set_tooltip", "set_tooltip_text" }, // Control, breaks TreeItem, at least for now. - // { "set_uv", "surface_set_uv" }, // ImmediateMesh broke Polygon2D - // { "set_v_offset", "set_drag_vertical_offset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D - // {"get_points","get_points_id"},// Astar, broke Line2D, Convexpolygonshape - // {"get_v_scroll","get_v_scroll_bar"},//ItemList, broke TextView - // { "get_stylebox", "get_theme_stylebox" }, // Control - Will rename the method in Theme as well, skipping - { "_about_to_show", "_about_to_popup" }, // ColorPickerButton - { "_get_configuration_warning", "_get_configuration_warnings" }, // Node - { "_set_current", "set_current" }, // Camera2D - { "_set_editor_description", "set_editor_description" }, // Node - { "_toplevel_raise_self", "_top_level_raise_self" }, // CanvasItem - { "_update_wrap_at", "_update_wrap_at_column" }, // TextEdit - { "add_animation", "add_animation_library" }, // AnimationPlayer - { "add_cancel", "add_cancel_button" }, // AcceptDialog - { "add_central_force", "apply_central_force" }, //RigidBody2D - { "add_child_below_node", "add_sibling" }, // Node - { "add_color_override", "add_theme_color_override" }, // Control - { "add_constant_override", "add_theme_constant_override" }, // Control - { "add_font_override", "add_theme_font_override" }, // Control - { "add_force", "apply_force" }, //RigidBody2D - { "add_icon_override", "add_theme_icon_override" }, // Control - { "add_scene_import_plugin", "add_scene_format_importer_plugin" }, //EditorPlugin - { "add_spatial_gizmo_plugin", "add_node_3d_gizmo_plugin" }, // EditorPlugin - { "add_stylebox_override", "add_theme_stylebox_override" }, // Control - { "add_torque", "apply_torque" }, //RigidBody2D - { "agent_set_neighbor_dist", "agent_set_neighbor_distance" }, // NavigationServer2D, NavigationServer3D - { "apply_changes", "_apply_changes" }, // EditorPlugin - { "body_add_force", "body_apply_force" }, // PhysicsServer2D - { "body_add_torque", "body_apply_torque" }, // PhysicsServer2D - { "bumpmap_to_normalmap", "bump_map_to_normal_map" }, // Image - { "can_be_hidden", "_can_be_hidden" }, // EditorNode3DGizmoPlugin - { "can_drop_data", "_can_drop_data" }, // Control - { "can_generate_small_preview", "_can_generate_small_preview" }, // EditorResourcePreviewGenerator - { "can_instance", "can_instantiate" }, // PackedScene, Script - { "canvas_light_set_scale", "canvas_light_set_texture_scale" }, // RenderingServer - { "capture_get_device", "get_input_device" }, // AudioServer - { "capture_get_device_list", "get_input_device_list" }, // AudioServer - { "capture_set_device", "set_input_device" }, // AudioServer - { "center_viewport_to_cursor", "center_viewport_to_caret" }, // TextEdit - { "change_scene", "change_scene_to_file" }, // SceneTree - { "change_scene_to", "change_scene_to_packed" }, // SceneTree - { "clip_polygons_2d", "clip_polygons" }, // Geometry2D - { "clip_polyline_with_polygon_2d", "clip_polyline_with_polygon" }, //Geometry2D - { "commit_handle", "_commit_handle" }, // EditorNode3DGizmo - { "convex_hull_2d", "convex_hull" }, // Geometry2D - { "create_gizmo", "_create_gizmo" }, // EditorNode3DGizmoPlugin - { "cursor_get_blink_speed", "get_caret_blink_interval" }, // TextEdit - { "cursor_get_column", "get_caret_column" }, // TextEdit - { "cursor_get_line", "get_caret_line" }, // TextEdit - { "cursor_set_blink_enabled", "set_caret_blink_enabled" }, // TextEdit - { "cursor_set_blink_speed", "set_caret_blink_interval" }, // TextEdit - { "cursor_set_column", "set_caret_column" }, // TextEdit - { "cursor_set_line", "set_caret_line" }, // TextEdit - { "damped_spring_joint_create", "joint_make_damped_spring" }, // PhysicsServer2D - { "damped_string_joint_get_param", "damped_spring_joint_get_param" }, // PhysicsServer2D - { "damped_string_joint_set_param", "damped_spring_joint_set_param" }, // PhysicsServer2D - { "dectime", "move_toward" }, // GDScript, Math functions - { "delete_char_at_cursor", "delete_char_at_caret" }, // LineEdit - { "deselect_items", "deselect_all" }, // FileDialog - { "disable_plugin", "_disable_plugin" }, // EditorPlugin - { "drop_data", "_drop_data" }, // Control - { "exclude_polygons_2d", "exclude_polygons" }, // Geometry2D - { "find_node", "find_child" }, // Node - { "find_scancode_from_string", "find_keycode_from_string" }, // OS - { "forward_canvas_draw_over_viewport", "_forward_canvas_draw_over_viewport" }, // EditorPlugin - { "forward_canvas_force_draw_over_viewport", "_forward_canvas_force_draw_over_viewport" }, // EditorPlugin - { "forward_canvas_gui_input", "_forward_canvas_gui_input" }, // EditorPlugin - { "forward_spatial_draw_over_viewport", "_forward_3d_draw_over_viewport" }, // EditorPlugin - { "forward_spatial_force_draw_over_viewport", "_forward_3d_force_draw_over_viewport" }, // EditorPlugin - { "forward_spatial_gui_input", "_forward_3d_gui_input" }, // EditorPlugin - { "generate_from_path", "_generate_from_path" }, // EditorResourcePreviewGenerator - { "generate_small_preview_automatically", "_generate_small_preview_automatically" }, // EditorResourcePreviewGenerator - { "get_action_list", "action_get_events" }, // InputMap - { "get_alt", "is_alt_pressed" }, // InputEventWithModifiers - { "get_animation_process_mode", "get_process_callback" }, // AnimationPlayer - { "get_applied_force", "get_constant_force" }, //RigidBody2D - { "get_applied_torque", "get_constant_torque" }, //RigidBody2D - { "get_audio_bus", "get_audio_bus_name" }, // Area3D - { "get_bound_child_nodes_to_bone", "get_bone_children" }, // Skeleton3D - { "get_camera", "get_camera_3d" }, // Viewport -> this is also convertible to get_camera_2d, broke GLTFNode - { "get_cancel", "get_cancel_button" }, // ConfirmationDialog - { "get_caption", "_get_caption" }, // AnimationNode - { "get_cast_to", "get_target_position" }, // RayCast2D, RayCast3D - { "get_child_by_name", "_get_child_by_name" }, // AnimationNode - { "get_child_nodes", "_get_child_nodes" }, // AnimationNode - { "get_closest_point_to_segment_2d", "get_closest_point_to_segment" }, // Geometry2D - { "get_closest_point_to_segment_uncapped_2d", "get_closest_point_to_segment_uncapped" }, // Geometry2D - { "get_closest_points_between_segments_2d", "get_closest_point_to_segment" }, // Geometry2D - { "get_collision_layer_bit", "get_collision_layer_value" }, // CSGShape3D and a lot of others like GridMap - { "get_collision_mask_bit", "get_collision_mask_value" }, // CSGShape3D and a lot of others like GridMap - { "get_color_types", "get_color_type_list" }, // Theme - { "get_command", "is_command_or_control_pressed" }, // InputEventWithModifiers - { "get_constant_types", "get_constant_type_list" }, // Theme - { "get_control", "is_ctrl_pressed" }, // InputEventWithModifiers - { "get_cull_mask_bit", "get_cull_mask_value" }, // Camera3D - { "get_cursor_position", "get_caret_column" }, // LineEdit - { "get_d", "get_distance" }, // LineShape2D - { "get_depth_bias_enable", "get_depth_bias_enabled" }, // RDPipelineRasterizationState - { "get_device", "get_output_device" }, // AudioServer - { "get_device_list", "get_output_device_list" }, // AudioServer - { "get_drag_data", "_get_drag_data" }, // Control - { "get_editor_viewport", "get_editor_main_screen" }, // EditorPlugin - { "get_enabled_focus_mode", "get_focus_mode" }, // BaseButton - { "get_endian_swap", "is_big_endian" }, // File - { "get_error_string", "get_error_message" }, // JSON - { "get_filename", "get_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places - { "get_focus_neighbour", "get_focus_neighbor" }, // Control - { "get_follow_smoothing", "get_position_smoothing_speed" }, // Camera2D - { "get_font_types", "get_font_type_list" }, // Theme - { "get_frame_color", "get_color" }, // ColorRect - { "get_global_rate_scale", "get_playback_speed_scale" }, // AudioServer - { "get_gravity_distance_scale", "get_gravity_point_unit_distance" }, // Area(2D/3D) - { "get_gravity_vector", "get_gravity_direction" }, // Area(2D/3D) - { "get_h_scrollbar", "get_h_scroll_bar" }, //ScrollContainer - { "get_hand", "get_tracker_hand" }, // XRPositionalTracker - { "get_handle_name", "_get_handle_name" }, // EditorNode3DGizmo - { "get_handle_value", "_get_handle_value" }, // EditorNode3DGizmo - { "get_icon_align", "get_icon_alignment" }, // Button - { "get_icon_types", "get_icon_type_list" }, // Theme - { "get_idle_frames", "get_process_frames" }, // Engine - { "get_import_options", "_get_import_options" }, // EditorImportPlugin - { "get_import_order", "_get_import_order" }, // EditorImportPlugin - { "get_importer_name", "_get_importer_name" }, // EditorImportPlugin - { "get_interior_ambient", "get_ambient_color" }, // ReflectionProbe - { "get_interior_ambient_energy", "get_ambient_color_energy" }, // ReflectionProbe - { "get_iterations_per_second", "get_physics_ticks_per_second" }, // Engine - { "get_last_mouse_speed", "get_last_mouse_velocity" }, // Input - { "get_layer_mask_bit", "get_layer_mask_value" }, // VisualInstance3D - { "get_len", "get_length" }, // File - { "get_max_atlas_size", "get_max_texture_size" }, // LightmapGI - { "get_metakey", "is_meta_pressed" }, // InputEventWithModifiers - { "get_mid_height", "get_height" }, // CapsuleMesh - { "get_motion_remainder", "get_remainder" }, // PhysicsTestMotionResult2D - { "get_neighbor_dist", "get_neighbor_distance" }, // NavigationAgent2D, NavigationAgent3D - { "get_network_connected_peers", "get_peers" }, // Multiplayer API - { "get_network_master", "get_multiplayer_authority" }, // Node - { "get_network_peer", "get_multiplayer_peer" }, // Multiplayer API - { "get_network_unique_id", "get_unique_id" }, // Multiplayer API - { "get_ok", "get_ok_button" }, // AcceptDialog - { "get_oneshot", "get_one_shot" }, // AnimatedTexture - { "get_option_visibility", "_get_option_visibility" }, // EditorImportPlugin - { "get_parameter_default_value", "_get_parameter_default_value" }, // AnimationNode - { "get_parameter_list", "_get_parameter_list" }, // AnimationNode - { "get_parent_spatial", "get_parent_node_3d" }, // Node3D - { "get_pause_mode", "get_process_mode" }, // Node - { "get_physical_scancode", "get_physical_keycode" }, // InputEventKey - { "get_physical_scancode_with_modifiers", "get_physical_keycode_with_modifiers" }, // InputEventKey - { "get_plugin_icon", "_get_plugin_icon" }, // EditorPlugin - { "get_plugin_name", "_get_plugin_name" }, // EditorPlugin - { "get_preset_count", "_get_preset_count" }, // EditorImportPlugin - { "get_preset_name", "_get_preset_name" }, // EditorImportPlugin - { "get_recognized_extensions", "_get_recognized_extensions" }, // ResourceFormatLoader, EditorImportPlugin broke ResourceSaver - { "get_render_info", "get_rendering_info" }, // RenderingServer - { "get_render_targetsize", "get_render_target_size" }, // XRInterface - { "get_resource_type", "_get_resource_type" }, // ResourceFormatLoader - { "get_result", "get_data" }, //JSON - { "get_reverb_bus", "set_reverb_bus_name" }, // Area3D - { "get_rpc_sender_id", "get_remote_sender_id" }, // Multiplayer API - { "get_save_extension", "_get_save_extension" }, // EditorImportPlugin - { "get_scancode", "get_keycode" }, // InputEventKey - { "get_scancode_string", "get_keycode_string" }, // OS - { "get_scancode_with_modifiers", "get_keycode_with_modifiers" }, // InputEventKey - { "get_selected_path", "get_current_directory" }, // EditorInterface - { "get_shift", "is_shift_pressed" }, // InputEventWithModifiers - { "get_size_override", "get_size_2d_override" }, // SubViewport - { "get_slide_count", "get_slide_collision_count" }, // CharacterBody2D, CharacterBody3D - { "get_slips_on_slope", "get_slide_on_slope" }, // SeparationRayShape2D, SeparationRayShape3D - { "get_space_override_mode", "get_gravity_space_override_mode" }, // Area2D - { "get_spatial_node", "get_node_3d" }, // EditorNode3DGizmo - { "get_speed", "get_velocity" }, // InputEventMouseMotion - { "get_stylebox_types", "get_stylebox_type_list" }, // Theme - { "get_surface_material", "get_surface_override_material" }, // MeshInstance3D broke ImporterMesh - { "get_surface_material_count", "get_surface_override_material_count" }, // MeshInstance3D - { "get_tab_disabled", "is_tab_disabled" }, // Tab - { "get_tab_hidden", "is_tab_hidden" }, // Tab - { "get_text_align", "get_text_alignment" }, // Button - { "get_theme_item_types", "get_theme_item_type_list" }, // Theme - { "get_timer_process_mode", "get_timer_process_callback" }, // Timer - { "get_translation", "get_position" }, // Node3D broke GLTFNode which is used rarely - { "get_unit_db", "get_volume_db" }, // AudioStreamPlayer3D - { "get_unit_offset", "get_progress_ratio" }, // PathFollow2D, PathFollow3D - { "get_use_in_baked_light", "is_baking_navigation" }, // GridMap - { "get_used_cells_by_id", "get_used_cells" }, // TileMap - { "get_v_scrollbar", "get_v_scroll_bar" }, //ScrollContainer - { "get_visible_name", "_get_visible_name" }, // EditorImportPlugin - { "get_window_layout", "_get_window_layout" }, // EditorPlugin - { "get_word_under_cursor", "get_word_under_caret" }, // TextEdit - { "get_world", "get_world_3d" }, // Viewport, Spatial - { "get_zfar", "get_far" }, // Camera3D broke GLTFCamera - { "get_znear", "get_near" }, // Camera3D broke GLTFCamera - { "groove_joint_create", "joint_make_groove" }, // PhysicsServer2D - { "handle_menu_selected", "_handle_menu_selected" }, // EditorResourcePicker - { "handles_type", "_handles_type" }, // ResourceFormatLoader - { "has_color", "has_theme_color" }, // Control broke Theme - { "has_color_override", "has_theme_color_override" }, // Control broke Theme - { "has_constant", "has_theme_constant" }, // Control - { "has_constant_override", "has_theme_constant_override" }, // Control - { "has_filter", "_has_filter" }, // AnimationNode - { "has_font", "has_theme_font" }, // Control broke Theme - { "has_font_override", "has_theme_font_override" }, // Control - { "has_icon", "has_theme_icon" }, // Control broke Theme - { "has_icon_override", "has_theme_icon_override" }, // Control - { "has_main_screen", "_has_main_screen" }, // EditorPlugin - { "has_network_peer", "has_multiplayer_peer" }, // Multiplayer API - { "has_stylebox", "has_theme_stylebox" }, // Control broke Theme - { "has_stylebox_override", "has_theme_stylebox_override" }, // Control - { "http_escape", "uri_encode" }, // String - { "http_unescape", "uri_decode" }, // String - { "import_scene_from_other_importer", "_import_scene" }, //EditorSceneFormatImporter - { "instance_set_surface_material", "instance_set_surface_override_material" }, // RenderingServer - { "interpolate", "sample" }, // Curve, Curve2D, Curve3D, Gradient - { "intersect_polygons_2d", "intersect_polygons" }, // Geometry2D - { "intersect_polyline_with_polygon_2d", "intersect_polyline_with_polygon" }, // Geometry2D - { "is_a_parent_of", "is_ancestor_of" }, // Node - { "is_commiting_action", "is_committing_action" }, // UndoRedo - { "is_doubleclick", "is_double_click" }, // InputEventMouseButton - { "is_draw_red", "is_draw_warning" }, // EditorProperty - { "is_follow_smoothing_enabled", "is_position_smoothing_enabled" }, // Camera2D - { "is_h_drag_enabled", "is_drag_horizontal_enabled" }, // Camera2D - { "is_handle_highlighted", "_is_handle_highlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin - { "is_inverting_faces", "get_flip_faces" }, // CSGPrimitive3D - { "is_network_master", "is_multiplayer_authority" }, // Node - { "is_network_server", "is_server" }, // Multiplayer API - { "is_normalmap", "is_normal_map" }, // NoiseTexture - { "is_refusing_new_network_connections", "is_refusing_new_connections" }, // Multiplayer API - { "is_region", "is_region_enabled" }, // Sprite2D - { "is_rotating", "is_ignoring_rotation" }, // Camera2D - { "is_scancode_unicode", "is_keycode_unicode" }, // OS - { "is_selectable_when_hidden", "_is_selectable_when_hidden" }, // EditorNode3DGizmoPlugin - { "is_set_as_toplevel", "is_set_as_top_level" }, // CanvasItem - { "is_shortcut", "matches_event" }, // Shortcut - { "is_size_override_stretch_enabled", "is_size_2d_override_stretch_enabled" }, // SubViewport - { "is_sort_enabled", "is_y_sort_enabled" }, // Node2D - { "is_static_body", "is_able_to_sleep" }, // PhysicalBone3D - TODO - not sure - { "is_v_drag_enabled", "is_drag_vertical_enabled" }, // Camera2D - { "joint_create_cone_twist", "joint_make_cone_twist" }, // PhysicsServer3D - { "joint_create_generic_6dof", "joint_make_generic_6dof" }, // PhysicsServer3D - { "joint_create_hinge", "joint_make_hinge" }, // PhysicsServer3D - { "joint_create_pin", "joint_make_pin" }, // PhysicsServer3D - { "joint_create_slider", "joint_make_slider" }, // PhysicsServer3D - { "line_intersects_line_2d", "line_intersects_line" }, // Geometry2D - { "load_from_globals", "load_from_project_settings" }, // InputMap - { "load_interactive", "load_threaded_request" }, // ResourceLoader - load_threaded_request is alternative, but is used differently - { "make_convex_from_brothers", "make_convex_from_siblings" }, // CollisionShape3D - { "make_visible", "_make_visible" }, // EditorPlugin - { "merge_polygons_2d", "merge_polygons" }, // Geometry2D - { "mesh_surface_get_format", "mesh_surface_get_format_attribute_stride" }, // RenderingServer - { "mesh_surface_update_region", "mesh_surface_update_attribute_region" }, // RenderingServer - { "move_to_bottom", "move_after" }, // Skeleton3D - { "move_to_top", "move_before" }, // Skeleton3D - { "multimesh_allocate", "multimesh_allocate_data" }, // RenderingServer - { "normalmap_to_xy", "normal_map_to_xy" }, // Image - { "offset_polygon_2d", "offset_polygon" }, // Geometry2D - { "offset_polyline_2d", "offset_polyline" }, // Geometry2D - { "percent_decode", "uri_decode" }, // String - { "percent_encode", "uri_encode" }, // String - { "pin_joint_create", "joint_make_pin" }, // PhysicsServer2D - { "popup_centered_minsize", "popup_centered_clamped" }, // Window - { "post_import", "_post_import" }, // EditorScenePostImport - { "print_stray_nodes", "print_orphan_nodes" }, // Node - { "property_list_changed_notify", "notify_property_list_changed" }, // Object - { "raise", "move_to_front" }, // CanvasItem - { "recognize", "_recognize" }, // ResourceFormatLoader - { "regen_normalmaps", "regen_normal_maps" }, // ArrayMesh - { "remove", "remove_at" }, // Array, broke Directory - { "remove_animation", "remove_animation_library" }, // AnimationPlayer - { "remove_color_override", "remove_theme_color_override" }, // Control - { "remove_constant_override", "remove_theme_constant_override" }, // Control - { "remove_font_override", "remove_theme_font_override" }, // Control - { "remove_icon_override", "remove_theme_icon_override" }, // Control - { "remove_scene_import_plugin", "remove_scene_format_importer_plugin" }, //EditorPlugin - { "remove_spatial_gizmo_plugin", "remove_node_3d_gizmo_plugin" }, // EditorPlugin - { "remove_stylebox_override", "remove_theme_stylebox_override" }, // Control - { "rename_animation", "rename_animation_library" }, // AnimationPlayer - { "rename_dependencies", "_rename_dependencies" }, // ResourceFormatLoader - { "save_external_data", "_save_external_data" }, // EditorPlugin - { "segment_intersects_segment_2d", "segment_intersects_segment" }, // Geometry2D - { "set_adjustment_enable", "set_adjustment_enabled" }, // Environment - { "set_alt", "set_alt_pressed" }, // InputEventWithModifiers - { "set_anchor_and_margin", "set_anchor_and_offset" }, // Control - { "set_anchors_and_margins_preset", "set_anchors_and_offsets_preset" }, // Control - { "set_animation_process_mode", "set_process_callback" }, // AnimationPlayer - { "set_as_bulk_array", "set_buffer" }, // MultiMesh - { "set_as_normalmap", "set_as_normal_map" }, // NoiseTexture - { "set_as_toplevel", "set_as_top_level" }, // CanvasItem - { "set_audio_bus", "set_audio_bus_name" }, // Area3D - { "set_autowrap", "set_autowrap_mode" }, // Label broke AcceptDialog - { "set_cast_to", "set_target_position" }, // RayCast2D, RayCast3D - { "set_collision_layer_bit", "set_collision_layer_value" }, // CSGShape3D and a lot of others like GridMap - { "set_collision_mask_bit", "set_collision_mask_value" }, // CSGShape3D and a lot of others like GridMap - { "set_column_min_width", "set_column_custom_minimum_width" }, // Tree - { "set_command", "set_meta_pressed" }, // InputEventWithModifiers - { "set_control", "set_ctrl_pressed" }, // InputEventWithModifiers - { "set_create_options", "_set_create_options" }, // EditorResourcePicker - { "set_cull_mask_bit", "set_cull_mask_value" }, // Camera3D - { "set_cursor_position", "set_caret_column" }, // LineEdit - { "set_d", "set_distance" }, // WorldMarginShape2D - { "set_depth_bias_enable", "set_depth_bias_enabled" }, // RDPipelineRasterizationState - { "set_device", "set_output_device" }, // AudioServer - { "set_doubleclick", "set_double_click" }, // InputEventMouseButton - { "set_draw_red", "set_draw_warning" }, // EditorProperty - { "set_enable_follow_smoothing", "set_position_smoothing_enabled" }, // Camera2D - { "set_enabled_focus_mode", "set_focus_mode" }, // BaseButton - { "set_endian_swap", "set_big_endian" }, // File - { "set_expand_to_text_length", "set_expand_to_text_length_enabled" }, // LineEdit - { "set_filename", "set_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places - { "set_focus_neighbour", "set_focus_neighbor" }, // Control - { "set_follow_smoothing", "set_position_smoothing_speed" }, // Camera2D - { "set_frame_color", "set_color" }, // ColorRect - { "set_global_rate_scale", "set_playback_speed_scale" }, // AudioServer - { "set_gravity_distance_scale", "set_gravity_point_unit_distance" }, // Area(2D/3D) - { "set_gravity_vector", "set_gravity_direction" }, // Area(2D/3D) - { "set_h_drag_enabled", "set_drag_horizontal_enabled" }, // Camera2D - { "set_icon_align", "set_icon_alignment" }, // Button - { "set_interior_ambient", "set_ambient_color" }, // ReflectionProbe - { "set_interior_ambient_energy", "set_ambient_color_energy" }, // ReflectionProbe - { "set_invert_faces", "set_flip_faces" }, // CSGPrimitive3D - { "set_is_initialized", "_is_initialized" }, // XRInterface - { "set_is_primary", "set_primary" }, // XRInterface - { "set_iterations_per_second", "set_physics_ticks_per_second" }, // Engine - { "set_layer_mask_bit", "set_layer_mask_value" }, // VisualInstance3D - { "set_margins_preset", "set_offsets_preset" }, // Control - { "set_max_atlas_size", "set_max_texture_size" }, // LightmapGI - { "set_metakey", "set_meta_pressed" }, // InputEventWithModifiers - { "set_mid_height", "set_height" }, // CapsuleMesh - { "set_neighbor_dist", "set_neighbor_distance" }, // NavigationAgent2D, NavigationAgent3D - { "set_network_master", "set_multiplayer_authority" }, // Node - { "set_network_peer", "set_multiplayer_peer" }, // Multiplayer API - { "set_oneshot", "set_one_shot" }, // AnimatedTexture - { "set_pause_mode", "set_process_mode" }, // Node - { "set_physical_scancode", "set_physical_keycode" }, // InputEventKey - { "set_proximity_fade", "set_proximity_fade_enabled" }, // Material - { "set_refuse_new_network_connections", "set_refuse_new_connections" }, // Multiplayer API - { "set_region", "set_region_enabled" }, // Sprite2D, Sprite broke AtlasTexture - { "set_region_filter_clip", "set_region_filter_clip_enabled" }, // Sprite2D - { "set_reverb_bus", "set_reverb_bus_name" }, // Area3D - { "set_rotate", "set_rotates" }, // PathFollow2D - { "set_scancode", "set_keycode" }, // InputEventKey - { "set_shift", "set_shift_pressed" }, // InputEventWithModifiers - { "set_size_override", "set_size_2d_override" }, // SubViewport broke ImageTexture - { "set_size_override_stretch", "set_size_2d_override_stretch" }, // SubViewport - { "set_slips_on_slope", "set_slide_on_slope" }, // SeparationRayShape2D, SeparationRayShape3D - { "set_sort_enabled", "set_y_sort_enabled" }, // Node2D - { "set_space_override_mode", "set_gravity_space_override_mode" }, // Area2D - { "set_spatial_node", "set_node_3d" }, // EditorNode3DGizmo - { "set_speed", "set_velocity" }, // InputEventMouseMotion - { "set_ssao_edge_sharpness", "set_ssao_sharpness" }, // Environment - { "set_surface_material", "set_surface_override_material" }, // MeshInstance3D broke ImporterMesh - { "set_tab_align", "set_tab_alignment" }, //TabContainer - { "set_tangent", "surface_set_tangent" }, // ImmediateGeometry broke SurfaceTool - { "set_text_align", "set_text_alignment" }, // Button - { "set_timer_process_mode", "set_timer_process_callback" }, // Timer - { "set_translation", "set_position" }, // Node3D - this broke GLTFNode which is used rarely - { "set_unit_db", "set_volume_db" }, // AudioStreamPlayer3D - { "set_unit_offset", "set_progress_ratio" }, // PathFollow2D, PathFollow3D - { "set_uv2", "surface_set_uv2" }, // ImmediateMesh broke Surffacetool - { "set_v_drag_enabled", "set_drag_vertical_enabled" }, // Camera2D - { "set_valign", "set_vertical_alignment" }, // Label - { "set_window_layout", "_set_window_layout" }, // EditorPlugin - { "set_zfar", "set_far" }, // Camera3D broke GLTFCamera - { "set_znear", "set_near" }, // Camera3D broke GLTFCamera - { "shortcut_match", "is_match" }, // InputEvent - { "skeleton_allocate", "skeleton_allocate_data" }, // RenderingServer - { "surface_update_region", "surface_update_attribute_region" }, // ArrayMesh - { "targeting_method", "tween_method" }, // Tween - { "targeting_property", "tween_property" }, // Tween - { "track_remove_key_at_position", "track_remove_key_at_time" }, // Animation - { "triangulate_delaunay_2d", "triangulate_delaunay" }, // Geometry2D - { "unselect", "deselect" }, // ItemList - { "unselect_all", "deselect_all" }, // ItemList - { "update_configuration_warning", "update_configuration_warnings" }, // Node - { "update_gizmo", "update_gizmos" }, // Node3D - { "viewport_set_use_arvr", "viewport_set_use_xr" }, // RenderingServer - { "warp_mouse_position", "warp_mouse" }, // Input - { "world_to_map", "local_to_map" }, // TileMap, GridMap - { "set_shader_param", "set_shader_parameter" }, // ShaderMaterial - { "get_shader_param", "get_shader_parameter" }, // ShaderMaterial - { "set_uniform_name", "set_parameter_name" }, // ParameterRef - { "get_uniform_name", "get_parameter_name" }, // ParameterRef - - // Builtin types - // Remember to add them to builtin_types_excluded_functions variable, because for now this functions cannot be listed - // { "empty", "is_empty" }, // Array - Used as custom rule // Be careful, this will be used everywhere - { "clamped", "clamp" }, // Vector2 // Be careful, this will be used everywhere - { "get_rotation_quat", "get_rotation_quaternion" }, // Basis - { "grow_margin", "grow_side" }, // Rect2 - { "invert", "reverse" }, // Array - TODO check // Be careful, this will be used everywhere - { "is_abs_path", "is_absolute_path" }, // String - { "is_valid_integer", "is_valid_int" }, // String - { "linear_interpolate", "lerp" }, // Color - { "find_last", "rfind" }, // Array, String - { "to_ascii", "to_ascii_buffer" }, // String - { "to_utf8", "to_utf8_buffer" }, // String - { "to_wchar", "to_utf32_buffer" }, // String // TODO - utf32 or utf16? - - // @GlobalScope - // Remember to add them to builtin_types_excluded_functions variable, because for now this functions cannot be listed - { "bytes2var", "bytes_to_var" }, - { "bytes2var_with_objects", "bytes_to_var_with_objects" }, - { "db2linear", "db_to_linear" }, - { "deg2rad", "deg_to_rad" }, - { "linear2db", "linear_to_db" }, - { "rad2deg", "rad_to_deg" }, - { "rand_range", "randf_range" }, - { "range_lerp", "remap" }, - { "stepify", "snapped" }, - { "str2var", "str_to_var" }, - { "var2str", "var_to_str" }, - { "var2bytes", "var_to_bytes" }, - { "var2bytes_with_objects", "var_to_bytes_with_objects" }, - - // @GDScript - // Remember to add them to builtin_types_excluded_functions variable, because for now this functions cannot be listed - { "dict2inst", "dict_to_inst" }, - { "inst2dict", "inst_to_dict" }, - - { nullptr, nullptr }, -}; - -// gdscript_function_renames clone with CamelCase -const char *ProjectConverter3To4::csharp_function_renames[][2] = { - // { "_SetName", "GetTrackerName"}, // XRPositionalTracker - CameraFeed use this - // { "_UnhandledInput", "_UnhandledKeyInput"}, // BaseButton, ViewportContainer broke Node, FileDialog,SubViewportContainer - // { "CreateGizmo", "_CreateGizmo"}, // EditorNode3DGizmoPlugin - may be used - // { "GetDependencies", "_GetDependencies" }, // ResourceFormatLoader broke ResourceLoader - // { "GetExtents", "GetSize" }, // BoxShape, RectangleShape broke Decal, VoxelGI, GPUParticlesCollisionBox, GPUParticlesCollisionSDF, GPUParticlesCollisionHeightField, GPUParticlesAttractorBox, GPUParticlesAttractorVectorField, FogVolume - // { "GetHOffset", "GetDragHorizontalOffset"}, // Camera2D, broke PathFollow, Camera - // { "GetMode", "GetFileMode"}, // FileDialog broke Panel, Shader, CSGPolygon, Tilemap - // { "GetMotion", "GetTravel"}, // PhysicsTestMotionResult2D broke ParalaxLayer - // { "GetName", "GetTrackerName"}, // XRPositionalTracker broke OS, Node - // { "GetNetworkConnectedPeers", "GetPeers"}, // MultiplayerAPI broke SceneTree - // { "GetNetworkPeer", "HasMultiplayerPeer"}, // MultiplayerAPI broke SceneTree - // { "GetNetworkUniqueId", "GetUniqueId"}, // MultiplayerAPI broke SceneTree - // { "GetOffset", "GetPositionOffset" }, // GraphNode broke Gradient - // { "GetPeerPort", "GetPeer" }, // ENetMultiplayerPeer broke WebSocketServer - // { "GetProcessMode", "GetProcessCallback" }, // ClippedCamera3D broke Node, Sky - // { "GetRenderInfo", "GetRenderingInfo" }, // RenderingServer broke Viewport - // { "GetType", "GetTrackerType"}, // XRPositionalTracker broke GLTFAccessor, GLTFLight - // { "GetVOffset", "GetDragVerticalOffset"}, // Camera2D, broke PathFollow, Camera - // { "HasNetworkPeer", "HasMultiplayerPeer"}, // MultiplayerAPI broke SceneTree - // { "Instance", "Instantiate" }, // PackedScene, ClassDB - Broke FileSystemDock signal and also tscn files - [instance=ExtResource( 17 )] - this is implemented as custom rule - // { "IsListening", "IsBound"}, // PacketPeerUDP broke TCPServer, UDPServer - // { "IsRefusingNewNetworkConnections", "IsRefusingNewConnections"}, // MultiplayerAPI broke SceneTree - // { "IsValid", "HasValidEvent" }, // Shortcut broke e.g. Callable - // { "Listen", "Bound"}, // PacketPeerUDP broke TCPServer, UDPServer - // { "Load", "_Load"}, // ResourceFormatLoader broke ConfigFile, Image, StreamTexture2D - // { "MakeCurrent", "SetCurrent" }, // Camera2D broke Camera3D, Listener2D - // { "Process", "_Process" }, // AnimationNode - This word is commonly used - // { "Save", "_Save"}, // ResourceFormatLoader broke ConfigFile, Image, StreamTexture2D - // { "SetAutowrap", "SetAutowrapMode" }, // AcceptDialog broke Label - Cyclic Rename - // { "SetColor", "SurfaceSetColor"}, // ImmediateMesh broke Light2D, Theme, SurfaceTool - // { "SetEvent", "SetShortcut" }, // BaseButton - Cyclic Rename - // { "SetExtents", "SetSize"}, // BoxShape, RectangleShape broke ReflectionProbe - // { "SetFlag", "SetParticleFlag"}, // ParticleProcessMaterial broke Window, HingeJoint3D - // { "SetHOffset", "SetDragHorizontalOffset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D - // { "SetMargin", "SetOffset" }, // Control broke Shape3D, AtlasTexture - // { "SetMode", "SetModeFileMode" }, // FileDialog broke Panel, Shader, CSGPolygon, Tilemap - // { "SetNormal", "SurfaceSetNormal"}, // ImmediateGeometry broke SurfaceTool, WorldMarginShape2D - // { "SetOffset", "SetProgress" }, // PathFollow2D, PathFollow3D - Too common - // { "SetProcessMode", "SetProcessCallback" }, // AnimationTree broke Node, Tween, Sky - // { "SetRefuseNewNetworkConnections", "SetRefuseNewConnections"}, // MultiplayerAPI broke SceneTree - // { "SetTooltip", "SetTooltipText" }, // Control, breaks TreeItem, at least for now. - // { "SetUv", "SurfaceSetUv" }, // ImmediateMesh broke Polygon2D - // { "SetVOffset", "SetDragVerticalOffset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D - // {"GetPoints","GetPointsId"},// Astar, broke Line2D, Convexpolygonshape - // {"GetVScroll","GetVScrollBar"},//ItemList, broke TextView - // { "GetStylebox", "GetThemeStylebox" }, // Control - Will rename the method in Theme as well, skipping - { "AddSpatialGizmoPlugin", "AddNode3dGizmoPlugin" }, // EditorPlugin - { "RenderingServer", "GetTabAlignment" }, // Tab - { "_AboutToShow", "_AboutToPopup" }, // ColorPickerButton - { "_GetConfigurationWarning", "_GetConfigurationWarnings" }, // Node - { "_SetCurrent", "SetCurrent" }, // Camera2D - { "_SetEditorDescription", "SetEditorDescription" }, // Node - { "_SetPlaying", "SetPlaying" }, // AnimatedSprite3D - { "_ToplevelRaiseSelf", "_TopLevelRaiseSelf" }, // CanvasItem - { "_UpdateWrapAt", "_UpdateWrapAtColumn" }, // TextEdit - { "AddAnimation", "AddAnimationLibrary" }, // AnimationPlayer - { "AddCancel", "AddCancelButton" }, // AcceptDialog - { "AddCentralForce", "AddConstantCentralForce" }, //RigidBody2D - { "AddChildBelowNode", "AddSibling" }, // Node - { "AddColorOverride", "AddThemeColorOverride" }, // Control - { "AddConstantOverride", "AddThemeConstantOverride" }, // Control - { "AddFontOverride", "AddThemeFontOverride" }, // Control - { "AddForce", "AddConstantForce" }, //RigidBody2D - { "AddIconOverride", "AddThemeIconOverride" }, // Control - { "AddSceneImportPlugin", "AddSceneFormatImporterPlugin" }, //EditorPlugin - { "AddStyleboxOverride", "AddThemeStyleboxOverride" }, // Control - { "AddTorque", "AddConstantTorque" }, //RigidBody2D - { "AgentSetNeighborDist", "AgentSetNeighborDistance" }, // NavigationServer2D, NavigationServer3D - { "BindChildNodeToBone", "SetBoneChildren" }, // Skeleton3D - { "BumpmapToNormalmap", "BumpMapToNormalMap" }, // Image - { "CanBeHidden", "_CanBeHidden" }, // EditorNode3DGizmoPlugin - { "CanDropData", "_CanDropData" }, // Control - { "CanDropDataFw", "_CanDropDataFw" }, // ScriptEditor - { "CanGenerateSmallPreview", "_CanGenerateSmallPreview" }, // EditorResourcePreviewGenerator - { "CanInstance", "CanInstantiate" }, // PackedScene, Script - { "CanvasLightSetScale", "CanvasLightSetTextureScale" }, // RenderingServer - { "CaptureGetDevice", "GetInputDevice" }, // AudioServer - { "CaptureGetDeviceList", "GetInputDeviceList" }, // AudioServer - { "CaptureSetDevice", "SetInputDevice" }, // AudioServer - { "CenterViewportToCursor", "CenterViewportToCaret" }, // TextEdit - { "ChangeScene", "ChangeSceneToFile" }, // SceneTree - { "ChangeSceneTo", "ChangeSceneToPacked" }, // SceneTree - { "ClipPolygons2d", "ClipPolygons" }, // Geometry2D - { "ClipPolylineWithPolygon2d", "ClipPolylineWithPolygon" }, //Geometry2D - { "CommitHandle", "_CommitHandle" }, // EditorNode3DGizmo - { "ConvexHull2d", "ConvexHull" }, // Geometry2D - { "CursorGetBlinkSpeed", "GetCaretBlinkInterval" }, // TextEdit - { "CursorGetColumn", "GetCaretColumn" }, // TextEdit - { "CursorGetLine", "GetCaretLine" }, // TextEdit - { "CursorSetBlinkEnabled", "SetCaretBlinkEnabled" }, // TextEdit - { "CursorSetBlinkSpeed", "SetCaretBlinkInterval" }, // TextEdit - { "CursorSetColumn", "SetCaretColumn" }, // TextEdit - { "CursorSetLine", "SetCaretLine" }, // TextEdit - { "DampedSpringJointCreate", "JointMakeDampedSpring" }, // PhysicsServer2D - { "DampedStringJointGetParam", "DampedSpringJointGetParam" }, // PhysicsServer2D - { "DampedStringJointSetParam", "DampedSpringJointSetParam" }, // PhysicsServer2D - { "DeleteCharAtCursor", "DeleteCharAtCaret" }, // LineEdit - { "DeselectItems", "DeselectAll" }, // FileDialog - { "DropData", "_DropData" }, // Control - { "DropDataFw", "_DropDataFw" }, // ScriptEditor - { "ExcludePolygons2d", "ExcludePolygons" }, // Geometry2D - { "FindScancodeFromString", "FindKeycodeFromString" }, // OS - { "ForwardCanvasDrawOverViewport", "_ForwardCanvasDrawOverViewport" }, // EditorPlugin - { "ForwardCanvasForceDrawOverViewport", "_ForwardCanvasForceDrawOverViewport" }, // EditorPlugin - { "ForwardCanvasGuiInput", "_ForwardCanvasGuiInput" }, // EditorPlugin - { "ForwardSpatialDrawOverViewport", "_Forward3dDrawOverViewport" }, // EditorPlugin - { "ForwardSpatialForceDrawOverViewport", "_Forward3dForceDrawOverViewport" }, // EditorPlugin - { "ForwardSpatialGuiInput", "_Forward3dGuiInput" }, // EditorPlugin - { "GenerateFromPath", "_GenerateFromPath" }, // EditorResourcePreviewGenerator - { "GenerateSmallPreviewAutomatically", "_GenerateSmallPreviewAutomatically" }, // EditorResourcePreviewGenerator - { "GetActionList", "ActionGetEvents" }, // InputMap - { "GetAlt", "IsAltPressed" }, // InputEventWithModifiers - { "GetAnimationProcessMode", "GetProcessCallback" }, // AnimationPlayer - { "GetAppliedForce", "GetConstantForce" }, //RigidBody2D - { "GetAppliedTorque", "GetConstantTorque" }, //RigidBody2D - { "GetAudioBus", "GetAudioBusName" }, // Area3D - { "GetBoundChildNodesToBone", "GetBoneChildren" }, // Skeleton3D - { "GetCamera", "GetCamera3d" }, // Viewport -> this is also convertible to getCamera2d, broke GLTFNode - { "GetCancel", "GetCancelButton" }, // ConfirmationDialog - { "GetCaption", "_GetCaption" }, // AnimationNode - { "GetCastTo", "GetTargetPosition" }, // RayCast2D, RayCast3D - { "GetChildByName", "_GetChildByName" }, // AnimationNode - { "GetChildNodes", "_GetChildNodes" }, // AnimationNode - { "GetClosestPointToSegment2d", "GetClosestPointToSegment" }, // Geometry2D - { "GetClosestPointToSegmentUncapped2d", "GetClosestPointToSegmentUncapped" }, // Geometry2D - { "GetClosestPointsBetweenSegments2d", "GetClosestPointToSegment" }, // Geometry2D - { "GetCollisionLayerBit", "GetCollisionLayerValue" }, // CSGShape3D and a lot of others like GridMap - { "GetCollisionMaskBit", "GetCollisionMaskValue" }, // CSGShape3D and a lot of others like GridMap - { "GetColorTypes", "GetColorTypeList" }, // Theme - { "GetCommand", "IsCommandPressed" }, // InputEventWithModifiers - { "GetConstantTypes", "GetConstantTypeList" }, // Theme - { "GetControl", "IsCtrlPressed" }, // InputEventWithModifiers - { "GetCullMaskBit", "GetCullMaskValue" }, // Camera3D - { "GetCursorPosition", "GetCaretColumn" }, // LineEdit - { "GetD", "GetDistance" }, // LineShape2D - { "GetDepthBiasEnable", "GetDepthBiasEnabled" }, // RDPipelineRasterizationState - { "GetDevice", "GetOutputDevice" }, // AudioServer - { "GetDeviceList", "GetOutputDeviceList" }, // AudioServer - { "GetDragDataFw", "_GetDragDataFw" }, // ScriptEditor - { "GetEditorViewport", "GetViewport" }, // EditorPlugin - { "GetEnabledFocusMode", "GetFocusMode" }, // BaseButton - { "GetEndianSwap", "IsBigEndian" }, // File - { "GetErrorString", "GetErrorMessage" }, // JSON - { "GetFocusNeighbour", "GetFocusNeighbor" }, // Control - { "GetFollowSmoothing", "GetFollowSmoothingSpeed" }, // Camera2D - { "GetFontTypes", "GetFontTypeList" }, // Theme - { "GetFrameColor", "GetColor" }, // ColorRect - { "GetGlobalRateScale", "GetPlaybackSpeedScale" }, // AudioServer - { "GetGravityDistanceScale", "GetGravityPointDistanceScale" }, //Area2D - { "GetGravityVector", "GetGravityDirection" }, //Area2D - { "GetHScrollbar", "GetHScrollBar" }, //ScrollContainer - { "GetHand", "GetTrackerHand" }, // XRPositionalTracker - { "GetHandleName", "_GetHandleName" }, // EditorNode3DGizmo - { "GetHandleValue", "_GetHandleValue" }, // EditorNode3DGizmo - { "GetIconAlign", "GetIconAlignment" }, // Button - { "GetIconTypes", "GetIconTypeList" }, // Theme - { "GetIdleFrames", "GetProcessFrames" }, // Engine - { "GetImportOptions", "_GetImportOptions" }, // EditorImportPlugin - { "GetImportOrder", "_GetImportOrder" }, // EditorImportPlugin - { "GetImporterName", "_GetImporterName" }, // EditorImportPlugin - { "GetInteriorAmbient", "GetAmbientColor" }, // ReflectionProbe - { "GetInteriorAmbientEnergy", "GetAmbientColorEnergy" }, // ReflectionProbe - { "GetIterationsPerSecond", "GetPhysicsTicksPerSecond" }, // Engine - { "GetLastMouseSpeed", "GetLastMouseVelocity" }, // Input - { "GetLayerMaskBit", "GetLayerMaskValue" }, // VisualInstance3D - { "GetLen", "GetLength" }, // File - { "GetMaxAtlasSize", "GetMaxTextureSize" }, // LightmapGI - { "GetMetakey", "IsMetaPressed" }, // InputEventWithModifiers - { "GetMidHeight", "GetHeight" }, // CapsuleMesh - { "GetMotionRemainder", "GetRemainder" }, // PhysicsTestMotionResult2D - { "GetNeighborDist", "GetNeighborDistance" }, // NavigationAgent2D, NavigationAgent3D - { "GetNetworkConnectedPeers", "GetPeers" }, // Multiplayer API - { "GetNetworkMaster", "GetMultiplayerAuthority" }, // Node - { "GetNetworkPeer", "GetMultiplayerPeer" }, // Multiplayer API - { "GetNetworkUniqueId", "GetUniqueId" }, // Multiplayer API - { "GetOneshot", "GetOneShot" }, // AnimatedTexture - { "GetOk", "GetOkButton" }, // AcceptDialog - { "GetOptionVisibility", "_GetOptionVisibility" }, // EditorImportPlugin - { "GetParameterDefaultValue", "_GetParameterDefaultValue" }, // AnimationNode - { "GetParameterList", "_GetParameterList" }, // AnimationNode - { "GetParentSpatial", "GetParentNode3d" }, // Node3D - { "GetPhysicalScancode", "GetPhysicalKeycode" }, // InputEventKey - { "GetPhysicalScancodeWithModifiers", "GetPhysicalKeycodeWithModifiers" }, // InputEventKey - { "GetPluginIcon", "_GetPluginIcon" }, // EditorPlugin - { "GetPluginName", "_GetPluginName" }, // EditorPlugin - { "GetPresetCount", "_GetPresetCount" }, // EditorImportPlugin - { "GetPresetName", "_GetPresetName" }, // EditorImportPlugin - { "GetRecognizedExtensions", "_GetRecognizedExtensions" }, // ResourceFormatLoader, EditorImportPlugin broke ResourceSaver - { "GetRenderInfo", "GetRenderingInfo" }, // RenderingServer - { "GetRenderTargetsize", "GetRenderTargetSize" }, // XRInterface - { "GetResourceType", "_GetResourceType" }, // ResourceFormatLoader - { "GetResult", "GetData" }, //JSON - { "GetReverbBus", "GetReverbBusName" }, // Area3D - { "GetRpcSenderId", "GetRemoteSenderId" }, // Multiplayer API - { "GetSaveExtension", "_GetSaveExtension" }, // EditorImportPlugin - { "GetScancode", "GetKeycode" }, // InputEventKey - { "GetScancodeString", "GetKeycodeString" }, // OS - { "GetScancodeWithModifiers", "GetKeycodeWithModifiers" }, // InputEventKey - { "GetShift", "IsShiftPressed" }, // InputEventWithModifiers - { "GetSizeOverride", "GetSize2dOverride" }, // SubViewport - { "GetSlipsOnSlope", "GetSlideOnSlope" }, // SeparationRayShape2D, SeparationRayShape3D - { "GetSpaceOverrideMode", "GetGravitySpaceOverrideMode" }, // Area2D - { "GetSpatialNode", "GetNode3d" }, // EditorNode3DGizmo - { "GetSpeed", "GetVelocity" }, // InputEventMouseMotion - { "GetStyleboxTypes", "GetStyleboxTypeList" }, // Theme - { "GetSurfaceMaterial", "GetSurfaceOverrideMaterial" }, // MeshInstance3D broke ImporterMesh - { "GetSurfaceMaterialCount", "GetSurfaceOverrideMaterialCount" }, // MeshInstance3D - { "GetTabDisabled", "IsTabDisabled" }, // Tab - { "GetTabHidden", "IsTabHidden" }, // Tab - { "GetTextAlign", "GetTextAlignment" }, // Button - { "GetThemeItemTypes", "GetThemeItemTypeList" }, // Theme - { "GetTimerProcessMode", "GetTimerProcessCallback" }, // Timer - { "GetTranslation", "GetPosition" }, // Node3D broke GLTFNode which is used rarely - { "GetUnitDb", "GetVolumeDb" }, // AudioStreamPlayer3D - { "GetUnitOffset", "GetProgressRatio" }, // PathFollow2D, PathFollow3D - { "GetUseInBakedLight", "IsBakingNavigation" }, // GridMap - { "GetUsedCellsById", "GetUsedCells" }, // TileMap - { "GetVScrollbar", "GetVScrollBar" }, //ScrollContainer - { "GetVisibleName", "_GetVisibleName" }, // EditorImportPlugin - { "GetWindowLayout", "_GetWindowLayout" }, // EditorPlugin - { "GetWordUnderCursor", "GetWordUnderCaret" }, // TextEdit - { "GetWorld", "GetWorld3d" }, // Viewport, Spatial - { "GetZfar", "GetFar" }, // Camera3D broke GLTFCamera - { "GetZnear", "GetNear" }, // Camera3D broke GLTFCamera - { "GrooveJointCreate", "JointMakeGroove" }, // PhysicsServer2D - { "HandleMenuSelected", "_HandleMenuSelected" }, // EditorResourcePicker - { "HandlesType", "_HandlesType" }, // ResourceFormatLoader - { "HasColor", "HasThemeColor" }, // Control broke Theme - { "HasColorOverride", "HasThemeColorOverride" }, // Control broke Theme - { "HasConstant", "HasThemeConstant" }, // Control - { "HasConstantOverride", "HasThemeConstantOverride" }, // Control - { "HasFilter", "_HasFilter" }, // AnimationNode - { "HasFont", "HasThemeFont" }, // Control broke Theme - { "HasFontOverride", "HasThemeFontOverride" }, // Control - { "HasIcon", "HasThemeIcon" }, // Control broke Theme - { "HasIconOverride", "HasThemeIconOverride" }, // Control - { "HasMainScreen", "_HasMainScreen" }, // EditorPlugin - { "HasNetworkPeer", "HasMultiplayerPeer" }, // Multiplayer API - { "HasStylebox", "HasThemeStylebox" }, // Control broke Theme - { "HasStyleboxOverride", "HasThemeStyleboxOverride" }, // Control - { "HttpEscape", "UriEncode" }, // String - { "HttpUnescape", "UriDecode" }, // String - { "ImportAnimationFromOtherImporter", "_ImportAnimation" }, //EditorSceneFormatImporter - { "ImportSceneFromOtherImporter", "_ImportScene" }, //EditorSceneFormatImporter - { "InstanceSetSurfaceMaterial", "InstanceSetSurfaceOverrideMaterial" }, // RenderingServer - { "IntersectPolygons2d", "IntersectPolygons" }, // Geometry2D - { "IntersectPolylineWithPolygon2d", "IntersectPolylineWithPolygon" }, // Geometry2D - { "IsAParentOf", "IsAncestorOf" }, // Node - { "IsCommitingAction", "IsCommittingAction" }, // UndoRedo - { "IsDoubleclick", "IsDoubleClick" }, // InputEventMouseButton - { "IsFollowSmoothingEnabled", "IsPositionSmoothingEnabled" }, // Camera2D - { "IsHDragEnabled", "IsDragHorizontalEnabled" }, // Camera2D - { "IsHandleHighlighted", "_IsHandleHighlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin - { "IsNetworkMaster", "IsMultiplayerAuthority" }, // Node - { "IsNetworkServer", "IsServer" }, // Multiplayer API - { "IsNormalmap", "IsNormalMap" }, // NoiseTexture - { "IsRefusingNewNetworkConnections", "IsRefusingNewConnections" }, // Multiplayer API - { "IsRegion", "IsRegionEnabled" }, // Sprite2D - { "IsRotating", "IsIgnoringRotation" }, // Camera2D - { "IsScancodeUnicode", "IsKeycodeUnicode" }, // OS - { "IsSelectableWhenHidden", "_IsSelectableWhenHidden" }, // EditorNode3DGizmoPlugin - { "IsSetAsToplevel", "IsSetAsTopLevel" }, // CanvasItem - { "IsShortcut", "MatchesEvent" }, // Shortcut - { "IsSizeOverrideStretchEnabled", "IsSize2dOverrideStretchEnabled" }, // SubViewport - { "IsSortEnabled", "IsYSortEnabled" }, // Node2D - { "IsStaticBody", "IsAbleToSleep" }, // PhysicalBone3D - TODO - not sure - { "IsVDragEnabled", "IsDragVerticalEnabled" }, // Camera2D - { "JointCreateConeTwist", "JointMakeConeTwist" }, // PhysicsServer3D - { "JointCreateGeneric6dof", "JointMakeGeneric6dof" }, // PhysicsServer3D - { "JointCreateHinge", "JointMakeHinge" }, // PhysicsServer3D - { "JointCreatePin", "JointMakePin" }, // PhysicsServer3D - { "JointCreateSlider", "JointMakeSlider" }, // PhysicsServer3D - { "LineIntersectsLine2d", "LineIntersectsLine" }, // Geometry2D - { "LoadFromGlobals", "LoadFromProjectSettings" }, // InputMap - { "MakeConvexFromBrothers", "MakeConvexFromSiblings" }, // CollisionShape3D - { "MergePolygons2d", "MergePolygons" }, // Geometry2D - { "MeshSurfaceGetFormat", "MeshSurfaceGetFormatAttributeStride" }, // RenderingServer - { "MeshSurfaceUpdateRegion", "MeshSurfaceUpdateAttributeRegion" }, // RenderingServer - { "MoveToBottom", "MoveAfter" }, // Skeleton3D - { "MoveToTop", "MoveBefore" }, // Skeleton3D - { "MultimeshAllocate", "MultimeshAllocateData" }, // RenderingServer - { "NormalmapToXy", "NormalMapToXy" }, // Image - { "OffsetPolygon2d", "OffsetPolygon" }, // Geometry2D - { "OffsetPolyline2d", "OffsetPolyline" }, // Geometry2D - { "PercentDecode", "UriDecode" }, // String - { "PercentEncode", "UriEncode" }, // String - { "PinJointCreate", "JointMakePin" }, // PhysicsServer2D - { "PopupCenteredMinsize", "PopupCenteredClamped" }, // Window - { "PostImport", "_PostImport" }, // EditorScenePostImport - { "PrintStrayNodes", "PrintOrphanNodes" }, // Node - { "PropertyListChangedNotify", "NotifyPropertyListChanged" }, // Object - { "Recognize", "_Recognize" }, // ResourceFormatLoader - { "RegenNormalmaps", "RegenNormalMaps" }, // ArrayMesh - { "Remove", "RemoveAt" }, // Array, broke Directory - { "RemoveAnimation", "RemoveAnimationLibrary" }, // AnimationPlayer - { "RemoveColorOverride", "RemoveThemeColorOverride" }, // Control - { "RemoveConstantOverride", "RemoveThemeConstantOverride" }, // Control - { "RemoveFontOverride", "RemoveThemeFontOverride" }, // Control - { "RemoveSceneImportPlugin", "RemoveSceneFormatImporterPlugin" }, //EditorPlugin - { "RemoveSpatialGizmoPlugin", "RemoveNode3dGizmoPlugin" }, // EditorPlugin - { "RemoveStyleboxOverride", "RemoveThemeStyleboxOverride" }, // Control - { "RenameAnimation", "RenameAnimationLibrary" }, // AnimationPlayer - { "RenameDependencies", "_RenameDependencies" }, // ResourceFormatLoader - { "SaveExternalData", "_SaveExternalData" }, // EditorPlugin - { "SegmentIntersectsSegment2d", "SegmentIntersectsSegment" }, // Geometry2D - { "SetAdjustmentEnable", "SetAdjustmentEnabled" }, // Environment - { "SetAlt", "SetAltPressed" }, // InputEventWithModifiers - { "SetAnchorAndMargin", "SetAnchorAndOffset" }, // Control - { "SetAnchorsAndMarginsPreset", "SetAnchorsAndOffsetsPreset" }, // Control - { "SetAnimationProcessMode", "SetProcessCallback" }, // AnimationPlayer - { "SetAsBulkArray", "SetBuffer" }, // MultiMesh - { "SetAsNormalmap", "SetAsNormalMap" }, // NoiseTexture - { "SetAsToplevel", "SetAsTopLevel" }, // CanvasItem - { "SetAudioBus", "SetAudioBusName" }, // Area3D - { "SetAutowrap", "SetAutowrapMode" }, // Label broke AcceptDialog - { "SetCastTo", "SetTargetPosition" }, // RayCast2D, RayCast3D - { "SetCollisionLayerBit", "SetCollisionLayerValue" }, // CSGShape3D and a lot of others like GridMap - { "SetCollisionMaskBit", "SetCollisionMaskValue" }, // CSGShape3D and a lot of others like GridMap - { "SetColumnMinWidth", "SetColumnCustomMinimumWidth" }, // Tree - { "SetCommand", "SetCommandPressed" }, // InputEventWithModifiers - { "SetControl", "SetCtrlPressed" }, // InputEventWithModifiers - { "SetCreateOptions", "_SetCreateOptions" }, // EditorResourcePicker - { "SetCullMaskBit", "SetCullMaskValue" }, // Camera3D - { "SetCursorPosition", "SetCaretColumn" }, // LineEdit - { "SetD", "SetDistance" }, // WorldMarginShape2D - { "SetDepthBiasEnable", "SetDepthBiasEnabled" }, // RDPipelineRasterizationState - { "SetDevice", "SetOutputDevice" }, // AudioServer - { "SetDoubleclick", "SetDoubleClick" }, // InputEventMouseButton - { "SetEnableFollowSmoothing", "SetFollowSmoothingEnabled" }, // Camera2D - { "SetEnabledFocusMode", "SetFocusMode" }, // BaseButton - { "SetEndianSwap", "SetBigEndian" }, // File - { "SetExpandToTextLength", "SetExpandToTextLengthEnabled" }, // LineEdit - { "SetFocusNeighbour", "SetFocusNeighbor" }, // Control - { "SetFollowSmoothing", "SetFollowSmoothingSpeed" }, // Camera2D - { "SetFrameColor", "SetColor" }, // ColorRect - { "SetGlobalRateScale", "SetPlaybackSpeedScale" }, // AudioServer - { "SetGravityDistanceScale", "SetGravityPointDistanceScale" }, // Area2D - { "SetGravityVector", "SetGravityDirection" }, // Area2D - { "SetHDragEnabled", "SetDragHorizontalEnabled" }, // Camera2D - { "SetIconAlign", "SetIconAlignment" }, // Button - { "SetInteriorAmbient", "SetAmbientColor" }, // ReflectionProbe - { "SetInteriorAmbientEnergy", "SetAmbientColorEnergy" }, // ReflectionProbe - { "SetIsInitialized", "_IsInitialized" }, // XRInterface - { "SetIsPrimary", "SetPrimary" }, // XRInterface - { "SetIterationsPerSecond", "SetPhysicsTicksPerSecond" }, // Engine - { "SetLayerMaskBit", "SetLayerMaskValue" }, // VisualInstance3D - { "SetMarginsPreset", "SetOffsetsPreset" }, // Control - { "SetMaxAtlasSize", "SetMaxTextureSize" }, // LightmapGI - { "SetMetakey", "SetMetaPressed" }, // InputEventWithModifiers - { "SetMidHeight", "SetHeight" }, // CapsuleMesh - { "SetNeighborDist", "SetNeighborDistance" }, // NavigationAgent2D, NavigationAgent3D - { "SetNetworkMaster", "SetMultiplayerAuthority" }, // Node - { "SetNetworkPeer", "SetMultiplayerPeer" }, // Multiplayer API - { "SetOneshot", "SetOneShot" }, // AnimatedTexture - { "SetPhysicalScancode", "SetPhysicalKeycode" }, // InputEventKey - { "SetProximityFade", "SetProximityFadeEnabled" }, // Material - { "SetRefuseNewNetworkConnections", "SetRefuseNewConnections" }, // Multiplayer API - { "SetRegion", "SetRegionEnabled" }, // Sprite2D, Sprite broke AtlasTexture - { "SetRegionFilterClip", "SetRegionFilterClipEnabled" }, // Sprite2D - { "SetReverbBus", "SetReverbBusName" }, // Area3D - { "SetRotate", "SetRotates" }, // PathFollow2D - { "SetScancode", "SetKeycode" }, // InputEventKey - { "SetShift", "SetShiftPressed" }, // InputEventWithModifiers - { "SetSizeOverride", "SetSize2dOverride" }, // SubViewport broke ImageTexture - { "SetSizeOverrideStretch", "SetSize2dOverrideStretch" }, // SubViewport - { "SetSlipsOnSlope", "SetSlideOnSlope" }, // SeparationRayShape2D, SeparationRayShape3D - { "SetSortEnabled", "SetYSortEnabled" }, // Node2D - { "SetSpaceOverrideMode", "SetGravitySpaceOverrideMode" }, // Area2D - { "SetSpatialNode", "SetNode3d" }, // EditorNode3DGizmo - { "SetSpeed", "SetVelocity" }, // InputEventMouseMotion - { "SetSsaoEdgeSharpness", "SetSsaoSharpness" }, // Environment - { "SetSurfaceMaterial", "SetSurfaceOverrideMaterial" }, // MeshInstance3D broke ImporterMesh - { "SetTabAlign", "SetTabAlignment" }, //TabContainer - { "SetTangent", "SurfaceSetTangent" }, // ImmediateGeometry broke SurfaceTool - { "SetTextAlign", "SetTextAlignment" }, // Button - { "SetTimerProcessMode", "SetTimerProcessCallback" }, // Timer - { "SetTonemapAutoExposure", "SetTonemapAutoExposureEnabled" }, // Environment - { "SetTranslation", "SetPosition" }, // Node3D - this broke GLTFNode which is used rarely - { "SetUnitDb", "SetVolumeDb" }, // AudioStreamPlayer3D - { "SetUnitOffset", "SetProgressRatio" }, // PathFollow2D, PathFollow3D - { "SetUv2", "SurfaceSetUv2" }, // ImmediateMesh broke Surffacetool - { "SetVDragEnabled", "SetDragVerticalEnabled" }, // Camera2D - { "SetValign", "SetVerticalAlignment" }, // Label - { "SetWindowLayout", "_SetWindowLayout" }, // EditorPlugin - { "SetZfar", "SetFar" }, // Camera3D broke GLTFCamera - { "SetZnear", "SetNear" }, // Camera3D broke GLTFCamera - { "ShortcutMatch", "IsMatch" }, // InputEvent - { "SkeletonAllocate", "SkeletonAllocateData" }, // RenderingServer - { "SurfaceUpdateRegion", "SurfaceUpdateAttributeRegion" }, // ArrayMesh - { "TargetingMethod", "TweenMethod" }, // Tween - { "TargetingProperty", "TweenProperty" }, // Tween - { "TrackRemoveKeyAtPosition", "TrackRemoveKeyAtTime" }, // Animation - { "TriangulateDelaunay2d", "TriangulateDelaunay" }, // Geometry2D - { "UnbindChildNodeFromBone", "RemoveBoneChild" }, // Skeleton3D - { "Unselect", "Deselect" }, // ItemList - { "UnselectAll", "DeselectAll" }, // ItemList - { "UpdateConfigurationWarning", "UpdateConfigurationWarnings" }, // Node - { "UpdateGizmo", "UpdateGizmos" }, // Node3D - { "ViewportSetUseArvr", "ViewportSetUseXr" }, // RenderingServer - { "WarpMousePosition", "WarpMouse" }, // Input - { "WorldToMap", "LocalToMap" }, // TileMap, GridMap - { "SetShaderParam", "SetShaderParameter" }, // ShaderMaterial - { "GetShaderParam", "GetShaderParameter" }, // ShaderMaterial - { "SetUniformName", "SetParameterName" }, // ParameterRef - { "GetUniformName", "GetParameterName" }, // ParameterRef - - // Builtin types - // { "Empty", "IsEmpty" }, // Array - Used as custom rule // Be careful, this will be used everywhere - { "Clamped", "Clamp" }, // Vector2 // Be careful, this will be used everywhere - { "GetRotationQuat", "GetRotationQuaternion" }, // Basis - { "GrowMargin", "GrowSide" }, // Rect2 - { "Invert", "Reverse" }, // Array - TODO check // Be careful, this will be used everywhere - { "IsAbsPath", "IsAbsolutePath" }, // String - { "IsValidInteger", "IsValidInt" }, // String - { "LinearInterpolate", "Lerp" }, // Color - { "ToAscii", "ToAsciiBuffer" }, // String - { "ToUtf8", "ToUtf8Buffer" }, // String - { "ToWchar", "ToUtf32Buffer" }, // String // TODO - utf32 or utf16? - - // @GlobalScope - { "Bytes2Var", "BytesToVar" }, - { "Bytes2VarWithObjects", "BytesToVarWithObjects" }, - { "Db2Linear", "DbToLinear" }, - { "Deg2Rad", "DegToRad" }, - { "Linear2Db", "LinearToDb" }, - { "Rad2Deg", "RadToDeg" }, - { "RandRange", "RandfRange" }, - { "RangeLerp", "Remap" }, - { "Stepify", "Snapped" }, - { "Str2Var", "StrToVar" }, - { "Var2Str", "VarToStr" }, - { "Var2Bytes", "VarToBytes" }, - { "Var2BytesWithObjects", "VarToBytesWithObjects" }, - - // @GDScript - { "Dict2Inst", "DictToInst" }, - { "Inst2Dict", "InstToDict" }, - - { nullptr, nullptr }, -}; - -// Some needs to be disabled, because users can use this names as variables -const char *ProjectConverter3To4::gdscript_properties_renames[][2] = { - // // { "d", "distance" }, //WorldMarginShape2D - TODO, looks that polish letters Ä… Ä™ are treaten as space, not as letter, so `bÄ™dÄ…` are renamed to `bÄ™distanceÄ…` - // // {"alt","alt_pressed"}, // This may broke a lot of comments and user variables - // // {"command","command_pressed"},// This may broke a lot of comments and user variables - // // {"control","ctrl_pressed"},// This may broke a lot of comments and user variables - // // {"extends","size"}, // BoxShape3D, LightmapGI broke ReflectionProbe - // // {"meta","meta_pressed"},// This may broke a lot of comments and user variables - // // {"pause_mode","process_mode"}, // Node - Cyclic rename, look for others - // // {"rotate","rotates"}, // PathFollow2D - probably function exists with same name - // // {"offset","progress"}, // PathFollow2D, PathFollow3D - Name is way too vague - // // {"shift","shift_pressed"},// This may broke a lot of comments and user variables - // { "autowrap", "autowrap_mode" }, // Label - // { "cast_to", "target_position" }, // RayCast2D, RayCast3D - // { "device", "output_device"}, // AudioServer - Too vague, most likely breaks comments & variables - // { "doubleclick", "double_click" }, // InputEventMouseButton - // { "group", "button_group" }, // BaseButton - // { "process_mode", "process_callback" }, // AnimationTree, Camera2D - // { "scancode", "keycode" }, // InputEventKey - // { "toplevel", "top_level" }, // Node - // { "window_title", "title" }, // Window - // { "wrap_enabled", "wrap_mode" }, // TextEdit - // { "zfar", "far" }, // Camera3D - // { "znear", "near" }, // Camera3D - // { "filename", "scene_file_path" }, // Node - // { "pressed", "button_pressed" }, // BaseButton - Will also rename the signal, skipping for now - { "as_normalmap", "as_normal_map" }, // NoiseTexture - { "bbcode_text", "text" }, // RichTextLabel - { "bg", "panel" }, // Theme - { "bg_focus", "focus" }, // Theme - { "capture_device", "input_device" }, // AudioServer - { "caret_blink_speed", "caret_blink_interval" }, // TextEdit, LineEdit - { "caret_moving_by_right_click", "caret_move_on_right_click" }, // TextEdit - { "caret_position", "caret_column" }, // LineEdit - { "check_vadjust", "check_v_offset" }, // Theme - { "close_h_ofs", "close_h_offset" }, // Theme - { "close_v_ofs", "close_v_offset" }, // Theme - { "commentfocus", "comment_focus" }, // Theme - { "contacts_reported", "max_contacts_reported" }, // RigidBody - { "depth_bias_enable", "depth_bias_enabled" }, // RDPipelineRasterizationState - { "drag_margin_bottom", "drag_bottom_margin" }, // Camera2D - { "drag_margin_h_enabled", "drag_horizontal_enabled" }, // Camera2D - { "drag_margin_left", "drag_left_margin" }, // Camera2D - { "drag_margin_right", "drag_right_margin" }, // Camera2D - { "drag_margin_top", "drag_top_margin" }, // Camera2D - { "drag_margin_v_enabled", "drag_vertical_enabled" }, // Camera2D - { "enabled_focus_mode", "focus_mode" }, // BaseButton - Removed - { "extra_spacing_bottom", "spacing_bottom" }, // Font - { "extra_spacing_top", "spacing_top" }, // Font - { "focus_neighbour_bottom", "focus_neighbor_bottom" }, // Control - { "focus_neighbour_left", "focus_neighbor_left" }, // Control - { "focus_neighbour_right", "focus_neighbor_right" }, // Control - { "focus_neighbour_top", "focus_neighbor_top" }, // Control - { "follow_viewport_enable", "follow_viewport_enabled" }, // CanvasItem - { "file_icon_modulate", "file_icon_color" }, // Theme - { "files_disabled", "file_disabled_color" }, // Theme - { "folder_icon_modulate", "folder_icon_color" }, // Theme - { "global_rate_scale", "playback_speed_scale" }, // AudioServer - { "gravity_distance_scale", "gravity_point_unit_distance" }, // Area(2D/3D) - { "gravity_vec", "gravity_direction" }, // Area(2D/3D) - { "hint_tooltip", "tooltip_text" }, // Control - { "hseparation", "h_separation" }, // Theme - { "icon_align", "icon_alignment" }, // Button - { "iterations_per_second", "physics_ticks_per_second" }, // Engine - { "invert_enable", "invert_enabled" }, // Polygon2D - { "margin_bottom", "offset_bottom" }, // Control broke NinePatchRect, StyleBox - { "margin_left", "offset_left" }, // Control broke NinePatchRect, StyleBox - { "margin_right", "offset_right" }, // Control broke NinePatchRect, StyleBox - { "margin_top", "offset_top" }, // Control broke NinePatchRect, StyleBox - { "mid_height", "height" }, // CapsuleMesh - { "neighbor_dist", "neighbor_distance" }, // NavigationAgent2D, NavigationAgent3D - { "offset_h", "drag_horizontal_offset" }, // Camera2D - { "offset_v", "drag_vertical_offset" }, // Camera2D - { "off", "unchecked" }, // Theme - { "off_disabled", "unchecked_disabled" }, // Theme - { "ofs", "offset" }, // Theme - { "on", "checked" }, // Theme - { "on_disabled", "checked_disabled" }, // Theme - { "oneshot", "one_shot" }, // AnimatedTexture - { "out_of_range_mode", "max_polyphony" }, // AudioStreamPlayer3D - { "pause_mode", "process_mode" }, // Node - { "physical_scancode", "physical_keycode" }, // InputEventKey - { "popup_exclusive", "exclusive" }, // Window - { "proximity_fade_enable", "proximity_fade_enabled" }, // Material - { "rect_position", "position" }, // Control - { "rect_global_position", "global_position" }, // Control - { "rect_size", "size" }, // Control - { "rect_min_size", "custom_minimum_size" }, // Control - { "rect_rotation", "rotation" }, // Control - { "rect_scale", "scale" }, // Control - { "rect_pivot_offset", "pivot_offset" }, // Control - { "rect_clip_content", "clip_contents" }, // Control - { "refuse_new_network_connections", "refuse_new_connections" }, // MultiplayerAPI - { "region_filter_clip", "region_filter_clip_enabled" }, // Sprite2D - { "reverb_bus_enable", "reverb_bus_enabled" }, // Area3D - { "selectedframe", "selected_frame" }, // Theme - { "size_override_stretch", "size_2d_override_stretch" }, // SubViewport - { "slips_on_slope", "slide_on_slope" }, // SeparationRayShape2D - { "smoothing_enabled", "follow_smoothing_enabled" }, // Camera2D - { "smoothing_speed", "position_smoothing_speed" }, // Camera2D - { "ss_reflections_depth_tolerance", "ssr_depth_tolerance" }, // Environment - { "ss_reflections_enabled", "ssr_enabled" }, // Environment - { "ss_reflections_fade_in", "ssr_fade_in" }, // Environment - { "ss_reflections_fade_out", "ssr_fade_out" }, // Environment - { "ss_reflections_max_steps", "ssr_max_steps" }, // Environment - { "state_machine_selectedframe", "state_machine_selected_frame" }, // Theme - { "syntax_highlighting", "syntax_highlighter" }, // TextEdit - { "tab_align", "tab_alignment" }, // TabContainer - { "table_hseparation", "table_h_separation" }, // Theme - { "table_vseparation", "table_v_separation" }, // Theme - { "translation", "position" }, // Node3D - broke GLTFNode - { "unit_db", "volume_db" }, // AudioStreamPlayer3D - { "unit_offset", "progress_ratio" }, // PathFollow2D, PathFollow3D - { "vseparation", "v_separation" }, // Theme - { "frames", "sprite_frames" }, // AnimatedSprite2D, AnimatedSprite3D - - { nullptr, nullptr }, -}; - -// Some needs to be disabled, because users can use this names as variables -const char *ProjectConverter3To4::csharp_properties_renames[][2] = { - // // { "D", "Distance" }, //WorldMarginShape2D - TODO, looks that polish letters Ä… Ä™ are treaten as space, not as letter, so `bÄ™dÄ…` are renamed to `bÄ™distanceÄ…` - // // {"Alt","AltPressed"}, // This may broke a lot of comments and user variables - // // {"Command","CommandPressed"},// This may broke a lot of comments and user variables - // // {"Control","CtrlPressed"},// This may broke a lot of comments and user variables - // // {"Extends","Size"}, // BoxShape3D, LightmapGI broke ReflectionProbe - // // {"Meta","MetaPressed"},// This may broke a lot of comments and user variables - // // {"PauseMode","ProcessMode"}, // Node - Cyclic rename, look for others - // // {"Rotate","Rotates"}, // PathFollow2D - probably function exists with same name - // // {"Offset","Progress"}, // PathFollow2D, PathFollow3D - Name is way too vague - // // {"Shift","ShiftPressed"},// This may broke a lot of comments and user variables - // { "Autowrap", "AutowrapMode" }, // Label - // { "CastTo", "TargetPosition" }, // RayCast2D, RayCast3D - // { "Doubleclick", "DoubleClick" }, // InputEventMouseButton - // { "Group", "ButtonGroup" }, // BaseButton - // { "PercentVisible, "ShowPercentage}, // ProgressBar, conflicts with Label and RichTextLabel, but may be a worth it. - // { "ProcessMode", "ProcessCallback" }, // AnimationTree, Camera2D - // { "Scancode", "Keycode" }, // InputEventKey - // { "Toplevel", "TopLevel" }, // Node - // { "WindowTitle", "Title" }, // Window - // { "WrapEnabled", "WrapMode" }, // TextEdit - // { "Zfar", "Far" }, // Camera3D - // { "Znear", "Near" }, // Camera3D - // { "Pressed", "ButtonPressed" }, // BaseButton - Will also rename the signal, skipping for now - { "AsNormalmap", "AsNormalMap" }, // NoiseTexture - { "BbcodeText", "Text" }, // RichTextLabel - { "CaretBlinkSpeed", "CaretBlinkInterval" }, // TextEdit, LineEdit - { "CaretMovingByRightClick", "CaretMoveOnRightClick" }, // TextEdit - { "CaretPosition", "CaretColumn" }, // LineEdit - { "CheckVadjust", "CheckVAdjust" }, // Theme - { "CloseHOfs", "CloseHOffset" }, // Theme - { "CloseVOfs", "CloseVOffset" }, // Theme - { "Commentfocus", "CommentFocus" }, // Theme - { "DepthBiasEnable", "DepthBiasEnabled" }, // RDPipelineRasterizationState - { "DragMarginBottom", "DragBottomMargin" }, // Camera2D - { "DragMarginHEnabled", "DragHorizontalEnabled" }, // Camera2D - { "DragMarginLeft", "DragLeftMargin" }, // Camera2D - { "DragMarginRight", "DragRightMargin" }, // Camera2D - { "DragMarginTop", "DragTopMargin" }, // Camera2D - { "DragMarginVEnabled", "DragVerticalEnabled" }, // Camera2D - { "EnabledFocusMode", "FocusMode" }, // BaseButton - Removed - { "ExtraSpacingBottom", "SpacingBottom" }, // Font - { "ExtraSpacingTop", "SpacingTop" }, // Font - { "FocusNeighbourBottom", "FocusNeighborBottom" }, // Control - { "FocusNeighbourLeft", "FocusNeighborLeft" }, // Control - { "FocusNeighbourRight", "FocusNeighborRight" }, // Control - { "FocusNeighbourTop", "FocusNeighborTop" }, // Control - { "FollowViewportEnable", "FollowViewportEnabled" }, // CanvasItem - { "GlobalRateScale", "PlaybackSpeedScale" }, // AudioServer - { "GravityDistanceScale", "GravityPointDistanceScale" }, // Area2D - { "GravityVec", "GravityDirection" }, // Area2D - { "HintTooltip", "TooltipText" }, // Control - { "Hseparation", "HSeparation" }, // Theme - { "IconAlign", "IconAlignment" }, // Button - { "IterationsPerSecond", "PhysicsTicksPerSecond" }, // Engine - { "InvertEnable", "InvertEnabled" }, // Polygon2D - { "MarginBottom", "OffsetBottom" }, // Control broke NinePatchRect, StyleBox - { "MarginLeft", "OffsetLeft" }, // Control broke NinePatchRect, StyleBox - { "MarginRight", "OffsetRight" }, // Control broke NinePatchRect, StyleBox - { "MarginTop", "OffsetTop" }, // Control broke NinePatchRect, StyleBox - { "MidHeight", "Height" }, // CapsuleMesh - { "NeighborDist", "NeighborDistance" }, // NavigationAgent2D, NavigationAgent3D - { "OffsetH", "DragHorizontalOffset" }, // Camera2D - { "OffsetV", "DragVerticalOffset" }, // Camera2D - { "Ofs", "Offset" }, // Theme - { "Oneshot", "OneShot" }, // AnimatedTexture - { "OutOfRangeMode", "MaxPolyphony" }, // AudioStreamPlayer3D - { "PauseMode", "ProcessMode" }, // Node - { "PhysicalScancode", "PhysicalKeycode" }, // InputEventKey - { "PopupExclusive", "Exclusive" }, // Window - { "ProximityFadeEnable", "ProximityFadeEnabled" }, // Material - { "RectPosition", "Position" }, // Control - { "RectGlobalPosition", "GlobalPosition" }, // Control - { "RectSize", "Size" }, // Control - { "RectMinSize", "CustomMinimumSize" }, // Control - { "RectRotation", "Rotation" }, // Control - { "RectScale", "Scale" }, // Control - { "RectPivotOffset", "PivotOffset" }, // Control - { "RectClipContent", "ClipContents" }, // Control - { "RefuseNewNetworkConnections", "RefuseNewConnections" }, // MultiplayerAPI - { "RegionFilterClip", "RegionFilterClipEnabled" }, // Sprite2D - { "ReverbBusEnable", "ReverbBusEnabled" }, // Area3D - { "Selectedframe", "SelectedFrame" }, // Theme - { "SizeOverrideStretch", "Size2dOverrideStretch" }, // SubViewport - { "SlipsOnSlope", "SlideOnSlope" }, // SeparationRayShape2D - { "SmoothingEnabled", "FollowSmoothingEnabled" }, // Camera2D - { "SmoothingSpeed", "FollowSmoothingSpeed" }, // Camera2D - { "SsReflectionsDepthTolerance", "SsrDepthTolerance" }, // Environment - { "SsReflectionsEnabled", "SsrEnabled" }, // Environment - { "SsReflectionsFadeIn", "SsrFadeIn" }, // Environment - { "SsReflectionsFadeOut", "SsrFadeOut" }, // Environment - { "SsReflectionsMaxSteps", "SsrMaxSteps" }, // Environment - { "StateMachineSelectedframe", "StateMachineSelectedFrame" }, // Theme - { "SyntaxHighlighting", "SyntaxHighlighter" }, // TextEdit - { "TabAlign", "TabAlignment" }, // TabContainer - { "TableHseparation", "TableHSeparation" }, // Theme - { "TableVseparation", "TableVSeparation" }, // Theme - { "Translation", "Position" }, // Node3D - broke GLTFNode - { "UnitDb", "VolumeDb" }, // AudioStreamPlayer3D - { "UnitOffset", "ProgressRatio" }, // PathFollow2D, PathFollow3D - { "Vseparation", "VSeparation" }, // Theme - - { nullptr, nullptr }, -}; - -const char *ProjectConverter3To4::gdscript_signals_renames[][2] = { - // {"instantiate","instance"}, // FileSystemDock - // { "hide", "hidden" }, // CanvasItem - function with same name exists - // { "tween_all_completed","loop_finished"}, // Tween - TODO, not sure - // {"changed","settings_changed"}, // EditorSettings - { "about_to_show", "about_to_popup" }, // Popup - { "button_release", "button_released" }, // XRController3D - { "cancelled", "canceled" }, // AcceptDialog - { "item_double_clicked", "item_icon_double_clicked" }, // Tree - { "network_peer_connected", "peer_connected" }, // MultiplayerAPI - { "network_peer_disconnected", "peer_disconnected" }, // MultiplayerAPI - { "network_peer_packet", "peer_packet" }, // MultiplayerAPI - { "node_unselected", "node_deselected" }, // GraphEdit - { "offset_changed", "position_offset_changed" }, // GraphNode - { "settings_changed", "changed" }, // TileMap broke EditorSettings - { "skeleton_updated", "pose_updated" }, // - { "tab_close", "tab_closed" }, // TextEdit - { "tab_hover", "tab_hovered" }, // TextEdit - { "text_entered", "text_submitted" }, // LineEdit - { "tween_completed", "finished" }, // Tween - { "tween_step", "step_finished" }, // Tween - - { nullptr, nullptr }, -}; - -const char *ProjectConverter3To4::csharp_signals_renames[][2] = { - // {"Instantiate","Instance"}, // FileSystemDock - // { "Hide", "Hidden" }, // CanvasItem - function with same name exists - // { "TweenAllCompleted","LoopFinished"}, // Tween - TODO, not sure - // {"Changed","SettingsChanged"}, // EditorSettings - { "AboutToShow", "AboutToPopup" }, // Popup - { "ButtonRelease", "ButtonReleased" }, // XRController3D - { "NetworkPeerConnected", "PeerConnected" }, // MultiplayerAPI - { "NetworkPeerDisconnected", "PeerDisconnected" }, // MultiplayerAPI - { "NetworkPeerPacket", "PeerPacket" }, // MultiplayerAPI - { "NodeUnselected", "NodeDeselected" }, // GraphEdit - { "OffsetChanged", "PositionOffsetChanged" }, // GraphNode - { "SettingsChanged", "Changed" }, // TileMap broke EditorSettings - { "SkeletonUpdated", "PoseUpdated" }, // - { "TabClose", "TabClosed" }, // TextEdit - { "TabHover", "TabHovered" }, // TextEdit - { "TextEntered", "TextSubmitted" }, // LineEdit - { "TweenCompleted", "Finished" }, // Tween - { "TweenStep", "StepFinished" }, // Tween - - { nullptr, nullptr }, - -}; - -const char *ProjectConverter3To4::project_settings_renames[][2] = { - { "audio/channel_disable_threshold_db", "audio/buses/channel_disable_threshold_db" }, - { "audio/channel_disable_time", "audio/buses/channel_disable_time" }, - { "audio/default_bus_layout", "audio/buses/default_bus_layout" }, - { "audio/driver", "audio/driver/driver" }, - { "audio/enable_audio_input", "audio/driver/enable_input" }, - { "audio/mix_rate", "audio/driver/mix_rate" }, - { "audio/output_latency", "audio/driver/output_latency" }, - { "audio/output_latency.web", "audio/driver/output_latency.web" }, - { "audio/video_delay_compensation_ms", "audio/video/video_delay_compensation_ms" }, - { "display/window/vsync/use_vsync", "display/window/vsync/vsync_mode" }, - { "editor/main_run_args", "editor/run/main_run_args" }, - { "gui/common/swap_ok_cancel", "gui/common/swap_cancel_ok" }, - { "network/limits/debugger_stdout/max_chars_per_second", "network/limits/debugger/max_chars_per_second" }, - { "network/limits/debugger_stdout/max_errors_per_second", "network/limits/debugger/max_errors_per_second" }, - { "network/limits/debugger_stdout/max_messages_per_frame", "network/limits/debugger/max_queued_messages" }, - { "network/limits/debugger_stdout/max_warnings_per_second", "network/limits/debugger/max_warnings_per_second" }, - { "network/ssl/certificates", "network/tls/certificate_bundle_override" }, - { "physics/2d/thread_model", "physics/2d/run_on_thread" }, // TODO not sure - { "rendering/environment/default_clear_color", "rendering/environment/defaults/default_clear_color" }, - { "rendering/environment/default_environment", "rendering/environment/defaults/default_environment" }, - { "rendering/quality/depth_prepass/disable_for_vendors", "rendering/driver/depth_prepass/disable_for_vendors" }, - { "rendering/quality/depth_prepass/enable", "rendering/driver/depth_prepass/enable" }, - { "rendering/quality/shading/force_blinn_over_ggx", "rendering/shading/overrides/force_blinn_over_ggx" }, - { "rendering/quality/shading/force_blinn_over_ggx.mobile", "rendering/shading/overrides/force_blinn_over_ggx.mobile" }, - { "rendering/quality/shading/force_lambert_over_burley", "rendering/shading/overrides/force_lambert_over_burley" }, - { "rendering/quality/shading/force_lambert_over_burley.mobile", "rendering/shading/overrides/force_lambert_over_burley.mobile" }, - { "rendering/quality/shading/force_vertex_shading", "rendering/shading/overrides/force_vertex_shading" }, - { "rendering/quality/shading/force_vertex_shading.mobile", "rendering/shading/overrides/force_vertex_shading.mobile" }, - { "rendering/quality/shadow_atlas/quadrant_0_subdiv", "rendering/lights_and_shadows/shadow_atlas/quadrant_0_subdiv" }, - { "rendering/quality/shadow_atlas/quadrant_1_subdiv", "rendering/lights_and_shadows/shadow_atlas/quadrant_1_subdiv" }, - { "rendering/quality/shadow_atlas/quadrant_2_subdiv", "rendering/lights_and_shadows/shadow_atlas/quadrant_2_subdiv" }, - { "rendering/quality/shadow_atlas/quadrant_3_subdiv", "rendering/lights_and_shadows/shadow_atlas/quadrant_3_subdiv" }, - { "rendering/quality/shadow_atlas/size", "rendering/lights_and_shadows/shadow_atlas/size" }, - { "rendering/quality/shadow_atlas/size.mobile", "rendering/lights_and_shadows/shadow_atlas/size.mobile" }, - { "rendering/vram_compression/import_etc2", "rendering/textures/vram_compression/import_etc2_astc" }, - { "rendering/vram_compression/import_s3tc", "rendering/textures/vram_compression/import_s3tc_bptc" }, - { "window/size/width", "window/size/viewport_width" }, - { "window/size/height", "window/size/viewport_height" }, - { "window/size/test_width", "window/size/window_width_override" }, - { "window/size/test_height", "window/size/window_height_override" }, - - { nullptr, nullptr }, -}; - -const char *ProjectConverter3To4::input_map_renames[][2] = { - { ",\"alt\":", ",\"alt_pressed\":" }, - { ",\"shift\":", ",\"shift_pressed\":" }, - { ",\"control\":", ",\"ctrl_pressed\":" }, - { ",\"meta\":", ",\"meta_pressed\":" }, - { ",\"scancode\":", ",\"keycode\":" }, - { ",\"physical_scancode\":", ",\"physical_keycode\":" }, - { ",\"doubleclick\":", ",\"double_click\":" }, - - { nullptr, nullptr }, -}; - -const char *ProjectConverter3To4::builtin_types_renames[][2] = { - { "PoolByteArray", "PackedByteArray" }, - { "PoolColorArray", "PackedColorArray" }, - { "PoolIntArray", "PackedInt32Array" }, - { "PoolRealArray", "PackedFloat32Array" }, - { "PoolStringArray", "PackedStringArray" }, - { "PoolVector2Array", "PackedVector2Array" }, - { "PoolVector3Array", "PackedVector3Array" }, - { "Quat", "Quaternion" }, - { "Transform", "Transform3D" }, - - { nullptr, nullptr }, -}; - -const char *ProjectConverter3To4::shaders_renames[][2] = { - { "ALPHA_SCISSOR", "ALPHA_SCISSOR_THRESHOLD" }, - { "CAMERA_MATRIX", "INV_VIEW_MATRIX" }, - { "INV_CAMERA_MATRIX", "VIEW_MATRIX" }, - { "NORMALMAP", "NORMAL_MAP" }, - { "NORMALMAP_DEPTH", "NORMAL_MAP_DEPTH" }, - { "TRANSMISSION", "BACKLIGHT" }, - { "WORLD_MATRIX", "MODEL_MATRIX" }, - { "depth_draw_alpha_prepass", "depth_draw_opaque" }, - { "hint_albedo", "source_color" }, - { "hint_aniso", "hint_anisotropy" }, - { "hint_black", "hint_default_black" }, - { "hint_black_albedo", "hint_default_black" }, - { "hint_color", "source_color" }, - { "hint_white", "hint_default_white" }, - { nullptr, nullptr }, -}; - -const char *ProjectConverter3To4::class_renames[][2] = { - // { "BulletPhysicsDirectBodyState", "BulletPhysicsDirectBodyState3D" }, // Class is not visible in ClassDB - // { "BulletPhysicsServer", "BulletPhysicsServer3D" }, // Class is not visible in ClassDB - // { "GDScriptFunctionState", "Node3D" }, // TODO - not sure to which should be changed - // { "GDScriptNativeClass", "Node3D" }, // TODO - not sure to which should be changed - // { "InputDefault",""}, // TODO ? - // { "Physics2DDirectBodyStateSW", "GodotPhysicsDirectBodyState2D" }, // Class is not visible in ClassDB - // { "Physics2DShapeQueryResult", "PhysicsShapeQueryResult2D" }, // Class is not visible in ClassDB - // { "PhysicsShapeQueryResult", "PhysicsShapeQueryResult3D" }, // Class is not visible in ClassDB - // { "NativeScript","GDExtension"}, ?? - { "ARVRAnchor", "XRAnchor3D" }, - { "ARVRCamera", "XRCamera3D" }, - { "ARVRController", "XRController3D" }, - { "ARVRInterface", "XRInterface" }, - { "ARVRInterfaceGDNative", "Node3D" }, - { "ARVROrigin", "XROrigin3D" }, - { "ARVRPositionalTracker", "XRPositionalTracker" }, - { "ARVRServer", "XRServer" }, - { "AStar", "AStar3D" }, - { "AnimatedSprite", "AnimatedSprite2D" }, - { "AnimationTreePlayer", "AnimationTree" }, - { "Area", "Area3D" }, // Be careful, this will be used everywhere - { "AudioStreamOGGVorbis", "AudioStreamOggVorbis" }, - { "AudioStreamRandomPitch", "AudioStreamRandomizer" }, - { "AudioStreamSample", "AudioStreamWAV" }, - { "BakedLightmap", "LightmapGI" }, - { "BakedLightmapData", "LightmapGIData" }, - { "BitmapFont", "FontFile" }, - { "BoneAttachment", "BoneAttachment3D" }, - { "BoxShape", "BoxShape3D" }, - { "CPUParticles", "CPUParticles3D" }, - { "CSGBox", "CSGBox3D" }, - { "CSGCombiner", "CSGCombiner3D" }, - { "CSGCylinder", "CSGCylinder3D" }, - { "CSGMesh", "CSGMesh3D" }, - { "CSGPolygon", "CSGPolygon3D" }, - { "CSGPrimitive", "CSGPrimitive3D" }, - { "CSGShape", "CSGShape3D" }, - { "CSGSphere", "CSGSphere3D" }, - { "CSGTorus", "CSGTorus3D" }, - { "Camera", "Camera3D" }, // Be careful, this will be used everywhere - { "CapsuleShape", "CapsuleShape3D" }, - { "ClippedCamera", "Camera3D" }, - { "CollisionObject", "CollisionObject3D" }, - { "CollisionPolygon", "CollisionPolygon3D" }, - { "CollisionShape", "CollisionShape3D" }, - { "ConcavePolygonShape", "ConcavePolygonShape3D" }, - { "ConeTwistJoint", "ConeTwistJoint3D" }, - { "ConvexPolygonShape", "ConvexPolygonShape3D" }, - { "CubeMap", "Cubemap" }, - { "CubeMesh", "BoxMesh" }, - { "CylinderShape", "CylinderShape3D" }, - { "DirectionalLight", "DirectionalLight3D" }, - { "DynamicFont", "FontFile" }, - { "DynamicFontData", "FontFile" }, - { "EditorNavigationMeshGenerator", "NavigationMeshGenerator" }, - { "EditorSceneImporter", "EditorSceneFormatImporter" }, - { "EditorSceneImporterFBX", "EditorSceneFormatImporterFBX" }, - { "EditorSceneImporterGLTF", "EditorSceneFormatImporterGLTF" }, - { "EditorSpatialGizmo", "EditorNode3DGizmo" }, - { "EditorSpatialGizmoPlugin", "EditorNode3DGizmoPlugin" }, - { "ExternalTexture", "ImageTexture" }, - { "FuncRef", "Callable" }, - { "GIProbe", "VoxelGI" }, - { "GIProbeData", "VoxelGIData" }, - { "Generic6DOFJoint", "Generic6DOFJoint3D" }, - { "Geometry", "Geometry2D" }, // Geometry class is split between Geometry2D and Geometry3D so we need to choose one - { "GeometryInstance", "GeometryInstance3D" }, - { "GradientTexture", "GradientTexture2D" }, - { "HeightMapShape", "HeightMapShape3D" }, - { "HingeJoint", "HingeJoint3D" }, - { "IP_Unix", "IPUnix" }, - { "ImmediateGeometry", "ImmediateMesh" }, - { "ImmediateGeometry3D", "ImmediateMesh" }, - { "InterpolatedCamera", "Camera3D" }, - { "InterpolatedCamera3D", "Camera3D" }, - { "JSONParseResult", "JSON" }, - { "Joint", "Joint3D" }, - { "KinematicBody", "CharacterBody3D" }, - { "KinematicBody2D", "CharacterBody2D" }, - { "KinematicCollision", "KinematicCollision3D" }, - { "LargeTexture", "ImageTexture" }, - { "Light", "Light3D" }, - { "Light2D", "PointLight2D" }, - { "LineShape2D", "WorldBoundaryShape2D" }, - { "Listener", "AudioListener3D" }, - { "Listener2D", "AudioListener2D" }, - { "MeshInstance", "MeshInstance3D" }, - { "MultiMeshInstance", "MultiMeshInstance3D" }, - { "MultiplayerPeerGDNative", "MultiplayerPeerExtension" }, - { "Navigation", "Node3D" }, - { "Navigation2D", "Node2D" }, - { "Navigation2DServer", "NavigationServer2D" }, - { "Navigation3D", "Node3D" }, - { "NavigationAgent", "NavigationAgent3D" }, - { "NavigationMeshInstance", "NavigationRegion3D" }, - { "NavigationObstacle", "NavigationObstacle3D" }, - { "NavigationPolygonInstance", "NavigationRegion2D" }, - { "NavigationRegion", "NavigationRegion3D" }, - { "NavigationServer", "NavigationServer3D" }, - { "NetworkedMultiplayerENet", "ENetMultiplayerPeer" }, - { "NetworkedMultiplayerPeer", "MultiplayerPeer" }, - { "Occluder", "OccluderInstance3D" }, - { "OmniLight", "OmniLight3D" }, - { "PHashTranslation", "OptimizedTranslation" }, - { "PacketPeerGDNative", "PacketPeerExtension" }, - { "PanoramaSky", "Sky" }, - { "Particles", "GPUParticles3D" }, // Be careful, this will be used everywhere - { "Particles2D", "GPUParticles2D" }, - { "ParticlesMaterial", "ParticleProcessMaterial" }, - { "Path", "Path3D" }, // Be careful, this will be used everywhere - { "PathFollow", "PathFollow3D" }, - { "PhysicalBone", "PhysicalBone3D" }, - { "Physics2DDirectBodyState", "PhysicsDirectBodyState2D" }, - { "Physics2DDirectSpaceState", "PhysicsDirectSpaceState2D" }, - { "Physics2DServer", "PhysicsServer2D" }, - { "Physics2DServerSW", "GodotPhysicsServer2D" }, - { "Physics2DShapeQueryParameters", "PhysicsShapeQueryParameters2D" }, - { "Physics2DTestMotionResult", "PhysicsTestMotionResult2D" }, - { "PhysicsBody", "PhysicsBody3D" }, - { "PhysicsDirectBodyState", "PhysicsDirectBodyState3D" }, - { "PhysicsDirectSpaceState", "PhysicsDirectSpaceState3D" }, - { "PhysicsServer", "PhysicsServer3D" }, - { "PhysicsShapeQueryParameters", "PhysicsShapeQueryParameters3D" }, - { "PhysicsTestMotionResult", "PhysicsTestMotionResult3D" }, - { "PinJoint", "PinJoint3D" }, - { "PlaneShape", "WorldBoundaryShape3D" }, - { "PopupDialog", "Popup" }, - { "Position2D", "Marker2D" }, - { "Position3D", "Marker3D" }, - { "ProceduralSky", "Sky" }, - { "RayCast", "RayCast3D" }, - { "RayShape", "SeparationRayShape3D" }, - { "RayShape2D", "SeparationRayShape2D" }, - { "Reference", "RefCounted" }, // Be careful, this will be used everywhere - { "RemoteTransform", "RemoteTransform3D" }, - { "ResourceInteractiveLoader", "ResourceLoader" }, - { "RigidBody", "RigidBody3D" }, - { "SceneTreeTween", "Tween" }, - { "Shape", "Shape3D" }, // Be careful, this will be used everywhere - { "ShortCut", "Shortcut" }, - { "Skeleton", "Skeleton3D" }, - { "SkeletonIK", "SkeletonIK3D" }, - { "SliderJoint", "SliderJoint3D" }, - { "SoftBody", "SoftBody3D" }, - { "Spatial", "Node3D" }, - { "SpatialGizmo", "Node3DGizmo" }, - { "SpatialMaterial", "StandardMaterial3D" }, - { "SphereShape", "SphereShape3D" }, - { "SpotLight", "SpotLight3D" }, - { "SpringArm", "SpringArm3D" }, - { "Sprite", "Sprite2D" }, - { "StaticBody", "StaticBody3D" }, - { "StreamCubemap", "CompressedCubemap" }, - { "StreamCubemapArray", "CompressedCubemapArray" }, - { "StreamPeerGDNative", "StreamPeerExtension" }, - { "StreamPeerSSL", "StreamPeerTLS" }, - { "StreamTexture", "CompressedTexture2D" }, - { "StreamTexture2D", "CompressedTexture2D" }, - { "StreamTexture2DArray", "CompressedTexture2DArray" }, - { "StreamTextureLayered", "CompressedTextureLayered" }, - { "TCP_Server", "TCPServer" }, - { "Tabs", "TabBar" }, // Be careful, this will be used everywhere - { "TextFile", "Node3D" }, - { "Texture", "Texture2D" }, // May broke TextureRect - { "TextureArray", "Texture2DArray" }, - { "TextureProgress", "TextureProgressBar" }, - { "ToolButton", "Button" }, - { "VehicleBody", "VehicleBody3D" }, - { "VehicleWheel", "VehicleWheel3D" }, - { "VideoPlayer", "VideoStreamPlayer" }, - { "Viewport", "SubViewport" }, - { "ViewportContainer", "SubViewportContainer" }, - { "VisibilityEnabler", "VisibleOnScreenEnabler3D" }, - { "VisibilityEnabler2D", "VisibleOnScreenEnabler2D" }, - { "VisibilityNotifier", "VisibleOnScreenNotifier3D" }, - { "VisibilityNotifier2D", "VisibleOnScreenNotifier2D" }, - { "VisibilityNotifier3D", "VisibleOnScreenNotifier3D" }, - { "VisualInstance", "VisualInstance3D" }, - { "VisualServer", "RenderingServer" }, - { "VisualShaderNodeCubeMap", "VisualShaderNodeCubemap" }, - { "VisualShaderNodeScalarClamp", "VisualShaderNodeClamp" }, - { "VisualShaderNodeScalarConstant", "VisualShaderNodeFloatConstant" }, - { "VisualShaderNodeScalarFunc", "VisualShaderNodeFloatFunc" }, - { "VisualShaderNodeScalarInterp", "VisualShaderNodeMix" }, - { "VisualShaderNodeScalarOp", "VisualShaderNodeFloatOp" }, - { "VisualShaderNodeScalarSmoothStep", "VisualShaderNodeSmoothStep" }, - { "VisualShaderNodeScalarSwitch", "VisualShaderNodeSwitch" }, - { "VisualShaderNodeScalarTransformMult", "VisualShaderNodeTransformOp" }, - { "VisualShaderNodeTransformMult", "VisualShaderNode" }, - { "VisualShaderNodeVectorClamp", "VisualShaderNodeClamp" }, - { "VisualShaderNodeVectorInterp", "VisualShaderNodeMix" }, - { "VisualShaderNodeVectorScalarMix", "VisualShaderNodeMix" }, - { "VisualShaderNodeVectorScalarSmoothStep", "VisualShaderNodeSmoothStep" }, - { "VisualShaderNodeVectorScalarStep", "VisualShaderNodeStep" }, - { "VisualShaderNodeVectorSmoothStep", "VisualShaderNodeSmoothStep" }, - { "VisualShaderNodeBooleanUniform", "VisualShaderNodeBooleanParameter" }, - { "VisualShaderNodeColorUniform", "VisualShaderNodeColorParameter" }, - { "VisualShaderNodeScalarUniform", "VisualShaderNodeFloatParameter" }, - { "VisualShaderNodeCubemapUniform", "VisualShaderNodeCubemapParameter" }, - { "VisualShaderNodeTextureUniform", "VisualShaderNodeTexture2DParameter" }, - { "VisualShaderNodeTextureUniformTriplanar", "VisualShaderNodeTextureParameterTriplanar" }, - { "VisualShaderNodeTransformUniform", "VisualShaderNodeTransformParameter" }, - { "VisualShaderNodeVec3Uniform", "VisualShaderNodeVec3Parameter" }, - { "VisualShaderNodeUniform", "VisualShaderNodeParameter" }, - { "VisualShaderNodeUniformRef", "VisualShaderNodeParameterRef" }, - { "WebRTCDataChannelGDNative", "WebRTCDataChannelExtension" }, - { "WebRTCMultiplayer", "WebRTCMultiplayerPeer" }, - { "WebRTCPeerConnectionGDNative", "WebRTCPeerConnectionExtension" }, - { "WindowDialog", "Window" }, - { "World", "World3D" }, // Be careful, this will be used everywhere - { "XRAnchor", "XRAnchor3D" }, - { "XRController", "XRController3D" }, - { "XROrigin", "XROrigin3D" }, - { "YSort", "Node2D" }, - - { "CullInstance", "Node3D" }, // Probably this type needs to be added to Godot 4.0, since it is for now only available only in Godot 3.x - { "RoomGroup", "Node3D" }, // Probably this type needs to be added to Godot 4.0, since it is for now only available only in Godot 3.x - { "Room", "Node3D" }, // Probably this type needs to be added to Godot 4.0, since it is for now only available only in Godot 3.x - { "RoomManager", "Node3D" }, // Probably this type needs to be added to Godot 4.0, since it is for now only available only in Godot 3.x - { "Portal", "Node3D" }, // Probably this type needs to be added to Godot 4.0, since it is for now only available only in Godot 3.x - - { nullptr, nullptr }, -}; - -const char *ProjectConverter3To4::ProjectConverter3To4::color_renames[][2] = { - { "aliceblue", "ALICE_BLUE" }, - { "antiquewhite", "ANTIQUE_WHITE" }, - { "aqua", "AQUA" }, - { "aquamarine", "AQUAMARINE" }, - { "azure", "AZURE" }, - { "beige", "BEIGE" }, - { "bisque", "BISQUE" }, - { "black", "BLACK" }, - { "blanchedalmond", "BLANCHED_ALMOND" }, - { "blue", "BLUE" }, - { "blueviolet", "BLUE_VIOLET" }, - { "brown", "BROWN" }, - { "burlywood", "BURLYWOOD" }, - { "cadetblue", "CADET_BLUE" }, - { "chartreuse", "CHARTREUSE" }, - { "chocolate", "CHOCOLATE" }, - { "coral", "CORAL" }, - { "cornflowerblue", "CORNFLOWER_BLUE" }, - { "cornsilk", "CORNSILK" }, - { "crimson", "CRIMSON" }, - { "cyan", "CYAN" }, - { "darkblue", "DARK_BLUE" }, - { "darkcyan", "DARK_CYAN" }, - { "darkgoldenrod", "DARK_GOLDENROD" }, - { "darkgray", "DARK_GRAY" }, - { "darkgreen", "DARK_GREEN" }, - { "darkkhaki", "DARK_KHAKI" }, - { "darkmagenta", "DARK_MAGENTA" }, - { "darkolivegreen", "DARK_OLIVE_GREEN" }, - { "darkorange", "DARK_ORANGE" }, - { "darkorchid", "DARK_ORCHID" }, - { "darkred", "DARK_RED" }, - { "darksalmon", "DARK_SALMON" }, - { "darkseagreen", "DARK_SEA_GREEN" }, - { "darkslateblue", "DARK_SLATE_BLUE" }, - { "darkslategray", "DARK_SLATE_GRAY" }, - { "darkturquoise", "DARK_TURQUOISE" }, - { "darkviolet", "DARK_VIOLET" }, - { "deeppink", "DEEP_PINK" }, - { "deepskyblue", "DEEP_SKY_BLUE" }, - { "dimgray", "DIM_GRAY" }, - { "dodgerblue", "DODGER_BLUE" }, - { "firebrick", "FIREBRICK" }, - { "floralwhite", "FLORAL_WHITE" }, - { "forestgreen", "FOREST_GREEN" }, - { "fuchsia", "FUCHSIA" }, - { "gainsboro", "GAINSBORO" }, - { "ghostwhite", "GHOST_WHITE" }, - { "gold", "GOLD" }, - { "goldenrod", "GOLDENROD" }, - { "gray", "GRAY" }, - { "green", "GREEN" }, - { "greenyellow", "GREEN_YELLOW" }, - { "honeydew", "HONEYDEW" }, - { "hotpink", "HOT_PINK" }, - { "indianred", "INDIAN_RED" }, - { "indigo", "INDIGO" }, - { "ivory", "IVORY" }, - { "khaki", "KHAKI" }, - { "lavender", "LAVENDER" }, - { "lavenderblush", "LAVENDER_BLUSH" }, - { "lawngreen", "LAWN_GREEN" }, - { "lemonchiffon", "LEMON_CHIFFON" }, - { "lightblue", "LIGHT_BLUE" }, - { "lightcoral", "LIGHT_CORAL" }, - { "lightcyan", "LIGHT_CYAN" }, - { "lightgoldenrod", "LIGHT_GOLDENROD" }, - { "lightgray", "LIGHT_GRAY" }, - { "lightgreen", "LIGHT_GREEN" }, - { "lightpink", "LIGHT_PINK" }, - { "lightsalmon", "LIGHT_SALMON" }, - { "lightseagreen", "LIGHT_SEA_GREEN" }, - { "lightskyblue", "LIGHT_SKY_BLUE" }, - { "lightslategray", "LIGHT_SLATE_GRAY" }, - { "lightsteelblue", "LIGHT_STEEL_BLUE" }, - { "lightyellow", "LIGHT_YELLOW" }, - { "lime", "LIME" }, - { "limegreen", "LIME_GREEN" }, - { "linen", "LINEN" }, - { "magenta", "MAGENTA" }, - { "maroon", "MAROON" }, - { "mediumaquamarine", "MEDIUM_AQUAMARINE" }, - { "mediumblue", "MEDIUM_BLUE" }, - { "mediumorchid", "MEDIUM_ORCHID" }, - { "mediumpurple", "MEDIUM_PURPLE" }, - { "mediumseagreen", "MEDIUM_SEA_GREEN" }, - { "mediumslateblue", "MEDIUM_SLATE_BLUE" }, - { "mediumspringgreen", "MEDIUM_SPRING_GREEN" }, - { "mediumturquoise", "MEDIUM_TURQUOISE" }, - { "mediumvioletred", "MEDIUM_VIOLET_RED" }, - { "midnightblue", "MIDNIGHT_BLUE" }, - { "mintcream", "MINT_CREAM" }, - { "mistyrose", "MISTY_ROSE" }, - { "moccasin", "MOCCASIN" }, - { "navajowhite", "NAVAJO_WHITE" }, - { "navyblue", "NAVY_BLUE" }, - { "oldlace", "OLD_LACE" }, - { "olive", "OLIVE" }, - { "olivedrab", "OLIVE_DRAB" }, - { "orange", "ORANGE" }, - { "orangered", "ORANGE_RED" }, - { "orchid", "ORCHID" }, - { "palegoldenrod", "PALE_GOLDENROD" }, - { "palegreen", "PALE_GREEN" }, - { "paleturquoise", "PALE_TURQUOISE" }, - { "palevioletred", "PALE_VIOLET_RED" }, - { "papayawhip", "PAPAYA_WHIP" }, - { "peachpuff", "PEACH_PUFF" }, - { "peru", "PERU" }, - { "pink", "PINK" }, - { "plum", "PLUM" }, - { "powderblue", "POWDER_BLUE" }, - { "purple", "PURPLE" }, - { "rebeccapurple", "REBECCA_PURPLE" }, - { "red", "RED" }, - { "rosybrown", "ROSY_BROWN" }, - { "royalblue", "ROYAL_BLUE" }, - { "saddlebrown", "SADDLE_BROWN" }, - { "salmon", "SALMON" }, - { "sandybrown", "SANDY_BROWN" }, - { "seagreen", "SEA_GREEN" }, - { "seashell", "SEASHELL" }, - { "sienna", "SIENNA" }, - { "silver", "SILVER" }, - { "skyblue", "SKY_BLUE" }, - { "slateblue", "SLATE_BLUE" }, - { "slategray", "SLATE_GRAY" }, - { "snow", "SNOW" }, - { "springgreen", "SPRING_GREEN" }, - { "steelblue", "STEEL_BLUE" }, - { "tan", "TAN" }, - { "teal", "TEAL" }, - { "thistle", "THISTLE" }, - { "tomato", "TOMATO" }, - { "transparent", "TRANSPARENT" }, - { "turquoise", "TURQUOISE" }, - { "violet", "VIOLET" }, - { "webgray", "WEB_GRAY" }, - { "webgreen", "WEB_GREEN" }, - { "webmaroon", "WEB_MAROON" }, - { "webpurple", "WEB_PURPLE" }, - { "wheat", "WHEAT" }, - { "white", "WHITE" }, - { "whitesmoke", "WHITE_SMOKE" }, - { "yellow", "YELLOW" }, - { "yellowgreen", "YELLOW_GREEN" }, - - { nullptr, nullptr }, -}; +#include "editor/renames_map_3_to_4.h" +#include "modules/regex/regex.h" // Find "OS.set_property(x)", capturing x into $1. static String make_regex_gds_os_property_set(String name_set) { @@ -1928,70 +166,71 @@ public: // Common. { // Enum. - for (unsigned int current_index = 0; enum_renames[current_index][0]; current_index++) { - enum_regexes.push_back(memnew(RegEx(String("\\b") + enum_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::enum_renames[current_index][0]; current_index++) { + enum_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::enum_renames[current_index][0] + "\\b"))); } // GDScript functions. - for (unsigned int current_index = 0; gdscript_function_renames[current_index][0]; current_index++) { - gdscript_function_regexes.push_back(memnew(RegEx(String("\\b") + gdscript_function_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::gdscript_function_renames[current_index][0]; current_index++) { + gdscript_function_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::gdscript_function_renames[current_index][0] + "\\b"))); } // Project Settings. - for (unsigned int current_index = 0; project_settings_renames[current_index][0]; current_index++) { - project_settings_regexes.push_back(memnew(RegEx(String("\\b") + project_settings_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::project_settings_renames[current_index][0]; current_index++) { + project_settings_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::project_settings_renames[current_index][0] + "\\b"))); } // Input Map. - for (unsigned int current_index = 0; input_map_renames[current_index][0]; current_index++) { - input_map_regexes.push_back(memnew(RegEx(String("\\b") + input_map_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::input_map_renames[current_index][0]; current_index++) { + input_map_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::input_map_renames[current_index][0] + "\\b"))); } // GDScript properties. - for (unsigned int current_index = 0; gdscript_properties_renames[current_index][0]; current_index++) { - gdscript_properties_regexes.push_back(memnew(RegEx(String("\\b") + gdscript_properties_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::gdscript_properties_renames[current_index][0]; current_index++) { + gdscript_properties_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::gdscript_properties_renames[current_index][0] + "\\b"))); } // GDScript Signals. - for (unsigned int current_index = 0; gdscript_signals_renames[current_index][0]; current_index++) { - gdscript_signals_regexes.push_back(memnew(RegEx(String("\\b") + gdscript_signals_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::gdscript_signals_renames[current_index][0]; current_index++) { + gdscript_signals_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::gdscript_signals_renames[current_index][0] + "\\b"))); } // Shaders. - for (unsigned int current_index = 0; shaders_renames[current_index][0]; current_index++) { - shaders_regexes.push_back(memnew(RegEx(String("\\b") + shaders_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::shaders_renames[current_index][0]; current_index++) { + shaders_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::shaders_renames[current_index][0] + "\\b"))); } // Builtin types. - for (unsigned int current_index = 0; builtin_types_renames[current_index][0]; current_index++) { - builtin_types_regexes.push_back(memnew(RegEx(String("\\b") + builtin_types_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::builtin_types_renames[current_index][0]; current_index++) { + builtin_types_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::builtin_types_renames[current_index][0] + "\\b"))); } // CSharp function renames. - for (unsigned int current_index = 0; csharp_function_renames[current_index][0]; current_index++) { - csharp_function_regexes.push_back(memnew(RegEx(String("\\b") + csharp_function_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::csharp_function_renames[current_index][0]; current_index++) { + csharp_function_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::csharp_function_renames[current_index][0] + "\\b"))); } // CSharp properties renames. - for (unsigned int current_index = 0; csharp_properties_renames[current_index][0]; current_index++) { - csharp_properties_regexes.push_back(memnew(RegEx(String("\\b") + csharp_properties_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::csharp_properties_renames[current_index][0]; current_index++) { + csharp_properties_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::csharp_properties_renames[current_index][0] + "\\b"))); } // CSharp signals renames. - for (unsigned int current_index = 0; csharp_signals_renames[current_index][0]; current_index++) { - csharp_signal_regexes.push_back(memnew(RegEx(String("\\b") + csharp_signals_renames[current_index][0] + "\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::csharp_signals_renames[current_index][0]; current_index++) { + csharp_signal_regexes.push_back(memnew(RegEx(String("\\b") + RenamesMap3To4::csharp_signals_renames[current_index][0] + "\\b"))); } } // Colors. { - for (unsigned int current_index = 0; color_renames[current_index][0]; current_index++) { - color_regexes.push_back(memnew(RegEx(String("\\bColor.") + color_renames[current_index][0] + "\\b"))); - color_renamed.push_back(String("Color.") + color_renames[current_index][1]); + for (unsigned int current_index = 0; RenamesMap3To4::color_renames[current_index][0]; current_index++) { + color_regexes.push_back(memnew(RegEx(String("\\bColor.") + RenamesMap3To4::color_renames[current_index][0] + "\\b"))); + color_renamed.push_back(String("Color.") + RenamesMap3To4::color_renames[current_index][1]); } } // Classes. { - for (unsigned int current_index = 0; class_renames[current_index][0]; current_index++) { - class_tscn_regexes.push_back(memnew(RegEx(String("\\b") + class_renames[current_index][0] + ".tscn\\b"))); - class_gd_regexes.push_back(memnew(RegEx(String("\\b") + class_renames[current_index][0] + ".gd\\b"))); - class_shader_regexes.push_back(memnew(RegEx(String("\\b") + class_renames[current_index][0] + ".shader\\b"))); + for (unsigned int current_index = 0; RenamesMap3To4::class_renames[current_index][0]; current_index++) { + const String class_name = RenamesMap3To4::class_renames[current_index][0]; + class_tscn_regexes.push_back(memnew(RegEx(String("\\b") + class_name + ".tscn\\b"))); + class_gd_regexes.push_back(memnew(RegEx(String("\\b") + class_name + ".gd\\b"))); + class_shader_regexes.push_back(memnew(RegEx(String("\\b") + class_name + ".shader\\b"))); - class_regexes.push_back(memnew(RegEx(String("\\b") + class_renames[current_index][0] + "\\b"))); + class_regexes.push_back(memnew(RegEx(String("\\b") + class_name + "\\b"))); - class_temp_tscn_renames.push_back(String(class_renames[current_index][0]) + ".tscn"); - class_temp_gd_renames.push_back(String(class_renames[current_index][0]) + ".gd"); - class_temp_shader_renames.push_back(String(class_renames[current_index][0]) + ".shader"); + class_temp_tscn_renames.push_back(class_name + ".tscn"); + class_temp_gd_renames.push_back(class_name + ".gd"); + class_temp_shader_renames.push_back(class_name + ".shader"); } } } @@ -2047,7 +286,7 @@ ProjectConverter3To4::ProjectConverter3To4(int p_maximum_file_size_kb, int p_max } // Function responsible for converting project. -int ProjectConverter3To4::convert() { +bool ProjectConverter3To4::convert() { print_line("Starting conversion."); uint64_t conversion_start_time = Time::get_singleton()->get_ticks_msec(); @@ -2056,8 +295,8 @@ int ProjectConverter3To4::convert() { int cached_maximum_line_length = maximum_line_length; maximum_line_length = 10000; // Use only for tests bigger value, to not break them. - ERR_FAIL_COND_V_MSG(!test_array_names(), ERROR_CODE, "Cannot start converting due to problems with data in arrays."); - ERR_FAIL_COND_V_MSG(!test_conversion(reg_container), ERROR_CODE, "Cannot start converting due to problems with converting arrays."); + ERR_FAIL_COND_V_MSG(!test_array_names(), false, "Cannot start converting due to problems with data in arrays."); + ERR_FAIL_COND_V_MSG(!test_conversion(reg_container), false, "Cannot start converting due to problems with converting arrays."); maximum_line_length = cached_maximum_line_length; @@ -2066,16 +305,16 @@ int ProjectConverter3To4::convert() { { String converter_text = "; Project was converted by built-in tool to Godot 4.0"; - ERR_FAIL_COND_V_MSG(!FileAccess::exists("project.godot"), ERROR_CODE, "Current working directory doesn't contain a \"project.godot\" file for a Godot 3 project."); + ERR_FAIL_COND_V_MSG(!FileAccess::exists("project.godot"), false, "Current working directory doesn't contain a \"project.godot\" file for a Godot 3 project."); Error err = OK; String project_godot_content = FileAccess::get_file_as_string("project.godot", &err); - ERR_FAIL_COND_V_MSG(err != OK, ERROR_CODE, "Unable to read \"project.godot\"."); - ERR_FAIL_COND_V_MSG(project_godot_content.contains(converter_text), ERROR_CODE, "Project was already converted with this tool."); + ERR_FAIL_COND_V_MSG(err != OK, false, "Unable to read \"project.godot\"."); + ERR_FAIL_COND_V_MSG(project_godot_content.contains(converter_text), false, "Project was already converted with this tool."); Ref<FileAccess> file = FileAccess::open("project.godot", FileAccess::WRITE); - ERR_FAIL_COND_V_MSG(file.is_null(), ERROR_CODE, "Unable to open \"project.godot\"."); + ERR_FAIL_COND_V_MSG(file.is_null(), false, "Unable to open \"project.godot\"."); file->store_string(converter_text + "\n" + project_godot_content); } @@ -2116,59 +355,59 @@ int ProjectConverter3To4::convert() { if (file_name.ends_with(".gd")) { rename_classes(lines, reg_container); // Using only specialized function. - rename_common(enum_renames, reg_container.enum_regexes, lines); + rename_common(RenamesMap3To4::enum_renames, reg_container.enum_regexes, lines); rename_colors(lines, reg_container); // Require to additional rename. - rename_common(gdscript_function_renames, reg_container.gdscript_function_regexes, lines); + rename_common(RenamesMap3To4::gdscript_function_renames, reg_container.gdscript_function_regexes, lines); rename_gdscript_functions(lines, reg_container, false); // Require to additional rename. - rename_common(project_settings_renames, reg_container.project_settings_regexes, lines); + rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines); rename_gdscript_keywords(lines, reg_container); - rename_common(gdscript_properties_renames, reg_container.gdscript_properties_regexes, lines); - rename_common(gdscript_signals_renames, reg_container.gdscript_signals_regexes, lines); - rename_common(shaders_renames, reg_container.shaders_regexes, lines); - rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines); + rename_common(RenamesMap3To4::gdscript_properties_renames, reg_container.gdscript_properties_regexes, lines); + rename_common(RenamesMap3To4::gdscript_signals_renames, reg_container.gdscript_signals_regexes, lines); + rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, lines); + rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines); custom_rename(lines, "\\.shader", ".gdshader"); } else if (file_name.ends_with(".tscn")) { rename_classes(lines, reg_container); // Using only specialized function. - rename_common(enum_renames, reg_container.enum_regexes, lines); + rename_common(RenamesMap3To4::enum_renames, reg_container.enum_regexes, lines); rename_colors(lines, reg_container); // Require to do additional renames. - rename_common(gdscript_function_renames, reg_container.gdscript_function_regexes, lines); + rename_common(RenamesMap3To4::gdscript_function_renames, reg_container.gdscript_function_regexes, lines); rename_gdscript_functions(lines, reg_container, true); // Require to do additional renames. - rename_common(project_settings_renames, reg_container.project_settings_regexes, lines); + rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines); rename_gdscript_keywords(lines, reg_container); - rename_common(gdscript_properties_renames, reg_container.gdscript_properties_regexes, lines); - rename_common(gdscript_signals_renames, reg_container.gdscript_signals_regexes, lines); - rename_common(shaders_renames, reg_container.shaders_regexes, lines); - rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines); + rename_common(RenamesMap3To4::gdscript_properties_renames, reg_container.gdscript_properties_regexes, lines); + rename_common(RenamesMap3To4::gdscript_signals_renames, reg_container.gdscript_signals_regexes, lines); + rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, lines); + rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines); custom_rename(lines, "\\.shader", ".gdshader"); } else if (file_name.ends_with(".cs")) { // TODO, C# should use different methods. rename_classes(lines, reg_container); // Using only specialized function. - rename_common(csharp_function_renames, reg_container.csharp_function_regexes, lines); - rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines); - rename_common(csharp_properties_renames, reg_container.csharp_properties_regexes, lines); - rename_common(csharp_signals_renames, reg_container.csharp_signal_regexes, lines); + rename_common(RenamesMap3To4::csharp_function_renames, reg_container.csharp_function_regexes, lines); + rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines); + rename_common(RenamesMap3To4::csharp_properties_renames, reg_container.csharp_properties_regexes, lines); + rename_common(RenamesMap3To4::csharp_signals_renames, reg_container.csharp_signal_regexes, lines); rename_csharp_functions(lines, reg_container); rename_csharp_attributes(lines, reg_container); custom_rename(lines, "public class ", "public partial class "); } else if (file_name.ends_with(".gdshader") || file_name.ends_with(".shader")) { - rename_common(shaders_renames, reg_container.shaders_regexes, lines); + rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, lines); } else if (file_name.ends_with("tres")) { rename_classes(lines, reg_container); // Using only specialized function. - rename_common(shaders_renames, reg_container.shaders_regexes, lines); - rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines); + rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, lines); + rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines); custom_rename(lines, "\\.shader", ".gdshader"); } else if (file_name.ends_with("project.godot")) { - rename_common(project_settings_renames, reg_container.project_settings_regexes, lines); - rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines); - rename_common(input_map_renames, reg_container.input_map_regexes, lines); + rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines); + rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines); + rename_common(RenamesMap3To4::input_map_renames, reg_container.input_map_regexes, lines); } else if (file_name.ends_with(".csproj")) { // TODO } else { @@ -2216,11 +455,11 @@ int ProjectConverter3To4::convert() { print_line(vformat("Conversion ended - all files(%d), converted files: (%d), not converted files: (%d).", collected_files.size(), converted_files, collected_files.size() - converted_files)); uint64_t conversion_end_time = Time::get_singleton()->get_ticks_msec(); print_line(vformat("Conversion of all files took %10.3f seconds.", (conversion_end_time - conversion_start_time) / 1000.0)); - return 0; -}; + return true; +} // Function responsible for validating project conversion. -int ProjectConverter3To4::validate_conversion() { +bool ProjectConverter3To4::validate_conversion() { print_line("Starting checking if project conversion can be done."); uint64_t conversion_start_time = Time::get_singleton()->get_ticks_msec(); @@ -2229,8 +468,8 @@ int ProjectConverter3To4::validate_conversion() { int cached_maximum_line_length = maximum_line_length; maximum_line_length = 10000; // To avoid breaking the tests, only use this for the their larger value. - ERR_FAIL_COND_V_MSG(!test_array_names(), ERROR_CODE, "Cannot start converting due to problems with data in arrays."); - ERR_FAIL_COND_V_MSG(!test_conversion(reg_container), ERROR_CODE, "Cannot start converting due to problems with converting arrays."); + ERR_FAIL_COND_V_MSG(!test_array_names(), false, "Cannot start converting due to problems with data in arrays."); + ERR_FAIL_COND_V_MSG(!test_conversion(reg_container), false, "Cannot start converting due to problems with converting arrays."); maximum_line_length = cached_maximum_line_length; @@ -2239,13 +478,13 @@ int ProjectConverter3To4::validate_conversion() { { String conventer_text = "; Project was converted by built-in tool to Godot 4.0"; - ERR_FAIL_COND_V_MSG(!FileAccess::exists("project.godot"), ERROR_CODE, "Current directory doesn't contains any Godot 3 project"); + ERR_FAIL_COND_V_MSG(!FileAccess::exists("project.godot"), false, "Current directory doesn't contains any Godot 3 project"); Error err = OK; String project_godot_content = FileAccess::get_file_as_string("project.godot", &err); - ERR_FAIL_COND_V_MSG(err != OK, ERROR_CODE, "Failed to read content of \"project.godot\" file."); - ERR_FAIL_COND_V_MSG(project_godot_content.contains(conventer_text), ERROR_CODE, "Project already was converted with this tool."); + ERR_FAIL_COND_V_MSG(err != OK, false, "Failed to read content of \"project.godot\" file."); + ERR_FAIL_COND_V_MSG(project_godot_content.contains(conventer_text), false, "Project already was converted with this tool."); } Vector<String> collected_files = check_for_files(); @@ -2282,59 +521,59 @@ int ProjectConverter3To4::validate_conversion() { if (file_name.ends_with(".gd")) { changed_elements.append_array(check_for_rename_classes(lines, reg_container)); - changed_elements.append_array(check_for_rename_common(enum_renames, reg_container.enum_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::enum_renames, reg_container.enum_regexes, lines)); changed_elements.append_array(check_for_rename_colors(lines, reg_container)); - changed_elements.append_array(check_for_rename_common(gdscript_function_renames, reg_container.gdscript_function_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::gdscript_function_renames, reg_container.gdscript_function_regexes, lines)); changed_elements.append_array(check_for_rename_gdscript_functions(lines, reg_container, false)); - changed_elements.append_array(check_for_rename_common(project_settings_renames, reg_container.project_settings_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines)); changed_elements.append_array(check_for_rename_gdscript_keywords(lines, reg_container)); - changed_elements.append_array(check_for_rename_common(gdscript_properties_renames, reg_container.gdscript_properties_regexes, lines)); - changed_elements.append_array(check_for_rename_common(gdscript_signals_renames, reg_container.gdscript_signals_regexes, lines)); - changed_elements.append_array(check_for_rename_common(shaders_renames, reg_container.shaders_regexes, lines)); - changed_elements.append_array(check_for_rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::gdscript_properties_renames, reg_container.gdscript_properties_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::gdscript_signals_renames, reg_container.gdscript_signals_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines)); changed_elements.append_array(check_for_custom_rename(lines, "\\.shader", ".gdshader")); } else if (file_name.ends_with(".tscn")) { changed_elements.append_array(check_for_rename_classes(lines, reg_container)); - changed_elements.append_array(check_for_rename_common(enum_renames, reg_container.enum_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::enum_renames, reg_container.enum_regexes, lines)); changed_elements.append_array(check_for_rename_colors(lines, reg_container)); - changed_elements.append_array(check_for_rename_common(gdscript_function_renames, reg_container.gdscript_function_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::gdscript_function_renames, reg_container.gdscript_function_regexes, lines)); changed_elements.append_array(check_for_rename_gdscript_functions(lines, reg_container, true)); - changed_elements.append_array(check_for_rename_common(project_settings_renames, reg_container.project_settings_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines)); changed_elements.append_array(check_for_rename_gdscript_keywords(lines, reg_container)); - changed_elements.append_array(check_for_rename_common(gdscript_properties_renames, reg_container.gdscript_properties_regexes, lines)); - changed_elements.append_array(check_for_rename_common(gdscript_signals_renames, reg_container.gdscript_signals_regexes, lines)); - changed_elements.append_array(check_for_rename_common(shaders_renames, reg_container.shaders_regexes, lines)); - changed_elements.append_array(check_for_rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::gdscript_properties_renames, reg_container.gdscript_properties_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::gdscript_signals_renames, reg_container.gdscript_signals_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines)); changed_elements.append_array(check_for_custom_rename(lines, "\\.shader", ".gdshader")); } else if (file_name.ends_with(".cs")) { changed_elements.append_array(check_for_rename_classes(lines, reg_container)); - changed_elements.append_array(check_for_rename_common(csharp_function_renames, reg_container.csharp_function_regexes, lines)); - changed_elements.append_array(check_for_rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines)); - changed_elements.append_array(check_for_rename_common(csharp_properties_renames, reg_container.csharp_properties_regexes, lines)); - changed_elements.append_array(check_for_rename_common(csharp_signals_renames, reg_container.csharp_signal_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::csharp_function_renames, reg_container.csharp_function_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::csharp_properties_renames, reg_container.csharp_properties_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::csharp_signals_renames, reg_container.csharp_signal_regexes, lines)); changed_elements.append_array(check_for_rename_csharp_functions(lines, reg_container)); changed_elements.append_array(check_for_rename_csharp_attributes(lines, reg_container)); changed_elements.append_array(check_for_custom_rename(lines, "public class ", "public partial class ")); } else if (file_name.ends_with(".gdshader") || file_name.ends_with(".shader")) { - changed_elements.append_array(check_for_rename_common(shaders_renames, reg_container.shaders_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, lines)); } else if (file_name.ends_with("tres")) { changed_elements.append_array(check_for_rename_classes(lines, reg_container)); - changed_elements.append_array(check_for_rename_common(shaders_renames, reg_container.shaders_regexes, lines)); - changed_elements.append_array(check_for_rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines)); changed_elements.append_array(check_for_custom_rename(lines, "\\.shader", ".gdshader")); } else if (file_name.ends_with("project.godot")) { - changed_elements.append_array(check_for_rename_common(project_settings_renames, reg_container.project_settings_regexes, lines)); - changed_elements.append_array(check_for_rename_common(builtin_types_renames, reg_container.builtin_types_regexes, lines)); - changed_elements.append_array(check_for_rename_common(input_map_renames, reg_container.input_map_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, lines)); + changed_elements.append_array(check_for_rename_common(RenamesMap3To4::input_map_renames, reg_container.input_map_regexes, lines)); } else if (file_name.ends_with(".csproj")) { // TODO } else { @@ -2375,7 +614,7 @@ int ProjectConverter3To4::validate_conversion() { print_line(vformat("Checking for valid conversion ended - all files(%d), files which would be converted(%d), files which would not be converted(%d).", collected_files.size(), converted_files, collected_files.size() - converted_files)); uint64_t conversion_end_time = Time::get_singleton()->get_ticks_msec(); print_line(vformat("Conversion of all files took %10.3f seconds.", (conversion_end_time - conversion_start_time) / 1000.0)); - return 0; + return true; } // Collect files which will be checked, excluding ".txt", ".mp4", ".wav" etc. files. @@ -2453,27 +692,27 @@ bool ProjectConverter3To4::test_conversion_basic(String name, String expected, c bool ProjectConverter3To4::test_conversion(RegExContainer ®_container) { bool valid = true; - valid = valid && test_conversion_basic("TYPE_REAL", "TYPE_FLOAT", enum_renames, reg_container.enum_regexes, "enum"); + valid = valid && test_conversion_basic("TYPE_REAL", "TYPE_FLOAT", RenamesMap3To4::enum_renames, reg_container.enum_regexes, "enum"); - valid = valid && test_conversion_basic("can_instance", "can_instantiate", gdscript_function_renames, reg_container.gdscript_function_regexes, "gdscript function"); + valid = valid && test_conversion_basic("can_instance", "can_instantiate", RenamesMap3To4::gdscript_function_renames, reg_container.gdscript_function_regexes, "gdscript function"); - valid = valid && test_conversion_basic("CanInstance", "CanInstantiate", csharp_function_renames, reg_container.csharp_function_regexes, "csharp function"); + valid = valid && test_conversion_basic("CanInstance", "CanInstantiate", RenamesMap3To4::csharp_function_renames, reg_container.csharp_function_regexes, "csharp function"); - valid = valid && test_conversion_basic("translation", "position", gdscript_properties_renames, reg_container.gdscript_properties_regexes, "gdscript property"); + valid = valid && test_conversion_basic("translation", "position", RenamesMap3To4::gdscript_properties_renames, reg_container.gdscript_properties_regexes, "gdscript property"); - valid = valid && test_conversion_basic("Translation", "Position", csharp_properties_renames, reg_container.csharp_properties_regexes, "csharp property"); + valid = valid && test_conversion_basic("Translation", "Position", RenamesMap3To4::csharp_properties_renames, reg_container.csharp_properties_regexes, "csharp property"); - valid = valid && test_conversion_basic("NORMALMAP", "NORMAL_MAP", shaders_renames, reg_container.shaders_regexes, "shader"); + valid = valid && test_conversion_basic("NORMALMAP", "NORMAL_MAP", RenamesMap3To4::shaders_renames, reg_container.shaders_regexes, "shader"); - valid = valid && test_conversion_basic("text_entered", "text_submitted", gdscript_signals_renames, reg_container.gdscript_signals_regexes, "gdscript signal"); + valid = valid && test_conversion_basic("text_entered", "text_submitted", RenamesMap3To4::gdscript_signals_renames, reg_container.gdscript_signals_regexes, "gdscript signal"); - valid = valid && test_conversion_basic("TextEntered", "TextSubmitted", csharp_signals_renames, reg_container.csharp_signal_regexes, "csharp signal"); + valid = valid && test_conversion_basic("TextEntered", "TextSubmitted", RenamesMap3To4::csharp_signals_renames, reg_container.csharp_signal_regexes, "csharp signal"); - valid = valid && test_conversion_basic("audio/channel_disable_threshold_db", "audio/buses/channel_disable_threshold_db", project_settings_renames, reg_container.project_settings_regexes, "project setting"); + valid = valid && test_conversion_basic("audio/channel_disable_threshold_db", "audio/buses/channel_disable_threshold_db", RenamesMap3To4::project_settings_renames, reg_container.project_settings_regexes, "project setting"); - valid = valid && test_conversion_basic("\"device\":-1,\"alt\":false,\"shift\":false,\"control\":false,\"meta\":false,\"doubleclick\":false,\"scancode\":0,\"physical_scancode\":16777254,\"script\":null", "\"device\":-1,\"alt_pressed\":false,\"shift_pressed\":false,\"ctrl_pressed\":false,\"meta_pressed\":false,\"double_click\":false,\"keycode\":0,\"physical_keycode\":16777254,\"script\":null", input_map_renames, reg_container.input_map_regexes, "input map"); + valid = valid && test_conversion_basic("\"device\":-1,\"alt\":false,\"shift\":false,\"control\":false,\"meta\":false,\"doubleclick\":false,\"scancode\":0,\"physical_scancode\":16777254,\"script\":null", "\"device\":-1,\"alt_pressed\":false,\"shift_pressed\":false,\"ctrl_pressed\":false,\"meta_pressed\":false,\"double_click\":false,\"keycode\":0,\"physical_keycode\":16777254,\"script\":null", RenamesMap3To4::input_map_renames, reg_container.input_map_regexes, "input map"); - valid = valid && test_conversion_basic("Transform", "Transform3D", builtin_types_renames, reg_container.builtin_types_regexes, "builtin type"); + valid = valid && test_conversion_basic("Transform", "Transform3D", RenamesMap3To4::builtin_types_renames, reg_container.builtin_types_regexes, "builtin type"); // Custom Renames. @@ -2787,9 +1026,9 @@ bool ProjectConverter3To4::test_array_names() { // Validate if all classes are valid. { - for (unsigned int current_index = 0; class_renames[current_index][0]; current_index++) { - const String old_class = class_renames[current_index][0]; - const String new_class = class_renames[current_index][1]; + for (unsigned int current_index = 0; RenamesMap3To4::class_renames[current_index][0]; current_index++) { + const String old_class = RenamesMap3To4::class_renames[current_index][0]; + const String new_class = RenamesMap3To4::class_renames[current_index][1]; // Light2D, Texture, Viewport are special classes(probably virtual ones). if (ClassDB::class_exists(StringName(old_class)) && old_class != "Light2D" && old_class != "Texture" && old_class != "Viewport") { @@ -2838,10 +1077,10 @@ bool ProjectConverter3To4::test_array_names() { } int current_element = 0; - while (gdscript_function_renames[current_element][0] != nullptr) { - String name_3_x = gdscript_function_renames[current_element][0]; - String name_4_0 = gdscript_function_renames[current_element][1]; - if (!all_functions.has(gdscript_function_renames[current_element][1])) { + while (RenamesMap3To4::gdscript_function_renames[current_element][0] != nullptr) { + String name_3_x = RenamesMap3To4::gdscript_function_renames[current_element][0]; + String name_4_0 = RenamesMap3To4::gdscript_function_renames[current_element][1]; + if (!all_functions.has(name_4_0)) { ERR_PRINT(vformat("Missing GDScript function in pair (%s - ===> %s <===)", name_3_x, name_4_0)); valid = false; } @@ -2852,18 +1091,18 @@ bool ProjectConverter3To4::test_array_names() { ERR_PRINT("Found function which is used in the converter, but it cannot be found in Godot 4. Rename this element or remove its entry if it's obsolete."); } - valid = valid && test_single_array(enum_renames); - valid = valid && test_single_array(class_renames, true); - valid = valid && test_single_array(gdscript_function_renames, true); - valid = valid && test_single_array(csharp_function_renames, true); - valid = valid && test_single_array(gdscript_properties_renames, true); - valid = valid && test_single_array(csharp_properties_renames, true); - valid = valid && test_single_array(shaders_renames, true); - valid = valid && test_single_array(gdscript_signals_renames); - valid = valid && test_single_array(project_settings_renames); - valid = valid && test_single_array(input_map_renames); - valid = valid && test_single_array(builtin_types_renames); - valid = valid && test_single_array(color_renames); + valid = valid && test_single_array(RenamesMap3To4::enum_renames); + valid = valid && test_single_array(RenamesMap3To4::class_renames, true); + valid = valid && test_single_array(RenamesMap3To4::gdscript_function_renames, true); + valid = valid && test_single_array(RenamesMap3To4::csharp_function_renames, true); + valid = valid && test_single_array(RenamesMap3To4::gdscript_properties_renames, true); + valid = valid && test_single_array(RenamesMap3To4::csharp_properties_renames, true); + valid = valid && test_single_array(RenamesMap3To4::shaders_renames, true); + valid = valid && test_single_array(RenamesMap3To4::gdscript_signals_renames); + valid = valid && test_single_array(RenamesMap3To4::project_settings_renames); + valid = valid && test_single_array(RenamesMap3To4::input_map_renames); + valid = valid && test_single_array(RenamesMap3To4::builtin_types_renames); + valid = valid && test_single_array(RenamesMap3To4::color_renames); return valid; } @@ -3092,7 +1331,7 @@ void ProjectConverter3To4::rename_colors(Vector<String> &lines, const RegExConta for (String &line : lines) { if (uint64_t(line.length()) <= maximum_line_length) { if (line.contains("Color.")) { - for (unsigned int current_index = 0; color_renames[current_index][0]; current_index++) { + for (unsigned int current_index = 0; RenamesMap3To4::color_renames[current_index][0]; current_index++) { line = reg_container.color_regexes[current_index]->sub(line, reg_container.color_renamed[current_index], true); } } @@ -3107,10 +1346,10 @@ Vector<String> ProjectConverter3To4::check_for_rename_colors(Vector<String> &lin for (String &line : lines) { if (uint64_t(line.length()) <= maximum_line_length) { if (line.contains("Color.")) { - for (unsigned int current_index = 0; color_renames[current_index][0]; current_index++) { + for (unsigned int current_index = 0; RenamesMap3To4::color_renames[current_index][0]; current_index++) { TypedArray<RegExMatch> reg_match = reg_container.color_regexes[current_index]->search_all(line); if (reg_match.size() > 0) { - found_renames.append(line_formatter(current_line, color_renames[current_index][0], color_renames[current_index][1], line)); + found_renames.append(line_formatter(current_line, RenamesMap3To4::color_renames[current_index][0], RenamesMap3To4::color_renames[current_index][1], line)); } } } @@ -3124,11 +1363,11 @@ Vector<String> ProjectConverter3To4::check_for_rename_colors(Vector<String> &lin void ProjectConverter3To4::rename_classes(Vector<String> &lines, const RegExContainer ®_container) { for (String &line : lines) { if (uint64_t(line.length()) <= maximum_line_length) { - for (unsigned int current_index = 0; class_renames[current_index][0]; current_index++) { - if (line.contains(class_renames[current_index][0])) { + for (unsigned int current_index = 0; RenamesMap3To4::class_renames[current_index][0]; current_index++) { + if (line.contains(RenamesMap3To4::class_renames[current_index][0])) { bool found_ignored_items = false; // Renaming Spatial.tscn to TEMP_RENAMED_CLASS.tscn. - if (line.contains(String(class_renames[current_index][0]) + ".")) { + if (line.contains(String(RenamesMap3To4::class_renames[current_index][0]) + ".")) { found_ignored_items = true; line = reg_container.class_tscn_regexes[current_index]->sub(line, "TEMP_RENAMED_CLASS.tscn", true); line = reg_container.class_gd_regexes[current_index]->sub(line, "TEMP_RENAMED_CLASS.gd", true); @@ -3136,7 +1375,7 @@ void ProjectConverter3To4::rename_classes(Vector<String> &lines, const RegExCont } // Causal renaming Spatial -> Node3D. - line = reg_container.class_regexes[current_index]->sub(line, class_renames[current_index][1], true); + line = reg_container.class_regexes[current_index]->sub(line, RenamesMap3To4::class_renames[current_index][1], true); // Restore Spatial.tscn from TEMP_RENAMED_CLASS.tscn. if (found_ignored_items) { @@ -3157,12 +1396,12 @@ Vector<String> ProjectConverter3To4::check_for_rename_classes(Vector<String> &li for (String &line : lines) { if (uint64_t(line.length()) <= maximum_line_length) { - for (unsigned int current_index = 0; class_renames[current_index][0]; current_index++) { - if (line.contains(class_renames[current_index][0])) { + for (unsigned int current_index = 0; RenamesMap3To4::class_renames[current_index][0]; current_index++) { + if (line.contains(RenamesMap3To4::class_renames[current_index][0])) { String old_line = line; bool found_ignored_items = false; // Renaming Spatial.tscn to TEMP_RENAMED_CLASS.tscn. - if (line.contains(String(class_renames[current_index][0]) + ".")) { + if (line.contains(String(RenamesMap3To4::class_renames[current_index][0]) + ".")) { found_ignored_items = true; line = reg_container.class_tscn_regexes[current_index]->sub(line, "TEMP_RENAMED_CLASS.tscn", true); line = reg_container.class_gd_regexes[current_index]->sub(line, "TEMP_RENAMED_CLASS.gd", true); @@ -3172,7 +1411,7 @@ Vector<String> ProjectConverter3To4::check_for_rename_classes(Vector<String> &li // Causal renaming Spatial -> Node3D. TypedArray<RegExMatch> reg_match = reg_container.class_regexes[current_index]->search_all(line); if (reg_match.size() > 0) { - found_renames.append(line_formatter(current_line, class_renames[current_index][0], class_renames[current_index][1], old_line)); + found_renames.append(line_formatter(current_line, RenamesMap3To4::class_renames[current_index][0], RenamesMap3To4::class_renames[current_index][1], old_line)); } // Restore Spatial.tscn from TEMP_RENAMED_CLASS.tscn. @@ -4353,17 +2592,6 @@ String ProjectConverter3To4::collect_string_from_vector(Vector<String> &vector) return string; } -#else // No RegEx. - -ProjectConverter3To4::ProjectConverter3To4(int _p_maximum_file_size_kb, int _p_maximum_line_length) {} - -int ProjectConverter3To4::convert() { - ERR_FAIL_V_MSG(ERROR_CODE, "Can't run converter for Godot 3.x projects, because RegEx module is disabled."); -} - -int ProjectConverter3To4::validate_conversion() { - ERR_FAIL_V_MSG(ERROR_CODE, "Can't validate conversion for Godot 3.x projects, because RegEx module is disabled."); -} - #endif // MODULE_REGEX_ENABLED + #endif // DISABLE_DEPRECATED diff --git a/editor/project_converter_3_to_4.h b/editor/project_converter_3_to_4.h index 641bc467ac..420dd79d72 100644 --- a/editor/project_converter_3_to_4.h +++ b/editor/project_converter_3_to_4.h @@ -33,31 +33,36 @@ #ifndef DISABLE_DEPRECATED -#include "core/io/file_access.h" -#include "core/object/ref_counted.h" +#include "modules/modules_enabled.gen.h" // For regex. + +#ifndef MODULE_REGEX_ENABLED + +#include "core/error/error_macros.h" + +class ProjectConverter3To4 { +public: + ProjectConverter3To4(int, int) {} + + bool validate_conversion() { + ERR_FAIL_V_MSG(false, "Can't validate conversion for Godot 3.x projects, because RegEx module is disabled."); + } + + bool convert() { + ERR_FAIL_V_MSG(false, "Can't run converter for Godot 3.x projects, because RegEx module is disabled."); + } +}; + +#else // Has regex. + #include "core/string/ustring.h" #include "core/templates/local_vector.h" +#include "core/templates/vector.h" class RegEx; class ProjectConverter3To4 { -public: class RegExContainer; - static const char *enum_renames[][2]; - static const char *gdscript_function_renames[][2]; - static const char *csharp_function_renames[][2]; - static const char *gdscript_properties_renames[][2]; - static const char *csharp_properties_renames[][2]; - static const char *gdscript_signals_renames[][2]; - static const char *csharp_signals_renames[][2]; - static const char *project_settings_renames[][2]; - static const char *input_map_renames[][2]; - static const char *builtin_types_renames[][2]; - static const char *shaders_renames[][2]; - static const char *class_renames[][2]; - static const char *color_renames[][2]; - -private: + uint64_t maximum_file_size; uint64_t maximum_line_length; @@ -108,10 +113,12 @@ private: public: ProjectConverter3To4(int, int); - int validate_conversion(); - int convert(); + bool validate_conversion(); + bool convert(); }; +#endif // MODULE_REGEX_ENABLED + #endif // DISABLE_DEPRECATED #endif // PROJECT_CONVERTER_3_TO_4_H diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 5d66be3853..dc019d8e7c 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1359,6 +1359,8 @@ void ProjectList::load_projects() { create_project_item_control(i); } + sort_projects(); + set_v_scroll(0); update_icons_async(); diff --git a/editor/renames_map_3_to_4.cpp b/editor/renames_map_3_to_4.cpp new file mode 100644 index 0000000000..4c47eac6a5 --- /dev/null +++ b/editor/renames_map_3_to_4.cpp @@ -0,0 +1,1797 @@ +/**************************************************************************/ +/* renames_map_3_to_4.cpp */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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 "renames_map_3_to_4.h" + +#ifndef DISABLE_DEPRECATED + +const char *RenamesMap3To4::enum_renames[][2] = { + //// constants + { "TYPE_COLOR_ARRAY", "TYPE_PACKED_COLOR_ARRAY" }, + { "TYPE_FLOAT64_ARRAY", "TYPE_PACKED_FLOAT64_ARRAY" }, + { "TYPE_INT64_ARRAY", "TYPE_PACKED_INT64_ARRAY" }, + { "TYPE_INT_ARRAY", "TYPE_PACKED_INT32_ARRAY" }, + { "TYPE_QUAT", "TYPE_QUATERNION" }, + { "TYPE_RAW_ARRAY", "TYPE_PACKED_BYTE_ARRAY" }, + { "TYPE_REAL", "TYPE_FLOAT" }, + { "TYPE_REAL_ARRAY", "TYPE_PACKED_FLOAT32_ARRAY" }, + { "TYPE_STRING_ARRAY", "TYPE_PACKED_STRING_ARRAY" }, + { "TYPE_TRANSFORM", "TYPE_TRANSFORM3D" }, + { "TYPE_VECTOR2_ARRAY", "TYPE_PACKED_VECTOR2_ARRAY" }, + { "TYPE_VECTOR3_ARRAY", "TYPE_PACKED_VECTOR3_ARRAY" }, + + // {"FLAG_MAX", "PARTICLE_FLAG_MAX"}, // CPUParticles2D - used in more classes + { "ALIGN_BEGIN", "ALIGNMENT_BEGIN" }, //AspectRatioContainer + { "ALIGN_CENTER", "ALIGNMENT_CENTER" }, //AspectRatioContainer + { "ALIGN_END", "ALIGNMENT_END" }, //AspectRatioContainer + { "ARRAY_COMPRESS_BASE", "ARRAY_COMPRESS_FLAGS_BASE" }, // Mesh + { "ARVR_AR", "XR_AR" }, // XRInterface + { "ARVR_EXCESSIVE_MOTION", "XR_EXCESSIVE_MOTION" }, // XRInterface + { "ARVR_EXTERNAL", "XR_EXTERNAL" }, // XRInterface + { "ARVR_INSUFFICIENT_FEATURES", "XR_INSUFFICIENT_FEATURES" }, // XRInterface + { "ARVR_MONO", "XR_MONO" }, // XRInterface + { "ARVR_NONE", "XR_NONE" }, // XRInterface + { "ARVR_NORMAL_TRACKING", "XR_NORMAL_TRACKING" }, // XRInterface + { "ARVR_NOT_TRACKING", "XR_NOT_TRACKING" }, // XRInterface + { "ARVR_STEREO", "XR_STEREO" }, // XRInterface + { "ARVR_UNKNOWN_TRACKING", "XR_UNKNOWN_TRACKING" }, // XRInterface + { "BAKE_ERROR_INVALID_MESH", "BAKE_ERROR_MESHES_INVALID" }, // LightmapGI + { "BODY_MODE_CHARACTER", "BODY_MODE_RIGID_LINEAR" }, // PhysicsServer + { "BUTTON_LEFT", "MOUSE_BUTTON_LEFT" }, // Globals + { "BUTTON_MASK_LEFT", "MOUSE_BUTTON_MASK_LEFT" }, // Globals + { "BUTTON_MASK_MIDDLE", "MOUSE_BUTTON_MASK_MIDDLE" }, // Globals + { "BUTTON_MASK_RIGHT", "MOUSE_BUTTON_MASK_RIGHT" }, // Globals + { "BUTTON_MASK_XBUTTON1", "MOUSE_BUTTON_MASK_XBUTTON1" }, // Globals + { "BUTTON_MASK_XBUTTON2", "MOUSE_BUTTON_MASK_XBUTTON2" }, // Globals + { "BUTTON_MIDDLE", "MOUSE_BUTTON_MIDDLE" }, // Globals + { "BUTTON_RIGHT", "MOUSE_BUTTON_RIGHT" }, // Globals + { "BUTTON_WHEEL_DOWN", "MOUSE_BUTTON_WHEEL_DOWN" }, // Globals + { "BUTTON_WHEEL_LEFT", "MOUSE_BUTTON_WHEEL_LEFT" }, // Globals + { "BUTTON_WHEEL_RIGHT", "MOUSE_BUTTON_WHEEL_RIGHT" }, // Globals + { "BUTTON_WHEEL_UP", "MOUSE_BUTTON_WHEEL_UP" }, // Globals + { "BUTTON_XBUTTON1", "MOUSE_BUTTON_XBUTTON1" }, // Globals + { "BUTTON_XBUTTON2", "MOUSE_BUTTON_XBUTTON2" }, // Globals + { "CLEAR_MODE_ONLY_NEXT_FRAME", "CLEAR_MODE_ONCE" }, // SubViewport + { "COMPRESS_PVRTC4", "COMPRESS_PVRTC1_4" }, // Image + { "CONNECT_ONESHOT", "CONNECT_ONE_SHOT" }, // Object + { "CONTAINER_PROPERTY_EDITOR_BOTTOM", "CONTAINER_INSPECTOR_BOTTOM" }, // EditorPlugin + { "CUBEMAP_BACK", "CUBEMAP_LAYER_BACK" }, // RenderingServer + { "CUBEMAP_BOTTOM", "CUBEMAP_LAYER_BOTTOM" }, // RenderingServer + { "CUBEMAP_FRONT", "CUBEMAP_LAYER_FRONT" }, // RenderingServer + { "CUBEMAP_LEFT", "CUBEMAP_LAYER_LEFT" }, // RenderingServer + { "CUBEMAP_RIGHT", "CUBEMAP_LAYER_RIGHT" }, // RenderingServer + { "CUBEMAP_TOP", "CUBEMAP_LAYER_TOP" }, // RenderingServer + { "DAMPED_STRING_DAMPING", "DAMPED_SPRING_DAMPING" }, // PhysicsServer2D + { "DAMPED_STRING_REST_LENGTH", "DAMPED_SPRING_REST_LENGTH" }, // PhysicsServer2D + { "DAMPED_STRING_STIFFNESS", "DAMPED_SPRING_STIFFNESS" }, // PhysicsServer2D + { "FLAG_ALIGN_Y_TO_VELOCITY", "PARTICLE_FLAG_ALIGN_Y_TO_VELOCITY" }, // CPUParticles2D + { "FLAG_DISABLE_Z", "PARTICLE_FLAG_DISABLE_Z" }, // CPUParticles2D + { "FLAG_ROTATE_Y", "PARTICLE_FLAG_ROTATE_Y" }, // CPUParticles2D + { "FLAG_USE_BAKED_LIGHT", "GI_MODE_BAKED" }, // GeometryInstance3D + { "FORMAT_PVRTC2", "FORMAT_PVRTC1_2" }, // Image + { "FORMAT_PVRTC2A", "FORMAT_PVRTC1_2A" }, // Image + { "FORMAT_PVRTC4", "FORMAT_PVRTC1_4" }, // Image + { "FORMAT_PVRTC4A", "FORMAT_PVRTC1_4A" }, // Image + { "FUNC_FRAC", "FUNC_FRACT" }, // VisualShaderNodeVectorFunc + { "INSTANCE_LIGHTMAP_CAPTURE", "INSTANCE_LIGHTMAP" }, // RenderingServer + { "JOINT_6DOF", "JOINT_TYPE_6DOF" }, // PhysicsServer3D + { "JOINT_CONE_TWIST", "JOINT_TYPE_CONE_TWIST" }, // PhysicsServer3D + { "JOINT_DAMPED_SPRING", "JOINT_TYPE_DAMPED_SPRING" }, // PhysicsServer2D + { "JOINT_GROOVE", "JOINT_TYPE_GROOVE" }, // PhysicsServer2D + { "JOINT_HINGE", "JOINT_TYPE_HINGE" }, // PhysicsServer3D + { "JOINT_PIN", "JOINT_TYPE_PIN" }, // PhysicsServer2D + { "JOINT_SLIDER", "JOINT_TYPE_SLIDER" }, // PhysicsServer3D + { "KEY_CONTROL", "KEY_CTRL" }, // Globals + { "LOOP_PING_PONG", "LOOP_PINGPONG" }, // AudioStreamWAV + { "MODE_KINEMATIC", "FREEZE_MODE_KINEMATIC" }, // RigidBody + { "MODE_OPEN_ANY", "FILE_MODE_OPEN_ANY" }, // FileDialog + { "MODE_OPEN_DIR", "FILE_MODE_OPEN_DIR" }, // FileDialog + { "MODE_OPEN_FILE", "FILE_MODE_OPEN_FILE" }, // FileDialog + { "MODE_OPEN_FILES", "FILE_MODE_OPEN_FILES" }, // FileDialog + { "MODE_SAVE_FILE", "FILE_MODE_SAVE_FILE" }, // FileDialog + { "MODE_STATIC", "FREEZE_MODE_STATIC" }, // RigidBody + { "NOTIFICATION_APP_PAUSED", "NOTIFICATION_APPLICATION_PAUSED" }, // MainLoop + { "NOTIFICATION_APP_RESUMED", "NOTIFICATION_APPLICATION_RESUMED" }, // MainLoop + { "NOTIFICATION_INSTANCED", "NOTIFICATION_SCENE_INSTANTIATED" }, // Node + { "NOTIFICATION_PATH_CHANGED", "NOTIFICATION_PATH_RENAMED" }, //Node + { "NOTIFICATION_WM_FOCUS_IN", "NOTIFICATION_APPLICATION_FOCUS_IN" }, // MainLoop + { "NOTIFICATION_WM_FOCUS_OUT", "NOTIFICATION_APPLICATION_FOCUS_OUT" }, // MainLoop + { "NOTIFICATION_WM_UNFOCUS_REQUEST", "NOTIFICATION_WM_WINDOW_FOCUS_OUT" }, //Node + { "PAUSE_MODE_INHERIT", "PROCESS_MODE_INHERIT" }, // Node + { "PAUSE_MODE_PROCESS", "PROCESS_MODE_ALWAYS" }, // Node + { "PAUSE_MODE_STOP", "PROCESS_MODE_PAUSABLE" }, // Node + { "RENDER_DRAW_CALLS_IN_FRAME", "RENDER_TOTAL_DRAW_CALLS_IN_FRAME" }, // Performance + { "RENDER_OBJECTS_IN_FRAME", "RENDER_TOTAL_OBJECTS_IN_FRAME" }, // Performance + { "SIDE_BOTTOM", "MARGIN_BOTTOM" }, // Globals + { "SIDE_LEFT", "MARGIN_LEFT" }, // Globals + { "SIDE_RIGHT", "MARGIN_RIGHT" }, // Globals + { "SIDE_TOP", "MARGIN_TOP" }, // Globals + { "TEXTURE_TYPE_2D_ARRAY", "TEXTURE_LAYERED_2D_ARRAY" }, // RenderingServer + { "TEXTURE_TYPE_CUBEMAP", "TEXTURE_LAYERED_CUBEMAP_ARRAY" }, // RenderingServer + { "TRACKER_LEFT_HAND", "TRACKER_HAND_LEFT" }, // XRPositionalTracker + { "TRACKER_RIGHT_HAND", "TRACKER_HAND_RIGHT" }, // XRPositionalTracker + { "TYPE_NORMALMAP", "TYPE_NORMAL_MAP" }, // VisualShaderNodeCubemap + + /// enums + { "AlignMode", "AlignmentMode" }, //AspectRatioContainer + { "AnimationProcessMode", "AnimationProcessCallback" }, // AnimationTree, AnimationPlayer + { "Camera2DProcessMode", "Camera2DProcessCallback" }, // Camera2D + { "CubeMapSide", "CubeMapLayer" }, // RenderingServer + { "DampedStringParam", "DampedSpringParam" }, // PhysicsServer2D + { "FFT_Size", "FFTSize" }, // AudioEffectPitchShift,AudioEffectSpectrumAnalyzer + { "PauseMode", "ProcessMode" }, // Node + { "TimerProcessMode", "TimerProcessCallback" }, // Timer + { "Tracking_status", "TrackingStatus" }, // XRInterface + { nullptr, nullptr }, +}; + +const char *RenamesMap3To4::gdscript_function_renames[][2] = { + // { "_set_name", "get_tracker_name"}, // XRPositionalTracker - CameraFeed use this + // { "_unhandled_input", "_unhandled_key_input"}, // BaseButton, ViewportContainer broke Node, FileDialog,SubViewportContainer + // { "create_gizmo", "_create_gizmo"}, // EditorNode3DGizmoPlugin - may be used + // { "get_dependencies", "_get_dependencies" }, // ResourceFormatLoader broke ResourceLoader + // { "get_extents", "get_size" }, // BoxShape, RectangleShape broke Decal, VoxelGI, GPUParticlesCollisionBox, GPUParticlesCollisionSDF, GPUParticlesCollisionHeightField, GPUParticlesAttractorBox, GPUParticlesAttractorVectorField, FogVolume + // { "get_h_offset", "get_drag_horizontal_offset"}, // Camera2D, broke PathFollow, Camera + // { "get_mode", "get_file_mode"}, // FileDialog broke Panel, Shader, CSGPolygon, Tilemap + // { "get_motion", "get_travel"}, // PhysicsTestMotionResult2D broke ParalaxLayer + // { "get_name", "get_tracker_name"}, // XRPositionalTracker broke OS, Node + // { "get_network_connected_peers", "get_peers"}, // MultiplayerAPI broke SceneTree + // { "get_network_peer", "has_multiplayer_peer"}, // MultiplayerAPI broke SceneTree + // { "get_network_unique_id", "get_unique_id"}, // MultiplayerAPI broke SceneTree + // { "get_offset", "get_position_offset" }, // GraphNode broke Gradient + // { "get_peer_port", "get_peer" }, // ENetMultiplayerPeer broke WebSocketServer + // { "get_process_mode", "get_process_callback" }, // ClippedCamera3D broke Node, Sky + // { "get_render_info", "get_rendering_info" }, // RenderingServer broke Viewport + // { "get_type", "get_tracker_type"}, // XRPositionalTracker broke GLTFAccessor, GLTFLight + // { "get_v_offset", "get_drag_vertical_offset"}, // Camera2D, broke PathFollow, Camera + // { "has_network_peer", "has_multiplayer_peer"}, // MultiplayerAPI broke SceneTree + // { "instance", "instantiate" }, // PackedScene, ClassDB - Broke FileSystemDock signal and also tscn files - [instance=ExtResource( 17 )] - this is implemented as custom rule + // { "is_listening", "is_bound"}, // PacketPeerUDP broke TCPServer, UDPServer + // { "is_refusing_new_network_connections", "is_refusing_new_connections"}, // MultiplayerAPI broke SceneTree + // { "is_valid", "has_valid_event" }, // Shortcut broke e.g. Callable + // { "listen", "bound"}, // PacketPeerUDP broke TCPServer, UDPServer + // { "load", "_load"}, // ResourceFormatLoader broke ConfigFile, Image, StreamTexture2D + // { "make_current", "set_current" }, // Camera2D broke Camera3D, Listener2D + // { "process", "_process" }, // AnimationNode - This word is commonly used + // { "save", "_save"}, // ResourceFormatLoader broke ConfigFile, Image, StreamTexture2D + // { "set_autowrap", "set_autowrap_mode" }, // AcceptDialog broke Label - Cyclic Rename + // { "set_color", "surface_set_color"}, // ImmediateMesh broke Light2D, Theme, SurfaceTool + // { "set_event", "set_shortcut" }, // BaseButton - Cyclic Rename + // { "set_extents", "set_size"}, // BoxShape, RectangleShape broke ReflectionProbe + // { "set_flag", "set_particle_flag"}, // ParticleProcessMaterial broke Window, HingeJoint3D + // { "set_h_offset", "set_drag_horizontal_offset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D + // { "set_margin", "set_offset" }, // Control broke Shape3D, AtlasTexture + // { "set_mode", "set_mode_file_mode" }, // FileDialog broke Panel, Shader, CSGPolygon, Tilemap + // { "set_normal", "surface_set_normal"}, // ImmediateGeometry broke SurfaceTool, WorldMarginShape2D + // { "set_offset", "set_progress" }, // PathFollow2D, PathFollow3D - Too common + // { "set_process_mode", "set_process_callback" }, // AnimationTree broke Node, Tween, Sky + // { "set_refuse_new_network_connections", "set_refuse_new_connections"}, // MultiplayerAPI broke SceneTree + // { "set_tooltip", "set_tooltip_text" }, // Control, breaks TreeItem, at least for now. + // { "set_uv", "surface_set_uv" }, // ImmediateMesh broke Polygon2D + // { "set_v_offset", "set_drag_vertical_offset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D + // {"get_points","get_points_id"},// Astar, broke Line2D, Convexpolygonshape + // {"get_v_scroll","get_v_scroll_bar"},//ItemList, broke TextView + // { "get_stylebox", "get_theme_stylebox" }, // Control - Will rename the method in Theme as well, skipping + { "_about_to_show", "_about_to_popup" }, // ColorPickerButton + { "_get_configuration_warning", "_get_configuration_warnings" }, // Node + { "_set_current", "set_current" }, // Camera2D + { "_set_editor_description", "set_editor_description" }, // Node + { "_toplevel_raise_self", "_top_level_raise_self" }, // CanvasItem + { "_update_wrap_at", "_update_wrap_at_column" }, // TextEdit + { "add_animation", "add_animation_library" }, // AnimationPlayer + { "add_cancel", "add_cancel_button" }, // AcceptDialog + { "add_central_force", "apply_central_force" }, //RigidBody2D + { "add_child_below_node", "add_sibling" }, // Node + { "add_color_override", "add_theme_color_override" }, // Control + { "add_constant_override", "add_theme_constant_override" }, // Control + { "add_font_override", "add_theme_font_override" }, // Control + { "add_force", "apply_force" }, //RigidBody2D + { "add_icon_override", "add_theme_icon_override" }, // Control + { "add_scene_import_plugin", "add_scene_format_importer_plugin" }, //EditorPlugin + { "add_spatial_gizmo_plugin", "add_node_3d_gizmo_plugin" }, // EditorPlugin + { "add_stylebox_override", "add_theme_stylebox_override" }, // Control + { "add_torque", "apply_torque" }, //RigidBody2D + { "agent_set_neighbor_dist", "agent_set_neighbor_distance" }, // NavigationServer2D, NavigationServer3D + { "apply_changes", "_apply_changes" }, // EditorPlugin + { "body_add_force", "body_apply_force" }, // PhysicsServer2D + { "body_add_torque", "body_apply_torque" }, // PhysicsServer2D + { "bumpmap_to_normalmap", "bump_map_to_normal_map" }, // Image + { "can_be_hidden", "_can_be_hidden" }, // EditorNode3DGizmoPlugin + { "can_drop_data", "_can_drop_data" }, // Control + { "can_generate_small_preview", "_can_generate_small_preview" }, // EditorResourcePreviewGenerator + { "can_instance", "can_instantiate" }, // PackedScene, Script + { "canvas_light_set_scale", "canvas_light_set_texture_scale" }, // RenderingServer + { "capture_get_device", "get_input_device" }, // AudioServer + { "capture_get_device_list", "get_input_device_list" }, // AudioServer + { "capture_set_device", "set_input_device" }, // AudioServer + { "center_viewport_to_cursor", "center_viewport_to_caret" }, // TextEdit + { "change_scene", "change_scene_to_file" }, // SceneTree + { "change_scene_to", "change_scene_to_packed" }, // SceneTree + { "clip_polygons_2d", "clip_polygons" }, // Geometry2D + { "clip_polyline_with_polygon_2d", "clip_polyline_with_polygon" }, //Geometry2D + { "commit_handle", "_commit_handle" }, // EditorNode3DGizmo + { "convex_hull_2d", "convex_hull" }, // Geometry2D + { "create_gizmo", "_create_gizmo" }, // EditorNode3DGizmoPlugin + { "cursor_get_blink_speed", "get_caret_blink_interval" }, // TextEdit + { "cursor_get_column", "get_caret_column" }, // TextEdit + { "cursor_get_line", "get_caret_line" }, // TextEdit + { "cursor_set_blink_enabled", "set_caret_blink_enabled" }, // TextEdit + { "cursor_set_blink_speed", "set_caret_blink_interval" }, // TextEdit + { "cursor_set_column", "set_caret_column" }, // TextEdit + { "cursor_set_line", "set_caret_line" }, // TextEdit + { "damped_spring_joint_create", "joint_make_damped_spring" }, // PhysicsServer2D + { "damped_string_joint_get_param", "damped_spring_joint_get_param" }, // PhysicsServer2D + { "damped_string_joint_set_param", "damped_spring_joint_set_param" }, // PhysicsServer2D + { "dectime", "move_toward" }, // GDScript, Math functions + { "delete_char_at_cursor", "delete_char_at_caret" }, // LineEdit + { "deselect_items", "deselect_all" }, // FileDialog + { "disable_plugin", "_disable_plugin" }, // EditorPlugin + { "drop_data", "_drop_data" }, // Control + { "exclude_polygons_2d", "exclude_polygons" }, // Geometry2D + { "find_node", "find_child" }, // Node + { "find_scancode_from_string", "find_keycode_from_string" }, // OS + { "forward_canvas_draw_over_viewport", "_forward_canvas_draw_over_viewport" }, // EditorPlugin + { "forward_canvas_force_draw_over_viewport", "_forward_canvas_force_draw_over_viewport" }, // EditorPlugin + { "forward_canvas_gui_input", "_forward_canvas_gui_input" }, // EditorPlugin + { "forward_spatial_draw_over_viewport", "_forward_3d_draw_over_viewport" }, // EditorPlugin + { "forward_spatial_force_draw_over_viewport", "_forward_3d_force_draw_over_viewport" }, // EditorPlugin + { "forward_spatial_gui_input", "_forward_3d_gui_input" }, // EditorPlugin + { "generate_from_path", "_generate_from_path" }, // EditorResourcePreviewGenerator + { "generate_small_preview_automatically", "_generate_small_preview_automatically" }, // EditorResourcePreviewGenerator + { "get_action_list", "action_get_events" }, // InputMap + { "get_alt", "is_alt_pressed" }, // InputEventWithModifiers + { "get_animation_process_mode", "get_process_callback" }, // AnimationPlayer + { "get_applied_force", "get_constant_force" }, //RigidBody2D + { "get_applied_torque", "get_constant_torque" }, //RigidBody2D + { "get_audio_bus", "get_audio_bus_name" }, // Area3D + { "get_bound_child_nodes_to_bone", "get_bone_children" }, // Skeleton3D + { "get_camera", "get_camera_3d" }, // Viewport -> this is also convertible to get_camera_2d, broke GLTFNode + { "get_cancel", "get_cancel_button" }, // ConfirmationDialog + { "get_caption", "_get_caption" }, // AnimationNode + { "get_cast_to", "get_target_position" }, // RayCast2D, RayCast3D + { "get_child_by_name", "_get_child_by_name" }, // AnimationNode + { "get_child_nodes", "_get_child_nodes" }, // AnimationNode + { "get_closest_point_to_segment_2d", "get_closest_point_to_segment" }, // Geometry2D + { "get_closest_point_to_segment_uncapped_2d", "get_closest_point_to_segment_uncapped" }, // Geometry2D + { "get_closest_points_between_segments_2d", "get_closest_point_to_segment" }, // Geometry2D + { "get_collision_layer_bit", "get_collision_layer_value" }, // CSGShape3D and a lot of others like GridMap + { "get_collision_mask_bit", "get_collision_mask_value" }, // CSGShape3D and a lot of others like GridMap + { "get_color_types", "get_color_type_list" }, // Theme + { "get_command", "is_command_or_control_pressed" }, // InputEventWithModifiers + { "get_constant_types", "get_constant_type_list" }, // Theme + { "get_control", "is_ctrl_pressed" }, // InputEventWithModifiers + { "get_cull_mask_bit", "get_cull_mask_value" }, // Camera3D + { "get_cursor_position", "get_caret_column" }, // LineEdit + { "get_d", "get_distance" }, // LineShape2D + { "get_depth_bias_enable", "get_depth_bias_enabled" }, // RDPipelineRasterizationState + { "get_device", "get_output_device" }, // AudioServer + { "get_device_list", "get_output_device_list" }, // AudioServer + { "get_drag_data", "_get_drag_data" }, // Control + { "get_editor_viewport", "get_editor_main_screen" }, // EditorPlugin + { "get_enabled_focus_mode", "get_focus_mode" }, // BaseButton + { "get_endian_swap", "is_big_endian" }, // File + { "get_error_string", "get_error_message" }, // JSON + { "get_filename", "get_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places + { "get_focus_neighbour", "get_focus_neighbor" }, // Control + { "get_follow_smoothing", "get_position_smoothing_speed" }, // Camera2D + { "get_font_types", "get_font_type_list" }, // Theme + { "get_frame_color", "get_color" }, // ColorRect + { "get_global_rate_scale", "get_playback_speed_scale" }, // AudioServer + { "get_gravity_distance_scale", "get_gravity_point_unit_distance" }, // Area(2D/3D) + { "get_gravity_vector", "get_gravity_direction" }, // Area(2D/3D) + { "get_h_scrollbar", "get_h_scroll_bar" }, //ScrollContainer + { "get_hand", "get_tracker_hand" }, // XRPositionalTracker + { "get_handle_name", "_get_handle_name" }, // EditorNode3DGizmo + { "get_handle_value", "_get_handle_value" }, // EditorNode3DGizmo + { "get_icon_align", "get_icon_alignment" }, // Button + { "get_icon_types", "get_icon_type_list" }, // Theme + { "get_idle_frames", "get_process_frames" }, // Engine + { "get_import_options", "_get_import_options" }, // EditorImportPlugin + { "get_import_order", "_get_import_order" }, // EditorImportPlugin + { "get_importer_name", "_get_importer_name" }, // EditorImportPlugin + { "get_interior_ambient", "get_ambient_color" }, // ReflectionProbe + { "get_interior_ambient_energy", "get_ambient_color_energy" }, // ReflectionProbe + { "get_iterations_per_second", "get_physics_ticks_per_second" }, // Engine + { "get_last_mouse_speed", "get_last_mouse_velocity" }, // Input + { "get_layer_mask_bit", "get_layer_mask_value" }, // VisualInstance3D + { "get_len", "get_length" }, // File + { "get_max_atlas_size", "get_max_texture_size" }, // LightmapGI + { "get_metakey", "is_meta_pressed" }, // InputEventWithModifiers + { "get_mid_height", "get_height" }, // CapsuleMesh + { "get_motion_remainder", "get_remainder" }, // PhysicsTestMotionResult2D + { "get_neighbor_dist", "get_neighbor_distance" }, // NavigationAgent2D, NavigationAgent3D + { "get_network_connected_peers", "get_peers" }, // Multiplayer API + { "get_network_master", "get_multiplayer_authority" }, // Node + { "get_network_peer", "get_multiplayer_peer" }, // Multiplayer API + { "get_network_unique_id", "get_unique_id" }, // Multiplayer API + { "get_ok", "get_ok_button" }, // AcceptDialog + { "get_oneshot", "get_one_shot" }, // AnimatedTexture + { "get_option_visibility", "_get_option_visibility" }, // EditorImportPlugin + { "get_parameter_default_value", "_get_parameter_default_value" }, // AnimationNode + { "get_parameter_list", "_get_parameter_list" }, // AnimationNode + { "get_parent_spatial", "get_parent_node_3d" }, // Node3D + { "get_pause_mode", "get_process_mode" }, // Node + { "get_physical_scancode", "get_physical_keycode" }, // InputEventKey + { "get_physical_scancode_with_modifiers", "get_physical_keycode_with_modifiers" }, // InputEventKey + { "get_plugin_icon", "_get_plugin_icon" }, // EditorPlugin + { "get_plugin_name", "_get_plugin_name" }, // EditorPlugin + { "get_preset_count", "_get_preset_count" }, // EditorImportPlugin + { "get_preset_name", "_get_preset_name" }, // EditorImportPlugin + { "get_recognized_extensions", "_get_recognized_extensions" }, // ResourceFormatLoader, EditorImportPlugin broke ResourceSaver + { "get_render_info", "get_rendering_info" }, // RenderingServer + { "get_render_targetsize", "get_render_target_size" }, // XRInterface + { "get_resource_type", "_get_resource_type" }, // ResourceFormatLoader + { "get_result", "get_data" }, //JSON + { "get_reverb_bus", "set_reverb_bus_name" }, // Area3D + { "get_rpc_sender_id", "get_remote_sender_id" }, // Multiplayer API + { "get_save_extension", "_get_save_extension" }, // EditorImportPlugin + { "get_scancode", "get_keycode" }, // InputEventKey + { "get_scancode_string", "get_keycode_string" }, // OS + { "get_scancode_with_modifiers", "get_keycode_with_modifiers" }, // InputEventKey + { "get_selected_path", "get_current_directory" }, // EditorInterface + { "get_shift", "is_shift_pressed" }, // InputEventWithModifiers + { "get_size_override", "get_size_2d_override" }, // SubViewport + { "get_slide_count", "get_slide_collision_count" }, // CharacterBody2D, CharacterBody3D + { "get_slips_on_slope", "get_slide_on_slope" }, // SeparationRayShape2D, SeparationRayShape3D + { "get_space_override_mode", "get_gravity_space_override_mode" }, // Area2D + { "get_spatial_node", "get_node_3d" }, // EditorNode3DGizmo + { "get_speed", "get_velocity" }, // InputEventMouseMotion + { "get_stylebox_types", "get_stylebox_type_list" }, // Theme + { "get_surface_material", "get_surface_override_material" }, // MeshInstance3D broke ImporterMesh + { "get_surface_material_count", "get_surface_override_material_count" }, // MeshInstance3D + { "get_tab_disabled", "is_tab_disabled" }, // Tab + { "get_tab_hidden", "is_tab_hidden" }, // Tab + { "get_text_align", "get_text_alignment" }, // Button + { "get_theme_item_types", "get_theme_item_type_list" }, // Theme + { "get_timer_process_mode", "get_timer_process_callback" }, // Timer + { "get_translation", "get_position" }, // Node3D broke GLTFNode which is used rarely + { "get_unit_db", "get_volume_db" }, // AudioStreamPlayer3D + { "get_unit_offset", "get_progress_ratio" }, // PathFollow2D, PathFollow3D + { "get_use_in_baked_light", "is_baking_navigation" }, // GridMap + { "get_used_cells_by_id", "get_used_cells" }, // TileMap + { "get_v_scrollbar", "get_v_scroll_bar" }, //ScrollContainer + { "get_visible_name", "_get_visible_name" }, // EditorImportPlugin + { "get_window_layout", "_get_window_layout" }, // EditorPlugin + { "get_word_under_cursor", "get_word_under_caret" }, // TextEdit + { "get_world", "get_world_3d" }, // Viewport, Spatial + { "get_zfar", "get_far" }, // Camera3D broke GLTFCamera + { "get_znear", "get_near" }, // Camera3D broke GLTFCamera + { "groove_joint_create", "joint_make_groove" }, // PhysicsServer2D + { "handle_menu_selected", "_handle_menu_selected" }, // EditorResourcePicker + { "handles_type", "_handles_type" }, // ResourceFormatLoader + { "has_color", "has_theme_color" }, // Control broke Theme + { "has_color_override", "has_theme_color_override" }, // Control broke Theme + { "has_constant", "has_theme_constant" }, // Control + { "has_constant_override", "has_theme_constant_override" }, // Control + { "has_filter", "_has_filter" }, // AnimationNode + { "has_font", "has_theme_font" }, // Control broke Theme + { "has_font_override", "has_theme_font_override" }, // Control + { "has_icon", "has_theme_icon" }, // Control broke Theme + { "has_icon_override", "has_theme_icon_override" }, // Control + { "has_main_screen", "_has_main_screen" }, // EditorPlugin + { "has_network_peer", "has_multiplayer_peer" }, // Multiplayer API + { "has_stylebox", "has_theme_stylebox" }, // Control broke Theme + { "has_stylebox_override", "has_theme_stylebox_override" }, // Control + { "http_escape", "uri_encode" }, // String + { "http_unescape", "uri_decode" }, // String + { "import_scene_from_other_importer", "_import_scene" }, //EditorSceneFormatImporter + { "instance_set_surface_material", "instance_set_surface_override_material" }, // RenderingServer + { "interpolate", "sample" }, // Curve, Curve2D, Curve3D, Gradient + { "intersect_polygons_2d", "intersect_polygons" }, // Geometry2D + { "intersect_polyline_with_polygon_2d", "intersect_polyline_with_polygon" }, // Geometry2D + { "is_a_parent_of", "is_ancestor_of" }, // Node + { "is_commiting_action", "is_committing_action" }, // UndoRedo + { "is_doubleclick", "is_double_click" }, // InputEventMouseButton + { "is_draw_red", "is_draw_warning" }, // EditorProperty + { "is_follow_smoothing_enabled", "is_position_smoothing_enabled" }, // Camera2D + { "is_h_drag_enabled", "is_drag_horizontal_enabled" }, // Camera2D + { "is_handle_highlighted", "_is_handle_highlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin + { "is_inverting_faces", "get_flip_faces" }, // CSGPrimitive3D + { "is_network_master", "is_multiplayer_authority" }, // Node + { "is_network_server", "is_server" }, // Multiplayer API + { "is_normalmap", "is_normal_map" }, // NoiseTexture + { "is_refusing_new_network_connections", "is_refusing_new_connections" }, // Multiplayer API + { "is_region", "is_region_enabled" }, // Sprite2D + { "is_rotating", "is_ignoring_rotation" }, // Camera2D + { "is_scancode_unicode", "is_keycode_unicode" }, // OS + { "is_selectable_when_hidden", "_is_selectable_when_hidden" }, // EditorNode3DGizmoPlugin + { "is_set_as_toplevel", "is_set_as_top_level" }, // CanvasItem + { "is_shortcut", "matches_event" }, // Shortcut + { "is_size_override_stretch_enabled", "is_size_2d_override_stretch_enabled" }, // SubViewport + { "is_sort_enabled", "is_y_sort_enabled" }, // Node2D + { "is_static_body", "is_able_to_sleep" }, // PhysicalBone3D - TODO - not sure + { "is_v_drag_enabled", "is_drag_vertical_enabled" }, // Camera2D + { "joint_create_cone_twist", "joint_make_cone_twist" }, // PhysicsServer3D + { "joint_create_generic_6dof", "joint_make_generic_6dof" }, // PhysicsServer3D + { "joint_create_hinge", "joint_make_hinge" }, // PhysicsServer3D + { "joint_create_pin", "joint_make_pin" }, // PhysicsServer3D + { "joint_create_slider", "joint_make_slider" }, // PhysicsServer3D + { "line_intersects_line_2d", "line_intersects_line" }, // Geometry2D + { "load_from_globals", "load_from_project_settings" }, // InputMap + { "load_interactive", "load_threaded_request" }, // ResourceLoader - load_threaded_request is alternative, but is used differently + { "make_convex_from_brothers", "make_convex_from_siblings" }, // CollisionShape3D + { "make_visible", "_make_visible" }, // EditorPlugin + { "merge_polygons_2d", "merge_polygons" }, // Geometry2D + { "mesh_surface_get_format", "mesh_surface_get_format_attribute_stride" }, // RenderingServer + { "mesh_surface_update_region", "mesh_surface_update_attribute_region" }, // RenderingServer + { "move_to_bottom", "move_after" }, // Skeleton3D + { "move_to_top", "move_before" }, // Skeleton3D + { "multimesh_allocate", "multimesh_allocate_data" }, // RenderingServer + { "normalmap_to_xy", "normal_map_to_xy" }, // Image + { "offset_polygon_2d", "offset_polygon" }, // Geometry2D + { "offset_polyline_2d", "offset_polyline" }, // Geometry2D + { "percent_decode", "uri_decode" }, // String + { "percent_encode", "uri_encode" }, // String + { "pin_joint_create", "joint_make_pin" }, // PhysicsServer2D + { "popup_centered_minsize", "popup_centered_clamped" }, // Window + { "post_import", "_post_import" }, // EditorScenePostImport + { "print_stray_nodes", "print_orphan_nodes" }, // Node + { "property_list_changed_notify", "notify_property_list_changed" }, // Object + { "raise", "move_to_front" }, // CanvasItem + { "recognize", "_recognize" }, // ResourceFormatLoader + { "regen_normalmaps", "regen_normal_maps" }, // ArrayMesh + { "remove", "remove_at" }, // Array, broke Directory + { "remove_animation", "remove_animation_library" }, // AnimationPlayer + { "remove_color_override", "remove_theme_color_override" }, // Control + { "remove_constant_override", "remove_theme_constant_override" }, // Control + { "remove_font_override", "remove_theme_font_override" }, // Control + { "remove_icon_override", "remove_theme_icon_override" }, // Control + { "remove_scene_import_plugin", "remove_scene_format_importer_plugin" }, //EditorPlugin + { "remove_spatial_gizmo_plugin", "remove_node_3d_gizmo_plugin" }, // EditorPlugin + { "remove_stylebox_override", "remove_theme_stylebox_override" }, // Control + { "rename_animation", "rename_animation_library" }, // AnimationPlayer + { "rename_dependencies", "_rename_dependencies" }, // ResourceFormatLoader + { "save_external_data", "_save_external_data" }, // EditorPlugin + { "segment_intersects_segment_2d", "segment_intersects_segment" }, // Geometry2D + { "set_adjustment_enable", "set_adjustment_enabled" }, // Environment + { "set_alt", "set_alt_pressed" }, // InputEventWithModifiers + { "set_anchor_and_margin", "set_anchor_and_offset" }, // Control + { "set_anchors_and_margins_preset", "set_anchors_and_offsets_preset" }, // Control + { "set_animation_process_mode", "set_process_callback" }, // AnimationPlayer + { "set_as_bulk_array", "set_buffer" }, // MultiMesh + { "set_as_normalmap", "set_as_normal_map" }, // NoiseTexture + { "set_as_toplevel", "set_as_top_level" }, // CanvasItem + { "set_audio_bus", "set_audio_bus_name" }, // Area3D + { "set_autowrap", "set_autowrap_mode" }, // Label broke AcceptDialog + { "set_cast_to", "set_target_position" }, // RayCast2D, RayCast3D + { "set_collision_layer_bit", "set_collision_layer_value" }, // CSGShape3D and a lot of others like GridMap + { "set_collision_mask_bit", "set_collision_mask_value" }, // CSGShape3D and a lot of others like GridMap + { "set_column_min_width", "set_column_custom_minimum_width" }, // Tree + { "set_command", "set_meta_pressed" }, // InputEventWithModifiers + { "set_control", "set_ctrl_pressed" }, // InputEventWithModifiers + { "set_create_options", "_set_create_options" }, // EditorResourcePicker + { "set_cull_mask_bit", "set_cull_mask_value" }, // Camera3D + { "set_cursor_position", "set_caret_column" }, // LineEdit + { "set_d", "set_distance" }, // WorldMarginShape2D + { "set_depth_bias_enable", "set_depth_bias_enabled" }, // RDPipelineRasterizationState + { "set_device", "set_output_device" }, // AudioServer + { "set_doubleclick", "set_double_click" }, // InputEventMouseButton + { "set_draw_red", "set_draw_warning" }, // EditorProperty + { "set_enable_follow_smoothing", "set_position_smoothing_enabled" }, // Camera2D + { "set_enabled_focus_mode", "set_focus_mode" }, // BaseButton + { "set_endian_swap", "set_big_endian" }, // File + { "set_expand_to_text_length", "set_expand_to_text_length_enabled" }, // LineEdit + { "set_filename", "set_scene_file_path" }, // Node, WARNING, this may be used in a lot of other places + { "set_focus_neighbour", "set_focus_neighbor" }, // Control + { "set_follow_smoothing", "set_position_smoothing_speed" }, // Camera2D + { "set_frame_color", "set_color" }, // ColorRect + { "set_global_rate_scale", "set_playback_speed_scale" }, // AudioServer + { "set_gravity_distance_scale", "set_gravity_point_unit_distance" }, // Area(2D/3D) + { "set_gravity_vector", "set_gravity_direction" }, // Area(2D/3D) + { "set_h_drag_enabled", "set_drag_horizontal_enabled" }, // Camera2D + { "set_icon_align", "set_icon_alignment" }, // Button + { "set_interior_ambient", "set_ambient_color" }, // ReflectionProbe + { "set_interior_ambient_energy", "set_ambient_color_energy" }, // ReflectionProbe + { "set_invert_faces", "set_flip_faces" }, // CSGPrimitive3D + { "set_is_initialized", "_is_initialized" }, // XRInterface + { "set_is_primary", "set_primary" }, // XRInterface + { "set_iterations_per_second", "set_physics_ticks_per_second" }, // Engine + { "set_layer_mask_bit", "set_layer_mask_value" }, // VisualInstance3D + { "set_margins_preset", "set_offsets_preset" }, // Control + { "set_max_atlas_size", "set_max_texture_size" }, // LightmapGI + { "set_metakey", "set_meta_pressed" }, // InputEventWithModifiers + { "set_mid_height", "set_height" }, // CapsuleMesh + { "set_neighbor_dist", "set_neighbor_distance" }, // NavigationAgent2D, NavigationAgent3D + { "set_network_master", "set_multiplayer_authority" }, // Node + { "set_network_peer", "set_multiplayer_peer" }, // Multiplayer API + { "set_oneshot", "set_one_shot" }, // AnimatedTexture + { "set_pause_mode", "set_process_mode" }, // Node + { "set_physical_scancode", "set_physical_keycode" }, // InputEventKey + { "set_proximity_fade", "set_proximity_fade_enabled" }, // Material + { "set_refuse_new_network_connections", "set_refuse_new_connections" }, // Multiplayer API + { "set_region", "set_region_enabled" }, // Sprite2D, Sprite broke AtlasTexture + { "set_region_filter_clip", "set_region_filter_clip_enabled" }, // Sprite2D + { "set_reverb_bus", "set_reverb_bus_name" }, // Area3D + { "set_rotate", "set_rotates" }, // PathFollow2D + { "set_scancode", "set_keycode" }, // InputEventKey + { "set_shift", "set_shift_pressed" }, // InputEventWithModifiers + { "set_size_override", "set_size_2d_override" }, // SubViewport broke ImageTexture + { "set_size_override_stretch", "set_size_2d_override_stretch" }, // SubViewport + { "set_slips_on_slope", "set_slide_on_slope" }, // SeparationRayShape2D, SeparationRayShape3D + { "set_sort_enabled", "set_y_sort_enabled" }, // Node2D + { "set_space_override_mode", "set_gravity_space_override_mode" }, // Area2D + { "set_spatial_node", "set_node_3d" }, // EditorNode3DGizmo + { "set_speed", "set_velocity" }, // InputEventMouseMotion + { "set_ssao_edge_sharpness", "set_ssao_sharpness" }, // Environment + { "set_surface_material", "set_surface_override_material" }, // MeshInstance3D broke ImporterMesh + { "set_tab_align", "set_tab_alignment" }, //TabContainer + { "set_tangent", "surface_set_tangent" }, // ImmediateGeometry broke SurfaceTool + { "set_text_align", "set_text_alignment" }, // Button + { "set_timer_process_mode", "set_timer_process_callback" }, // Timer + { "set_translation", "set_position" }, // Node3D - this broke GLTFNode which is used rarely + { "set_unit_db", "set_volume_db" }, // AudioStreamPlayer3D + { "set_unit_offset", "set_progress_ratio" }, // PathFollow2D, PathFollow3D + { "set_uv2", "surface_set_uv2" }, // ImmediateMesh broke Surffacetool + { "set_v_drag_enabled", "set_drag_vertical_enabled" }, // Camera2D + { "set_valign", "set_vertical_alignment" }, // Label + { "set_window_layout", "_set_window_layout" }, // EditorPlugin + { "set_zfar", "set_far" }, // Camera3D broke GLTFCamera + { "set_znear", "set_near" }, // Camera3D broke GLTFCamera + { "shortcut_match", "is_match" }, // InputEvent + { "skeleton_allocate", "skeleton_allocate_data" }, // RenderingServer + { "surface_update_region", "surface_update_attribute_region" }, // ArrayMesh + { "targeting_method", "tween_method" }, // Tween + { "targeting_property", "tween_property" }, // Tween + { "track_remove_key_at_position", "track_remove_key_at_time" }, // Animation + { "triangulate_delaunay_2d", "triangulate_delaunay" }, // Geometry2D + { "unselect", "deselect" }, // ItemList + { "unselect_all", "deselect_all" }, // ItemList + { "update_configuration_warning", "update_configuration_warnings" }, // Node + { "update_gizmo", "update_gizmos" }, // Node3D + { "viewport_set_use_arvr", "viewport_set_use_xr" }, // RenderingServer + { "warp_mouse_position", "warp_mouse" }, // Input + { "world_to_map", "local_to_map" }, // TileMap, GridMap + { "set_shader_param", "set_shader_parameter" }, // ShaderMaterial + { "get_shader_param", "get_shader_parameter" }, // ShaderMaterial + { "set_uniform_name", "set_parameter_name" }, // ParameterRef + { "get_uniform_name", "get_parameter_name" }, // ParameterRef + + // Builtin types + // Remember to add them to builtin_types_excluded_functions variable, because for now this functions cannot be listed + // { "empty", "is_empty" }, // Array - Used as custom rule // Be careful, this will be used everywhere + { "clamped", "clamp" }, // Vector2 // Be careful, this will be used everywhere + { "get_rotation_quat", "get_rotation_quaternion" }, // Basis + { "grow_margin", "grow_side" }, // Rect2 + { "invert", "reverse" }, // Array - TODO check // Be careful, this will be used everywhere + { "is_abs_path", "is_absolute_path" }, // String + { "is_valid_integer", "is_valid_int" }, // String + { "linear_interpolate", "lerp" }, // Color + { "find_last", "rfind" }, // Array, String + { "to_ascii", "to_ascii_buffer" }, // String + { "to_utf8", "to_utf8_buffer" }, // String + { "to_wchar", "to_utf32_buffer" }, // String // TODO - utf32 or utf16? + + // @GlobalScope + // Remember to add them to builtin_types_excluded_functions variable, because for now this functions cannot be listed + { "bytes2var", "bytes_to_var" }, + { "bytes2var_with_objects", "bytes_to_var_with_objects" }, + { "db2linear", "db_to_linear" }, + { "deg2rad", "deg_to_rad" }, + { "linear2db", "linear_to_db" }, + { "rad2deg", "rad_to_deg" }, + { "rand_range", "randf_range" }, + { "range_lerp", "remap" }, + { "stepify", "snapped" }, + { "str2var", "str_to_var" }, + { "var2str", "var_to_str" }, + { "var2bytes", "var_to_bytes" }, + { "var2bytes_with_objects", "var_to_bytes_with_objects" }, + + // @GDScript + // Remember to add them to builtin_types_excluded_functions variable, because for now this functions cannot be listed + { "dict2inst", "dict_to_inst" }, + { "inst2dict", "inst_to_dict" }, + + { nullptr, nullptr }, +}; + +// gdscript_function_renames clone with CamelCase +const char *RenamesMap3To4::csharp_function_renames[][2] = { + // { "_SetName", "GetTrackerName"}, // XRPositionalTracker - CameraFeed use this + // { "_UnhandledInput", "_UnhandledKeyInput"}, // BaseButton, ViewportContainer broke Node, FileDialog,SubViewportContainer + // { "CreateGizmo", "_CreateGizmo"}, // EditorNode3DGizmoPlugin - may be used + // { "GetDependencies", "_GetDependencies" }, // ResourceFormatLoader broke ResourceLoader + // { "GetExtents", "GetSize" }, // BoxShape, RectangleShape broke Decal, VoxelGI, GPUParticlesCollisionBox, GPUParticlesCollisionSDF, GPUParticlesCollisionHeightField, GPUParticlesAttractorBox, GPUParticlesAttractorVectorField, FogVolume + // { "GetHOffset", "GetDragHorizontalOffset"}, // Camera2D, broke PathFollow, Camera + // { "GetMode", "GetFileMode"}, // FileDialog broke Panel, Shader, CSGPolygon, Tilemap + // { "GetMotion", "GetTravel"}, // PhysicsTestMotionResult2D broke ParalaxLayer + // { "GetName", "GetTrackerName"}, // XRPositionalTracker broke OS, Node + // { "GetNetworkConnectedPeers", "GetPeers"}, // MultiplayerAPI broke SceneTree + // { "GetNetworkPeer", "HasMultiplayerPeer"}, // MultiplayerAPI broke SceneTree + // { "GetNetworkUniqueId", "GetUniqueId"}, // MultiplayerAPI broke SceneTree + // { "GetOffset", "GetPositionOffset" }, // GraphNode broke Gradient + // { "GetPeerPort", "GetPeer" }, // ENetMultiplayerPeer broke WebSocketServer + // { "GetProcessMode", "GetProcessCallback" }, // ClippedCamera3D broke Node, Sky + // { "GetRenderInfo", "GetRenderingInfo" }, // RenderingServer broke Viewport + // { "GetType", "GetTrackerType"}, // XRPositionalTracker broke GLTFAccessor, GLTFLight + // { "GetVOffset", "GetDragVerticalOffset"}, // Camera2D, broke PathFollow, Camera + // { "HasNetworkPeer", "HasMultiplayerPeer"}, // MultiplayerAPI broke SceneTree + // { "Instance", "Instantiate" }, // PackedScene, ClassDB - Broke FileSystemDock signal and also tscn files - [instance=ExtResource( 17 )] - this is implemented as custom rule + // { "IsListening", "IsBound"}, // PacketPeerUDP broke TCPServer, UDPServer + // { "IsRefusingNewNetworkConnections", "IsRefusingNewConnections"}, // MultiplayerAPI broke SceneTree + // { "IsValid", "HasValidEvent" }, // Shortcut broke e.g. Callable + // { "Listen", "Bound"}, // PacketPeerUDP broke TCPServer, UDPServer + // { "Load", "_Load"}, // ResourceFormatLoader broke ConfigFile, Image, StreamTexture2D + // { "MakeCurrent", "SetCurrent" }, // Camera2D broke Camera3D, Listener2D + // { "Process", "_Process" }, // AnimationNode - This word is commonly used + // { "Save", "_Save"}, // ResourceFormatLoader broke ConfigFile, Image, StreamTexture2D + // { "SetAutowrap", "SetAutowrapMode" }, // AcceptDialog broke Label - Cyclic Rename + // { "SetColor", "SurfaceSetColor"}, // ImmediateMesh broke Light2D, Theme, SurfaceTool + // { "SetEvent", "SetShortcut" }, // BaseButton - Cyclic Rename + // { "SetExtents", "SetSize"}, // BoxShape, RectangleShape broke ReflectionProbe + // { "SetFlag", "SetParticleFlag"}, // ParticleProcessMaterial broke Window, HingeJoint3D + // { "SetHOffset", "SetDragHorizontalOffset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D + // { "SetMargin", "SetOffset" }, // Control broke Shape3D, AtlasTexture + // { "SetMode", "SetModeFileMode" }, // FileDialog broke Panel, Shader, CSGPolygon, Tilemap + // { "SetNormal", "SurfaceSetNormal"}, // ImmediateGeometry broke SurfaceTool, WorldMarginShape2D + // { "SetOffset", "SetProgress" }, // PathFollow2D, PathFollow3D - Too common + // { "SetProcessMode", "SetProcessCallback" }, // AnimationTree broke Node, Tween, Sky + // { "SetRefuseNewNetworkConnections", "SetRefuseNewConnections"}, // MultiplayerAPI broke SceneTree + // { "SetTooltip", "SetTooltipText" }, // Control, breaks TreeItem, at least for now. + // { "SetUv", "SurfaceSetUv" }, // ImmediateMesh broke Polygon2D + // { "SetVOffset", "SetDragVerticalOffset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D + // {"GetPoints","GetPointsId"},// Astar, broke Line2D, Convexpolygonshape + // {"GetVScroll","GetVScrollBar"},//ItemList, broke TextView + // { "GetStylebox", "GetThemeStylebox" }, // Control - Will rename the method in Theme as well, skipping + { "AddSpatialGizmoPlugin", "AddNode3dGizmoPlugin" }, // EditorPlugin + { "RenderingServer", "GetTabAlignment" }, // Tab + { "_AboutToShow", "_AboutToPopup" }, // ColorPickerButton + { "_GetConfigurationWarning", "_GetConfigurationWarnings" }, // Node + { "_SetCurrent", "SetCurrent" }, // Camera2D + { "_SetEditorDescription", "SetEditorDescription" }, // Node + { "_SetPlaying", "SetPlaying" }, // AnimatedSprite3D + { "_ToplevelRaiseSelf", "_TopLevelRaiseSelf" }, // CanvasItem + { "_UpdateWrapAt", "_UpdateWrapAtColumn" }, // TextEdit + { "AddAnimation", "AddAnimationLibrary" }, // AnimationPlayer + { "AddCancel", "AddCancelButton" }, // AcceptDialog + { "AddCentralForce", "AddConstantCentralForce" }, //RigidBody2D + { "AddChildBelowNode", "AddSibling" }, // Node + { "AddColorOverride", "AddThemeColorOverride" }, // Control + { "AddConstantOverride", "AddThemeConstantOverride" }, // Control + { "AddFontOverride", "AddThemeFontOverride" }, // Control + { "AddForce", "AddConstantForce" }, //RigidBody2D + { "AddIconOverride", "AddThemeIconOverride" }, // Control + { "AddSceneImportPlugin", "AddSceneFormatImporterPlugin" }, //EditorPlugin + { "AddStyleboxOverride", "AddThemeStyleboxOverride" }, // Control + { "AddTorque", "AddConstantTorque" }, //RigidBody2D + { "AgentSetNeighborDist", "AgentSetNeighborDistance" }, // NavigationServer2D, NavigationServer3D + { "BindChildNodeToBone", "SetBoneChildren" }, // Skeleton3D + { "BumpmapToNormalmap", "BumpMapToNormalMap" }, // Image + { "CanBeHidden", "_CanBeHidden" }, // EditorNode3DGizmoPlugin + { "CanDropData", "_CanDropData" }, // Control + { "CanDropDataFw", "_CanDropDataFw" }, // ScriptEditor + { "CanGenerateSmallPreview", "_CanGenerateSmallPreview" }, // EditorResourcePreviewGenerator + { "CanInstance", "CanInstantiate" }, // PackedScene, Script + { "CanvasLightSetScale", "CanvasLightSetTextureScale" }, // RenderingServer + { "CaptureGetDevice", "GetInputDevice" }, // AudioServer + { "CaptureGetDeviceList", "GetInputDeviceList" }, // AudioServer + { "CaptureSetDevice", "SetInputDevice" }, // AudioServer + { "CenterViewportToCursor", "CenterViewportToCaret" }, // TextEdit + { "ChangeScene", "ChangeSceneToFile" }, // SceneTree + { "ChangeSceneTo", "ChangeSceneToPacked" }, // SceneTree + { "ClipPolygons2d", "ClipPolygons" }, // Geometry2D + { "ClipPolylineWithPolygon2d", "ClipPolylineWithPolygon" }, //Geometry2D + { "CommitHandle", "_CommitHandle" }, // EditorNode3DGizmo + { "ConvexHull2d", "ConvexHull" }, // Geometry2D + { "CursorGetBlinkSpeed", "GetCaretBlinkInterval" }, // TextEdit + { "CursorGetColumn", "GetCaretColumn" }, // TextEdit + { "CursorGetLine", "GetCaretLine" }, // TextEdit + { "CursorSetBlinkEnabled", "SetCaretBlinkEnabled" }, // TextEdit + { "CursorSetBlinkSpeed", "SetCaretBlinkInterval" }, // TextEdit + { "CursorSetColumn", "SetCaretColumn" }, // TextEdit + { "CursorSetLine", "SetCaretLine" }, // TextEdit + { "DampedSpringJointCreate", "JointMakeDampedSpring" }, // PhysicsServer2D + { "DampedStringJointGetParam", "DampedSpringJointGetParam" }, // PhysicsServer2D + { "DampedStringJointSetParam", "DampedSpringJointSetParam" }, // PhysicsServer2D + { "DeleteCharAtCursor", "DeleteCharAtCaret" }, // LineEdit + { "DeselectItems", "DeselectAll" }, // FileDialog + { "DropData", "_DropData" }, // Control + { "DropDataFw", "_DropDataFw" }, // ScriptEditor + { "ExcludePolygons2d", "ExcludePolygons" }, // Geometry2D + { "FindScancodeFromString", "FindKeycodeFromString" }, // OS + { "ForwardCanvasDrawOverViewport", "_ForwardCanvasDrawOverViewport" }, // EditorPlugin + { "ForwardCanvasForceDrawOverViewport", "_ForwardCanvasForceDrawOverViewport" }, // EditorPlugin + { "ForwardCanvasGuiInput", "_ForwardCanvasGuiInput" }, // EditorPlugin + { "ForwardSpatialDrawOverViewport", "_Forward3dDrawOverViewport" }, // EditorPlugin + { "ForwardSpatialForceDrawOverViewport", "_Forward3dForceDrawOverViewport" }, // EditorPlugin + { "ForwardSpatialGuiInput", "_Forward3dGuiInput" }, // EditorPlugin + { "GenerateFromPath", "_GenerateFromPath" }, // EditorResourcePreviewGenerator + { "GenerateSmallPreviewAutomatically", "_GenerateSmallPreviewAutomatically" }, // EditorResourcePreviewGenerator + { "GetActionList", "ActionGetEvents" }, // InputMap + { "GetAlt", "IsAltPressed" }, // InputEventWithModifiers + { "GetAnimationProcessMode", "GetProcessCallback" }, // AnimationPlayer + { "GetAppliedForce", "GetConstantForce" }, //RigidBody2D + { "GetAppliedTorque", "GetConstantTorque" }, //RigidBody2D + { "GetAudioBus", "GetAudioBusName" }, // Area3D + { "GetBoundChildNodesToBone", "GetBoneChildren" }, // Skeleton3D + { "GetCamera", "GetCamera3d" }, // Viewport -> this is also convertible to getCamera2d, broke GLTFNode + { "GetCancel", "GetCancelButton" }, // ConfirmationDialog + { "GetCaption", "_GetCaption" }, // AnimationNode + { "GetCastTo", "GetTargetPosition" }, // RayCast2D, RayCast3D + { "GetChildByName", "_GetChildByName" }, // AnimationNode + { "GetChildNodes", "_GetChildNodes" }, // AnimationNode + { "GetClosestPointToSegment2d", "GetClosestPointToSegment" }, // Geometry2D + { "GetClosestPointToSegmentUncapped2d", "GetClosestPointToSegmentUncapped" }, // Geometry2D + { "GetClosestPointsBetweenSegments2d", "GetClosestPointToSegment" }, // Geometry2D + { "GetCollisionLayerBit", "GetCollisionLayerValue" }, // CSGShape3D and a lot of others like GridMap + { "GetCollisionMaskBit", "GetCollisionMaskValue" }, // CSGShape3D and a lot of others like GridMap + { "GetColorTypes", "GetColorTypeList" }, // Theme + { "GetCommand", "IsCommandPressed" }, // InputEventWithModifiers + { "GetConstantTypes", "GetConstantTypeList" }, // Theme + { "GetControl", "IsCtrlPressed" }, // InputEventWithModifiers + { "GetCullMaskBit", "GetCullMaskValue" }, // Camera3D + { "GetCursorPosition", "GetCaretColumn" }, // LineEdit + { "GetD", "GetDistance" }, // LineShape2D + { "GetDepthBiasEnable", "GetDepthBiasEnabled" }, // RDPipelineRasterizationState + { "GetDevice", "GetOutputDevice" }, // AudioServer + { "GetDeviceList", "GetOutputDeviceList" }, // AudioServer + { "GetDragDataFw", "_GetDragDataFw" }, // ScriptEditor + { "GetEditorViewport", "GetViewport" }, // EditorPlugin + { "GetEnabledFocusMode", "GetFocusMode" }, // BaseButton + { "GetEndianSwap", "IsBigEndian" }, // File + { "GetErrorString", "GetErrorMessage" }, // JSON + { "GetFocusNeighbour", "GetFocusNeighbor" }, // Control + { "GetFollowSmoothing", "GetFollowSmoothingSpeed" }, // Camera2D + { "GetFontTypes", "GetFontTypeList" }, // Theme + { "GetFrameColor", "GetColor" }, // ColorRect + { "GetGlobalRateScale", "GetPlaybackSpeedScale" }, // AudioServer + { "GetGravityDistanceScale", "GetGravityPointDistanceScale" }, //Area2D + { "GetGravityVector", "GetGravityDirection" }, //Area2D + { "GetHScrollbar", "GetHScrollBar" }, //ScrollContainer + { "GetHand", "GetTrackerHand" }, // XRPositionalTracker + { "GetHandleName", "_GetHandleName" }, // EditorNode3DGizmo + { "GetHandleValue", "_GetHandleValue" }, // EditorNode3DGizmo + { "GetIconAlign", "GetIconAlignment" }, // Button + { "GetIconTypes", "GetIconTypeList" }, // Theme + { "GetIdleFrames", "GetProcessFrames" }, // Engine + { "GetImportOptions", "_GetImportOptions" }, // EditorImportPlugin + { "GetImportOrder", "_GetImportOrder" }, // EditorImportPlugin + { "GetImporterName", "_GetImporterName" }, // EditorImportPlugin + { "GetInteriorAmbient", "GetAmbientColor" }, // ReflectionProbe + { "GetInteriorAmbientEnergy", "GetAmbientColorEnergy" }, // ReflectionProbe + { "GetIterationsPerSecond", "GetPhysicsTicksPerSecond" }, // Engine + { "GetLastMouseSpeed", "GetLastMouseVelocity" }, // Input + { "GetLayerMaskBit", "GetLayerMaskValue" }, // VisualInstance3D + { "GetLen", "GetLength" }, // File + { "GetMaxAtlasSize", "GetMaxTextureSize" }, // LightmapGI + { "GetMetakey", "IsMetaPressed" }, // InputEventWithModifiers + { "GetMidHeight", "GetHeight" }, // CapsuleMesh + { "GetMotionRemainder", "GetRemainder" }, // PhysicsTestMotionResult2D + { "GetNeighborDist", "GetNeighborDistance" }, // NavigationAgent2D, NavigationAgent3D + { "GetNetworkConnectedPeers", "GetPeers" }, // Multiplayer API + { "GetNetworkMaster", "GetMultiplayerAuthority" }, // Node + { "GetNetworkPeer", "GetMultiplayerPeer" }, // Multiplayer API + { "GetNetworkUniqueId", "GetUniqueId" }, // Multiplayer API + { "GetOneshot", "GetOneShot" }, // AnimatedTexture + { "GetOk", "GetOkButton" }, // AcceptDialog + { "GetOptionVisibility", "_GetOptionVisibility" }, // EditorImportPlugin + { "GetParameterDefaultValue", "_GetParameterDefaultValue" }, // AnimationNode + { "GetParameterList", "_GetParameterList" }, // AnimationNode + { "GetParentSpatial", "GetParentNode3d" }, // Node3D + { "GetPhysicalScancode", "GetPhysicalKeycode" }, // InputEventKey + { "GetPhysicalScancodeWithModifiers", "GetPhysicalKeycodeWithModifiers" }, // InputEventKey + { "GetPluginIcon", "_GetPluginIcon" }, // EditorPlugin + { "GetPluginName", "_GetPluginName" }, // EditorPlugin + { "GetPresetCount", "_GetPresetCount" }, // EditorImportPlugin + { "GetPresetName", "_GetPresetName" }, // EditorImportPlugin + { "GetRecognizedExtensions", "_GetRecognizedExtensions" }, // ResourceFormatLoader, EditorImportPlugin broke ResourceSaver + { "GetRenderInfo", "GetRenderingInfo" }, // RenderingServer + { "GetRenderTargetsize", "GetRenderTargetSize" }, // XRInterface + { "GetResourceType", "_GetResourceType" }, // ResourceFormatLoader + { "GetResult", "GetData" }, //JSON + { "GetReverbBus", "GetReverbBusName" }, // Area3D + { "GetRpcSenderId", "GetRemoteSenderId" }, // Multiplayer API + { "GetSaveExtension", "_GetSaveExtension" }, // EditorImportPlugin + { "GetScancode", "GetKeycode" }, // InputEventKey + { "GetScancodeString", "GetKeycodeString" }, // OS + { "GetScancodeWithModifiers", "GetKeycodeWithModifiers" }, // InputEventKey + { "GetShift", "IsShiftPressed" }, // InputEventWithModifiers + { "GetSizeOverride", "GetSize2dOverride" }, // SubViewport + { "GetSlipsOnSlope", "GetSlideOnSlope" }, // SeparationRayShape2D, SeparationRayShape3D + { "GetSpaceOverrideMode", "GetGravitySpaceOverrideMode" }, // Area2D + { "GetSpatialNode", "GetNode3d" }, // EditorNode3DGizmo + { "GetSpeed", "GetVelocity" }, // InputEventMouseMotion + { "GetStyleboxTypes", "GetStyleboxTypeList" }, // Theme + { "GetSurfaceMaterial", "GetSurfaceOverrideMaterial" }, // MeshInstance3D broke ImporterMesh + { "GetSurfaceMaterialCount", "GetSurfaceOverrideMaterialCount" }, // MeshInstance3D + { "GetTabDisabled", "IsTabDisabled" }, // Tab + { "GetTabHidden", "IsTabHidden" }, // Tab + { "GetTextAlign", "GetTextAlignment" }, // Button + { "GetThemeItemTypes", "GetThemeItemTypeList" }, // Theme + { "GetTimerProcessMode", "GetTimerProcessCallback" }, // Timer + { "GetTranslation", "GetPosition" }, // Node3D broke GLTFNode which is used rarely + { "GetUnitDb", "GetVolumeDb" }, // AudioStreamPlayer3D + { "GetUnitOffset", "GetProgressRatio" }, // PathFollow2D, PathFollow3D + { "GetUseInBakedLight", "IsBakingNavigation" }, // GridMap + { "GetUsedCellsById", "GetUsedCells" }, // TileMap + { "GetVScrollbar", "GetVScrollBar" }, //ScrollContainer + { "GetVisibleName", "_GetVisibleName" }, // EditorImportPlugin + { "GetWindowLayout", "_GetWindowLayout" }, // EditorPlugin + { "GetWordUnderCursor", "GetWordUnderCaret" }, // TextEdit + { "GetWorld", "GetWorld3d" }, // Viewport, Spatial + { "GetZfar", "GetFar" }, // Camera3D broke GLTFCamera + { "GetZnear", "GetNear" }, // Camera3D broke GLTFCamera + { "GrooveJointCreate", "JointMakeGroove" }, // PhysicsServer2D + { "HandleMenuSelected", "_HandleMenuSelected" }, // EditorResourcePicker + { "HandlesType", "_HandlesType" }, // ResourceFormatLoader + { "HasColor", "HasThemeColor" }, // Control broke Theme + { "HasColorOverride", "HasThemeColorOverride" }, // Control broke Theme + { "HasConstant", "HasThemeConstant" }, // Control + { "HasConstantOverride", "HasThemeConstantOverride" }, // Control + { "HasFilter", "_HasFilter" }, // AnimationNode + { "HasFont", "HasThemeFont" }, // Control broke Theme + { "HasFontOverride", "HasThemeFontOverride" }, // Control + { "HasIcon", "HasThemeIcon" }, // Control broke Theme + { "HasIconOverride", "HasThemeIconOverride" }, // Control + { "HasMainScreen", "_HasMainScreen" }, // EditorPlugin + { "HasNetworkPeer", "HasMultiplayerPeer" }, // Multiplayer API + { "HasStylebox", "HasThemeStylebox" }, // Control broke Theme + { "HasStyleboxOverride", "HasThemeStyleboxOverride" }, // Control + { "HttpEscape", "UriEncode" }, // String + { "HttpUnescape", "UriDecode" }, // String + { "ImportAnimationFromOtherImporter", "_ImportAnimation" }, //EditorSceneFormatImporter + { "ImportSceneFromOtherImporter", "_ImportScene" }, //EditorSceneFormatImporter + { "InstanceSetSurfaceMaterial", "InstanceSetSurfaceOverrideMaterial" }, // RenderingServer + { "IntersectPolygons2d", "IntersectPolygons" }, // Geometry2D + { "IntersectPolylineWithPolygon2d", "IntersectPolylineWithPolygon" }, // Geometry2D + { "IsAParentOf", "IsAncestorOf" }, // Node + { "IsCommitingAction", "IsCommittingAction" }, // UndoRedo + { "IsDoubleclick", "IsDoubleClick" }, // InputEventMouseButton + { "IsFollowSmoothingEnabled", "IsPositionSmoothingEnabled" }, // Camera2D + { "IsHDragEnabled", "IsDragHorizontalEnabled" }, // Camera2D + { "IsHandleHighlighted", "_IsHandleHighlighted" }, // EditorNode3DGizmo, EditorNode3DGizmoPlugin + { "IsNetworkMaster", "IsMultiplayerAuthority" }, // Node + { "IsNetworkServer", "IsServer" }, // Multiplayer API + { "IsNormalmap", "IsNormalMap" }, // NoiseTexture + { "IsRefusingNewNetworkConnections", "IsRefusingNewConnections" }, // Multiplayer API + { "IsRegion", "IsRegionEnabled" }, // Sprite2D + { "IsRotating", "IsIgnoringRotation" }, // Camera2D + { "IsScancodeUnicode", "IsKeycodeUnicode" }, // OS + { "IsSelectableWhenHidden", "_IsSelectableWhenHidden" }, // EditorNode3DGizmoPlugin + { "IsSetAsToplevel", "IsSetAsTopLevel" }, // CanvasItem + { "IsShortcut", "MatchesEvent" }, // Shortcut + { "IsSizeOverrideStretchEnabled", "IsSize2dOverrideStretchEnabled" }, // SubViewport + { "IsSortEnabled", "IsYSortEnabled" }, // Node2D + { "IsStaticBody", "IsAbleToSleep" }, // PhysicalBone3D - TODO - not sure + { "IsVDragEnabled", "IsDragVerticalEnabled" }, // Camera2D + { "JointCreateConeTwist", "JointMakeConeTwist" }, // PhysicsServer3D + { "JointCreateGeneric6dof", "JointMakeGeneric6dof" }, // PhysicsServer3D + { "JointCreateHinge", "JointMakeHinge" }, // PhysicsServer3D + { "JointCreatePin", "JointMakePin" }, // PhysicsServer3D + { "JointCreateSlider", "JointMakeSlider" }, // PhysicsServer3D + { "LineIntersectsLine2d", "LineIntersectsLine" }, // Geometry2D + { "LoadFromGlobals", "LoadFromProjectSettings" }, // InputMap + { "MakeConvexFromBrothers", "MakeConvexFromSiblings" }, // CollisionShape3D + { "MergePolygons2d", "MergePolygons" }, // Geometry2D + { "MeshSurfaceGetFormat", "MeshSurfaceGetFormatAttributeStride" }, // RenderingServer + { "MeshSurfaceUpdateRegion", "MeshSurfaceUpdateAttributeRegion" }, // RenderingServer + { "MoveToBottom", "MoveAfter" }, // Skeleton3D + { "MoveToTop", "MoveBefore" }, // Skeleton3D + { "MultimeshAllocate", "MultimeshAllocateData" }, // RenderingServer + { "NormalmapToXy", "NormalMapToXy" }, // Image + { "OffsetPolygon2d", "OffsetPolygon" }, // Geometry2D + { "OffsetPolyline2d", "OffsetPolyline" }, // Geometry2D + { "PercentDecode", "UriDecode" }, // String + { "PercentEncode", "UriEncode" }, // String + { "PinJointCreate", "JointMakePin" }, // PhysicsServer2D + { "PopupCenteredMinsize", "PopupCenteredClamped" }, // Window + { "PostImport", "_PostImport" }, // EditorScenePostImport + { "PrintStrayNodes", "PrintOrphanNodes" }, // Node + { "PropertyListChangedNotify", "NotifyPropertyListChanged" }, // Object + { "Recognize", "_Recognize" }, // ResourceFormatLoader + { "RegenNormalmaps", "RegenNormalMaps" }, // ArrayMesh + { "Remove", "RemoveAt" }, // Array, broke Directory + { "RemoveAnimation", "RemoveAnimationLibrary" }, // AnimationPlayer + { "RemoveColorOverride", "RemoveThemeColorOverride" }, // Control + { "RemoveConstantOverride", "RemoveThemeConstantOverride" }, // Control + { "RemoveFontOverride", "RemoveThemeFontOverride" }, // Control + { "RemoveSceneImportPlugin", "RemoveSceneFormatImporterPlugin" }, //EditorPlugin + { "RemoveSpatialGizmoPlugin", "RemoveNode3dGizmoPlugin" }, // EditorPlugin + { "RemoveStyleboxOverride", "RemoveThemeStyleboxOverride" }, // Control + { "RenameAnimation", "RenameAnimationLibrary" }, // AnimationPlayer + { "RenameDependencies", "_RenameDependencies" }, // ResourceFormatLoader + { "SaveExternalData", "_SaveExternalData" }, // EditorPlugin + { "SegmentIntersectsSegment2d", "SegmentIntersectsSegment" }, // Geometry2D + { "SetAdjustmentEnable", "SetAdjustmentEnabled" }, // Environment + { "SetAlt", "SetAltPressed" }, // InputEventWithModifiers + { "SetAnchorAndMargin", "SetAnchorAndOffset" }, // Control + { "SetAnchorsAndMarginsPreset", "SetAnchorsAndOffsetsPreset" }, // Control + { "SetAnimationProcessMode", "SetProcessCallback" }, // AnimationPlayer + { "SetAsBulkArray", "SetBuffer" }, // MultiMesh + { "SetAsNormalmap", "SetAsNormalMap" }, // NoiseTexture + { "SetAsToplevel", "SetAsTopLevel" }, // CanvasItem + { "SetAudioBus", "SetAudioBusName" }, // Area3D + { "SetAutowrap", "SetAutowrapMode" }, // Label broke AcceptDialog + { "SetCastTo", "SetTargetPosition" }, // RayCast2D, RayCast3D + { "SetCollisionLayerBit", "SetCollisionLayerValue" }, // CSGShape3D and a lot of others like GridMap + { "SetCollisionMaskBit", "SetCollisionMaskValue" }, // CSGShape3D and a lot of others like GridMap + { "SetColumnMinWidth", "SetColumnCustomMinimumWidth" }, // Tree + { "SetCommand", "SetCommandPressed" }, // InputEventWithModifiers + { "SetControl", "SetCtrlPressed" }, // InputEventWithModifiers + { "SetCreateOptions", "_SetCreateOptions" }, // EditorResourcePicker + { "SetCullMaskBit", "SetCullMaskValue" }, // Camera3D + { "SetCursorPosition", "SetCaretColumn" }, // LineEdit + { "SetD", "SetDistance" }, // WorldMarginShape2D + { "SetDepthBiasEnable", "SetDepthBiasEnabled" }, // RDPipelineRasterizationState + { "SetDevice", "SetOutputDevice" }, // AudioServer + { "SetDoubleclick", "SetDoubleClick" }, // InputEventMouseButton + { "SetEnableFollowSmoothing", "SetFollowSmoothingEnabled" }, // Camera2D + { "SetEnabledFocusMode", "SetFocusMode" }, // BaseButton + { "SetEndianSwap", "SetBigEndian" }, // File + { "SetExpandToTextLength", "SetExpandToTextLengthEnabled" }, // LineEdit + { "SetFocusNeighbour", "SetFocusNeighbor" }, // Control + { "SetFollowSmoothing", "SetFollowSmoothingSpeed" }, // Camera2D + { "SetFrameColor", "SetColor" }, // ColorRect + { "SetGlobalRateScale", "SetPlaybackSpeedScale" }, // AudioServer + { "SetGravityDistanceScale", "SetGravityPointDistanceScale" }, // Area2D + { "SetGravityVector", "SetGravityDirection" }, // Area2D + { "SetHDragEnabled", "SetDragHorizontalEnabled" }, // Camera2D + { "SetIconAlign", "SetIconAlignment" }, // Button + { "SetInteriorAmbient", "SetAmbientColor" }, // ReflectionProbe + { "SetInteriorAmbientEnergy", "SetAmbientColorEnergy" }, // ReflectionProbe + { "SetIsInitialized", "_IsInitialized" }, // XRInterface + { "SetIsPrimary", "SetPrimary" }, // XRInterface + { "SetIterationsPerSecond", "SetPhysicsTicksPerSecond" }, // Engine + { "SetLayerMaskBit", "SetLayerMaskValue" }, // VisualInstance3D + { "SetMarginsPreset", "SetOffsetsPreset" }, // Control + { "SetMaxAtlasSize", "SetMaxTextureSize" }, // LightmapGI + { "SetMetakey", "SetMetaPressed" }, // InputEventWithModifiers + { "SetMidHeight", "SetHeight" }, // CapsuleMesh + { "SetNeighborDist", "SetNeighborDistance" }, // NavigationAgent2D, NavigationAgent3D + { "SetNetworkMaster", "SetMultiplayerAuthority" }, // Node + { "SetNetworkPeer", "SetMultiplayerPeer" }, // Multiplayer API + { "SetOneshot", "SetOneShot" }, // AnimatedTexture + { "SetPhysicalScancode", "SetPhysicalKeycode" }, // InputEventKey + { "SetProximityFade", "SetProximityFadeEnabled" }, // Material + { "SetRefuseNewNetworkConnections", "SetRefuseNewConnections" }, // Multiplayer API + { "SetRegion", "SetRegionEnabled" }, // Sprite2D, Sprite broke AtlasTexture + { "SetRegionFilterClip", "SetRegionFilterClipEnabled" }, // Sprite2D + { "SetReverbBus", "SetReverbBusName" }, // Area3D + { "SetRotate", "SetRotates" }, // PathFollow2D + { "SetScancode", "SetKeycode" }, // InputEventKey + { "SetShift", "SetShiftPressed" }, // InputEventWithModifiers + { "SetSizeOverride", "SetSize2dOverride" }, // SubViewport broke ImageTexture + { "SetSizeOverrideStretch", "SetSize2dOverrideStretch" }, // SubViewport + { "SetSlipsOnSlope", "SetSlideOnSlope" }, // SeparationRayShape2D, SeparationRayShape3D + { "SetSortEnabled", "SetYSortEnabled" }, // Node2D + { "SetSpaceOverrideMode", "SetGravitySpaceOverrideMode" }, // Area2D + { "SetSpatialNode", "SetNode3d" }, // EditorNode3DGizmo + { "SetSpeed", "SetVelocity" }, // InputEventMouseMotion + { "SetSsaoEdgeSharpness", "SetSsaoSharpness" }, // Environment + { "SetSurfaceMaterial", "SetSurfaceOverrideMaterial" }, // MeshInstance3D broke ImporterMesh + { "SetTabAlign", "SetTabAlignment" }, //TabContainer + { "SetTangent", "SurfaceSetTangent" }, // ImmediateGeometry broke SurfaceTool + { "SetTextAlign", "SetTextAlignment" }, // Button + { "SetTimerProcessMode", "SetTimerProcessCallback" }, // Timer + { "SetTonemapAutoExposure", "SetTonemapAutoExposureEnabled" }, // Environment + { "SetTranslation", "SetPosition" }, // Node3D - this broke GLTFNode which is used rarely + { "SetUnitDb", "SetVolumeDb" }, // AudioStreamPlayer3D + { "SetUnitOffset", "SetProgressRatio" }, // PathFollow2D, PathFollow3D + { "SetUv2", "SurfaceSetUv2" }, // ImmediateMesh broke Surffacetool + { "SetVDragEnabled", "SetDragVerticalEnabled" }, // Camera2D + { "SetValign", "SetVerticalAlignment" }, // Label + { "SetWindowLayout", "_SetWindowLayout" }, // EditorPlugin + { "SetZfar", "SetFar" }, // Camera3D broke GLTFCamera + { "SetZnear", "SetNear" }, // Camera3D broke GLTFCamera + { "ShortcutMatch", "IsMatch" }, // InputEvent + { "SkeletonAllocate", "SkeletonAllocateData" }, // RenderingServer + { "SurfaceUpdateRegion", "SurfaceUpdateAttributeRegion" }, // ArrayMesh + { "TargetingMethod", "TweenMethod" }, // Tween + { "TargetingProperty", "TweenProperty" }, // Tween + { "TrackRemoveKeyAtPosition", "TrackRemoveKeyAtTime" }, // Animation + { "TriangulateDelaunay2d", "TriangulateDelaunay" }, // Geometry2D + { "UnbindChildNodeFromBone", "RemoveBoneChild" }, // Skeleton3D + { "Unselect", "Deselect" }, // ItemList + { "UnselectAll", "DeselectAll" }, // ItemList + { "UpdateConfigurationWarning", "UpdateConfigurationWarnings" }, // Node + { "UpdateGizmo", "UpdateGizmos" }, // Node3D + { "ViewportSetUseArvr", "ViewportSetUseXr" }, // RenderingServer + { "WarpMousePosition", "WarpMouse" }, // Input + { "WorldToMap", "LocalToMap" }, // TileMap, GridMap + { "SetShaderParam", "SetShaderParameter" }, // ShaderMaterial + { "GetShaderParam", "GetShaderParameter" }, // ShaderMaterial + { "SetUniformName", "SetParameterName" }, // ParameterRef + { "GetUniformName", "GetParameterName" }, // ParameterRef + + // Builtin types + // { "Empty", "IsEmpty" }, // Array - Used as custom rule // Be careful, this will be used everywhere + { "Clamped", "Clamp" }, // Vector2 // Be careful, this will be used everywhere + { "GetRotationQuat", "GetRotationQuaternion" }, // Basis + { "GrowMargin", "GrowSide" }, // Rect2 + { "Invert", "Reverse" }, // Array - TODO check // Be careful, this will be used everywhere + { "IsAbsPath", "IsAbsolutePath" }, // String + { "IsValidInteger", "IsValidInt" }, // String + { "LinearInterpolate", "Lerp" }, // Color + { "ToAscii", "ToAsciiBuffer" }, // String + { "ToUtf8", "ToUtf8Buffer" }, // String + { "ToWchar", "ToUtf32Buffer" }, // String // TODO - utf32 or utf16? + + // @GlobalScope + { "Bytes2Var", "BytesToVar" }, + { "Bytes2VarWithObjects", "BytesToVarWithObjects" }, + { "Db2Linear", "DbToLinear" }, + { "Deg2Rad", "DegToRad" }, + { "Linear2Db", "LinearToDb" }, + { "Rad2Deg", "RadToDeg" }, + { "RandRange", "RandfRange" }, + { "RangeLerp", "Remap" }, + { "Stepify", "Snapped" }, + { "Str2Var", "StrToVar" }, + { "Var2Str", "VarToStr" }, + { "Var2Bytes", "VarToBytes" }, + { "Var2BytesWithObjects", "VarToBytesWithObjects" }, + + // @GDScript + { "Dict2Inst", "DictToInst" }, + { "Inst2Dict", "InstToDict" }, + + { nullptr, nullptr }, +}; + +// Some needs to be disabled, because users can use this names as variables +const char *RenamesMap3To4::gdscript_properties_renames[][2] = { + // // { "d", "distance" }, //WorldMarginShape2D - TODO, looks that polish letters Ä… Ä™ are treaten as space, not as letter, so `bÄ™dÄ…` are renamed to `bÄ™distanceÄ…` + // // {"alt","alt_pressed"}, // This may broke a lot of comments and user variables + // // {"command","command_pressed"},// This may broke a lot of comments and user variables + // // {"control","ctrl_pressed"},// This may broke a lot of comments and user variables + // // {"extends","size"}, // BoxShape3D, LightmapGI broke ReflectionProbe + // // {"meta","meta_pressed"},// This may broke a lot of comments and user variables + // // {"pause_mode","process_mode"}, // Node - Cyclic rename, look for others + // // {"rotate","rotates"}, // PathFollow2D - probably function exists with same name + // // {"offset","progress"}, // PathFollow2D, PathFollow3D - Name is way too vague + // // {"shift","shift_pressed"},// This may broke a lot of comments and user variables + // { "autowrap", "autowrap_mode" }, // Label + // { "cast_to", "target_position" }, // RayCast2D, RayCast3D + // { "device", "output_device"}, // AudioServer - Too vague, most likely breaks comments & variables + // { "doubleclick", "double_click" }, // InputEventMouseButton + // { "group", "button_group" }, // BaseButton + // { "process_mode", "process_callback" }, // AnimationTree, Camera2D + // { "scancode", "keycode" }, // InputEventKey + // { "toplevel", "top_level" }, // Node + // { "window_title", "title" }, // Window + // { "wrap_enabled", "wrap_mode" }, // TextEdit + // { "zfar", "far" }, // Camera3D + // { "znear", "near" }, // Camera3D + // { "filename", "scene_file_path" }, // Node + // { "pressed", "button_pressed" }, // BaseButton - Will also rename the signal, skipping for now + { "as_normalmap", "as_normal_map" }, // NoiseTexture + { "bbcode_text", "text" }, // RichTextLabel + { "bg", "panel" }, // Theme + { "bg_focus", "focus" }, // Theme + { "capture_device", "input_device" }, // AudioServer + { "caret_blink_speed", "caret_blink_interval" }, // TextEdit, LineEdit + { "caret_moving_by_right_click", "caret_move_on_right_click" }, // TextEdit + { "caret_position", "caret_column" }, // LineEdit + { "check_vadjust", "check_v_offset" }, // Theme + { "close_h_ofs", "close_h_offset" }, // Theme + { "close_v_ofs", "close_v_offset" }, // Theme + { "commentfocus", "comment_focus" }, // Theme + { "contacts_reported", "max_contacts_reported" }, // RigidBody + { "depth_bias_enable", "depth_bias_enabled" }, // RDPipelineRasterizationState + { "drag_margin_bottom", "drag_bottom_margin" }, // Camera2D + { "drag_margin_h_enabled", "drag_horizontal_enabled" }, // Camera2D + { "drag_margin_left", "drag_left_margin" }, // Camera2D + { "drag_margin_right", "drag_right_margin" }, // Camera2D + { "drag_margin_top", "drag_top_margin" }, // Camera2D + { "drag_margin_v_enabled", "drag_vertical_enabled" }, // Camera2D + { "enabled_focus_mode", "focus_mode" }, // BaseButton - Removed + { "extra_spacing_bottom", "spacing_bottom" }, // Font + { "extra_spacing_top", "spacing_top" }, // Font + { "focus_neighbour_bottom", "focus_neighbor_bottom" }, // Control + { "focus_neighbour_left", "focus_neighbor_left" }, // Control + { "focus_neighbour_right", "focus_neighbor_right" }, // Control + { "focus_neighbour_top", "focus_neighbor_top" }, // Control + { "follow_viewport_enable", "follow_viewport_enabled" }, // CanvasItem + { "file_icon_modulate", "file_icon_color" }, // Theme + { "files_disabled", "file_disabled_color" }, // Theme + { "folder_icon_modulate", "folder_icon_color" }, // Theme + { "global_rate_scale", "playback_speed_scale" }, // AudioServer + { "gravity_distance_scale", "gravity_point_unit_distance" }, // Area(2D/3D) + { "gravity_vec", "gravity_direction" }, // Area(2D/3D) + { "hint_tooltip", "tooltip_text" }, // Control + { "hseparation", "h_separation" }, // Theme + { "icon_align", "icon_alignment" }, // Button + { "iterations_per_second", "physics_ticks_per_second" }, // Engine + { "invert_enable", "invert_enabled" }, // Polygon2D + { "margin_bottom", "offset_bottom" }, // Control broke NinePatchRect, StyleBox + { "margin_left", "offset_left" }, // Control broke NinePatchRect, StyleBox + { "margin_right", "offset_right" }, // Control broke NinePatchRect, StyleBox + { "margin_top", "offset_top" }, // Control broke NinePatchRect, StyleBox + { "mid_height", "height" }, // CapsuleMesh + { "neighbor_dist", "neighbor_distance" }, // NavigationAgent2D, NavigationAgent3D + { "offset_h", "drag_horizontal_offset" }, // Camera2D + { "offset_v", "drag_vertical_offset" }, // Camera2D + { "off", "unchecked" }, // Theme + { "off_disabled", "unchecked_disabled" }, // Theme + { "ofs", "offset" }, // Theme + { "on", "checked" }, // Theme + { "on_disabled", "checked_disabled" }, // Theme + { "oneshot", "one_shot" }, // AnimatedTexture + { "out_of_range_mode", "max_polyphony" }, // AudioStreamPlayer3D + { "pause_mode", "process_mode" }, // Node + { "physical_scancode", "physical_keycode" }, // InputEventKey + { "popup_exclusive", "exclusive" }, // Window + { "proximity_fade_enable", "proximity_fade_enabled" }, // Material + { "rect_position", "position" }, // Control + { "rect_global_position", "global_position" }, // Control + { "rect_size", "size" }, // Control + { "rect_min_size", "custom_minimum_size" }, // Control + { "rect_rotation", "rotation" }, // Control + { "rect_scale", "scale" }, // Control + { "rect_pivot_offset", "pivot_offset" }, // Control + { "rect_clip_content", "clip_contents" }, // Control + { "refuse_new_network_connections", "refuse_new_connections" }, // MultiplayerAPI + { "region_filter_clip", "region_filter_clip_enabled" }, // Sprite2D + { "reverb_bus_enable", "reverb_bus_enabled" }, // Area3D + { "selectedframe", "selected_frame" }, // Theme + { "size_override_stretch", "size_2d_override_stretch" }, // SubViewport + { "slips_on_slope", "slide_on_slope" }, // SeparationRayShape2D + { "smoothing_enabled", "follow_smoothing_enabled" }, // Camera2D + { "smoothing_speed", "position_smoothing_speed" }, // Camera2D + { "ss_reflections_depth_tolerance", "ssr_depth_tolerance" }, // Environment + { "ss_reflections_enabled", "ssr_enabled" }, // Environment + { "ss_reflections_fade_in", "ssr_fade_in" }, // Environment + { "ss_reflections_fade_out", "ssr_fade_out" }, // Environment + { "ss_reflections_max_steps", "ssr_max_steps" }, // Environment + { "state_machine_selectedframe", "state_machine_selected_frame" }, // Theme + { "syntax_highlighting", "syntax_highlighter" }, // TextEdit + { "tab_align", "tab_alignment" }, // TabContainer + { "table_hseparation", "table_h_separation" }, // Theme + { "table_vseparation", "table_v_separation" }, // Theme + { "translation", "position" }, // Node3D - broke GLTFNode + { "unit_db", "volume_db" }, // AudioStreamPlayer3D + { "unit_offset", "progress_ratio" }, // PathFollow2D, PathFollow3D + { "vseparation", "v_separation" }, // Theme + { "frames", "sprite_frames" }, // AnimatedSprite2D, AnimatedSprite3D + + { nullptr, nullptr }, +}; + +// Some needs to be disabled, because users can use this names as variables +const char *RenamesMap3To4::csharp_properties_renames[][2] = { + // // { "D", "Distance" }, //WorldMarginShape2D - TODO, looks that polish letters Ä… Ä™ are treaten as space, not as letter, so `bÄ™dÄ…` are renamed to `bÄ™distanceÄ…` + // // {"Alt","AltPressed"}, // This may broke a lot of comments and user variables + // // {"Command","CommandPressed"},// This may broke a lot of comments and user variables + // // {"Control","CtrlPressed"},// This may broke a lot of comments and user variables + // // {"Extends","Size"}, // BoxShape3D, LightmapGI broke ReflectionProbe + // // {"Meta","MetaPressed"},// This may broke a lot of comments and user variables + // // {"PauseMode","ProcessMode"}, // Node - Cyclic rename, look for others + // // {"Rotate","Rotates"}, // PathFollow2D - probably function exists with same name + // // {"Offset","Progress"}, // PathFollow2D, PathFollow3D - Name is way too vague + // // {"Shift","ShiftPressed"},// This may broke a lot of comments and user variables + // { "Autowrap", "AutowrapMode" }, // Label + // { "CastTo", "TargetPosition" }, // RayCast2D, RayCast3D + // { "Doubleclick", "DoubleClick" }, // InputEventMouseButton + // { "Group", "ButtonGroup" }, // BaseButton + // { "PercentVisible, "ShowPercentage}, // ProgressBar, conflicts with Label and RichTextLabel, but may be a worth it. + // { "ProcessMode", "ProcessCallback" }, // AnimationTree, Camera2D + // { "Scancode", "Keycode" }, // InputEventKey + // { "Toplevel", "TopLevel" }, // Node + // { "WindowTitle", "Title" }, // Window + // { "WrapEnabled", "WrapMode" }, // TextEdit + // { "Zfar", "Far" }, // Camera3D + // { "Znear", "Near" }, // Camera3D + // { "Pressed", "ButtonPressed" }, // BaseButton - Will also rename the signal, skipping for now + { "AsNormalmap", "AsNormalMap" }, // NoiseTexture + { "BbcodeText", "Text" }, // RichTextLabel + { "CaretBlinkSpeed", "CaretBlinkInterval" }, // TextEdit, LineEdit + { "CaretMovingByRightClick", "CaretMoveOnRightClick" }, // TextEdit + { "CaretPosition", "CaretColumn" }, // LineEdit + { "CheckVadjust", "CheckVAdjust" }, // Theme + { "CloseHOfs", "CloseHOffset" }, // Theme + { "CloseVOfs", "CloseVOffset" }, // Theme + { "Commentfocus", "CommentFocus" }, // Theme + { "DepthBiasEnable", "DepthBiasEnabled" }, // RDPipelineRasterizationState + { "DragMarginBottom", "DragBottomMargin" }, // Camera2D + { "DragMarginHEnabled", "DragHorizontalEnabled" }, // Camera2D + { "DragMarginLeft", "DragLeftMargin" }, // Camera2D + { "DragMarginRight", "DragRightMargin" }, // Camera2D + { "DragMarginTop", "DragTopMargin" }, // Camera2D + { "DragMarginVEnabled", "DragVerticalEnabled" }, // Camera2D + { "EnabledFocusMode", "FocusMode" }, // BaseButton - Removed + { "ExtraSpacingBottom", "SpacingBottom" }, // Font + { "ExtraSpacingTop", "SpacingTop" }, // Font + { "FocusNeighbourBottom", "FocusNeighborBottom" }, // Control + { "FocusNeighbourLeft", "FocusNeighborLeft" }, // Control + { "FocusNeighbourRight", "FocusNeighborRight" }, // Control + { "FocusNeighbourTop", "FocusNeighborTop" }, // Control + { "FollowViewportEnable", "FollowViewportEnabled" }, // CanvasItem + { "GlobalRateScale", "PlaybackSpeedScale" }, // AudioServer + { "GravityDistanceScale", "GravityPointDistanceScale" }, // Area2D + { "GravityVec", "GravityDirection" }, // Area2D + { "HintTooltip", "TooltipText" }, // Control + { "Hseparation", "HSeparation" }, // Theme + { "IconAlign", "IconAlignment" }, // Button + { "IterationsPerSecond", "PhysicsTicksPerSecond" }, // Engine + { "InvertEnable", "InvertEnabled" }, // Polygon2D + { "MarginBottom", "OffsetBottom" }, // Control broke NinePatchRect, StyleBox + { "MarginLeft", "OffsetLeft" }, // Control broke NinePatchRect, StyleBox + { "MarginRight", "OffsetRight" }, // Control broke NinePatchRect, StyleBox + { "MarginTop", "OffsetTop" }, // Control broke NinePatchRect, StyleBox + { "MidHeight", "Height" }, // CapsuleMesh + { "NeighborDist", "NeighborDistance" }, // NavigationAgent2D, NavigationAgent3D + { "OffsetH", "DragHorizontalOffset" }, // Camera2D + { "OffsetV", "DragVerticalOffset" }, // Camera2D + { "Ofs", "Offset" }, // Theme + { "Oneshot", "OneShot" }, // AnimatedTexture + { "OutOfRangeMode", "MaxPolyphony" }, // AudioStreamPlayer3D + { "PauseMode", "ProcessMode" }, // Node + { "PhysicalScancode", "PhysicalKeycode" }, // InputEventKey + { "PopupExclusive", "Exclusive" }, // Window + { "ProximityFadeEnable", "ProximityFadeEnabled" }, // Material + { "RectPosition", "Position" }, // Control + { "RectGlobalPosition", "GlobalPosition" }, // Control + { "RectSize", "Size" }, // Control + { "RectMinSize", "CustomMinimumSize" }, // Control + { "RectRotation", "Rotation" }, // Control + { "RectScale", "Scale" }, // Control + { "RectPivotOffset", "PivotOffset" }, // Control + { "RectClipContent", "ClipContents" }, // Control + { "RefuseNewNetworkConnections", "RefuseNewConnections" }, // MultiplayerAPI + { "RegionFilterClip", "RegionFilterClipEnabled" }, // Sprite2D + { "ReverbBusEnable", "ReverbBusEnabled" }, // Area3D + { "Selectedframe", "SelectedFrame" }, // Theme + { "SizeOverrideStretch", "Size2dOverrideStretch" }, // SubViewport + { "SlipsOnSlope", "SlideOnSlope" }, // SeparationRayShape2D + { "SmoothingEnabled", "FollowSmoothingEnabled" }, // Camera2D + { "SmoothingSpeed", "FollowSmoothingSpeed" }, // Camera2D + { "SsReflectionsDepthTolerance", "SsrDepthTolerance" }, // Environment + { "SsReflectionsEnabled", "SsrEnabled" }, // Environment + { "SsReflectionsFadeIn", "SsrFadeIn" }, // Environment + { "SsReflectionsFadeOut", "SsrFadeOut" }, // Environment + { "SsReflectionsMaxSteps", "SsrMaxSteps" }, // Environment + { "StateMachineSelectedframe", "StateMachineSelectedFrame" }, // Theme + { "SyntaxHighlighting", "SyntaxHighlighter" }, // TextEdit + { "TabAlign", "TabAlignment" }, // TabContainer + { "TableHseparation", "TableHSeparation" }, // Theme + { "TableVseparation", "TableVSeparation" }, // Theme + { "Translation", "Position" }, // Node3D - broke GLTFNode + { "UnitDb", "VolumeDb" }, // AudioStreamPlayer3D + { "UnitOffset", "ProgressRatio" }, // PathFollow2D, PathFollow3D + { "Vseparation", "VSeparation" }, // Theme + + { nullptr, nullptr }, +}; + +const char *RenamesMap3To4::gdscript_signals_renames[][2] = { + // {"instantiate","instance"}, // FileSystemDock + // { "hide", "hidden" }, // CanvasItem - function with same name exists + // { "tween_all_completed","loop_finished"}, // Tween - TODO, not sure + // {"changed","settings_changed"}, // EditorSettings + { "about_to_show", "about_to_popup" }, // Popup + { "button_release", "button_released" }, // XRController3D + { "cancelled", "canceled" }, // AcceptDialog + { "item_double_clicked", "item_icon_double_clicked" }, // Tree + { "network_peer_connected", "peer_connected" }, // MultiplayerAPI + { "network_peer_disconnected", "peer_disconnected" }, // MultiplayerAPI + { "network_peer_packet", "peer_packet" }, // MultiplayerAPI + { "node_unselected", "node_deselected" }, // GraphEdit + { "offset_changed", "position_offset_changed" }, // GraphNode + { "settings_changed", "changed" }, // TileMap broke EditorSettings + { "skeleton_updated", "pose_updated" }, // + { "tab_close", "tab_closed" }, // TextEdit + { "tab_hover", "tab_hovered" }, // TextEdit + { "text_entered", "text_submitted" }, // LineEdit + { "tween_completed", "finished" }, // Tween + { "tween_step", "step_finished" }, // Tween + + { nullptr, nullptr }, +}; + +const char *RenamesMap3To4::csharp_signals_renames[][2] = { + // {"Instantiate","Instance"}, // FileSystemDock + // { "Hide", "Hidden" }, // CanvasItem - function with same name exists + // { "TweenAllCompleted","LoopFinished"}, // Tween - TODO, not sure + // {"Changed","SettingsChanged"}, // EditorSettings + { "AboutToShow", "AboutToPopup" }, // Popup + { "ButtonRelease", "ButtonReleased" }, // XRController3D + { "NetworkPeerConnected", "PeerConnected" }, // MultiplayerAPI + { "NetworkPeerDisconnected", "PeerDisconnected" }, // MultiplayerAPI + { "NetworkPeerPacket", "PeerPacket" }, // MultiplayerAPI + { "NodeUnselected", "NodeDeselected" }, // GraphEdit + { "OffsetChanged", "PositionOffsetChanged" }, // GraphNode + { "SettingsChanged", "Changed" }, // TileMap broke EditorSettings + { "SkeletonUpdated", "PoseUpdated" }, // + { "TabClose", "TabClosed" }, // TextEdit + { "TabHover", "TabHovered" }, // TextEdit + { "TextEntered", "TextSubmitted" }, // LineEdit + { "TweenCompleted", "Finished" }, // Tween + { "TweenStep", "StepFinished" }, // Tween + + { nullptr, nullptr }, + +}; + +const char *RenamesMap3To4::project_settings_renames[][2] = { + { "audio/channel_disable_threshold_db", "audio/buses/channel_disable_threshold_db" }, + { "audio/channel_disable_time", "audio/buses/channel_disable_time" }, + { "audio/default_bus_layout", "audio/buses/default_bus_layout" }, + { "audio/driver", "audio/driver/driver" }, + { "audio/enable_audio_input", "audio/driver/enable_input" }, + { "audio/mix_rate", "audio/driver/mix_rate" }, + { "audio/output_latency", "audio/driver/output_latency" }, + { "audio/output_latency.web", "audio/driver/output_latency.web" }, + { "audio/video_delay_compensation_ms", "audio/video/video_delay_compensation_ms" }, + { "display/window/vsync/use_vsync", "display/window/vsync/vsync_mode" }, + { "editor/main_run_args", "editor/run/main_run_args" }, + { "gui/common/swap_ok_cancel", "gui/common/swap_cancel_ok" }, + { "network/limits/debugger_stdout/max_chars_per_second", "network/limits/debugger/max_chars_per_second" }, + { "network/limits/debugger_stdout/max_errors_per_second", "network/limits/debugger/max_errors_per_second" }, + { "network/limits/debugger_stdout/max_messages_per_frame", "network/limits/debugger/max_queued_messages" }, + { "network/limits/debugger_stdout/max_warnings_per_second", "network/limits/debugger/max_warnings_per_second" }, + { "network/ssl/certificates", "network/tls/certificate_bundle_override" }, + { "physics/2d/thread_model", "physics/2d/run_on_thread" }, // TODO not sure + { "rendering/environment/default_clear_color", "rendering/environment/defaults/default_clear_color" }, + { "rendering/environment/default_environment", "rendering/environment/defaults/default_environment" }, + { "rendering/quality/depth_prepass/disable_for_vendors", "rendering/driver/depth_prepass/disable_for_vendors" }, + { "rendering/quality/depth_prepass/enable", "rendering/driver/depth_prepass/enable" }, + { "rendering/quality/shading/force_blinn_over_ggx", "rendering/shading/overrides/force_blinn_over_ggx" }, + { "rendering/quality/shading/force_blinn_over_ggx.mobile", "rendering/shading/overrides/force_blinn_over_ggx.mobile" }, + { "rendering/quality/shading/force_lambert_over_burley", "rendering/shading/overrides/force_lambert_over_burley" }, + { "rendering/quality/shading/force_lambert_over_burley.mobile", "rendering/shading/overrides/force_lambert_over_burley.mobile" }, + { "rendering/quality/shading/force_vertex_shading", "rendering/shading/overrides/force_vertex_shading" }, + { "rendering/quality/shading/force_vertex_shading.mobile", "rendering/shading/overrides/force_vertex_shading.mobile" }, + { "rendering/quality/shadow_atlas/quadrant_0_subdiv", "rendering/lights_and_shadows/shadow_atlas/quadrant_0_subdiv" }, + { "rendering/quality/shadow_atlas/quadrant_1_subdiv", "rendering/lights_and_shadows/shadow_atlas/quadrant_1_subdiv" }, + { "rendering/quality/shadow_atlas/quadrant_2_subdiv", "rendering/lights_and_shadows/shadow_atlas/quadrant_2_subdiv" }, + { "rendering/quality/shadow_atlas/quadrant_3_subdiv", "rendering/lights_and_shadows/shadow_atlas/quadrant_3_subdiv" }, + { "rendering/quality/shadow_atlas/size", "rendering/lights_and_shadows/shadow_atlas/size" }, + { "rendering/quality/shadow_atlas/size.mobile", "rendering/lights_and_shadows/shadow_atlas/size.mobile" }, + { "rendering/vram_compression/import_etc2", "rendering/textures/vram_compression/import_etc2_astc" }, + { "rendering/vram_compression/import_s3tc", "rendering/textures/vram_compression/import_s3tc_bptc" }, + { "window/size/width", "window/size/viewport_width" }, + { "window/size/height", "window/size/viewport_height" }, + { "window/size/test_width", "window/size/window_width_override" }, + { "window/size/test_height", "window/size/window_height_override" }, + + { nullptr, nullptr }, +}; + +const char *RenamesMap3To4::input_map_renames[][2] = { + { ",\"alt\":", ",\"alt_pressed\":" }, + { ",\"shift\":", ",\"shift_pressed\":" }, + { ",\"control\":", ",\"ctrl_pressed\":" }, + { ",\"meta\":", ",\"meta_pressed\":" }, + { ",\"scancode\":", ",\"keycode\":" }, + { ",\"physical_scancode\":", ",\"physical_keycode\":" }, + { ",\"doubleclick\":", ",\"double_click\":" }, + + { nullptr, nullptr }, +}; + +const char *RenamesMap3To4::builtin_types_renames[][2] = { + { "PoolByteArray", "PackedByteArray" }, + { "PoolColorArray", "PackedColorArray" }, + { "PoolIntArray", "PackedInt32Array" }, + { "PoolRealArray", "PackedFloat32Array" }, + { "PoolStringArray", "PackedStringArray" }, + { "PoolVector2Array", "PackedVector2Array" }, + { "PoolVector3Array", "PackedVector3Array" }, + { "Quat", "Quaternion" }, + { "Transform", "Transform3D" }, + + { nullptr, nullptr }, +}; + +const char *RenamesMap3To4::shaders_renames[][2] = { + { "ALPHA_SCISSOR", "ALPHA_SCISSOR_THRESHOLD" }, + { "CAMERA_MATRIX", "INV_VIEW_MATRIX" }, + { "INV_CAMERA_MATRIX", "VIEW_MATRIX" }, + { "NORMALMAP", "NORMAL_MAP" }, + { "NORMALMAP_DEPTH", "NORMAL_MAP_DEPTH" }, + { "TRANSMISSION", "BACKLIGHT" }, + { "WORLD_MATRIX", "MODEL_MATRIX" }, + { "depth_draw_alpha_prepass", "depth_draw_opaque" }, + { "hint_albedo", "source_color" }, + { "hint_aniso", "hint_anisotropy" }, + { "hint_black", "hint_default_black" }, + { "hint_black_albedo", "hint_default_black" }, + { "hint_color", "source_color" }, + { "hint_white", "hint_default_white" }, + { nullptr, nullptr }, +}; + +const char *RenamesMap3To4::class_renames[][2] = { + // { "BulletPhysicsDirectBodyState", "BulletPhysicsDirectBodyState3D" }, // Class is not visible in ClassDB + // { "BulletPhysicsServer", "BulletPhysicsServer3D" }, // Class is not visible in ClassDB + // { "GDScriptFunctionState", "Node3D" }, // TODO - not sure to which should be changed + // { "GDScriptNativeClass", "Node3D" }, // TODO - not sure to which should be changed + // { "InputDefault",""}, // TODO ? + // { "Physics2DDirectBodyStateSW", "GodotPhysicsDirectBodyState2D" }, // Class is not visible in ClassDB + // { "Physics2DShapeQueryResult", "PhysicsShapeQueryResult2D" }, // Class is not visible in ClassDB + // { "PhysicsShapeQueryResult", "PhysicsShapeQueryResult3D" }, // Class is not visible in ClassDB + // { "NativeScript","GDExtension"}, ?? + { "ARVRAnchor", "XRAnchor3D" }, + { "ARVRCamera", "XRCamera3D" }, + { "ARVRController", "XRController3D" }, + { "ARVRInterface", "XRInterface" }, + { "ARVRInterfaceGDNative", "Node3D" }, + { "ARVROrigin", "XROrigin3D" }, + { "ARVRPositionalTracker", "XRPositionalTracker" }, + { "ARVRServer", "XRServer" }, + { "AStar", "AStar3D" }, + { "AnimatedSprite", "AnimatedSprite2D" }, + { "AnimationTreePlayer", "AnimationTree" }, + { "Area", "Area3D" }, // Be careful, this will be used everywhere + { "AudioStreamOGGVorbis", "AudioStreamOggVorbis" }, + { "AudioStreamRandomPitch", "AudioStreamRandomizer" }, + { "AudioStreamSample", "AudioStreamWAV" }, + { "BakedLightmap", "LightmapGI" }, + { "BakedLightmapData", "LightmapGIData" }, + { "BitmapFont", "FontFile" }, + { "BoneAttachment", "BoneAttachment3D" }, + { "BoxShape", "BoxShape3D" }, + { "CPUParticles", "CPUParticles3D" }, + { "CSGBox", "CSGBox3D" }, + { "CSGCombiner", "CSGCombiner3D" }, + { "CSGCylinder", "CSGCylinder3D" }, + { "CSGMesh", "CSGMesh3D" }, + { "CSGPolygon", "CSGPolygon3D" }, + { "CSGPrimitive", "CSGPrimitive3D" }, + { "CSGShape", "CSGShape3D" }, + { "CSGSphere", "CSGSphere3D" }, + { "CSGTorus", "CSGTorus3D" }, + { "Camera", "Camera3D" }, // Be careful, this will be used everywhere + { "CapsuleShape", "CapsuleShape3D" }, + { "ClippedCamera", "Camera3D" }, + { "CollisionObject", "CollisionObject3D" }, + { "CollisionPolygon", "CollisionPolygon3D" }, + { "CollisionShape", "CollisionShape3D" }, + { "ConcavePolygonShape", "ConcavePolygonShape3D" }, + { "ConeTwistJoint", "ConeTwistJoint3D" }, + { "ConvexPolygonShape", "ConvexPolygonShape3D" }, + { "CubeMap", "Cubemap" }, + { "CubeMesh", "BoxMesh" }, + { "CylinderShape", "CylinderShape3D" }, + { "DirectionalLight", "DirectionalLight3D" }, + { "DynamicFont", "FontFile" }, + { "DynamicFontData", "FontFile" }, + { "EditorNavigationMeshGenerator", "NavigationMeshGenerator" }, + { "EditorSceneImporter", "EditorSceneFormatImporter" }, + { "EditorSceneImporterFBX", "EditorSceneFormatImporterFBX" }, + { "EditorSceneImporterGLTF", "EditorSceneFormatImporterGLTF" }, + { "EditorSpatialGizmo", "EditorNode3DGizmo" }, + { "EditorSpatialGizmoPlugin", "EditorNode3DGizmoPlugin" }, + { "ExternalTexture", "ImageTexture" }, + { "FuncRef", "Callable" }, + { "GIProbe", "VoxelGI" }, + { "GIProbeData", "VoxelGIData" }, + { "Generic6DOFJoint", "Generic6DOFJoint3D" }, + { "Geometry", "Geometry2D" }, // Geometry class is split between Geometry2D and Geometry3D so we need to choose one + { "GeometryInstance", "GeometryInstance3D" }, + { "GradientTexture", "GradientTexture2D" }, + { "HeightMapShape", "HeightMapShape3D" }, + { "HingeJoint", "HingeJoint3D" }, + { "IP_Unix", "IPUnix" }, + { "ImmediateGeometry", "ImmediateMesh" }, + { "ImmediateGeometry3D", "ImmediateMesh" }, + { "InterpolatedCamera", "Camera3D" }, + { "InterpolatedCamera3D", "Camera3D" }, + { "JSONParseResult", "JSON" }, + { "Joint", "Joint3D" }, + { "KinematicBody", "CharacterBody3D" }, + { "KinematicBody2D", "CharacterBody2D" }, + { "KinematicCollision", "KinematicCollision3D" }, + { "LargeTexture", "ImageTexture" }, + { "Light", "Light3D" }, + { "Light2D", "PointLight2D" }, + { "LineShape2D", "WorldBoundaryShape2D" }, + { "Listener", "AudioListener3D" }, + { "Listener2D", "AudioListener2D" }, + { "MeshInstance", "MeshInstance3D" }, + { "MultiMeshInstance", "MultiMeshInstance3D" }, + { "MultiplayerPeerGDNative", "MultiplayerPeerExtension" }, + { "Navigation", "Node3D" }, + { "Navigation2D", "Node2D" }, + { "Navigation2DServer", "NavigationServer2D" }, + { "Navigation3D", "Node3D" }, + { "NavigationAgent", "NavigationAgent3D" }, + { "NavigationMeshInstance", "NavigationRegion3D" }, + { "NavigationObstacle", "NavigationObstacle3D" }, + { "NavigationPolygonInstance", "NavigationRegion2D" }, + { "NavigationRegion", "NavigationRegion3D" }, + { "NavigationServer", "NavigationServer3D" }, + { "NetworkedMultiplayerENet", "ENetMultiplayerPeer" }, + { "NetworkedMultiplayerPeer", "MultiplayerPeer" }, + { "Occluder", "OccluderInstance3D" }, + { "OmniLight", "OmniLight3D" }, + { "PHashTranslation", "OptimizedTranslation" }, + { "PacketPeerGDNative", "PacketPeerExtension" }, + { "PanoramaSky", "Sky" }, + { "Particles", "GPUParticles3D" }, // Be careful, this will be used everywhere + { "Particles2D", "GPUParticles2D" }, + { "ParticlesMaterial", "ParticleProcessMaterial" }, + { "Path", "Path3D" }, // Be careful, this will be used everywhere + { "PathFollow", "PathFollow3D" }, + { "PhysicalBone", "PhysicalBone3D" }, + { "Physics2DDirectBodyState", "PhysicsDirectBodyState2D" }, + { "Physics2DDirectSpaceState", "PhysicsDirectSpaceState2D" }, + { "Physics2DServer", "PhysicsServer2D" }, + { "Physics2DServerSW", "GodotPhysicsServer2D" }, + { "Physics2DShapeQueryParameters", "PhysicsShapeQueryParameters2D" }, + { "Physics2DTestMotionResult", "PhysicsTestMotionResult2D" }, + { "PhysicsBody", "PhysicsBody3D" }, + { "PhysicsDirectBodyState", "PhysicsDirectBodyState3D" }, + { "PhysicsDirectSpaceState", "PhysicsDirectSpaceState3D" }, + { "PhysicsServer", "PhysicsServer3D" }, + { "PhysicsShapeQueryParameters", "PhysicsShapeQueryParameters3D" }, + { "PhysicsTestMotionResult", "PhysicsTestMotionResult3D" }, + { "PinJoint", "PinJoint3D" }, + { "PlaneShape", "WorldBoundaryShape3D" }, + { "PopupDialog", "Popup" }, + { "Position2D", "Marker2D" }, + { "Position3D", "Marker3D" }, + { "ProceduralSky", "Sky" }, + { "RayCast", "RayCast3D" }, + { "RayShape", "SeparationRayShape3D" }, + { "RayShape2D", "SeparationRayShape2D" }, + { "Reference", "RefCounted" }, // Be careful, this will be used everywhere + { "RemoteTransform", "RemoteTransform3D" }, + { "ResourceInteractiveLoader", "ResourceLoader" }, + { "RigidBody", "RigidBody3D" }, + { "SceneTreeTween", "Tween" }, + { "Shape", "Shape3D" }, // Be careful, this will be used everywhere + { "ShortCut", "Shortcut" }, + { "Skeleton", "Skeleton3D" }, + { "SkeletonIK", "SkeletonIK3D" }, + { "SliderJoint", "SliderJoint3D" }, + { "SoftBody", "SoftBody3D" }, + { "Spatial", "Node3D" }, + { "SpatialGizmo", "Node3DGizmo" }, + { "SpatialMaterial", "StandardMaterial3D" }, + { "SphereShape", "SphereShape3D" }, + { "SpotLight", "SpotLight3D" }, + { "SpringArm", "SpringArm3D" }, + { "Sprite", "Sprite2D" }, + { "StaticBody", "StaticBody3D" }, + { "StreamCubemap", "CompressedCubemap" }, + { "StreamCubemapArray", "CompressedCubemapArray" }, + { "StreamPeerGDNative", "StreamPeerExtension" }, + { "StreamPeerSSL", "StreamPeerTLS" }, + { "StreamTexture", "CompressedTexture2D" }, + { "StreamTexture2D", "CompressedTexture2D" }, + { "StreamTexture2DArray", "CompressedTexture2DArray" }, + { "StreamTextureLayered", "CompressedTextureLayered" }, + { "TCP_Server", "TCPServer" }, + { "Tabs", "TabBar" }, // Be careful, this will be used everywhere + { "TextFile", "Node3D" }, + { "Texture", "Texture2D" }, // May broke TextureRect + { "TextureArray", "Texture2DArray" }, + { "TextureProgress", "TextureProgressBar" }, + { "ToolButton", "Button" }, + { "VehicleBody", "VehicleBody3D" }, + { "VehicleWheel", "VehicleWheel3D" }, + { "VideoPlayer", "VideoStreamPlayer" }, + { "Viewport", "SubViewport" }, + { "ViewportContainer", "SubViewportContainer" }, + { "VisibilityEnabler", "VisibleOnScreenEnabler3D" }, + { "VisibilityEnabler2D", "VisibleOnScreenEnabler2D" }, + { "VisibilityNotifier", "VisibleOnScreenNotifier3D" }, + { "VisibilityNotifier2D", "VisibleOnScreenNotifier2D" }, + { "VisibilityNotifier3D", "VisibleOnScreenNotifier3D" }, + { "VisualInstance", "VisualInstance3D" }, + { "VisualServer", "RenderingServer" }, + { "VisualShaderNodeCubeMap", "VisualShaderNodeCubemap" }, + { "VisualShaderNodeScalarClamp", "VisualShaderNodeClamp" }, + { "VisualShaderNodeScalarConstant", "VisualShaderNodeFloatConstant" }, + { "VisualShaderNodeScalarFunc", "VisualShaderNodeFloatFunc" }, + { "VisualShaderNodeScalarInterp", "VisualShaderNodeMix" }, + { "VisualShaderNodeScalarOp", "VisualShaderNodeFloatOp" }, + { "VisualShaderNodeScalarSmoothStep", "VisualShaderNodeSmoothStep" }, + { "VisualShaderNodeScalarSwitch", "VisualShaderNodeSwitch" }, + { "VisualShaderNodeScalarTransformMult", "VisualShaderNodeTransformOp" }, + { "VisualShaderNodeTransformMult", "VisualShaderNode" }, + { "VisualShaderNodeVectorClamp", "VisualShaderNodeClamp" }, + { "VisualShaderNodeVectorInterp", "VisualShaderNodeMix" }, + { "VisualShaderNodeVectorScalarMix", "VisualShaderNodeMix" }, + { "VisualShaderNodeVectorScalarSmoothStep", "VisualShaderNodeSmoothStep" }, + { "VisualShaderNodeVectorScalarStep", "VisualShaderNodeStep" }, + { "VisualShaderNodeVectorSmoothStep", "VisualShaderNodeSmoothStep" }, + { "VisualShaderNodeBooleanUniform", "VisualShaderNodeBooleanParameter" }, + { "VisualShaderNodeColorUniform", "VisualShaderNodeColorParameter" }, + { "VisualShaderNodeScalarUniform", "VisualShaderNodeFloatParameter" }, + { "VisualShaderNodeCubemapUniform", "VisualShaderNodeCubemapParameter" }, + { "VisualShaderNodeTextureUniform", "VisualShaderNodeTexture2DParameter" }, + { "VisualShaderNodeTextureUniformTriplanar", "VisualShaderNodeTextureParameterTriplanar" }, + { "VisualShaderNodeTransformUniform", "VisualShaderNodeTransformParameter" }, + { "VisualShaderNodeVec3Uniform", "VisualShaderNodeVec3Parameter" }, + { "VisualShaderNodeUniform", "VisualShaderNodeParameter" }, + { "VisualShaderNodeUniformRef", "VisualShaderNodeParameterRef" }, + { "WebRTCDataChannelGDNative", "WebRTCDataChannelExtension" }, + { "WebRTCMultiplayer", "WebRTCMultiplayerPeer" }, + { "WebRTCPeerConnectionGDNative", "WebRTCPeerConnectionExtension" }, + { "WindowDialog", "Window" }, + { "World", "World3D" }, // Be careful, this will be used everywhere + { "XRAnchor", "XRAnchor3D" }, + { "XRController", "XRController3D" }, + { "XROrigin", "XROrigin3D" }, + { "YSort", "Node2D" }, + + { "CullInstance", "Node3D" }, // Probably this type needs to be added to Godot 4.0, since it is for now only available only in Godot 3.x + { "RoomGroup", "Node3D" }, // Probably this type needs to be added to Godot 4.0, since it is for now only available only in Godot 3.x + { "Room", "Node3D" }, // Probably this type needs to be added to Godot 4.0, since it is for now only available only in Godot 3.x + { "RoomManager", "Node3D" }, // Probably this type needs to be added to Godot 4.0, since it is for now only available only in Godot 3.x + { "Portal", "Node3D" }, // Probably this type needs to be added to Godot 4.0, since it is for now only available only in Godot 3.x + + { nullptr, nullptr }, +}; + +const char *RenamesMap3To4::color_renames[][2] = { + { "aliceblue", "ALICE_BLUE" }, + { "antiquewhite", "ANTIQUE_WHITE" }, + { "aqua", "AQUA" }, + { "aquamarine", "AQUAMARINE" }, + { "azure", "AZURE" }, + { "beige", "BEIGE" }, + { "bisque", "BISQUE" }, + { "black", "BLACK" }, + { "blanchedalmond", "BLANCHED_ALMOND" }, + { "blue", "BLUE" }, + { "blueviolet", "BLUE_VIOLET" }, + { "brown", "BROWN" }, + { "burlywood", "BURLYWOOD" }, + { "cadetblue", "CADET_BLUE" }, + { "chartreuse", "CHARTREUSE" }, + { "chocolate", "CHOCOLATE" }, + { "coral", "CORAL" }, + { "cornflowerblue", "CORNFLOWER_BLUE" }, + { "cornsilk", "CORNSILK" }, + { "crimson", "CRIMSON" }, + { "cyan", "CYAN" }, + { "darkblue", "DARK_BLUE" }, + { "darkcyan", "DARK_CYAN" }, + { "darkgoldenrod", "DARK_GOLDENROD" }, + { "darkgray", "DARK_GRAY" }, + { "darkgreen", "DARK_GREEN" }, + { "darkkhaki", "DARK_KHAKI" }, + { "darkmagenta", "DARK_MAGENTA" }, + { "darkolivegreen", "DARK_OLIVE_GREEN" }, + { "darkorange", "DARK_ORANGE" }, + { "darkorchid", "DARK_ORCHID" }, + { "darkred", "DARK_RED" }, + { "darksalmon", "DARK_SALMON" }, + { "darkseagreen", "DARK_SEA_GREEN" }, + { "darkslateblue", "DARK_SLATE_BLUE" }, + { "darkslategray", "DARK_SLATE_GRAY" }, + { "darkturquoise", "DARK_TURQUOISE" }, + { "darkviolet", "DARK_VIOLET" }, + { "deeppink", "DEEP_PINK" }, + { "deepskyblue", "DEEP_SKY_BLUE" }, + { "dimgray", "DIM_GRAY" }, + { "dodgerblue", "DODGER_BLUE" }, + { "firebrick", "FIREBRICK" }, + { "floralwhite", "FLORAL_WHITE" }, + { "forestgreen", "FOREST_GREEN" }, + { "fuchsia", "FUCHSIA" }, + { "gainsboro", "GAINSBORO" }, + { "ghostwhite", "GHOST_WHITE" }, + { "gold", "GOLD" }, + { "goldenrod", "GOLDENROD" }, + { "gray", "GRAY" }, + { "green", "GREEN" }, + { "greenyellow", "GREEN_YELLOW" }, + { "honeydew", "HONEYDEW" }, + { "hotpink", "HOT_PINK" }, + { "indianred", "INDIAN_RED" }, + { "indigo", "INDIGO" }, + { "ivory", "IVORY" }, + { "khaki", "KHAKI" }, + { "lavender", "LAVENDER" }, + { "lavenderblush", "LAVENDER_BLUSH" }, + { "lawngreen", "LAWN_GREEN" }, + { "lemonchiffon", "LEMON_CHIFFON" }, + { "lightblue", "LIGHT_BLUE" }, + { "lightcoral", "LIGHT_CORAL" }, + { "lightcyan", "LIGHT_CYAN" }, + { "lightgoldenrod", "LIGHT_GOLDENROD" }, + { "lightgray", "LIGHT_GRAY" }, + { "lightgreen", "LIGHT_GREEN" }, + { "lightpink", "LIGHT_PINK" }, + { "lightsalmon", "LIGHT_SALMON" }, + { "lightseagreen", "LIGHT_SEA_GREEN" }, + { "lightskyblue", "LIGHT_SKY_BLUE" }, + { "lightslategray", "LIGHT_SLATE_GRAY" }, + { "lightsteelblue", "LIGHT_STEEL_BLUE" }, + { "lightyellow", "LIGHT_YELLOW" }, + { "lime", "LIME" }, + { "limegreen", "LIME_GREEN" }, + { "linen", "LINEN" }, + { "magenta", "MAGENTA" }, + { "maroon", "MAROON" }, + { "mediumaquamarine", "MEDIUM_AQUAMARINE" }, + { "mediumblue", "MEDIUM_BLUE" }, + { "mediumorchid", "MEDIUM_ORCHID" }, + { "mediumpurple", "MEDIUM_PURPLE" }, + { "mediumseagreen", "MEDIUM_SEA_GREEN" }, + { "mediumslateblue", "MEDIUM_SLATE_BLUE" }, + { "mediumspringgreen", "MEDIUM_SPRING_GREEN" }, + { "mediumturquoise", "MEDIUM_TURQUOISE" }, + { "mediumvioletred", "MEDIUM_VIOLET_RED" }, + { "midnightblue", "MIDNIGHT_BLUE" }, + { "mintcream", "MINT_CREAM" }, + { "mistyrose", "MISTY_ROSE" }, + { "moccasin", "MOCCASIN" }, + { "navajowhite", "NAVAJO_WHITE" }, + { "navyblue", "NAVY_BLUE" }, + { "oldlace", "OLD_LACE" }, + { "olive", "OLIVE" }, + { "olivedrab", "OLIVE_DRAB" }, + { "orange", "ORANGE" }, + { "orangered", "ORANGE_RED" }, + { "orchid", "ORCHID" }, + { "palegoldenrod", "PALE_GOLDENROD" }, + { "palegreen", "PALE_GREEN" }, + { "paleturquoise", "PALE_TURQUOISE" }, + { "palevioletred", "PALE_VIOLET_RED" }, + { "papayawhip", "PAPAYA_WHIP" }, + { "peachpuff", "PEACH_PUFF" }, + { "peru", "PERU" }, + { "pink", "PINK" }, + { "plum", "PLUM" }, + { "powderblue", "POWDER_BLUE" }, + { "purple", "PURPLE" }, + { "rebeccapurple", "REBECCA_PURPLE" }, + { "red", "RED" }, + { "rosybrown", "ROSY_BROWN" }, + { "royalblue", "ROYAL_BLUE" }, + { "saddlebrown", "SADDLE_BROWN" }, + { "salmon", "SALMON" }, + { "sandybrown", "SANDY_BROWN" }, + { "seagreen", "SEA_GREEN" }, + { "seashell", "SEASHELL" }, + { "sienna", "SIENNA" }, + { "silver", "SILVER" }, + { "skyblue", "SKY_BLUE" }, + { "slateblue", "SLATE_BLUE" }, + { "slategray", "SLATE_GRAY" }, + { "snow", "SNOW" }, + { "springgreen", "SPRING_GREEN" }, + { "steelblue", "STEEL_BLUE" }, + { "tan", "TAN" }, + { "teal", "TEAL" }, + { "thistle", "THISTLE" }, + { "tomato", "TOMATO" }, + { "transparent", "TRANSPARENT" }, + { "turquoise", "TURQUOISE" }, + { "violet", "VIOLET" }, + { "webgray", "WEB_GRAY" }, + { "webgreen", "WEB_GREEN" }, + { "webmaroon", "WEB_MAROON" }, + { "webpurple", "WEB_PURPLE" }, + { "wheat", "WHEAT" }, + { "white", "WHITE" }, + { "whitesmoke", "WHITE_SMOKE" }, + { "yellow", "YELLOW" }, + { "yellowgreen", "YELLOW_GREEN" }, + + { nullptr, nullptr }, +}; + +#endif // DISABLE_DEPRECATED diff --git a/editor/renames_map_3_to_4.h b/editor/renames_map_3_to_4.h new file mode 100644 index 0000000000..119ededf43 --- /dev/null +++ b/editor/renames_map_3_to_4.h @@ -0,0 +1,54 @@ +/**************************************************************************/ +/* renames_map_3_to_4.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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 RENAMES_MAP_3_TO_4_H +#define RENAMES_MAP_3_TO_4_H + +#ifndef DISABLE_DEPRECATED + +struct RenamesMap3To4 { + static const char *enum_renames[][2]; + static const char *gdscript_function_renames[][2]; + static const char *csharp_function_renames[][2]; + static const char *gdscript_properties_renames[][2]; + static const char *csharp_properties_renames[][2]; + static const char *gdscript_signals_renames[][2]; + static const char *csharp_signals_renames[][2]; + static const char *project_settings_renames[][2]; + static const char *input_map_renames[][2]; + static const char *builtin_types_renames[][2]; + static const char *shaders_renames[][2]; + static const char *class_renames[][2]; + static const char *color_renames[][2]; +}; + +#endif // DISABLE_DEPRECATED + +#endif // RENAMES_MAP_3_TO_4_H diff --git a/main/main.cpp b/main/main.cpp index 3aa9a44a21..81f2c101a1 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -72,6 +72,7 @@ #include "servers/movie_writer/movie_writer_mjpeg.h" #include "servers/navigation_server_2d.h" #include "servers/navigation_server_3d.h" +#include "servers/navigation_server_3d_dummy.h" #include "servers/physics_server_2d.h" #include "servers/physics_server_3d.h" #include "servers/register_server_types.h" @@ -93,13 +94,17 @@ #include "editor/editor_settings.h" #include "editor/editor_translation.h" #include "editor/progress_dialog.h" -#include "editor/project_converter_3_to_4.h" #include "editor/project_manager.h" #include "editor/register_editor_types.h" + #ifndef NO_EDITOR_SPLASH #include "main/splash_editor.gen.h" #endif -#endif + +#ifndef DISABLE_DEPRECATED +#include "editor/project_converter_3_to_4.h" +#endif // DISABLE_DEPRECATED +#endif // TOOLS_ENABLED #include "modules/modules_enabled.gen.h" // For mono. @@ -163,8 +168,10 @@ static OS::ProcessID editor_pid = 0; static bool found_project = false; static bool auto_build_solutions = false; static String debug_server_uri; +#ifndef DISABLE_DEPRECATED static int converter_max_kb_file = 4 * 1024; // 4MB static int converter_max_line_length = 100000; +#endif // DISABLE_DEPRECATED HashMap<Main::CLIScope, Vector<String>> forwardable_cli_arguments; #endif @@ -278,8 +285,21 @@ void finalize_display() { void initialize_navigation_server() { ERR_FAIL_COND(navigation_server_3d != nullptr); + // Init 3D Navigation Server navigation_server_3d = NavigationServer3DManager::new_default_server(); + + // Fall back to dummy if no default server has been registered. + if (!navigation_server_3d) { + WARN_PRINT_ONCE("No NavigationServer3D implementation has been registered! Falling back to a dummy implementation: navigation features will be unavailable."); + navigation_server_3d = memnew(NavigationServer3DDummy); + } + + // Should be impossible, but make sure it's not null. + ERR_FAIL_NULL_MSG(navigation_server_3d, "Failed to initialize NavigationServer3D."); + + // Init 2D Navigation Server navigation_server_2d = memnew(NavigationServer2D); + ERR_FAIL_NULL_MSG(navigation_server_2d, "Failed to initialize NavigationServer2D."); } void finalize_navigation_server() { @@ -423,10 +443,12 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" The target directory must exist.\n"); OS::get_singleton()->print(" --export-debug <preset> <path> Export the project in debug mode using the given preset and output path. See --export-release description for other considerations.\n"); OS::get_singleton()->print(" --export-pack <preset> <path> Export the project data only using the given preset and output path. The <path> extension determines whether it will be in PCK or ZIP format.\n"); +#ifndef DISABLE_DEPRECATED OS::get_singleton()->print(" --convert-3to4 [<max_file_kb>] [<max_line_size>]\n"); OS::get_singleton()->print(" Converts project from Godot 3.x to Godot 4.x.\n"); OS::get_singleton()->print(" --validate-conversion-3to4 [<max_file_kb>] [<max_line_size>]\n"); OS::get_singleton()->print(" Shows what elements will be renamed when converting project from Godot 3.x to Godot 4.x.\n"); +#endif // DISABLE_DEPRECATED 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"); @@ -1108,6 +1130,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph editor = true; cmdline_tool = true; main_args.push_back(I->get()); +#ifndef DISABLE_DEPRECATED } else if (I->get() == "--convert-3to4") { // Actually handling is done in start(). cmdline_tool = true; @@ -1138,6 +1161,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } } } +#endif // DISABLE_DEPRECATED } else if (I->get() == "--doctool") { // Actually handling is done in start(). cmdline_tool = true; @@ -1147,7 +1171,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph audio_driver = NULL_AUDIO_DRIVER; display_driver = NULL_DISPLAY_DRIVER; main_args.push_back(I->get()); -#endif +#endif // TOOLS_ENABLED } else if (I->get() == "--path") { // set path of project to start or edit if (I->next()) { @@ -2370,7 +2394,7 @@ bool Main::start() { bool converting_project = false; bool validating_converting_project = false; #endif // DISABLE_DEPRECATED -#endif +#endif // TOOLS_ENABLED main_timer_sync.init(OS::get_singleton()->get_ticks_usec()); List<String> args = OS::get_singleton()->get_cmdline_args(); @@ -2395,7 +2419,7 @@ bool Main::start() { editor = true; } else if (args[i] == "-p" || args[i] == "--project-manager") { project_manager = true; -#endif +#endif // TOOLS_ENABLED } else if (args[i].length() && args[i][0] != '-' && positional_arg.is_empty()) { positional_arg = args[i]; @@ -2553,18 +2577,22 @@ bool Main::start() { #ifndef DISABLE_DEPRECATED if (converting_project) { - int exit_code = ProjectConverter3To4(converter_max_kb_file, converter_max_line_length).convert(); - OS::get_singleton()->set_exit_code(exit_code); + int ret = ProjectConverter3To4(converter_max_kb_file, converter_max_line_length).convert(); + if (ret) { + OS::get_singleton()->set_exit_code(EXIT_SUCCESS); + } return false; } if (validating_converting_project) { - int exit_code = ProjectConverter3To4(converter_max_kb_file, converter_max_line_length).validate_conversion(); - OS::get_singleton()->set_exit_code(exit_code); + bool ret = ProjectConverter3To4(converter_max_kb_file, converter_max_line_length).validate_conversion(); + if (ret) { + OS::get_singleton()->set_exit_code(EXIT_SUCCESS); + } return false; } #endif // DISABLE_DEPRECATED -#endif +#endif // TOOLS_ENABLED if (script.is_empty() && game_path.is_empty() && String(GLOBAL_GET("application/run/main_scene")) != "") { game_path = GLOBAL_GET("application/run/main_scene"); diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 13c7a8202c..afb8e62eea 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -1255,6 +1255,30 @@ Vector3 CSGBox3D::get_size() const { return size; } +#ifndef DISABLE_DEPRECATED +// Kept for compatibility from 3.x to 4.0. +bool CSGBox3D::_set(const StringName &p_name, const Variant &p_value) { + if (p_name == "width") { + size.x = p_value; + _make_dirty(); + update_gizmos(); + return true; + } else if (p_name == "height") { + size.y = p_value; + _make_dirty(); + update_gizmos(); + return true; + } else if (p_name == "depth") { + size.z = p_value; + _make_dirty(); + update_gizmos(); + return true; + } else { + return false; + } +} +#endif + void CSGBox3D::set_material(const Ref<Material> &p_material) { material = p_material; _make_dirty(); diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index 9012c37679..c244107bfb 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -248,6 +248,10 @@ class CSGBox3D : public CSGPrimitive3D { protected: static void _bind_methods(); +#ifndef DISABLE_DEPRECATED + // Kept for compatibility from 3.x to 4.0. + bool _set(const StringName &p_name, const Variant &p_value); +#endif public: void set_size(const Vector3 &p_size); diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 602d07d9a7..de0dacece3 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -42,6 +42,11 @@ #include "gdscript_utility_functions.h" #include "scene/resources/packed_scene.h" +#if defined(TOOLS_ENABLED) && !defined(DISABLE_DEPRECATED) +#define SUGGEST_GODOT4_RENAMES +#include "editor/renames_map_3_to_4.h" +#endif + #define UNNAMED_ENUM "<anonymous enum>" #define ENUM_SEPARATOR "::" @@ -2601,9 +2606,8 @@ void GDScriptAnalyzer::reduce_binary_op(GDScriptParser::BinaryOpNode *p_binary_o p_binary_op->set_datatype(result); } -#ifdef TOOLS_ENABLED -#ifndef DISABLE_DEPRECATED -const char *GDScriptAnalyzer::get_rename_from_map(const char *map[][2], String key) { +#ifdef SUGGEST_GODOT4_RENAMES +const char *get_rename_from_map(const char *map[][2], String key) { for (int index = 0; map[index][0]; index++) { if (map[index][0] == key) { return map[index][1]; @@ -2614,39 +2618,39 @@ const char *GDScriptAnalyzer::get_rename_from_map(const char *map[][2], String k // Checks if an identifier/function name has been renamed in Godot 4, uses ProjectConverter3To4 for rename map. // Returns the new name if found, nullptr otherwise. -const char *GDScriptAnalyzer::check_for_renamed_identifier(String identifier, GDScriptParser::Node::Type type) { +const char *check_for_renamed_identifier(String identifier, GDScriptParser::Node::Type type) { switch (type) { case GDScriptParser::Node::IDENTIFIER: { // Check properties - const char *result = get_rename_from_map(ProjectConverter3To4::gdscript_properties_renames, identifier); + const char *result = get_rename_from_map(RenamesMap3To4::gdscript_properties_renames, identifier); if (result) { return result; } // Check enum values - result = get_rename_from_map(ProjectConverter3To4::enum_renames, identifier); + result = get_rename_from_map(RenamesMap3To4::enum_renames, identifier); if (result) { return result; } // Check color constants - result = get_rename_from_map(ProjectConverter3To4::color_renames, identifier); + result = get_rename_from_map(RenamesMap3To4::color_renames, identifier); if (result) { return result; } // Check type names - result = get_rename_from_map(ProjectConverter3To4::class_renames, identifier); + result = get_rename_from_map(RenamesMap3To4::class_renames, identifier); if (result) { return result; } - return get_rename_from_map(ProjectConverter3To4::builtin_types_renames, identifier); + return get_rename_from_map(RenamesMap3To4::builtin_types_renames, identifier); } case GDScriptParser::Node::CALL: { - const char *result = get_rename_from_map(ProjectConverter3To4::gdscript_function_renames, identifier); + const char *result = get_rename_from_map(RenamesMap3To4::gdscript_function_renames, identifier); if (result) { return result; } // Built-in Types are mistaken for function calls when the built-in type is not found. // Check built-in types if function rename not found - return get_rename_from_map(ProjectConverter3To4::builtin_types_renames, identifier); + return get_rename_from_map(RenamesMap3To4::builtin_types_renames, identifier); } // Signal references don't get parsed through the GDScriptAnalyzer. No support for signal rename hints. default: @@ -2654,8 +2658,7 @@ const char *GDScriptAnalyzer::check_for_renamed_identifier(String identifier, GD return nullptr; } } -#endif // DISABLE_DEPRECATED -#endif // TOOLS_ENABLED +#endif // SUGGEST_GODOT4_RENAMES void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_await, bool p_is_root) { bool all_is_constant = true; @@ -3078,8 +3081,7 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a } if (!found && (is_self || (base_type.is_hard_type() && base_type.kind == GDScriptParser::DataType::BUILTIN))) { String base_name = is_self && !p_call->is_super ? "self" : base_type.to_string(); -#ifdef TOOLS_ENABLED -#ifndef DISABLE_DEPRECATED +#ifdef SUGGEST_GODOT4_RENAMES String rename_hint = String(); if (GLOBAL_GET(GDScriptWarning::get_settings_path_from_code(GDScriptWarning::Code::RENAMED_IN_GD4_HINT)).booleanize()) { const char *renamed_function_name = check_for_renamed_identifier(p_call->function_name, p_call->type); @@ -3088,12 +3090,9 @@ void GDScriptAnalyzer::reduce_call(GDScriptParser::CallNode *p_call, bool p_is_a } } push_error(vformat(R"*(Function "%s()" not found in base %s.%s)*", p_call->function_name, base_name, rename_hint), p_call->is_super ? p_call : p_call->callee); -#else // !DISABLE_DEPRECATED - push_error(vformat(R"*(Function "%s()" not found in base %s.)*", p_call->function_name, base_name), p_call->is_super ? p_call : p_call->callee); -#endif // DISABLE_DEPRECATED #else push_error(vformat(R"*(Function "%s()" not found in base %s.)*", p_call->function_name, base_name), p_call->is_super ? p_call : p_call->callee); -#endif +#endif // SUGGEST_GODOT4_RENAMES } else if (!found && (!p_call->is_super && base_type.is_hard_type() && base_type.kind == GDScriptParser::DataType::NATIVE && base_type.is_meta_type)) { push_error(vformat(R"*(Static function "%s()" not found in base "%s".)*", p_call->function_name, base_type.native_type), p_call); } @@ -3283,8 +3282,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod p_identifier->reduced_value = result; p_identifier->set_datatype(type_from_variant(result, p_identifier)); } else if (base.is_hard_type()) { -#ifdef TOOLS_ENABLED -#ifndef DISABLE_DEPRECATED +#ifdef SUGGEST_GODOT4_RENAMES String rename_hint = String(); if (GLOBAL_GET(GDScriptWarning::get_settings_path_from_code(GDScriptWarning::Code::RENAMED_IN_GD4_HINT)).booleanize()) { const char *renamed_identifier_name = check_for_renamed_identifier(name, p_identifier->type); @@ -3293,12 +3291,9 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod } } push_error(vformat(R"(Cannot find constant "%s" on base "%s".%s)", name, base.to_string(), rename_hint), p_identifier); -#else // !DISABLE_DEPRECATED - push_error(vformat(R"(Cannot find constant "%s" on base "%s".)", name, base.to_string()), p_identifier); -#endif // DISABLE_DEPRECATED #else push_error(vformat(R"(Cannot find constant "%s" on base "%s".)", name, base.to_string()), p_identifier); -#endif +#endif // SUGGEST_GODOT4_RENAMES } } else { switch (base.builtin_type) { @@ -3327,8 +3322,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod } } if (base.is_hard_type()) { -#ifdef TOOLS_ENABLED -#ifndef DISABLE_DEPRECATED +#ifdef SUGGEST_GODOT4_RENAMES String rename_hint = String(); if (GLOBAL_GET(GDScriptWarning::get_settings_path_from_code(GDScriptWarning::Code::RENAMED_IN_GD4_HINT)).booleanize()) { const char *renamed_identifier_name = check_for_renamed_identifier(name, p_identifier->type); @@ -3337,12 +3331,9 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod } } push_error(vformat(R"(Cannot find property "%s" on base "%s".%s)", name, base.to_string(), rename_hint), p_identifier); -#else // !DISABLE_DEPRECATED - push_error(vformat(R"(Cannot find property "%s" on base "%s".)", name, base.to_string()), p_identifier); -#endif // DISABLE_DEPRECATED #else push_error(vformat(R"(Cannot find property "%s" on base "%s".)", name, base.to_string()), p_identifier); -#endif +#endif // SUGGEST_GODOT4_RENAMES } } } @@ -3682,8 +3673,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident if (GDScriptUtilityFunctions::function_exists(name)) { push_error(vformat(R"(Built-in function "%s" cannot be used as an identifier.)", name), p_identifier); } else { -#ifdef TOOLS_ENABLED -#ifndef DISABLE_DEPRECATED +#ifdef SUGGEST_GODOT4_RENAMES String rename_hint = String(); if (GLOBAL_GET(GDScriptWarning::get_settings_path_from_code(GDScriptWarning::Code::RENAMED_IN_GD4_HINT)).booleanize()) { const char *renamed_identifier_name = check_for_renamed_identifier(name, p_identifier->type); @@ -3692,12 +3682,9 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident } } push_error(vformat(R"(Identifier "%s" not declared in the current scope.%s)", name, rename_hint), p_identifier); -#else // !DISABLE_DEPRECATED - push_error(vformat(R"(Identifier "%s" not declared in the current scope.)", name), p_identifier); -#endif // DISABLE_DEPRECATED #else push_error(vformat(R"(Identifier "%s" not declared in the current scope.)", name), p_identifier); -#endif +#endif // SUGGEST_GODOT4_RENAMES } GDScriptParser::DataType dummy; dummy.kind = GDScriptParser::DataType::VARIANT; diff --git a/modules/gdscript/gdscript_analyzer.h b/modules/gdscript/gdscript_analyzer.h index a4c84db6b9..cdeba374c7 100644 --- a/modules/gdscript/gdscript_analyzer.h +++ b/modules/gdscript/gdscript_analyzer.h @@ -37,10 +37,6 @@ #include "gdscript_cache.h" #include "gdscript_parser.h" -#ifdef TOOLS_ENABLED -#include "editor/project_converter_3_to_4.h" -#endif - class GDScriptAnalyzer { GDScriptParser *parser = nullptr; HashMap<String, Ref<GDScriptParserRef>> depended_parsers; @@ -137,13 +133,6 @@ class GDScriptAnalyzer { bool is_shadowing(GDScriptParser::IdentifierNode *p_local, const String &p_context); #endif -#ifdef TOOLS_ENABLED -#ifndef DISABLE_DEPRECATED - const char *get_rename_from_map(const char *map[][2], String key); - const char *check_for_renamed_identifier(String identifier, GDScriptParser::Node::Type type); -#endif // DISABLE_DEPRECATED -#endif // TOOLS_ENABLED - public: Error resolve_inheritance(); Error resolve_interface(); diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 3543c0a79f..8cfd48b52b 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -3491,14 +3491,6 @@ static Error _lookup_symbol_from_base(const GDScriptParser::DataType &p_base, co break; } - if (context.current_class) { - if (context.type != GDScriptParser::COMPLETION_SUPER_METHOD) { - base.type = context.current_class->get_datatype(); - } else { - base.type = context.current_class->base_type; - } - } - if (_lookup_symbol_from_base(base.type, p_symbol, is_function, r_result) == OK) { return OK; } diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index 6c26e226a5..7a11ea52f0 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -447,6 +447,9 @@ void (*type_init_function_table[])(Variant *) = { #define OP_GET_BASIS get_basis #define OP_GET_RID get_rid +#define METHOD_CALL_ON_NULL_VALUE_ERROR(method_pointer) "Cannot call method '" + (method_pointer)->get_name() + "' on a null value." +#define METHOD_CALL_ON_FREED_INSTANCE_ERROR(method_pointer) "Cannot call method '" + (method_pointer)->get_name() + "' on a previously freed instance." + Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Callable::CallError &r_err, CallState *p_state) { OPCODES_TABLE; @@ -1675,10 +1678,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a bool freed = false; Object *base_obj = base->get_validated_object_with_check(freed); if (freed) { - err_text = "Trying to call a function on a previously freed instance."; + err_text = METHOD_CALL_ON_FREED_INSTANCE_ERROR(method); OPCODE_BREAK; } else if (!base_obj) { - err_text = "Trying to call a function on a null value."; + err_text = METHOD_CALL_ON_NULL_VALUE_ERROR(method); OPCODE_BREAK; } #else @@ -1839,10 +1842,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a bool freed = false; \ Object *base_obj = base->get_validated_object_with_check(freed); \ if (freed) { \ - err_text = "Trying to call a function on a previously freed instance."; \ + err_text = METHOD_CALL_ON_FREED_INSTANCE_ERROR(method); \ OPCODE_BREAK; \ } else if (!base_obj) { \ - err_text = "Trying to call a function on a null value."; \ + err_text = METHOD_CALL_ON_NULL_VALUE_ERROR(method); \ OPCODE_BREAK; \ } \ const void **argptrs = call_args_ptr; \ @@ -1941,10 +1944,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a bool freed = false; Object *base_obj = base->get_validated_object_with_check(freed); if (freed) { - err_text = "Trying to call a function on a previously freed instance."; + err_text = METHOD_CALL_ON_FREED_INSTANCE_ERROR(method); OPCODE_BREAK; } else if (!base_obj) { - err_text = "Trying to call a function on a null value."; + err_text = METHOD_CALL_ON_NULL_VALUE_ERROR(method); OPCODE_BREAK; } #else @@ -1969,7 +1972,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a VariantInternal::initialize(ret, Variant::OBJECT); Object **ret_opaque = VariantInternal::get_object(ret); method->ptrcall(base_obj, argptrs, ret_opaque); - VariantInternal::update_object_id(ret); + if (method->is_return_type_raw_object_ptr()) { + // The Variant has to participate in the ref count since the method returns a raw Object *. + VariantInternal::object_assign(ret, *ret_opaque); + } else { + // The method, in case it returns something, returns an already encapsulated object. + VariantInternal::update_object_id(ret); + } #ifdef DEBUG_ENABLED if (GDScriptLanguage::get_singleton()->profiling) { @@ -1996,10 +2005,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a bool freed = false; Object *base_obj = base->get_validated_object_with_check(freed); if (freed) { - err_text = "Trying to call a function on a previously freed instance."; + err_text = METHOD_CALL_ON_FREED_INSTANCE_ERROR(method); OPCODE_BREAK; } else if (!base_obj) { - err_text = "Trying to call a function on a null value."; + err_text = METHOD_CALL_ON_NULL_VALUE_ERROR(method); OPCODE_BREAK; } #else diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs index 1e4fd2f09a..7c02f29606 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildInfo.cs @@ -12,6 +12,7 @@ namespace GodotTools.Build public sealed partial class BuildInfo : RefCounted // TODO Remove RefCounted once we have proper serialization { public string Solution { get; private set; } + public string Project { get; private set; } public string Configuration { get; private set; } public string? RuntimeIdentifier { get; private set; } public string? PublishOutputDir { get; private set; } @@ -28,6 +29,7 @@ namespace GodotTools.Build { return obj is BuildInfo other && other.Solution == Solution && + other.Project == Project && other.Configuration == Configuration && other.RuntimeIdentifier == RuntimeIdentifier && other.PublishOutputDir == PublishOutputDir && other.Restore == Restore && other.Rebuild == Rebuild && other.OnlyClean == OnlyClean && @@ -41,6 +43,7 @@ namespace GodotTools.Build { int hash = 17; hash = (hash * 29) + Solution.GetHashCode(); + hash = (hash * 29) + Project.GetHashCode(); hash = (hash * 29) + Configuration.GetHashCode(); hash = (hash * 29) + (RuntimeIdentifier?.GetHashCode() ?? 0); hash = (hash * 29) + (PublishOutputDir?.GetHashCode() ?? 0); @@ -57,22 +60,25 @@ namespace GodotTools.Build private BuildInfo() { Solution = string.Empty; + Project = string.Empty; Configuration = string.Empty; } - public BuildInfo(string solution, string configuration, bool restore, bool rebuild, bool onlyClean) + public BuildInfo(string solution, string project, string configuration, bool restore, bool rebuild, bool onlyClean) { Solution = solution; + Project = project; Configuration = configuration; Restore = restore; Rebuild = rebuild; OnlyClean = onlyClean; } - public BuildInfo(string solution, string configuration, string runtimeIdentifier, + public BuildInfo(string solution, string project, string configuration, string runtimeIdentifier, string publishOutputDir, bool restore, bool rebuild, bool onlyClean) { Solution = solution; + Project = project; Configuration = configuration; RuntimeIdentifier = runtimeIdentifier; PublishOutputDir = publishOutputDir; diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs index 349f9d0cb8..ed3a4c6e26 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildManager.cs @@ -262,7 +262,7 @@ namespace GodotTools.Build bool onlyClean = false ) { - var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, configuration, + var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, GodotSharpDirs.ProjectCsProjPath, configuration, restore: true, rebuild, onlyClean); // If a platform was not specified, try determining the current one. If that fails, let MSBuild auto-detect it. @@ -282,7 +282,7 @@ namespace GodotTools.Build [DisallowNull] string publishOutputDir ) { - var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, configuration, + var buildInfo = new BuildInfo(GodotSharpDirs.ProjectSlnPath, GodotSharpDirs.ProjectCsProjPath, configuration, runtimeIdentifier, publishOutputDir, restore: true, rebuild: false, onlyClean: false); buildInfo.CustomProperties.Add($"GodotTargetPlatform={platform}"); diff --git a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs index d6549c1b70..d550c36b82 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Build/BuildSystem.cs @@ -139,8 +139,8 @@ namespace GodotTools.Build // `dotnet clean` / `dotnet build` commands arguments.Add(buildInfo.OnlyClean ? "clean" : "build"); - // Solution - arguments.Add(buildInfo.Solution); + // C# Project + arguments.Add(buildInfo.Project); // `dotnet clean` doesn't recognize these options if (!buildInfo.OnlyClean) @@ -180,8 +180,8 @@ namespace GodotTools.Build { arguments.Add("publish"); // `dotnet publish` command - // Solution - arguments.Add(buildInfo.Solution); + // C# Project + arguments.Add(buildInfo.Project); // Restore // `dotnet publish` restores by default, unless requested not to diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs index 027eab30fc..79030c79cc 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs @@ -1,17 +1,44 @@ using System; using System.Collections.Concurrent; -using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; namespace Godot { public sealed class GodotSynchronizationContext : SynchronizationContext, IDisposable { - private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> _queue = new(); + private readonly BlockingCollection<(SendOrPostCallback Callback, object State)> _queue = new(); + + public override void Send(SendOrPostCallback d, object state) + { + // Shortcut if we're already on this context + // Also necessary to avoid a deadlock, since Send is blocking + if (Current == this) + { + d(state); + return; + } + + var source = new TaskCompletionSource(); + + _queue.Add((st => + { + try + { + d(st); + } + finally + { + source.SetResult(); + } + }, state)); + + source.Task.Wait(); + } public override void Post(SendOrPostCallback d, object state) { - _queue.Add(new KeyValuePair<SendOrPostCallback, object>(d, state)); + _queue.Add((d, state)); } /// <summary> @@ -21,7 +48,7 @@ namespace Godot { while (_queue.TryTake(out var workItem)) { - workItem.Key(workItem.Value); + workItem.Callback(workItem.State); } } diff --git a/modules/multiplayer/multiplayer_spawner.cpp b/modules/multiplayer/multiplayer_spawner.cpp index 0aa54b69f9..4b1b6b541d 100644 --- a/modules/multiplayer/multiplayer_spawner.cpp +++ b/modules/multiplayer/multiplayer_spawner.cpp @@ -103,6 +103,15 @@ void MultiplayerSpawner::add_spawnable_scene(const String &p_path) { ERR_FAIL_COND(!FileAccess::exists(p_path)); } spawnable_scenes.push_back(sc); +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + return; + } +#endif + Node *node = get_spawn_node(); + if (spawnable_scenes.size() == 1 && node && !node->is_connected("child_entered_tree", callable_mp(this, &MultiplayerSpawner::_node_added))) { + node->connect("child_entered_tree", callable_mp(this, &MultiplayerSpawner::_node_added)); + } } int MultiplayerSpawner::get_spawnable_scene_count() const { @@ -116,6 +125,15 @@ String MultiplayerSpawner::get_spawnable_scene(int p_idx) const { void MultiplayerSpawner::clear_spawnable_scenes() { spawnable_scenes.clear(); +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + return; + } +#endif + Node *node = get_spawn_node(); + if (node && node->is_connected("child_entered_tree", callable_mp(this, &MultiplayerSpawner::_node_added))) { + node->disconnect("child_entered_tree", callable_mp(this, &MultiplayerSpawner::_node_added)); + } } Vector<String> MultiplayerSpawner::_get_spawnable_scenes() const { diff --git a/modules/webxr/native/library_godot_webxr.js b/modules/webxr/native/library_godot_webxr.js index 1c00ebebb4..5c01d88a30 100644 --- a/modules/webxr/native/library_godot_webxr.js +++ b/modules/webxr/native/library_godot_webxr.js @@ -584,12 +584,11 @@ const GodotWebXR = { } const buf = GodotRuntime.malloc(point_count * 3 * 4); - GodotRuntime.setHeapValue(buf, point_count, 'i32'); for (let i = 0; i < point_count; i++) { const point = GodotWebXR.space.boundsGeometry[i]; - GodotRuntime.setHeapValue(buf + ((i * 3) + 1) * 4, point.x, 'float'); - GodotRuntime.setHeapValue(buf + ((i * 3) + 2) * 4, point.y, 'float'); - GodotRuntime.setHeapValue(buf + ((i * 3) + 3) * 4, point.z, 'float'); + GodotRuntime.setHeapValue(buf + ((i * 3) + 0) * 4, point.x, 'float'); + GodotRuntime.setHeapValue(buf + ((i * 3) + 1) * 4, point.y, 'float'); + GodotRuntime.setHeapValue(buf + ((i * 3) + 2) * 4, point.z, 'float'); } GodotRuntime.setHeapValue(r_points, buf, 'i32'); diff --git a/platform/android/android_input_handler.cpp b/platform/android/android_input_handler.cpp index 17903b3965..6d34e28182 100644 --- a/platform/android/android_input_handler.cpp +++ b/platform/android/android_input_handler.cpp @@ -129,13 +129,22 @@ void AndroidInputHandler::process_key_event(int p_physical_keycode, int p_unicod Input::get_singleton()->parse_input_event(ev); } -void AndroidInputHandler::_parse_all_touch(bool p_pressed, bool p_double_tap) { +void AndroidInputHandler::_cancel_all_touch() { + _parse_all_touch(false, false, true); + touch.clear(); +} + +void AndroidInputHandler::_parse_all_touch(bool p_pressed, bool p_double_tap, bool reset_index) { if (touch.size()) { //end all if exist for (int i = 0; i < touch.size(); i++) { Ref<InputEventScreenTouch> ev; ev.instantiate(); - ev->set_index(touch[i].id); + if (reset_index) { + ev->set_index(-1); + } else { + ev->set_index(touch[i].id); + } ev->set_pressed(p_pressed); ev->set_position(touch[i].pos); ev->set_double_tap(p_double_tap); @@ -196,7 +205,9 @@ void AndroidInputHandler::process_touch_event(int p_event, int p_pointer, const } } break; - case AMOTION_EVENT_ACTION_CANCEL: + case AMOTION_EVENT_ACTION_CANCEL: { + _cancel_all_touch(); + } break; case AMOTION_EVENT_ACTION_UP: { //release _release_all_touch(); } break; @@ -236,6 +247,12 @@ void AndroidInputHandler::process_touch_event(int p_event, int p_pointer, const } } +void AndroidInputHandler::_cancel_mouse_event_info(bool p_source_mouse_relative) { + buttons_state = BitField<MouseButtonMask>(); + _parse_mouse_event_info(BitField<MouseButtonMask>(), false, false, p_source_mouse_relative); + mouse_event_info.valid = false; +} + void AndroidInputHandler::_parse_mouse_event_info(BitField<MouseButtonMask> event_buttons_mask, bool p_pressed, bool p_double_click, bool p_source_mouse_relative) { if (!mouse_event_info.valid) { return; @@ -296,8 +313,11 @@ void AndroidInputHandler::process_mouse_event(int p_event_action, int p_event_an _parse_mouse_event_info(event_buttons_mask, true, p_double_click, p_source_mouse_relative); } break; + case AMOTION_EVENT_ACTION_CANCEL: { + _cancel_mouse_event_info(p_source_mouse_relative); + } break; + case AMOTION_EVENT_ACTION_UP: - case AMOTION_EVENT_ACTION_CANCEL: case AMOTION_EVENT_ACTION_BUTTON_RELEASE: { _release_mouse_event_info(p_source_mouse_relative); } break; diff --git a/platform/android/android_input_handler.h b/platform/android/android_input_handler.h index 6e53dcfc89..a56b6aa6c4 100644 --- a/platform/android/android_input_handler.h +++ b/platform/android/android_input_handler.h @@ -87,10 +87,14 @@ private: void _release_mouse_event_info(bool p_source_mouse_relative = false); - void _parse_all_touch(bool p_pressed, bool p_double_tap); + void _cancel_mouse_event_info(bool p_source_mouse_relative = false); + + void _parse_all_touch(bool p_pressed, bool p_double_tap, bool reset_index = false); void _release_all_touch(); + void _cancel_all_touch(); + public: void process_mouse_event(int p_event_action, int p_event_android_buttons_mask, Point2 p_event_pos, Vector2 p_delta, bool p_double_click, bool p_source_mouse_relative); void process_touch_event(int p_event, int p_pointer, const Vector<TouchPos> &p_points, bool p_double_tap); diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index 36e149f2b4..bae5a98aee 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -346,7 +346,7 @@ def configure(env: "Environment"): gnu_ld_version = re.search("^GNU ld [^$]*(\d+\.\d+)$", linker_version_str, re.MULTILINE) if not gnu_ld_version: print( - "Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld, not gold or LLD." + "Warning: Creating export template binaries enabled for PCK embedding is currently only supported with GNU ld, not gold, LLD or mold." ) else: if float(gnu_ld_version.group(1)) >= 2.30: diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index fe6bee0f1b..f7d2ae7d2d 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -266,6 +266,8 @@ void Camera2D::_notification(int p_what) { clear_current(); } viewport = nullptr; + just_exited_tree = true; + callable_mp(this, &Camera2D::_reset_just_exited).call_deferred(); } break; #ifdef TOOLS_ENABLED @@ -438,6 +440,10 @@ void Camera2D::_update_process_internal_for_smoothing() { void Camera2D::make_current() { ERR_FAIL_COND(!enabled || !is_inside_tree()); get_tree()->call_group(group_name, "_make_current", this); + if (just_exited_tree) { + // If camera exited the scene tree in the same frame, group call will skip it, so this needs to be called manually. + _make_current(this); + } _update_scroll(); } diff --git a/scene/2d/camera_2d.h b/scene/2d/camera_2d.h index 7a77266db8..2417953691 100644 --- a/scene/2d/camera_2d.h +++ b/scene/2d/camera_2d.h @@ -51,6 +51,7 @@ protected: Point2 camera_pos; Point2 smoothed_camera_pos; bool first = true; + bool just_exited_tree = false; ObjectID custom_viewport_id; // to check validity Viewport *custom_viewport = nullptr; @@ -88,6 +89,7 @@ protected: void _update_scroll(); void _make_current(Object *p_which); + void _reset_just_exited() { just_exited_tree = false; } void _set_old_smoothing(real_t p_enable); diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp index d91f6e36bb..0970325502 100644 --- a/scene/2d/line_builder.cpp +++ b/scene/2d/line_builder.cpp @@ -393,6 +393,8 @@ void LineBuilder::build() { if (end_cap_mode == Line2D::LINE_CAP_BOX) { pos_up1 += f0 * hw * width_factor; pos_down1 += f0 * hw * width_factor; + + current_distance1 += hw * width_factor; } if (texture_mode == Line2D::LINE_TEXTURE_TILE) { diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp index 6aa7779b09..52a1213a49 100644 --- a/scene/2d/navigation_agent_2d.cpp +++ b/scene/2d/navigation_agent_2d.cpp @@ -119,7 +119,7 @@ void NavigationAgent2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_debug_path_custom_line_width", "line_width"), &NavigationAgent2D::set_debug_path_custom_line_width); ClassDB::bind_method(D_METHOD("get_debug_path_custom_line_width"), &NavigationAgent2D::get_debug_path_custom_line_width); - ADD_GROUP("Debug", ""); + ADD_GROUP("Debug", "debug_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_enabled"), "set_debug_enabled", "get_debug_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_use_custom"), "set_debug_use_custom", "get_debug_use_custom"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color"); diff --git a/scene/2d/navigation_region_2d.cpp b/scene/2d/navigation_region_2d.cpp index 3484a9de65..5dbba313bc 100644 --- a/scene/2d/navigation_region_2d.cpp +++ b/scene/2d/navigation_region_2d.cpp @@ -167,58 +167,78 @@ void NavigationRegion2D::_notification(int p_what) { case NOTIFICATION_DRAW: { #ifdef DEBUG_ENABLED - if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || NavigationServer3D::get_singleton()->get_debug_enabled()) && navigation_polygon.is_valid()) { - Vector<Vector2> verts = navigation_polygon->get_vertices(); - if (verts.size() < 3) { + if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || NavigationServer2D::get_singleton()->get_debug_enabled()) && navigation_polygon.is_valid()) { + Vector<Vector2> navigation_polygon_vertices = navigation_polygon->get_vertices(); + if (navigation_polygon_vertices.size() < 3) { return; } - Color color; - if (enabled) { - color = NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_color(); - } else { - color = NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_disabled_color(); + const NavigationServer2D *ns2d = NavigationServer2D::get_singleton(); + + bool enabled_geometry_face_random_color = ns2d->get_debug_navigation_enable_geometry_face_random_color(); + bool enabled_edge_lines = ns2d->get_debug_navigation_enable_edge_lines(); + bool enable_edge_connections = ns2d->get_debug_navigation_enable_edge_connections(); + + Color debug_face_color = ns2d->get_debug_navigation_geometry_face_color(); + Color debug_edge_color = ns2d->get_debug_navigation_geometry_edge_color(); + Color debug_edge_connection_color = ns2d->get_debug_navigation_edge_connection_color(); + + if (!enabled) { + debug_face_color = ns2d->get_debug_navigation_geometry_face_disabled_color(); + debug_edge_color = ns2d->get_debug_navigation_geometry_edge_disabled_color(); } - Color doors_color = NavigationServer3D::get_singleton()->get_debug_navigation_edge_connection_color(); RandomPCG rand; for (int i = 0; i < navigation_polygon->get_polygon_count(); i++) { // An array of vertices for this polygon. Vector<int> polygon = navigation_polygon->get_polygon(i); - Vector<Vector2> vertices; - vertices.resize(polygon.size()); + Vector<Vector2> debug_polygon_vertices; + debug_polygon_vertices.resize(polygon.size()); for (int j = 0; j < polygon.size(); j++) { - ERR_FAIL_INDEX(polygon[j], verts.size()); - vertices.write[j] = verts[polygon[j]]; + ERR_FAIL_INDEX(polygon[j], navigation_polygon_vertices.size()); + debug_polygon_vertices.write[j] = navigation_polygon_vertices[polygon[j]]; } // Generate the polygon color, slightly randomly modified from the settings one. - Color random_variation_color; - random_variation_color.set_hsv(color.get_h() + rand.random(-1.0, 1.0) * 0.1, color.get_s(), color.get_v() + rand.random(-1.0, 1.0) * 0.2); - random_variation_color.a = color.a; - Vector<Color> colors; - colors.push_back(random_variation_color); + Color random_variation_color = debug_face_color; + if (enabled_geometry_face_random_color) { + random_variation_color.set_hsv( + debug_face_color.get_h() + rand.random(-1.0, 1.0) * 0.1, + debug_face_color.get_s(), + debug_face_color.get_v() + rand.random(-1.0, 1.0) * 0.2); + } + random_variation_color.a = debug_face_color.a; - RS::get_singleton()->canvas_item_add_polygon(get_canvas_item(), vertices, colors); + Vector<Color> debug_face_colors; + debug_face_colors.push_back(random_variation_color); + RS::get_singleton()->canvas_item_add_polygon(get_canvas_item(), debug_polygon_vertices, debug_face_colors); + + if (enabled_edge_lines) { + Vector<Color> debug_edge_colors; + debug_edge_colors.push_back(debug_edge_color); + debug_polygon_vertices.push_back(debug_polygon_vertices[0]); // Add first again for closing polyline. + RS::get_singleton()->canvas_item_add_polyline(get_canvas_item(), debug_polygon_vertices, debug_edge_colors); + } } - // Draw the region - Transform2D xform = get_global_transform(); - const NavigationServer2D *ns = NavigationServer2D::get_singleton(); - real_t radius = ns->map_get_edge_connection_margin(get_world_2d()->get_navigation_map()) / 2.0; - for (int i = 0; i < ns->region_get_connections_count(region); i++) { - // Two main points - Vector2 a = ns->region_get_connection_pathway_start(region, i); - a = xform.affine_inverse().xform(a); - Vector2 b = ns->region_get_connection_pathway_end(region, i); - b = xform.affine_inverse().xform(b); - draw_line(a, b, doors_color); - - // Draw a circle to illustrate the margins. - real_t angle = a.angle_to_point(b); - draw_arc(a, radius, angle + Math_PI / 2.0, angle - Math_PI / 2.0 + Math_TAU, 10, doors_color); - draw_arc(b, radius, angle - Math_PI / 2.0, angle + Math_PI / 2.0, 10, doors_color); + if (enable_edge_connections) { + // Draw the region edge connections. + Transform2D xform = get_global_transform(); + real_t radius = ns2d->map_get_edge_connection_margin(get_world_2d()->get_navigation_map()) / 2.0; + for (int i = 0; i < ns2d->region_get_connections_count(region); i++) { + // Two main points + Vector2 a = ns2d->region_get_connection_pathway_start(region, i); + a = xform.affine_inverse().xform(a); + Vector2 b = ns2d->region_get_connection_pathway_end(region, i); + b = xform.affine_inverse().xform(b); + draw_line(a, b, debug_edge_connection_color); + + // Draw a circle to illustrate the margins. + real_t angle = a.angle_to_point(b); + draw_arc(a, radius, angle + Math_PI / 2.0, angle - Math_PI / 2.0 + Math_TAU, 10, debug_edge_connection_color); + draw_arc(b, radius, angle - Math_PI / 2.0, angle + Math_PI / 2.0, 10, debug_edge_connection_color); + } } } #endif // DEBUG_ENABLED diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 95bf67d38d..2e0b16388f 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -752,6 +752,20 @@ TileMap::VisibilityMode TileMap::get_navigation_visibility_mode() { return navigation_visibility_mode; } +void TileMap::set_navigation_map(int p_layer, RID p_map) { + ERR_FAIL_INDEX(p_layer, (int)layers.size()); + + layers[p_layer].navigation_map = p_map; +} + +RID TileMap::get_navigation_map(int p_layer) const { + ERR_FAIL_INDEX_V(p_layer, (int)layers.size(), RID()); + if (layers[p_layer].navigation_map.is_valid()) { + return layers[p_layer].navigation_map; + } + return RID(); +} + void TileMap::set_y_sort_enabled(bool p_enable) { Node2D::set_y_sort_enabled(p_enable); _clear_internals(); @@ -897,6 +911,9 @@ void TileMap::_recreate_layer_internals(int p_layer) { // Update the layer internals. _rendering_update_layer(p_layer); + // Update the layer internal navigation maps. + _navigation_update_layer(p_layer); + // Recreate the quadrants. const HashMap<Vector2i, TileMapCell> &tile_map = layers[p_layer].tile_map; for (const KeyValue<Vector2i, TileMapCell> &E : tile_map) { @@ -959,6 +976,9 @@ void TileMap::_clear_layer_internals(int p_layer) { // Clear the layers internals. _rendering_cleanup_layer(p_layer); + // Clear the layers internal navigation maps. + _navigation_cleanup_layer(p_layer); + // Clear the dirty quadrants list. while (layers[p_layer].dirty_quadrant_list.first()) { layers[p_layer].dirty_quadrant_list.remove(layers[p_layer].dirty_quadrant_list.first()); @@ -1083,6 +1103,36 @@ void TileMap::_rendering_notification(int p_what) { } } +void TileMap::_navigation_update_layer(int p_layer) { + ERR_FAIL_INDEX(p_layer, (int)layers.size()); + ERR_FAIL_NULL(NavigationServer2D::get_singleton()); + + if (!layers[p_layer].navigation_map.is_valid()) { + if (p_layer == 0 && is_inside_tree()) { + // Use the default World2D navigation map for the first layer when empty. + layers[p_layer].navigation_map = get_world_2d()->get_navigation_map(); + } else { + RID new_layer_map = NavigationServer2D::get_singleton()->map_create(); + NavigationServer2D::get_singleton()->map_set_active(new_layer_map, true); + layers[p_layer].navigation_map = new_layer_map; + } + } +} + +void TileMap::_navigation_cleanup_layer(int p_layer) { + ERR_FAIL_INDEX(p_layer, (int)layers.size()); + ERR_FAIL_NULL(NavigationServer2D::get_singleton()); + + if (layers[p_layer].navigation_map.is_valid()) { + if (is_inside_tree() && layers[p_layer].navigation_map == get_world_2d()->get_navigation_map()) { + // Do not delete the World2D default navigation map. + return; + } + NavigationServer2D::get_singleton()->free(layers[p_layer].navigation_map); + layers[p_layer].navigation_map = RID(); + } +} + void TileMap::_rendering_update_layer(int p_layer) { ERR_FAIL_INDEX(p_layer, (int)layers.size()); @@ -1732,6 +1782,9 @@ void TileMap::_navigation_update_dirty_quadrants(SelfList<TileMapQuadrant>::List q.navigation_regions[E_cell].resize(tile_set->get_navigation_layers_count()); for (int layer_index = 0; layer_index < tile_set->get_navigation_layers_count(); layer_index++) { + if (layer_index >= (int)layers.size() || !layers[layer_index].navigation_map.is_valid()) { + continue; + } Ref<NavigationPolygon> navigation_polygon; navigation_polygon = tile_data->get_navigation_polygon(layer_index); @@ -1741,7 +1794,7 @@ void TileMap::_navigation_update_dirty_quadrants(SelfList<TileMapQuadrant>::List RID region = NavigationServer2D::get_singleton()->region_create(); NavigationServer2D::get_singleton()->region_set_owner_id(region, get_instance_id()); - NavigationServer2D::get_singleton()->region_set_map(region, get_world_2d()->get_navigation_map()); + NavigationServer2D::get_singleton()->region_set_map(region, layers[layer_index].navigation_map); NavigationServer2D::get_singleton()->region_set_transform(region, tilemap_xform * tile_transform); NavigationServer2D::get_singleton()->region_set_navigation_layers(region, tile_set->get_navigation_layer_layers(layer_index)); NavigationServer2D::get_singleton()->region_set_navigation_polygon(region, navigation_polygon); @@ -1795,12 +1848,16 @@ void TileMap::_navigation_draw_quadrant_debug(TileMapQuadrant *p_quadrant) { return; } +#ifdef DEBUG_ENABLED RenderingServer *rs = RenderingServer::get_singleton(); + const NavigationServer2D *ns2d = NavigationServer2D::get_singleton(); + + bool enabled_geometry_face_random_color = ns2d->get_debug_navigation_enable_geometry_face_random_color(); + bool enabled_edge_lines = ns2d->get_debug_navigation_enable_edge_lines(); + + Color debug_face_color = ns2d->get_debug_navigation_geometry_face_color(); + Color debug_edge_color = ns2d->get_debug_navigation_geometry_edge_color(); - Color color = Color(0.5, 1.0, 1.0, 1.0); -#ifdef DEBUG_ENABLED - color = NavigationServer3D::get_singleton()->get_debug_navigation_geometry_face_color(); -#endif // DEBUG_ENABLED RandomPCG rand; Vector2 quadrant_pos = map_to_local(p_quadrant->coords * get_effective_quadrant_size(p_quadrant->layer)); @@ -1830,34 +1887,50 @@ void TileMap::_navigation_draw_quadrant_debug(TileMapQuadrant *p_quadrant) { rs->canvas_item_add_set_transform(p_quadrant->debug_canvas_item, cell_to_quadrant); for (int layer_index = 0; layer_index < tile_set->get_navigation_layers_count(); layer_index++) { - Ref<NavigationPolygon> navpoly = tile_data->get_navigation_polygon(layer_index); - if (navpoly.is_valid()) { - PackedVector2Array navigation_polygon_vertices = navpoly->get_vertices(); + Ref<NavigationPolygon> navigation_polygon = tile_data->get_navigation_polygon(layer_index); + if (navigation_polygon.is_valid()) { + Vector<Vector2> navigation_polygon_vertices = navigation_polygon->get_vertices(); + if (navigation_polygon_vertices.size() < 3) { + continue; + } - for (int i = 0; i < navpoly->get_polygon_count(); i++) { + for (int i = 0; i < navigation_polygon->get_polygon_count(); i++) { // An array of vertices for this polygon. - Vector<int> polygon = navpoly->get_polygon(i); - Vector<Vector2> vertices; - vertices.resize(polygon.size()); + Vector<int> polygon = navigation_polygon->get_polygon(i); + Vector<Vector2> debug_polygon_vertices; + debug_polygon_vertices.resize(polygon.size()); for (int j = 0; j < polygon.size(); j++) { ERR_FAIL_INDEX(polygon[j], navigation_polygon_vertices.size()); - vertices.write[j] = navigation_polygon_vertices[polygon[j]]; + debug_polygon_vertices.write[j] = navigation_polygon_vertices[polygon[j]]; } // Generate the polygon color, slightly randomly modified from the settings one. - Color random_variation_color; - random_variation_color.set_hsv(color.get_h() + rand.random(-1.0, 1.0) * 0.05, color.get_s(), color.get_v() + rand.random(-1.0, 1.0) * 0.1); - random_variation_color.a = color.a; - Vector<Color> colors; - colors.push_back(random_variation_color); + Color random_variation_color = debug_face_color; + if (enabled_geometry_face_random_color) { + random_variation_color.set_hsv( + debug_face_color.get_h() + rand.random(-1.0, 1.0) * 0.1, + debug_face_color.get_s(), + debug_face_color.get_v() + rand.random(-1.0, 1.0) * 0.2); + } + random_variation_color.a = debug_face_color.a; - rs->canvas_item_add_polygon(p_quadrant->debug_canvas_item, vertices, colors); + Vector<Color> debug_face_colors; + debug_face_colors.push_back(random_variation_color); + rs->canvas_item_add_polygon(p_quadrant->debug_canvas_item, debug_polygon_vertices, debug_face_colors); + + if (enabled_edge_lines) { + Vector<Color> debug_edge_colors; + debug_edge_colors.push_back(debug_edge_color); + debug_polygon_vertices.push_back(debug_polygon_vertices[0]); // Add first again for closing polyline. + rs->canvas_item_add_polyline(p_quadrant->debug_canvas_item, debug_polygon_vertices, debug_edge_colors); + } } } } } } } +#endif // DEBUG_ENABLED } /////////////////////////////// Scenes ////////////////////////////////////// @@ -4031,6 +4104,9 @@ void TileMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_navigation_visibility_mode", "navigation_visibility_mode"), &TileMap::set_navigation_visibility_mode); ClassDB::bind_method(D_METHOD("get_navigation_visibility_mode"), &TileMap::get_navigation_visibility_mode); + ClassDB::bind_method(D_METHOD("set_navigation_map", "layer", "map"), &TileMap::set_navigation_map); + ClassDB::bind_method(D_METHOD("get_navigation_map", "layer"), &TileMap::get_navigation_map); + ClassDB::bind_method(D_METHOD("set_cell", "layer", "coords", "source_id", "atlas_coords", "alternative_tile"), &TileMap::set_cell, DEFVAL(TileSet::INVALID_SOURCE), DEFVAL(TileSetSource::INVALID_ATLAS_COORDS), DEFVAL(0)); ClassDB::bind_method(D_METHOD("erase_cell", "layer", "coords"), &TileMap::erase_cell); ClassDB::bind_method(D_METHOD("get_cell_source_id", "layer", "coords", "use_proxies"), &TileMap::get_cell_source_id, DEFVAL(false)); diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 7cf2a2eded..62d7612be2 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -211,6 +211,7 @@ private: HashMap<Vector2i, TileMapCell> tile_map; HashMap<Vector2i, TileMapQuadrant> quadrant_map; SelfList<TileMapQuadrant>::List dirty_quadrant_list; + RID navigation_map; }; LocalVector<TileMapLayer> layers; int selected_layer = -1; @@ -259,6 +260,8 @@ private: void _physics_draw_quadrant_debug(TileMapQuadrant *p_quadrant); void _navigation_notification(int p_what); + void _navigation_update_layer(int p_layer); + void _navigation_cleanup_layer(int p_layer); void _navigation_update_dirty_quadrants(SelfList<TileMapQuadrant>::List &r_dirty_quadrant_list); void _navigation_cleanup_quadrant(TileMapQuadrant *p_quadrant); void _navigation_draw_quadrant_debug(TileMapQuadrant *p_quadrant); @@ -339,6 +342,9 @@ public: void set_navigation_visibility_mode(VisibilityMode p_show_navigation); VisibilityMode get_navigation_visibility_mode(); + void set_navigation_map(int p_layer, RID p_map); + RID get_navigation_map(int p_layer) const; + // Cells accessors. void set_cell(int p_layer, const Vector2i &p_coords, int p_source_id = TileSet::INVALID_SOURCE, const Vector2i p_atlas_coords = TileSetSource::INVALID_ATLAS_COORDS, int p_alternative_tile = 0); void erase_cell(int p_layer, const Vector2i &p_coords); diff --git a/scene/3d/label_3d.cpp b/scene/3d/label_3d.cpp index b39ca43d2e..5fc36abb76 100644 --- a/scene/3d/label_3d.cpp +++ b/scene/3d/label_3d.cpp @@ -442,6 +442,18 @@ void Label3D::_generate_glyph_surfaces(const Glyph &p_glyph, Vector2 &r_offset, } void Label3D::_shape() { + // When a shaped text is invalidated by an external source, we want to reshape it. + if (!TS->shaped_text_is_ready(text_rid)) { + dirty_text = true; + } + + for (const RID &line_rid : lines_rid) { + if (!TS->shaped_text_is_ready(line_rid)) { + dirty_lines = true; + break; + } + } + // Clear mesh. RS::get_singleton()->mesh_clear(mesh); aabb = AABB(); diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp index fb74cffc94..b4387b0f3c 100644 --- a/scene/3d/lightmap_gi.cpp +++ b/scene/3d/lightmap_gi.cpp @@ -163,7 +163,8 @@ Array LightmapGIData::_get_light_textures_data() const { config->set_value("remap", "importer", "2d_array_texture"); config->set_value("remap", "type", "CompressedTexture2DArray"); if (!config->has_section_key("params", "compress/mode")) { - config->set_value("params", "compress/mode", 2); //user may want another compression, so leave it be + // User may want another compression, so leave it be, but default to VRAM uncompressed. + config->set_value("params", "compress/mode", 3); } config->set_value("params", "compress/channel_pack", 1); config->set_value("params", "mipmaps/generate", false); diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp index 081e7505d0..16f357194e 100644 --- a/scene/3d/navigation_agent_3d.cpp +++ b/scene/3d/navigation_agent_3d.cpp @@ -130,7 +130,7 @@ void NavigationAgent3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_debug_path_custom_point_size", "point_size"), &NavigationAgent3D::set_debug_path_custom_point_size); ClassDB::bind_method(D_METHOD("get_debug_path_custom_point_size"), &NavigationAgent3D::get_debug_path_custom_point_size); - ADD_GROUP("Debug", ""); + ADD_GROUP("Debug", "debug_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_enabled"), "set_debug_enabled", "get_debug_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_use_custom"), "set_debug_use_custom", "get_debug_use_custom"); ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_path_custom_color"), "set_debug_path_custom_color", "get_debug_path_custom_color"); diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp index 3567738366..d3207c1a3d 100644 --- a/scene/animation/animation_blend_tree.cpp +++ b/scene/animation/animation_blend_tree.cpp @@ -350,29 +350,29 @@ double AnimationNodeOneShot::process(double p_time, bool p_seek, bool p_is_exter set_parameter(active, true); } - real_t blend; - bool use_fade_in = fade_in > 0; + real_t blend = 1.0; + bool use_blend = sync; if (cur_time < fade_in) { - if (use_fade_in) { + if (fade_in > 0) { + use_blend = true; blend = cur_time / fade_in; } else { blend = 0; // Should not happen. } } else if (!do_start && cur_remaining <= fade_out) { + use_blend = true; if (fade_out > 0) { blend = (cur_remaining / fade_out); } else { blend = 0; } - } else { - blend = 1.0; } double main_rem = 0.0; if (mix == MIX_MODE_ADD) { main_rem = blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0, FILTER_IGNORE, sync); - } else if (use_fade_in) { - main_rem = blend_input(0, p_time, p_seek, p_is_external_seeking, 1.0 - blend, FILTER_BLEND, sync); // Unlike below, processing this edge is a corner case. + } else { + main_rem = blend_input(0, p_time, use_blend && p_seek, p_is_external_seeking, 1.0 - blend, FILTER_BLEND, sync); // Unlike below, processing this edge is a corner case. } double os_rem = blend_input(1, os_seek ? cur_time : p_time, os_seek, p_is_external_seeking, Math::is_zero_approx(blend) ? CMP_EPSILON : blend, FILTER_PASS, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge. @@ -825,6 +825,7 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex bool switched = false; bool restart = false; + bool clear_remaining_fade = false; if (pending_update) { if (cur_current_index < 0 || cur_current_index >= get_input_count()) { @@ -842,6 +843,10 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex pending_update = false; } + if (p_time == 0 && p_seek && !p_is_external_seeking) { + clear_remaining_fade = true; // Reset occurs. + } + if (!cur_transition_request.is_empty()) { int new_idx = find_input(cur_transition_request); if (new_idx >= 0) { @@ -849,10 +854,7 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex if (allow_transition_to_self) { // Transition to same state. restart = input_data[cur_current_index].reset; - cur_prev_xfading = 0; - set_parameter(prev_xfading, 0); - cur_prev_index = -1; - set_parameter(prev_index, -1); + clear_remaining_fade = true; } } else { switched = true; @@ -869,6 +871,13 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex set_parameter(transition_request, cur_transition_request); } + if (clear_remaining_fade) { + cur_prev_xfading = 0; + set_parameter(prev_xfading, 0); + cur_prev_index = -1; + set_parameter(prev_index, -1); + } + // Special case for restart. if (restart) { set_parameter(time, 0); @@ -910,29 +919,31 @@ double AnimationNodeTransition::process(double p_time, bool p_seek, bool p_is_ex } else { // Cross-fading from prev to current. - bool use_blend = xfade_time > 0; - real_t blend = !use_blend ? 0 : (cur_prev_xfading / xfade_time); - if (xfade_curve.is_valid()) { - blend = xfade_curve->sample(blend); + real_t blend = 0.0; + real_t blend_inv = 1.0; + bool use_blend = sync; + if (xfade_time > 0) { + use_blend = true; + blend = cur_prev_xfading / xfade_time; + if (xfade_curve.is_valid()) { + blend = xfade_curve->sample(blend); + } + blend_inv = 1.0 - blend; + blend = Math::is_zero_approx(blend) ? CMP_EPSILON : blend; + blend_inv = Math::is_zero_approx(blend_inv) ? CMP_EPSILON : blend_inv; } // Blend values must be more than CMP_EPSILON to process discrete keys in edge. - real_t blend_inv = 1.0 - blend; if (input_data[cur_current_index].reset && !p_seek && switched) { // Just switched, seek to start of current. - rem = blend_input(cur_current_index, 0, true, p_is_external_seeking, Math::is_zero_approx(blend_inv) ? CMP_EPSILON : blend_inv, FILTER_IGNORE, true); + rem = blend_input(cur_current_index, 0, true, p_is_external_seeking, blend_inv, FILTER_IGNORE, true); } else { - rem = blend_input(cur_current_index, p_time, p_seek, p_is_external_seeking, Math::is_zero_approx(blend_inv) ? CMP_EPSILON : blend_inv, FILTER_IGNORE, true); + rem = blend_input(cur_current_index, p_time, p_seek, p_is_external_seeking, blend_inv, FILTER_IGNORE, true); } + blend_input(cur_prev_index, p_time, use_blend && p_seek, p_is_external_seeking, blend, FILTER_IGNORE, true); if (p_seek) { - if (use_blend) { - blend_input(cur_prev_index, p_time, true, p_is_external_seeking, Math::is_zero_approx(blend) ? CMP_EPSILON : blend, FILTER_IGNORE, true); - } cur_time = p_time; } else { - if (use_blend) { - blend_input(cur_prev_index, p_time, false, p_is_external_seeking, Math::is_zero_approx(blend) ? CMP_EPSILON : blend, FILTER_IGNORE, true); - } cur_time += p_time; cur_prev_xfading -= p_time; if (cur_prev_xfading < 0) { diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index abc7814877..9d1118e0ef 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -60,6 +60,20 @@ void Tweener::_bind_methods() { ADD_SIGNAL(MethodInfo("finished")); } +bool Tween::_validate_type_match(const Variant &p_from, Variant &r_to) { + if (p_from.get_type() != r_to.get_type()) { + // Cast r_to between double and int to avoid minor annoyances. + if (p_from.get_type() == Variant::FLOAT && r_to.get_type() == Variant::INT) { + r_to = double(r_to); + } else if (p_from.get_type() == Variant::INT && r_to.get_type() == Variant::FLOAT) { + r_to = int(r_to); + } else { + ERR_FAIL_V_MSG(false, "Type mismatch between initial and final value: " + Variant::get_type_name(p_from.get_type()) + " and " + Variant::get_type_name(r_to.get_type())); + } + } + return true; +} + void Tween::_start_tweeners() { if (tweeners.is_empty()) { dead = true; @@ -85,16 +99,8 @@ Ref<PropertyTweener> Tween::tween_property(Object *p_target, NodePath p_property ERR_FAIL_COND_V_MSG(!valid, nullptr, "Tween invalid. Either finished or created outside scene tree."); ERR_FAIL_COND_V_MSG(started, nullptr, "Can't append to a Tween that has started. Use stop() first."); - Variant::Type property_type = p_target->get_indexed(p_property.get_as_property_path().get_subnames()).get_type(); - if (property_type != p_to.get_type()) { - // Cast p_to between double and int to avoid minor annoyances. - if (property_type == Variant::FLOAT && p_to.get_type() == Variant::INT) { - p_to = double(p_to); - } else if (property_type == Variant::INT && p_to.get_type() == Variant::FLOAT) { - p_to = int(p_to); - } else { - ERR_FAIL_V_MSG(Ref<PropertyTweener>(), "Type mismatch between property and final value: " + Variant::get_type_name(property_type) + " and " + Variant::get_type_name(p_to.get_type())); - } + if (!_validate_type_match(p_target->get_indexed(p_property.get_as_property_path().get_subnames()), p_to)) { + return nullptr; } Ref<PropertyTweener> tweener = memnew(PropertyTweener(p_target, p_property, p_to, p_duration)); @@ -124,6 +130,10 @@ Ref<MethodTweener> Tween::tween_method(Callable p_callback, Variant p_from, Vari ERR_FAIL_COND_V_MSG(!valid, nullptr, "Tween invalid. Either finished or created outside scene tree."); ERR_FAIL_COND_V_MSG(started, nullptr, "Can't append to a Tween that has started. Use stop() first."); + if (!_validate_type_match(p_from, p_to)) { + return nullptr; + } + Ref<MethodTweener> tweener = memnew(MethodTweener(p_callback, p_from, p_to, p_duration)); append(tweener); return tweener; diff --git a/scene/animation/tween.h b/scene/animation/tween.h index 58217db535..c5abcb28a6 100644 --- a/scene/animation/tween.h +++ b/scene/animation/tween.h @@ -47,6 +47,7 @@ public: protected: static void _bind_methods(); + Ref<Tween> tween; double elapsed_time = 0; bool finished = false; @@ -125,6 +126,7 @@ private: void _start_tweeners(); void _stop_internal(bool p_reset); + bool _validate_type_match(const Variant &p_from, Variant &r_to); protected: static void _bind_methods(); diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index da29bc823f..0b0698188c 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -1197,11 +1197,11 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) { } if (!spinning) { - real_t x = CLAMP(bev->get_position().x, corner_x, c->get_size().x - corner_x); - real_t y = CLAMP(bev->get_position().y, corner_x, c->get_size().y - corner_y); + real_t x = CLAMP(bev->get_position().x - corner_x, 0, real_size.x); + real_t y = CLAMP(bev->get_position().y - corner_y, 0, real_size.y); - s = (x - c->get_position().x - corner_x) / real_size.x; - v = 1.0 - (y - c->get_position().y - corner_y) / real_size.y; + s = x / real_size.x; + v = 1.0 - y / real_size.y; } } @@ -1250,11 +1250,11 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event, Control *c) { real_t corner_y = (c == wheel_uv) ? center.y - Math_SQRT12 * c->get_size().height * 0.42 : 0; Size2 real_size(c->get_size().x - corner_x * 2, c->get_size().y - corner_y * 2); - real_t x = CLAMP(mev->get_position().x, corner_x, c->get_size().x - corner_x); - real_t y = CLAMP(mev->get_position().y, corner_x, c->get_size().y - corner_y); + real_t x = CLAMP(mev->get_position().x - corner_x, 0, real_size.x); + real_t y = CLAMP(mev->get_position().y - corner_y, 0, real_size.y); - s = (x - corner_x) / real_size.x; - v = 1.0 - (y - corner_y) / real_size.y; + s = x / real_size.x; + v = 1.0 - y / real_size.y; } } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index a6a2fb8d7c..58b820c31f 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -860,7 +860,7 @@ bool GraphEdit::is_in_port_hotzone(const Vector2 &pos, const Vector2 &p_mouse_po } for (int i = 0; i < get_child_count(); i++) { - Control *child = Object::cast_to<Control>(get_child(i)); + GraphNode *child = Object::cast_to<GraphNode>(get_child(i)); if (!child) { continue; } diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index f59702835c..c0ef71ee4f 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -87,6 +87,8 @@ int Label::get_line_height(int p_line) const { } void Label::_shape() { + bool font_was_dirty = font_dirty; + Ref<StyleBox> style = theme_cache.normal_style; int width = (get_size().width - style->get_minimum_size().width); @@ -128,7 +130,24 @@ void Label::_shape() { TS->free_rid(lines_rid[i]); } lines_rid.clear(); + } + + Size2i prev_minsize = minsize; + minsize = Size2(); + + if (xl_text.length() == 0) { + lines_dirty = false; + return; + } + // Don't compute minimum size until width is stable (two shape requests in a row with the same width.) + // This avoids situations in which the initial width is very narrow and the label would break text + // into many very short lines, causing a very tall label that can leave a deformed container. + bool width_stabilized = get_size().width == stable_width; + stable_width = get_size().width; + + // With autowrap off, there's still a point in shaping before width is stable: to contribute a min width. + if (lines_dirty && (width_stabilized || autowrap_mode == TextServer::AUTOWRAP_OFF)) { BitField<TextServer::LineBreakFlag> autowrap_flags = TextServer::BREAK_MANDATORY; switch (autowrap_mode) { case TextServer::AUTOWRAP_WORD_SMART: @@ -152,21 +171,19 @@ void Label::_shape() { } } - if (xl_text.length() == 0) { - minsize = Size2(1, get_line_height()); - return; - } - if (autowrap_mode == TextServer::AUTOWRAP_OFF) { - minsize.width = 0.0f; for (int i = 0; i < lines_rid.size(); i++) { if (minsize.width < TS->shaped_text_get_size(lines_rid[i]).x) { minsize.width = TS->shaped_text_get_size(lines_rid[i]).x; } } + + // With autowrap off, by now we already know the width the label will take. + width = (minsize.width - style->get_minimum_size().width); + width_stabilized = true; } - if (lines_dirty) { + if (lines_dirty && width_stabilized) { BitField<TextServer::TextOverrunFlag> overrun_flags = TextServer::OVERRUN_NO_TRIM; switch (overrun_behavior) { case TextServer::OVERRUN_TRIM_WORD_ELLIPSIS: @@ -191,8 +208,11 @@ void Label::_shape() { // Fill after min_size calculation. + int visible_lines = lines_rid.size(); + if (max_lines_visible >= 0 && visible_lines > max_lines_visible) { + visible_lines = max_lines_visible; + } if (autowrap_mode != TextServer::AUTOWRAP_OFF) { - int visible_lines = get_visible_line_count(); bool lines_hidden = visible_lines > 0 && visible_lines < lines_rid.size(); if (lines_hidden) { overrun_flags.set_flag(TextServer::OVERRUN_ENFORCE_ELLIPSIS); @@ -221,33 +241,22 @@ void Label::_shape() { } } } - lines_dirty = false; - lines_shaped_last_width = get_size().width; - } - _update_visible(); + int last_line = MIN(lines_rid.size(), visible_lines + lines_skipped); + int line_spacing = settings.is_valid() ? settings->get_line_spacing() : theme_cache.line_spacing; + for (int64_t i = lines_skipped; i < last_line; i++) { + minsize.height += TS->shaped_text_get_size(lines_rid[i]).y + line_spacing; + } - if (autowrap_mode == TextServer::AUTOWRAP_OFF || !clip || overrun_behavior == TextServer::OVERRUN_NO_TRIMMING) { - update_minimum_size(); + lines_dirty = false; } -} - -void Label::_update_visible() { - int line_spacing = settings.is_valid() ? settings->get_line_spacing() : theme_cache.line_spacing; - Ref<StyleBox> style = theme_cache.normal_style; - int lines_visible = lines_rid.size(); - if (max_lines_visible >= 0 && lines_visible > max_lines_visible) { - lines_visible = max_lines_visible; + if (minsize != prev_minsize || font_was_dirty) { + update_minimum_size(); } - minsize.height = 0; - int last_line = MIN(lines_rid.size(), lines_visible + lines_skipped); - for (int64_t i = lines_skipped; i < last_line; i++) { - minsize.height += TS->shaped_text_get_size(lines_rid[i]).y + line_spacing; - if (minsize.height > (get_size().height - style->get_minimum_size().height + line_spacing)) { - break; - } + if (!width_stabilized) { + callable_mp(this, &Label::_shape).call_deferred(); } } @@ -345,8 +354,25 @@ void Label::_notification(int p_what) { RenderingServer::get_singleton()->canvas_item_set_clip(get_canvas_item(), true); } + // When a shaped text is invalidated by an external source, we want to reshape it. + if (!TS->shaped_text_is_ready(text_rid)) { + dirty = true; + } + + for (const RID &line_rid : lines_rid) { + if (!TS->shaped_text_is_ready(line_rid)) { + lines_dirty = true; + break; + } + } + if (dirty || font_dirty || lines_dirty) { _shape(); + if (lines_dirty) { + // There will be another pass. + queue_redraw(); + break; + } } RID ci = get_canvas_item(); @@ -370,7 +396,7 @@ void Label::_notification(int p_what) { style->draw(ci, Rect2(Point2(0, 0), get_size())); float total_h = 0.0; - int lines_visible = 0; + int visible_lines = 0; // Get number of lines to fit to the height. for (int64_t i = lines_skipped; i < lines_rid.size(); i++) { @@ -378,14 +404,14 @@ void Label::_notification(int p_what) { if (total_h > (get_size().height - style->get_minimum_size().height + line_spacing)) { break; } - lines_visible++; + visible_lines++; } - if (max_lines_visible >= 0 && lines_visible > max_lines_visible) { - lines_visible = max_lines_visible; + if (max_lines_visible >= 0 && visible_lines > max_lines_visible) { + visible_lines = max_lines_visible; } - int last_line = MIN(lines_rid.size(), lines_visible + lines_skipped); + int last_line = MIN(lines_rid.size(), visible_lines + lines_skipped); bool trim_chars = (visible_chars >= 0) && (visible_chars_behavior == TextServer::VC_CHARS_AFTER_SHAPING); bool trim_glyphs_ltr = (visible_chars >= 0) && ((visible_chars_behavior == TextServer::VC_GLYPHS_LTR) || ((visible_chars_behavior == TextServer::VC_GLYPHS_AUTO) && !rtl_layout)); bool trim_glyphs_rtl = (visible_chars >= 0) && ((visible_chars_behavior == TextServer::VC_GLYPHS_RTL) || ((visible_chars_behavior == TextServer::VC_GLYPHS_AUTO) && rtl_layout)); @@ -402,7 +428,7 @@ void Label::_notification(int p_what) { total_h += style->get_margin(SIDE_TOP) + style->get_margin(SIDE_BOTTOM); int vbegin = 0, vsep = 0; - if (lines_visible > 0) { + if (visible_lines > 0) { switch (vertical_alignment) { case VERTICAL_ALIGNMENT_TOP: { // Nothing. @@ -419,8 +445,8 @@ void Label::_notification(int p_what) { } break; case VERTICAL_ALIGNMENT_FILL: { vbegin = 0; - if (lines_visible > 1) { - vsep = (size.y - (total_h - line_spacing)) / (lines_visible - 1); + if (visible_lines > 1) { + vsep = (size.y - (total_h - line_spacing)) / (visible_lines - 1); } else { vsep = 0; } @@ -597,13 +623,7 @@ void Label::_notification(int p_what) { } break; case NOTIFICATION_RESIZED: { - // It may happen that the reshaping due to this size change triggers a cascade of re-layout - // across the hierarchy where this label belongs to in a way that its size changes multiple - // times, but ending up with the original size it was already shaped for. - // This check prevents the catastrophic, freezing infinite cascade of re-layout. - if (lines_shaped_last_width != get_size().width) { - lines_dirty = true; - } + lines_dirty = true; } break; } } @@ -646,25 +666,25 @@ int Label::get_line_count() const { int Label::get_visible_line_count() const { Ref<StyleBox> style = theme_cache.normal_style; int line_spacing = settings.is_valid() ? settings->get_line_spacing() : theme_cache.line_spacing; - int lines_visible = 0; + int visible_lines = 0; float total_h = 0.0; for (int64_t i = lines_skipped; i < lines_rid.size(); i++) { total_h += TS->shaped_text_get_size(lines_rid[i]).y + line_spacing; if (total_h > (get_size().height - style->get_minimum_size().height + line_spacing)) { break; } - lines_visible++; + visible_lines++; } - if (lines_visible > lines_rid.size()) { - lines_visible = lines_rid.size(); + if (visible_lines > lines_rid.size()) { + visible_lines = lines_rid.size(); } - if (max_lines_visible >= 0 && lines_visible > max_lines_visible) { - lines_visible = max_lines_visible; + if (max_lines_visible >= 0 && visible_lines > max_lines_visible) { + visible_lines = max_lines_visible; } - return lines_visible; + return visible_lines; } void Label::set_horizontal_alignment(HorizontalAlignment p_alignment) { @@ -886,7 +906,7 @@ void Label::set_lines_skipped(int p_lines) { } lines_skipped = p_lines; - _update_visible(); + lines_dirty = true; queue_redraw(); } @@ -900,7 +920,7 @@ void Label::set_max_lines_visible(int p_lines) { } max_lines_visible = p_lines; - _update_visible(); + lines_dirty = true; queue_redraw(); } @@ -949,7 +969,7 @@ void Label::_bind_methods() { ClassDB::bind_method(D_METHOD("get_visible_ratio"), &Label::get_visible_ratio); ClassDB::bind_method(D_METHOD("set_lines_skipped", "lines_skipped"), &Label::set_lines_skipped); ClassDB::bind_method(D_METHOD("get_lines_skipped"), &Label::get_lines_skipped); - ClassDB::bind_method(D_METHOD("set_max_lines_visible", "lines_visible"), &Label::set_max_lines_visible); + ClassDB::bind_method(D_METHOD("set_max_lines_visible", "visible_lines"), &Label::set_max_lines_visible); ClassDB::bind_method(D_METHOD("get_max_lines_visible"), &Label::get_max_lines_visible); ClassDB::bind_method(D_METHOD("set_structured_text_bidi_override", "parser"), &Label::set_structured_text_bidi_override); ClassDB::bind_method(D_METHOD("get_structured_text_bidi_override"), &Label::get_structured_text_bidi_override); diff --git a/scene/gui/label.h b/scene/gui/label.h index b80646810b..448cb245eb 100644 --- a/scene/gui/label.h +++ b/scene/gui/label.h @@ -46,10 +46,10 @@ private: bool clip = false; TextServer::OverrunBehavior overrun_behavior = TextServer::OVERRUN_NO_TRIMMING; Size2 minsize; + real_t stable_width = -1; bool uppercase = false; bool lines_dirty = true; - int lines_shaped_last_width = -1; bool dirty = true; bool font_dirty = true; @@ -83,7 +83,6 @@ private: int font_shadow_outline_size; } theme_cache; - void _update_visible(); void _shape(); void _invalidate(); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 0eeac2f285..1a6adca121 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -59,6 +59,7 @@ Size2 PopupMenu::_get_contents_minimum_size() const { for (int i = 0; i < items.size(); i++) { Size2 item_size; + const_cast<PopupMenu *>(this)->_shape_item(i); Size2 icon_size = items[i].get_icon_size(); item_size.height = _get_item_height(i); diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 771e074d48..9092be93e6 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -569,6 +569,12 @@ void Window::_update_from_window() { void Window::_clear_window() { ERR_FAIL_COND(window_id == DisplayServer::INVALID_WINDOW_ID); + DisplayServer::get_singleton()->window_set_rect_changed_callback(Callable(), window_id); + DisplayServer::get_singleton()->window_set_window_event_callback(Callable(), window_id); + DisplayServer::get_singleton()->window_set_input_event_callback(Callable(), window_id); + DisplayServer::get_singleton()->window_set_input_text_callback(Callable(), window_id); + DisplayServer::get_singleton()->window_set_drop_files_callback(Callable(), window_id); + if (transient_parent && transient_parent->window_id != DisplayServer::INVALID_WINDOW_ID) { DisplayServer::get_singleton()->window_set_transient(window_id, DisplayServer::INVALID_WINDOW_ID); } @@ -1422,6 +1428,9 @@ void Window::popup_centered_clamped(const Size2i &p_size, float p_fallback_ratio ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window."); + // Consider the current size when calling with the default value. + Size2i expected_size = p_size == Size2i() ? size : p_size; + Rect2 parent_rect; if (is_embedded()) { @@ -1436,7 +1445,7 @@ void Window::popup_centered_clamped(const Size2i &p_size, float p_fallback_ratio Vector2i size_ratio = parent_rect.size * p_fallback_ratio; Rect2i popup_rect; - popup_rect.size = Vector2i(MIN(size_ratio.x, p_size.x), MIN(size_ratio.y, p_size.y)); + popup_rect.size = Vector2i(MIN(size_ratio.x, expected_size.x), MIN(size_ratio.y, expected_size.y)); popup_rect.size = _clamp_window_size(popup_rect.size); if (parent_rect != Rect2()) { @@ -1450,6 +1459,9 @@ void Window::popup_centered(const Size2i &p_minsize) { ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window."); + // Consider the current size when calling with the default value. + Size2i expected_size = p_minsize == Size2i() ? size : p_minsize; + Rect2 parent_rect; if (is_embedded()) { @@ -1462,7 +1474,7 @@ void Window::popup_centered(const Size2i &p_minsize) { } Rect2i popup_rect; - popup_rect.size = _clamp_window_size(get_size().max(p_minsize)); + popup_rect.size = _clamp_window_size(expected_size); if (parent_rect != Rect2()) { popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2; diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index ef1f6459e9..8ed68626a8 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -2890,6 +2890,18 @@ void TextMesh::_create_mesh_array(Array &p_arr) const { dirty_cache = false; } + // When a shaped text is invalidated by an external source, we want to reshape it. + if (!TS->shaped_text_is_ready(text_rid)) { + dirty_text = true; + } + + for (const RID &line_rid : lines_rid) { + if (!TS->shaped_text_is_ready(line_rid)) { + dirty_lines = true; + break; + } + } + // Update text buffer. if (dirty_text) { TS->shaped_text_clear(text_rid); @@ -3328,7 +3340,7 @@ void TextMesh::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "pixel_size", PROPERTY_HINT_RANGE, "0.0001,128,0.0001,suffix:m"), "set_pixel_size", "get_pixel_size"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "curve_step", PROPERTY_HINT_RANGE, "0.1,10,0.1,suffix:px"), "set_curve_step", "get_curve_step"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "depth", PROPERTY_HINT_RANGE, "0.0,100.0,0.001,or_greater,suffix:m"), "set_depth", "get_depth"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "width", PROPERTY_HINT_NONE, "suffix:m"), "set_width", "get_width"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "width", PROPERTY_HINT_NONE, "suffix:px"), "set_width", "get_width"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "offset", PROPERTY_HINT_NONE, "suffix:px"), "set_offset", "get_offset"); ADD_GROUP("BiDi", ""); diff --git a/scene/resources/surface_tool.cpp b/scene/resources/surface_tool.cpp index 16cc1c3370..ccb3ddee45 100644 --- a/scene/resources/surface_tool.cpp +++ b/scene/resources/surface_tool.cpp @@ -648,7 +648,7 @@ Array SurfaceTool::commit_to_arrays() { for (uint32_t idx = 0; idx < vertex_array.size(); idx++) { const Vertex &v = vertex_array[idx]; - if (v.bones.size() > count) { + if (v.bones.size() != count) { ERR_PRINT_ONCE(vformat("Invalid bones size %d vs count %d", v.bones.size(), count)); continue; } @@ -672,7 +672,7 @@ Array SurfaceTool::commit_to_arrays() { for (uint32_t idx = 0; idx < vertex_array.size(); idx++) { const Vertex &v = vertex_array[idx]; - if (v.weights.size() > count) { + if (v.weights.size() != count) { ERR_PRINT_ONCE(vformat("Invalid weight size %d vs count %d", v.weights.size(), count)); continue; } diff --git a/scene/resources/text_line.cpp b/scene/resources/text_line.cpp index 93611ea2c4..38a865b170 100644 --- a/scene/resources/text_line.cpp +++ b/scene/resources/text_line.cpp @@ -101,6 +101,11 @@ void TextLine::_bind_methods() { } void TextLine::_shape() { + // When a shaped text is invalidated by an external source, we want to reshape it. + if (!TS->shaped_text_is_ready(rid)) { + dirty = true; + } + if (dirty) { if (!tab_stops.is_empty()) { TS->shaped_text_tab_align(rid, tab_stops); diff --git a/scene/resources/text_paragraph.cpp b/scene/resources/text_paragraph.cpp index dfafc7d2bc..729063245c 100644 --- a/scene/resources/text_paragraph.cpp +++ b/scene/resources/text_paragraph.cpp @@ -134,6 +134,18 @@ void TextParagraph::_bind_methods() { } void TextParagraph::_shape_lines() { + // When a shaped text is invalidated by an external source, we want to reshape it. + if (!TS->shaped_text_is_ready(rid) || !TS->shaped_text_is_ready(dropcap_rid)) { + lines_dirty = true; + } + + for (const RID &line_rid : lines_rid) { + if (!TS->shaped_text_is_ready(line_rid)) { + lines_dirty = true; + break; + } + } + if (lines_dirty) { for (const RID &line_rid : lines_rid) { TS->free_rid(line_rid); diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp index 58a638804d..fee0a4a910 100644 --- a/scene/resources/tile_set.cpp +++ b/scene/resources/tile_set.cpp @@ -4805,8 +4805,8 @@ void TileSetScenesCollectionSource::set_scene_tile_scene(int p_id, Ref<PackedSce scene_state = scene_state->get_base_scene_state(); } ERR_FAIL_COND_MSG(type.is_empty(), vformat("Invalid PackedScene for TileSetScenesCollectionSource: %s. Could not get the type of the root node.", p_packed_scene->get_path())); - bool extends_correct_class = ClassDB::is_parent_class(type, "Control") || ClassDB::is_parent_class(type, "Node2D"); - ERR_FAIL_COND_MSG(!extends_correct_class, vformat("Invalid PackedScene for TileSetScenesCollectionSource: %s. Root node should extend Control or Node2D. Found %s instead.", p_packed_scene->get_path(), type)); + bool extends_correct_class = ClassDB::is_parent_class(type, "CanvasItem"); + ERR_FAIL_COND_MSG(!extends_correct_class, vformat("Invalid PackedScene for TileSetScenesCollectionSource: %s. Root node should extend CanvasItem. Found %s instead.", p_packed_scene->get_path(), type)); scenes[p_id].scene = p_packed_scene; } else { diff --git a/servers/navigation/navigation_utilities.h b/servers/navigation/navigation_utilities.h index 7897efd423..04d0ab0d98 100644 --- a/servers/navigation/navigation_utilities.h +++ b/servers/navigation/navigation_utilities.h @@ -69,10 +69,10 @@ struct PathQueryParameters { }; struct PathQueryResult { - Vector<Vector3> path; - Vector<int32_t> path_types; + PackedVector3Array path; + PackedInt32Array path_types; TypedArray<RID> path_rids; - Vector<int64_t> path_owner_ids; + PackedInt64Array path_owner_ids; }; } //namespace NavigationUtilities diff --git a/servers/navigation_server_2d.cpp b/servers/navigation_server_2d.cpp index 85ba8ed431..668b1dffc3 100644 --- a/servers/navigation_server_2d.cpp +++ b/servers/navigation_server_2d.cpp @@ -200,6 +200,22 @@ Color NavigationServer2D::get_debug_navigation_link_connection_disabled_color() return NavigationServer3D::get_singleton()->get_debug_navigation_link_connection_disabled_color(); } +void NavigationServer2D::set_debug_navigation_geometry_edge_color(const Color &p_color) { + NavigationServer3D::get_singleton()->set_debug_navigation_geometry_edge_color(p_color); +} + +Color NavigationServer2D::get_debug_navigation_geometry_edge_color() const { + return NavigationServer3D::get_singleton()->get_debug_navigation_geometry_edge_color(); +} + +void NavigationServer2D::set_debug_navigation_geometry_edge_disabled_color(const Color &p_color) { + NavigationServer3D::get_singleton()->set_debug_navigation_geometry_edge_disabled_color(p_color); +} + +Color NavigationServer2D::get_debug_navigation_geometry_edge_disabled_color() const { + return NavigationServer3D::get_singleton()->get_debug_navigation_geometry_edge_disabled_color(); +} + void NavigationServer2D::set_debug_navigation_enable_edge_connections(const bool p_value) { NavigationServer3D::get_singleton()->set_debug_navigation_enable_edge_connections(p_value); } @@ -208,6 +224,22 @@ bool NavigationServer2D::get_debug_navigation_enable_edge_connections() const { return NavigationServer3D::get_singleton()->get_debug_navigation_enable_edge_connections(); } +void NavigationServer2D::set_debug_navigation_enable_geometry_face_random_color(const bool p_value) { + NavigationServer3D::get_singleton()->set_debug_navigation_enable_geometry_face_random_color(p_value); +} + +bool NavigationServer2D::get_debug_navigation_enable_geometry_face_random_color() const { + return NavigationServer3D::get_singleton()->get_debug_navigation_enable_geometry_face_random_color(); +} + +void NavigationServer2D::set_debug_navigation_enable_edge_lines(const bool p_value) { + NavigationServer3D::get_singleton()->set_debug_navigation_enable_edge_lines(p_value); +} + +bool NavigationServer2D::get_debug_navigation_enable_edge_lines() const { + return NavigationServer3D::get_singleton()->get_debug_navigation_enable_edge_lines(); +} + void NavigationServer2D::set_debug_navigation_agent_path_color(const Color &p_color) { NavigationServer3D::get_singleton()->set_debug_navigation_agent_path_color(p_color); } diff --git a/servers/navigation_server_2d.h b/servers/navigation_server_2d.h index 746389404b..153e60272c 100644 --- a/servers/navigation_server_2d.h +++ b/servers/navigation_server_2d.h @@ -225,6 +225,7 @@ public: /// Callback called at the end of the RVO process virtual void agent_set_callback(RID p_agent, Callable p_callback); + /// Returns a customized navigation path using a query parameters object virtual void query_path(const Ref<NavigationPathQueryParameters2D> &p_query_parameters, Ref<NavigationPathQueryResult2D> p_query_result) const; /// Destroy the `RID` @@ -246,6 +247,12 @@ public: void set_debug_navigation_geometry_face_disabled_color(const Color &p_color); Color get_debug_navigation_geometry_face_disabled_color() const; + void set_debug_navigation_geometry_edge_color(const Color &p_color); + Color get_debug_navigation_geometry_edge_color() const; + + void set_debug_navigation_geometry_edge_disabled_color(const Color &p_color); + Color get_debug_navigation_geometry_edge_disabled_color() const; + void set_debug_navigation_link_connection_color(const Color &p_color); Color get_debug_navigation_link_connection_color() const; @@ -255,6 +262,12 @@ public: void set_debug_navigation_enable_edge_connections(const bool p_value); bool get_debug_navigation_enable_edge_connections() const; + void set_debug_navigation_enable_geometry_face_random_color(const bool p_value); + bool get_debug_navigation_enable_geometry_face_random_color() const; + + void set_debug_navigation_enable_edge_lines(const bool p_value); + bool get_debug_navigation_enable_edge_lines() const; + void set_debug_navigation_agent_path_color(const Color &p_color); Color get_debug_navigation_agent_path_color() const; diff --git a/servers/navigation_server_3d.cpp b/servers/navigation_server_3d.cpp index 70897ae75c..02460bdb18 100644 --- a/servers/navigation_server_3d.cpp +++ b/servers/navigation_server_3d.cpp @@ -29,7 +29,6 @@ /**************************************************************************/ #include "navigation_server_3d.h" - #include "core/config/project_settings.h" NavigationServer3D *NavigationServer3D::singleton = nullptr; @@ -186,17 +185,6 @@ NavigationServer3D::~NavigationServer3D() { singleton = nullptr; } -NavigationServer3DCallback NavigationServer3DManager::create_callback = nullptr; - -void NavigationServer3DManager::set_default_server(NavigationServer3DCallback p_callback) { - create_callback = p_callback; -} - -NavigationServer3D *NavigationServer3DManager::new_default_server() { - ERR_FAIL_COND_V(create_callback == nullptr, nullptr); - return create_callback(); -} - #ifdef DEBUG_ENABLED void NavigationServer3D::_emit_navigation_debug_changed_signal() { if (debug_dirty) { @@ -594,8 +582,6 @@ bool NavigationServer3D::get_debug_navigation_enable_agent_paths_xray() const { #endif // DEBUG_ENABLED -/////////////////////////////////////////////////////// - void NavigationServer3D::query_path(const Ref<NavigationPathQueryParameters3D> &p_query_parameters, Ref<NavigationPathQueryResult3D> p_query_result) const { ERR_FAIL_COND(!p_query_parameters.is_valid()); ERR_FAIL_COND(!p_query_result.is_valid()); @@ -607,3 +593,19 @@ void NavigationServer3D::query_path(const Ref<NavigationPathQueryParameters3D> & p_query_result->set_path_rids(_query_result.path_rids); p_query_result->set_path_owner_ids(_query_result.path_owner_ids); } + +/////////////////////////////////////////////////////// + +NavigationServer3DCallback NavigationServer3DManager::create_callback = nullptr; + +void NavigationServer3DManager::set_default_server(NavigationServer3DCallback p_callback) { + create_callback = p_callback; +} + +NavigationServer3D *NavigationServer3DManager::new_default_server() { + if (create_callback == nullptr) { + return nullptr; + } + + return create_callback(); +} diff --git a/servers/navigation_server_3d.h b/servers/navigation_server_3d.h index bc4bdf2a30..79729c55be 100644 --- a/servers/navigation_server_3d.h +++ b/servers/navigation_server_3d.h @@ -253,12 +253,12 @@ public: virtual void process(real_t delta_time) = 0; /// Returns a customized navigation path using a query parameters object - void query_path(const Ref<NavigationPathQueryParameters3D> &p_query_parameters, Ref<NavigationPathQueryResult3D> p_query_result) const; + virtual void query_path(const Ref<NavigationPathQueryParameters3D> &p_query_parameters, Ref<NavigationPathQueryResult3D> p_query_result) const; virtual NavigationUtilities::PathQueryResult _query_path(const NavigationUtilities::PathQueryParameters &p_parameters) const = 0; NavigationServer3D(); - virtual ~NavigationServer3D(); + ~NavigationServer3D() override; enum ProcessInfo { INFO_ACTIVE_MAPS, diff --git a/servers/navigation_server_3d_dummy.h b/servers/navigation_server_3d_dummy.h new file mode 100644 index 0000000000..d2f8fe6048 --- /dev/null +++ b/servers/navigation_server_3d_dummy.h @@ -0,0 +1,117 @@ +/**************************************************************************/ +/* navigation_server_3d_dummy.h */ +/**************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/**************************************************************************/ +/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ +/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* */ +/* 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 NAVIGATION_SERVER_3D_DUMMY_H +#define NAVIGATION_SERVER_3D_DUMMY_H + +#include "servers/navigation_server_3d.h" + +class NavigationServer3DDummy : public NavigationServer3D { + GDCLASS(NavigationServer3DDummy, NavigationServer3D); + +public: + TypedArray<RID> get_maps() const override { return TypedArray<RID>(); } + RID map_create() override { return RID(); } + void map_set_active(RID p_map, bool p_active) override {} + bool map_is_active(RID p_map) const override { return false; } + void map_set_up(RID p_map, Vector3 p_up) override {} + Vector3 map_get_up(RID p_map) const override { return Vector3(); } + void map_set_cell_size(RID p_map, real_t p_cell_size) override {} + real_t map_get_cell_size(RID p_map) const override { return 0; } + void map_set_edge_connection_margin(RID p_map, real_t p_connection_margin) override {} + real_t map_get_edge_connection_margin(RID p_map) const override { return 0; } + void map_set_link_connection_radius(RID p_map, real_t p_connection_radius) override {} + real_t map_get_link_connection_radius(RID p_map) const override { return 0; } + Vector<Vector3> map_get_path(RID p_map, Vector3 p_origin, Vector3 p_destination, bool p_optimize, uint32_t p_navigation_layers) const override { return Vector<Vector3>(); } + Vector3 map_get_closest_point_to_segment(RID p_map, const Vector3 &p_from, const Vector3 &p_to, const bool p_use_collision) const override { return Vector3(); } + Vector3 map_get_closest_point(RID p_map, const Vector3 &p_point) const override { return Vector3(); } + Vector3 map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const override { return Vector3(); } + RID map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const override { return RID(); } + TypedArray<RID> map_get_links(RID p_map) const override { return TypedArray<RID>(); } + TypedArray<RID> map_get_regions(RID p_map) const override { return TypedArray<RID>(); } + TypedArray<RID> map_get_agents(RID p_map) const override { return TypedArray<RID>(); } + void map_force_update(RID p_map) override {} + RID region_create() override { return RID(); } + void region_set_enter_cost(RID p_region, real_t p_enter_cost) override {} + real_t region_get_enter_cost(RID p_region) const override { return 0; } + void region_set_travel_cost(RID p_region, real_t p_travel_cost) override {} + real_t region_get_travel_cost(RID p_region) const override { return 0; } + void region_set_owner_id(RID p_region, ObjectID p_owner_id) override {} + ObjectID region_get_owner_id(RID p_region) const override { return ObjectID(); } + bool region_owns_point(RID p_region, const Vector3 &p_point) const override { return false; } + void region_set_map(RID p_region, RID p_map) override {} + RID region_get_map(RID p_region) const override { return RID(); } + void region_set_navigation_layers(RID p_region, uint32_t p_navigation_layers) override {} + uint32_t region_get_navigation_layers(RID p_region) const override { return 0; } + void region_set_transform(RID p_region, Transform3D p_transform) override {} + void region_set_navigation_mesh(RID p_region, Ref<NavigationMesh> p_navigation_mesh) override {} + void region_bake_navigation_mesh(Ref<NavigationMesh> p_navigation_mesh, Node *p_root_node) override {} + int region_get_connections_count(RID p_region) const override { return 0; } + Vector3 region_get_connection_pathway_start(RID p_region, int p_connection_id) const override { return Vector3(); } + Vector3 region_get_connection_pathway_end(RID p_region, int p_connection_id) const override { return Vector3(); } + RID link_create() override { return RID(); } + void link_set_map(RID p_link, RID p_map) override {} + RID link_get_map(RID p_link) const override { return RID(); } + void link_set_bidirectional(RID p_link, bool p_bidirectional) override {} + bool link_is_bidirectional(RID p_link) const override { return false; } + void link_set_navigation_layers(RID p_link, uint32_t p_navigation_layers) override {} + uint32_t link_get_navigation_layers(RID p_link) const override { return 0; } + void link_set_start_position(RID p_link, Vector3 p_position) override {} + Vector3 link_get_start_position(RID p_link) const override { return Vector3(); } + void link_set_end_position(RID p_link, Vector3 p_position) override {} + Vector3 link_get_end_position(RID p_link) const override { return Vector3(); } + void link_set_enter_cost(RID p_link, real_t p_enter_cost) override {} + real_t link_get_enter_cost(RID p_link) const override { return 0; } + void link_set_travel_cost(RID p_link, real_t p_travel_cost) override {} + real_t link_get_travel_cost(RID p_link) const override { return 0; } + void link_set_owner_id(RID p_link, ObjectID p_owner_id) override {} + ObjectID link_get_owner_id(RID p_link) const override { return ObjectID(); } + RID agent_create() override { return RID(); } + void agent_set_map(RID p_agent, RID p_map) override {} + RID agent_get_map(RID p_agent) const override { return RID(); } + void agent_set_neighbor_distance(RID p_agent, real_t p_distance) override {} + void agent_set_max_neighbors(RID p_agent, int p_count) override {} + void agent_set_time_horizon(RID p_agent, real_t p_time) override {} + void agent_set_radius(RID p_agent, real_t p_radius) override {} + void agent_set_max_speed(RID p_agent, real_t p_max_speed) override {} + void agent_set_velocity(RID p_agent, Vector3 p_velocity) override {} + void agent_set_target_velocity(RID p_agent, Vector3 p_velocity) override {} + void agent_set_position(RID p_agent, Vector3 p_position) override {} + void agent_set_ignore_y(RID p_agent, bool p_ignore) override {} + bool agent_is_map_changed(RID p_agent) const override { return false; } + void agent_set_callback(RID p_agent, Callable p_callback) override {} + void free(RID p_object) override {} + void set_active(bool p_active) override {} + void process(real_t delta_time) override {} + NavigationUtilities::PathQueryResult _query_path(const NavigationUtilities::PathQueryParameters &p_parameters) const override { return NavigationUtilities::PathQueryResult(); } + int get_process_info(ProcessInfo p_info) const override { return 0; } +}; + +#endif // NAVIGATION_SERVER_3D_DUMMY_H diff --git a/servers/physics_2d/godot_step_2d.cpp b/servers/physics_2d/godot_step_2d.cpp index 3b5fbbced8..bbaec8be2b 100644 --- a/servers/physics_2d/godot_step_2d.cpp +++ b/servers/physics_2d/godot_step_2d.cpp @@ -30,6 +30,7 @@ #include "godot_step_2d.h" +#include "core/object/worker_thread_pool.h" #include "core/os/os.h" #define BODY_ISLAND_COUNT_RESERVE 128 diff --git a/servers/physics_2d/godot_step_2d.h b/servers/physics_2d/godot_step_2d.h index 75eeba4a3d..c08c6379de 100644 --- a/servers/physics_2d/godot_step_2d.h +++ b/servers/physics_2d/godot_step_2d.h @@ -33,7 +33,6 @@ #include "godot_space_2d.h" -#include "core/object/worker_thread_pool.h" #include "core/templates/local_vector.h" class GodotStep2D { diff --git a/servers/physics_3d/godot_step_3d.cpp b/servers/physics_3d/godot_step_3d.cpp index 4119c58897..d09a3b4e6d 100644 --- a/servers/physics_3d/godot_step_3d.cpp +++ b/servers/physics_3d/godot_step_3d.cpp @@ -32,6 +32,7 @@ #include "godot_joint_3d.h" +#include "core/object/worker_thread_pool.h" #include "core/os/os.h" #define BODY_ISLAND_COUNT_RESERVE 128 diff --git a/servers/physics_3d/godot_step_3d.h b/servers/physics_3d/godot_step_3d.h index be7266b264..1c9b0af422 100644 --- a/servers/physics_3d/godot_step_3d.h +++ b/servers/physics_3d/godot_step_3d.h @@ -33,7 +33,6 @@ #include "godot_space_3d.h" -#include "core/object/worker_thread_pool.h" #include "core/templates/local_vector.h" class GodotStep3D { diff --git a/servers/physics_server_3d.cpp b/servers/physics_server_3d.cpp index 6a163c86d2..c9cf8f99af 100644 --- a/servers/physics_server_3d.cpp +++ b/servers/physics_server_3d.cpp @@ -429,7 +429,7 @@ Vector<real_t> PhysicsDirectSpaceState3D::_cast_motion(const Ref<PhysicsShapeQue return ret; } -TypedArray<PackedVector2Array> PhysicsDirectSpaceState3D::_collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results) { +TypedArray<PackedVector3Array> PhysicsDirectSpaceState3D::_collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results) { ERR_FAIL_COND_V(!p_shape_query.is_valid(), Array()); Vector<Vector3> ret; @@ -437,9 +437,9 @@ TypedArray<PackedVector2Array> PhysicsDirectSpaceState3D::_collide_shape(const R int rc = 0; bool res = collide_shape(p_shape_query->get_parameters(), ret.ptrw(), p_max_results, rc); if (!res) { - return TypedArray<PackedVector2Array>(); + return TypedArray<PackedVector3Array>(); } - TypedArray<PackedVector2Array> r; + TypedArray<PackedVector3Array> r; r.resize(rc * 2); for (int i = 0; i < rc * 2; i++) { r[i] = ret[i]; diff --git a/servers/physics_server_3d.h b/servers/physics_server_3d.h index abf22e68a4..2c7ebeea66 100644 --- a/servers/physics_server_3d.h +++ b/servers/physics_server_3d.h @@ -125,7 +125,7 @@ private: TypedArray<Dictionary> _intersect_point(const Ref<PhysicsPointQueryParameters3D> &p_point_query, int p_max_results = 32); TypedArray<Dictionary> _intersect_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results = 32); Vector<real_t> _cast_motion(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query); - TypedArray<PackedVector2Array> _collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results = 32); + TypedArray<PackedVector3Array> _collide_shape(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query, int p_max_results = 32); Dictionary _get_rest_info(const Ref<PhysicsShapeQueryParameters3D> &p_shape_query); protected: diff --git a/servers/rendering/renderer_rd/effects/ss_effects.cpp b/servers/rendering/renderer_rd/effects/ss_effects.cpp index 2b5d36d686..e031e33041 100644 --- a/servers/rendering/renderer_rd/effects/ss_effects.cpp +++ b/servers/rendering/renderer_rd/effects/ss_effects.cpp @@ -411,12 +411,21 @@ SSEffects::~SSEffects() { /* SS Downsampler */ -void SSEffects::downsample_depth(RID p_depth_buffer, const Vector<RID> &p_depth_mipmaps, bool p_invalidate_uniform_set, Size2i p_full_screen_size, const Projection &p_projection) { +void SSEffects::downsample_depth(Ref<RenderSceneBuffersRD> p_render_buffers, uint32_t p_view, const Projection &p_projection) { UniformSetCacheRD *uniform_set_cache = UniformSetCacheRD::get_singleton(); ERR_FAIL_NULL(uniform_set_cache); MaterialStorage *material_storage = MaterialStorage::get_singleton(); ERR_FAIL_NULL(material_storage); + uint32_t view_count = p_render_buffers->get_view_count(); + Size2i full_screen_size = p_render_buffers->get_internal_size(); + Size2i size((full_screen_size.x + 1) / 2, (full_screen_size.y + 1) / 2); + + // Make sure our buffers exist, buffers are automatically cleared if view count or size changes. + if (!p_render_buffers->has_texture(RB_SCOPE_SSDS, RB_LINEAR_DEPTH)) { + p_render_buffers->create_texture(RB_SCOPE_SSDS, RB_LINEAR_DEPTH, RD::DATA_FORMAT_R16_SFLOAT, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, size, view_count * 4, 5); + } + // Downsample and deinterleave the depth buffer for SSAO and SSIL RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin(); @@ -447,45 +456,32 @@ void SSEffects::downsample_depth(RID p_depth_buffer, const Vector<RID> &p_depth_ } } + RID shader = ss_effects.downsample_shader.version_get_shader(ss_effects.downsample_shader_version, downsample_mode); int depth_index = use_half_size ? 1 : 0; RD::get_singleton()->draw_command_begin_label("Downsample Depth"); - if (p_invalidate_uniform_set || use_full_mips != ss_effects.used_full_mips_last_frame || use_half_size != ss_effects.used_half_size_last_frame || use_mips != ss_effects.used_mips_last_frame) { - if (ss_effects.downsample_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(ss_effects.downsample_uniform_set)) { - RD::get_singleton()->free(ss_effects.downsample_uniform_set); - ss_effects.downsample_uniform_set = RID(); - } - Vector<RD::Uniform> uniforms; - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_IMAGE; - u.binding = 0; - u.append_id(p_depth_mipmaps[depth_index + 1]); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_IMAGE; - u.binding = 1; - u.append_id(p_depth_mipmaps[depth_index + 2]); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_IMAGE; - u.binding = 2; - u.append_id(p_depth_mipmaps[depth_index + 3]); - uniforms.push_back(u); - } - if (use_full_mips) { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_IMAGE; - u.binding = 3; - u.append_id(p_depth_mipmaps[4]); - uniforms.push_back(u); + RID downsample_uniform_set; + if (use_mips) { + // Grab our downsample uniform set from cache, these are automatically cleaned up if the depth textures are cleared. + // This also ensures we can switch between left eye and right eye uniform sets without recreating the uniform twice a frame. + Vector<RD::Uniform> u_depths; + + // Note, use_full_mips is true if either SSAO or SSIL uses half size, but the other full size and we're using mips. + // That means we're filling all 5 levels. + // In this scenario `depth_index` will be 0. + for (int i = 0; i < (use_full_mips ? 4 : 3); i++) { + RID depth_mipmap = p_render_buffers->get_texture_slice(RB_SCOPE_SSDS, RB_LINEAR_DEPTH, p_view * 4, depth_index + i + 1, 4, 1); + + RD::Uniform u_depth; + u_depth.uniform_type = RD::UNIFORM_TYPE_IMAGE; + u_depth.binding = i; + u_depth.append_id(depth_mipmap); + u_depths.push_back(u_depth); } - ss_effects.downsample_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ss_effects.downsample_shader.version_get_shader(ss_effects.downsample_shader_version, use_full_mips ? 6 : 2), 2); + + // This before only used SS_EFFECTS_DOWNSAMPLE_MIPMAP or SS_EFFECTS_DOWNSAMPLE_FULL_MIPS + downsample_uniform_set = uniform_set_cache->get_cache_vec(shader, 2, u_depths); } float depth_linearize_mul = -p_projection.columns[3][2]; @@ -501,25 +497,30 @@ void SSEffects::downsample_depth(RID p_depth_buffer, const Vector<RID> &p_depth_ ss_effects.downsample_push_constant.z_near = p_projection.get_z_near(); ss_effects.downsample_push_constant.z_far = p_projection.get_z_far(); } - ss_effects.downsample_push_constant.pixel_size[0] = 1.0 / p_full_screen_size.x; - ss_effects.downsample_push_constant.pixel_size[1] = 1.0 / p_full_screen_size.y; + ss_effects.downsample_push_constant.pixel_size[0] = 1.0 / full_screen_size.x; + ss_effects.downsample_push_constant.pixel_size[1] = 1.0 / full_screen_size.y; ss_effects.downsample_push_constant.radius_sq = 1.0; - RID shader = ss_effects.downsample_shader.version_get_shader(ss_effects.downsample_shader_version, downsample_mode); RID default_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED); - RD::Uniform u_depth_buffer(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_depth_buffer })); - RD::Uniform u_depth_mipmaps(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_depth_mipmaps[depth_index + 0] })); + RID depth_texture = p_render_buffers->get_depth_texture(p_view); + RID depth_mipmap = p_render_buffers->get_texture_slice(RB_SCOPE_SSDS, RB_LINEAR_DEPTH, p_view * 4, depth_index, 4, 1); + + RD::Uniform u_depth_buffer(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, depth_texture })); + RD::Uniform u_depth_mipmap(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ depth_mipmap })); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ss_effects.pipelines[downsample_mode]); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_depth_buffer), 0); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_depth_mipmaps), 1); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_depth_mipmap), 1); if (use_mips) { - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, ss_effects.downsample_uniform_set, 2); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, downsample_uniform_set, 2); } RD::get_singleton()->compute_list_set_push_constant(compute_list, &ss_effects.downsample_push_constant, sizeof(SSEffectsDownsamplePushConstant)); - Size2i size(MAX(1, p_full_screen_size.x >> (use_half_size ? 2 : 1)), MAX(1, p_full_screen_size.y >> (use_half_size ? 2 : 1))); + if (use_half_size) { + size.x = MAX(1, size.x >> 1); + size.y = MAX(1, size.y >> 1); + } RD::get_singleton()->compute_list_dispatch_threads(compute_list, size.x, size.y, 1); RD::get_singleton()->compute_list_add_barrier(compute_list); @@ -543,7 +544,7 @@ void SSEffects::ssil_set_quality(RS::EnvironmentSSILQuality p_quality, bool p_ha ssil_fadeout_to = p_fadeout_to; } -void SSEffects::gather_ssil(RD::ComputeListID p_compute_list, const Vector<RID> p_ssil_slices, const Vector<RID> p_edges_slices, const SSILSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set, RID p_projection_uniform_set) { +void SSEffects::gather_ssil(RD::ComputeListID p_compute_list, const RID *p_ssil_slices, const RID *p_edges_slices, const SSILSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set, RID p_projection_uniform_set) { UniformSetCacheRD *uniform_set_cache = UniformSetCacheRD::get_singleton(); ERR_FAIL_NULL(uniform_set_cache); @@ -578,12 +579,13 @@ void SSEffects::gather_ssil(RD::ComputeListID p_compute_list, const Vector<RID> RD::get_singleton()->compute_list_add_barrier(p_compute_list); } -void SSEffects::ssil_allocate_buffers(SSILRenderBuffers &p_ssil_buffers, const SSILSettings &p_settings, RID p_linear_depth) { +void SSEffects::ssil_allocate_buffers(Ref<RenderSceneBuffersRD> p_render_buffers, SSILRenderBuffers &p_ssil_buffers, const SSILSettings &p_settings) { if (p_ssil_buffers.half_size != ssil_half_size) { - ssil_free(p_ssil_buffers); + p_render_buffers->clear_context(RB_SCOPE_SSIL); } - if (ssil_half_size) { + p_ssil_buffers.half_size = ssil_half_size; + if (p_ssil_buffers.half_size) { p_ssil_buffers.buffer_width = (p_settings.full_screen_size.x + 3) / 4; p_ssil_buffers.buffer_height = (p_settings.full_screen_size.y + 3) / 4; p_ssil_buffers.half_buffer_width = (p_settings.full_screen_size.x + 7) / 8; @@ -595,104 +597,59 @@ void SSEffects::ssil_allocate_buffers(SSILRenderBuffers &p_ssil_buffers, const S p_ssil_buffers.half_buffer_height = (p_settings.full_screen_size.y + 3) / 4; } - if (p_ssil_buffers.ssil_final.is_null()) { - { - p_ssil_buffers.depth_texture_view = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_linear_depth, 0, ssil_half_size ? 1 : 0, 4, RD::TEXTURE_SLICE_2D_ARRAY); - } - { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT; - tf.width = p_settings.full_screen_size.x; - tf.height = p_settings.full_screen_size.y; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_CAN_COPY_TO_BIT; - p_ssil_buffers.ssil_final = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssil_buffers.ssil_final, "SSIL texture"); - RD::get_singleton()->texture_clear(p_ssil_buffers.ssil_final, Color(0, 0, 0, 0), 0, 1, 0, 1); - if (p_ssil_buffers.last_frame.is_null()) { - tf.mipmaps = 6; - p_ssil_buffers.last_frame = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssil_buffers.last_frame, "Last Frame Radiance"); - RD::get_singleton()->texture_clear(p_ssil_buffers.last_frame, Color(0, 0, 0, 0), 0, tf.mipmaps, 0, 1); - for (uint32_t i = 0; i < 6; i++) { - RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_ssil_buffers.last_frame, 0, i); - p_ssil_buffers.last_frame_slices.push_back(slice); - RD::get_singleton()->set_resource_name(slice, "Last Frame Radiance Mip " + itos(i) + " "); - } - } - } - { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT; - tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY; - tf.width = p_ssil_buffers.buffer_width; - tf.height = p_ssil_buffers.buffer_height; - tf.array_layers = 4; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; - p_ssil_buffers.deinterleaved = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssil_buffers.deinterleaved, "SSIL deinterleaved buffer"); - for (uint32_t i = 0; i < 4; i++) { - RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_ssil_buffers.deinterleaved, i, 0); - p_ssil_buffers.deinterleaved_slices.push_back(slice); - RD::get_singleton()->set_resource_name(slice, "SSIL deinterleaved buffer array " + itos(i) + " "); - } - } + uint32_t view_count = p_render_buffers->get_view_count(); + Size2i full_size = Size2i(p_ssil_buffers.buffer_width, p_ssil_buffers.buffer_height); + Size2i half_size = Size2i(p_ssil_buffers.half_buffer_width, p_ssil_buffers.half_buffer_height); - { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT; - tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY; - tf.width = p_ssil_buffers.buffer_width; - tf.height = p_ssil_buffers.buffer_height; - tf.array_layers = 4; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; - p_ssil_buffers.pong = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssil_buffers.pong, "SSIL deinterleaved pong buffer"); - for (uint32_t i = 0; i < 4; i++) { - RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_ssil_buffers.pong, i, 0); - p_ssil_buffers.pong_slices.push_back(slice); - RD::get_singleton()->set_resource_name(slice, "SSIL deinterleaved buffer pong array " + itos(i) + " "); - } - } + // We create our intermediate and final results as render buffers. + // These are automatically cached and cleaned up when our viewport resizes + // or when our viewport gets destroyed. - { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R8_UNORM; - tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY; - tf.width = p_ssil_buffers.buffer_width; - tf.height = p_ssil_buffers.buffer_height; - tf.array_layers = 4; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; - p_ssil_buffers.edges = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssil_buffers.edges, "SSIL edges buffer"); - for (uint32_t i = 0; i < 4; i++) { - RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_ssil_buffers.edges, i, 0); - p_ssil_buffers.edges_slices.push_back(slice); - RD::get_singleton()->set_resource_name(slice, "SSIL edges buffer slice " + itos(i) + " "); - } - } + if (!p_render_buffers->has_texture(RB_SCOPE_SSIL, RB_FINAL)) { // We don't strictly have to check if it exists but we only want to clear it when we create it... + RID final = p_render_buffers->create_texture(RB_SCOPE_SSIL, RB_FINAL, RD::DATA_FORMAT_R16G16B16A16_SFLOAT, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_CAN_COPY_TO_BIT); + RD::get_singleton()->texture_clear(final, Color(0, 0, 0, 0), 0, 1, 0, view_count); + } - { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R8_UNORM; - tf.width = p_ssil_buffers.half_buffer_width; - tf.height = p_ssil_buffers.half_buffer_height; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; - p_ssil_buffers.importance_map[0] = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssil_buffers.importance_map[0], "SSIL Importance Map"); - p_ssil_buffers.importance_map[1] = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssil_buffers.importance_map[1], "SSIL Importance Map Pong"); - } - p_ssil_buffers.half_size = ssil_half_size; + if (!p_render_buffers->has_texture(RB_SCOPE_SSIL, RB_LAST_FRAME)) { + RID last_frame = p_render_buffers->create_texture(RB_SCOPE_SSIL, RB_LAST_FRAME, RD::DATA_FORMAT_R16G16B16A16_SFLOAT, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_CAN_COPY_TO_BIT, RD::TEXTURE_SAMPLES_1, p_settings.full_screen_size, 0, 6); + RD::get_singleton()->texture_clear(last_frame, Color(0, 0, 0, 0), 0, 6, 0, view_count); } + + // As we're not clearing these, and render buffers will return the cached texture if it already exists, + // we don't first check has_texture here + + p_render_buffers->create_texture(RB_SCOPE_SSIL, RB_DEINTERLEAVED, RD::DATA_FORMAT_R16G16B16A16_SFLOAT, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, full_size, 4 * view_count); + p_render_buffers->create_texture(RB_SCOPE_SSIL, RB_DEINTERLEAVED_PONG, RD::DATA_FORMAT_R16G16B16A16_SFLOAT, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, full_size, 4 * view_count); + p_render_buffers->create_texture(RB_SCOPE_SSIL, RB_EDGES, RD::DATA_FORMAT_R8_UNORM, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, full_size, 4 * view_count); + p_render_buffers->create_texture(RB_SCOPE_SSIL, RB_IMPORTANCE_MAP, RD::DATA_FORMAT_R8_UNORM, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, half_size); + p_render_buffers->create_texture(RB_SCOPE_SSIL, RB_IMPORTANCE_PONG, RD::DATA_FORMAT_R8_UNORM, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, half_size); } -void SSEffects::screen_space_indirect_lighting(SSILRenderBuffers &p_ssil_buffers, RID p_normal_buffer, const Projection &p_projection, const Projection &p_last_projection, const SSILSettings &p_settings) { +void SSEffects::screen_space_indirect_lighting(Ref<RenderSceneBuffersRD> p_render_buffers, SSILRenderBuffers &p_ssil_buffers, uint32_t p_view, RID p_normal_buffer, const Projection &p_projection, const Projection &p_last_projection, const SSILSettings &p_settings) { UniformSetCacheRD *uniform_set_cache = UniformSetCacheRD::get_singleton(); ERR_FAIL_NULL(uniform_set_cache); MaterialStorage *material_storage = MaterialStorage::get_singleton(); ERR_FAIL_NULL(material_storage); RD::get_singleton()->draw_command_begin_label("Process Screen Space Indirect Lighting"); + + // Obtain our (cached) buffer slices for the view we are rendering. + RID last_frame = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_LAST_FRAME, p_view, 0, 1, 6); + RID deinterleaved = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_DEINTERLEAVED, p_view * 4, 0, 4, 1); + RID deinterleaved_pong = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_DEINTERLEAVED_PONG, 4 * p_view, 0, 4, 1); + RID edges = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_EDGES, 4 * p_view, 0, 4, 1); + RID importance_map = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_IMPORTANCE_MAP, p_view, 0); + RID importance_pong = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_IMPORTANCE_PONG, p_view, 0); + + RID deinterleaved_slices[4]; + RID deinterleaved_pong_slices[4]; + RID edges_slices[4]; + for (uint32_t i = 0; i < 4; i++) { + deinterleaved_slices[i] = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_DEINTERLEAVED, p_view * 4 + i, 0); + deinterleaved_pong_slices[i] = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_DEINTERLEAVED_PONG, p_view * 4 + i, 0); + edges_slices[i] = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_EDGES, p_view * 4 + i, 0); + } + //Store projection info before starting the compute list SSILProjectionUniforms projection_uniforms; store_camera(p_last_projection, projection_uniforms.inv_last_frame_projection_matrix); @@ -701,7 +658,7 @@ void SSEffects::screen_space_indirect_lighting(SSILRenderBuffers &p_ssil_buffers memset(&ssil.gather_push_constant, 0, sizeof(SSILGatherPushConstant)); - RID shader = ssil.gather_shader.version_get_shader(ssil.gather_shader_version, 0); + RID shader = ssil.gather_shader.version_get_shader(ssil.gather_shader_version, SSIL_GATHER); RID default_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED); RID default_mipmap_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED); @@ -749,78 +706,69 @@ void SSEffects::screen_space_indirect_lighting(SSILRenderBuffers &p_ssil_buffers ssil.gather_push_constant.quality = MAX(0, ssil_quality - 1); ssil.gather_push_constant.size_multiplier = ssil_half_size ? 2 : 1; - if (p_ssil_buffers.projection_uniform_set.is_null()) { - Vector<RD::Uniform> uniforms; - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE; - u.binding = 0; - u.append_id(default_mipmap_sampler); - u.append_id(p_ssil_buffers.last_frame); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_UNIFORM_BUFFER; - u.binding = 1; - u.append_id(ssil.projection_uniform_buffer); - uniforms.push_back(u); - } - p_ssil_buffers.projection_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssil.gather_shader.version_get_shader(ssil.gather_shader_version, 0), 3); + // We are using our uniform cache so our uniform sets are automatically freed when our textures are freed. + // It also ensures that we're reusing the right cached entry in a multiview situation without us having to + // remember each instance of the uniform set. + + RID projection_uniform_set; + { + RD::Uniform u_last_frame; + u_last_frame.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE; + u_last_frame.binding = 0; + u_last_frame.append_id(default_mipmap_sampler); + u_last_frame.append_id(last_frame); + + RD::Uniform u_projection; + u_projection.uniform_type = RD::UNIFORM_TYPE_UNIFORM_BUFFER; + u_projection.binding = 1; + u_projection.append_id(ssil.projection_uniform_buffer); + + projection_uniform_set = uniform_set_cache->get_cache(shader, 3, u_last_frame, u_projection); } - if (p_ssil_buffers.gather_uniform_set.is_null()) { - Vector<RD::Uniform> uniforms; - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE; - u.binding = 0; - u.append_id(default_sampler); - u.append_id(p_ssil_buffers.depth_texture_view); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_IMAGE; - u.binding = 1; - u.append_id(p_normal_buffer); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_UNIFORM_BUFFER; - u.binding = 2; - u.append_id(ss_effects.gather_constants_buffer); - uniforms.push_back(u); - } - p_ssil_buffers.gather_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssil.gather_shader.version_get_shader(ssil.gather_shader_version, 0), 0); + RID gather_uniform_set; + { + RID depth_texture_view = p_render_buffers->get_texture_slice(RB_SCOPE_SSDS, RB_LINEAR_DEPTH, p_view * 4, ssil_half_size ? 1 : 0, 4, 4); + + RD::Uniform u_depth_texture_view; + u_depth_texture_view.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE; + u_depth_texture_view.binding = 0; + u_depth_texture_view.append_id(default_sampler); + u_depth_texture_view.append_id(depth_texture_view); + + RD::Uniform u_normal_buffer; + u_normal_buffer.uniform_type = RD::UNIFORM_TYPE_IMAGE; + u_normal_buffer.binding = 1; + u_normal_buffer.append_id(p_normal_buffer); + + RD::Uniform u_gather_constants_buffer; + u_gather_constants_buffer.uniform_type = RD::UNIFORM_TYPE_UNIFORM_BUFFER; + u_gather_constants_buffer.binding = 2; + u_gather_constants_buffer.append_id(ss_effects.gather_constants_buffer); + + gather_uniform_set = uniform_set_cache->get_cache(shader, 0, u_depth_texture_view, u_normal_buffer, u_gather_constants_buffer); } - if (p_ssil_buffers.importance_map_uniform_set.is_null()) { - Vector<RD::Uniform> uniforms; - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_IMAGE; - u.binding = 0; - u.append_id(p_ssil_buffers.pong); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE; - u.binding = 1; - u.append_id(default_sampler); - u.append_id(p_ssil_buffers.importance_map[0]); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER; - u.binding = 2; - u.append_id(ssil.importance_map_load_counter); - uniforms.push_back(u); - } - p_ssil_buffers.importance_map_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssil.gather_shader.version_get_shader(ssil.gather_shader_version, 2), 1); + RID importance_map_uniform_set; + { + RD::Uniform u_pong; + u_pong.uniform_type = RD::UNIFORM_TYPE_IMAGE; + u_pong.binding = 0; + u_pong.append_id(deinterleaved_pong); + + RD::Uniform u_importance_map; + u_importance_map.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE; + u_importance_map.binding = 1; + u_importance_map.append_id(default_sampler); + u_importance_map.append_id(importance_map); + + RD::Uniform u_load_counter; + u_load_counter.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER; + u_load_counter.binding = 2; + u_load_counter.append_id(ssil.importance_map_load_counter); + + RID shader_adaptive = ssil.gather_shader.version_get_shader(ssil.gather_shader_version, SSIL_GATHER_ADAPTIVE); + importance_map_uniform_set = uniform_set_cache->get_cache(shader_adaptive, 1, u_pong, u_importance_map, u_load_counter); } if (ssil_quality == RS::ENV_SSIL_QUALITY_ULTRA) { @@ -828,38 +776,42 @@ void SSEffects::screen_space_indirect_lighting(SSILRenderBuffers &p_ssil_buffers ssil.importance_map_push_constant.half_screen_pixel_size[0] = 1.0 / p_ssil_buffers.buffer_width; ssil.importance_map_push_constant.half_screen_pixel_size[1] = 1.0 / p_ssil_buffers.buffer_height; ssil.importance_map_push_constant.intensity = p_settings.intensity * Math_PI; + //base pass RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssil.pipelines[SSIL_GATHER_BASE]); - gather_ssil(compute_list, p_ssil_buffers.pong_slices, p_ssil_buffers.edges_slices, p_settings, true, p_ssil_buffers.gather_uniform_set, p_ssil_buffers.importance_map_uniform_set, p_ssil_buffers.projection_uniform_set); + gather_ssil(compute_list, deinterleaved_pong_slices, edges_slices, p_settings, true, gather_uniform_set, importance_map_uniform_set, projection_uniform_set); //generate importance map - RD::Uniform u_ssil_pong_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssil_buffers.pong })); - RD::Uniform u_importance_map(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssil_buffers.importance_map[0] })); + RID gen_imp_shader = ssil.importance_map_shader.version_get_shader(ssil.importance_map_shader_version, 0); + RD::Uniform u_ssil_pong_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, deinterleaved_pong })); + RD::Uniform u_importance_map(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ importance_map })); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssil.pipelines[SSIL_GENERATE_IMPORTANCE_MAP]); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_ssil_pong_with_sampler), 0); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_importance_map), 1); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(gen_imp_shader, 0, u_ssil_pong_with_sampler), 0); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(gen_imp_shader, 1, u_importance_map), 1); RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssil.importance_map_push_constant, sizeof(SSILImportanceMapPushConstant)); RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssil_buffers.half_buffer_width, p_ssil_buffers.half_buffer_height, 1); RD::get_singleton()->compute_list_add_barrier(compute_list); // process Importance Map A - RD::Uniform u_importance_map_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssil_buffers.importance_map[0] })); - RD::Uniform u_importance_map_pong(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssil_buffers.importance_map[1] })); + RID proc_imp_shader_a = ssil.importance_map_shader.version_get_shader(ssil.importance_map_shader_version, 1); + RD::Uniform u_importance_map_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, importance_map })); + RD::Uniform u_importance_map_pong(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ importance_pong })); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssil.pipelines[SSIL_PROCESS_IMPORTANCE_MAPA]); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_importance_map_with_sampler), 0); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_importance_map_pong), 1); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(proc_imp_shader_a, 0, u_importance_map_with_sampler), 0); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(proc_imp_shader_a, 1, u_importance_map_pong), 1); RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssil.importance_map_push_constant, sizeof(SSILImportanceMapPushConstant)); RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssil_buffers.half_buffer_width, p_ssil_buffers.half_buffer_height, 1); RD::get_singleton()->compute_list_add_barrier(compute_list); // process Importance Map B - RD::Uniform u_importance_map_pong_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssil_buffers.importance_map[1] })); + RID proc_imp_shader_b = ssil.importance_map_shader.version_get_shader(ssil.importance_map_shader_version, 2); + RD::Uniform u_importance_map_pong_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, importance_pong })); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssil.pipelines[SSIL_PROCESS_IMPORTANCE_MAPB]); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_importance_map_pong_with_sampler), 0); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_importance_map), 1); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(proc_imp_shader_b, 0, u_importance_map_pong_with_sampler), 0); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(proc_imp_shader_b, 1, u_importance_map), 1); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, ssil.counter_uniform_set, 2); RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssil.importance_map_push_constant, sizeof(SSILImportanceMapPushConstant)); RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssil_buffers.half_buffer_width, p_ssil_buffers.half_buffer_height, 1); @@ -872,7 +824,7 @@ void SSEffects::screen_space_indirect_lighting(SSILRenderBuffers &p_ssil_buffers RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssil.pipelines[SSIL_GATHER]); } - gather_ssil(compute_list, p_ssil_buffers.deinterleaved_slices, p_ssil_buffers.edges_slices, p_settings, false, p_ssil_buffers.gather_uniform_set, p_ssil_buffers.importance_map_uniform_set, p_ssil_buffers.projection_uniform_set); + gather_ssil(compute_list, deinterleaved_slices, edges_slices, p_settings, false, gather_uniform_set, importance_map_uniform_set, projection_uniform_set); RD::get_singleton()->draw_command_end_label(); //Gather } @@ -895,6 +847,8 @@ void SSEffects::screen_space_indirect_lighting(SSILRenderBuffers &p_ssil_buffers } } + RID blur_shader = ssil.blur_shader.version_get_shader(ssil.blur_shader_version, blur_pipeline - SSIL_BLUR_PASS); + for (int i = 0; i < 4; i++) { if ((ssil_quality == RS::ENV_SSIL_QUALITY_VERY_LOW) && ((i == 1) || (i == 2))) { continue; @@ -903,30 +857,30 @@ void SSEffects::screen_space_indirect_lighting(SSILRenderBuffers &p_ssil_buffers RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssil.pipelines[blur_pipeline]); if (pass % 2 == 0) { if (ssil_quality == RS::ENV_SSIL_QUALITY_VERY_LOW) { - RD::Uniform u_ssil_slice(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssil_buffers.deinterleaved_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_ssil_slice), 0); + RD::Uniform u_ssil_slice(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, deinterleaved_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 0, u_ssil_slice), 0); } else { - RD::Uniform u_ssil_slice(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ ss_effects.mirror_sampler, p_ssil_buffers.deinterleaved_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_ssil_slice), 0); + RD::Uniform u_ssil_slice(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ ss_effects.mirror_sampler, deinterleaved_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 0, u_ssil_slice), 0); } - RD::Uniform u_ssil_pong_slice(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssil_buffers.pong_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_ssil_pong_slice), 1); + RD::Uniform u_ssil_pong_slice(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ deinterleaved_pong_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 1, u_ssil_pong_slice), 1); } else { if (ssil_quality == RS::ENV_SSIL_QUALITY_VERY_LOW) { - RD::Uniform u_ssil_pong_slice(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssil_buffers.pong_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_ssil_pong_slice), 0); + RD::Uniform u_ssil_pong_slice(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, deinterleaved_pong_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 0, u_ssil_pong_slice), 0); } else { - RD::Uniform u_ssil_pong_slice(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ ss_effects.mirror_sampler, p_ssil_buffers.pong_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_ssil_pong_slice), 0); + RD::Uniform u_ssil_pong_slice(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ ss_effects.mirror_sampler, deinterleaved_pong_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 0, u_ssil_pong_slice), 0); } - RD::Uniform u_ssil_slice(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssil_buffers.deinterleaved_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_ssil_slice), 1); + RD::Uniform u_ssil_slice(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ deinterleaved_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 1, u_ssil_slice), 1); } - RD::Uniform u_edges_slice(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssil_buffers.edges_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 2, u_edges_slice), 2); + RD::Uniform u_edges_slice(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ edges_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 2, u_edges_slice), 2); RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssil.blur_push_constant, sizeof(SSILBlurPushConstant)); @@ -961,18 +915,19 @@ void SSEffects::screen_space_indirect_lighting(SSILRenderBuffers &p_ssil_buffers RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssil.pipelines[interleave_pipeline]); - RD::Uniform u_destination(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssil_buffers.ssil_final })); + RID final = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_FINAL, p_view, 0); + RD::Uniform u_destination(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ final })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_destination), 0); if (ssil_quality > RS::ENV_SSIL_QUALITY_VERY_LOW && ssil_blur_passes % 2 == 0) { - RD::Uniform u_ssil(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssil_buffers.deinterleaved })); + RD::Uniform u_ssil(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, deinterleaved })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_ssil), 1); } else { - RD::Uniform u_ssil_pong(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssil_buffers.pong })); + RD::Uniform u_ssil_pong(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, deinterleaved_pong })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_ssil_pong), 1); } - RD::Uniform u_edges(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssil_buffers.edges })); + RD::Uniform u_edges(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ edges })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 2, u_edges), 2); RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssil.interleave_push_constant, sizeof(SSILInterleavePushConstant)); @@ -990,34 +945,6 @@ void SSEffects::screen_space_indirect_lighting(SSILRenderBuffers &p_ssil_buffers RD::get_singleton()->buffer_update(ssil.importance_map_load_counter, 0, sizeof(uint32_t), &zero, 0); //no barrier } -void SSEffects::ssil_free(SSILRenderBuffers &p_ssil_buffers) { - if (p_ssil_buffers.ssil_final.is_valid()) { - RD::get_singleton()->free(p_ssil_buffers.ssil_final); - RD::get_singleton()->free(p_ssil_buffers.deinterleaved); - RD::get_singleton()->free(p_ssil_buffers.pong); - RD::get_singleton()->free(p_ssil_buffers.edges); - RD::get_singleton()->free(p_ssil_buffers.importance_map[0]); - RD::get_singleton()->free(p_ssil_buffers.importance_map[1]); - RD::get_singleton()->free(p_ssil_buffers.last_frame); - - p_ssil_buffers.ssil_final = RID(); - p_ssil_buffers.deinterleaved = RID(); - p_ssil_buffers.pong = RID(); - p_ssil_buffers.edges = RID(); - p_ssil_buffers.deinterleaved_slices.clear(); - p_ssil_buffers.pong_slices.clear(); - p_ssil_buffers.edges_slices.clear(); - p_ssil_buffers.importance_map[0] = RID(); - p_ssil_buffers.importance_map[1] = RID(); - p_ssil_buffers.last_frame = RID(); - p_ssil_buffers.last_frame_slices.clear(); - - p_ssil_buffers.gather_uniform_set = RID(); - p_ssil_buffers.importance_map_uniform_set = RID(); - p_ssil_buffers.projection_uniform_set = RID(); - } -} - /* SSAO */ void SSEffects::ssao_set_quality(RS::EnvironmentSSAOQuality p_quality, bool p_half_size, float p_adaptive_target, int p_blur_passes, float p_fadeout_from, float p_fadeout_to) { @@ -1029,13 +956,13 @@ void SSEffects::ssao_set_quality(RS::EnvironmentSSAOQuality p_quality, bool p_ha ssao_fadeout_to = p_fadeout_to; } -void SSEffects::gather_ssao(RD::ComputeListID p_compute_list, const Vector<RID> p_ao_slices, const SSAOSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set) { +void SSEffects::gather_ssao(RD::ComputeListID p_compute_list, const RID *p_ao_slices, const SSAOSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set) { UniformSetCacheRD *uniform_set_cache = UniformSetCacheRD::get_singleton(); ERR_FAIL_NULL(uniform_set_cache); RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, p_gather_uniform_set, 0); if ((ssao_quality == RS::ENV_SSAO_QUALITY_ULTRA) && !p_adaptive_base_pass) { - RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, p_importance_map_uniform_set, 0); + RD::get_singleton()->compute_list_bind_uniform_set(p_compute_list, p_importance_map_uniform_set, 1); } RID shader = ssao.gather_shader.version_get_shader(ssao.gather_shader_version, 1); // @@ -1062,11 +989,12 @@ void SSEffects::gather_ssao(RD::ComputeListID p_compute_list, const Vector<RID> RD::get_singleton()->compute_list_add_barrier(p_compute_list); } -void SSEffects::ssao_allocate_buffers(SSAORenderBuffers &p_ssao_buffers, const SSAOSettings &p_settings, RID p_linear_depth) { +void SSEffects::ssao_allocate_buffers(Ref<RenderSceneBuffersRD> p_render_buffers, SSAORenderBuffers &p_ssao_buffers, const SSAOSettings &p_settings) { if (p_ssao_buffers.half_size != ssao_half_size) { - ssao_free(p_ssao_buffers); + p_render_buffers->clear_context(RB_SCOPE_SSAO); } + p_ssao_buffers.half_size = ssao_half_size; if (ssao_half_size) { p_ssao_buffers.buffer_width = (p_settings.full_screen_size.x + 3) / 4; p_ssao_buffers.buffer_height = (p_settings.full_screen_size.y + 3) / 4; @@ -1079,79 +1007,45 @@ void SSEffects::ssao_allocate_buffers(SSAORenderBuffers &p_ssao_buffers, const S p_ssao_buffers.half_buffer_height = (p_settings.full_screen_size.y + 3) / 4; } - if (p_ssao_buffers.ao_deinterleaved.is_null()) { - { - p_ssao_buffers.depth_texture_view = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_linear_depth, 0, ssao_half_size ? 1 : 0, 4, RD::TEXTURE_SLICE_2D_ARRAY); - } - { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R8G8_UNORM; - tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY; - tf.width = p_ssao_buffers.buffer_width; - tf.height = p_ssao_buffers.buffer_height; - tf.array_layers = 4; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; - p_ssao_buffers.ao_deinterleaved = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssao_buffers.ao_deinterleaved, "SSAO De-interleaved Array"); - for (uint32_t i = 0; i < 4; i++) { - RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_ssao_buffers.ao_deinterleaved, i, 0); - p_ssao_buffers.ao_deinterleaved_slices.push_back(slice); - RD::get_singleton()->set_resource_name(slice, "SSAO De-interleaved Array Layer " + itos(i) + " "); - } - } + uint32_t view_count = p_render_buffers->get_view_count(); + Size2i full_size = Size2i(p_ssao_buffers.buffer_width, p_ssao_buffers.buffer_height); + Size2i half_size = Size2i(p_ssao_buffers.half_buffer_width, p_ssao_buffers.half_buffer_height); - { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R8G8_UNORM; - tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY; - tf.width = p_ssao_buffers.buffer_width; - tf.height = p_ssao_buffers.buffer_height; - tf.array_layers = 4; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; - p_ssao_buffers.ao_pong = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssao_buffers.ao_pong, "SSAO De-interleaved Array Pong"); - for (uint32_t i = 0; i < 4; i++) { - RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_ssao_buffers.ao_pong, i, 0); - p_ssao_buffers.ao_pong_slices.push_back(slice); - RD::get_singleton()->set_resource_name(slice, "SSAO De-interleaved Array Layer " + itos(i) + " Pong"); - } - } + // As we're not clearing these, and render buffers will return the cached texture if it already exists, + // we don't first check has_texture here - { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R8_UNORM; - tf.width = p_ssao_buffers.buffer_width; - tf.height = p_ssao_buffers.buffer_height; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; - p_ssao_buffers.importance_map[0] = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssao_buffers.importance_map[0], "SSAO Importance Map"); - p_ssao_buffers.importance_map[1] = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssao_buffers.importance_map[1], "SSAO Importance Map Pong"); - } - { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R8_UNORM; - tf.width = p_settings.full_screen_size.x; - tf.height = p_settings.full_screen_size.y; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; - p_ssao_buffers.ao_final = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssao_buffers.ao_final, "SSAO Final"); - } - p_ssao_buffers.half_size = ssao_half_size; - } + p_render_buffers->create_texture(RB_SCOPE_SSAO, RB_DEINTERLEAVED, RD::DATA_FORMAT_R8G8_UNORM, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, full_size, 4 * view_count); + p_render_buffers->create_texture(RB_SCOPE_SSAO, RB_DEINTERLEAVED_PONG, RD::DATA_FORMAT_R8G8_UNORM, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, full_size, 4 * view_count); + p_render_buffers->create_texture(RB_SCOPE_SSAO, RB_IMPORTANCE_MAP, RD::DATA_FORMAT_R8_UNORM, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, half_size); + p_render_buffers->create_texture(RB_SCOPE_SSAO, RB_IMPORTANCE_PONG, RD::DATA_FORMAT_R8_UNORM, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, half_size); + p_render_buffers->create_texture(RB_SCOPE_SSAO, RB_FINAL, RD::DATA_FORMAT_R8_UNORM, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1); } -void SSEffects::generate_ssao(SSAORenderBuffers &p_ssao_buffers, RID p_normal_buffer, const Projection &p_projection, const SSAOSettings &p_settings) { +void SSEffects::generate_ssao(Ref<RenderSceneBuffersRD> p_render_buffers, SSAORenderBuffers &p_ssao_buffers, uint32_t p_view, RID p_normal_buffer, const Projection &p_projection, const SSAOSettings &p_settings) { UniformSetCacheRD *uniform_set_cache = UniformSetCacheRD::get_singleton(); ERR_FAIL_NULL(uniform_set_cache); MaterialStorage *material_storage = MaterialStorage::get_singleton(); ERR_FAIL_NULL(material_storage); + // Obtain our (cached) buffer slices for the view we are rendering. + RID ao_deinterleaved = p_render_buffers->get_texture_slice(RB_SCOPE_SSAO, RB_DEINTERLEAVED, p_view * 4, 0, 4, 1); + RID ao_pong = p_render_buffers->get_texture_slice(RB_SCOPE_SSAO, RB_DEINTERLEAVED_PONG, p_view * 4, 0, 4, 1); + RID importance_map = p_render_buffers->get_texture_slice(RB_SCOPE_SSAO, RB_IMPORTANCE_MAP, p_view, 0); + RID importance_pong = p_render_buffers->get_texture_slice(RB_SCOPE_SSAO, RB_IMPORTANCE_PONG, p_view, 0); + RID ao_final = p_render_buffers->get_texture_slice(RB_SCOPE_SSAO, RB_FINAL, p_view, 0); + + RID ao_deinterleaved_slices[4]; + RID ao_pong_slices[4]; + for (uint32_t i = 0; i < 4; i++) { + ao_deinterleaved_slices[i] = p_render_buffers->get_texture_slice(RB_SCOPE_SSAO, RB_DEINTERLEAVED, p_view * 4 + i, 0); + ao_pong_slices[i] = p_render_buffers->get_texture_slice(RB_SCOPE_SSAO, RB_DEINTERLEAVED_PONG, p_view * 4 + i, 0); + } + RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin(); memset(&ssao.gather_push_constant, 0, sizeof(SSAOGatherPushConstant)); /* FIRST PASS */ - RID shader = ssao.gather_shader.version_get_shader(ssao.gather_shader_version, 0); + RID shader = ssao.gather_shader.version_get_shader(ssao.gather_shader_version, SSAO_GATHER); RID default_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED); RD::get_singleton()->draw_command_begin_label("Process Screen Space Ambient Occlusion"); @@ -1201,60 +1095,52 @@ void SSEffects::generate_ssao(SSAORenderBuffers &p_ssao_buffers, RID p_normal_bu ssao.gather_push_constant.quality = MAX(0, ssao_quality - 1); ssao.gather_push_constant.size_multiplier = ssao_half_size ? 2 : 1; - if (p_ssao_buffers.gather_uniform_set.is_null()) { - Vector<RD::Uniform> uniforms; - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE; - u.binding = 0; - u.append_id(default_sampler); - u.append_id(p_ssao_buffers.depth_texture_view); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_IMAGE; - u.binding = 1; - u.append_id(p_normal_buffer); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_UNIFORM_BUFFER; - u.binding = 2; - u.append_id(ss_effects.gather_constants_buffer); - uniforms.push_back(u); - } - p_ssao_buffers.gather_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, shader, 0); - RD::get_singleton()->set_resource_name(p_ssao_buffers.gather_uniform_set, "SSAO Gather Uniform Set"); + // We are using our uniform cache so our uniform sets are automatically freed when our textures are freed. + // It also ensures that we're reusing the right cached entry in a multiview situation without us having to + // remember each instance of the uniform set. + RID gather_uniform_set; + { + RID depth_texture_view = p_render_buffers->get_texture_slice(RB_SCOPE_SSDS, RB_LINEAR_DEPTH, p_view * 4, ssao_half_size ? 1 : 0, 4, 4); + + RD::Uniform u_depth_texture_view; + u_depth_texture_view.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE; + u_depth_texture_view.binding = 0; + u_depth_texture_view.append_id(default_sampler); + u_depth_texture_view.append_id(depth_texture_view); + + RD::Uniform u_normal_buffer; + u_normal_buffer.uniform_type = RD::UNIFORM_TYPE_IMAGE; + u_normal_buffer.binding = 1; + u_normal_buffer.append_id(p_normal_buffer); + + RD::Uniform u_gather_constants_buffer; + u_gather_constants_buffer.uniform_type = RD::UNIFORM_TYPE_UNIFORM_BUFFER; + u_gather_constants_buffer.binding = 2; + u_gather_constants_buffer.append_id(ss_effects.gather_constants_buffer); + + gather_uniform_set = uniform_set_cache->get_cache(shader, 0, u_depth_texture_view, u_normal_buffer, u_gather_constants_buffer); } - if (p_ssao_buffers.importance_map_uniform_set.is_null()) { - Vector<RD::Uniform> uniforms; - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_IMAGE; - u.binding = 0; - u.append_id(p_ssao_buffers.ao_pong); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE; - u.binding = 1; - u.append_id(default_sampler); - u.append_id(p_ssao_buffers.importance_map[0]); - uniforms.push_back(u); - } - { - RD::Uniform u; - u.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER; - u.binding = 2; - u.append_id(ssao.importance_map_load_counter); - uniforms.push_back(u); - } - p_ssao_buffers.importance_map_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, ssao.gather_shader.version_get_shader(ssao.gather_shader_version, 2), 1); - RD::get_singleton()->set_resource_name(p_ssao_buffers.importance_map_uniform_set, "SSAO Importance Map Uniform Set"); + RID importance_map_uniform_set; + { + RD::Uniform u_pong; + u_pong.uniform_type = RD::UNIFORM_TYPE_IMAGE; + u_pong.binding = 0; + u_pong.append_id(ao_pong); + + RD::Uniform u_importance_map; + u_importance_map.uniform_type = RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE; + u_importance_map.binding = 1; + u_importance_map.append_id(default_sampler); + u_importance_map.append_id(importance_map); + + RD::Uniform u_load_counter; + u_load_counter.uniform_type = RD::UNIFORM_TYPE_STORAGE_BUFFER; + u_load_counter.binding = 2; + u_load_counter.append_id(ssao.importance_map_load_counter); + + RID shader_adaptive = ssao.gather_shader.version_get_shader(ssao.gather_shader_version, SSAO_GATHER_ADAPTIVE); + importance_map_uniform_set = uniform_set_cache->get_cache(shader_adaptive, 1, u_pong, u_importance_map, u_load_counter); } if (ssao_quality == RS::ENV_SSAO_QUALITY_ULTRA) { @@ -1266,41 +1152,44 @@ void SSEffects::generate_ssao(SSAORenderBuffers &p_ssao_buffers, RID p_normal_bu //base pass RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_GATHER_BASE]); - gather_ssao(compute_list, p_ssao_buffers.ao_pong_slices, p_settings, true, p_ssao_buffers.gather_uniform_set, RID()); + gather_ssao(compute_list, ao_pong_slices, p_settings, true, gather_uniform_set, RID()); //generate importance map + RID gen_imp_shader = ssao.importance_map_shader.version_get_shader(ssao.importance_map_shader_version, 0); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_GENERATE_IMPORTANCE_MAP]); - RD::Uniform u_ao_pong_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssao_buffers.ao_pong })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_ao_pong_with_sampler), 0); + RD::Uniform u_ao_pong_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, ao_pong })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(gen_imp_shader, 0, u_ao_pong_with_sampler), 0); - RD::Uniform u_importance_map(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssao_buffers.importance_map[0] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_importance_map), 1); + RD::Uniform u_importance_map(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ importance_map })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(gen_imp_shader, 1, u_importance_map), 1); RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssao.importance_map_push_constant, sizeof(SSAOImportanceMapPushConstant)); RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssao_buffers.half_buffer_width, p_ssao_buffers.half_buffer_height, 1); RD::get_singleton()->compute_list_add_barrier(compute_list); //process importance map A + RID proc_imp_shader_a = ssao.importance_map_shader.version_get_shader(ssao.importance_map_shader_version, 1); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_PROCESS_IMPORTANCE_MAPA]); - RD::Uniform u_importance_map_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssao_buffers.importance_map[0] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_importance_map_with_sampler), 0); + RD::Uniform u_importance_map_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, importance_map })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(proc_imp_shader_a, 0, u_importance_map_with_sampler), 0); - RD::Uniform u_importance_map_pong(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssao_buffers.importance_map[1] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_importance_map_pong), 1); + RD::Uniform u_importance_map_pong(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ importance_pong })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(proc_imp_shader_a, 1, u_importance_map_pong), 1); RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssao.importance_map_push_constant, sizeof(SSAOImportanceMapPushConstant)); RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssao_buffers.half_buffer_width, p_ssao_buffers.half_buffer_height, 1); RD::get_singleton()->compute_list_add_barrier(compute_list); //process Importance Map B + RID proc_imp_shader_b = ssao.importance_map_shader.version_get_shader(ssao.importance_map_shader_version, 2); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_PROCESS_IMPORTANCE_MAPB]); - RD::Uniform u_importance_map_pong_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssao_buffers.importance_map[1] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_importance_map_pong_with_sampler), 0); + RD::Uniform u_importance_map_pong_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, importance_pong })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(proc_imp_shader_b, 0, u_importance_map_pong_with_sampler), 0); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_importance_map), 1); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(proc_imp_shader_b, 1, u_importance_map), 1); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, ssao.counter_uniform_set, 2); RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssao.importance_map_push_constant, sizeof(SSAOImportanceMapPushConstant)); RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssao_buffers.half_buffer_width, p_ssao_buffers.half_buffer_height, 1); @@ -1312,7 +1201,7 @@ void SSEffects::generate_ssao(SSAORenderBuffers &p_ssao_buffers, RID p_normal_bu RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[SSAO_GATHER]); } - gather_ssao(compute_list, p_ssao_buffers.ao_deinterleaved_slices, p_settings, false, p_ssao_buffers.gather_uniform_set, p_ssao_buffers.importance_map_uniform_set); + gather_ssao(compute_list, ao_deinterleaved_slices, p_settings, false, gather_uniform_set, importance_map_uniform_set); RD::get_singleton()->draw_command_end_label(); // Gather SSAO } @@ -1344,29 +1233,30 @@ void SSEffects::generate_ssao(SSAORenderBuffers &p_ssao_buffers, RID p_normal_bu continue; } + RID blur_shader = ssao.blur_shader.version_get_shader(ssao.blur_shader_version, blur_pipeline - SSAO_BLUR_PASS); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[blur_pipeline]); if (pass % 2 == 0) { if (ssao_quality == RS::ENV_SSAO_QUALITY_VERY_LOW) { - RD::Uniform u_ao_slices_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssao_buffers.ao_deinterleaved_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_ao_slices_with_sampler), 0); + RD::Uniform u_ao_slices_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, ao_deinterleaved_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 0, u_ao_slices_with_sampler), 0); } else { - RD::Uniform u_ao_slices_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ ss_effects.mirror_sampler, p_ssao_buffers.ao_deinterleaved_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_ao_slices_with_sampler), 0); + RD::Uniform u_ao_slices_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ ss_effects.mirror_sampler, ao_deinterleaved_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 0, u_ao_slices_with_sampler), 0); } - RD::Uniform u_ao_pong_slices(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssao_buffers.ao_pong_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_ao_pong_slices), 1); + RD::Uniform u_ao_pong_slices(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ ao_pong_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 1, u_ao_pong_slices), 1); } else { if (ssao_quality == RS::ENV_SSAO_QUALITY_VERY_LOW) { - RD::Uniform u_ao_pong_slices_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssao_buffers.ao_pong_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_ao_pong_slices_with_sampler), 0); + RD::Uniform u_ao_pong_slices_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, ao_pong_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 0, u_ao_pong_slices_with_sampler), 0); } else { - RD::Uniform u_ao_pong_slices_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ ss_effects.mirror_sampler, p_ssao_buffers.ao_pong_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_ao_pong_slices_with_sampler), 0); + RD::Uniform u_ao_pong_slices_with_sampler(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ ss_effects.mirror_sampler, ao_pong_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 0, u_ao_pong_slices_with_sampler), 0); } - RD::Uniform u_ao_slices(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssao_buffers.ao_deinterleaved_slices[i] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_ao_slices), 1); + RD::Uniform u_ao_slices(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ ao_deinterleaved_slices[i] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(blur_shader, 1, u_ao_slices), 1); } RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssao.blur_push_constant, sizeof(SSAOBlurPushConstant)); @@ -1400,17 +1290,18 @@ void SSEffects::generate_ssao(SSAORenderBuffers &p_ssao_buffers, RID p_normal_bu interleave_pipeline = SSAO_INTERLEAVE_SMART; } + RID interleave_shader = ssao.interleave_shader.version_get_shader(ssao.interleave_shader_version, interleave_pipeline - SSAO_INTERLEAVE); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssao.pipelines[interleave_pipeline]); - RD::Uniform u_upscale_buffer(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssao_buffers.ao_final })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_upscale_buffer), 0); + RD::Uniform u_upscale_buffer(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ ao_final })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(interleave_shader, 0, u_upscale_buffer), 0); if (ssao_quality > RS::ENV_SSAO_QUALITY_VERY_LOW && ssao_blur_passes % 2 == 0) { - RD::Uniform u_ao(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssao_buffers.ao_deinterleaved })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_ao), 1); + RD::Uniform u_ao(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, ao_deinterleaved })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(interleave_shader, 1, u_ao), 1); } else { - RD::Uniform u_ao(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_ssao_buffers.ao_pong })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_ao), 1); + RD::Uniform u_ao(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, ao_pong })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(interleave_shader, 1, u_ao), 1); } RD::get_singleton()->compute_list_set_push_constant(compute_list, &ssao.interleave_push_constant, sizeof(SSAOInterleavePushConstant)); @@ -1426,116 +1317,43 @@ void SSEffects::generate_ssao(SSAORenderBuffers &p_ssao_buffers, RID p_normal_bu RD::get_singleton()->buffer_update(ssao.importance_map_load_counter, 0, sizeof(uint32_t), &zero, 0); //no barrier } -void SSEffects::ssao_free(SSAORenderBuffers &p_ssao_buffers) { - if (p_ssao_buffers.ao_final.is_valid()) { - RD::get_singleton()->free(p_ssao_buffers.ao_deinterleaved); - RD::get_singleton()->free(p_ssao_buffers.ao_pong); - RD::get_singleton()->free(p_ssao_buffers.ao_final); - - RD::get_singleton()->free(p_ssao_buffers.importance_map[0]); - RD::get_singleton()->free(p_ssao_buffers.importance_map[1]); - - p_ssao_buffers.ao_deinterleaved = RID(); - p_ssao_buffers.ao_pong = RID(); - p_ssao_buffers.ao_final = RID(); - p_ssao_buffers.importance_map[0] = RID(); - p_ssao_buffers.importance_map[1] = RID(); - p_ssao_buffers.ao_deinterleaved_slices.clear(); - p_ssao_buffers.ao_pong_slices.clear(); - - p_ssao_buffers.gather_uniform_set = RID(); - p_ssao_buffers.importance_map_uniform_set = RID(); - } -} - /* Screen Space Reflection */ void SSEffects::ssr_set_roughness_quality(RS::EnvironmentSSRRoughnessQuality p_quality) { ssr_roughness_quality = p_quality; } -void SSEffects::ssr_allocate_buffers(SSRRenderBuffers &p_ssr_buffers, const RenderingDevice::DataFormat p_color_format, const Size2i &p_screen_size, const uint32_t p_view_count) { - // As we are processing one view at a time, we can reuse buffers, only our output needs to have layers for each view. - if (p_ssr_buffers.size != p_screen_size || p_ssr_buffers.roughness_quality != ssr_roughness_quality) { - ssr_free(p_ssr_buffers); - } - - if (p_ssr_buffers.output.is_valid()) { - // already allocated - return; +void SSEffects::ssr_allocate_buffers(Ref<RenderSceneBuffersRD> p_render_buffers, SSRRenderBuffers &p_ssr_buffers, const RenderingDevice::DataFormat p_color_format) { + if (p_ssr_buffers.roughness_quality != ssr_roughness_quality) { + // Buffers will already be cleared if view count or viewport size has changed, also cleared them if we change roughness. + p_render_buffers->clear_context(RB_SCOPE_SSR); } - p_ssr_buffers.size = p_screen_size; + Size2i internal_size = p_render_buffers->get_internal_size(); + p_ssr_buffers.size = Size2i(internal_size.x / 2, internal_size.y / 2); p_ssr_buffers.roughness_quality = ssr_roughness_quality; - if (p_ssr_buffers.depth_scaled.is_null()) { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R32_SFLOAT; - tf.width = p_screen_size.x; - tf.height = p_screen_size.y; - tf.texture_type = RD::TEXTURE_TYPE_2D; - tf.array_layers = 1; - tf.usage_bits = RD::TEXTURE_USAGE_STORAGE_BIT; - - p_ssr_buffers.depth_scaled = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssr_buffers.depth_scaled, "SSR Depth Scaled"); + // We are using barriers so we do not need to allocate textures for both views on anything but output... - tf.format = RD::DATA_FORMAT_R8G8B8A8_UNORM; + p_render_buffers->create_texture(RB_SCOPE_SSR, RB_DEPTH_SCALED, RD::DATA_FORMAT_R32_SFLOAT, RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, p_ssr_buffers.size, 1); + p_render_buffers->create_texture(RB_SCOPE_SSR, RB_NORMAL_SCALED, RD::DATA_FORMAT_R8G8B8A8_UNORM, RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, p_ssr_buffers.size, 1); - p_ssr_buffers.normal_scaled = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssr_buffers.normal_scaled, "SSR Normal Scaled"); + if (ssr_roughness_quality != RS::ENV_SSR_ROUGHNESS_QUALITY_DISABLED && !p_render_buffers->has_texture(RB_SCOPE_SSR, RB_BLUR_RADIUS)) { + p_render_buffers->create_texture(RB_SCOPE_SSR, RB_BLUR_RADIUS, RD::DATA_FORMAT_R8_UNORM, RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT, RD::TEXTURE_SAMPLES_1, p_ssr_buffers.size, 2); // 2 layers, for our two blur stages } - if (ssr_roughness_quality != RS::ENV_SSR_ROUGHNESS_QUALITY_DISABLED && !p_ssr_buffers.blur_radius[0].is_valid()) { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R8_UNORM; - tf.width = p_screen_size.x; - tf.height = p_screen_size.y; - tf.texture_type = RD::TEXTURE_TYPE_2D; - tf.array_layers = 1; - tf.usage_bits = RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_SAMPLING_BIT; - - p_ssr_buffers.blur_radius[0] = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssr_buffers.blur_radius[0], "SSR Blur Radius 0"); - p_ssr_buffers.blur_radius[1] = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssr_buffers.blur_radius[1], "SSR Blur Radius 1"); - } - - if (p_ssr_buffers.intermediate.is_null()) { - RD::TextureFormat tf; - tf.format = p_color_format; - tf.width = p_screen_size.x; - tf.height = p_screen_size.y; - tf.texture_type = RD::TEXTURE_TYPE_2D; - tf.array_layers = 1; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_COPY_TO_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; - - p_ssr_buffers.intermediate = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssr_buffers.intermediate, "SSR Intermediate"); - - if (p_view_count > 1) { - tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY; - tf.array_layers = p_view_count; - } else { - tf.texture_type = RD::TEXTURE_TYPE_2D; - tf.array_layers = 1; - } - - p_ssr_buffers.output = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(p_ssr_buffers.output, "SSR Output"); - - for (uint32_t v = 0; v < p_view_count; v++) { - p_ssr_buffers.output_slices[v] = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), p_ssr_buffers.output, v, 0); - } - } + p_render_buffers->create_texture(RB_SCOPE_SSR, RB_INTERMEDIATE, p_color_format, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_COPY_TO_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, p_ssr_buffers.size, 1); + p_render_buffers->create_texture(RB_SCOPE_SSR, RB_OUTPUT, p_color_format, RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_CAN_COPY_TO_BIT | RD::TEXTURE_USAGE_STORAGE_BIT, RD::TEXTURE_SAMPLES_1, p_ssr_buffers.size); } -void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const RID *p_diffuse_slices, const RID *p_normal_roughness_slices, const RID *p_metallic_slices, const RID *p_depth_slices, const Size2i &p_screen_size, int p_max_steps, float p_fade_in, float p_fade_out, float p_tolerance, const uint32_t p_view_count, const Projection *p_projections, const Vector3 *p_eye_offsets) { +void SSEffects::screen_space_reflection(Ref<RenderSceneBuffersRD> p_render_buffers, SSRRenderBuffers &p_ssr_buffers, const RID *p_normal_roughness_slices, const RID *p_metallic_slices, int p_max_steps, float p_fade_in, float p_fade_out, float p_tolerance, const Projection *p_projections, const Vector3 *p_eye_offsets) { UniformSetCacheRD *uniform_set_cache = UniformSetCacheRD::get_singleton(); ERR_FAIL_NULL(uniform_set_cache); MaterialStorage *material_storage = MaterialStorage::get_singleton(); ERR_FAIL_NULL(material_storage); + uint32_t view_count = p_render_buffers->get_view_count(); + RID default_sampler = material_storage->sampler_rd_get_default(RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR, RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED); { @@ -1546,7 +1364,7 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R ssr.ubo = RD::get_singleton()->uniform_buffer_create(sizeof(ScreenSpaceReflectionSceneData)); } - for (uint32_t v = 0; v < p_view_count; v++) { + for (uint32_t v = 0; v < view_count; v++) { store_camera(p_projections[v], scene_data.projection[v]); store_camera(p_projections[v].inverse(), scene_data.inv_projection[v]); scene_data.eye_offset[v][0] = p_eye_offsets[v].x; @@ -1559,13 +1377,27 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R } uint32_t pipeline_specialization = 0; - if (p_view_count > 1) { + if (view_count > 1) { pipeline_specialization |= SSR_MULTIVIEW; } RD::ComputeListID compute_list = RD::get_singleton()->compute_list_begin(); - for (uint32_t v = 0; v < p_view_count; v++) { + for (uint32_t v = 0; v < view_count; v++) { + // get buffers we need to use for this view + RID diffuse_slice = p_render_buffers->get_internal_texture(v); + RID depth_slice = p_render_buffers->get_depth_texture(v); + RID depth_scaled = p_render_buffers->get_texture(RB_SCOPE_SSR, RB_DEPTH_SCALED); + RID normal_scaled = p_render_buffers->get_texture(RB_SCOPE_SSR, RB_NORMAL_SCALED); + RID intermediate = p_render_buffers->get_texture(RB_SCOPE_SSR, RB_INTERMEDIATE); + RID output = p_render_buffers->get_texture_slice(RB_SCOPE_SSR, RB_OUTPUT, v, 0); + + RID blur_radius[2]; + if (ssr_roughness_quality != RS::ENV_SSR_ROUGHNESS_QUALITY_DISABLED) { + blur_radius[0] = p_render_buffers->get_texture_slice(RB_SCOPE_SSR, RB_BLUR_RADIUS, 0, 0); + blur_radius[1] = p_render_buffers->get_texture_slice(RB_SCOPE_SSR, RB_BLUR_RADIUS, 1, 0); + } + RD::get_singleton()->draw_command_begin_label(String("SSR View ") + itos(v)); { //scale color and depth to half @@ -1577,34 +1409,29 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R push_constant.camera_z_near = p_projections[v].get_z_near(); push_constant.orthogonal = p_projections[v].is_orthogonal(); push_constant.filter = false; //enabling causes arctifacts - push_constant.screen_size[0] = p_screen_size.x; - push_constant.screen_size[1] = p_screen_size.y; + push_constant.screen_size[0] = p_ssr_buffers.size.x; + push_constant.screen_size[1] = p_ssr_buffers.size.y; RID shader = ssr_scale.shader.version_get_shader(ssr_scale.shader_version, 0); RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssr_scale.pipelines[pipeline_specialization]); - RD::Uniform u_diffuse(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_diffuse_slices[v] })); + RD::Uniform u_diffuse(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, diffuse_slice })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_diffuse), 0); - RD::Uniform u_depth(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_depth_slices[v] })); + RD::Uniform u_depth(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, depth_slice })); RD::Uniform u_normal_roughness(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 1, Vector<RID>({ default_sampler, p_normal_roughness_slices[v] })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_depth, u_normal_roughness), 1); - if (ssr_roughness_quality != RS::ENV_SSR_ROUGHNESS_QUALITY_DISABLED) { - RD::Uniform u_output(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.output_slices[v] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 2, u_output), 2); - } else { - RD::Uniform u_intermediate(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.intermediate })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 2, u_intermediate), 2); - } + RD::Uniform u_intermediate(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ intermediate })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 2, u_intermediate), 2); - RD::Uniform u_scale_depth(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.depth_scaled })); - RD::Uniform u_scale_normal(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ p_ssr_buffers.normal_scaled })); + RD::Uniform u_scale_depth(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ depth_scaled })); + RD::Uniform u_scale_normal(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ normal_scaled })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 3, u_scale_depth, u_scale_normal), 3); RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(ScreenSpaceReflectionScalePushConstant)); - RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_screen_size.width, p_screen_size.height, 1); + RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssr_buffers.size.width, p_ssr_buffers.size.height, 1); RD::get_singleton()->compute_list_add_barrier(compute_list); @@ -1619,15 +1446,15 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R push_constant.camera_z_far = p_projections[v].get_z_far(); push_constant.camera_z_near = p_projections[v].get_z_near(); push_constant.orthogonal = p_projections[v].is_orthogonal(); - push_constant.screen_size[0] = p_screen_size.x; - push_constant.screen_size[1] = p_screen_size.y; + push_constant.screen_size[0] = p_ssr_buffers.size.x; + push_constant.screen_size[1] = p_ssr_buffers.size.y; push_constant.curve_fade_in = p_fade_in; push_constant.distance_fade = p_fade_out; push_constant.num_steps = p_max_steps; push_constant.depth_tolerance = p_tolerance; push_constant.use_half_res = true; - push_constant.proj_info[0] = -2.0f / (p_screen_size.width * p_projections[v].columns[0][0]); - push_constant.proj_info[1] = -2.0f / (p_screen_size.height * p_projections[v].columns[1][1]); + push_constant.proj_info[0] = -2.0f / (p_ssr_buffers.size.width * p_projections[v].columns[0][0]); + push_constant.proj_info[1] = -2.0f / (p_ssr_buffers.size.height * p_projections[v].columns[1][1]); push_constant.proj_info[2] = (1.0f - p_projections[v].columns[0][2]) / p_projections[v].columns[0][0]; push_constant.proj_info[3] = (1.0f + p_projections[v].columns[1][2]) / p_projections[v].columns[1][1]; @@ -1639,35 +1466,30 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R RD::Uniform u_scene_data(RD::UNIFORM_TYPE_UNIFORM_BUFFER, 0, ssr.ubo); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 4, u_scene_data), 4); + // read from intermediate + RD::Uniform u_intermediate(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ intermediate })); + RD::Uniform u_scale_depth(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ depth_scaled })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_intermediate, u_scale_depth), 0); + if (ssr_roughness_quality != RS::ENV_SSR_ROUGHNESS_QUALITY_DISABLED) { - // read from output slices (our scale wrote into these) - RD::Uniform u_output(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.output_slices[v] })); - RD::Uniform u_scale_depth(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ p_ssr_buffers.depth_scaled })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_output, u_scale_depth), 0); - - // write to intermediate (our roughness pass will output into output slices) - RD::Uniform u_intermediate(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.intermediate })); - RD::Uniform u_blur_radius(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ p_ssr_buffers.blur_radius[0] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_intermediate, u_blur_radius), 1); + // write to output and blur radius + RD::Uniform u_output(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ output })); + RD::Uniform u_blur_radius(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ blur_radius[0] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_output, u_blur_radius), 1); } else { - // read from intermediate (our scale wrote into these) - RD::Uniform u_intermediate(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.intermediate })); - RD::Uniform u_scale_depth(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ p_ssr_buffers.depth_scaled })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_intermediate, u_scale_depth), 0); - - // We are not performing our blur so go directly to output. - RD::Uniform u_output(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.output_slices[v] })); + // We are only writing output + RD::Uniform u_output(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ output })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_output), 1); } - RD::Uniform u_scale_normal(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.normal_scaled })); + RD::Uniform u_scale_normal(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ normal_scaled })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 2, u_scale_normal), 2); RD::Uniform u_metallic(RD::UNIFORM_TYPE_SAMPLER_WITH_TEXTURE, 0, Vector<RID>({ default_sampler, p_metallic_slices[v] })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 3, u_metallic), 3); RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(ScreenSpaceReflectionPushConstant)); - RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_screen_size.width, p_screen_size.height, 1); + RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssr_buffers.size.width, p_ssr_buffers.size.height, 1); RD::get_singleton()->draw_command_end_label(); } @@ -1682,8 +1504,8 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R push_constant.view_index = v; push_constant.orthogonal = p_projections[v].is_orthogonal(); push_constant.edge_tolerance = Math::sin(Math::deg_to_rad(15.0)); - push_constant.proj_info[0] = -2.0f / (p_screen_size.width * p_projections[v].columns[0][0]); - push_constant.proj_info[1] = -2.0f / (p_screen_size.height * p_projections[v].columns[1][1]); + push_constant.proj_info[0] = -2.0f / (p_ssr_buffers.size.width * p_projections[v].columns[0][0]); + push_constant.proj_info[1] = -2.0f / (p_ssr_buffers.size.height * p_projections[v].columns[1][1]); push_constant.proj_info[2] = (1.0f - p_projections[v].columns[0][2]) / p_projections[v].columns[0][0]; push_constant.proj_info[3] = (1.0f + p_projections[v].columns[1][2]) / p_projections[v].columns[1][1]; push_constant.vertical = 0; @@ -1698,8 +1520,8 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R push_constant.increment = 1; } - push_constant.screen_size[0] = p_screen_size.width; - push_constant.screen_size[1] = p_screen_size.height; + push_constant.screen_size[0] = p_ssr_buffers.size.width; + push_constant.screen_size[1] = p_ssr_buffers.size.height; // Horizontal pass @@ -1709,25 +1531,25 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R RD::get_singleton()->compute_list_bind_compute_pipeline(compute_list, ssr_filter.pipelines[pipeline_specialization][mode]); - RD::Uniform u_scene_data(RD::UNIFORM_TYPE_UNIFORM_BUFFER, 0, ssr.ubo); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 4, u_scene_data), 4); - - RD::Uniform u_intermediate(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.intermediate })); - RD::Uniform u_blur_radius(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ p_ssr_buffers.blur_radius[0] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_intermediate, u_blur_radius), 0); + RD::Uniform u_output(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ output })); + RD::Uniform u_blur_radius(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ blur_radius[0] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_output, u_blur_radius), 0); - RD::Uniform u_scale_normal(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.normal_scaled })); + RD::Uniform u_scale_normal(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ normal_scaled })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_scale_normal), 1); - RD::Uniform u_output_blur(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.output_slices[v] })); - RD::Uniform u_blur_radius2(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ p_ssr_buffers.blur_radius[1] })); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 2, u_output_blur, u_blur_radius2), 2); + RD::Uniform u_intermediate(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ intermediate })); + RD::Uniform u_blur_radius2(RD::UNIFORM_TYPE_IMAGE, 1, Vector<RID>({ blur_radius[1] })); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 2, u_intermediate, u_blur_radius2), 2); - RD::Uniform u_scale_depth(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ p_ssr_buffers.depth_scaled })); + RD::Uniform u_scale_depth(RD::UNIFORM_TYPE_IMAGE, 0, Vector<RID>({ depth_scaled })); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 3, u_scale_depth), 3); + RD::Uniform u_scene_data(RD::UNIFORM_TYPE_UNIFORM_BUFFER, 0, ssr.ubo); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 4, u_scene_data), 4); + RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(ScreenSpaceReflectionFilterPushConstant)); - RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_screen_size.width, p_screen_size.height, 1); + RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssr_buffers.size.width, p_ssr_buffers.size.height, 1); RD::get_singleton()->compute_list_add_barrier(compute_list); // Vertical pass @@ -1739,16 +1561,16 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R push_constant.vertical = 1; - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_output_blur, u_blur_radius2), 0); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 0, u_intermediate, u_blur_radius2), 0); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 1, u_scale_normal), 1); - RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 2, u_intermediate), 2); + RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 2, u_output), 2); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 3, u_scale_depth), 3); RD::get_singleton()->compute_list_bind_uniform_set(compute_list, uniform_set_cache->get_cache(shader, 4, u_scene_data), 4); RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(ScreenSpaceReflectionFilterPushConstant)); - RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_screen_size.width, p_screen_size.height, 1); + RD::get_singleton()->compute_list_dispatch_threads(compute_list, p_ssr_buffers.size.width, p_ssr_buffers.size.height, 1); - if (v != p_view_count - 1) { + if (v != view_count - 1) { RD::get_singleton()->compute_list_add_barrier(compute_list); } @@ -1761,36 +1583,6 @@ void SSEffects::screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const R RD::get_singleton()->compute_list_end(); } -void SSEffects::ssr_free(SSRRenderBuffers &p_ssr_buffers) { - for (uint32_t v = 0; v < RendererSceneRender::MAX_RENDER_VIEWS; v++) { - p_ssr_buffers.output_slices[v] = RID(); - } - - if (p_ssr_buffers.output.is_valid()) { - RD::get_singleton()->free(p_ssr_buffers.output); - p_ssr_buffers.output = RID(); - } - - if (p_ssr_buffers.intermediate.is_valid()) { - RD::get_singleton()->free(p_ssr_buffers.intermediate); - p_ssr_buffers.intermediate = RID(); - } - - if (p_ssr_buffers.blur_radius[0].is_valid()) { - RD::get_singleton()->free(p_ssr_buffers.blur_radius[0]); - RD::get_singleton()->free(p_ssr_buffers.blur_radius[1]); - p_ssr_buffers.blur_radius[0] = RID(); - p_ssr_buffers.blur_radius[1] = RID(); - } - - if (p_ssr_buffers.depth_scaled.is_valid()) { - RD::get_singleton()->free(p_ssr_buffers.depth_scaled); - p_ssr_buffers.depth_scaled = RID(); - RD::get_singleton()->free(p_ssr_buffers.normal_scaled); - p_ssr_buffers.normal_scaled = RID(); - } -} - /* Subsurface scattering */ void SSEffects::sss_set_quality(RS::SubSurfaceScatteringQuality p_quality) { diff --git a/servers/rendering/renderer_rd/effects/ss_effects.h b/servers/rendering/renderer_rd/effects/ss_effects.h index bac1d9b786..8585277e19 100644 --- a/servers/rendering/renderer_rd/effects/ss_effects.h +++ b/servers/rendering/renderer_rd/effects/ss_effects.h @@ -48,6 +48,26 @@ #include "servers/rendering/renderer_scene_render.h" #include "servers/rendering_server.h" +#define RB_SCOPE_SSDS SNAME("rb_ssds") +#define RB_SCOPE_SSIL SNAME("rb_ssil") +#define RB_SCOPE_SSAO SNAME("rb_ssao") +#define RB_SCOPE_SSR SNAME("rb_ssr") + +#define RB_LINEAR_DEPTH SNAME("linear_depth") +#define RB_FINAL SNAME("final") +#define RB_LAST_FRAME SNAME("last_frame") +#define RB_DEINTERLEAVED SNAME("deinterleaved") +#define RB_DEINTERLEAVED_PONG SNAME("deinterleaved_pong") +#define RB_EDGES SNAME("edges") +#define RB_IMPORTANCE_MAP SNAME("importance_map") +#define RB_IMPORTANCE_PONG SNAME("importance_pong") + +#define RB_DEPTH_SCALED SNAME("depth_scaled") +#define RB_NORMAL_SCALED SNAME("normal_scaled") +#define RB_BLUR_RADIUS SNAME("blur_radius") +#define RB_INTERMEDIATE SNAME("intermediate") +#define RB_OUTPUT SNAME("output") + class RenderSceneBuffersRD; namespace RendererRD { @@ -64,7 +84,7 @@ public: /* SS Downsampler */ - void downsample_depth(RID p_depth_buffer, const Vector<RID> &p_depth_mipmaps, bool p_invalidate_uniform_set, Size2i p_full_screen_size, const Projection &p_projection); + void downsample_depth(Ref<RenderSceneBuffersRD> p_render_buffers, uint32_t p_view, const Projection &p_projection); /* SSIL */ void ssil_set_quality(RS::EnvironmentSSILQuality p_quality, bool p_half_size, float p_adaptive_target, int p_blur_passes, float p_fadeout_from, float p_fadeout_to); @@ -75,23 +95,6 @@ public: int buffer_height; int half_buffer_width; int half_buffer_height; - - RID ssil_final; - RID deinterleaved; - Vector<RID> deinterleaved_slices; - RID pong; - Vector<RID> pong_slices; - RID edges; - Vector<RID> edges_slices; - RID importance_map[2]; - RID depth_texture_view; - - RID last_frame; - Vector<RID> last_frame_slices; - - RID gather_uniform_set; - RID importance_map_uniform_set; - RID projection_uniform_set; }; struct SSILSettings { @@ -103,9 +106,8 @@ public: Size2i full_screen_size; }; - void ssil_allocate_buffers(SSILRenderBuffers &p_ssil_buffers, const SSILSettings &p_settings, RID p_linear_depth); - void screen_space_indirect_lighting(SSILRenderBuffers &p_ssil_buffers, RID p_normal_buffer, const Projection &p_projection, const Projection &p_last_projection, const SSILSettings &p_settings); - void ssil_free(SSILRenderBuffers &p_ssil_buffers); + void ssil_allocate_buffers(Ref<RenderSceneBuffersRD> p_render_buffers, SSILRenderBuffers &p_ssil_buffers, const SSILSettings &p_settings); + void screen_space_indirect_lighting(Ref<RenderSceneBuffersRD> p_render_buffers, SSILRenderBuffers &p_ssil_buffers, uint32_t p_view, RID p_normal_buffer, const Projection &p_projection, const Projection &p_last_projection, const SSILSettings &p_settings); /* SSAO */ void ssao_set_quality(RS::EnvironmentSSAOQuality p_quality, bool p_half_size, float p_adaptive_target, int p_blur_passes, float p_fadeout_from, float p_fadeout_to); @@ -116,17 +118,6 @@ public: int buffer_height; int half_buffer_width; int half_buffer_height; - - RID ao_deinterleaved; - Vector<RID> ao_deinterleaved_slices; - RID ao_pong; - Vector<RID> ao_pong_slices; - RID ao_final; - RID importance_map[2]; - RID depth_texture_view; - - RID gather_uniform_set; - RID importance_map_uniform_set; }; struct SSAOSettings { @@ -140,9 +131,8 @@ public: Size2i full_screen_size; }; - void ssao_allocate_buffers(SSAORenderBuffers &p_ssao_buffers, const SSAOSettings &p_settings, RID p_linear_depth); - void generate_ssao(SSAORenderBuffers &p_ssao_buffers, RID p_normal_buffer, const Projection &p_projection, const SSAOSettings &p_settings); - void ssao_free(SSAORenderBuffers &p_ssao_buffers); + void ssao_allocate_buffers(Ref<RenderSceneBuffersRD> p_render_buffers, SSAORenderBuffers &p_ssao_buffers, const SSAOSettings &p_settings); + void generate_ssao(Ref<RenderSceneBuffersRD> p_render_buffers, SSAORenderBuffers &p_ssao_buffers, uint32_t p_view, RID p_normal_buffer, const Projection &p_projection, const SSAOSettings &p_settings); /* Screen Space Reflection */ void ssr_set_roughness_quality(RS::EnvironmentSSRRoughnessQuality p_quality); @@ -150,18 +140,10 @@ public: struct SSRRenderBuffers { Size2i size; RenderingServer::EnvironmentSSRRoughnessQuality roughness_quality = RenderingServer::ENV_SSR_ROUGHNESS_QUALITY_DISABLED; - - RID normal_scaled; - RID depth_scaled; - RID blur_radius[2]; - RID intermediate; - RID output; - RID output_slices[RendererSceneRender::MAX_RENDER_VIEWS]; }; - void ssr_allocate_buffers(SSRRenderBuffers &p_ssr_buffers, const RenderingDevice::DataFormat p_color_format, const Size2i &p_screen_size, const uint32_t p_view_count); - void screen_space_reflection(SSRRenderBuffers &p_ssr_buffers, const RID *p_diffuse_slices, const RID *p_normal_roughness_slices, const RID *p_metallic_slices, const RID *p_depth_slices, const Size2i &p_screen_size, int p_max_steps, float p_fade_in, float p_fade_out, float p_tolerance, const uint32_t p_view_count, const Projection *p_projections, const Vector3 *p_eye_offsets); - void ssr_free(SSRRenderBuffers &p_ssr_buffers); + void ssr_allocate_buffers(Ref<RenderSceneBuffersRD> p_render_buffers, SSRRenderBuffers &p_ssr_buffers, const RenderingDevice::DataFormat p_color_format); + void screen_space_reflection(Ref<RenderSceneBuffersRD> p_render_buffers, SSRRenderBuffers &p_ssr_buffers, const RID *p_normal_roughness_slices, const RID *p_metallic_slices, int p_max_steps, float p_fade_in, float p_fade_out, float p_tolerance, const Projection *p_projections, const Vector3 *p_eye_offsets); /* subsurface scattering */ void sss_set_quality(RS::SubSurfaceScatteringQuality p_quality); @@ -223,7 +205,6 @@ private: SSEffectsDownsamplePushConstant downsample_push_constant; SsEffectsDownsampleShaderRD downsample_shader; RID downsample_shader_version; - RID downsample_uniform_set; bool used_half_size_last_frame = false; bool used_mips_last_frame = false; bool used_full_mips_last_frame = false; @@ -332,7 +313,7 @@ private: RID pipelines[SSIL_MAX]; } ssil; - void gather_ssil(RD::ComputeListID p_compute_list, const Vector<RID> p_ssil_slices, const Vector<RID> p_edges_slices, const SSILSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set, RID p_projection_uniform_set); + void gather_ssil(RD::ComputeListID p_compute_list, const RID *p_ssil_slices, const RID *p_edges_slices, const SSILSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set, RID p_projection_uniform_set); /* SSAO */ @@ -426,7 +407,7 @@ private: RID pipelines[SSAO_MAX]; } ssao; - void gather_ssao(RD::ComputeListID p_compute_list, const Vector<RID> p_ao_slices, const SSAOSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set); + void gather_ssao(RD::ComputeListID p_compute_list, const RID *p_ao_slices, const SSAOSettings &p_settings, bool p_adaptive_base_pass, RID p_gather_uniform_set, RID p_importance_map_uniform_set); /* Screen Space Reflection */ diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp index 59e1f559c7..6d5e55ee6a 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp @@ -30,6 +30,7 @@ #include "render_forward_clustered.h" #include "core/config/project_settings.h" +#include "core/object/worker_thread_pool.h" #include "servers/rendering/renderer_rd/framebuffer_cache_rd.h" #include "servers/rendering/renderer_rd/renderer_compositor_rd.h" #include "servers/rendering/renderer_rd/storage_rd/light_storage.h" @@ -108,6 +109,10 @@ void RenderForwardClustered::RenderBufferDataForwardClustered::free_data() { // JIC, should already have been cleared if (render_buffers) { render_buffers->clear_context(RB_SCOPE_FORWARD_CLUSTERED); + render_buffers->clear_context(RB_SCOPE_SSDS); + render_buffers->clear_context(RB_SCOPE_SSIL); + render_buffers->clear_context(RB_SCOPE_SSAO); + render_buffers->clear_context(RB_SCOPE_SSR); } if (cluster_builder) { @@ -118,21 +123,6 @@ void RenderForwardClustered::RenderBufferDataForwardClustered::free_data() { if (!render_sdfgi_uniform_set.is_null() && RD::get_singleton()->uniform_set_is_valid(render_sdfgi_uniform_set)) { RD::get_singleton()->free(render_sdfgi_uniform_set); } - - if (ss_effects_data.linear_depth.is_valid()) { - RD::get_singleton()->free(ss_effects_data.linear_depth); - ss_effects_data.linear_depth = RID(); - ss_effects_data.linear_depth_slices.clear(); - } - - if (ss_effects_data.downsample_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(ss_effects_data.downsample_uniform_set)) { - RD::get_singleton()->free(ss_effects_data.downsample_uniform_set); - ss_effects_data.downsample_uniform_set = RID(); - } - - RenderForwardClustered::get_singleton()->get_ss_effects()->ssao_free(ss_effects_data.ssao); - RenderForwardClustered::get_singleton()->get_ss_effects()->ssil_free(ss_effects_data.ssil); - RenderForwardClustered::get_singleton()->get_ss_effects()->ssr_free(ss_effects_data.ssr); } void RenderForwardClustered::RenderBufferDataForwardClustered::configure(RenderSceneBuffersRD *p_render_buffers) { @@ -1252,7 +1242,7 @@ void RenderForwardClustered::setup_added_decal(const Transform3D &p_transform, c /* Render scene */ -void RenderForwardClustered::_process_ssao(Ref<RenderSceneBuffersRD> p_render_buffers, RID p_environment, RID p_normal_buffer, const Projection &p_projection) { +void RenderForwardClustered::_process_ssao(Ref<RenderSceneBuffersRD> p_render_buffers, RID p_environment, const RID *p_normal_buffers, const Projection *p_projections) { ERR_FAIL_NULL(ss_effects); ERR_FAIL_COND(p_render_buffers.is_null()); ERR_FAIL_COND(p_environment.is_null()); @@ -1271,11 +1261,14 @@ void RenderForwardClustered::_process_ssao(Ref<RenderSceneBuffersRD> p_render_bu settings.sharpness = environment_get_ssao_sharpness(p_environment); settings.full_screen_size = p_render_buffers->get_internal_size(); - ss_effects->ssao_allocate_buffers(rb_data->ss_effects_data.ssao, settings, rb_data->ss_effects_data.linear_depth); - ss_effects->generate_ssao(rb_data->ss_effects_data.ssao, p_normal_buffer, p_projection, settings); + ss_effects->ssao_allocate_buffers(p_render_buffers, rb_data->ss_effects_data.ssao, settings); + + for (uint32_t v = 0; v < p_render_buffers->get_view_count(); v++) { + ss_effects->generate_ssao(p_render_buffers, rb_data->ss_effects_data.ssao, v, p_normal_buffers[v], p_projections[v], settings); + } } -void RenderForwardClustered::_process_ssil(Ref<RenderSceneBuffersRD> p_render_buffers, RID p_environment, RID p_normal_buffer, const Projection &p_projection, const Transform3D &p_transform) { +void RenderForwardClustered::_process_ssil(Ref<RenderSceneBuffersRD> p_render_buffers, RID p_environment, const RID *p_normal_buffers, const Projection *p_projections, const Transform3D &p_transform) { ERR_FAIL_NULL(ss_effects); ERR_FAIL_COND(p_render_buffers.is_null()); ERR_FAIL_COND(p_environment.is_null()); @@ -1292,36 +1285,46 @@ void RenderForwardClustered::_process_ssil(Ref<RenderSceneBuffersRD> p_render_bu settings.normal_rejection = environment_get_ssil_normal_rejection(p_environment); settings.full_screen_size = p_render_buffers->get_internal_size(); - Projection correction; - correction.set_depth_correction(true); - Projection projection = correction * p_projection; + ss_effects->ssil_allocate_buffers(p_render_buffers, rb_data->ss_effects_data.ssil, settings); + Transform3D transform = p_transform; transform.set_origin(Vector3(0.0, 0.0, 0.0)); - Projection last_frame_projection = rb_data->ss_effects_data.last_frame_projection * Projection(rb_data->ss_effects_data.last_frame_transform.affine_inverse()) * Projection(transform) * projection.inverse(); - ss_effects->ssil_allocate_buffers(rb_data->ss_effects_data.ssil, settings, rb_data->ss_effects_data.linear_depth); - ss_effects->screen_space_indirect_lighting(rb_data->ss_effects_data.ssil, p_normal_buffer, p_projection, last_frame_projection, settings); - rb_data->ss_effects_data.last_frame_projection = projection; + for (uint32_t v = 0; v < p_render_buffers->get_view_count(); v++) { + Projection correction; + correction.set_depth_correction(true); + Projection projection = correction * p_projections[v]; + Projection last_frame_projection = rb_data->ss_effects_data.last_frame_projections[v] * Projection(rb_data->ss_effects_data.last_frame_transform.affine_inverse()) * Projection(transform) * projection.inverse(); + + ss_effects->screen_space_indirect_lighting(p_render_buffers, rb_data->ss_effects_data.ssil, v, p_normal_buffers[v], p_projections[v], last_frame_projection, settings); + + rb_data->ss_effects_data.last_frame_projections[v] = projection; + } rb_data->ss_effects_data.last_frame_transform = transform; } void RenderForwardClustered::_copy_framebuffer_to_ssil(Ref<RenderSceneBuffersRD> p_render_buffers) { ERR_FAIL_COND(p_render_buffers.is_null()); - Ref<RenderBufferDataForwardClustered> rb_data = p_render_buffers->get_custom_data(RB_SCOPE_FORWARD_CLUSTERED); - ERR_FAIL_COND(rb_data.is_null()); - - if (rb_data->ss_effects_data.ssil.last_frame.is_valid()) { + if (p_render_buffers->has_texture(RB_SCOPE_SSIL, RB_LAST_FRAME)) { Size2i size = p_render_buffers->get_internal_size(); - RID texture = p_render_buffers->get_internal_texture(); - copy_effects->copy_to_rect(texture, rb_data->ss_effects_data.ssil.last_frame, Rect2i(0, 0, size.x, size.y)); - - int width = size.x; - int height = size.y; - for (int i = 0; i < rb_data->ss_effects_data.ssil.last_frame_slices.size() - 1; i++) { - width = MAX(1, width >> 1); - height = MAX(1, height >> 1); - copy_effects->make_mipmap(rb_data->ss_effects_data.ssil.last_frame_slices[i], rb_data->ss_effects_data.ssil.last_frame_slices[i + 1], Size2i(width, height)); + uint32_t mipmaps = p_render_buffers->get_texture_format(RB_SCOPE_SSIL, RB_LAST_FRAME).mipmaps; + for (uint32_t v = 0; v < p_render_buffers->get_view_count(); v++) { + RID source = p_render_buffers->get_internal_texture(v); + RID dest = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_LAST_FRAME, v, 0); + copy_effects->copy_to_rect(source, dest, Rect2i(0, 0, size.x, size.y)); + + int width = size.x; + int height = size.y; + for (uint32_t m = 1; m < mipmaps; m++) { + width = MAX(1, width >> 1); + height = MAX(1, height >> 1); + + source = dest; + dest = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_LAST_FRAME, v, m); + + copy_effects->make_mipmap(source, dest, Size2i(width, height)); + } } } } @@ -1421,41 +1424,23 @@ void RenderForwardClustered::_pre_opaque_render(RenderDataRD *p_render_data, boo } if (rb_data.is_valid() && ss_effects) { - if (p_use_ssao || p_use_ssil) { - Size2i size = rb->get_internal_size(); + // Note, in multiview we're allocating buffers for each eye/view we're rendering. + // This should allow most of the processing to happen in parallel even if we're doing + // drawcalls per eye/view. It will all sync up at the barrier. - bool invalidate_uniform_set = false; - if (rb_data->ss_effects_data.linear_depth.is_null()) { - RD::TextureFormat tf; - tf.format = RD::DATA_FORMAT_R16_SFLOAT; - tf.texture_type = RD::TEXTURE_TYPE_2D_ARRAY; - tf.width = (size.x + 1) / 2; - tf.height = (size.y + 1) / 2; - tf.mipmaps = 5; - tf.array_layers = 4; - tf.usage_bits = RD::TEXTURE_USAGE_SAMPLING_BIT | RD::TEXTURE_USAGE_STORAGE_BIT; - rb_data->ss_effects_data.linear_depth = RD::get_singleton()->texture_create(tf, RD::TextureView()); - RD::get_singleton()->set_resource_name(rb_data->ss_effects_data.linear_depth, "SS Effects Depth"); - for (uint32_t i = 0; i < tf.mipmaps; i++) { - RID slice = RD::get_singleton()->texture_create_shared_from_slice(RD::TextureView(), rb_data->ss_effects_data.linear_depth, 0, i, 1, RD::TEXTURE_SLICE_2D_ARRAY); - rb_data->ss_effects_data.linear_depth_slices.push_back(slice); - RD::get_singleton()->set_resource_name(slice, "SS Effects Depth Mip " + itos(i) + " "); - } - invalidate_uniform_set = true; + if (p_use_ssao || p_use_ssil) { + // Convert our depth buffer data to linear data in + for (uint32_t v = 0; v < rb->get_view_count(); v++) { + ss_effects->downsample_depth(rb, v, p_render_data->scene_data->view_projection[v]); } - RID depth_texture = rb->get_depth_texture(); - ss_effects->downsample_depth(depth_texture, rb_data->ss_effects_data.linear_depth_slices, invalidate_uniform_set, size, p_render_data->scene_data->cam_projection); - } - - if (p_use_ssao) { - // TODO make these proper stereo - _process_ssao(rb, p_render_data->environment, p_normal_roughness_slices[0], p_render_data->scene_data->cam_projection); - } + if (p_use_ssao) { + _process_ssao(rb, p_render_data->environment, p_normal_roughness_slices, p_render_data->scene_data->view_projection); + } - if (p_use_ssil) { - // TODO make these proper stereo - _process_ssil(rb, p_render_data->environment, p_normal_roughness_slices[0], p_render_data->scene_data->cam_projection, p_render_data->scene_data->cam_transform); + if (p_use_ssil) { + _process_ssil(rb, p_render_data->environment, p_normal_roughness_slices, p_render_data->scene_data->view_projection, p_render_data->scene_data->cam_transform); + } } } @@ -1514,17 +1499,11 @@ void RenderForwardClustered::_process_ssr(Ref<RenderSceneBuffersRD> p_render_buf ERR_FAIL_COND(p_environment.is_null()); ERR_FAIL_COND(!environment_get_ssr_enabled(p_environment)); - Size2i half_size = Size2i(internal_size.x / 2, internal_size.y / 2); - ss_effects->ssr_allocate_buffers(rb_data->ss_effects_data.ssr, _render_buffers_get_color_format(), half_size, view_count); + ss_effects->ssr_allocate_buffers(p_render_buffers, rb_data->ss_effects_data.ssr, _render_buffers_get_color_format()); + ss_effects->screen_space_reflection(p_render_buffers, rb_data->ss_effects_data.ssr, p_normal_slices, p_metallic_slices, environment_get_ssr_max_steps(p_environment), environment_get_ssr_fade_in(p_environment), environment_get_ssr_fade_out(p_environment), environment_get_ssr_depth_tolerance(p_environment), p_projections, p_eye_offsets); - RID texture_slices[RendererSceneRender::MAX_RENDER_VIEWS]; - RID depth_slices[RendererSceneRender::MAX_RENDER_VIEWS]; - for (uint32_t v = 0; v < view_count; v++) { - texture_slices[v] = p_render_buffers->get_internal_texture(v); - depth_slices[v] = p_render_buffers->get_depth_texture(v); - } - ss_effects->screen_space_reflection(rb_data->ss_effects_data.ssr, texture_slices, p_normal_slices, p_metallic_slices, depth_slices, half_size, environment_get_ssr_max_steps(p_environment), environment_get_ssr_fade_in(p_environment), environment_get_ssr_fade_out(p_environment), environment_get_ssr_depth_tolerance(p_environment), view_count, p_projections, p_eye_offsets); - copy_effects->merge_specular(p_dest_framebuffer, p_specular_buffer, p_use_additive ? RID() : p_render_buffers->get_internal_texture(), rb_data->ss_effects_data.ssr.output, view_count); + RID output = p_render_buffers->get_texture(RB_SCOPE_SSR, RB_OUTPUT); + copy_effects->merge_specular(p_dest_framebuffer, p_specular_buffer, p_use_additive ? RID() : p_render_buffers->get_internal_texture(), output, view_count); } void RenderForwardClustered::_process_sss(Ref<RenderSceneBuffersRD> p_render_buffers, const Projection &p_camera) { @@ -2129,14 +2108,16 @@ void RenderForwardClustered::_render_buffers_debug_draw(Ref<RenderSceneBuffersRD RID render_target = p_render_buffers->get_render_target(); - if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_SSAO && rb_data->ss_effects_data.ssao.ao_final.is_valid()) { + if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_SSAO && p_render_buffers->has_texture(RB_SCOPE_SSAO, RB_FINAL)) { + RID final = p_render_buffers->get_texture_slice(RB_SCOPE_SSAO, RB_FINAL, 0, 0); Size2i rtsize = texture_storage->render_target_get_size(render_target); - copy_effects->copy_to_fb_rect(rb_data->ss_effects_data.ssao.ao_final, texture_storage->render_target_get_rd_framebuffer(render_target), Rect2(Vector2(), rtsize), false, true); + copy_effects->copy_to_fb_rect(final, texture_storage->render_target_get_rd_framebuffer(render_target), Rect2(Vector2(), rtsize), false, true); } - if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_SSIL && rb_data->ss_effects_data.ssil.ssil_final.is_valid()) { + if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_SSIL && p_render_buffers->has_texture(RB_SCOPE_SSIL, RB_FINAL)) { + RID final = p_render_buffers->get_texture_slice(RB_SCOPE_SSIL, RB_FINAL, 0, 0); Size2i rtsize = texture_storage->render_target_get_size(render_target); - copy_effects->copy_to_fb_rect(rb_data->ss_effects_data.ssil.ssil_final, texture_storage->render_target_get_rd_framebuffer(render_target), Rect2(Vector2(), rtsize), false, false); + copy_effects->copy_to_fb_rect(final, texture_storage->render_target_get_rd_framebuffer(render_target), Rect2(Vector2(), rtsize), false, false); } if (get_debug_draw_mode() == RS::VIEWPORT_DEBUG_DRAW_GI_BUFFER && p_render_buffers->has_texture(RB_SCOPE_GI, RB_TEX_AMBIENT)) { @@ -3058,7 +3039,7 @@ RID RenderForwardClustered::_setup_render_pass_uniform_set(RenderListType p_rend RD::Uniform u; u.binding = 13; u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; - RID aot = rb_data.is_valid() ? rb_data->get_ao_texture() : RID(); + RID aot = rb.is_valid() && rb->has_texture(RB_SCOPE_SSAO, RB_FINAL) ? rb->get_texture(RB_SCOPE_SSAO, RB_FINAL) : RID(); RID texture = aot.is_valid() ? aot : texture_storage->texture_rd_get_default(RendererRD::TextureStorage::DEFAULT_RD_TEXTURE_BLACK); u.append_id(texture); uniforms.push_back(u); @@ -3144,7 +3125,7 @@ RID RenderForwardClustered::_setup_render_pass_uniform_set(RenderListType p_rend RD::Uniform u; u.binding = 20; u.uniform_type = RD::UNIFORM_TYPE_TEXTURE; - RID ssil = rb_data.is_valid() ? rb_data->get_ssil_texture() : RID(); + RID ssil = rb.is_valid() && rb->has_texture(RB_SCOPE_SSIL, RB_FINAL) ? rb->get_texture(RB_SCOPE_SSIL, RB_FINAL) : RID(); RID texture = ssil.is_valid() ? ssil : texture_storage->texture_rd_get_default(RendererRD::TextureStorage::DEFAULT_RD_TEXTURE_BLACK); u.append_id(texture); uniforms.push_back(u); diff --git a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h index 8eb17ba6f4..e07d2f2258 100644 --- a/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h +++ b/servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.h @@ -104,16 +104,11 @@ class RenderForwardClustered : public RendererSceneRenderRD { ClusterBuilderRD *cluster_builder = nullptr; struct SSEffectsData { - RID linear_depth; - Vector<RID> linear_depth_slices; - - RID downsample_uniform_set; - - Projection last_frame_projection; + Projection last_frame_projections[RendererSceneRender::MAX_RENDER_VIEWS]; Transform3D last_frame_transform; - RendererRD::SSEffects::SSAORenderBuffers ssao; RendererRD::SSEffects::SSILRenderBuffers ssil; + RendererRD::SSEffects::SSAORenderBuffers ssao; RendererRD::SSEffects::SSRRenderBuffers ssr; } ss_effects_data; @@ -155,9 +150,6 @@ class RenderForwardClustered : public RendererSceneRenderRD { RID get_depth_fb(DepthFrameBufferType p_type = DEPTH_FB); RID get_specular_only_fb(); - RID get_ao_texture() const { return ss_effects_data.ssao.ao_final; } - RID get_ssil_texture() const { return ss_effects_data.ssil.ssil_final; } - virtual void configure(RenderSceneBuffersRD *p_render_buffers) override; virtual void free_data() override; }; @@ -600,8 +592,8 @@ class RenderForwardClustered : public RendererSceneRenderRD { void _render_shadow_end(uint32_t p_barrier = RD::BARRIER_MASK_ALL_BARRIERS); /* Render Scene */ - void _process_ssao(Ref<RenderSceneBuffersRD> p_render_buffers, RID p_environment, RID p_normal_buffer, const Projection &p_projection); - void _process_ssil(Ref<RenderSceneBuffersRD> p_render_buffers, RID p_environment, RID p_normal_buffer, const Projection &p_projection, const Transform3D &p_transform); + void _process_ssao(Ref<RenderSceneBuffersRD> p_render_buffers, RID p_environment, const RID *p_normal_buffers, const Projection *p_projections); + void _process_ssil(Ref<RenderSceneBuffersRD> p_render_buffers, RID p_environment, const RID *p_normal_buffers, const Projection *p_projections, const Transform3D &p_transform); void _copy_framebuffer_to_ssil(Ref<RenderSceneBuffersRD> p_render_buffers); void _pre_opaque_render(RenderDataRD *p_render_data, bool p_use_ssao, bool p_use_ssil, bool p_use_gi, const RID *p_normal_roughness_slices, RID p_voxel_gi_buffer); void _process_ssr(Ref<RenderSceneBuffersRD> p_render_buffers, RID p_dest_framebuffer, const RID *p_normal_buffer_slices, RID p_specular_buffer, const RID *p_metallic_slices, RID p_environment, const Projection *p_projections, const Vector3 *p_eye_offsets, bool p_use_additive); diff --git a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp index f9529de6dd..45fe067a6f 100644 --- a/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp +++ b/servers/rendering/renderer_rd/forward_mobile/render_forward_mobile.cpp @@ -30,6 +30,7 @@ #include "render_forward_mobile.h" #include "core/config/project_settings.h" +#include "core/object/worker_thread_pool.h" #include "servers/rendering/renderer_rd/storage_rd/light_storage.h" #include "servers/rendering/renderer_rd/storage_rd/mesh_storage.h" #include "servers/rendering/renderer_rd/storage_rd/particles_storage.h" diff --git a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp index 5776414b14..efd961fd89 100644 --- a/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp +++ b/servers/rendering/renderer_rd/renderer_scene_render_rd.cpp @@ -1110,6 +1110,8 @@ float RendererSceneRenderRD::screen_space_roughness_limiter_get_limit() const { } TypedArray<Image> RendererSceneRenderRD::bake_render_uv2(RID p_base, const TypedArray<RID> &p_material_overrides, const Size2i &p_image_size) { + ERR_FAIL_COND_V_MSG(p_image_size.width <= 0, TypedArray<Image>(), "Image width must be greater than 0."); + ERR_FAIL_COND_V_MSG(p_image_size.height <= 0, TypedArray<Image>(), "Image height must be greater than 0."); RD::TextureFormat tf; tf.format = RD::DATA_FORMAT_R8G8B8A8_UNORM; tf.width = p_image_size.width; // Always 64x64 diff --git a/servers/rendering/renderer_rd/shader_rd.cpp b/servers/rendering/renderer_rd/shader_rd.cpp index 533a912a34..c85ece6366 100644 --- a/servers/rendering/renderer_rd/shader_rd.cpp +++ b/servers/rendering/renderer_rd/shader_rd.cpp @@ -33,6 +33,7 @@ #include "core/io/compression.h" #include "core/io/dir_access.h" #include "core/io/file_access.h" +#include "core/object/worker_thread_pool.h" #include "core/version.h" #include "renderer_compositor_rd.h" #include "servers/rendering/rendering_device.h" diff --git a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl index 21fa7fa148..c8ad1f0312 100644 --- a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl +++ b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered.glsl @@ -1390,7 +1390,11 @@ void fragment_shader(in SceneData scene_data) { #endif // !USE_LIGHTMAP if (bool(implementation_data.ss_effects_flags & SCREEN_SPACE_EFFECTS_FLAGS_USE_SSAO)) { +#ifdef USE_MULTIVIEW + float ssao = texture(sampler2DArray(ao_buffer, material_samplers[SAMPLER_LINEAR_CLAMP]), vec3(screen_uv, ViewIndex)).r; +#else float ssao = texture(sampler2D(ao_buffer, material_samplers[SAMPLER_LINEAR_CLAMP]), screen_uv).r; +#endif ao = min(ao, ssao); ao_light_affect = mix(ao_light_affect, max(ao_light_affect, implementation_data.ssao_light_affect), implementation_data.ssao_ao_affect); } @@ -1473,7 +1477,11 @@ void fragment_shader(in SceneData scene_data) { ambient_light *= ao; if (bool(implementation_data.ss_effects_flags & SCREEN_SPACE_EFFECTS_FLAGS_USE_SSIL)) { +#ifdef USE_MULTIVIEW + vec4 ssil = textureLod(sampler2DArray(ssil_buffer, material_samplers[SAMPLER_LINEAR_CLAMP]), vec3(screen_uv, ViewIndex), 0.0); +#else vec4 ssil = textureLod(sampler2D(ssil_buffer, material_samplers[SAMPLER_LINEAR_CLAMP]), screen_uv, 0.0); +#endif // USE_MULTIVIEW ambient_light *= 1.0 - ssil.a; ambient_light += ssil.rgb * albedo.rgb; } diff --git a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered_inc.glsl b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered_inc.glsl index 8ff7a784dc..043bba1e4e 100644 --- a/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered_inc.glsl +++ b/servers/rendering/renderer_rd/shaders/forward_clustered/scene_forward_clustered_inc.glsl @@ -275,6 +275,7 @@ layout(r32ui, set = 1, binding = 13) uniform restrict uimage3D geom_facing_grid; layout(set = 1, binding = 10) uniform texture2DArray depth_buffer; layout(set = 1, binding = 11) uniform texture2DArray color_buffer; layout(set = 1, binding = 12) uniform texture2DArray normal_roughness_buffer; +layout(set = 1, binding = 13) uniform texture2DArray ao_buffer; layout(set = 1, binding = 14) uniform texture2DArray ambient_buffer; layout(set = 1, binding = 15) uniform texture2DArray reflection_buffer; #define multiviewSampler sampler2DArray @@ -282,11 +283,11 @@ layout(set = 1, binding = 15) uniform texture2DArray reflection_buffer; layout(set = 1, binding = 10) uniform texture2D depth_buffer; layout(set = 1, binding = 11) uniform texture2D color_buffer; layout(set = 1, binding = 12) uniform texture2D normal_roughness_buffer; +layout(set = 1, binding = 13) uniform texture2D ao_buffer; layout(set = 1, binding = 14) uniform texture2D ambient_buffer; layout(set = 1, binding = 15) uniform texture2D reflection_buffer; #define multiviewSampler sampler2D #endif -layout(set = 1, binding = 13) uniform texture2D ao_buffer; layout(set = 1, binding = 16) uniform texture2DArray sdfgi_lightprobe_texture; layout(set = 1, binding = 17) uniform texture3D sdfgi_occlusion_cascades; @@ -312,7 +313,11 @@ voxel_gi_instances; layout(set = 1, binding = 19) uniform texture3D volumetric_fog_texture; +#ifdef USE_MULTIVIEW +layout(set = 1, binding = 20) uniform texture2DArray ssil_buffer; +#else layout(set = 1, binding = 20) uniform texture2D ssil_buffer; +#endif // USE_MULTIVIEW #endif diff --git a/servers/rendering/renderer_scene_cull.cpp b/servers/rendering/renderer_scene_cull.cpp index 7d2cd12959..813c1fa4ff 100644 --- a/servers/rendering/renderer_scene_cull.cpp +++ b/servers/rendering/renderer_scene_cull.cpp @@ -31,6 +31,7 @@ #include "renderer_scene_cull.h" #include "core/config/project_settings.h" +#include "core/object/worker_thread_pool.h" #include "core/os/os.h" #include "rendering_server_default.h" #include "rendering_server_globals.h" diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp index d251a81427..0e2a3c682d 100644 --- a/servers/rendering/renderer_viewport.cpp +++ b/servers/rendering/renderer_viewport.cpp @@ -31,6 +31,7 @@ #include "renderer_viewport.h" #include "core/config/project_settings.h" +#include "core/object/worker_thread_pool.h" #include "renderer_canvas_cull.h" #include "renderer_scene_cull.h" #include "rendering_server_globals.h" @@ -229,6 +230,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) { bool scenario_draw_canvas_bg = false; //draw canvas, or some layer of it, as BG for 3D instead of in front int scenario_canvas_max_layer = 0; + bool force_clear_render_target = false; for (int i = 0; i < RS::VIEWPORT_RENDER_INFO_TYPE_MAX; i++) { for (int j = 0; j < RS::VIEWPORT_RENDER_INFO_MAX; j++) { @@ -236,11 +238,16 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) { } } - if (!p_viewport->disable_2d && !viewport_is_environment_disabled(p_viewport) && RSG::scene->is_scenario(p_viewport->scenario)) { + if (RSG::scene->is_scenario(p_viewport->scenario)) { RID environment = RSG::scene->scenario_get_environment(p_viewport->scenario); if (RSG::scene->is_environment(environment)) { - scenario_draw_canvas_bg = RSG::scene->environment_get_background(environment) == RS::ENV_BG_CANVAS; - scenario_canvas_max_layer = RSG::scene->environment_get_canvas_max_layer(environment); + if (!p_viewport->disable_2d && !viewport_is_environment_disabled(p_viewport)) { + scenario_draw_canvas_bg = RSG::scene->environment_get_background(environment) == RS::ENV_BG_CANVAS; + scenario_canvas_max_layer = RSG::scene->environment_get_canvas_max_layer(environment); + } else if (RSG::scene->environment_get_background(environment) == RS::ENV_BG_CANVAS) { + // The scene renderer will still copy over the last frame, so we need to clear the render target. + force_clear_render_target = true; + } } } @@ -263,6 +270,9 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport) { } if (!scenario_draw_canvas_bg && can_draw_3d) { + if (force_clear_render_target) { + RSG::texture_storage->render_target_do_clear_request(p_viewport->render_target); + } _draw_3d(p_viewport); } diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h index 4f52a63b2f..a3bdf7d146 100644 --- a/servers/rendering/rendering_server_default.h +++ b/servers/rendering/rendering_server_default.h @@ -31,6 +31,7 @@ #ifndef RENDERING_SERVER_DEFAULT_H #define RENDERING_SERVER_DEFAULT_H +#include "core/os/thread.h" #include "core/templates/command_queue_mt.h" #include "core/templates/hash_map.h" #include "renderer_canvas_cull.h" diff --git a/servers/rendering/shader_compiler.cpp b/servers/rendering/shader_compiler.cpp index 2710724066..8737d3b217 100644 --- a/servers/rendering/shader_compiler.cpp +++ b/servers/rendering/shader_compiler.cpp @@ -1151,6 +1151,9 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene bool is_texture_func = false; bool is_screen_texture = false; + bool texture_func_no_uv = false; + bool texture_func_returns_data = false; + if (onode->op == SL::OP_STRUCT) { code += _mkid(vnode->name); } else if (onode->op == SL::OP_CONSTRUCT) { @@ -1164,6 +1167,8 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene if (is_internal_func) { code += vnode->name; is_texture_func = texture_functions.has(vnode->name); + texture_func_no_uv = (vnode->name == "textureSize" || vnode->name == "textureQueryLevels"); + texture_func_returns_data = texture_func_no_uv || vnode->name == "textureQueryLod"; } else if (p_default_actions.renames.has(vnode->name)) { code += p_default_actions.renames[vnode->name]; } else { @@ -1313,7 +1318,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene } else { code += node_code; } - } else if (multiview_uv_needed && i == 2) { + } else if (multiview_uv_needed && !texture_func_no_uv && i == 2) { // UV coordinate after using color, depth or normal roughness texture. node_code = "multiview_uv(" + node_code + ".xy)"; @@ -1323,7 +1328,7 @@ String ShaderCompiler::_dump_node_code(const SL::Node *p_node, int p_level, Gene } } code += ")"; - if (is_screen_texture && actions.apply_luminance_multiplier) { + if (is_screen_texture && !texture_func_returns_data && actions.apply_luminance_multiplier) { code = "(" + code + " * vec4(vec3(sc_luminance_multiplier), 1.0))"; } } break; diff --git a/servers/rendering_server.cpp b/servers/rendering_server.cpp index 848b6d01d4..05b1a8f87a 100644 --- a/servers/rendering_server.cpp +++ b/servers/rendering_server.cpp @@ -31,6 +31,7 @@ #include "rendering_server.h" #include "core/config/project_settings.h" +#include "core/object/worker_thread_pool.h" #include "core/variant/typed_array.h" #include "servers/rendering/rendering_server_globals.h" #include "servers/rendering/shader_language.h" diff --git a/servers/rendering_server.h b/servers/rendering_server.h index 1f9bff7c3f..b53b7d2ff9 100644 --- a/servers/rendering_server.h +++ b/servers/rendering_server.h @@ -35,7 +35,6 @@ #include "core/math/geometry_3d.h" #include "core/math/transform_2d.h" #include "core/object/class_db.h" -#include "core/object/worker_thread_pool.h" #include "core/templates/rid.h" #include "core/variant/typed_array.h" #include "core/variant/variant.h" diff --git a/tests/core/math/test_vector3.h b/tests/core/math/test_vector3.h index c3488954ce..ca0aa02882 100644 --- a/tests/core/math/test_vector3.h +++ b/tests/core/math/test_vector3.h @@ -354,6 +354,14 @@ TEST_CASE("[Vector3] Other methods") { CHECK_MESSAGE( vector.snapped(Vector3(0.25, 0.25, 0.25)) == Vector3(1.25, 3.5, 5.5), "Vector3 snapped to 0.25 should give exact results."); + + CHECK_MESSAGE( + Vector3(1.2, 2.5, 2.0).is_equal_approx(vector.min(Vector3(3.0, 2.5, 2.0))), + "Vector3 min should return expected value."); + + CHECK_MESSAGE( + Vector3(5.3, 3.4, 5.6).is_equal_approx(vector.max(Vector3(5.3, 2.0, 3.0))), + "Vector3 max should return expected value."); } TEST_CASE("[Vector3] Plane methods") { diff --git a/tests/core/math/test_vector3i.h b/tests/core/math/test_vector3i.h index 6eef129a36..485a500715 100644 --- a/tests/core/math/test_vector3i.h +++ b/tests/core/math/test_vector3i.h @@ -131,6 +131,13 @@ TEST_CASE("[Vector3i] Other methods") { const Vector3i vector = Vector3i(1, 3, -7); CHECK_MESSAGE( + vector.min(Vector3i(3, 2, 5)) == Vector3i(1, 2, -7), + "Vector3i min should return expected value."); + CHECK_MESSAGE( + vector.max(Vector3i(5, 2, 4)) == Vector3i(5, 3, 4), + "Vector3i max should return expected value."); + + CHECK_MESSAGE( vector.snapped(Vector3i(4, 2, 5)) == Vector3i(0, 4, -5), "Vector3i snapped should work as expected."); } diff --git a/tests/core/math/test_vector4.h b/tests/core/math/test_vector4.h index b85cc710e0..331e0fcfd5 100644 --- a/tests/core/math/test_vector4.h +++ b/tests/core/math/test_vector4.h @@ -255,6 +255,14 @@ TEST_CASE("[Vector4] Other methods") { CHECK_MESSAGE( vector.snapped(Vector4(0.25, 0.25, 0.25, 0.25)) == Vector4(1.25, 3.5, 5.5, 1.5), "Vector4 snapped to 0.25 should give exact results."); + + CHECK_MESSAGE( + Vector4(1.2, 2.5, 2.0, 1.6).is_equal_approx(vector.min(Vector4(3.0, 2.5, 2.0, 3.4))), + "Vector4 min should return expected value."); + + CHECK_MESSAGE( + Vector4(5.3, 3.4, 5.6, 4.2).is_equal_approx(vector.max(Vector4(5.3, 2.0, 3.0, 4.2))), + "Vector4 max should return expected value."); } TEST_CASE("[Vector4] Rounding methods") { diff --git a/tests/core/math/test_vector4i.h b/tests/core/math/test_vector4i.h index e5b47af7c4..5fda6f1778 100644 --- a/tests/core/math/test_vector4i.h +++ b/tests/core/math/test_vector4i.h @@ -134,6 +134,14 @@ TEST_CASE("[Vector3i] Other methods") { const Vector4i vector = Vector4i(1, 3, -7, 13); CHECK_MESSAGE( + vector.min(Vector4i(3, 2, 5, 8)) == Vector4i(1, 2, -7, 8), + "Vector4i min should return expected value."); + + CHECK_MESSAGE( + vector.max(Vector4i(5, 2, 4, 8)) == Vector4i(5, 3, 4, 13), + "Vector4i max should return expected value."); + + CHECK_MESSAGE( vector.snapped(Vector4i(4, 2, 5, 8)) == Vector4i(0, 4, -5, 16), "Vector4i snapped should work as expected."); } |