diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/dist/html/editor.html | 38 | ||||
-rw-r--r-- | misc/dist/html/manifest.json | 1 | ||||
-rw-r--r-- | misc/dist/html/service-worker.js | 112 | ||||
-rw-r--r-- | misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj | 8 | ||||
-rw-r--r-- | misc/dist/linux/godot.6 | 3 | ||||
-rw-r--r-- | misc/dist/linux/org.godotengine.Godot.desktop | 7 | ||||
-rw-r--r-- | misc/dist/osx_template.app/Contents/Info.plist | 4 | ||||
-rw-r--r-- | misc/dist/osx_tools.app/Contents/Info.plist | 2 | ||||
-rw-r--r-- | misc/dist/osx_tools.app/Contents/Resources/en.lproj/InfoPlist.strings | 0 | ||||
-rw-r--r-- | misc/dist/shell/_godot.zsh-completion | 29 | ||||
-rw-r--r-- | misc/dist/shell/godot.bash-completion | 19 | ||||
-rw-r--r-- | misc/dist/shell/godot.fish | 28 | ||||
-rwxr-xr-x | misc/hooks/pre-commit-black | 16 | ||||
-rwxr-xr-x | misc/hooks/pre-commit-clang-format | 18 | ||||
-rwxr-xr-x | misc/scripts/black_format.sh | 20 | ||||
-rwxr-xr-x | misc/scripts/clang_format.sh | 55 | ||||
-rwxr-xr-x | misc/scripts/clang_tidy.sh | 31 | ||||
-rw-r--r-- | misc/scripts/codespell.sh | 5 | ||||
-rwxr-xr-x | misc/scripts/file_format.sh | 12 |
19 files changed, 260 insertions, 148 deletions
diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html index 3e84d30113..7c44dd45a1 100644 --- a/misc/dist/html/editor.html +++ b/misc/dist/html/editor.html @@ -299,12 +299,13 @@ <button id="btn-close-editor" class="btn close-btn" disabled="disabled" onclick="closeEditor()">×</button> <button id="btn-tab-game" class="btn tab-btn" disabled="disabled" onclick="showTab('game')">Game</button> <button id="btn-close-game" class="btn close-btn" disabled="disabled" onclick="closeGame()">×</button> + <button id="btn-tab-update" class="btn tab-btn" style="display: none;">Update</button> </div> <div id="tabs"> <div id="tab-loader"> <div style="color: #e0e0e0;" id="persistence"> <br /> - <img src="logo.svg" alt="Godot Engine logo" width="1024" height="414" style="width: auto; height: auto; max-width: 85%; max-height: 250px" /> + <img src="logo.svg" alt="Godot Engine logo" width="1024" height="414" style="width: auto; height: auto; max-width: min(85%, 50vh); max-height: 250px" /> <br /> @GODOT_VERSION@ <br /> @@ -358,10 +359,39 @@ <div id="status-notice" class="godot" style="display: none;"></div> </div> </div> - <script> + <script>//<![CDATA[ window.addEventListener("load", () => { + function notifyUpdate(sw) { + const btn = document.getElementById("btn-tab-update"); + btn.onclick = function () { + if (!window.confirm("Are you sure you want to update?\nClicking \"OK\" will reload all active instances!")) { + return; + } + sw.postMessage("update"); + btn.innerHTML = "Updating..."; + btn.disabled = true; + }; + btn.style.display = ""; + } if ("serviceWorker" in navigator) { - navigator.serviceWorker.register("service.worker.js"); + navigator.serviceWorker.register("service.worker.js").then(function (reg) { + if (reg.waiting) { + notifyUpdate(reg.waiting); + } + reg.addEventListener("updatefound", function () { + const update = reg.installing; + update.addEventListener("statechange", function () { + if (update.state === "installed") { + // It's a new install, claim and perform aggressive caching. + if (!reg.active) { + update.postMessage("claim"); + } else { + notifyUpdate(update); + } + } + }); + }); + }); } if (!crossOriginIsolated) { @@ -385,7 +415,7 @@ localStorage.setItem("welcomeModalDismissed", 'true'); } } - </script> + //]]></script> <script src="godot.tools.js"></script> <script>//<![CDATA[ diff --git a/misc/dist/html/manifest.json b/misc/dist/html/manifest.json index adc8106e2a..ccfb793b20 100644 --- a/misc/dist/html/manifest.json +++ b/misc/dist/html/manifest.json @@ -5,7 +5,6 @@ "lang": "en", "start_url": "./godot.tools.html", "display": "standalone", - "orientation": "landscape", "theme_color": "#202531", "icons": [ { diff --git a/misc/dist/html/service-worker.js b/misc/dist/html/service-worker.js index 063e40a6cb..310574f21d 100644 --- a/misc/dist/html/service-worker.js +++ b/misc/dist/html/service-worker.js @@ -4,7 +4,8 @@ // Incrementing CACHE_VERSION will kick off the install event and force // previously cached resources to be updated from the network. const CACHE_VERSION = "@GODOT_VERSION@"; -const CACHE_NAME = "@GODOT_NAME@-cache"; +const CACHE_PREFIX = "@GODOT_NAME@-sw-cache-"; +const CACHE_NAME = CACHE_PREFIX + CACHE_VERSION; const OFFLINE_URL = "@GODOT_OFFLINE_PAGE@"; // Files that will be cached on load. const CACHED_FILES = @GODOT_CACHE@; @@ -13,26 +14,35 @@ const CACHABLE_FILES = @GODOT_OPT_CACHE@; const FULL_CACHE = CACHED_FILES.concat(CACHABLE_FILES); self.addEventListener("install", (event) => { - event.waitUntil(async function () { - const cache = await caches.open(CACHE_NAME); - // Clear old cache (including optionals). - await Promise.all(FULL_CACHE.map(path => cache.delete(path))); - // Insert new one. - const done = await cache.addAll(CACHED_FILES); - return done; - }()); + event.waitUntil(caches.open(CACHE_NAME).then(cache => cache.addAll(CACHED_FILES))); }); self.addEventListener("activate", (event) => { - event.waitUntil(async function () { - if ("navigationPreload" in self.registration) { - await self.registration.navigationPreload.enable(); - } - }()); - // Tell the active service worker to take control of the page immediately. - self.clients.claim(); + event.waitUntil(caches.keys().then( + function (keys) { + // Remove old caches. + return Promise.all(keys.filter(key => key.startsWith(CACHE_PREFIX) && key != CACHE_NAME).map(key => caches.delete(key))); + }).then(function() { + // Enable navigation preload if available. + return ("navigationPreload" in self.registration) ? self.registration.navigationPreload.enable() : Promise.resolve(); + }) + ); }); +async function fetchAndCache(event, cache, isCachable) { + // Use the preloaded response, if it's there + let response = await event.preloadResponse; + if (!response) { + // Or, go over network. + response = await self.fetch(event.request); + } + if (isCachable) { + // And update the cache + cache.put(event.request, response.clone()); + } + return response; +} + self.addEventListener("fetch", (event) => { const isNavigate = event.request.mode === "navigate"; const url = event.request.url || ""; @@ -42,32 +52,54 @@ self.addEventListener("fetch", (event) => { const isCachable = FULL_CACHE.some(v => v === local) || (base === referrer && base.endsWith(CACHED_FILES[0])); if (isNavigate || isCachable) { event.respondWith(async function () { - try { - // Use the preloaded response, if it's there - let request = event.request.clone(); - let response = await event.preloadResponse; - if (!response) { - // Or, go over network. - response = await fetch(event.request); - } - if (isCachable) { - // Update the cache - const cache = await caches.open(CACHE_NAME); - cache.put(request, response.clone()); - } - return response; - } catch (error) { - const cache = await caches.open(CACHE_NAME); - if (event.request.mode === "navigate") { - // Check if we have full cache. - const cached = await Promise.all(FULL_CACHE.map(name => cache.match(name))); - const missing = cached.some(v => v === undefined); - const cachedResponse = missing ? await caches.match(OFFLINE_URL) : await caches.match(CACHED_FILES[0]); - return cachedResponse; + // Try to use cache first + const cache = await caches.open(CACHE_NAME); + if (event.request.mode === "navigate") { + // Check if we have full cache during HTML page request. + const fullCache = await Promise.all(FULL_CACHE.map(name => cache.match(name))); + const missing = fullCache.some(v => v === undefined); + if (missing) { + try { + // Try network if some cached file is missing (so we can display offline page in case). + return await fetchAndCache(event, cache, isCachable); + } catch (e) { + // And return the hopefully always cached offline page in case of network failure. + console.error("Network error: ", e); + return await caches.match(OFFLINE_URL); + } } - const cachedResponse = await caches.match(event.request); - return cachedResponse; + } + const cached = await cache.match(event.request); + if (cached) { + return cached; + } else { + // Try network if don't have it in cache. + return await fetchAndCache(event, cache, isCachable); } }()); } }); + +self.addEventListener("message", (event) => { + // No cross origin + if (event.origin != self.origin) { + return; + } + const id = event.source.id || ""; + const msg = event.data || ""; + // Ensure it's one of our clients. + self.clients.get(id).then(function (client) { + if (!client) { + return; // Not a valid client. + } + if (msg === "claim") { + self.skipWaiting().then(() => self.clients.claim()); + } else if (msg === "clear") { + caches.delete(CACHE_NAME); + } else if (msg === "update") { + self.skipWaiting().then(() => self.clients.claim()).then(() => self.clients.matchAll()).then(all => all.forEach(c => c.navigate(c.url))); + } else { + onClientMessage(event); + } + }); +}); diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj index fd69725a21..69899cbe8d 100644 --- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj +++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj @@ -45,6 +45,7 @@ D0BCFE3418AEBDA2004A7AAE /* $binary.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "$binary.app"; sourceTree = BUILT_PRODUCTS_DIR; }; D0BCFE4318AEBDA2004A7AAE /* $binary-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "$binary-Info.plist"; sourceTree = "<group>"; }; D0BCFE4518AEBDA2004A7AAE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; + $pbx_locale_file_reference D0BCFE7718AEBFEB004A7AAE /* $binary.pck */ = {isa = PBXFileReference; lastKnownFileType = file; path = "$binary.pck"; sourceTree = "<group>"; }; $pbx_launch_screen_file_reference /* End PBXFileReference section */ @@ -207,6 +208,7 @@ isa = PBXVariantGroup; children = ( D0BCFE4518AEBDA2004A7AAE /* en */, + $pbx_locale_build_reference ); name = InfoPlist.strings; sourceTree = "<group>"; @@ -308,6 +310,7 @@ CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements"; CODE_SIGN_IDENTITY = "$code_sign_identity_debug"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_debug"; + CODE_SIGN_STYLE = "$code_sign_style_debug"; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; DEVELOPMENT_TEAM = $team_id; INFOPLIST_FILE = "$binary/$binary-Info.plist"; @@ -324,7 +327,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "$provisioning_profile_uuid_debug"; TARGETED_DEVICE_FAMILY = "$targeted_device_family"; - VALID_ARCHS = "armv7 armv7s arm64 i386 x86_64"; + VALID_ARCHS = "arm64 x86_64"; WRAPPER_EXTENSION = app; }; name = Debug; @@ -338,6 +341,7 @@ CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements"; CODE_SIGN_IDENTITY = "$code_sign_identity_release"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_release"; + CODE_SIGN_STYLE = "$code_sign_style_release"; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; DEVELOPMENT_TEAM = $team_id; INFOPLIST_FILE = "$binary/$binary-Info.plist"; @@ -354,7 +358,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "$provisioning_profile_uuid_release"; TARGETED_DEVICE_FAMILY = "$targeted_device_family"; - VALID_ARCHS = "armv7 armv7s arm64 i386 x86_64"; + VALID_ARCHS = "arm64 x86_64"; WRAPPER_EXTENSION = app; }; name = Release; diff --git a/misc/dist/linux/godot.6 b/misc/dist/linux/godot.6 index 3e5bdefdce..07e2a389a7 100644 --- a/misc/dist/linux/godot.6 +++ b/misc/dist/linux/godot.6 @@ -150,9 +150,6 @@ Disallow dumping the base types (used with \fB\-\-doctool\fR). \fB\-\-build\-solutions\fR Build the scripting solutions (e.g. for C# projects). Implies \-\-editor and requires a valid project to edit. .TP -\fB\-\-gdnative\-generate\-json\-api\fR -Generate JSON dump of the Godot API for GDNative bindings. -.TP \fB\-\-test\fR <test> Run a unit test ('string', 'math', 'physics', 'physics_2d', 'render', 'oa_hash_map', 'gui', 'shaderlang', 'gd_tokenizer', 'gd_parser', 'gd_compiler', 'gd_bytecode', 'ordered_hash_map', 'astar'). .SH FILES diff --git a/misc/dist/linux/org.godotengine.Godot.desktop b/misc/dist/linux/org.godotengine.Godot.desktop index 8b74234174..db0c80e4f1 100644 --- a/misc/dist/linux/org.godotengine.Godot.desktop +++ b/misc/dist/linux/org.godotengine.Godot.desktop @@ -1,7 +1,13 @@ [Desktop Entry] Name=Godot Engine GenericName=Libre game engine +GenericName[el]=Ελεύθερη μηχανή παιχνιδιού +GenericName[fr]=Moteur de jeu libre +GenericName[zh_CN]=自由的游戏引擎 Comment=Multi-platform 2D and 3D game engine with a feature-rich editor +Comment[el]=2D και 3D μηχανή παιχνιδιού πολλαπλών πλατφορμών με επεξεργαστή πλούσιο σε χαρακτηριστικά +Comment[fr]=Moteur de jeu 2D et 3D multiplateforme avec un éditeur riche en fonctionnalités +Comment[zh_CN]=多平台 2D 和 3D 游戏引擎,带有功能丰富的编辑器 Exec=godot %f Icon=godot Terminal=false @@ -9,3 +15,4 @@ PrefersNonDefaultGPU=true Type=Application MimeType=application/x-godot-project; Categories=Development;IDE; +StartupWMClass=Godot diff --git a/misc/dist/osx_template.app/Contents/Info.plist b/misc/dist/osx_template.app/Contents/Info.plist index a087550290..542146cdb8 100644 --- a/misc/dist/osx_template.app/Contents/Info.plist +++ b/misc/dist/osx_template.app/Contents/Info.plist @@ -8,8 +8,8 @@ <string>$binary</string> <key>CFBundleName</key> <string>$name</string> - <key>CFBundleGetInfoString</key> - <string>$info</string> + <key>CFBundleDisplayName</key> + <string>$name</string> <key>CFBundleIconFile</key> <string>icon.icns</string> <key>CFBundleIdentifier</key> diff --git a/misc/dist/osx_tools.app/Contents/Info.plist b/misc/dist/osx_tools.app/Contents/Info.plist index 221c4b7a81..886df87cc6 100644 --- a/misc/dist/osx_tools.app/Contents/Info.plist +++ b/misc/dist/osx_tools.app/Contents/Info.plist @@ -8,8 +8,6 @@ <string>Godot</string> <key>CFBundleName</key> <string>Godot</string> - <key>CFBundleGetInfoString</key> - <string>(c) 2007-2022 Juan Linietsky, Ariel Manzur & Godot Engine contributors</string> <key>CFBundleIconFile</key> <string>Godot.icns</string> <key>CFBundleIdentifier</key> diff --git a/misc/dist/osx_tools.app/Contents/Resources/en.lproj/InfoPlist.strings b/misc/dist/osx_tools.app/Contents/Resources/en.lproj/InfoPlist.strings new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/misc/dist/osx_tools.app/Contents/Resources/en.lproj/InfoPlist.strings diff --git a/misc/dist/shell/_godot.zsh-completion b/misc/dist/shell/_godot.zsh-completion index 9d42f4fe05..aaa5fe0a06 100644 --- a/misc/dist/shell/_godot.zsh-completion +++ b/misc/dist/shell/_godot.zsh-completion @@ -30,10 +30,11 @@ _arguments \ '(-h --help)'{-h,--help}'[display the full help message]' \ '--version[display the version string]' \ '(-v --verbose)'{-v,--verbose}'[use verbose stdout mode]' \ - '--quiet[quiet mode, silences stdout messages (errors are still displayed)]' \ + '(-q --quiet)'{-q,--quiet}'[quiet mode, silences stdout messages (errors are still displayed)]' \ '(-e --editor)'{-e,--editor}'[start the editor instead of running the scene]' \ '(-p --project-manager)'{-p,--project-manager}'[start the project manager, even if a project is auto-detected]' \ - '(-q --quit)'{-q,--quit}'[quit after the first iteration]' \ + '--debug-server[start the editor debug server]:editor debugger listen address' \ + '--quit[quit after the first iteration]' \ '(-l --language)'{-l,--language}'[use a specific locale (<locale> being a two-letter code)]:two-letter locale code' \ "--path[path to a project (<directory> must contain a 'project.godot' file)]:path to directory with 'project.godot' file:_dirs" \ '(-u --upwards)'{-u,--upwards}'[scan folders upwards for project.godot file]' \ @@ -42,7 +43,12 @@ _arguments \ '--remote-fs[use a remote filesystem]:remote filesystem address' \ '--remote-fs-password[password for remote filesystem]:remote filesystem password' \ '--audio-driver[set the audio driver]:audio driver name' \ - "--video-driver[set the video driver]:video driver name:((Vulkan\:'Vulkan renderer' GLES2\:'OpenGL ES 2.0 renderer'))" \ + '--display-driver[set the display driver]:display driver name' \ + "--rendering-driver[set the rendering driver]:rendering driver name:((vulkan\:'Vulkan renderer' opengl3\:'OpenGL ES 3.0 renderer' dummy\:'Dummy renderer'))" \ + "--gpu-index[use a specific GPU (run with --verbose to get available device list)]:device index" \ + '--text-driver[set the text driver]:text driver name' \ + '--tablet-driver[set the pen tablet input driver]:tablet driver name' \ + '--headless[enable headless mode (--display-driver headless --audio-driver Dummy), useful for servers and with --script]' \ '(-f --fullscreen)'{-f,--fullscreen}'[request fullscreen mode]' \ '(-m --maximized)'{-m,--maximized}'[request a maximized window]' \ '(-w --windowed)'{-w,--windowed}'[request windowed mode]' \ @@ -50,12 +56,17 @@ _arguments \ '--resolution[request window resolution]:resolution in WxH format' \ '--position[request window position]:position in X,Y format' \ '--headless[enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script]' \ + '--single-window[use a single window (no separate subwindows)]' \ '(-d --debug)'{-d,--debug}'[debug (local stdout debugger)]' \ '(-b --breakpoints)'{-b,--breakpoints}'[specify the breakpoint list as source::line comma-separated pairs, no spaces (use %20 instead)]:breakpoint list' \ '--profiling[enable profiling in the script debugger]' \ + '--gpu-profile[show a GPU profile of the tasks that took the most time during frame rendering]' \ + '--vk-layers[enable Vulkan validation layers for debugging]' \ + '--gpu-abort[abort on GPU errors (usually validation layer errors)]' \ '--remote-debug[enable remote debugging]:remote debugger address' \ '--debug-collisions[show collision shapes when running the scene]' \ '--debug-navigation[show navigation polygons when running the scene]' \ + '--debug-stringnames[print all StringName allocations to stdout when the engine quits]' \ '--frame-delay[simulate high CPU load (delay each frame by the given number of milliseconds)]:number of milliseconds' \ '--time-scale[force time scale (higher values are faster, 1.0 is normal speed)]:time scale' \ '--disable-render-loop[disable render loop so rendering only occurs when called explicitly from script]' \ @@ -64,11 +75,11 @@ _arguments \ '--print-fps[print the frames per second to the stdout]' \ '(-s, --script)'{-s,--script}'[run a script]:path to script:_files' \ '--check-only[only parse for errors and quit (use with --script)]' \ - '--export[export the project using the given preset and matching release template]:export preset name' \ - '--export-debug[same as --export, but using the debug template]:export preset name' \ - '--export-pack[same as --export, but only export the game pack for the given preset]:export preset name' \ - '--doctool[dump the engine API reference to the given path in XML format, merging if existing files are found]:path to base Godot build directory:_dirs' \ + '--export[export the project using the given preset and matching release template]:export preset name then path' \ + '--export-debug[same as --export, but using the debug template]:export preset name then path' \ + '--export-pack[same as --export, but only export the game pack for the given preset]:export preset name then path' \ + '--doctool[dump the engine API reference to the given path in XML format, merging if existing files are found]:path to base Godot build directory (optional):_dirs' \ '--no-docbase[disallow dumping the base types (used with --doctool)]' \ '--build-solutions[build the scripting solutions (e.g. for C# projects)]' \ - '--gdnative-generate-json-api[generate JSON dump of the Godot API for GDNative bindings]' \ - '--test[run a unit test]:unit test name' + '--dump-extension-api[generate JSON dump of the Godot API for GDExtension bindings named "extension_api.json" in the current folder]' \ + '--test[run all unit tests; run with "--test --help" for more information]' diff --git a/misc/dist/shell/godot.bash-completion b/misc/dist/shell/godot.bash-completion index eeee538aba..7927d26171 100644 --- a/misc/dist/shell/godot.bash-completion +++ b/misc/dist/shell/godot.bash-completion @@ -36,6 +36,7 @@ _complete_godot_options() { --quiet --editor --project-manager +--debug-server --quit --language --path @@ -45,7 +46,12 @@ _complete_godot_options() { --remote-fs --remote-fs-password --audio-driver ---video-driver +--display-driver +--rendering-driver +--gpu-index +--text-driver +--tablet-driver +--headless --fullscreen --maximized --windowed @@ -53,12 +59,17 @@ _complete_godot_options() { --resolution --position --headless +--single-window --debug --breakpoints --profiling +--gpu-profile +--vk-layers +--gpu-abort --remote-debug --debug-collisions --debug-navigation +--debug-stringnames --frame-delay --time-scale --disable-render-loop @@ -73,7 +84,7 @@ _complete_godot_options() { --doctool --no-docbase --build-solutions ---gdnative-generate-json-api +--dump-extension-api --test " -- "$1")) } @@ -99,10 +110,10 @@ _complete_godot_bash() { local IFS=$' \n\t' # shellcheck disable=SC2207 COMPREPLY=($(compgen -W "unsafe safe separate" -- "$cur")) - elif [[ $prev == "--video-driver" ]]; then + elif [[ $prev == "--rendering-driver" ]]; then local IFS=$' \n\t' # shellcheck disable=SC2207 - COMPREPLY=($(compgen -W "Vulkan GLES2" -- "$cur")) + COMPREPLY=($(compgen -W "vulkan opengl3 dummy" -- "$cur")) elif [[ $prev == "--path" || $prev == "--doctool" ]]; then local IFS=$'\n\t' # shellcheck disable=SC2207 diff --git a/misc/dist/shell/godot.fish b/misc/dist/shell/godot.fish index 79df2de7f0..c05aa74017 100644 --- a/misc/dist/shell/godot.fish +++ b/misc/dist/shell/godot.fish @@ -23,10 +23,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -function godot_video_driver_args +function godot_rendering_driver_args # Use a function instead of a fixed string to customize the argument descriptions. - echo -e "Vulkan\tVulkan renderer" - echo -e "GLES2\tOpenGL ES 2.0 renderer" + echo -e "vulkan\tVulkan renderer" + echo -e "opengl3\tOpenGL ES 3.0 renderer" + echo -e "dummy\tDummy renderer" end # Erase existing completions for Godot. @@ -36,12 +37,13 @@ complete -c godot -e complete -c godot -s h -l help -d "Display the full help message" complete -c godot -l version -d "Display the version string" complete -c godot -s v -l verbose -d "Use verbose stdout mode" -complete -c godot -l quiet -d "Quiet mode, silences stdout messages (errors are still displayed)" +complete -c godot -s q -l quiet -d "Quiet mode, silences stdout messages (errors are still displayed)" # Run options: complete -c godot -s e -l editor -d "Start the editor instead of running the scene" complete -c godot -s p -l project-manager -d "Start the project manager, even if a project is auto-detected" -complete -c godot -s q -l quit -d "Quit after the first iteration" +complete -c godot -l debug-server -d "Start the editor debug server (<protocol>://<host/IP>[:<port>] address)" -x +complete -c godot -l quit -d "Quit after the first iteration" complete -c godot -s l -l language -d "Use a specific locale (<locale> being a two-letter code)" -x complete -c godot -l path -d "Path to a project (<directory> must contain a 'project.godot' file)" -r complete -c godot -s u -l upwards -d "Scan folders upwards for project.godot file" @@ -50,7 +52,12 @@ complete -c godot -l render-thread -d "Set the render thread mode" -x -a "unsafe complete -c godot -l remote-fs -d "Use a remote filesystem (<host/IP>[:<port>] address)" -x complete -c godot -l remote-fs-password -d "Password for remote filesystem" -x complete -c godot -l audio-driver -d "Set the audio driver" -x -complete -c godot -l video-driver -d "Set the video driver" -x -a "(godot_video_driver_args)" +complete -c godot -l display-driver -d "Set the display driver" -x +complete -c godot -l rendering-driver -d "Set the rendering driver" -x -a "(godot_rendering_driver_args)" +complete -c godot -l gpu-index -d "Use a specific GPU (run with --verbose to get available device list)" -x +complete -c godot -l text-driver -d "Set the text driver" -x +complete -c godot -l tablet-driver -d "Set the pen tablet input driver" -x +complete -c godot -l headless -d "Enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script" # Display options: complete -c godot -s f -l fullscreen -d "Request fullscreen mode" @@ -60,14 +67,19 @@ complete -c godot -s t -l always-on-top -d "Request an always-on-top window" complete -c godot -l resolution -d "Request window resolution" -x complete -c godot -l position -d "Request window position" -x complete -c godot -l headless -d "Enable headless mode (--display-driver headless --audio-driver Dummy). Useful for servers and with --script" +complete -c godot -l single-window -d "Use a single window (no separate subwindows)" # Debug options: complete -c godot -s d -l debug -d "Debug (local stdout debugger)" complete -c godot -s b -l breakpoints -d "Specify the breakpoint list as source::line comma-separated pairs, no spaces (use %20 instead)" -x complete -c godot -l profiling -d "Enable profiling in the script debugger" +complete -c godot -l gpu-profile -d "Show a GPU profile of the tasks that took the most time during frame rendering" +complete -c godot -l vk-layers -d "Enable Vulkan validation layers for debugging" +complete -c godot -l gpu-abort -d "Abort on GPU errors (usually validation layer errors)" complete -c godot -l remote-debug -d "Enable remote debugging" complete -c godot -l debug-collisions -d "Show collision shapes when running the scene" complete -c godot -l debug-navigation -d "Show navigation polygons when running the scene" +complete -c godot -l debug-stringnames -d "Print all StringName allocations to stdout when the engine quits" complete -c godot -l frame-delay -d "Simulate high CPU load (delay each frame by the given number of milliseconds)" -x complete -c godot -l time-scale -d "Force time scale (higher values are faster, 1.0 is normal speed)" -x complete -c godot -l disable-render-loop -d "Disable render loop so rendering only occurs when called explicitly from script" @@ -84,5 +96,5 @@ complete -c godot -l export-pack -d "Same as --export, but only export the game complete -c godot -l doctool -d "Dump the engine API reference to the given path in XML format, merging if existing files are found" -r complete -c godot -l no-docbase -d "Disallow dumping the base types (used with --doctool)" complete -c godot -l build-solutions -d "Build the scripting solutions (e.g. for C# projects)" -complete -c godot -l gdnative-generate-json-api -d "Generate JSON dump of the Godot API for GDNative bindings" -complete -c godot -l test -d "Run a unit test" -x +complete -c godot -l dump-extension-api -d "Generate JSON dump of the Godot API for GDExtension bindings named 'extension_api.json' in the current folder" +complete -c godot -l test -d "Run all unit tests; run with '--test --help' for more information" -x diff --git a/misc/hooks/pre-commit-black b/misc/hooks/pre-commit-black index 8e22e6068e..fd93bfe73c 100755 --- a/misc/hooks/pre-commit-black +++ b/misc/hooks/pre-commit-black @@ -139,11 +139,11 @@ fi while true; do if [ $terminal = "0" ] ; then if [ -x "$ZENITY" ] ; then - ans=$($ZENITY --text-info --filename="$patch" --width=800 --height=600 --title="Do you want to apply that patch?" --ok-label="Apply" --cancel-label="Do not apply" --extra-button="Apply and stage") + choice=$($ZENITY --text-info --filename="$patch" --width=800 --height=600 --title="Do you want to apply that patch?" --ok-label="Apply" --cancel-label="Do not apply" --extra-button="Apply and stage") if [ "$?" = "0" ] ; then yn="Y" else - if [ "$ans" = "Apply and stage" ] ; then + if [ "$choice" = "Apply and stage" ] ; then yn="S" else yn="N" @@ -151,10 +151,10 @@ while true; do fi elif [ -x "$XMSG" ] ; then $XMSG -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?" - ans=$? - if [ "$ans" = "100" ] ; then + choice=$? + if [ "$choice" = "100" ] ; then yn="Y" - elif [ "$ans" = "200" ] ; then + elif [ "$choice" = "200" ] ; then yn="S" else yn="N" @@ -162,10 +162,10 @@ while true; do elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")" $PWSH -noprofile -executionpolicy bypass -file "$winmessage" -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?" - ans=$? - if [ "$ans" = "100" ] ; then + choice=$? + if [ "$choice" = "100" ] ; then yn="Y" - elif [ "$ans" = "200" ] ; then + elif [ "$choice" = "200" ] ; then yn="S" else yn="N" diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format index de5d9c3f06..e8e62e6470 100755 --- a/misc/hooks/pre-commit-clang-format +++ b/misc/hooks/pre-commit-clang-format @@ -77,7 +77,7 @@ fi # To get consistent formatting, we recommend contributors to use the same # clang-format version as CI. RECOMMENDED_CLANG_FORMAT_MAJOR_MIN="12" -RECOMMENDED_CLANG_FORMAT_MAJOR_MAX="13" +RECOMMENDED_CLANG_FORMAT_MAJOR_MAX="14" if [ ! -x "$CLANG_FORMAT" ] ; then message="Error: clang-format executable not found. Please install clang-format $RECOMMENDED_CLANG_FORMAT_MAJOR_MAX." @@ -179,11 +179,11 @@ fi while true; do if [ $terminal = "0" ] ; then if [ -x "$ZENITY" ] ; then - ans=$($ZENITY --text-info --filename="$patch" --width=800 --height=600 --title="Do you want to apply that patch?" --ok-label="Apply" --cancel-label="Do not apply" --extra-button="Apply and stage") + choice=$($ZENITY --text-info --filename="$patch" --width=800 --height=600 --title="Do you want to apply that patch?" --ok-label="Apply" --cancel-label="Do not apply" --extra-button="Apply and stage") if [ "$?" = "0" ] ; then yn="Y" else - if [ "$ans" = "Apply and stage" ] ; then + if [ "$choice" = "Apply and stage" ] ; then yn="S" else yn="N" @@ -191,10 +191,10 @@ while true; do fi elif [ -x "$XMSG" ] ; then $XMSG -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?" - ans=$? - if [ "$ans" = "100" ] ; then + choice=$? + if [ "$choice" = "100" ] ; then yn="Y" - elif [ "$ans" = "200" ] ; then + elif [ "$choice" = "200" ] ; then yn="S" else yn="N" @@ -202,10 +202,10 @@ while true; do elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")" $PWSH -noprofile -executionpolicy bypass -file "$winmessage" -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?" - ans=$? - if [ "$ans" = "100" ] ; then + choice=$? + if [ "$choice" = "100" ] ; then yn="Y" - elif [ "$ans" = "200" ] ; then + elif [ "$choice" = "200" ] ; then yn="S" else yn="N" diff --git a/misc/scripts/black_format.sh b/misc/scripts/black_format.sh index 2ad9a23832..f6fac58e50 100755 --- a/misc/scripts/black_format.sh +++ b/misc/scripts/black_format.sh @@ -6,28 +6,20 @@ set -uo pipefail # Apply black. echo -e "Formatting Python files..." -PY_FILES=$(find \( -path "./.git" \ - -o -path "./thirdparty" \ - \) -prune \ - -o \( -name "SConstruct" \ - -o -name "SCsub" \ - -o -name "*.py" \ - \) -print) +PY_FILES=$(git ls-files -- '*SConstruct' '*SCsub' '*.py' ':!:.git/*' ':!:thirdparty/*') black -l 120 $PY_FILES -git diff --color > patch.patch +diff=$(git diff --color) -# If no patch has been generated all is OK, clean up, and exit. -if [ ! -s patch.patch ] ; then +# If no diff has been generated all is OK, clean up, and exit. +if [ -z "$diff" ] ; then printf "Files in this commit comply with the black style rules.\n" - rm -f patch.patch exit 0 fi -# A patch has been created, notify the user, clean up, and exit. +# A diff has been created, notify the user, clean up, and exit. printf "\n*** The following differences were found between the code " printf "and the formatting rules:\n\n" -cat patch.patch +echo "$diff" printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n" -rm -f patch.patch exit 1 diff --git a/misc/scripts/clang_format.sh b/misc/scripts/clang_format.sh index 0006b82280..ba30ca8924 100755 --- a/misc/scripts/clang_format.sh +++ b/misc/scripts/clang_format.sh @@ -4,53 +4,38 @@ # This is the primary script responsible for fixing style violations. set -uo pipefail -IFS=$'\n\t' -CLANG_FORMAT_FILE_EXTS=(".c" ".h" ".cpp" ".hpp" ".cc" ".hh" ".cxx" ".m" ".mm" ".inc" ".java" ".glsl") +# Loops through all code files tracked by Git. +git ls-files -- '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh' '*.cxx' '*.m' '*.mm' '*.inc' '*.java' '*.glsl' \ + ':!:.git/*' ':!:thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' ':!:*-so_wrap.*' | +while read -r f; do + # Run clang-format. + clang-format --Wno-error=unknown -i "$f" -# Loops through all text files tracked by Git. -git grep -zIl '' | -while IFS= read -rd '' f; do - # Exclude some files. - if [[ "$f" == "thirdparty"* ]]; then + # Fix copyright headers, but not all files get them. + if [[ "$f" == *"inc" ]]; then continue - elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then + elif [[ "$f" == *"glsl" ]]; then continue - elif [[ "$f" == *"-so_wrap."* ]]; then + elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView"* ]]; then + continue + elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper"* ]]; then continue fi - for extension in ${CLANG_FORMAT_FILE_EXTS[@]}; do - if [[ "$f" == *"$extension" ]]; then - # Run clang-format. - clang-format --Wno-error=unknown -i "$f" - # Fix copyright headers, but not all files get them. - if [[ "$f" == *"inc" ]]; then - continue 2 - elif [[ "$f" == *"glsl" ]]; then - continue 2 - elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/input/InputManager"* ]]; then - continue 2 - fi - python misc/scripts/copyright_headers.py "$f" - continue 2 - fi - done + python misc/scripts/copyright_headers.py "$f" done -git diff --color > patch.patch +diff=$(git diff --color) -# If no patch has been generated all is OK, clean up, and exit. -if [ ! -s patch.patch ] ; then +# If no diff has been generated all is OK, clean up, and exit. +if [ -z "$diff" ] ; then printf "Files in this commit comply with the clang-format style rules.\n" - rm -f patch.patch exit 0 fi -# A patch has been created, notify the user, clean up, and exit. -printf "\n*** The following differences were found between the code " -printf "and the formatting rules:\n\n" -cat patch.patch -printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n" -rm -f patch.patch +# A diff has been created, notify the user, clean up, and exit. +printf "\n*** The following changes have been made to comply with the formatting rules:\n\n" +echo "$diff" +printf "\n*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n" exit 1 diff --git a/misc/scripts/clang_tidy.sh b/misc/scripts/clang_tidy.sh new file mode 100755 index 0000000000..63c1b10042 --- /dev/null +++ b/misc/scripts/clang_tidy.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# This script runs clang-tidy on all relevant files in the repo. +# This is more thorough than clang-format and thus slower; it should only be run manually. + +set -uo pipefail + +# Loops through all code files tracked by Git. +git ls-files -- '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh' '*.cxx' '*.m' '*.mm' '*.inc' '*.java' '*.glsl' \ + ':!:.git/*' ':!:thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' ':!:*-so_wrap.*' | +while read -r f; do + # Run clang-tidy. + clang-tidy --quiet --fix "$f" &> /dev/null + + # Run clang-format. This also fixes the output of clang-tidy. + clang-format --Wno-error=unknown -i "$f" +done + +diff=$(git diff --color) + +# If no diff has been generated all is OK, clean up, and exit. +if [ -z "$diff" ] ; then + printf "Files in this commit comply with the clang-tidy style rules.\n" + exit 0 +fi + +# A diff has been created, notify the user, clean up, and exit. +printf "\n*** The following changes have been made to comply with the formatting rules:\n\n" +echo "$diff" +printf "\n*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n" +exit 1 diff --git a/misc/scripts/codespell.sh b/misc/scripts/codespell.sh new file mode 100644 index 0000000000..7c5f824b5e --- /dev/null +++ b/misc/scripts/codespell.sh @@ -0,0 +1,5 @@ +#!/bin/sh +SKIP_LIST="./thirdparty,*.gen.*,*.po,*.pot,package-lock.json,./core/string/locales.h,./DONORS.md,./misc/scripts/codespell.sh" +IGNORE_LIST="ba,childs,complies,curvelinear,expct,fave,findn,gird,inout,lod,nd,numer,ois,ro,statics,te,varn" + +codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}" diff --git a/misc/scripts/file_format.sh b/misc/scripts/file_format.sh index e66bc88bc0..c767d3f8a0 100755 --- a/misc/scripts/file_format.sh +++ b/misc/scripts/file_format.sh @@ -47,19 +47,17 @@ while IFS= read -rd '' f; do perl -i -ple 's/\s*$//g' "$f" done -git diff --color > patch.patch +diff=$(git diff --color) -# If no patch has been generated all is OK, clean up, and exit. -if [ ! -s patch.patch ] ; then +# If no diff has been generated all is OK, clean up, and exit. +if [ -z "$diff" ] ; then printf "Files in this commit comply with the formatting rules.\n" - rm -f patch.patch exit 0 fi -# A patch has been created, notify the user, clean up, and exit. +# A diff has been created, notify the user, clean up, and exit. printf "\n*** The following differences were found between the code " printf "and the formatting rules:\n\n" -cat patch.patch +echo "$diff" printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n" -rm -f patch.patch exit 1 |