diff options
Diffstat (limited to 'misc')
23 files changed, 252 insertions, 585 deletions
diff --git a/misc/dist/docker/Dockerfile b/misc/dist/docker/Dockerfile deleted file mode 100644 index 428de9d1a7..0000000000 --- a/misc/dist/docker/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM ubuntu:14.04 -MAINTAINER Mohammad Rezai, https://github.com/mrezai -WORKDIR /godot-dev -COPY scripts/install-android-tools /godot-dev/ -ENV DEBIAN_FRONTEND noninteractive -RUN dpkg --add-architecture i386 && \ - apt-get update && \ - apt-get upgrade -y && \ - apt-get install --no-install-recommends -y -q \ - build-essential gcc-multilib g++-multilib mingw32 mingw-w64 scons pkg-config libx11-dev libxcursor-dev \ - libasound2-dev libfreetype6-dev libgl1-mesa-dev libglu-dev libssl-dev libxinerama-dev libudev-dev \ - git wget openjdk-7-jdk libbcprov-java libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 lib32z1 - diff --git a/misc/dist/docker/README.md b/misc/dist/docker/README.md deleted file mode 100644 index 71aac8a77c..0000000000 --- a/misc/dist/docker/README.md +++ /dev/null @@ -1,40 +0,0 @@ -## A Docker image to build Linux, Windows and Android godot binaries. - -The main reason to write this, is to provide a simple way in all platforms to integrate external godot modules and build a custom version of godot. - -## usage -1. Install docker on Linux or docker toolbox on Windows or Mac. -2. Open a terminal on linux or "Docker Quickstart Terminal" on Windows or Mac. -3. Run command: - - Linux: `cd` - - Windows: `cd /c/Users/YOUR_USERNAME` - - Mac: `cd /Users/YOUR_USERNAME` -4. Get godot source code: `git clone https://github.com/godotengine/godot.git` -5. Run command: `cd godot/tools/docker` -6. Run command: `docker build -t godot .`(In Linux run Docker commands with `sudo` or add your user to docker group before run the Docker commands). The godot docker image will be build after a while. -7. Run command: - - Linux: `docker run -it --name=godot-dev -v /home/YOUR_USERNAME/godot:/godot-dev/godot godot` - - Windows: `docker run -it --name=godot-dev -v /c/Users/YOUR_USERNAME/godot:/godot-dev/godot godot` - - Mac: `docker run -it --name=godot-dev -v /Users/YOUR_USERNAME/godot:/godot-dev/godot godot` - You are in the godot-dev container and /godot-dev directory now. -8. Run `./install-android-tools` to download and install all android development tools. -9. Run command: `source ~/.bashrc` -10. Run command: `cd godot` -11. Run command: `scons p=android target=release` to test everything is ok. You can set platform to x11, windows, android, haiku and server. - -After use and exit, you can use this environment again by open terminal and type commands: `docker start godot-dev && docker attach godot-dev`. - -### Windows and Mac stuffs: - -- Speed up compilation: - - Exit from container. - - Run command: `docker-machine stop` - - Open "Oracle VM VirtualBox". - - In settings of default VM increase CPU cores and RAM to suitable values. - - Run command: `docker-machine start` - - Run command: `docker start godot-dev && docker attach godot-dev` - -- ssh to VM(can be useful sometimes): - - `docker-machine ssh` - -Check docker and boot2docker projects for more details. diff --git a/misc/dist/docker/scripts/install-android-tools b/misc/dist/docker/scripts/install-android-tools deleted file mode 100644 index 8a617d9942..0000000000 --- a/misc/dist/docker/scripts/install-android-tools +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -BASH_RC=~/.bashrc -GODOT_BUILD_TOOLS_PATH=/godot-dev/build-tools -mkdir -p $GODOT_BUILD_TOOLS_PATH -cd $GODOT_BUILD_TOOLS_PATH - -ANDROID_BASE_URL=http://dl.google.com/android - -ANDROID_SDK_RELEASE=android-sdk_r24.4.1 -ANDROID_SDK_DIR=android-sdk-linux -ANDROID_SDK_FILENAME=$ANDROID_SDK_RELEASE-linux.tgz -ANDROID_SDK_URL=$ANDROID_BASE_URL/$ANDROID_SDK_FILENAME -ANDROID_SDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_SDK_DIR -ANDROID_SDK_SHA1=725bb360f0f7d04eaccff5a2d57abdd49061326d - -ANDROID_NDK_RELEASE=android-ndk-r10e -ANDROID_NDK_DIR=$ANDROID_NDK_RELEASE -ANDROID_NDK_FILENAME=$ANDROID_NDK_RELEASE-linux-x86_64.bin -ANDROID_NDK_URL=$ANDROID_BASE_URL/ndk/$ANDROID_NDK_FILENAME -ANDROID_NDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_NDK_DIR -ANDROID_NDK_MD5=19af543b068bdb7f27787c2bc69aba7f - -echo -echo "Download and install Android development tools ..." -echo - -if [ ! -e $ANDROID_SDK_FILENAME ]; then - echo "Downloading: Android SDK ..." - wget $ANDROID_SDK_URL -else - echo $ANDROID_SDK_SHA1 $ANDROID_SDK_FILENAME > $ANDROID_SDK_FILENAME.sha1 - sha1sum --check --strict $ANDROID_SDK_FILENAME.sha1 - if [ ! $? -eq 0 ]; then - echo "Downloading: Android SDK ..." - wget $ANDROID_SDK_URL - fi -fi - -if [ ! -d $ANDROID_SDK_DIR ]; then - tar -xvzf $ANDROID_SDK_FILENAME -fi - -if [ ! -e $ANDROID_NDK_FILENAME ]; then - echo "Downloading: Android NDK ..." - wget $ANDROID_NDK_URL -else - echo $ANDROID_NDK_MD5 $ANDROID_NDK_FILENAME > $ANDROID_NDK_FILENAME.md5 - md5sum --check --strict $ANDROID_NDK_FILENAME.md5 - if [ ! $? -eq 0 ]; then - echo "Downloading: Android NDK ..." - wget $ANDROID_NDK_URL - fi -fi - -if [ ! -d $ANDROID_NDK_DIR ]; then - chmod a+x $ANDROID_NDK_FILENAME - ./$ANDROID_NDK_FILENAME - echo -fi - -cd $ANDROID_SDK_DIR/tools -chmod a+x android - -if ! ./android list target | grep -q 'android-19'; then - echo "Installing: Android Tools ..." - echo y | ./android update sdk --no-ui --all --filter "platform-tools,android-19,build-tools-19.1.0,\ - extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,\ - extra-google-play_apk_expansion,extra-google-play_billing,extra-google-play_licensing" -fi - -EXPORT_VAL="export ANDROID_HOME=$ANDROID_SDK_PATH" -if ! grep -q "^$EXPORT_VAL" $BASH_RC; then - echo $EXPORT_VAL >> ~/.bashrc -fi - - -EXPORT_VAL="export ANDROID_NDK_ROOT=$ANDROID_NDK_PATH" -if ! grep -q "^$EXPORT_VAL" $BASH_RC; then - echo $EXPORT_VAL >> ~/.bashrc -fi - -EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools" -if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools.*" $BASH_RC; then - echo $EXPORT_VAL >> ~/.bashrc -fi - -echo -echo "Done!" -echo
\ No newline at end of file diff --git a/misc/dist/html/fixed-size.html b/misc/dist/html/fixed-size.html index 1cc6fd715e..6c6a3a5d2d 100644 --- a/misc/dist/html/fixed-size.html +++ b/misc/dist/html/fixed-size.html @@ -2,6 +2,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang=""> <head> <meta charset="utf-8" /> + <link id='-gd-engine-icon' rel='icon' type='image/png' href='favicon.png' /> <title></title> <style type="text/css"> diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html index 9269227d02..92b65257d4 100644 --- a/misc/dist/html/full-size.html +++ b/misc/dist/html/full-size.html @@ -3,6 +3,7 @@ <head> <meta charset='utf-8' /> <meta name='viewport' content='width=device-width, user-scalable=no' /> + <link id='-gd-engine-icon' rel='icon' type='image/png' href='favicon.png' /> <title></title> <style type='text/css'> diff --git a/misc/dist/ios_xcode/godot_ios/dummy.cpp b/misc/dist/ios_xcode/godot_ios/dummy.cpp index 7b52e926b0..0fcbf227b5 100644 --- a/misc/dist/ios_xcode/godot_ios/dummy.cpp +++ b/misc/dist/ios_xcode/godot_ios/dummy.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/misc/dist/linux/godot.6 b/misc/dist/linux/godot.6 index 4860c7b5a8..00d19c5178 100644 --- a/misc/dist/linux/godot.6 +++ b/misc/dist/linux/godot.6 @@ -1,4 +1,4 @@ -.TH GODOT "6" "March 2019" "godot 3.2" "Games" +.TH GODOT "6" "January 2020" "godot 4.0" "Games" .SH NAME godot \- multi\-platform 2D and 3D game engine with a feature\-rich editor .SH SYNOPSIS @@ -85,6 +85,12 @@ Force low\-DPI mode (macOS and Windows only). .TP \fB\-\-no\-window\fR Disable window creation (Windows only). Useful together with \fB\-\-script\fR. +.TP +\fB\-\-enable\-vsync\-via\-compositor\fR +When vsync is enabled, vsync via the OS' window compositor (Windows only). +.TP +\fB\-\-disable\-vsync\-via\-compositor\fR +Disable vsync via the OS' window compositor (Windows only). .SS "Debug options:" .TP \fB\-d\fR, \fB\-\-debug\fR @@ -130,11 +136,16 @@ Run a script. \fB\-\-check\-only\fR Only parse for errors and quit (use with --script). .TP -\fB\-\-export\fR <target> -Export the project using the given export target. Export only main pack if path ends with .pck or .zip. +\fB\-\-export\fR <preset> <path> +Export the project using the given preset and matching release template. The preset name should match one defined in export_presets.cfg. +.br +<path> should be absolute or relative to the project directory, and include the filename for the binary (e.g. 'builds/game.exe'). The target directory should exist. +.TP +\fB\-\-export\-debug\fR <preset> <path> +Same as \-\-export, but using the debug template. .TP -\fB\-\-export\-debug\fR <target> -Like \-\-export, but use debug template. +\fB\-\-export\-pack\fR <preset> <path> +Same as \-\-export, but only export the game pack for the given preset. The <path> extension determines whether it will be in PCK or ZIP format. .TP \fB\-\-doctool\fR <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found. @@ -143,7 +154,7 @@ Dump the engine API reference to the given <path> in XML format, merging if exis Disallow dumping the base types (used with \fB\-\-doctool\fR). .TP \fB\-\-build\-solutions\fR -Build the scripting solutions (e.g. for C# projects). +Build the scripting solutions (e.g. for C# projects). Implies \-\-editor and requires a valid project to edit. .TP \fB\-\-gdnative\-generate\-json\-api\fR Generate JSON dump of the Godot API for GDNative bindings. @@ -179,5 +190,5 @@ Godot Engine is a free and open source project and welcomes any kind of contributions. In particular, you can report issues or make suggestions on Godot's issue tracker at \fIhttps://github.com/godotengine/godot/issues\fR. .SH AUTHOR -Man page written by Rémi Verschelde <akien@godotengine.org> on behalf of the +Man page written by Rémi Verschelde <remi@godotengine.org> on behalf of the Godot Engine development team. diff --git a/misc/dist/linux/org.godotengine.Godot.appdata.xml b/misc/dist/linux/org.godotengine.Godot.appdata.xml index 09d5468d70..2b30036006 100644 --- a/misc/dist/linux/org.godotengine.Godot.appdata.xml +++ b/misc/dist/linux/org.godotengine.Godot.appdata.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright 2017-2019 Rémi Verschelde <akien@godotengine.org> --> +<!-- Copyright 2017-2020 Rémi Verschelde <remi@godotengine.org> --> <component type="desktop"> <id>org.godotengine.Godot</id> <metadata_license>CC0-1.0</metadata_license> diff --git a/misc/dist/osx_template.app/Contents/Info.plist b/misc/dist/osx_template.app/Contents/Info.plist index eee787bdaf..696c825594 100755 --- a/misc/dist/osx_template.app/Contents/Info.plist +++ b/misc/dist/osx_template.app/Contents/Info.plist @@ -24,6 +24,10 @@ <string>$signature</string> <key>CFBundleVersion</key> <string>$version</string> + <key>NSMicrophoneUsageDescription</key> + <string>$microphone_usage_description</string> + <key>NSCameraUsageDescription</key> + <string>$camera_usage_description</string> <key>NSHumanReadableCopyright</key> <string>$copyright</string> <key>LSMinimumSystemVersion</key> diff --git a/misc/dist/osx_tools.app/Contents/Info.plist b/misc/dist/osx_tools.app/Contents/Info.plist index bb22f1807c..46550ba6c7 100755 --- a/misc/dist/osx_tools.app/Contents/Info.plist +++ b/misc/dist/osx_tools.app/Contents/Info.plist @@ -9,7 +9,7 @@ <key>CFBundleName</key> <string>Godot</string> <key>CFBundleGetInfoString</key> - <string>(c) 2007-2019 Juan Linietsky, Ariel Manzur & Godot Engine contributors</string> + <string>(c) 2007-2020 Juan Linietsky, Ariel Manzur & Godot Engine contributors</string> <key>CFBundleIconFile</key> <string>Godot.icns</string> <key>CFBundleIdentifier</key> @@ -19,15 +19,19 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>3.2</string> + <string>4.0</string> <key>CFBundleSignature</key> <string>godot</string> <key>CFBundleVersion</key> - <string>3.2</string> + <string>4.0</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-2019 Juan Linietsky, Ariel Manzur & Godot Engine contributors</string> + <string>© 2007-2020 Juan Linietsky, Ariel Manzur & Godot Engine contributors</string> <key>LSMinimumSystemVersion</key> <string>10.9.0</string> <key>LSMinimumSystemVersionByArchitecture</key> diff --git a/misc/dist/shell/_godot.zsh-completion b/misc/dist/shell/_godot.zsh-completion new file mode 100644 index 0000000000..4945ecbabc --- /dev/null +++ b/misc/dist/shell/_godot.zsh-completion @@ -0,0 +1,77 @@ +#compdef godot + +# zsh completion for the Godot editor +# To use it, install this file as `_godot` in a directory specified in your +# `fpath` environment variable then restart your shell. +# +# Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. +# Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +_arguments \ + "1::path to scene or 'project.godot' file:_files" \ + '(-h --help)'{-h,--help}'[display the full help message]' \ + '--version[display the version string]' \ + '(-v --verbose)'{-v,--verbose}'[use verbose stdout mode]' \ + '--quiet[quiet mode, silences stdout messages (errors are still displayed)]' \ + '(-e --editor)'{-e,--editor}'[start the editor instead of running the scene]' \ + '(-p --project-manager)'{-p,--project-manager}'[start the project manager, even if a project is auto-detected]' \ + '(-q --quit)'{-q,--quit}'[quit after the first iteration]' \ + '(-l --language)'{-l,--language}'[use a specific locale (<locale> being a two-letter code)]:two-letter locale code' \ + "--path[path to a project (<directory> must contain a 'project.godot' file)]:path to directory with 'project.godot' file:_dirs" \ + '(-u --upwards)'{-u,--upwards}'[scan folders upwards for project.godot file]' \ + '--main-pack[path to a pack (.pck) file to load]:path to .pck file:_files' \ + '--render-thread[set the render thread mode]:render thread mode:(unsafe safe separate)' \ + '--remote-fs[use a remote filesystem]:remote filesystem address' \ + '--remote-fs-password[password for remote filesystem]:remote filesystem password' \ + '--audio-driver[set the audio driver]:audio driver name' \ + "--video-driver[set the video driver]:video driver name:((GLES3\:'OpenGL ES 3.0 renderer' GLES2\:'OpenGL ES 2.0 renderer'))" \ + '(-f --fullscreen)'{-f,--fullscreen}'[request fullscreen mode]' \ + '(-m --maximized)'{-m,--maximized}'[request a maximized window]' \ + '(-w --windowed)'{-w,--windowed}'[request windowed mode]' \ + '(-t --always-on-top)'{-t,--always-on-top}'[request an always-on-top window]' \ + '--resolution[request window resolution]:resolution in WxH format' \ + '--position[request window position]:position in X,Y format' \ + '--low-dpi[force low-DPI mode (macOS and Windows only)]' \ + '--no-window[disable window creation (Windows only), useful together with --script]' \ + "--enable-vsync-via-compositor[when Vsync is enabled, Vsync via the OS' window compositor (Windows only)]" \ + "--disable-vsync-via-compositor[disable Vsync via the OS' window compositor (Windows only)]" \ + '(-d --debug)'{-d,--debug}'[debug (local stdout debugger)]' \ + '(-b --breakpoints)'{-b,--breakpoints}'[specify the breakpoint list as source::line comma-separated pairs, no spaces (use %20 instead)]:breakpoint list' \ + '--profiling[enable profiling in the script debugger]' \ + '--remote-debug[enable remote debugging]:remote debugger address' \ + '--debug-collisions[show collision shapes when running the scene]' \ + '--debug-navigation[show navigation polygons when running the scene]' \ + '--frame-delay[simulate high CPU load (delay each frame by the given number of milliseconds)]:number of milliseconds' \ + '--time-scale[force time scale (higher values are faster, 1.0 is normal speed)]:time scale' \ + '--disable-render-loop[disable render loop so rendering only occurs when called explicitly from script]' \ + '--disable-crash-handler[disable crash handler when supported by the platform code]' \ + '--fixed-fps[force a fixed number of frames per second (this setting disables real-time synchronization)]:frames per second' \ + '--print-fps[print the frames per second to the stdout]' \ + '(-s, --script)'{-s,--script}'[run a script]:path to script:_files' \ + '--check-only[only parse for errors and quit (use with --script)]' \ + '--export[export the project using the given preset and matching release template]:export preset name' \ + '--export-debug[same as --export, but using the debug template]:export preset name' \ + '--export-pack[same as --export, but only export the game pack for the given preset]:export preset name' \ + '--doctool[dump the engine API reference to the given path in XML format, merging if existing files are found]:path to base Godot build directory:_dirs' \ + '--no-docbase[disallow dumping the base types (used with --doctool)]' \ + '--build-solutions[build the scripting solutions (e.g. for C# projects)]' \ + '--gdnative-generate-json-api[generate JSON dump of the Godot API for GDNative bindings]' \ + '--test[run a unit test]:unit test name' diff --git a/misc/dist/shell/godot.bash-completion b/misc/dist/shell/godot.bash-completion new file mode 100644 index 0000000000..714b6758e3 --- /dev/null +++ b/misc/dist/shell/godot.bash-completion @@ -0,0 +1,124 @@ +#!/usr/bin/env bash + +# Bash completion for the Godot editor +# To use it, install this file in `/etc/bash_completion.d` then restart your shell. +# You can also `source` this file directly in your shell startup file. +# +# Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. +# Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +_complete_godot_options() { + # Since Bash doesn't support option descriptions in autocompletion, + # only display long options to be more descriptive. + # shellcheck disable=SC2207 + COMPREPLY=($(compgen -W " \ +--help +--version +--verbose +--quiet +--editor +--project-manager +--quit +--language +--path +--upwards +--main-pack +--render-thread +--remote-fs +--remote-fs-password +--audio-driver +--video-driver +--fullscreen +--maximized +--windowed +--always-on-top +--resolution +--position +--low-dpi +--no-window +--enable-vsync-via-compositor +--disable-vsync-via-compositor +--debug +--breakpoints +--profiling +--remote-debug +--debug-collisions +--debug-navigation +--frame-delay +--time-scale +--disable-render-loop +--disable-crash-handler +--fixed-fps +--print-fps +--script +--check-only +--export +--export-debug +--export-pack +--doctool +--no-docbase +--build-solutions +--gdnative-generate-json-api +--test +" -- "$1")) +} + +_complete_godot_bash() { + local cur="${COMP_WORDS[$COMP_CWORD]}" prev + + # Complete options or the positional argument. + if [[ $cur == -* ]]; then + _complete_godot_options "$cur" + else + local IFS=$'\n\t' + # shellcheck disable=SC2207 + COMPREPLY=($(compgen -f -X "!*.@(scn|tscn|escn|godot)" -- "$cur")) + fi + + # If the array is accessed out of bounds (which will happen for the first argument), + # `$prev` will be an empty string and won't match any of the conditions below. + prev="${COMP_WORDS[$((COMP_CWORD-1))]}" + + # Complete option values. + if [[ $prev == "--render-thread" ]]; then + local IFS=$' \n\t' + # shellcheck disable=SC2207 + COMPREPLY=($(compgen -W "unsafe safe separate" -- "$cur")) + elif [[ $prev == "--video-driver" ]]; then + local IFS=$' \n\t' + # shellcheck disable=SC2207 + COMPREPLY=($(compgen -W "GLES3 GLES2" -- "$cur")) + elif [[ $prev == "--path" || $prev == "--doctool" ]]; then + local IFS=$'\n\t' + # shellcheck disable=SC2207 + COMPREPLY=($(compgen -d -- "$cur")) + elif [[ $prev == "--main-pack" ]]; then + local IFS=$'\n\t' + # shellcheck disable=SC2207 + COMPREPLY=($(compgen -f -X "!*.@(pck|zip)" -- "$cur")) + elif [[ $prev == "-s" || $prev == "--script" ]]; then + local IFS=$'\n\t' + # shellcheck disable=SC2207 + COMPREPLY=($(compgen -f -X "!*.gd" -- "$cur")) + fi +} + +complete -o filenames -F _complete_godot_bash godot diff --git a/misc/hooks/README.md b/misc/hooks/README.md index 6ec90fcc54..b18ba7df38 100644 --- a/misc/hooks/README.md +++ b/misc/hooks/README.md @@ -1,6 +1,6 @@ # Git hooks for Godot Engine -This folder contains git hooks meant to be installed locally by 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 @@ -9,10 +9,12 @@ contributors to make sure they comply with our requirements. before accepting a commit; blocks the commit and generates a patch if the style is not respected. Should work on Linux and macOS. You may need to edit the file if your - clang-format binary is not in the $PATH, or if you want to enable colored + clang-format binary is not in the `$PATH`, or if you want to enable colored output with pygmentize. +- Pre-commit hook for makerst: Checks the class reference syntax using `makerst.py`. + Should work on Linux and macOS. ## Installation -Copy all the files from this folder into your .git/hooks folder, and make sure +Copy all the files from this folder into your `.git/hooks` folder, and make sure the hooks and helper scripts are executable. diff --git a/misc/hooks/pre-commit b/misc/hooks/pre-commit index fc50ed70e7..36e9935785 100755 --- a/misc/hooks/pre-commit +++ b/misc/hooks/pre-commit @@ -14,7 +14,7 @@ # 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-compile pre-commit-uncrustify" -HOOKS="pre-commit-clang-format" +HOOKS="pre-commit-clang-format pre-commit-makerst" ########################################################### # There should be no need to change anything below this line. diff --git a/misc/hooks/pre-commit-makerst b/misc/hooks/pre-commit-makerst new file mode 100755 index 0000000000..d9b684e73b --- /dev/null +++ b/misc/hooks/pre-commit-makerst @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# Git pre-commit hook that checks the class reference syntax using makerst.py. + +doc/tools/makerst.py doc/classes modules --dry-run diff --git a/misc/scripts/file-hex-array.py b/misc/scripts/file-hex-array.py deleted file mode 100755 index a6cdfe541f..0000000000 --- a/misc/scripts/file-hex-array.py +++ /dev/null @@ -1,56 +0,0 @@ -import binascii -import os.path -import sys - - -def tof(filepath): - with open(filepath, 'r') as f: - content = f.read() - content = content.replace("0x", "") - content = content.split(',') - for i in range(len(content)): - if len(content[i]) == 1: - content[i] = "0" + content[i] - content = "".join(content) - with open(filepath + ".file", 'wb') as f: - content = f.write(content.decode("hex")) - print(os.path.basename(filepath) + ".file created.") - exit(0) - - -def toa(filepath): - with open(filepath, 'rb') as f: - content = f.read() - content = binascii.hexlify(content) - content = [content[i:i + 2] for i in range(0, len(content), 2)] - content = ",0x".join(content) - content = "0x" + content - content = content.replace("0x00", "0x0") - with open(filepath + ".array", 'w') as f: - content = f.write(content) - print(os.path.basename(filepath) + ".array created.") - exit(0) - - -def usage(): - print("========================================================\n\ -#\n\ -# Usage: python file-hex-array.py [action] [option]\n\ -#\n\ -# Arguments:\n\ -# action ==> toa # convert file to array [option is file path]\n\ -# tof # convert array to file [option is array file path]\n\ -#\n\ -# Example : python file-hex-array.py toa 1.png\n\ -#\n\ -========================================================") - exit(1) - -if len(sys.argv) != 3: - usage() -if sys.argv[1] == "toa" and os.path.isfile(sys.argv[2]): - toa(sys.argv[2]) -elif sys.argv[1] == "tof" and os.path.isfile(sys.argv[2]): - tof(sys.argv[2]) -else: - usage() diff --git a/misc/scripts/fix_headers.py b/misc/scripts/fix_headers.py index d94db22b42..f0038a8351 100755 --- a/misc/scripts/fix_headers.py +++ b/misc/scripts/fix_headers.py @@ -9,8 +9,8 @@ header = """\ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/misc/scripts/fix_style.sh b/misc/scripts/fix_style.sh index 19ca781535..b33cb0a7b4 100755 --- a/misc/scripts/fix_style.sh +++ b/misc/scripts/fix_style.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Command line arguments run_clang_format=false diff --git a/misc/scripts/make_bmfhdr.py b/misc/scripts/make_bmfhdr.py deleted file mode 100644 index 1d3c40f9c6..0000000000 --- a/misc/scripts/make_bmfhdr.py +++ /dev/null @@ -1,67 +0,0 @@ - - -import sys - -if (len(sys.argv) != 2): - print("Pass me a .fnt argument!") - -f = open(sys.argv[1], "rb") - -name = sys.argv[1].lower().replace(".fnt", "") - -l = f.readline() - -font_height = 0 -font_ascent = 0 -font_charcount = 0 -font_chars = [] -font_cc = 0 - -while(l != ""): - - fs = l.strip().find(" ") - if (fs == -1): - l = f.readline() - continue - t = l[0:fs] - - dv = l[fs + 1:].split(" ") - d = {} - for x in dv: - if (x.find("=") == -1): - continue - s = x.split("=") - d[s[0]] = s[1] - - if (t == "common"): - font_height = d["lineHeight"] - font_ascent = d["base"] - - if (t == "char"): - font_chars.append(d["id"]) - font_chars.append(d["x"]) - font_chars.append(d["y"]) - font_chars.append(d["width"]) - font_chars.append(d["height"]) - font_chars.append(d["xoffset"]) - font_chars.append(d["yoffset"]) - font_chars.append(d["xadvance"]) - font_cc += 1 - - l = f.readline() - - -print("static const int _bi_font_" + name + "_height=" + str(font_height) + ";") -print("static const int _bi_font_" + name + "_ascent=" + str(font_ascent) + ";") -print("static const int _bi_font_" + name + "_charcount=" + str(font_cc) + ";") -cstr = "static const int _bi_font_" + name + "_characters={" -for i in range(len(font_chars)): - - c = font_chars[i] - if (i > 0): - cstr += ", " - cstr += c - -cstr += ("};") - -print(cstr) diff --git a/misc/scripts/make_glwrapper.py b/misc/scripts/make_glwrapper.py deleted file mode 100644 index 15b66a950b..0000000000 --- a/misc/scripts/make_glwrapper.py +++ /dev/null @@ -1,181 +0,0 @@ -#! /usr/bin/env python -import sys - -if (len(sys.argv) < 2): - print("usage: make_glwrapper.py <headers>") - sys.exit(255) - - -functions = [] -types = [] -constants = [] - -READ_FUNCTIONS = 0 -READ_TYPES = 1 -READ_CONSTANTS = 2 - -read_what = READ_TYPES - -def read_file(f): - while(True): - - line = f.readline() - if (line == ""): - break - - line = line.replace("\n", "").strip() - """ - if (line.find("[types]")!=-1): - read_what=READ_TYPES - continue - elif (line.find("[constants]")!=-1): - read=READ_TYPES - continue - elif (line.find("[functions]")!=-1): - read_what=READ_FUNCTIONS - continue - """ - - if (line.find("#define") != -1): - if (line.find("0x") == -1 and line.find("GL_VERSION") == -1): - continue - constants.append(line) - elif (line.find("typedef") != -1): - if (line.find("(") != -1 or line.find(")") != -1 or line.find("ARB") != -1 or line.find("EXT") != -1 or line.find("GL") == -1): - continue - types.append(line) - elif (line.find("APIENTRY") != -1 and line.find("GLAPI") != -1): - - if (line.find("ARB") != -1 or line.find("EXT") != -1 or line.find("NV") != -1): - continue - - line = line.replace("APIENTRY", "") - line = line.replace("GLAPI", "") - - glpos = line.find(" gl") - if (glpos == -1): - - glpos = line.find("\tgl") - if (glpos == -1): - continue - - ret = line[:glpos].strip() - - line = line[glpos:].strip() - namepos = line.find("(") - - if (namepos == -1): - continue - - name = line[:namepos].strip() - line = line[namepos:] - - argpos = line.rfind(")") - if (argpos == -1): - continue - - args = line[1:argpos] - - funcdata = {} - funcdata["ret"] = ret - funcdata["name"] = name - funcdata["args"] = args - - functions.append(funcdata) - print(funcdata) - -for path in sys.argv[1:]: - with open(path, "r") as f: - read_file(f) - -# print(types) -# print(constants) -# print(functions) - - -f = open("glwrapper.h", "w") - -f.write("#ifndef GL_WRAPPER\n") -f.write("#define GL_WRAPPER\n\n\n") - -header_code = """\ -#if defined(__gl_h_) || defined(__GL_H__) -#error gl.h included before glwrapper.h -#endif -#if defined(__glext_h_) || defined(__GLEXT_H_) -#error glext.h included before glwrapper.h -#endif -#if defined(__gl_ATI_h_) -#error glATI.h included before glwrapper.h -#endif - -#define __gl_h_ -#define __GL_H__ -#define __glext_h_ -#define __GLEXT_H_ -#define __gl_ATI_h_ - -#define GL_TRUE 1 -#define GL_FALSE 0 - -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_NONE 0 -#define GL_NO_ERROR 0 - -\n\n -""" - -f.write("#include <stddef.h>\n\n\n") - -f.write(header_code) - -f.write("#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n") -f.write("#if defined(_WIN32) && !defined(__CYGWIN__)\n") -f.write("#define GLWRP_APIENTRY __stdcall\n") -f.write("#else\n") -f.write("#define GLWRP_APIENTRY \n") -f.write("#endif\n\n") -for x in types: - f.write(x + "\n") - -f.write("\n\n") - -for x in constants: - f.write(x + "\n") - -f.write("\n\n") - -for x in functions: - f.write("extern " + x["ret"] + " GLWRP_APIENTRY (*__wrapper_" + x["name"] + ")(" + x["args"] + ");\n") - f.write("#define " + x["name"] + " __wrapper_" + x["name"] + "\n") - -f.write("\n\n") -f.write("typedef void (*GLWrapperFuncPtr)(void);\n\n") -f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n") - -f.write("#ifdef __cplusplus\n}\n#endif\n") - -f.write("#endif\n\n") -f.close() - -f = open("glwrapper.c", "w") - -f.write("\n\n") -f.write("#include \"glwrapper.h\"\n") -f.write("\n\n") - -for x in functions: - f.write(x["ret"] + " GLWRP_APIENTRY (*__wrapper_" + x["name"] + ")(" + x["args"] + ")=NULL;\n") - -f.write("\n\n") -f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) ) {\n") -f.write("\n") - -for x in functions: - f.write("\t__wrapper_" + x["name"] + "=(" + x["ret"] + " GLWRP_APIENTRY (*)(" + x["args"] + "))wrapperFunc(\"" + x["name"] + "\");\n") - -f.write("\n\n") -f.write("}\n") -f.write("\n\n") -f.close() diff --git a/misc/scripts/make_icons.sh b/misc/scripts/make_icons.sh index 5f3ea40d6a..b590f03d38 100644..100755 --- a/misc/scripts/make_icons.sh +++ b/misc/scripts/make_icons.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # Generate .ico, .icns and .zip set of icons for Steam # Make icons with transparent backgrounds and all sizes diff --git a/misc/scripts/makeargs.py b/misc/scripts/makeargs.py deleted file mode 100644 index 26d9cc5a00..0000000000 --- a/misc/scripts/makeargs.py +++ /dev/null @@ -1,82 +0,0 @@ - -text = """ -#define FUNC$numR(m_r,m_func,$argt)\\ - virtual m_r m_func($argtp) { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - m_r ret;\\ - command_queue.push_and_ret( visual_server, &VisualServer::m_func,$argp,&ret);\\ - return ret;\\ - } else {\\ - return visual_server->m_func($argp);\\ - }\\ - } - -#define FUNC$numRC(m_r,m_func,$argt)\\ - virtual m_r m_func($argtp) const { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - m_r ret;\\ - command_queue.push_and_ret( visual_server, &VisualServer::m_func,$argp,&ret);\\ - return ret;\\ - } else {\\ - return visual_server->m_func($argp);\\ - }\\ - } - - -#define FUNC$numS(m_func,$argt)\\ - virtual void m_func($argtp) { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - command_queue.push_and_sync( visual_server, &VisualServer::m_func,$argp);\\ - } else {\\ - visual_server->m_func($argp);\\ - }\\ - } - -#define FUNC$numSC(m_func,$argt)\\ - virtual void m_func($argtp) const { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - command_queue.push_and_sync( visual_server, &VisualServer::m_func,$argp);\\ - } else {\\ - visual_server->m_func($argp);\\ - }\\ - } - - -#define FUNC$num(m_func,$argt)\\ - virtual void m_func($argtp) { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - command_queue.push( visual_server, &VisualServer::m_func,$argp);\\ - } else {\\ - visual_server->m_func($argp);\\ - }\\ - } - -#define FUNC$numC(m_func,$argt)\\ - virtual void m_func($argtp) const { \\ - if (Thread::get_caller_id()!=server_thread) {\\ - command_queue.push( visual_server, &VisualServer::m_func,$argp);\\ - } else {\\ - visual_server->m_func($argp);\\ - }\\ - } - - -""" - - -for i in range(1, 8): - - tp = "" - p = "" - t = "" - for j in range(i): - if (j > 0): - tp += ", " - p += ", " - t += ", " - tp += ("m_arg" + str(j + 1) + " p" + str(j + 1)) - p += ("p" + str(j + 1)) - t += ("m_arg" + str(j + 1)) - - t = text.replace("$argtp", tp).replace("$argp", p).replace("$argt", t).replace("$num", str(i)) - print(t) diff --git a/misc/scripts/memsort.py b/misc/scripts/memsort.py deleted file mode 100644 index fb636b0f78..0000000000 --- a/misc/scripts/memsort.py +++ /dev/null @@ -1,35 +0,0 @@ - -import sys - -arg = "memdump.txt" - -if (len(sys.argv) > 1): - arg = sys.argv[1] - -f = open(arg, "rb") - - -l = f.readline() - - -sum = {} -cnt = {} - - -while(l != ""): - - s = l.split("-") - amount = int(s[1]) - what = s[2] - if (what in sum): - sum[what] += amount - cnt[what] += 1 - else: - sum[what] = amount - cnt[what] = 1 - - l = f.readline() - - -for x in sum: - print(x.strip() + "(" + str(cnt[x]) + "):\n: " + str(sum[x])) |