diff options
Diffstat (limited to 'misc')
49 files changed, 1026 insertions, 1151 deletions
diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html index 93afbf085d..e5c68c6338 100644 --- a/misc/dist/html/editor.html +++ b/misc/dist/html/editor.html @@ -23,7 +23,7 @@ <link id="-gd-engine-icon" rel="icon" type="image/png" href="favicon.png"> <link rel="apple-touch-icon" type="image/png" href="favicon.png"> <link rel="manifest" href="manifest.json"> - <title>Godot Engine Web Editor (@GODOT_VERSION@)</title> + <title>Godot Engine Web Editor (___GODOT_VERSION___)</title> <style> *:focus { /* More visible outline for better keyboard navigation. */ @@ -294,7 +294,7 @@ a:active { <br > <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@ + ___GODOT_VERSION___ <br > <a href="releases/">Need an old version?</a> <br > @@ -384,7 +384,9 @@ window.addEventListener('load', () => { }); } - const missing = Engine.getMissingFeatures(); + const missing = Engine.getMissingFeatures({ + threads: ___GODOT_THREADS_ENABLED___, + }); if (missing.length) { // Display error dialog as threading support is required for the editor. document.getElementById('startButton').disabled = 'disabled'; diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html index 6710cb1533..8ae25362f8 100644 --- a/misc/dist/html/full-size.html +++ b/misc/dist/html/full-size.html @@ -136,6 +136,7 @@ body { <script src="$GODOT_URL"></script> <script> const GODOT_CONFIG = $GODOT_CONFIG; +const GODOT_THREADS_ENABLED = $GODOT_THREADS_ENABLED; const engine = new Engine(GODOT_CONFIG); (function () { @@ -213,10 +214,33 @@ const engine = new Engine(GODOT_CONFIG); initializing = false; } - const missing = Engine.getMissingFeatures(); + const missing = Engine.getMissingFeatures({ + threads: GODOT_THREADS_ENABLED, + }); if (missing.length !== 0) { - const missingMsg = 'Error\nThe following features required to run Godot projects on the Web are missing:\n'; - displayFailureNotice(missingMsg + missing.join('\n')); + if (GODOT_CONFIG['serviceWorker'] && GODOT_CONFIG['ensureCrossOriginIsolationHeaders'] && 'serviceWorker' in navigator) { + // There's a chance that installing the service worker would fix the issue + Promise.race([ + navigator.serviceWorker.getRegistration().then((registration) => { + if (registration != null) { + return Promise.reject(new Error('Service worker already exists.')); + } + return registration; + }).then(() => engine.installServiceWorker()), + // For some reason, `getRegistration()` can stall + new Promise((resolve) => { + setTimeout(() => resolve(), 2000); + }), + ]).catch((err) => { + console.error('Error while registering service worker:', err); + }).then(() => { + window.location.reload(); + }); + } else { + // Display the message as usual + const missingMsg = 'Error\nThe following features required to run Godot projects on the Web are missing:\n'; + displayFailureNotice(missingMsg + missing.join('\n')); + } } else { setStatusMode('indeterminate'); engine.startGame({ diff --git a/misc/dist/html/service-worker.js b/misc/dist/html/service-worker.js index 310574f21d..a5da7482f4 100644 --- a/misc/dist/html/service-worker.js +++ b/misc/dist/html/service-worker.js @@ -3,101 +3,163 @@ // that they need an Internet connection to run the project if desired. // 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_PREFIX = "@GODOT_NAME@-sw-cache-"; +/** @type {string} */ +const CACHE_VERSION = '___GODOT_VERSION___'; +/** @type {string} */ +const CACHE_PREFIX = '___GODOT_NAME___-sw-cache-'; const CACHE_NAME = CACHE_PREFIX + CACHE_VERSION; -const OFFLINE_URL = "@GODOT_OFFLINE_PAGE@"; +/** @type {string} */ +const OFFLINE_URL = '___GODOT_OFFLINE_PAGE___'; +/** @type {boolean} */ +const ENSURE_CROSSORIGIN_ISOLATION_HEADERS = ___GODOT_ENSURE_CROSSORIGIN_ISOLATION_HEADERS___; // Files that will be cached on load. -const CACHED_FILES = @GODOT_CACHE@; +/** @type {string[]} */ +const CACHED_FILES = ___GODOT_CACHE___; // Files that we might not want the user to preload, and will only be cached on first load. -const CACHABLE_FILES = @GODOT_OPT_CACHE@; +/** @type {string[]} */ +const CACHABLE_FILES = ___GODOT_OPT_CACHE___; const FULL_CACHE = CACHED_FILES.concat(CACHABLE_FILES); -self.addEventListener("install", (event) => { - event.waitUntil(caches.open(CACHE_NAME).then(cache => cache.addAll(CACHED_FILES))); +self.addEventListener('install', (event) => { + event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(CACHED_FILES))); }); -self.addEventListener("activate", (event) => { +self.addEventListener('activate', (event) => { 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(); - }) - ); + 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) { +/** + * Ensures that the response has the correct COEP/COOP headers + * @param {Response} response + * @returns {Response} + */ +function ensureCrossOriginIsolationHeaders(response) { + if (response.headers.get('Cross-Origin-Embedder-Policy') === 'require-corp' + && response.headers.get('Cross-Origin-Opener-Policy') === 'same-origin') { + return response; + } + + const crossOriginIsolatedHeaders = new Headers(response.headers); + crossOriginIsolatedHeaders.set('Cross-Origin-Embedder-Policy', 'require-corp'); + crossOriginIsolatedHeaders.set('Cross-Origin-Opener-Policy', 'same-origin'); + const newResponse = new Response(response.body, { + status: response.status, + statusText: response.statusText, + headers: crossOriginIsolatedHeaders, + }); + + return newResponse; +} + +/** + * Calls fetch and cache the result if it is cacheable + * @param {FetchEvent} event + * @param {Cache} cache + * @param {boolean} isCacheable + * @returns {Response} + */ +async function fetchAndCache(event, cache, isCacheable) { // Use the preloaded response, if it's there + /** @type { Response } */ let response = await event.preloadResponse; - if (!response) { + if (response == null) { // Or, go over network. response = await self.fetch(event.request); } - if (isCachable) { + + if (ENSURE_CROSSORIGIN_ISOLATION_HEADERS) { + response = ensureCrossOriginIsolationHeaders(response); + } + + if (isCacheable) { // 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 || ""; - const referrer = event.request.referrer || ""; - const base = referrer.slice(0, referrer.lastIndexOf("/") + 1); - const local = url.startsWith(base) ? url.replace(base, "") : ""; - const isCachable = FULL_CACHE.some(v => v === local) || (base === referrer && base.endsWith(CACHED_FILES[0])); - if (isNavigate || isCachable) { - event.respondWith(async function () { - // 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); +self.addEventListener( + 'fetch', + /** + * Triggered on fetch + * @param {FetchEvent} event + */ + (event) => { + const isNavigate = event.request.mode === 'navigate'; + const url = event.request.url || ''; + const referrer = event.request.referrer || ''; + const base = referrer.slice(0, referrer.lastIndexOf('/') + 1); + const local = url.startsWith(base) ? url.replace(base, '') : ''; + const isCachable = FULL_CACHE.some((v) => v === local) || (base === referrer && base.endsWith(CACHED_FILES[0])); + if (isNavigate || isCachable) { + event.respondWith((async () => { + // Try to use cache first + const cache = await caches.open(CACHE_NAME); + if (isNavigate) { + // Check if we have full cache during HTML page request. + /** @type {Response[]} */ + 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). + const response = await fetchAndCache(event, cache, isCachable); + return response; + } catch (e) { + // And return the hopefully always cached offline page in case of network failure. + console.error('Network error: ', e); // eslint-disable-line no-console + return caches.match(OFFLINE_URL); + } } } - } - const cached = await cache.match(event.request); - if (cached) { - return cached; - } else { + let cached = await cache.match(event.request); + if (cached != null) { + if (ENSURE_CROSSORIGIN_ISOLATION_HEADERS) { + cached = ensureCrossOriginIsolationHeaders(cached); + } + return cached; + } // Try network if don't have it in cache. - return await fetchAndCache(event, cache, isCachable); - } - }()); + const response = await fetchAndCache(event, cache, isCachable); + return response; + })()); + } else if (ENSURE_CROSSORIGIN_ISOLATION_HEADERS) { + event.respondWith((async () => { + let response = await fetch(event.request); + response = ensureCrossOriginIsolationHeaders(response); + return response; + })()); + } } -}); +); -self.addEventListener("message", (event) => { +self.addEventListener('message', (event) => { // No cross origin - if (event.origin != self.origin) { + if (event.origin !== self.origin) { return; } - const id = event.source.id || ""; - const msg = event.data || ""; + 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") { + if (msg === 'claim') { self.skipWaiting().then(() => self.clients.claim()); - } else if (msg === "clear") { + } 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 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/icon_console.svg b/misc/dist/icon_console.svg index 4a0d2d8d7d..10143d026b 100644 --- a/misc/dist/icon_console.svg +++ b/misc/dist/icon_console.svg @@ -1 +1 @@ -<svg width="1024" height="1024" xmlns="http://www.w3.org/2000/svg"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g><rect fill="#414042" stroke-width="20" stroke="#fff" x="550" y="650" width="430" height="330" rx="20"/><path fill="#fff" d="M590 750a10 10 0 0 0 0 14.142l70 70-70 70a10 10 0 0 0 0 14.142l20 20a10 10 0 0 0 14.142 0l97.071-97.071a10 10 0 0 0 0-14.142L624.142 730A10 10 0 0 0 610 730zm180 145a10 10 0 0 0-10 10v25a10 10 0 0 0 10 10h160a10 10 0 0 0 10-10v-25a10 10 0 0 0-10-10z"/></svg> +<svg width="1024" height="1024" xmlns="http://www.w3.org/2000/svg"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z" fill="#478cbf"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g><rect fill="#414042" stroke-width="20" stroke="#fff" x="550" y="650" width="430" height="330" rx="20"/><path fill="#fff" d="M590 750a10 10 0 0 0 0 14.142l70 70-70 70a10 10 0 0 0 0 14.142l20 20a10 10 0 0 0 14.142 0l97.071-97.071a10 10 0 0 0 0-14.142L624.142 730A10 10 0 0 0 610 730zm180 145a10 10 0 0 0-10 10v25a10 10 0 0 0 10 10h160a10 10 0 0 0 10-10v-25a10 10 0 0 0-10-10z"/></svg> diff --git a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj index 27bc2844d5..e9efea8809 100644 --- a/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj +++ b/misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj @@ -254,14 +254,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - "LD_CLASSIC_1000" = ""; - "LD_CLASSIC_1100" = ""; - "LD_CLASSIC_1200" = ""; - "LD_CLASSIC_1300" = ""; - "LD_CLASSIC_1400" = ""; + IPHONEOS_DEPLOYMENT_TARGET = $min_version; "LD_CLASSIC_1500" = "-ld_classic"; - OTHER_LDFLAGS = "$(LD_CLASSIC_$(XCODE_VERSION_MAJOR)) $linker_flags"; + "LD_CLASSIC_1501" = "-ld_classic"; + "LD_CLASSIC_1510" = "-ld_classic"; + OTHER_LDFLAGS = "$(LD_CLASSIC_$(XCODE_VERSION_ACTUAL)) $linker_flags"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "$targeted_device_family"; }; @@ -299,14 +296,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - "LD_CLASSIC_1000" = ""; - "LD_CLASSIC_1100" = ""; - "LD_CLASSIC_1200" = ""; - "LD_CLASSIC_1300" = ""; - "LD_CLASSIC_1400" = ""; + IPHONEOS_DEPLOYMENT_TARGET = $min_version; "LD_CLASSIC_1500" = "-ld_classic"; - OTHER_LDFLAGS = "$(LD_CLASSIC_$(XCODE_VERSION_MAJOR)) $linker_flags"; + "LD_CLASSIC_1501" = "-ld_classic"; + "LD_CLASSIC_1510" = "-ld_classic"; + OTHER_LDFLAGS = "$(LD_CLASSIC_$(XCODE_VERSION_ACTUAL)) $linker_flags"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "$targeted_device_family"; VALIDATE_PRODUCT = YES; @@ -318,7 +312,6 @@ buildSettings = { ARCHS = "$godot_archs"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - $pbx_launch_image_usage_setting CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements"; CODE_SIGN_IDENTITY = "$code_sign_identity_debug"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_debug"; @@ -326,7 +319,7 @@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; DEVELOPMENT_TEAM = $team_id; INFOPLIST_FILE = "$binary/$binary-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = $min_version; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -354,7 +347,6 @@ buildSettings = { ARCHS = "$godot_archs"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - $pbx_launch_image_usage_setting CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements"; CODE_SIGN_IDENTITY = "$code_sign_identity_release"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_release"; @@ -362,7 +354,7 @@ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; DEVELOPMENT_TEAM = $team_id; INFOPLIST_FILE = "$binary/$binary-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = $min_version; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Contents.json b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index f3ac82189f..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "images" : [ - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "2436h", - "filename" : "Default-Portrait-X.png", - "minimum-system-version" : "11.0", - "orientation" : "portrait", - "scale" : "3x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "2436h", - "filename" : "Default-Landscape-X.png", - "minimum-system-version" : "11.0", - "orientation" : "landscape", - "scale" : "3x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "736h", - "filename" : "Default-Portrait-736h@3x.png", - "minimum-system-version" : "8.0", - "orientation" : "portrait", - "scale" : "3x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "736h", - "filename" : "Default-Landscape-736h@3x.png", - "minimum-system-version" : "8.0", - "orientation" : "landscape", - "scale" : "3x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "667h", - "filename" : "Default-667h@2x.png", - "minimum-system-version" : "8.0", - "orientation" : "portrait", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "filename" : "Default-480h@2x.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "extent" : "full-screen", - "idiom" : "iphone", - "subtype" : "retina4", - "filename" : "Default-568h@2x.png", - "minimum-system-version" : "7.0", - "orientation" : "portrait", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "filename" : "Default-Portrait.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "filename" : "Default-Landscape.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "filename" : "Default-Portrait@2x.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "filename" : "Default-Landscape@2x.png", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-480h@2x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-480h@2x.png Binary files differdeleted file mode 100644 index 7c9cac3f0e..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-480h@2x.png +++ /dev/null diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png Binary files differdeleted file mode 100644 index 0226bdf7cd..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-568h@2x.png +++ /dev/null diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png Binary files differdeleted file mode 100644 index 25904c186c..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-667h@2x.png +++ /dev/null diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h@3x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h@3x.png Binary files differdeleted file mode 100644 index 649df071f9..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h@3x.png +++ /dev/null diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-X.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-X.png Binary files differdeleted file mode 100644 index f3bd86a7de..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-X.png +++ /dev/null diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape.png Binary files differdeleted file mode 100644 index d5692eaffa..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape.png +++ /dev/null diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png Binary files differdeleted file mode 100644 index 8c4fe87b9c..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png +++ /dev/null diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-736h@3x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-736h@3x.png Binary files differdeleted file mode 100644 index e755beb803..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-736h@3x.png +++ /dev/null diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-X.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-X.png Binary files differdeleted file mode 100644 index f676fda263..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-X.png +++ /dev/null diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait.png Binary files differdeleted file mode 100644 index 43da4f3ed6..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait.png +++ /dev/null diff --git a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png b/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png Binary files differdeleted file mode 100644 index 075a6790ce..0000000000 --- a/misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png +++ /dev/null diff --git a/misc/dist/macos/editor_debug.entitlements b/misc/dist/macos/editor_debug.entitlements new file mode 100644 index 0000000000..ff3f589121 --- /dev/null +++ b/misc/dist/macos/editor_debug.entitlements @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>com.apple.security.cs.allow-dyld-environment-variables</key> + <true/> + <key>com.apple.security.cs.allow-jit</key> + <true/> + <key>com.apple.security.cs.allow-unsigned-executable-memory</key> + <true/> + <key>com.apple.security.cs.disable-executable-page-protection</key> + <true/> + <key>com.apple.security.cs.disable-library-validation</key> + <true/> + <key>com.apple.security.device.audio-input</key> + <true/> + <key>com.apple.security.device.camera</key> + <true/> + <key>com.apple.security.get-task-allow</key> + <true/> +</dict> +</plist> diff --git a/misc/dist/macos/editor_info_plist.template b/misc/dist/macos/editor_info_plist.template new file mode 100644 index 0000000000..4b5399c345 --- /dev/null +++ b/misc/dist/macos/editor_info_plist.template @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>Godot</string> + <key>CFBundleName</key> + <string>Godot</string> + <key>CFBundleIconFile</key> + <string>Godot.icns</string> + <key>CFBundleIdentifier</key> + <string>org.godotengine.godot</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>$short_version</string> + <key>CFBundleSignature</key> + <string>godot</string> + <key>CFBundleVersion</key> + <string>$version</string> + <key>NSMicrophoneUsageDescription</key> + <string>Microphone access is required to capture audio.</string> + <key>NSCameraUsageDescription</key> + <string>Camera access is required to capture video.</string> + <key>NSRequiresAquaSystemAppearance</key> + <false/> + <key>NSHumanReadableCopyright</key> + <string>© 2007-present Juan Linietsky, Ariel Manzur & Godot Engine contributors</string> + <key>CFBundleSupportedPlatforms</key> + <array> + <string>MacOSX</string> + </array> + <key>NSPrincipalClass</key> + <string>NSApplication</string> + <key>LSApplicationCategoryType</key> + <string>public.app-category.developer-tools</string> + <key>LSMinimumSystemVersion</key> + <string>10.12</string> + <key>LSMinimumSystemVersionByArchitecture</key> + <dict> + <key>x86_64</key> + <string>10.12</string> + </dict> + <key>NSHighResolutionCapable</key> + <true/> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeRole</key> + <string>Editor</string> + <key>LSItemContentTypes</key> + <array> + <string>public.tscn</string> + </array> + <key>NSExportableTypes</key> + <array> + <string>public.tscn</string> + </array> + </dict> + <dict> + <key>CFBundleTypeRole</key> + <string>Editor</string> + <key>LSItemContentTypes</key> + <array> + <string>public.godot</string> + </array> + <key>NSExportableTypes</key> + <array> + <string>public.godot</string> + </array> + </dict> + </array> + <key>UTExportedTypeDeclarations</key> + <array> + <dict> + <key>UTTypeIdentifier</key> + <string>public.tscn</string> + <key>UTTypeReferenceURL</key> + <string></string> + <key>UTTypeDescription</key> + <string>Godot Engine scene</string> + <key>UTTypeIconFile</key> + <string>Scene.icns</string> + <key>UTTypeConformsTo</key> + <array> + <string>public.data</string> + </array> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>scn</string> + <string>tscn</string> + <string>escn</string> + </array> + <key>public.mime-type</key> + <string>application/x-godot-scene</string> + </dict> + </dict> + <dict> + <key>UTTypeIdentifier</key> + <string>public.gd</string> + <key>UTTypeReferenceURL</key> + <string></string> + <key>UTTypeDescription</key> + <string>GDScript script</string> + <key>UTTypeIconFile</key> + <string>GDScript.icns</string> + <key>UTTypeConformsTo</key> + <array> + <string>public.script</string> + </array> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>gd</string> + </array> + <key>public.mime-type</key> + <string>application/x-gdscript</string> + </dict> + </dict> + <dict> + <key>UTTypeIdentifier</key> + <string>public.res</string> + <key>UTTypeReferenceURL</key> + <string></string> + <key>UTTypeDescription</key> + <string>Godot Engine resource</string> + <key>UTTypeIconFile</key> + <string>Resource.icns</string> + <key>UTTypeConformsTo</key> + <array> + <string>public.data</string> + </array> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>res</string> + <string>tres</string> + </array> + <key>public.mime-type</key> + <string>application/x-godot-resource</string> + </dict> + </dict> + <dict> + <key>UTTypeIdentifier</key> + <string>public.gdshader</string> + <key>UTTypeReferenceURL</key> + <string></string> + <key>UTTypeDescription</key> + <string>Godot Engine shader</string> + <key>UTTypeIconFile</key> + <string>Shader.icns</string> + <key>UTTypeConformsTo</key> + <array> + <string>public.script</string> + </array> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>gdshader</string> + </array> + <key>public.mime-type</key> + <string>application/x-godot-shader</string> + </dict> + </dict> + <dict> + <key>UTTypeIdentifier</key> + <string>public.godot</string> + <key>UTTypeReferenceURL</key> + <string></string> + <key>UTTypeDescription</key> + <string>Godot Engine project</string> + <key>UTTypeIconFile</key> + <string>Project.icns</string> + <key>UTTypeConformsTo</key> + <array> + <string>public.data</string> + </array> + <key>UTTypeTagSpecification</key> + <dict> + <key>public.filename-extension</key> + <array> + <string>godot</string> + </array> + <key>public.mime-type</key> + <string>application/x-godot-project</string> + </dict> + </dict> + </array> +</dict> +</plist> diff --git a/misc/dist/macos_template.app/Contents/Info.plist b/misc/dist/macos_template.app/Contents/Info.plist index 40966d2ced..78bb559c0e 100644 --- a/misc/dist/macos_template.app/Contents/Info.plist +++ b/misc/dist/macos_template.app/Contents/Info.plist @@ -58,5 +58,6 @@ $usage_descriptions </dict> <key>NSHighResolutionCapable</key> $highres +$additional_plist_content </dict> </plist> diff --git a/misc/dist/project_icon.svg b/misc/dist/project_icon.svg deleted file mode 100644 index 5bfc113daa..0000000000 --- a/misc/dist/project_icon.svg +++ /dev/null @@ -1 +0,0 @@ -<svg width="1024" height="1024" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><rect fill="#1e1a21" x="8" y="8" width="1008" height="1008" rx="176" stroke-width="16" stroke="#2e2832"/><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg> diff --git a/misc/dist/shell/_godot.zsh-completion b/misc/dist/shell/_godot.zsh-completion index 490af0a8a5..f65cf37870 100644 --- a/misc/dist/shell/_godot.zsh-completion +++ b/misc/dist/shell/_godot.zsh-completion @@ -51,7 +51,8 @@ _arguments \ '--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]' \ - '--write-movie[writes a video to the specified path (usually with .avi or .png extension)]:path to output video file' \ + '--log-file[write output/error log to the specified path instead of the default location defined by the project]:path to output log file' \ + '--write-movie[write a video to the specified path (usually with .avi or .png extension)]:path to output video file' \ '(-f --fullscreen)'{-f,--fullscreen}'[request fullscreen mode]' \ '(-m --maximized)'{-m,--maximized}'[request a maximized window]' \ '(-w --windowed)'{-w,--windowed}'[request windowed mode]' \ diff --git a/misc/dist/shell/godot.bash-completion b/misc/dist/shell/godot.bash-completion index c78f0a1f33..63efa95c10 100644 --- a/misc/dist/shell/godot.bash-completion +++ b/misc/dist/shell/godot.bash-completion @@ -54,6 +54,7 @@ _complete_godot_options() { --text-driver --tablet-driver --headless +--log-file --write-movie --fullscreen --maximized diff --git a/misc/dist/shell/godot.fish b/misc/dist/shell/godot.fish index fbfa7344f1..3f0675fcb2 100644 --- a/misc/dist/shell/godot.fish +++ b/misc/dist/shell/godot.fish @@ -67,7 +67,8 @@ complete -c godot -l gpu-index -d "Use a specific GPU (run with --verbose to get 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" -complete -c godot -l write-movie -d "Writes a video to the specified path (usually with .avi or .png extension). --fixed-fps is forced when enabled" -x +complete -c godot -l log-file -d "Write output/error log to the specified path instead of the default location defined by the project" -x +complete -c godot -l write-movie -d "Write a video to the specified path (usually with .avi or .png extension). --fixed-fps is forced when enabled" -x # Display options: complete -c godot -s f -l fullscreen -d "Request fullscreen mode" diff --git a/misc/extension_api_validation/4.1-stable_4.2-stable.expected b/misc/extension_api_validation/4.1-stable_4.2-stable.expected index d51523bd38..11cf8531c6 100644 --- a/misc/extension_api_validation/4.1-stable_4.2-stable.expected +++ b/misc/extension_api_validation/4.1-stable_4.2-stable.expected @@ -91,7 +91,7 @@ Added optional argument. Compatibility methods registered. GH-80954 -------- -Validate extension JSON: Error: Field 'classes/Font/methods/find_variation/arguments': size changed value in new API, from 4 to 8. +Validate extension JSON: Error: Field 'classes/Font/methods/find_variation/arguments': size changed value in new API, from 4 to 9. Added optional arguments. Compatibility method registered. diff --git a/misc/extension_api_validation/4.2-stable.expected b/misc/extension_api_validation/4.2-stable.expected index 8a31d0fbc8..4706ed37f0 100644 --- a/misc/extension_api_validation/4.2-stable.expected +++ b/misc/extension_api_validation/4.2-stable.expected @@ -14,3 +14,304 @@ Validate extension JSON: Error: Field 'classes/TileData/methods/get_navigation_p Validate extension JSON: Error: Field 'classes/TileData/methods/get_occluder/arguments': size changed value in new API, from 1 to 4. Added optional argument to get_navigation_polygon and get_occluder to specify a polygon transform. + + +GH-85393 +-------- +Validate extension JSON: Error: Field 'classes/PhysicsShapeQueryParameters3D/properties/motion': type changed value in new API, from "Vector2" to "Vector3". + +The type was registered wrongly, this was a bug. + + +GH-86687 +-------- +Validate extension JSON: Error: Field 'classes/AnimationMixer/methods/_post_process_key_value/arguments/3': type changed value in new API, from "Object" to "int". + +Exposing the pointer was dangerous and it must be changed to avoid crash. Compatibility methods registered. + + +GH-84976 +-------- +Validate extension JSON: Error: Field 'classes/RenderingDevice/enums/FinalAction/values/FINAL_ACTION_CONTINUE': value changed value in new API, from 2.0 to 0. +Validate extension JSON: Error: Field 'classes/RenderingDevice/enums/FinalAction/values/FINAL_ACTION_MAX': value changed value in new API, from 3.0 to 2. +Validate extension JSON: Error: Field 'classes/RenderingDevice/enums/InitialAction/values/INITIAL_ACTION_CLEAR': value changed value in new API, from 0.0 to 1. +Validate extension JSON: Error: Field 'classes/RenderingDevice/enums/InitialAction/values/INITIAL_ACTION_CLEAR_REGION_CONTINUE': value changed value in new API, from 2.0 to 1. +Validate extension JSON: Error: Field 'classes/RenderingDevice/enums/InitialAction/values/INITIAL_ACTION_CONTINUE': value changed value in new API, from 5.0 to 0. +Validate extension JSON: Error: Field 'classes/RenderingDevice/enums/InitialAction/values/INITIAL_ACTION_DROP': value changed value in new API, from 4.0 to 2. +Validate extension JSON: Error: Field 'classes/RenderingDevice/enums/InitialAction/values/INITIAL_ACTION_KEEP': value changed value in new API, from 3.0 to 0. +Validate extension JSON: Error: Field 'classes/RenderingDevice/enums/InitialAction/values/INITIAL_ACTION_MAX': value changed value in new API, from 6.0 to 3. +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/buffer_clear/arguments': size changed value in new API, from 4 to 3. +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/buffer_update/arguments': size changed value in new API, from 5 to 4. +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/draw_list_begin/arguments': size changed value in new API, from 10 to 9. +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/texture_clear/arguments': size changed value in new API, from 7 to 6. +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/texture_copy/arguments': size changed value in new API, from 10 to 9. +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/texture_resolve_multisample/arguments': size changed value in new API, from 3 to 2. +Validate extension JSON: Error: Field 'classes/RenderingDevice/methods/texture_update/arguments': size changed value in new API, from 4 to 3. + +Barrier arguments have been removed from all relevant functions as they're no longer required. +Draw and compute list overlap no longer needs to be specified. +Initial and final actions have been simplified into fewer options. + + +GH-87115 +-------- +Validate extension JSON: Error: Field 'classes/TileMap/methods/get_collision_visibility_mode': is_const changed value in new API, from false to true. +Validate extension JSON: Error: Field 'classes/TileMap/methods/get_navigation_visibility_mode': is_const changed value in new API, from false to true. + +Two TileMap getters were made const. No adjustments should be necessary. + + +GH-86158 +-------- +Validate extension JSON: Error: Field 'classes/GraphEdit/methods/get_connection_line': is_const changed value in new API, from false to true. + +get_connection_line was made const. + + +GH-87668 +-------- +Validate extension JSON: Error: Field 'classes/Font/methods/find_variation/arguments': size changed value in new API, from 8 to 9. + +Added optional "baseline_offset" argument. Compatibility method registered. + + +GH-81996 +-------- +Validate extension JSON: Error: Field 'classes/GPUParticles2D/properties/process_material': type changed value in new API, from "ShaderMaterial,ParticleProcessMaterial" to "ParticleProcessMaterial,ShaderMaterial". +Validate extension JSON: Error: Field 'classes/GPUParticles3D/properties/process_material': type changed value in new API, from "ShaderMaterial,ParticleProcessMaterial" to "ParticleProcessMaterial,ShaderMaterial". +Validate extension JSON: Error: Field 'classes/Sky/properties/sky_material': type changed value in new API, from "ShaderMaterial,PanoramaSkyMaterial,ProceduralSkyMaterial,PhysicalSkyMaterial" to "PanoramaSkyMaterial,ProceduralSkyMaterial,PhysicalSkyMaterial,ShaderMaterial". + +Property hints reordered to improve editor usability. The types allowed are still the same as before. No adjustments should be necessary. + + +GH-86907 +-------- + +Validate extension JSON: Error: Field 'classes/AudioStreamPlayer/methods/is_autoplay_enabled': is_const changed value in new API, from false to true. +Validate extension JSON: Error: Field 'classes/AudioStreamPlayer2D/methods/is_autoplay_enabled': is_const changed value in new API, from false to true. +Validate extension JSON: Error: Field 'classes/AudioStreamPlayer3D/methods/is_autoplay_enabled': is_const changed value in new API, from false to true. +Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_buffer': is_const changed value in new API, from false to true. +Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_byte_length': is_const changed value in new API, from false to true. +Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_byte_offset': is_const changed value in new API, from false to true. +Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_byte_stride': is_const changed value in new API, from false to true. +Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_indices': is_const changed value in new API, from false to true. + +Change AudioStreamPlayer* is_autoplay_enabled and GLTFBufferView getters to be const. + + +GH-87340 +-------- +Validate extension JSON: JSON file: Field was added in a way that breaks compatibility 'classes/RenderingDevice/methods/screen_get_framebuffer_format': arguments + +screen_get_framebuffer_format can now specify the screen it should get the format from. The argument defaults to the main window to emulate the behavior of the old function. + + +GH-88418 +-------- +Validate extension JSON: API was removed: classes/GDExtension/methods/close_library +Validate extension JSON: API was removed: classes/GDExtension/methods/initialize_library +Validate extension JSON: API was removed: classes/GDExtension/methods/open_library + +Since it was basically impossible to use these methods in any useful way, the GDExtension team agreed that breaking compatibility by removing them was OK. + + +GH-86629 +-------- +Validate extension JSON: Error: Field 'classes/Animation/methods/position_track_interpolate/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/Animation/methods/rotation_track_interpolate/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/Animation/methods/scale_track_interpolate/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/Animation/methods/blend_shape_track_interpolate/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/Animation/methods/value_track_interpolate/arguments': size changed value in new API, from 2 to 3. + +Added optional argument to track_interpolate to treat playing backward correctly. Compatibility method registered. + + +GH-86661 +-------- +Validate extension JSON: Error: Field 'classes/Animation/methods/track_find_key/arguments': size changed value in new API, from 3 to 4. + +Added optional argument to track_find_key to avoid finding keys out of the animation range. Compatibility method registered. + + +GH-84792 +-------- +Validate extension JSON: Error: Field 'classes/RenderingServer/methods/environment_set_fog/arguments': size changed value in new API, from 10 to 11. + +Added fog mode argument. Compatibility method registered. + + +GH-80214 +-------- + +Validate extension JSON: Error: Field 'classes/RenderSceneBuffersRD/methods/get_color_layer/arguments': size changed value in new API, from 1 to 2. +Validate extension JSON: Error: Field 'classes/RenderSceneBuffersRD/methods/get_depth_layer/arguments': size changed value in new API, from 1 to 2. +Validate extension JSON: Error: Field 'classes/RenderSceneBuffersRD/methods/get_velocity_layer/arguments': size changed value in new API, from 1 to 2. +Validate extension JSON: JSON file: Field was added in a way that breaks compatibility 'classes/RenderSceneBuffersRD/methods/get_color_texture': arguments +Validate extension JSON: JSON file: Field was added in a way that breaks compatibility 'classes/RenderSceneBuffersRD/methods/get_depth_texture': arguments +Validate extension JSON: JSON file: Field was added in a way that breaks compatibility 'classes/RenderSceneBuffersRD/methods/get_velocity_texture': arguments + +MSAA flag was added, compatibility functions exist for these. + + +GH-84906 +-------- +Validate extension JSON: Error: Field 'classes/AnimationPlayer/methods/play/arguments/0': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/AnimationPlayer/methods/play_backwards/arguments/0': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/CodeEdit/methods/add_code_completion_option/arguments/5': default_value changed value in new API, from "0" to "null". +Validate extension JSON: Error: Field 'classes/Control/methods/get_theme_color/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/get_theme_constant/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/get_theme_font/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/get_theme_font_size/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/get_theme_icon/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/get_theme_stylebox/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/has_theme_color/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/has_theme_constant/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/has_theme_font/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/has_theme_font_size/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/has_theme_icon/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Control/methods/has_theme_stylebox/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Object/methods/tr/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Object/methods/tr_n/arguments/3': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Translation/methods/add_message/arguments/2': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Translation/methods/add_plural_message/arguments/2': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Translation/methods/erase_message/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Translation/methods/get_message/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Translation/methods/get_plural_message/arguments/3': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/TranslationServer/methods/translate/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/TranslationServer/methods/translate_plural/arguments/3': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/get_theme_color/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/get_theme_constant/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/get_theme_font/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/get_theme_font_size/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/get_theme_icon/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/get_theme_stylebox/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/has_theme_color/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/has_theme_constant/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/has_theme_font/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/has_theme_font_size/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/has_theme_icon/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". +Validate extension JSON: Error: Field 'classes/Window/methods/has_theme_stylebox/arguments/1': default_value changed value in new API, from "\"\"" to "&\"\"". + +Fix the default parameter value for StringName and Variant. +The changes to StringName parameters should be equivalent to the previous default values. +The change to the Variant parameter in 'add_code_completion_option' breaks behavior compatibility. + + +GH-81746 +-------- +Validate extension JSON: API was removed: classes/EditorSceneFormatImporterFBX + +Renamed to EditorSceneFormatImporterFBX2GLTF. + +The compat breakage was deemed necessary as this is a class most users wouldn't +use directly, and the name needs to be disambiguated with the new +EditorSceneFormatImporterUFBX. + + +GH-88791 +-------- +Validate extension JSON: JSON file: Field was added in a way that breaks compatibility 'classes/Skeleton3D/methods/add_bone': return_value + +Added a return value for add_bone. +Should not affect existing regular use - the return value would just be unused. +Compatibility method registered. + + +GH-89024 +-------- +Validate extension JSON: Error: Field 'classes/RichTextLabel/methods/push_meta/arguments': size changed value in new API, from 1 to 2. + +Added optional argument. Compatibility method registered. + + +GH-88081 +-------- +Validate extension JSON: Error: Field 'classes/EditorPlugin/methods/add_control_to_bottom_panel/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/EditorPlugin/methods/add_control_to_dock/arguments': size changed value in new API, from 2 to 3. + +Added optional argument to add_control_to_bottom_panel and add_control_to_dock to specify a shortcut that toggles the bottom panel/dock's visibility. +Compatibility method registered. + + +GH-89419 +-------- +Validate extension JSON: Error: Field 'classes/AcceptDialog/methods/register_text_enter/arguments/0': type changed value in new API, from "Control" to "LineEdit". +Validate extension JSON: Error: Field 'classes/AcceptDialog/methods/remove_button/arguments/0': type changed value in new API, from "Control" to "Button". + +Changed argument type to the more specific one actually expected by the method. Compatibility method registered. + + +GH-88047 +-------- +Validate extension JSON: Error: Field 'classes/AStar2D/methods/get_id_path/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/AStar2D/methods/get_point_path/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/AStar3D/methods/get_id_path/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/AStar3D/methods/get_point_path/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/AStarGrid2D/methods/get_id_path/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/AStarGrid2D/methods/get_point_path/arguments': size changed value in new API, from 2 to 3. + +Added optional "allow_partial_path" argument to get_id_path and get_point_path methods in AStar classes. +Compatibility methods registered. + + +GH-88014 +-------- +Validate extension JSON: API was removed: classes/VisualShaderNodeComment/methods/get_title +Validate extension JSON: API was removed: classes/VisualShaderNodeComment/methods/set_title +Validate extension JSON: API was removed: classes/VisualShaderNodeComment/properties/title + + +GH-87888 +-------- +Validate extension JSON: API was removed: classes/Skeleton3D/properties/animate_physical_bones + +These base class is changed to SkeletonModifier3D which is processed by Skeleton3D with the assumption that it is Skeleton3D's child. + + +GH-90575 +-------- +Validate extension JSON: API was removed: classes/BoneAttachment3D/methods/on_bone_pose_update +Validate extension JSON: API was removed: classes/Skeleton3D/signals/bone_pose_changed + +They have been replaced by a safer API due to performance concerns. Compatibility method registered. + + +GH-90747 +-------- +Validate extension JSON: API was removed: classes/NavigationRegion2D/methods/get_avoidance_layers +Validate extension JSON: API was removed: classes/NavigationRegion2D/methods/set_avoidance_layers +Validate extension JSON: API was removed: classes/NavigationRegion2D/properties/avoidance_layers +Validate extension JSON: API was removed: classes/NavigationRegion2D/methods/get_avoidance_layer_value +Validate extension JSON: API was removed: classes/NavigationRegion2D/methods/set_avoidance_layer_value +Validate extension JSON: API was removed: classes/NavigationRegion2D/methods/set_constrain_avoidance +Validate extension JSON: API was removed: classes/NavigationRegion2D/methods/get_constrain_avoidance +Validate extension JSON: API was removed: classes/NavigationRegion2D/properties/constrain_avoidance + +Experimental NavigationRegion2D feature "constrain_avoidance" was discontinued with no replacement. + + +GH-90645 +-------- +Validate extension JSON: API was removed: classes/XRPositionalTracker/methods/get_tracker_desc +Validate extension JSON: API was removed: classes/XRPositionalTracker/methods/get_tracker_name +Validate extension JSON: API was removed: classes/XRPositionalTracker/methods/get_tracker_type +Validate extension JSON: API was removed: classes/XRPositionalTracker/methods/set_tracker_desc +Validate extension JSON: API was removed: classes/XRPositionalTracker/methods/set_tracker_name +Validate extension JSON: API was removed: classes/XRPositionalTracker/methods/set_tracker_type +Validate extension JSON: API was removed: classes/XRPositionalTracker/properties/description +Validate extension JSON: API was removed: classes/XRPositionalTracker/properties/name +Validate extension JSON: API was removed: classes/XRPositionalTracker/properties/type +Validate extension JSON: Error: Field 'classes/WebXRInterface/methods/get_input_source_tracker/return_value': type changed value in new API, from "XRPositionalTracker" to "XRControllerTracker". +Validate extension JSON: Error: Field 'classes/XRServer/methods/add_tracker/arguments/0': type changed value in new API, from "XRPositionalTracker" to "XRTracker". +Validate extension JSON: Error: Field 'classes/XRServer/methods/get_tracker/return_value': type changed value in new API, from "XRPositionalTracker" to "XRTracker". +Validate extension JSON: Error: Field 'classes/XRServer/methods/remove_tracker/arguments/0': type changed value in new API, from "XRPositionalTracker" to "XRTracker". + +All trackers now have an XRTracker base, and the XRServer uses the XRTracker type. + + +GH-90732 +-------- +Validate extension JSON: Error: Field 'classes/TextServer/methods/shaped_text_get_word_breaks/arguments': size changed value in new API, from 2 to 3. +Validate extension JSON: Error: Field 'classes/TextServerExtension/methods/_shaped_text_get_word_breaks/arguments': size changed value in new API, from 2 to 3. + +Added optional argument. Compatibility method registered. diff --git a/misc/hooks/README.md b/misc/hooks/README.md deleted file mode 100644 index 0aaeff8ae3..0000000000 --- a/misc/hooks/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# Git hooks for Godot Engine - -This folder contains Git hooks meant to be installed locally by Godot Engine -contributors to make sure they comply with our requirements. - -## List of hooks - -- Pre-commit hook for `clang-format`: Applies `clang-format` to the staged - files before accepting a commit; blocks the commit and generates a patch if - the style is not respected. - You may need to edit the file if your `clang-format` binary is not in the - `PATH`, or if you want to enable colored output with `pygmentize`. -- Pre-commit hook for `black`: Applies `black` to the staged Python files - before accepting a commit. -- Pre-commit hook for `make_rst`: Checks the class reference syntax using - `make_rst.py`. - -## Installation - -Copy all the files from this folder into your `.git/hooks` folder, and make -sure the hooks and helper scripts are executable. - -#### Linux/macOS - -The hooks rely on bash scripts and tools which should be in the system `PATH`, -so they should work out of the box on Linux/macOS. - -#### Windows - -##### clang-format -- Download LLVM for Windows (version 13 or later) from - <https://releases.llvm.org/download.html> -- Make sure LLVM is added to the `PATH` during installation - -##### black -- Python installation: make sure Python is added to the `PATH` -- Install `black` - in any console: `pip3 install black` - -## Custom hooks - -The pre-commit hook will run any other script in `.git/hooks` whose filename -matches `pre-commit-custom-*`, after the Godot ones. diff --git a/misc/hooks/asmessage.applescript b/misc/hooks/asmessage.applescript deleted file mode 100644 index 15ba94dc37..0000000000 --- a/misc/hooks/asmessage.applescript +++ /dev/null @@ -1,59 +0,0 @@ -on run argv - set vButtons to { "OK" } - set vButtonCodes to { 0 } - set vDbutton to "OK" - set vText to "" - set vTitle to "" - set vTimeout to -1 - - repeat with i from 1 to length of argv - try - set vArg to item i of argv - if vArg = "-buttons" then - set vButtonsAndCodes to my fSplit(item (i + 1) of argv, ",") - set vButtons to {} - set vButtonCodes to {} - repeat with j from 1 to length of vButtonsAndCodes - set vBtn to my fSplit(item j of vButtonsAndCodes, ":") - copy (item 1 of vBtn) to the end of the vButtons - copy (item 2 of vBtn) to the end of the vButtonCodes - end repeat - else if vArg = "-title" then - set vTitle to item (i + 1) of argv - else if vArg = "-center" then - -- not supported - else if vArg = "-default" then - set vDbutton to item (i + 1) of argv - else if vArg = "-geometry" then - -- not supported - else if vArg = "-nearmouse" then - -- not supported - else if vArg = "-timeout" then - set vTimeout to item (i + 1) of argv as integer - else if vArg = "-file" then - set vText to read (item (i + 1) of argv) as string - else if vArg = "-text" then - set vText to item (i + 1) of argv - end if - end try - end repeat - - set vDlg to display dialog vText buttons vButtons default button vDbutton with title vTitle giving up after vTimeout with icon stop - set vRet to button returned of vDlg - repeat with i from 1 to length of vButtons - set vBtn to item i of vButtons - if vBtn = vRet - return item i of vButtonCodes - end if - end repeat - - return 0 -end run - -on fSplit(vString, vDelimiter) - set oldDelimiters to AppleScript's text item delimiters - set AppleScript's text item delimiters to vDelimiter - set vArray to every text item of vString - set AppleScript's text item delimiters to oldDelimiters - return vArray -end fSplit diff --git a/misc/hooks/canonicalize_filename.sh b/misc/hooks/canonicalize_filename.sh deleted file mode 100755 index fe66999d8c..0000000000 --- a/misc/hooks/canonicalize_filename.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -# Provide the canonicalize filename (physical filename with out any symlinks) -# like the GNU version readlink with the -f option regardless of the version of -# readlink (GNU or BSD). - -# This file is part of a set of unofficial pre-commit hooks available -# at github. -# Link: https://github.com/githubbrowser/Pre-commit-hooks -# Contact: David Martin, david.martin.mailbox@googlemail.com - -########################################################### -# There should be no need to change anything below this line. - -# Canonicalize by recursively following every symlink in every component of the -# specified filename. This should reproduce the results of the GNU version of -# readlink with the -f option. -# -# Reference: https://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac -canonicalize_filename () { - local target_file="$1" - local physical_directory="" - local result="" - - # Need to restore the working directory after work. - local working_dir="`pwd`" - - cd -- "$(dirname -- "$target_file")" - target_file="$(basename -- "$target_file")" - - # Iterate down a (possible) chain of symlinks - while [ -L "$target_file" ] - do - target_file="$(readlink -- "$target_file")" - cd -- "$(dirname -- "$target_file")" - target_file="$(basename -- "$target_file")" - done - - # Compute the canonicalized name by finding the physical path - # for the directory we're in and appending the target file. - physical_directory="`pwd -P`" - result="$physical_directory/$target_file" - - # restore the working directory after work. - cd -- "$working_dir" - - echo "$result" -} diff --git a/misc/hooks/pre-commit b/misc/hooks/pre-commit deleted file mode 100755 index 6359161260..0000000000 --- a/misc/hooks/pre-commit +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -# Git pre-commit hook that runs multiple hooks specified in $HOOKS. -# Make sure this script is executable. Bypass hooks with git commit --no-verify. - -# This file is part of a set of unofficial pre-commit hooks available -# at github. -# Link: https://github.com/githubbrowser/Pre-commit-hooks -# Contact: David Martin, david.martin.mailbox@googlemail.com - - -########################################################### -# CONFIGURATION: -# pre-commit hooks to be executed. They should be in the same .git/hooks/ folder -# as this script. Hooks should return 0 if successful and nonzero to cancel the -# commit. They are executed in the order in which they are listed. -HOOKS="pre-commit-clang-format pre-commit-black pre-commit-make-rst" -HOOKS="$HOOKS $(find $(dirname -- "$0") -type f -name 'pre-commit-custom-*' -exec basename {} \;)" -########################################################### -# There should be no need to change anything below this line. - -. "$(dirname -- "$0")/canonicalize_filename.sh" - -# exit on error -set -e - -# Absolute path to this script, e.g. /home/user/bin/foo.sh -SCRIPT="$(canonicalize_filename "$0")" - -# Absolute path this script is in, thus /home/user/bin -SCRIPTPATH="$(dirname -- "$SCRIPT")" - - -for hook in $HOOKS -do - echo "Running hook: $hook" - # run hook if it exists - # if it returns with nonzero exit with 1 and thus abort the commit - if [ -f "$SCRIPTPATH/$hook" ]; then - "$SCRIPTPATH/$hook" - if [ $? != 0 ]; then - exit 1 - fi - else - echo "Error: file $hook not found." - echo "Aborting commit. Make sure the hook is in $SCRIPTPATH and executable." - echo "You can disable it by removing it from the list in $SCRIPT." - echo "You can skip all pre-commit hooks with --no-verify (not recommended)." - exit 1 - fi -done diff --git a/misc/hooks/pre-commit-black b/misc/hooks/pre-commit-black deleted file mode 100755 index bbad6a690a..0000000000 --- a/misc/hooks/pre-commit-black +++ /dev/null @@ -1,219 +0,0 @@ -#!/usr/bin/env bash - -# git pre-commit hook that runs a black stylecheck. -# Based on pre-commit-clang-format. - -################################################################## -# SETTINGS -# Set path to black binary. -BLACK=`which black 2>/dev/null` -BLACK_OPTIONS="-l 120" - -# Remove any older patches from previous commits. Set to true or false. -DELETE_OLD_PATCHES=false - -# File types to parse. -FILE_NAMES="SConstruct SCsub" -FILE_EXTS=".py" - -# Use pygmentize instead of cat to parse diff with highlighting. -# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac) -PYGMENTIZE=`which pygmentize 2>/dev/null` -if [ ! -z "$PYGMENTIZE" ]; then - READER="pygmentize -l diff" -else - READER=cat -fi - -# Path to zenity -ZENITY=`which zenity 2>/dev/null` - -# Path to xmessage -XMSG=`which xmessage 2>/dev/null` - -# Path to powershell (Windows only) -PWSH=`which powershell 2>/dev/null` - -# Path to osascript (macOS only) -OSA=`which osascript 2>/dev/null` - -################################################################## -# There should be no need to change anything below this line. - -. "$(dirname -- "$0")/canonicalize_filename.sh" - -# exit on error -set -e - -# check whether the given file matches any of the set extensions -matches_name_or_extension() { - local filename=$(basename "$1") - local extension=".${filename##*.}" - - for name in $FILE_NAMES; do [[ "$name" == "$filename" ]] && return 0; done - for ext in $FILE_EXTS; do [[ "$ext" == "$extension" ]] && return 0; done - - return 1 -} - -# necessary check for initial commit -if git rev-parse --verify HEAD >/dev/null 2>&1 ; then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 -fi - -if [ ! -x "$BLACK" ] ; then - if [ ! -t 1 ] ; then - if [ -x "$ZENITY" ] ; then - $ZENITY --error --title="Error" --text="Error: black executable not found." - exit 1 - elif [ -x "$XMSG" ] ; then - $XMSG -center -title "Error" "Error: black executable not found." - exit 1 - elif [ -x "$OSA" ] ; then - asmessage="$(canonicalize_filename "$(dirname -- "$0")/asmessage.applescript")" - $OSA "$asmessage" -center -title "Error" --text "Error: black executable not found." - exit 1 - elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then - winmessage="$(canonicalize_filename "$(dirname -- "$0")/winmessage.ps1")" - $PWSH -noprofile -executionpolicy bypass -file "$winmessage" -center -title "Error" --text "Error: black executable not found." - exit 1 - fi - fi - printf "Error: black executable not found.\n" - printf "Set the correct path in $(canonicalize_filename "$0").\n" - exit 1 -fi - -# create a random filename to store our generated patch -prefix="pre-commit-black" -suffix="$(date +%s)" -patch="/tmp/$prefix-$suffix.patch" - -# clean up any older black patches -$DELETE_OLD_PATCHES && rm -f /tmp/$prefix*.patch - -# create one patch containing all changes to the files -git diff-index --cached --diff-filter=ACMR --name-only $against -- | while read file; -do - # ignore thirdparty files - if grep -q "thirdparty" <<< $file; then - continue; - fi - - # ignore file if not one of the names or extensions we handle - if ! matches_name_or_extension "$file"; then - continue; - fi - - # format our file with black, create a patch with diff and append it to our $patch - # The sed call is necessary to transform the patch from - # --- $file timestamp - # +++ $file timestamp - # to both lines working on the same file and having a/ and b/ prefix. - # Else it can not be applied with 'git apply'. - "$BLACK" "$BLACK_OPTIONS" --diff "$file" | \ - sed -e "1s|--- |--- a/|" -e "2s|+++ |+++ b/|" >> "$patch" -done - -# if no patch has been generated all is ok, clean up the file stub and exit -if [ ! -s "$patch" ] ; then - printf "Files in this commit comply with the black formatter rules.\n" - rm -f "$patch" - exit 0 -fi - -# a patch has been created, notify the user and exit -printf "\nThe following differences were found between the code to commit " -printf "and the black formatter rules:\n\n" - -if [ -t 1 ] ; then - $READER "$patch" - printf "\n" - # Allows us to read user input below, assigns stdin to keyboard - exec < /dev/tty - terminal="1" -else - cat "$patch" - printf "\n" - # Allows non zero zenity/powershell output - set +e - terminal="0" -fi - -while true; do - if [ $terminal = "0" ] ; then - if [ -x "$ZENITY" ] ; then - 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 [ "$choice" = "Apply and stage" ] ; then - yn="S" - else - yn="N" - fi - 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?" - choice=$? - if [ "$choice" = "100" ] ; then - yn="Y" - elif [ "$choice" = "200" ] ; then - yn="S" - else - yn="N" - fi - elif [ -x "$OSA" ] ; then - asmessage="$(canonicalize_filename "$(dirname -- "$0")/asmessage.applescript")" - choice=`$OSA "$asmessage" -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?"` - if [ "$choice" = "100" ] ; then - yn="Y" - elif [ "$choice" = "200" ] ; then - yn="S" - else - yn="N" - fi - elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then - winmessage="$(canonicalize_filename "$(dirname -- "$0")/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?" - choice=$? - if [ "$choice" = "100" ] ; then - yn="Y" - elif [ "$choice" = "200" ] ; then - yn="S" - else - yn="N" - fi - else - printf "Error: zenity, xmessage, osascript, or powershell executable not found.\n" - exit 1 - fi - else - read -p "Do you want to apply that patch (Y - Apply, N - Do not apply, S - Apply and stage files)? [Y/N/S] " yn - fi - case $yn in - [Yy] ) git apply $patch; - printf "The patch was applied. You can now stage the changes and commit again.\n\n"; - break - ;; - [Nn] ) printf "\nYou can apply these changes with:\n git apply $patch\n"; - printf "(may need to be called from the root directory of your repository)\n"; - printf "Aborting commit. Apply changes and commit again or skip checking with"; - printf " --no-verify (not recommended).\n\n"; - break - ;; - [Ss] ) git apply $patch; - git diff-index --cached --diff-filter=ACMR --name-only $against -- | while read file; - do git add $file; - done - printf "The patch was applied and the changed files staged. You can now commit.\n\n"; - break - ;; - * ) echo "Please answer yes or no." - ;; - esac -done -exit 1 # we don't commit in any case diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format deleted file mode 100755 index fd0213c175..0000000000 --- a/misc/hooks/pre-commit-clang-format +++ /dev/null @@ -1,259 +0,0 @@ -#!/usr/bin/env bash - -# git pre-commit hook that runs a clang-format stylecheck. -# Features: -# - abort commit when commit does not comply with the style guidelines -# - create a patch of the proposed style changes -# Modifications for clang-format by rene.milk@wwu.de - -# This file is part of a set of unofficial pre-commit hooks available -# at github. -# Link: https://github.com/githubbrowser/Pre-commit-hooks -# Contact: David Martin, david.martin.mailbox@googlemail.com - -# Some quality of life modifications made for Godot Engine. - -################################################################## -# SETTINGS -# Set path to clang-format binary. -CLANG_FORMAT=`which clang-format 2>/dev/null` - -# Remove any older patches from previous commits. Set to true or false. -DELETE_OLD_PATCHES=false - -# Only parse files with the extensions in FILE_EXTS. Set to true or false. -# If false every changed file in the commit will be parsed with clang-format. -# If true only files matching one of the extensions are parsed with clang-format. -PARSE_EXTS=true - -# File types to parse. Only effective when PARSE_EXTS is true. -FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc .java .glsl" - -# Use pygmentize instead of cat to parse diff with highlighting. -# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac) -PYGMENTIZE=`which pygmentize 2>/dev/null` -if [ ! -z "$PYGMENTIZE" ]; then - READER="pygmentize -l diff" -else - READER=cat -fi - -# Path to zenity -ZENITY=`which zenity 2>/dev/null` - -# Path to xmessage -XMSG=`which xmessage 2>/dev/null` - -# Path to powershell (Windows only) -PWSH=`which powershell 2>/dev/null` - -# Path to osascript (macOS only) -OSA=`which osascript 2>/dev/null` - -################################################################## -# There should be no need to change anything below this line. - -. "$(dirname -- "$0")/canonicalize_filename.sh" - -# exit on error -set -e - -# check whether the given file matches any of the set extensions -matches_extension() { - local filename=$(basename "$1") - local extension=".${filename##*.}" - local ext - - for ext in $FILE_EXTS; do [[ "$ext" == "$extension" ]] && return 0; done - - return 1 -} - -# necessary check for initial commit -if git rev-parse --verify HEAD >/dev/null 2>&1 ; then - against=HEAD -else - # Initial commit: diff against an empty tree object - against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 -fi - -# To get consistent formatting, we recommend contributors to use the same -# clang-format version as CI. -RECOMMENDED_CLANG_FORMAT_MAJOR_MIN="13" -RECOMMENDED_CLANG_FORMAT_MAJOR_MAX="15" - -if [ ! -x "$CLANG_FORMAT" ] ; then - message="Error: clang-format executable not found. Please install clang-format $RECOMMENDED_CLANG_FORMAT_MAJOR_MAX." - - if [ ! -t 1 ] ; then - if [ -x "$ZENITY" ] ; then - $ZENITY --error --title="Error" --text="$message" - exit 1 - elif [ -x "$XMSG" ] ; then - $XMSG -center -title "Error" "$message" - exit 1 - elif [ -x "$OSA" ] ; then - asmessage="$(canonicalize_filename "$(dirname -- "$0")/asmessage.applescript")" - $OSA "$asmessage" -center -title "Error" --text "$message" - exit 1 - elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then - winmessage="$(canonicalize_filename "$(dirname -- "$0")/winmessage.ps1")" - $PWSH -noprofile -executionpolicy bypass -file "$winmessage" -center -title "Error" --text "$message" - exit 1 - fi - fi - printf "$message\n" - printf "Set the correct path in $(canonicalize_filename "$0").\n" - exit 1 -fi - -# The returned string can be inconsistent depending on where clang-format comes from. -# Example output strings reported by `clang-format --version`: -# - Ubuntu: "Ubuntu clang-format version 11.0.0-2" -# - Fedora: "clang-format version 11.0.0 (Fedora 11.0.0-2.fc33)" -CLANG_FORMAT_VERSION="$(clang-format --version | sed "s/[^0-9\.]*\([0-9\.]*\).*/\1/")" -CLANG_FORMAT_MAJOR="$(echo "$CLANG_FORMAT_VERSION" | cut -d. -f1)" - -if [[ "$CLANG_FORMAT_MAJOR" -lt "$RECOMMENDED_CLANG_FORMAT_MAJOR_MIN" || "$CLANG_FORMAT_MAJOR" -gt "$RECOMMENDED_CLANG_FORMAT_MAJOR_MAX" ]]; then - echo "Warning: Your clang-format binary is the wrong version ($CLANG_FORMAT_VERSION, expected between $RECOMMENDED_CLANG_FORMAT_MAJOR_MIN and $RECOMMENDED_CLANG_FORMAT_MAJOR_MAX)." - echo " Consider upgrading or downgrading clang-format as formatting may not be applied correctly." -fi - -# create a random filename to store our generated patch -prefix="pre-commit-clang-format" -suffix="$(date +%s)" -patch="/tmp/$prefix-$suffix.patch" - -# clean up any older clang-format patches -$DELETE_OLD_PATCHES && rm -f /tmp/$prefix*.patch - -# create one patch containing all changes to the files -git diff-index --cached --diff-filter=ACMR --name-only $against -- | while read file; -do - # ignore thirdparty files - if grep -q "thirdparty" <<< $file; then - continue; - fi - if grep -q "platform/android/java/lib/src/com" <<< $file; then - continue; - fi - if grep -q "\-so_wrap." <<< $file; then - continue; - fi - - # ignore file if we do check for file extensions and the file - # does not match any of the extensions specified in $FILE_EXTS - if $PARSE_EXTS && ! matches_extension "$file"; then - continue; - fi - - # clang-format our sourcefile, create a patch with diff and append it to our $patch - # The sed call is necessary to transform the patch from - # --- $file timestamp - # +++ - timestamp - # to both lines working on the same file and having a/ and b/ prefix. - # Else it can not be applied with 'git apply'. - "$CLANG_FORMAT" -style=file "$file" --Wno-error=unknown | \ - diff -u "$file" - | \ - sed -e "1s|--- |--- a/|" -e "2s|+++ -|+++ b/$file|" >> "$patch" -done - -# if no patch has been generated all is ok, clean up the file stub and exit -if [ ! -s "$patch" ] ; then - printf "Files in this commit comply with the clang-format rules.\n" - rm -f "$patch" - exit 0 -fi - -# a patch has been created, notify the user and exit -printf "\nThe following differences were found between the code to commit " -printf "and the clang-format rules:\n\n" - -if [ -t 1 ] ; then - $READER "$patch" - printf "\n" - # Allows us to read user input below, assigns stdin to keyboard - exec < /dev/tty - terminal="1" -else - cat "$patch" - printf "\n" - # Allows non zero zenity/powershell output - set +e - terminal="0" -fi - -while true; do - if [ $terminal = "0" ] ; then - if [ -x "$ZENITY" ] ; then - 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 [ "$choice" = "Apply and stage" ] ; then - yn="S" - else - yn="N" - fi - 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?" - choice=$? - if [ "$choice" = "100" ] ; then - yn="Y" - elif [ "$choice" = "200" ] ; then - yn="S" - else - yn="N" - fi - elif [ -x "$OSA" ] ; then - asmessage="$(canonicalize_filename "$(dirname -- "$0")/asmessage.applescript")" - choice=`$OSA "$asmessage" -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?"` - if [ "$choice" = "100" ] ; then - yn="Y" - elif [ "$choice" = "200" ] ; then - yn="S" - else - yn="N" - fi - elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then - winmessage="$(canonicalize_filename "$(dirname -- "$0")/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?" - choice=$? - if [ "$choice" = "100" ] ; then - yn="Y" - elif [ "$choice" = "200" ] ; then - yn="S" - else - yn="N" - fi - else - printf "Error: zenity, xmessage, osascript, or powershell executable not found.\n" - exit 1 - fi - else - read -p "Do you want to apply that patch (Y - Apply, N - Do not apply, S - Apply and stage files)? [Y/N/S] " yn - fi - case $yn in - [Yy] ) git apply $patch; - printf "The patch was applied. You can now stage the changes and commit again.\n\n"; - break - ;; - [Nn] ) printf "\nYou can apply these changes with:\n git apply $patch\n"; - printf "(may need to be called from the root directory of your repository)\n"; - printf "Aborting commit. Apply changes and commit again or skip checking with"; - printf " --no-verify (not recommended).\n\n"; - break - ;; - [Ss] ) git apply $patch; - git diff-index --cached --diff-filter=ACMR --name-only $against -- | while read file; - do git add $file; - done - printf "The patch was applied and the changed files staged. You can now commit.\n\n"; - break - ;; - * ) echo "Please answer yes or no." - ;; - esac -done -exit 1 # we don't commit in any case diff --git a/misc/hooks/pre-commit-make-rst b/misc/hooks/pre-commit-make-rst deleted file mode 100755 index 3737272a6d..0000000000 --- a/misc/hooks/pre-commit-make-rst +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -# Git pre-commit hook that checks the class reference syntax using make_rst.py. - -# Workaround because we can't execute the .py file directly on windows -PYTHON=python -py_ver=$($PYTHON -c "import sys; print(sys.version_info.major)") -if [[ "$py_ver" != "3" ]]; then - PYTHON+=3 -fi - -$PYTHON doc/tools/make_rst.py doc/classes modules platform --dry-run --color diff --git a/misc/hooks/winmessage.ps1 b/misc/hooks/winmessage.ps1 deleted file mode 100644 index 3672579544..0000000000 --- a/misc/hooks/winmessage.ps1 +++ /dev/null @@ -1,103 +0,0 @@ -Param ( - [string]$file = "", - [string]$text = "", - [string]$buttons = "OK:0", - [string]$default = "", - [switch]$nearmouse = $false, - [switch]$center = $false, - [string]$geometry = "", - [int32]$timeout = 0, - [string]$title = "Message" -) -Add-Type -assembly System.Windows.Forms - -$global:Result = 0 - -$main_form = New-Object System.Windows.Forms.Form -$main_form.Text = $title - -$geometry_data = $geometry.Split("+") -if ($geometry_data.Length -ge 1) { - $size_data = $geometry_data[0].Split("x") - if ($size_data.Length -eq 2) { - $main_form.Width = $size_data[0] - $main_form.Height = $size_data[1] - } -} -if ($geometry_data.Length -eq 3) { - $main_form.StartPosition = [System.Windows.Forms.FormStartPosition]::Manual - $main_form.Location = New-Object System.Drawing.Point($geometry_data[1], $geometry_data[2]) -} -if ($nearmouse) { - $main_form.StartPosition = [System.Windows.Forms.FormStartPosition]::Manual - $main_form.Location = System.Windows.Forms.Cursor.Position -} -if ($center) { - $main_form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen -} - -$main_form.SuspendLayout() - -$button_panel = New-Object System.Windows.Forms.FlowLayoutPanel -$button_panel.SuspendLayout() -$button_panel.FlowDirection = [System.Windows.Forms.FlowDirection]::RightToLeft -$button_panel.Dock = [System.Windows.Forms.DockStyle]::Bottom -$button_panel.Autosize = $true - -if ($file -ne "") { - $text = [IO.File]::ReadAllText($file).replace("`n", "`r`n") -} - -if ($text -ne "") { - $text_box = New-Object System.Windows.Forms.TextBox - $text_box.Multiline = $true - $text_box.ReadOnly = $true - $text_box.Autosize = $true - $text_box.Text = $text - $text_box.Select(0,0) - $text_box.Dock = [System.Windows.Forms.DockStyle]::Fill - $main_form.Controls.Add($text_box) -} - -$buttons_array = $buttons.Split(",") -foreach ($button in $buttons_array) { - $button_data = $button.Split(":") - $button_ctl = New-Object System.Windows.Forms.Button - if ($button_data.Length -eq 2) { - $button_ctl.Tag = $button_data[1] - } else { - $button_ctl.Tag = 100 + $buttons_array.IndexOf($button) - } - if ($default -eq $button_data[0]) { - $main_form.AcceptButton = $button_ctl - } - $button_ctl.Autosize = $true - $button_ctl.Text = $button_data[0] - $button_ctl.Add_Click( - { - Param($sender) - $global:Result = $sender.Tag - $main_form.Close() - } - ) - $button_panel.Controls.Add($button_ctl) -} -$main_form.Controls.Add($button_panel) - -$button_panel.ResumeLayout($false) -$main_form.ResumeLayout($false) - -if ($timeout -gt 0) { - $timer = New-Object System.Windows.Forms.Timer - $timer.Add_Tick( - { - $global:Result = 0 - $main_form.Close() - } - ) - $timer.Interval = $timeout - $timer.Start() -} -$dlg_res = $main_form.ShowDialog() - -[Environment]::Exit($global:Result) diff --git a/misc/msvs/props.template b/misc/msvs/props.template new file mode 100644 index 0000000000..82e3e81f18 --- /dev/null +++ b/misc/msvs/props.template @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Condition="'$(GodotConfiguration)|$(GodotPlatform)'=='%%VSCONF%%'"> + <NMakeBuildCommandLine>%%BUILD%%</NMakeBuildCommandLine> + <NMakeReBuildCommandLine>%%REBUILD%%</NMakeReBuildCommandLine> + <NMakeCleanCommandLine>%%CLEAN%%</NMakeCleanCommandLine> + <NMakeOutput Condition="'$(NMakeOutput)' == ''">%%OUTPUT%%</NMakeOutput> + <NMakePreprocessorDefinitions>%%DEFINES%%;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath>%%INCLUDES%%;$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes>$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath>$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies>$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + <AdditionalOptions>%%OPTIONS%% $(AdditionalOptions)</AdditionalOptions> + </PropertyGroup> + <PropertyGroup Condition="%%CONDITION%%"> + %%PROPERTIES%% + </PropertyGroup> + <ItemGroup Condition="%%CONDITION%%"> + %%EXTRA_ITEMS%% + </ItemGroup> +</Project> +<!-- CHECKSUM +%%HASH%% +--> diff --git a/misc/msvs/sln.template b/misc/msvs/sln.template new file mode 100644 index 0000000000..25d9d88a49 --- /dev/null +++ b/misc/msvs/sln.template @@ -0,0 +1,20 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34221.43 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "%%NAME%%", "%%NAME%%.vcxproj", "{%%UUID%%}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + %%SECTION1%% + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + %%SECTION2%% + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {%%SLNUUID%%} + EndGlobalSection +EndGlobal diff --git a/misc/msvs/vcxproj.filters.template b/misc/msvs/vcxproj.filters.template new file mode 100644 index 0000000000..11d331d15d --- /dev/null +++ b/misc/msvs/vcxproj.filters.template @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>%%UUID1%%</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>%%UUID2%%</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>%%UUID3%%</UniqueIdentifier> + </Filter> + <Filter Include="Scripts"> + <UniqueIdentifier>%%UUID4%%</UniqueIdentifier> + </Filter> + %%FILTERS%% + </ItemGroup> + <ItemGroup> + %%COMPILES%% + </ItemGroup> + <ItemGroup> + %%INCLUDES%% + </ItemGroup> + <ItemGroup> + %%OTHERS%% + </ItemGroup> +</Project> +<!-- CHECKSUM +%%HASH%% +--> diff --git a/misc/msvs/vcxproj.template b/misc/msvs/vcxproj.template new file mode 100644 index 0000000000..2cdb82d01f --- /dev/null +++ b/misc/msvs/vcxproj.template @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + %%CONFS%% + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{%%UUID%%}</ProjectGuid> + <RootNamespace>godot</RootNamespace> + <Keyword>MakeFileProj</Keyword> + <VCProjectUpgraderObjectName>NoUpgrade</VCProjectUpgraderObjectName> + </PropertyGroup> + %%PROPERTIES%% + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <UseOfMfc>false</UseOfMfc> + <PlatformToolset>v143</PlatformToolset> + <OutDir>$(SolutionDir)\bin\$(GodotPlatform)\$(GodotConfiguration)\</OutDir> + <IntDir>obj\$(GodotPlatform)\$(GodotConfiguration)\</IntDir> + <LayoutDir>$(OutDir)\Layout</LayoutDir> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(GodotPlatform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(GodotPlatform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <ActiveProjectItemList></ActiveProjectItemList> + </PropertyGroup> + %%IMPORTS%% + <ItemGroup Condition="'$(IncludeListImported)'==''"> + %%DEFAULT_ITEMS%% + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> +<!-- CHECKSUM +%%HASH%% +--> diff --git a/misc/scripts/black_format.sh b/misc/scripts/black_format.sh deleted file mode 100755 index 3a64284eb6..0000000000 --- a/misc/scripts/black_format.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# This script runs black on all Python files in the repo. - -set -uo pipefail - -# Apply black. -echo -e "Formatting Python files..." -PY_FILES=$(git ls-files -- '*SConstruct' '*SCsub' '*.py' ':!:.git/*' ':!:thirdparty/*') -black -l 120 $PY_FILES - -diff=$(git diff --color) - -# If no diff has been generated all is OK, clean up, and exit. -if [ -z "$diff" ] ; then - printf "\e[1;32m*** Files in this commit comply with the black style rules.\e[0m\n" - exit 0 -fi - -# A diff has been created, notify the user, clean up, and exit. -printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" -# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`. -printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge' - -printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n" -exit 1 diff --git a/misc/scripts/check_ci_log.py b/misc/scripts/check_ci_log.py index 1e5a12eeb4..d024a3e375 100755 --- a/misc/scripts/check_ci_log.py +++ b/misc/scripts/check_ci_log.py @@ -9,8 +9,8 @@ if len(sys.argv) < 2: fname = sys.argv[1] -fileread = open(fname.strip(), "r") -file_contents = fileread.read() +with open(fname.strip(), "r", encoding="utf-8") as fileread: + file_contents = fileread.read() # If find "ERROR: AddressSanitizer:", then happens invalid read or write # This is critical bug, so we need to fix this as fast as possible diff --git a/misc/scripts/clang_format.sh b/misc/scripts/clang_format.sh deleted file mode 100755 index 40d94d4276..0000000000 --- a/misc/scripts/clang_format.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env bash - -# This script runs clang-format and fixes copyright headers on all relevant files in the repo. -# This is the primary script responsible for fixing style violations. - -set -uo pipefail - -if [ $# -eq 0 ]; then - # Loop through all code files tracked by Git. - files=$(git ls-files -- '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh' '*.cxx' '*.m' '*.mm' '*.inc' '*.java' '*.glsl' \ - ':!:.git/*' ':!:thirdparty/*' ':!:*/thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' \ - ':!:*-so_wrap.*' ':!:tests/python_build/*') -else - # $1 should be a file listing file paths to process. Used in CI. - files=$(cat "$1" | grep -v "thirdparty/" | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java|glsl)$" | grep -v "platform/android/java/lib/src/com/google/" | grep -v "\-so_wrap\." | grep -v "tests/python_build/") -fi - -if [ ! -z "$files" ]; then - clang-format --Wno-error=unknown -i $files -fi - -# Fix copyright headers, but not all files get them. -for f in $files; do - if [[ "$f" == *"inc" && "$f" != *"compat.inc" ]]; then - continue - elif [[ "$f" == *"glsl" ]]; then - continue - 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 - elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix"* ]]; then - continue - fi - - python misc/scripts/copyright_headers.py "$f" -done - -diff=$(git diff --color) - -# If no diff has been generated all is OK, clean up, and exit. -if [ -z "$diff" ] ; then - printf "\e[1;32m*** Files in this commit comply with the clang-format style rules.\e[0m\n" - exit 0 -fi - -# A diff has been created, notify the user, clean up, and exit. -printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" -# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`. -printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge' - -printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n" -exit 1 diff --git a/misc/scripts/clang_tidy.sh b/misc/scripts/clang_tidy.sh index c4811b903c..0c6998b491 100755 --- a/misc/scripts/clang_tidy.sh +++ b/misc/scripts/clang_tidy.sh @@ -27,7 +27,7 @@ fi # A diff has been created, notify the user, clean up, and exit. printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" # Perl commands replace trailing spaces with `·` and tabs with `<TAB>`. -printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge' +printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge' printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n" exit 1 diff --git a/misc/scripts/codespell.sh b/misc/scripts/codespell.sh index 2de440679f..7dad25fa23 100755 --- a/misc/scripts/codespell.sh +++ b/misc/scripts/codespell.sh @@ -3,6 +3,6 @@ SKIP_LIST="./.*,./**/.*,./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./A SKIP_LIST+="./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/renames_map_3_to_4.cpp,./misc/scripts/codespell.sh," SKIP_LIST+="./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json," -IGNORE_LIST="breaked,curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,mis,nd,numer,ot,requestor,te,vai" +IGNORE_LIST="breaked,cancelled,curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,mis,nd,numer,ot,requestor,te,vai" codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}" --builtin "clear,rare,en-GB_to_en-US" diff --git a/misc/scripts/copyright_headers.py b/misc/scripts/copyright_headers.py index a5e2f0c05d..2b1201b3c0 100755 --- a/misc/scripts/copyright_headers.py +++ b/misc/scripts/copyright_headers.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import os import sys header = """\ @@ -35,61 +36,61 @@ header = """\ /**************************************************************************/ """ -fname = sys.argv[1] +if len(sys.argv) < 2: + print("Invalid usage of copyright_headers.py, it should be called with a path to one or multiple files.") + sys.exit(1) -# Handle replacing $filename with actual filename and keep alignment -fsingle = fname.strip() -if fsingle.find("/") != -1: - fsingle = fsingle[fsingle.rfind("/") + 1 :] -rep_fl = "$filename" -rep_fi = fsingle -len_fl = len(rep_fl) -len_fi = len(rep_fi) -# Pad with spaces to keep alignment -if len_fi < len_fl: - for x in range(len_fl - len_fi): - rep_fi += " " -elif len_fl < len_fi: - for x in range(len_fi - len_fl): - rep_fl += " " -if header.find(rep_fl) != -1: - text = header.replace(rep_fl, rep_fi) -else: - text = header.replace("$filename", fsingle) -text += "\n" +for f in sys.argv[1:]: + fname = f -# We now have the proper header, so we want to ignore the one in the original file -# and potentially empty lines and badly formatted lines, while keeping comments that -# come after the header, and then keep everything non-header unchanged. -# To do so, we skip empty lines that may be at the top in a first pass. -# In a second pass, we skip all consecutive comment lines starting with "/*", -# then we can append the rest (step 2). + # Handle replacing $filename with actual filename and keep alignment + fsingle = os.path.basename(fname.strip()) + rep_fl = "$filename" + rep_fi = fsingle + len_fl = len(rep_fl) + len_fi = len(rep_fi) + # Pad with spaces to keep alignment + if len_fi < len_fl: + for x in range(len_fl - len_fi): + rep_fi += " " + elif len_fl < len_fi: + for x in range(len_fi - len_fl): + rep_fl += " " + if header.find(rep_fl) != -1: + text = header.replace(rep_fl, rep_fi) + else: + text = header.replace("$filename", fsingle) + text += "\n" -fileread = open(fname.strip(), "r") -line = fileread.readline() -header_done = False + # We now have the proper header, so we want to ignore the one in the original file + # and potentially empty lines and badly formatted lines, while keeping comments that + # come after the header, and then keep everything non-header unchanged. + # To do so, we skip empty lines that may be at the top in a first pass. + # In a second pass, we skip all consecutive comment lines starting with "/*", + # then we can append the rest (step 2). -while line.strip() == "": # Skip empty lines at the top - line = fileread.readline() + with open(fname.strip(), "r", encoding="utf-8") as fileread: + line = fileread.readline() + header_done = False -if line.find("/**********") == -1: # Godot header starts this way - # Maybe starting with a non-Godot comment, abort header magic - header_done = True + while line.strip() == "" and line != "": # Skip empty lines at the top + line = fileread.readline() -while not header_done: # Handle header now - if line.find("/*") != 0: # No more starting with a comment - header_done = True - if line.strip() != "": - text += line - line = fileread.readline() + if line.find("/**********") == -1: # Godot header starts this way + # Maybe starting with a non-Godot comment, abort header magic + header_done = True -while line != "": # Dump everything until EOF - text += line - line = fileread.readline() + while not header_done: # Handle header now + if line.find("/*") != 0: # No more starting with a comment + header_done = True + if line.strip() != "": + text += line + line = fileread.readline() -fileread.close() + while line != "": # Dump everything until EOF + text += line + line = fileread.readline() -# Write -filewrite = open(fname.strip(), "w") -filewrite.write(text) -filewrite.close() + # Write + with open(fname.strip(), "w", encoding="utf-8", newline="\n") as filewrite: + filewrite.write(text) diff --git a/misc/scripts/dotnet_format.py b/misc/scripts/dotnet_format.py new file mode 100644 index 0000000000..83265be7c5 --- /dev/null +++ b/misc/scripts/dotnet_format.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import glob +import os +import sys + +# Create dummy generated files. +for path in [ + "modules/mono/SdkPackageVersions.props", +]: + os.makedirs(os.path.dirname(path), exist_ok=True) + with open(path, "w", encoding="utf-8", newline="\n") as f: + f.write("<Project />") + +# Avoid importing GeneratedIncludes.props. +os.environ["GodotSkipGenerated"] = "true" + +# Match all the input files to their respective C# project. +input_files = [os.path.normpath(x) for x in sys.argv] +projects = { + path: [f for f in sys.argv if os.path.commonpath([f, path]) == path] + for path in [os.path.dirname(f) for f in glob.glob("**/*.csproj", recursive=True)] +} + +# Run dotnet format on all projects with more than 0 modified files. +for path, files in projects.items(): + if len(files) > 0: + command = f"dotnet format {path} --include {' '.join(files)}" + os.system(command) diff --git a/misc/scripts/dotnet_format.sh b/misc/scripts/dotnet_format.sh deleted file mode 100755 index cac00f5cb1..0000000000 --- a/misc/scripts/dotnet_format.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -# This script runs dotnet format on all relevant files in the repo. -# This is the primary script responsible for fixing style violations in C# files. - -set -uo pipefail - -# Create dummy generated files. -echo "<Project />" > modules/mono/SdkPackageVersions.props -mkdir -p modules/mono/glue/GodotSharp/GodotSharp/Generated -echo "<Project />" > modules/mono/glue/GodotSharp/GodotSharp/Generated/GeneratedIncludes.props -mkdir -p modules/mono/glue/GodotSharp/GodotSharpEditor/Generated -echo "<Project />" > modules/mono/glue/GodotSharp/GodotSharpEditor/Generated/GeneratedIncludes.props - -# Loops through all C# projects tracked by Git. -git ls-files -- '*.csproj' \ - ':!:.git/*' ':!:thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' ':!:*-so_wrap.*' | -while read -r f; do - # Run dotnet format. - dotnet format "$f" -done - -diff=$(git diff --color) - -# If no diff has been generated all is OK, clean up, and exit. -if [ -z "$diff" ] ; then - printf "\e[1;32m*** Files in this commit comply with the dotnet format style rules.\e[0m\n" - exit 0 -fi - -# A diff has been created, notify the user, clean up, and exit. -printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" -# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`. -printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge' - -printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n" -exit 1 diff --git a/misc/scripts/file_format.sh b/misc/scripts/file_format.sh index 94a3affbd7..ad58657883 100755 --- a/misc/scripts/file_format.sh +++ b/misc/scripts/file_format.sh @@ -82,7 +82,7 @@ then # A diff has been created, notify the user, clean up, and exit. printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" # Perl commands replace trailing spaces with `·` and tabs with `<TAB>`. - printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge' + printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge' fi printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n" diff --git a/misc/scripts/header_guards.sh b/misc/scripts/header_guards.sh index ce0b3f334d..a79ccd4bee 100755 --- a/misc/scripts/header_guards.sh +++ b/misc/scripts/header_guards.sh @@ -81,7 +81,7 @@ fi # A diff has been created, notify the user, clean up, and exit. printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n" # Perl commands replace trailing spaces with `·` and tabs with `<TAB>`. -printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge' +printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge' printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n" exit 1 diff --git a/misc/scripts/install_d3d12_sdk_windows.py b/misc/scripts/install_d3d12_sdk_windows.py new file mode 100644 index 0000000000..6dd0818b97 --- /dev/null +++ b/misc/scripts/install_d3d12_sdk_windows.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python + +import os +import urllib.request +import shutil +import subprocess + +# Base Godot dependencies path +# If cross-compiling (no LOCALAPPDATA), we install in `bin` +deps_folder = os.getenv("LOCALAPPDATA") +if deps_folder: + deps_folder = os.path.join(deps_folder, "Godot", "build_deps") +else: + deps_folder = os.path.join("bin", "build_deps") + +# DirectX Shader Compiler +dxc_version = "v1.7.2308" +dxc_filename = "dxc_2023_08_14.zip" +dxc_archive = os.path.join(deps_folder, dxc_filename) +dxc_folder = os.path.join(deps_folder, "dxc") +# Mesa NIR +mesa_version = "23.1.9" +mesa_filename = "godot-nir-23.1.9.zip" +mesa_archive = os.path.join(deps_folder, mesa_filename) +mesa_folder = os.path.join(deps_folder, "mesa") +# WinPixEventRuntime +pix_version = "1.0.231030001" +pix_archive = os.path.join(deps_folder, f"WinPixEventRuntime_{pix_version}.nupkg") +pix_folder = os.path.join(deps_folder, "pix") +# DirectX 12 Agility SDK +agility_sdk_version = "1.610.4" +agility_sdk_archive = os.path.join(deps_folder, f"Agility_SDK_{agility_sdk_version}.nupkg") +agility_sdk_folder = os.path.join(deps_folder, "agility_sdk") + +# Create dependencies folder +if not os.path.exists(deps_folder): + os.makedirs(deps_folder) + +# DirectX Shader Compiler +print("[1/4] DirectX Shader Compiler") +if os.path.isfile(dxc_archive): + os.remove(dxc_archive) +print(f"Downloading DirectX Shader Compiler {dxc_filename} ...") +urllib.request.urlretrieve( + f"https://github.com/microsoft/DirectXShaderCompiler/releases/download/{dxc_version}/{dxc_filename}", + dxc_archive, +) +if os.path.exists(dxc_folder): + print(f"Removing existing local DirectX Shader Compiler installation in {dxc_folder} ...") + shutil.rmtree(dxc_folder) +print(f"Extracting DirectX Shader Compiler {dxc_filename} to {dxc_folder} ...") +shutil.unpack_archive(dxc_archive, dxc_folder) +os.remove(dxc_archive) +print(f"DirectX Shader Compiler {dxc_filename} installed successfully.\n") + +# Mesa NIR +print("[2/4] Mesa NIR") +if os.path.isfile(mesa_archive): + os.remove(mesa_archive) +print(f"Downloading Mesa NIR {mesa_filename} ...") +urllib.request.urlretrieve( + f"https://github.com/godotengine/godot-nir-static/releases/download/{mesa_version}/{mesa_filename}", + mesa_archive, +) +if os.path.exists(mesa_folder): + print(f"Removing existing local Mesa NIR installation in {mesa_folder} ...") + shutil.rmtree(mesa_folder) +print(f"Extracting Mesa NIR {mesa_filename} to {mesa_folder} ...") +shutil.unpack_archive(mesa_archive, mesa_folder) +os.remove(mesa_archive) +print(f"Mesa NIR {mesa_filename} installed successfully.\n") + +# WinPixEventRuntime + +# MinGW needs DLLs converted with dlltool. +# We rely on finding gendef/dlltool to detect if we have MinGW. +# Check existence of needed tools for generating mingw library. +gendef = shutil.which("gendef") or "" +dlltool = shutil.which("dlltool") or "" +if dlltool == "": + dlltool = shutil.which("x86_64-w64-mingw32-dlltool") or "" +has_mingw = gendef != "" and dlltool != "" + +print("[3/4] WinPixEventRuntime") +if os.path.isfile(pix_archive): + os.remove(pix_archive) +print(f"Downloading WinPixEventRuntime {pix_version} ...") +urllib.request.urlretrieve(f"https://www.nuget.org/api/v2/package/WinPixEventRuntime/{pix_version}", pix_archive) +if os.path.exists(pix_folder): + print(f"Removing existing local WinPixEventRuntime installation in {pix_folder} ...") + shutil.rmtree(pix_folder) +print(f"Extracting WinPixEventRuntime {pix_version} to {pix_folder} ...") +shutil.unpack_archive(pix_archive, pix_folder, "zip") +os.remove(pix_archive) +if has_mingw: + print("Adapting WinPixEventRuntime to also support MinGW alongside MSVC.") + cwd = os.getcwd() + os.chdir(pix_folder) + subprocess.run([gendef, "./bin/x64/WinPixEventRuntime.dll"]) + subprocess.run( + [dlltool] + + "--machine i386:x86-64 --no-leading-underscore -d WinPixEventRuntime.def -D WinPixEventRuntime.dll -l ./bin/x64/libWinPixEventRuntime.a".split() + ) + subprocess.run([gendef, "./bin/ARM64/WinPixEventRuntime.dll"]) + subprocess.run( + [dlltool] + + "--machine arm64 --no-leading-underscore -d WinPixEventRuntime.def -D WinPixEventRuntime.dll -l ./bin/ARM64/libWinPixEventRuntime.a".split() + ) + os.chdir(cwd) +else: + print("MinGW wasn't found, so only MSVC support is provided for WinPixEventRuntime.") +print(f"WinPixEventRuntime {pix_version} installed successfully.\n") + +# DirectX 12 Agility SDK +print("[4/4] DirectX 12 Agility SDK") +if os.path.isfile(agility_sdk_archive): + os.remove(agility_sdk_archive) +print(f"Downloading DirectX 12 Agility SDK {agility_sdk_version} ...") +urllib.request.urlretrieve( + f"https://www.nuget.org/api/v2/package/Microsoft.Direct3D.D3D12/{agility_sdk_version}", agility_sdk_archive +) +if os.path.exists(agility_sdk_folder): + print(f"Removing existing local DirectX 12 Agility SDK installation in {agility_sdk_folder} ...") + shutil.rmtree(agility_sdk_folder) +print(f"Extracting DirectX 12 Agility SDK {agility_sdk_version} to {agility_sdk_folder} ...") +shutil.unpack_archive(agility_sdk_archive, agility_sdk_folder, "zip") +os.remove(agility_sdk_archive) +print(f"DirectX 12 Agility SDK {agility_sdk_version} installed successfully.\n") + +# Complete message +print(f'All Direct3D 12 SDK components were installed to "{deps_folder}" successfully!') +print('You can now build Godot with Direct3D 12 support enabled by running "scons d3d12=yes".') |