summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/dist/html/editor.html38
-rw-r--r--misc/dist/html/manifest.json1
-rw-r--r--misc/dist/html/service-worker.js112
-rw-r--r--misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj6
-rw-r--r--misc/dist/linux/godot.63
-rw-r--r--misc/dist/osx_template.app/Contents/Info.plist2
-rw-r--r--misc/dist/osx_tools.app/Contents/Resources/en.lproj/InfoPlist.strings0
-rw-r--r--misc/dist/shell/_godot.zsh-completion1
-rw-r--r--misc/dist/shell/godot.bash-completion1
-rw-r--r--misc/dist/shell/godot.fish1
-rwxr-xr-xmisc/hooks/pre-commit-black16
-rwxr-xr-xmisc/hooks/pre-commit-clang-format16
-rw-r--r--misc/scripts/codespell.sh5
13 files changed, 133 insertions, 69 deletions
diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html
index a681a2a1c3..8d436038c1 100644
--- a/misc/dist/html/editor.html
+++ b/misc/dist/html/editor.html
@@ -265,12 +265,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 />
@@ -324,10 +325,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 (localStorage.getItem("welcomeModalDismissed") !== 'true') {
@@ -342,7 +372,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 5ba45c0c13..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>";
@@ -325,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;
@@ -356,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/osx_template.app/Contents/Info.plist b/misc/dist/osx_template.app/Contents/Info.plist
index a087550290..43399ec6ce 100644
--- a/misc/dist/osx_template.app/Contents/Info.plist
+++ b/misc/dist/osx_template.app/Contents/Info.plist
@@ -8,6 +8,8 @@
<string>$binary</string>
<key>CFBundleName</key>
<string>$name</string>
+ <key>CFBundleDisplayName</key>
+ <string>$name</string>
<key>CFBundleGetInfoString</key>
<string>$info</string>
<key>CFBundleIconFile</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..8548b18cb0 100644
--- a/misc/dist/shell/_godot.zsh-completion
+++ b/misc/dist/shell/_godot.zsh-completion
@@ -70,5 +70,4 @@ _arguments \
'--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' \
'--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'
diff --git a/misc/dist/shell/godot.bash-completion b/misc/dist/shell/godot.bash-completion
index eeee538aba..56bf23a268 100644
--- a/misc/dist/shell/godot.bash-completion
+++ b/misc/dist/shell/godot.bash-completion
@@ -73,7 +73,6 @@ _complete_godot_options() {
--doctool
--no-docbase
--build-solutions
---gdnative-generate-json-api
--test
" -- "$1"))
}
diff --git a/misc/dist/shell/godot.fish b/misc/dist/shell/godot.fish
index 79df2de7f0..6aa3f38f1f 100644
--- a/misc/dist/shell/godot.fish
+++ b/misc/dist/shell/godot.fish
@@ -84,5 +84,4 @@ 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
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..2ee3f569d5 100755
--- a/misc/hooks/pre-commit-clang-format
+++ b/misc/hooks/pre-commit-clang-format
@@ -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/codespell.sh b/misc/scripts/codespell.sh
new file mode 100644
index 0000000000..2822c6421b
--- /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,curvelinear,expct,fave,findn,gird,inout,lod,nd,numer,ois,ro,statics,te,varn"
+
+codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}"