Merge pull request #40653 from akien-mga/3.2-cherrypicks

Cherry-picks for the 3.2 branch (future 3.2.3) - 4th batch
This commit is contained in:
Rémi Verschelde 2020-07-24 11:13:42 +02:00 committed by GitHub
commit 8b8364cc9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
829 changed files with 1808 additions and 1354 deletions

View File

@ -1,51 +0,0 @@
image: Visual Studio 2019
platform: x64
environment:
HOME: "%HOMEDRIVE%%HOMEPATH%"
PYTHON: C:\Python38
SCONS_CACHE_ROOT: "%HOME%\\scons_cache"
SCONS_CACHE_LIMIT: 1024
OPTIONS: "debug_symbols=no verbose=yes progress=no"
EXTRA_ARGS: "warnings=all werror=yes"
matrix:
- GD_PLATFORM: windows
TARGET: release_debug
TOOLS: yes
matrix:
fast_finish: true
init:
- ps: if ($env:APPVEYOR_REPO_BRANCH -ne "3.2") { $env:APPVEYOR_CACHE_SKIP_SAVE = "true" }
cache:
- "%SCONS_CACHE_ROOT%"
install:
- SET "PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- pip install -U wheel # needed for pip install scons to work, otherwise a flag is missing
- pip install scons # use stable scons
- if defined VS call "%VS%" %ARCH% # if defined - so we can also use mingw
before_build:
- echo %GD_PLATFORM%
- python --version
- scons --version
- set "SCONS_CACHE=%SCONS_CACHE_ROOT%\%APPVEYOR_REPO_BRANCH%"
build_script:
- scons platform=%GD_PLATFORM% target=%TARGET% tools=%TOOLS% %OPTIONS% %EXTRA_ARGS%
after_build:
- git rev-parse --short=9 HEAD > VERSION_HASH.txt
- set /P VERSION_HASH= < VERSION_HASH.txt
- cd bin
- mv godot.windows.opt.tools.64.exe godot_%APPVEYOR_REPO_BRANCH%-%VERSION_HASH%_win64.exe
- 7z a -mx9 godot_%APPVEYOR_REPO_BRANCH%-%VERSION_HASH%_win64.zip *.exe
artifacts:
- path: bin/godot_${APPVEYOR_REPO_BRANCH}-${VERSION_HASH}_win64.zip
name: Win64 release_debug editor build
type: zip

72
.github/workflows/android_builds.yml vendored Normal file
View File

@ -0,0 +1,72 @@
name: Android Builds
on: [push, pull_request]
# Global Cache Settings
env:
GODOT_BASE_BRANCH: 3.2
SCONS_CACHE_LIMIT: 4096
jobs:
android-template:
runs-on: "ubuntu-20.04"
name: Template (target=release, tools=no)
steps:
- uses: actions/checkout@v2
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Install all packages (except scons)
- name: Configure dependencies
run: |
sudo apt-get install openjdk-8-jdk
echo "::set-env name=JAVA_HOME::usr/lib/jvm/java-8-openjdk-amd64"
- name: Install Android SDK and NDK
run: |
echo "::set-env name=PATH::/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:${PATH}"
java -version
echo "::set-env name=ANDROID_HOME::$(pwd)/godot-dev/build-tools/android-sdk"
echo "::set-env name=ANDROID_NDK_ROOT::$(pwd)/godot-dev/build-tools/android-ndk"
misc/ci/android-tools-linux.sh
source ~/.bashrc
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: android-template-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=android target=release tools=no

76
.github/workflows/javascript_builds.yml vendored Normal file
View File

@ -0,0 +1,76 @@
name: JavaScript Builds
on: [push, pull_request]
# Global Cache Settings
env:
GODOT_BASE_BRANCH: 3.2
SCONS_CACHE_LIMIT: 4096
EM_VERSION: latest
EM_CACHE_FOLDER: 'emsdk-cache'
jobs:
javascript-template:
runs-on: "ubuntu-20.04"
name: Template (target=release, tools=no)
steps:
- uses: actions/checkout@v2
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: javascript-template-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Additional cache for Emscripten generated system libraries
- name: Load Emscripten cache
id: javascript-template-emscripten-cache
uses: actions/cache@v2
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{github.job}}
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Set up Emscripten latest
uses: mymindstorm/setup-emsdk@v6
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Verify Emscripten setup
run: |
emcc -v
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=javascript target=release tools=no use_closure_compiler=yes

117
.github/workflows/linux_builds.yml vendored Normal file
View File

@ -0,0 +1,117 @@
name: Linux Builds
on: [push, pull_request]
# Global Cache Settings
env:
GODOT_BASE_BRANCH: 3.2
SCONS_CACHE_LIMIT: 4096
jobs:
linux-editor:
runs-on: "ubuntu-20.04"
name: Editor w/ Mono (target=release_debug, tools=yes)
steps:
- uses: actions/checkout@v2
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Install all packages (except scons)
- name: Configure dependencies
run: |
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: linux-editor-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=x11 tools=yes target=release_debug module_mono_enabled=yes mono_glue=no
linux-template:
runs-on: "ubuntu-20.04"
name: Template w/ Mono (target=release, tools=no)
steps:
- uses: actions/checkout@v2
# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Install all packages (except scons)
- name: Configure dependencies
run: |
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: linux-template-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=x11 target=release tools=no module_mono_enabled=yes mono_glue=no

94
.github/workflows/macos_builds.yml vendored Normal file
View File

@ -0,0 +1,94 @@
name: MacOS Builds
on: [push, pull_request]
# Global Cache Settings
env:
GODOT_BASE_BRANCH: 3.2
SCONS_CACHE_LIMIT: 4096
jobs:
macos-editor:
runs-on: "macos-latest"
name: Editor (target=release_debug, tools=yes)
steps:
- uses: actions/checkout@v2
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: macos-editor-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=osx tools=yes target=release_debug
macos-template:
runs-on: "macos-latest"
name: Template (target=release, tools=no)
steps:
- uses: actions/checkout@v2
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
id: macos-template-cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Compilation
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=osx target=release tools=no

32
.github/workflows/static_checks.yml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Static Checks
on: [push, pull_request]
jobs:
static-checks:
name: Static Checks (clang-format, black format, file format, documentation checks)
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq dos2unix recode clang-format
sudo pip3 install black pygments
- name: File formatting checks (file_format.sh)
run: |
bash ./misc/scripts/file_format.sh
- name: Style checks via clang-format (clang_format.sh)
run: |
bash ./misc/scripts/clang_format.sh
- name: Python style checks via black (black_format.sh)
run: |
bash ./misc/scripts/black_format.sh
- name: Documentation checks
run: |
doc/tools/makerst.py --dry-run doc/classes modules

View File

@ -1,43 +1,36 @@
# Engine build CI
name: Godot CI
on:
# will build EVERY pull request
pull_request:
# will only build explicit branches
push:
branches: [ master, 3.2, 3.1, 3.0 ]
name: Windows Builds
on: [push, pull_request]
# Global Cache Settings
# SCONS_CACHE for windows must be set in the build environment
env:
GODOT_BASE_BRANCH: 3.2
SCONS_CACHE_MSVC_CONFIG: true
SCONS_CACHE_LIMIT: 8192
SCONS_CACHE_LIMIT: 4096
jobs:
windows-editor:
# Windows 10 with latest image
runs-on: "windows-latest"
# Windows Editor - checkout with the plugin
name: Windows Editor (target=release_debug, tools=yes)
name: Editor (target=release_debug, tools=yes)
steps:
- uses: actions/checkout@v2
# Upload cache on completion and check it out now
# Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache.
# Linux with this will work reliably, so not as bad to edit for Linux.
# Upload cache on completion and check it out now
# Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
- name: Load .scons_cache directory
id: windows-editor-cache
uses: RevoluPowered/cache@v2.1
with:
path: /.scons_cache/
key: ${{runner.os}}-editor-${{github.sha}}
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{runner.os}}-editor-${{github.sha}}
${{runner.os}}-editor
${{runner.os}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
@ -72,29 +65,27 @@ jobs:
# name: windows-editor (x64)
# path: bin/godot.windows.opt.tools.64.exe
windows-template:
runs-on: "windows-latest"
name: Windows Template (target=release, tools=no)
name: Template (target=release, tools=no)
steps:
- uses: actions/checkout@v2
# Upload cache on completion and check it out now
# Editing this is pretty dangerous for windows since it can break and needs properly tested with a fresh cache.
# Linux with this will work reliably, so not as bad to edit for Linux.
# Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
- name: Load .scons_cache directory
id: windows-template-cache
uses: RevoluPowered/cache@v2.1
with:
path: /.scons_cache/
key: ${{runner.os}}-template-${{github.sha}}
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{runner.os}}-template-${{github.sha}}
${{runner.os}}-template
${{runner.os}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform)
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
@ -110,6 +101,7 @@ jobs:
python -m pip install scons pywin32
python --version
scons --version
- name: Compilation
env:
SCONS_CACHE: /.scons_cache/

2
.gitignore vendored
View File

@ -33,6 +33,8 @@ platform/android/java/lib/.cxx/
*.os
*.Plo
*.lo
# Binutils tmp linker output of the form "stXXXXXX" where "X" is alphanumeric
st[A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9][A-Za-z0-9]
# Libs generated files
.deps/*

View File

@ -3,16 +3,11 @@ language: cpp
# OS config, depends on actual 'os' in build matrix
dist: xenial
stages:
- check
- build
env:
global:
- SCONS_CACHE=$HOME/.scons_cache/$TRAVIS_BRANCH
- SCONS_CACHE_LIMIT=1024
- OPTIONS="debug_symbols=no verbose=yes progress=no builtin_libpng=yes"
- secure: "uch9QszCgsl1qVbuzY41P7S2hWL2IiNFV4SbAYRCdi0oJ9MIu+pVyrQdpf3+jG4rH6j4Rffl+sN17Zz4dIDDioFL1JwqyCqyCyswR8uACC0Rr8gr4Mi3+HIRbv+2s2P4cIQq41JM8FJe84k9jLEMGCGh69w+ibCWoWs74CokYVA="
- OPTIONS="debug_symbols=no verbose=yes progress=no"
cache:
directories:
@ -20,56 +15,9 @@ cache:
matrix:
include:
- name: Static checks (clang-format) + Documentation checks
stage: check
env: STATIC_CHECKS=yes
os: linux
compiler: gcc
addons:
apt:
sources:
- llvm-toolchain-xenial-8
packages:
- clang-format-8
- name: Linux editor (debug, GCC 9, with Mono)
- name: iOS export template (release, Clang)
stage: build
env: PLATFORM=x11 TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-mono-gcc-9 MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" EXTRA_ARGS="module_mono_enabled=yes mono_glue=no warnings=extra werror=yes"
os: linux
compiler: gcc-9
addons:
apt:
sources:
- mono
- ubuntu-toolchain-r-test
packages:
- &gcc9_deps [gcc-9, g++-9]
- &linux_deps [libasound2-dev, libgl1-mesa-dev, libglu1-mesa-dev, libx11-dev, libxcursor-dev, libxi-dev, libxinerama-dev, libxrandr-dev]
- &linux_mono_deps [mono-devel, msbuild, nuget]
- name: Linux export template (release, Clang)
stage: build
env: PLATFORM=x11 TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra werror=yes"
os: linux
compiler: clang
addons:
apt:
packages:
- *linux_deps
- name: Android export template (release_debug, Clang)
stage: build
env: PLATFORM=android TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra werror=yes"
os: linux
compiler: clang
addons:
apt:
packages:
- openjdk-8-jdk
- name: macOS editor (debug, Clang)
stage: build
env: PLATFORM=osx TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-clang EXTRA_ARGS="warnings=extra werror=yes"
env: PLATFORM=iphone TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-clang
os: osx
compiler: clang
addons:
@ -78,76 +26,9 @@ matrix:
- scons
update: true
- name: iOS export template (debug, Clang)
stage: build
env: PLATFORM=iphone TOOLS=no TARGET=debug CACHE_NAME=${PLATFORM}-clang
os: osx
compiler: clang
addons:
homebrew:
packages:
- scons
update: true
- name: Linux headless editor (release_debug, GCC 9, testing project exporting and script running)
stage: build
env: PLATFORM=server TOOLS=yes TARGET=release_debug CACHE_NAME=${PLATFORM}-tools-gcc-9 MATRIX_EVAL="CC=gcc-9 && CXX=g++-9" EXTRA_ARGS="warnings=extra werror=yes" TEST_PROJECT=yes
os: linux
compiler: gcc-9
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- *gcc9_deps
- *linux_deps
- name: Linux export template (release_debug, GCC 5, without 3D support)
stage: build
env: PLATFORM=x11 TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-gcc-5 EXTRA_ARGS="CXXFLAGS=-fno-strict-aliasing disable_3d=yes"
os: linux
compiler: gcc
addons:
apt:
packages:
- *linux_deps
before_install:
- eval "${MATRIX_EVAL}"
install:
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
pyenv global 3.7.1 system;
pip3 install --user scons;
fi
- scons --version
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$PLATFORM" = "android" ]; then
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64;
export PATH=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin:${PATH};
java -version;
misc/travis/android-tools-linux.sh;
fi
- if [ "$STATIC_CHECKS" = "yes" ]; then
unset SCONS_CACHE;
pip3 install --user black pygments;
fi
before_script:
- if [ "$PLATFORM" = "android" ]; then
export ANDROID_HOME=$TRAVIS_BUILD_DIR/godot-dev/build-tools/android-sdk;
export ANDROID_NDK_ROOT=$TRAVIS_BUILD_DIR/godot-dev/build-tools/android-ndk;
fi
script:
- if [ "$STATIC_CHECKS" = "yes" ]; then
sh ./misc/travis/clang-format.sh &&
sh ./misc/travis/black-format.sh &&
doc/tools/makerst.py --dry-run doc/classes modules;
else
scons -j2 CC=$CC CXX=$CXX platform=$PLATFORM tools=$TOOLS target=$TARGET $OPTIONS $EXTRA_ARGS &&
if [ "$TEST_PROJECT" = "yes" ]; then
git clone --depth 1 "https://github.com/godotengine/godot-tests.git";
sed -i "s:custom_template/release=\"\":custom_template/release=\"$(readlink -e bin/godot_server.x11.opt.tools.64)\":" godot-tests/tests/project_export/export_presets.cfg;
godot-tests/tests/project_export/test_project.sh "bin/godot_server.x11.opt.tools.64";
fi
fi
- scons -j2 CC=$CC CXX=$CXX platform=$PLATFORM tools=$TOOLS target=$TARGET $OPTIONS $EXTRA_ARGS

View File

@ -2436,7 +2436,7 @@ String _Directory::get_current_dir() {
return d->get_current_dir();
}
Error _Directory::make_dir(String p_dir) {
ERR_FAIL_COND_V_MSG(!is_open(), ERR_UNCONFIGURED, "Directory must be opened before use.");
ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory is not configured properly.");
if (!p_dir.is_rel_path()) {
DirAccess *d = DirAccess::create_for_path(p_dir);
Error err = d->make_dir(p_dir);
@ -2446,7 +2446,7 @@ Error _Directory::make_dir(String p_dir) {
return d->make_dir(p_dir);
}
Error _Directory::make_dir_recursive(String p_dir) {
ERR_FAIL_COND_V_MSG(!is_open(), ERR_UNCONFIGURED, "Directory must be opened before use.");
ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory is not configured properly.");
if (!p_dir.is_rel_path()) {
DirAccess *d = DirAccess::create_for_path(p_dir);
Error err = d->make_dir_recursive(p_dir);

View File

@ -386,6 +386,7 @@ Error JSON::_parse_array(Array &array, const CharType *p_str, int &index, int p_
need_comma = true;
}
r_err_str = "Expected ']'";
return ERR_PARSE_ERROR;
}
@ -453,6 +454,7 @@ Error JSON::_parse_object(Dictionary &object, const CharType *p_str, int &index,
}
}
r_err_str = "Expected '}'";
return ERR_PARSE_ERROR;
}

View File

@ -1,5 +1,5 @@
/*************************************************************************/
/* object_rc.h */
/* object_id.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */

View File

@ -203,10 +203,10 @@
<description>
Returns [code]true[/code] if the array contains the given value.
[codeblock]
["inside", 7].has("inside") == true
["inside", 7].has("outside") == false
["inside", 7].has(7) == true
["inside", 7].has("7") == false
["inside", 7].has("inside") # True
["inside", 7].has("outside") # False
["inside", 7].has(7) # True
["inside", 7].has("7") # False
[/codeblock]
[b]Note:[/b] This is equivalent to using the [code]in[/code] operator as follows:
[codeblock]

View File

@ -13,7 +13,7 @@
<return type="void">
</return>
<description>
Called when the button is pressed.
Called when the button is pressed. If you need to know the button's pressed state (and [member toggle_mode] is active), use [method _toggled] instead.
</description>
</method>
<method name="_toggled" qualifiers="virtual">
@ -89,6 +89,7 @@
<signal name="pressed">
<description>
Emitted when the button is toggled or pressed. This is on [signal button_down] if [member action_mode] is [constant ACTION_MODE_BUTTON_PRESS] and on [signal button_up] otherwise.
If you need to know the button's pressed state (and [member toggle_mode] is active), use [signal toggled] instead.
</description>
</signal>
<signal name="toggled">

View File

@ -864,7 +864,9 @@
The node's rotation around its pivot, in degrees. See [member rect_pivot_offset] to change the pivot's position.
</member>
<member name="rect_scale" type="Vector2" setter="set_scale" getter="get_scale" default="Vector2( 1, 1 )">
The node's scale, relative to its [member rect_size]. Change this property to scale the node around its [member rect_pivot_offset].
The node's scale, relative to its [member rect_size]. Change this property to scale the node around its [member rect_pivot_offset]. The Control's [member hint_tooltip] will also scale according to this value.
[b]Note:[/b] This property is mainly intended to be used for animation purposes. Text inside the Control will look pixelated or blurry when the Control is scaled. To support multiple resolutions in your project, use an appropriate viewport stretch mode as described in the [url=https://docs.godotengine.org/en/latest/tutorials/viewports/multiple_resolutions.html]documentation[/url] instead of scaling Controls individually.
[b]Note:[/b] If the Control node is a child of a [Container] node, the scale will be reset to [code]Vector2(1, 1)[/code] when the scene is instanced. To set the Control's scale when it's instanced, wait for one frame using [code]yield(get_tree(), "idle_frame")[/code] then set its [member rect_scale] property.
</member>
<member name="rect_size" type="Vector2" setter="_set_size" getter="get_size" default="Vector2( 0, 0 )">
The size of the node's bounding rectangle, in pixels. [Container] nodes update this property automatically.

View File

@ -97,6 +97,7 @@
<argument index="0" name="resources" type="PoolStringArray">
</argument>
<description>
Emitted if at least one resource is reloaded when the filesystem is scanned.
</description>
</signal>
<signal name="sources_changed">

View File

@ -67,6 +67,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Returns the base class of the script class defined in the file at index [code]idx[/code]. If the file doesn't define a script class using the [code]class_name[/code] syntax, this will return an empty string.
</description>
</method>
<method name="get_file_script_class_name" qualifiers="const">
@ -75,6 +76,7 @@
<argument index="0" name="idx" type="int">
</argument>
<description>
Returns the name of the script class defined in the file at index [code]idx[/code]. If the file doesn't define a script class using the [code]class_name[/code] syntax, this will return an empty string.
</description>
</method>
<method name="get_file_type" qualifiers="const">

View File

@ -83,6 +83,16 @@
<argument index="1" name="options" type="Dictionary">
</argument>
<description>
This method can be overridden to hide specific import options if conditions are met. This is mainly useful for hiding options that depend on others if one of them is disabled. For example:
[codeblock]
func get_option_visibility(option, options):
# Only show the lossy quality setting if the compression mode is set to "Lossy".
if option == "compress/lossy_quality" and options.has("compress/mode"):
return int(options["compress/mode"]) == COMPRESS_LOSSY
return true
[/codeblock]
Return [code]true[/code] to make all options always visible.
</description>
</method>
<method name="get_preset_count" qualifiers="virtual">
@ -150,6 +160,8 @@
<argument index="4" name="gen_files" type="Array">
</argument>
<description>
Imports [code]source_file[/code] into [code]save_path[/code] with the import [code]options[/code] specified. The [code]platform_variants[/code] and [code]gen_files[/code] arrays will be modified by this function.
This method must be overridden to do the actual importing work. See this class' description for an example of overriding this method.
</description>
</method>
</methods>

View File

@ -14,35 +14,43 @@
<return type="void">
</return>
<description>
Refreshes the inspector.
[b]Note:[/b] To save on CPU resources, calling this method will do nothing if the time specified in [code]docks/property_editor/auto_refresh_interval[/code] editor setting hasn't passed yet since this method was last called. (By default, this interval is set to 0.3 seconds.)
</description>
</method>
</methods>
<members>
<member name="scroll_horizontal_enabled" type="bool" setter="set_enable_h_scroll" getter="is_h_scroll_enabled" override="true" default="false" />
<member name="scroll_horizontal_enabled" type="bool" setter="set_enable_h_scroll" getter="is_h_scroll_enabled" override="true" default="false">
If [code]true[/code], horizontal scrolling is enabled. An horizontal scroll bar will display at the bottom of the inspector.
</member>
</members>
<signals>
<signal name="object_id_selected">
<argument index="0" name="id" type="int">
</argument>
<description>
Emitted when the Edit button of an [Object] has been pressed in the inspector. This is mainly used in the remote scene tree inspector.
</description>
</signal>
<signal name="property_edited">
<argument index="0" name="property" type="String">
</argument>
<description>
Emitted when a property is edited in the inspector.
</description>
</signal>
<signal name="property_keyed">
<argument index="0" name="property" type="String">
</argument>
<description>
Emitted when a property is keyed in the inspector. Properties can be keyed by clicking the "key" icon next to a property when the Animation panel is toggled.
</description>
</signal>
<signal name="property_selected">
<argument index="0" name="property" type="String">
</argument>
<description>
Emitted when a property is selected in the inspector.
</description>
</signal>
<signal name="property_toggled">
@ -51,6 +59,8 @@
<argument index="1" name="checked" type="bool">
</argument>
<description>
Emitted when a boolean property is toggled in the inspector.
[b]Note:[/b] This signal is never emitted if the internal [code]autoclear[/code] property enabled. Since this property is always enabled in the editor inspector, this signal is never emitted by the editor itself.
</description>
</signal>
<signal name="resource_selected">
@ -59,10 +69,12 @@
<argument index="1" name="prop" type="String">
</argument>
<description>
Emitted when a resource is selected in the inspector.
</description>
</signal>
<signal name="restart_requested">
<description>
Emitted when a property that requires a restart to be applied is edited in the inspector. This is only used in the Project Settings and Editor Settings.
</description>
</signal>
</signals>

View File

@ -23,13 +23,14 @@
<return type="Control">
</return>
<description>
Returns the main container of Godot editor's window. You can use it, for example, to retrieve the size of the container and place your controls accordingly.
Returns the main container of Godot editor's window. For example, you can use it to retrieve the size of the container and place your controls accordingly.
</description>
</method>
<method name="get_current_path" qualifiers="const">
<return type="String">
</return>
<description>
Returns the current path being viewed in the [FileSystemDock].
</description>
</method>
<method name="get_edited_scene_root">
@ -43,26 +44,29 @@
<return type="EditorSettings">
</return>
<description>
Returns the [EditorSettings].
Returns the editor's [EditorSettings] instance.
</description>
</method>
<method name="get_editor_viewport">
<return type="Control">
</return>
<description>
Returns the editor [Viewport].
Returns the editor's [Viewport] instance.
[b]Note:[/b] This returns the main editor viewport containing the whole editor, not the 2D or 3D viewports specifically.
</description>
</method>
<method name="get_file_system_dock">
<return type="FileSystemDock">
</return>
<description>
Returns the editor's [FileSystemDock] instance.
</description>
</method>
<method name="get_inspector" qualifiers="const">
<return type="EditorInspector">
</return>
<description>
Returns the editor's [EditorInspector] instance.
</description>
</method>
<method name="get_open_scenes" qualifiers="const">
@ -83,34 +87,35 @@
<return type="EditorFileSystem">
</return>
<description>
Returns the [EditorFileSystem].
Returns the editor's [EditorFileSystem] instance.
</description>
</method>
<method name="get_resource_previewer">
<return type="EditorResourcePreview">
</return>
<description>
Returns the [EditorResourcePreview].
Returns the editor's [EditorResourcePreview] instance.
</description>
</method>
<method name="get_script_editor">
<return type="ScriptEditor">
</return>
<description>
Returns the [ScriptEditor].
Returns the editor's [ScriptEditor] instance.
</description>
</method>
<method name="get_selected_path" qualifiers="const">
<return type="String">
</return>
<description>
Returns the path of the directory currently selected in the [FileSystemDock]. If a file is selected, its base directory will be returned using [method String.get_base_dir] instead.
</description>
</method>
<method name="get_selection">
<return type="EditorSelection">
</return>
<description>
Returns the [EditorSelection].
Returns the editor's [EditorSelection] instance.
</description>
</method>
<method name="inspect_object">
@ -121,14 +126,14 @@
<argument index="1" name="for_property" type="String" default="&quot;&quot;">
</argument>
<description>
Shows the given property on the given [code]object[/code] in the Editor's Inspector dock.
Shows the given property on the given [code]object[/code] in the editor's Inspector dock.
</description>
</method>
<method name="is_playing_scene" qualifiers="const">
<return type="bool">
</return>
<description>
Returns [code]true[/code], if a scene is currently being played; [code]false[/code] otherwise. Paused scenes are considered as being played.
Returns [code]true[/code] if a scene is currently being played, [code]false[/code] otherwise. Paused scenes are considered as being played.
</description>
</method>
<method name="is_plugin_enabled" qualifiers="const">
@ -137,7 +142,7 @@
<argument index="0" name="plugin" type="String">
</argument>
<description>
Returns the enabled status of a plugin. The plugin name is the same as its directory name.
Returns [code]true[/code] if the specified [code]plugin[/code] is enabled. The plugin name is the same as its directory name.
</description>
</method>
<method name="make_mesh_previews">
@ -225,6 +230,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
Sets the editor's current main screen to the one specified in [code]name[/code]. [code]name[/code] must match the text of the tab in question exactly ([code]2D[/code], [code]3D[/code], [code]Script[/code], [code]AssetLib[/code]).
</description>
</method>
<method name="set_plugin_enabled">

View File

@ -73,22 +73,22 @@
</methods>
<members>
<member name="checkable" type="bool" setter="set_checkable" getter="is_checkable" default="false">
Used by the inspector, set when property is checkable.
Used by the inspector, set to [code]true[/code] when the property is checkable.
</member>
<member name="checked" type="bool" setter="set_checked" getter="is_checked" default="false">
Used by the inspector, when the property is checked.
Used by the inspector, set to [code]true[/code] when the property is checked.
</member>
<member name="draw_red" type="bool" setter="set_draw_red" getter="is_draw_red" default="false">
Used by the inspector, when the property must draw with error color.
Used by the inspector, set to [code]true[/code] when the property must draw with error color. This is used for editable children's properties.
</member>
<member name="keying" type="bool" setter="set_keying" getter="is_keying" default="false">
Used by the inspector, when the property can add keys for animation.
Used by the inspector, set to [code]true[/code] when the property can add keys for animation.
</member>
<member name="label" type="String" setter="set_label" getter="get_label" default="&quot;&quot;">
Sets this property to change the label (if you want to show one).
Set this property to change the label (if you want to show one).
</member>
<member name="read_only" type="bool" setter="set_read_only" getter="is_read_only" default="false">
Used by the inspector, when the property is read-only.
Used by the inspector, set to [code]true[/code] when the property is read-only.
</member>
</members>
<signals>

View File

@ -5,11 +5,16 @@
</brief_description>
<description>
Object that holds the project-independent editor settings. These settings are generally visible in the [b]Editor &gt; Editor Settings[/b] menu.
Accessing the settings is done by using the regular [Object] API, such as:
Property names use slash delimiters to distinguish sections. Setting values can be of any [Variant] type. It's recommended to use [code]snake_case[/code] for editor settings to be consistent with the Godot editor itself.
Accessing the settings can be done using the following methods, such as:
[codeblock]
settings.set(prop,value)
settings.get(prop)
list_of_settings = settings.get_property_list()
# `settings.set("some/property", value)` also works as this class overrides `_set()` internally.
settings.set_setting("some/property",value)
# `settings.get("some/property", value)` also works as this class overrides `_get()` internally.
settings.get_setting("some/property")
var list_of_settings = settings.get_property_list()
[/codeblock]
[b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_editor_settings].
</description>
@ -47,14 +52,14 @@
<argument index="0" name="property" type="String">
</argument>
<description>
Erase a given setting (pass full property path).
Erases the setting whose name is specified by [code]property[/code].
</description>
</method>
<method name="get_favorites" qualifiers="const">
<return type="PoolStringArray">
</return>
<description>
Gets the list of favorite files and directories for this project.
Returns the list of favorite files and directories for this project.
</description>
</method>
<method name="get_project_metadata" qualifiers="const">
@ -67,20 +72,21 @@
<argument index="2" name="default" type="Variant" default="null">
</argument>
<description>
Returns project-specific metadata for the [code]section[/code] and [code]key[/code] specified. If the metadata doesn't exist, [code]default[/code] will be returned instead. See also [method set_project_metadata].
</description>
</method>
<method name="get_project_settings_dir" qualifiers="const">
<return type="String">
</return>
<description>
Gets the specific project settings path. Projects all have a unique sub-directory inside the settings path where project specific settings are saved.
Returns the project-specific settings path. Projects all have a unique subdirectory inside the settings path where project-specific settings are saved.
</description>
</method>
<method name="get_recent_dirs" qualifiers="const">
<return type="PoolStringArray">
</return>
<description>
Gets the list of recently visited folders in the file dialog for this project.
Returns the list of recently visited folders in the file dialog for this project.
</description>
</method>
<method name="get_setting" qualifiers="const">
@ -89,6 +95,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
Returns the value of the setting specified by [code]name[/code]. This is equivalent to using [method Object.get] on the EditorSettings instance.
</description>
</method>
<method name="get_settings_dir" qualifiers="const">
@ -106,6 +113,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
Returns [code]true[/code] if the setting specified by [code]name[/code] exists, [code]false[/code] otherwise.
</description>
</method>
<method name="property_can_revert">
@ -114,6 +122,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
Returns [code]true[/code] if the setting specified by [code]name[/code] can have its value reverted to the default value, [code]false[/code] otherwise. When this method returns [code]true[/code], a Revert button will display next to the setting in the Editor Settings.
</description>
</method>
<method name="property_get_revert">
@ -122,6 +131,7 @@
<argument index="0" name="name" type="String">
</argument>
<description>
Returns the default value of the setting specified by [code]name[/code]. This is the value that would be applied when clicking the Revert button in the Editor Settings.
</description>
</method>
<method name="set_favorites">
@ -143,6 +153,7 @@
<argument index="2" name="update_current" type="bool">
</argument>
<description>
Sets the initial value of the setting specified by [code]name[/code] to [code]value[/code]. This is used to provide a value for the Revert button in the Editor Settings. If [code]update_current[/code] is true, the current value of the setting will be set to [code]value[/code] as well.
</description>
</method>
<method name="set_project_metadata">
@ -155,6 +166,7 @@
<argument index="2" name="data" type="Variant">
</argument>
<description>
Sets project-specific metadata with the [code]section[/code], [code]key[/code] and [code]data[/code] specified. This metadata is stored outside the project folder and therefore won't be checked into version control. See also [method get_project_metadata].
</description>
</method>
<method name="set_recent_dirs">
@ -174,19 +186,20 @@
<argument index="1" name="value" type="Variant">
</argument>
<description>
Sets the [code]value[/code] of the setting specified by [code]name[/code]. This is equivalent to using [method Object.set] on the EditorSettings instance.
</description>
</method>
</methods>
<signals>
<signal name="settings_changed">
<description>
Emitted when editor settings change.
Emitted after any editor setting has changed.
</description>
</signal>
</signals>
<constants>
<constant name="NOTIFICATION_EDITOR_SETTINGS_CHANGED" value="10000">
Emitted when editor settings change. It used by various editor plugins to update their visuals on theme changes or logic on configuration changes.
Emitted after any editor setting has changed. It's used by various editor plugins to update their visuals on theme changes or logic on configuration changes.
</constant>
</constants>
</class>

View File

@ -15,6 +15,7 @@
<argument index="0" name="segments" type="PoolVector3Array">
</argument>
<description>
Adds the specified [code]segments[/code] to the gizmo's collision shape for picking. Call this function during [method redraw].
</description>
</method>
<method name="add_collision_triangles">
@ -69,6 +70,7 @@
<argument index="3" name="material" type="Material" default="null">
</argument>
<description>
Adds a mesh to the gizmo with the specified [code]billboard[/code] state, [code]skeleton[/code] and [code]material[/code]. If [code]billboard[/code] is [code]true[/code], the mesh will rotate to always face the camera. Call this function during [method redraw].
</description>
</method>
<method name="add_unscaled_billboard">
@ -88,6 +90,7 @@
<return type="void">
</return>
<description>
Removes everything in the gizmo including meshes, collisions and handles.
</description>
</method>
<method name="commit_handle" qualifiers="virtual">
@ -143,14 +146,14 @@
<argument index="0" name="index" type="int">
</argument>
<description>
Gets whether a handle is highlighted or not.
Returns [code]true[/code] if the handle at index [code]index[/code] is highlighted by being hovered with the mouse.
</description>
</method>
<method name="redraw" qualifiers="virtual">
<return type="void">
</return>
<description>
This function is called when the Spatial this gizmo refers to changes (the [method Spatial.update_gizmo] is called).
This function is called when the [Spatial] this gizmo refers to changes (the [method Spatial.update_gizmo] is called).
</description>
</method>
<method name="set_handle" qualifiers="virtual">
@ -173,6 +176,7 @@
<argument index="0" name="hidden" type="bool">
</argument>
<description>
Sets the gizmo's hidden state. If [code]true[/code], the gizmo will be hidden. If [code]false[/code], it will be shown.
</description>
</method>
<method name="set_spatial_node">
@ -181,6 +185,7 @@
<argument index="0" name="node" type="Node">
</argument>
<description>
Sets the reference [Spatial] node for the gizmo. [code]node[/code] must inherit from [Spatial].
</description>
</method>
</methods>

View File

@ -139,6 +139,8 @@
<return type="String">
</return>
<description>
Override this method to set the gizmo's priority. Higher values correspond to higher priority. If a gizmo with higher priority conflicts with another gizmo, only the gizmo with higher priority will be used.
All built-in editor gizmos return a priority of [code]-1[/code]. If not overridden, this method will return [code]0[/code], which means custom gizmos will automatically override built-in gizmos.
</description>
</method>
<method name="has_gizmo" qualifiers="virtual">

View File

@ -20,6 +20,7 @@
file.close()
return content
[/codeblock]
In the example above, the file will be saved in the user data folder as specified in the [url=https://docs.godotengine.org/en/latest/tutorials/io/data_paths.html]Data paths[/url] documentation.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/getting_started/step_by_step/filesystem.html</link>

View File

@ -8,6 +8,7 @@
[b]Note:[/b] This client only needs to connect to a host once (see [method connect_to_host]) to send multiple requests. Because of this, methods that take URLs usually take just the part after the host instead of the full URL, as the client is already connected to a host. See [method request] for a full example and to get started.
A [HTTPClient] should be reused between multiple requests or to connect to different hosts instead of creating one client per request. Supports SSL and SSL server certificate verification. HTTP status codes in the 2xx range indicate success, 3xx redirection (i.e. "try again, but over here"), 4xx something was wrong with the request, and 5xx something went wrong on the server's side.
For more information on HTTP, see https://developer.mozilla.org/en-US/docs/Web/HTTP (or read RFC 2616 to get it straight from the source: https://tools.ietf.org/html/rfc2616).
[b]Note:[/b] When performing HTTP requests from a project exported to HTML5, keep in mind the remote server may not allow requests from foreign origins due to [url=https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS]CORS[/url]. If you host the server in question, you should modify its backend to allow requests from foreign origins by adding the [code]Access-Control-Allow-Origin: *[/code] HTTP header.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/networking/http_client_class.html</link>

View File

@ -64,6 +64,7 @@
add_child(texture_rect)
texture_rect.texture = texture
[/codeblock]
[b]Note:[/b] When performing HTTP requests from a project exported to HTML5, keep in mind the remote server may not allow requests from foreign origins due to [url=https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS]CORS[/url]. If you host the server in question, you should modify its backend to allow requests from foreign origins by adding the [code]Access-Control-Allow-Origin: *[/code] HTTP header.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/networking/http_request_class.html</link>

View File

@ -5,6 +5,7 @@
</brief_description>
<description>
Contains mouse and pen motion information. Supports relative, absolute positions and speed. See [method Node._input].
[b]Note:[/b] By default, this event is only emitted once per frame rendered at most. If you need more precise input reporting, call [method Input.set_use_accumulated_input] with [code]false[/code] to make events emitted as often as possible. If you use InputEventMouseMotion to draw lines, consider implementing [url=https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm]Bresenham's line algorithm[/url] as well to avoid visible gaps in lines if the user is moving the mouse quickly.
</description>
<tutorials>
<link>https://docs.godotengine.org/en/latest/tutorials/inputs/mouse_and_input_coordinates.html</link>

View File

@ -165,6 +165,9 @@
String value of the [LineEdit].
[b]Note:[/b] Changing text using this property won't emit the [signal text_changed] signal.
</member>
<member name="virtual_keyboard_enabled" type="bool" setter="set_virtual_keyboard_enabled" getter="is_virtual_keyboard_enabled" default="true">
If [code]true[/code], the native virtual keyboard is shown when focused on platforms that support it.
</member>
</members>
<signals>
<signal name="text_change_rejected">

View File

@ -153,7 +153,18 @@
<return type="PoolStringArray">
</return>
<description>
Returns the command line arguments passed to the engine.
Returns the command-line arguments passed to the engine.
Command-line arguments can be written in any form, including both [code]--key value[/code] and [code]--key=value[/code] forms so they can be properly parsed, as long as custom command-line arguments do not conflict with engine arguments.
You can also incorporate environment variables using the [method get_environment] method.
You can set [code]editor/main_run_args[/code] in the Project Settings to define command-line arguments to be passed by the editor when running the project.
Here's a minimal example on how to parse command-line arguments into a dictionary using the [code]--key=value[/code] form for arguments:
[codeblock]
var arguments = {}
for argument in OS.get_cmdline_args():
if argument.find("=") > -1:
var key_value = argument.split("=")
arguments[key_value[0].lstrip("--")] = key_value[1]
[/codeblock]
</description>
</method>
<method name="get_connected_midi_inputs">

View File

@ -13,7 +13,12 @@
<return type="Array">
</return>
<description>
Returns mesh arrays used to constitute surface of [Mesh]. Mesh arrays can be used with [ArrayMesh] to create new surfaces.
Returns mesh arrays used to constitute surface of [Mesh]. The result can be passed to [method ArrayMesh.add_surface_from_arrays] to create a new surface. For example:
[codeblock]
var c := CylinderMesh.new()
var arr_mesh := ArrayMesh.new()
arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, c.get_mesh_arrays())
[/codeblock]
</description>
</method>
</methods>

View File

@ -45,7 +45,7 @@
<description>
Updates the collision information for the ray.
Use this method to update the collision information immediately instead of waiting for the next [code]_physics_process[/code] call, for example if the ray or its parent has changed state.
[b]Note:[/b] [code]enabled == true[/code] is not required for this to work.
[b]Note:[/b] [code]enabled[/code] is not required for this to work.
</description>
</method>
<method name="get_collider" qualifiers="const">

View File

@ -44,7 +44,7 @@
</return>
<description>
Updates the collision information for the ray. Use this method to update the collision information immediately instead of waiting for the next [code]_physics_process[/code] call, for example if the ray or its parent has changed state.
[b]Note:[/b] [code]enabled == true[/code] is not required for this to work.
[b]Note:[/b] [code]enabled[/code] is not required for this to work.
</description>
</method>
<method name="get_collider" qualifiers="const">

View File

@ -230,7 +230,7 @@
<argument index="1" name="pose" type="Transform">
</argument>
<description>
Returns the pose transform for bone [code]bone_idx[/code].
Sets the pose transform for bone [code]bone_idx[/code].
</description>
</method>
<method name="set_bone_rest">

View File

@ -32,7 +32,7 @@
<return type="float">
</return>
<description>
Returns the proportion between the current arm length (after checking for collisions) and the [member spring_length]. Ranges from 0 to 1.
Returns the spring arm's current length.
</description>
</method>
<method name="remove_excluded_object">

View File

@ -253,7 +253,8 @@
<return type="String">
</return>
<description>
Returns a copy of the string with escaped characters replaced by their meanings according to the C language standard.
Returns a copy of the string with escaped characters replaced by their meanings. Supported escape sequences are [code]\'[/code], [code]\"[/code], [code]\?[/code], [code]\\[/code], [code]\a[/code], [code]\b[/code], [code]\f[/code], [code]\n[/code], [code]\r[/code], [code]\t[/code], [code]\v[/code].
[b]Note:[/b] Unlike the GDScript parser, this method doesn't support the [code]\uXXXX[/code] escape sequence.
</description>
</method>
<method name="capitalize">

View File

@ -5,7 +5,8 @@
</brief_description>
<description>
The VisibilityEnabler will disable [RigidBody] and [AnimationPlayer] nodes when they are not visible. It will only affect other nodes within the same scene as the VisibilityEnabler itself.
[b]Note:[/b] VisibilityEnabler uses an approximate heuristic for performance reasons. It doesn't take walls and other occlusion into account. If you need exact visibility checking, use another method such as adding an [Area] node as a child of a [Camera] node.
If you just want to receive notifications, use [VisibilityNotifier] instead.
[b]Note:[/b] VisibilityEnabler uses an approximate heuristic for performance reasons. It doesn't take walls and other occlusion into account. The heuristic is an implementation detail and may change in future versions. If you need precise visibility checking, use another method such as adding an [Area] node as a child of a [Camera] node and/or [method Vector3.dot].
[b]Note:[/b] VisibilityEnabler will not affect nodes added after scene initialization.
</description>
<tutorials>

View File

@ -5,7 +5,8 @@
</brief_description>
<description>
The VisibilityEnabler2D will disable [RigidBody2D], [AnimationPlayer], and other nodes when they are not visible. It will only affect nodes with the same root node as the VisibilityEnabler2D, and the root node itself.
[b]Note:[/b] For performance reasons, VisibilityEnabler2D uses an approximate heuristic with precision determined by [member ProjectSettings.world/2d/cell_size]. If you need exact visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node.
If you just want to receive notifications, use [VisibilityNotifier2D] instead.
[b]Note:[/b] For performance reasons, VisibilityEnabler2D uses an approximate heuristic with precision determined by [member ProjectSettings.world/2d/cell_size]. If you need precise visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node.
[b]Note:[/b] VisibilityEnabler2D will not affect nodes added after scene initialization.
</description>
<tutorials>

View File

@ -5,7 +5,8 @@
</brief_description>
<description>
The VisibilityNotifier detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a [Camera]'s view.
[b]Note:[/b] VisibilityNotifier uses an approximate heuristic for performance reasons. It doesn't take walls and other occlusion into account. If you need exact visibility checking, use another method such as adding an [Area] node as a child of a [Camera] node.
If you want nodes to be disabled automatically when they exit the screen, use [VisibilityEnabler] instead.
[b]Note:[/b] VisibilityNotifier uses an approximate heuristic for performance reasons. It does't take walls and other occlusion into account. The heuristic is an implementation detail and may change in future versions. If you need precise visibility checking, use another method such as adding an [Area] node as a child of a [Camera] node and/or [method Vector3.dot].
</description>
<tutorials>
</tutorials>

View File

@ -5,7 +5,8 @@
</brief_description>
<description>
The VisibilityNotifier2D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a viewport.
[b]Note:[/b] For performance reasons, VisibilityNotifier2D uses an approximate heuristic with precision determined by [member ProjectSettings.world/2d/cell_size]. If you need exact visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node.
If you want nodes to be disabled automatically when they exit the screen, use [VisibilityEnabler2D] instead.
[b]Note:[/b] For performance reasons, VisibilityNotifier2D uses an approximate heuristic with precision determined by [member ProjectSettings.world/2d/cell_size]. If you need precise visibility checking, use another method such as adding an [Area2D] node as a child of a [Camera2D] node.
</description>
<tutorials>
</tutorials>

View File

@ -1,3 +1,33 @@
/*************************************************************************/
/* rasterizer_array_gles2.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#pragma once
/*************************************************************************/

View File

@ -175,12 +175,127 @@
EditorNode *EditorNode::singleton = NULL;
void EditorNode::disambiguate_filenames(const Vector<String> p_full_paths, Vector<String> &r_filenames) {
// Keep track of a list of "index sets," i.e. sets of indices
// within disambiguated_scene_names which contain the same name.
Vector<Set<int> > index_sets;
Map<String, int> scene_name_to_set_index;
for (int i = 0; i < r_filenames.size(); i++) {
String scene_name = r_filenames[i];
if (!scene_name_to_set_index.has(scene_name)) {
index_sets.push_back(Set<int>());
scene_name_to_set_index.insert(r_filenames[i], index_sets.size() - 1);
}
index_sets.write[scene_name_to_set_index[scene_name]].insert(i);
}
// For each index set with a size > 1, we need to disambiguate
for (int i = 0; i < index_sets.size(); i++) {
Set<int> iset = index_sets[i];
while (iset.size() > 1) {
// Append the parent folder to each scene name
for (Set<int>::Element *E = iset.front(); E; E = E->next()) {
int set_idx = E->get();
String scene_name = r_filenames[set_idx];
String full_path = p_full_paths[set_idx];
// Get rid of file extensions and res:// prefixes
if (scene_name.rfind(".") >= 0) {
scene_name = scene_name.substr(0, scene_name.rfind("."));
}
if (full_path.begins_with("res://")) {
full_path = full_path.substr(6);
}
if (full_path.rfind(".") >= 0) {
full_path = full_path.substr(0, full_path.rfind("."));
}
int scene_name_size = scene_name.size();
int full_path_size = full_path.size();
int difference = full_path_size - scene_name_size;
// Find just the parent folder of the current path and append it.
// If the current name is foo.tscn, and the full path is /some/folder/foo.tscn
// then slash_idx is the second '/', so that we select just "folder", and
// append that to yield "folder/foo.tscn".
if (difference > 0) {
String parent = full_path.substr(0, difference);
int slash_idx = parent.rfind("/");
slash_idx = parent.rfind("/", slash_idx - 1);
parent = slash_idx >= 0 ? parent.substr(slash_idx + 1) : parent;
r_filenames.write[set_idx] = parent + r_filenames[set_idx];
}
}
// Loop back through scene names and remove non-ambiguous names
bool can_proceed = false;
Set<int>::Element *E = iset.front();
while (E) {
String scene_name = r_filenames[E->get()];
bool duplicate_found = false;
for (Set<int>::Element *F = iset.front(); F; F = F->next()) {
if (E->get() == F->get()) {
continue;
}
String other_scene_name = r_filenames[F->get()];
if (other_scene_name == scene_name) {
duplicate_found = true;
break;
}
}
Set<int>::Element *to_erase = duplicate_found ? nullptr : E;
// We need to check that we could actually append anymore names
// if we wanted to for disambiguation. If we can't, then we have
// to abort even with ambiguous names. We clean the full path
// and the scene name first to remove extensions so that this
// comparison actually works.
String path = p_full_paths[E->get()];
if (path.begins_with("res://")) {
path = path.substr(6);
}
if (path.rfind(".") >= 0) {
path = path.substr(0, path.rfind("."));
}
if (scene_name.rfind(".") >= 0) {
scene_name = scene_name.substr(0, scene_name.rfind("."));
}
// We can proceed iff the full path is longer than the scene name,
// meaning that there is at least one more parent folder we can
// tack onto the name.
can_proceed = can_proceed || (path.size() - scene_name.size()) >= 1;
E = E->next();
if (to_erase) {
iset.erase(to_erase);
}
}
if (!can_proceed) {
break;
}
}
}
}
void EditorNode::_update_scene_tabs() {
bool show_rb = EditorSettings::get_singleton()->get("interface/scene_tabs/show_script_button");
OS::get_singleton()->global_menu_clear("_dock");
// Get all scene names, which may be ambiguous
Vector<String> disambiguated_scene_names;
Vector<String> full_path_names;
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
disambiguated_scene_names.push_back(editor_data.get_scene_title(i));
full_path_names.push_back(editor_data.get_scene_path(i));
}
disambiguate_filenames(full_path_names, disambiguated_scene_names);
scene_tabs->clear_tabs();
Ref<Texture> script_icon = gui_base->get_icon("Script", "EditorIcons");
for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
@ -193,7 +308,7 @@ void EditorNode::_update_scene_tabs() {
int current = editor_data.get_edited_scene();
bool unsaved = (i == current) ? saved_version != editor_data.get_undo_redo().get_version() : editor_data.get_scene_version(i) != 0;
scene_tabs->add_tab(editor_data.get_scene_title(i) + (unsaved ? "(*)" : ""), icon);
scene_tabs->add_tab(disambiguated_scene_names[i] + (unsaved ? "(*)" : ""), icon);
OS::get_singleton()->global_menu_add_item("_dock", editor_data.get_scene_title(i) + (unsaved ? "(*)" : ""), GLOBAL_SCENE, i);
@ -1971,8 +2086,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
String args;
bool skip_breakpoints;
if (p_current || (editor_data.get_edited_scene_root() && p_custom == editor_data.get_edited_scene_root()->get_filename())) {
if (p_current || (editor_data.get_edited_scene_root() && p_custom != String() && p_custom == editor_data.get_edited_scene_root()->get_filename())) {
Node *scene = editor_data.get_edited_scene_root();
if (!scene) {
@ -2005,14 +2119,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
Node *scene = editor_data.get_edited_scene_root();
if (scene) { //only autosave if there is a scene obviously
if (scene->get_filename() == "") {
show_accept(TTR("Current scene was never saved, please save it prior to running."), TTR("OK"));
return;
}
if (scene && scene->get_filename() != "") { // Only autosave if there is a scene and if it has a path.
_save_scene_with_preview(scene->get_filename());
}
}
@ -3590,10 +3697,14 @@ void EditorNode::_quick_opened() {
Vector<String> files = quick_open->get_selected_files();
bool open_scene_dialog = quick_open->get_base_type() == "PackedScene";
for (int i = 0; i < files.size(); i++) {
String res_path = files[i];
if (quick_open->get_base_type() == "PackedScene") {
List<String> scene_extensions;
ResourceLoader::get_recognized_extensions_for_type("PackedScene", &scene_extensions);
if (open_scene_dialog || scene_extensions.find(files[i].get_extension())) {
open_request(res_path);
} else {
load_resource(res_path);

View File

@ -685,6 +685,8 @@ public:
static void add_editor_plugin(EditorPlugin *p_editor, bool p_config_changed = false);
static void remove_editor_plugin(EditorPlugin *p_editor, bool p_config_changed = false);
static void disambiguate_filenames(const Vector<String> p_full_paths, Vector<String> &r_filenames);
void new_inherited_scene() { _menu_option_confirm(FILE_NEW_INHERITED_SCENE, false); }
void set_docks_visible(bool p_show);

View File

@ -31,6 +31,7 @@
#include "editor_spin_slider.h"
#include "core/math/expression.h"
#include "core/os/input.h"
#include "editor_node.h"
#include "editor_scale.h"
String EditorSpinSlider::get_tooltip(const Point2 &p_pos) const {
@ -203,6 +204,19 @@ void EditorSpinSlider::_notification(int p_what) {
}
}
if (p_what == NOTIFICATION_READY) {
// Add a left margin to the stylebox to make the number align with the Label
// when it's edited. The LineEdit "focus" stylebox uses the "normal" stylebox's
// default margins.
Ref<StyleBoxFlat> stylebox =
EditorNode::get_singleton()->get_theme_base()->get_stylebox("normal", "LineEdit")->duplicate();
// EditorSpinSliders with a label have more space on the left, so add an
// higher margin to match the location where the text begins.
// The margin values below were determined by empirical testing.
stylebox->set_default_margin(MARGIN_LEFT, (get_label() != String() ? 23 : 16) * EDSCALE);
value_input->add_style_override("normal", stylebox);
}
if (p_what == NOTIFICATION_DRAW) {
updown_offset = -1;

View File

@ -1230,10 +1230,14 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
}
}
mesh.blend_weights.resize(mesh.mesh->get_blend_shape_count());
for (int32_t weight_i = 0; weight_i < mesh.blend_weights.size(); weight_i++) {
mesh.blend_weights.write[weight_i] = 0.0f;
}
if (d.has("weights")) {
const Array &weights = d["weights"];
ERR_FAIL_COND_V(mesh.mesh->get_blend_shape_count() != weights.size(), ERR_PARSE_ERROR);
mesh.blend_weights.resize(weights.size());
ERR_FAIL_COND_V(mesh.blend_weights.size() != weights.size(), ERR_PARSE_ERROR);
for (int j = 0; j < weights.size(); j++) {
mesh.blend_weights.write[j] = weights[j];
}

View File

@ -1996,17 +1996,16 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
if ((b->get_alt() && !b->get_control()) || tool == TOOL_MOVE) {
List<CanvasItem *> selection = _get_edited_canvas_items();
// Remove not movable nodes
drag_selection.clear();
for (int i = 0; i < selection.size(); i++) {
if (!_is_node_movable(selection[i], true)) {
selection.erase(selection[i]);
if (_is_node_movable(selection[i], true)) {
drag_selection.push_back(selection[i]);
}
}
if (selection.size() > 0) {
drag_type = DRAG_MOVE;
drag_from = transform.affine_inverse().xform(b->get_position());
drag_selection = selection;
_save_canvas_item_state(drag_selection);
}
return true;
@ -2296,16 +2295,15 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
// Drag the node(s) if requested
List<CanvasItem *> selection2 = _get_edited_canvas_items();
// Remove not movable nodes
drag_selection.clear();
for (int i = 0; i < selection2.size(); i++) {
if (!_is_node_movable(selection2[i], true)) {
selection2.erase(selection2[i]);
if (_is_node_movable(selection2[i], true)) {
drag_selection.push_back(selection2[i]);
}
}
if (selection2.size() > 0) {
drag_type = DRAG_MOVE;
drag_selection = selection2;
drag_from = click;
_save_canvas_item_state(drag_selection);
}

View File

@ -585,7 +585,7 @@ void ScriptEditor::_close_tab(int p_idx, bool p_save, bool p_history_back) {
Ref<Script> script = current->get_edited_resource();
if (p_save) {
// Do not try to save internal scripts
if (!(script->get_path() == "" || script->get_path().find("local://") != -1 || script->get_path().find("::") != -1)) {
if (!script.is_valid() || !(script->get_path() == "" || script->get_path().find("local://") != -1 || script->get_path().find("::") != -1)) {
_menu_option(FILE_SAVE);
}
}
@ -1887,6 +1887,19 @@ void ScriptEditor::_update_script_names() {
sedata.push_back(sd);
}
Vector<String> disambiguated_script_names;
Vector<String> full_script_paths;
for (int j = 0; j < sedata.size(); j++) {
disambiguated_script_names.push_back(sedata[j].name);
full_script_paths.push_back(sedata[j].tooltip);
}
EditorNode::disambiguate_filenames(full_script_paths, disambiguated_script_names);
for (int j = 0; j < sedata.size(); j++) {
sedata.write[j].name = disambiguated_script_names[j];
}
EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_child(i));
if (eh) {

View File

@ -1948,22 +1948,22 @@ void SpatialEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
switch (nav_mode) {
case NAVIGATION_PAN: {
_nav_pan(m, pan_gesture->get_delta());
_nav_pan(pan_gesture, pan_gesture->get_delta());
} break;
case NAVIGATION_ZOOM: {
_nav_zoom(m, pan_gesture->get_delta());
_nav_zoom(pan_gesture, pan_gesture->get_delta());
} break;
case NAVIGATION_ORBIT: {
_nav_orbit(m, pan_gesture->get_delta());
_nav_orbit(pan_gesture, pan_gesture->get_delta());
} break;
case NAVIGATION_LOOK: {
_nav_look(m, pan_gesture->get_delta());
_nav_look(pan_gesture, pan_gesture->get_delta());
} break;

View File

@ -2000,7 +2000,7 @@ void TileSetEditor::_set_edited_shape_points(const Vector<Vector2> &points) {
if (convex.is_valid()) {
undo_redo->add_do_method(convex.ptr(), "set_points", points);
undo_redo->add_undo_method(convex.ptr(), "set_points", _get_edited_shape_points());
} else if (concave.is_valid()) {
} else if (concave.is_valid() && points.size() > 1) {
PoolVector2Array segments;
for (int i = 0; i < points.size() - 1; i++) {
segments.push_back(points[i]);
@ -2681,7 +2681,7 @@ void TileSetEditor::draw_polygon_shapes() {
workspace->draw_polygon(polygon, colors);
if (coord == edited_shape_coord || tileset->tile_get_tile_mode(get_current_tile()) == TileSet::SINGLE_TILE) {
if (!creating_shape) {
if (!creating_shape && polygon.size() > 1) {
for (int j = 0; j < polygon.size() - 1; j++) {
workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true);
}
@ -2718,13 +2718,11 @@ void TileSetEditor::draw_polygon_shapes() {
}
workspace->draw_polygon(polygon, colors);
if (!creating_shape) {
if (polygon.size() > 1) {
for (int j = 0; j < polygon.size() - 1; j++) {
workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true);
}
workspace->draw_line(polygon[polygon.size() - 1], polygon[0], c_border, 1, true);
if (!creating_shape && polygon.size() > 1) {
for (int j = 0; j < polygon.size() - 1; j++) {
workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true);
}
workspace->draw_line(polygon[polygon.size() - 1], polygon[0], c_border, 1, true);
}
if (shape == edited_occlusion_shape) {
draw_handles = true;
@ -2768,7 +2766,7 @@ void TileSetEditor::draw_polygon_shapes() {
workspace->draw_polygon(polygon, colors);
if (coord == edited_shape_coord) {
if (!creating_shape) {
if (!creating_shape && polygon.size() > 1) {
for (int j = 0; j < polygon.size() - 1; j++) {
workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true);
}
@ -2808,7 +2806,7 @@ void TileSetEditor::draw_polygon_shapes() {
}
workspace->draw_polygon(polygon, colors);
if (!creating_shape) {
if (!creating_shape && polygon.size() > 1) {
for (int j = 0; j < polygon.size() - 1; j++) {
workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true);
}
@ -2857,7 +2855,7 @@ void TileSetEditor::draw_polygon_shapes() {
workspace->draw_polygon(polygon, colors);
if (coord == edited_shape_coord) {
if (!creating_shape) {
if (!creating_shape && polygon.size() > 1) {
for (int j = 0; j < polygon.size() - 1; j++) {
workspace->draw_line(polygon[j], polygon[j + 1], c_border, 1, true);
}
@ -2875,7 +2873,7 @@ void TileSetEditor::draw_polygon_shapes() {
}
}
if (creating_shape) {
if (creating_shape && current_shape.size() > 1) {
for (int j = 0; j < current_shape.size() - 1; j++) {
workspace->draw_line(current_shape[j], current_shape[j + 1], Color(0, 1, 1), 1, true);
}

View File

@ -102,9 +102,9 @@ bool test_add_remove() {
a.connect_points(1, 3, true);
a.connect_points(1, 4, false);
ok = ok && (a.are_points_connected(2, 1) == true);
ok = ok && (a.are_points_connected(4, 1) == true);
ok = ok && (a.are_points_connected(2, 1, false) == true);
ok = ok && (a.are_points_connected(2, 1));
ok = ok && (a.are_points_connected(4, 1));
ok = ok && (a.are_points_connected(2, 1, false));
ok = ok && (a.are_points_connected(4, 1, false) == false);
a.disconnect_points(1, 2, true);
@ -177,7 +177,7 @@ bool test_add_remove() {
if (Math::rand() % 2 == 1) {
// Add a (possibly existing) directed edge and confirm connectivity
a.connect_points(u, v, false);
ok = ok && (a.are_points_connected(u, v, false) == true);
ok = ok && (a.are_points_connected(u, v, false));
} else {
// Remove a (possibly nonexistent) directed edge and confirm disconnectivity
a.disconnect_points(u, v, false);

View File

@ -1,5 +1,5 @@
/*************************************************************************/
/* test_fbx.cpp */
/* test_basis.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */

View File

@ -1,5 +1,5 @@
/*************************************************************************/
/* test_fbx.h */
/* test_basis.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */

View File

@ -86,7 +86,7 @@ def update_version(module_version_string=""):
gitfolder = module_folder[8:]
if os.path.isfile(os.path.join(gitfolder, "HEAD")):
head = open(os.path.join(gitfolder, "HEAD"), "r").readline().strip()
head = open(os.path.join(gitfolder, "HEAD"), "r", encoding="utf8").readline().strip()
if head.startswith("ref: "):
head = os.path.join(gitfolder, head[5:])
if os.path.isfile(head):

View File

@ -24,12 +24,12 @@ ANDROID_SDK_URL=$ANDROID_BASE_URL/$ANDROID_SDK_FILENAME
ANDROID_SDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_SDK_DIR
ANDROID_SDK_SHA256=92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
ANDROID_NDK_RELEASE=r20
ANDROID_NDK_RELEASE=r21
ANDROID_NDK_DIR=android-ndk
ANDROID_NDK_FILENAME=android-ndk-$ANDROID_NDK_RELEASE-linux-x86_64.zip
ANDROID_NDK_URL=$ANDROID_BASE_URL/$ANDROID_NDK_FILENAME
ANDROID_NDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_NDK_DIR
ANDROID_NDK_SHA1=8665fc84a1b1f0d6ab3b5fdd1e30200cc7b9adff
ANDROID_NDK_SHA1=afc9c0b9faad222898ac8168c78ad4ccac8a1b5c
echo
echo "Download and install Android development tools ..."

4
misc/ci/sources.list Normal file
View File

@ -0,0 +1,4 @@
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

35
misc/scripts/black_format.sh Executable file
View File

@ -0,0 +1,35 @@
#!/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=$(find \( -path "./.git" \
-o -path "./thirdparty" \
\) -prune \
-o \( -name "SConstruct" \
-o -name "SCsub" \
-o -name "*.py" \
\) -print)
black -l 120 $PY_FILES
git diff > patch.patch
FILESIZE="$(stat -c%s patch.patch)"
MAXSIZE=5
# If no patch has been generated all is OK, clean up, and exit.
if (( FILESIZE < MAXSIZE )); then
printf "Files in this commit comply with the black style rules.\n"
rm -f patch.patch
exit 0
fi
# A patch has been created, notify the user, clean up, and exit.
printf "\n*** The following differences were found between the code "
printf "and the formatting rules:\n\n"
cat patch.patch
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
rm -f patch.patch
exit 1

58
misc/scripts/clang_format.sh Executable file
View File

@ -0,0 +1,58 @@
#!/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
IFS=$'\n\t'
CLANG_FORMAT_FILE_EXTS=(".c" ".h" ".cpp" ".hpp" ".cc" ".hh" ".cxx" ".m" ".mm" ".inc" ".java" ".glsl")
# Loops through all text files tracked by Git.
git grep -zIl '' |
while IFS= read -rd '' f; do
# Exclude some files.
if [[ "$f" == "thirdparty"* ]]; then
continue
elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then
continue
fi
for extension in ${CLANG_FORMAT_FILE_EXTS[@]}; do
if [[ "$f" == *"$extension" ]]; then
# Run clang-format.
clang-format -i "$f"
# Fix copyright headers, but not all files get them.
if [[ "$f" == *"inc" ]]; then
continue 2
elif [[ "$f" == *"glsl" ]]; then
continue 2
elif [[ "$f" == *"theme_data.h" ]]; then
continue 2
elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/input/InputManager"* ]]; then
continue 2
fi
python misc/scripts/copyright_headers.py "$f"
continue 2
fi
done
done
git diff > patch.patch
FILESIZE="$(stat -c%s patch.patch)"
MAXSIZE=5
# If no patch has been generated all is OK, clean up, and exit.
if (( FILESIZE < MAXSIZE )); then
printf "Files in this commit comply with the clang-format style rules.\n"
rm -f patch.patch
exit 0
fi
# A patch has been created, notify the user, clean up, and exit.
printf "\n*** The following differences were found between the code "
printf "and the formatting rules:\n\n"
cat patch.patch
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
rm -f patch.patch
exit 1

View File

@ -1,6 +1,8 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
header = """\
/*************************************************************************/
/* $filename */
@ -33,70 +35,61 @@ header = """\
/*************************************************************************/
"""
files = open("files", "r")
fname = sys.argv[1]
fname = files.readline()
# 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"
while fname != "":
# 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 = 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"
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).
fileread = open(fname.strip(), "r")
while line.strip() == "": # Skip empty lines at the top
line = fileread.readline()
header_done = False
while line.strip() == "": # Skip empty lines at the top
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
if line.find("/**********") == -1: # Godot header starts this way
# Maybe starting with a non-Godot comment, abort header magic
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()
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()
while line != "": # Dump everything until EOF
text += line
line = fileread.readline()
while line != "": # Dump everything until EOF
text += line
line = fileread.readline()
fileread.close()
fileread.close()
# Write
filewrite = open(fname.strip(), "w")
filewrite.write(text)
filewrite.close()
# Next file
fname = files.readline()
files.close()
# Write
filewrite = open(fname.strip(), "w")
filewrite.write(text)
filewrite.close()

59
misc/scripts/file_format.sh Executable file
View File

@ -0,0 +1,59 @@
#!/usr/bin/env bash
# This script ensures proper POSIX text file formatting and a few other things.
# This is supplementary to clang-black-format.sh, but should be run before it.
set -uo pipefail
IFS=$'\n\t'
# Loops through all text files tracked by Git.
git grep -zIl '' |
while IFS= read -rd '' f; do
# Exclude some types of files.
if [[ "$f" == *"csproj" ]]; then
continue
elif [[ "$f" == *"sln" ]]; then
continue
elif [[ "$f" == *"patch" ]]; then
continue
elif [[ "$f" == *"pot" ]]; then
continue
elif [[ "$f" == *"po" ]]; then
continue
elif [[ "$f" == "thirdparty"* ]]; then
continue
elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then
continue
fi
# Ensures that files are UTF-8 formatted.
recode UTF-8 "$f" 2> /dev/null
# Ensures that files have LF line endings.
dos2unix "$f" 2> /dev/null
# Ensures that files do not contain a BOM.
sed -i '1s/^\xEF\xBB\xBF//' "$f"
# Ensures that files end with newline characters.
tail -c1 < "$f" | read -r _ || echo >> "$f";
# Remove trailing space characters.
sed -z -i 's/\x20\x0A/\x0A/g' "$f"
# Remove the character sequence "== true" if it has a leading space.
sed -z -i 's/\x20== true//g' "$f"
done
git diff > patch.patch
FILESIZE="$(stat -c%s patch.patch)"
MAXSIZE=5
# If no patch has been generated all is OK, clean up, and exit.
if (( FILESIZE < MAXSIZE )); then
printf "Files in this commit comply with the formatting rules.\n"
rm -f patch.patch
exit 0
fi
# A patch has been created, notify the user, clean up, and exit.
printf "\n*** The following differences were found between the code "
printf "and the formatting rules:\n\n"
cat patch.patch
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
rm -f patch.patch
exit 1

View File

@ -1,60 +0,0 @@
#!/usr/bin/env bash
# Command line arguments
run_clang_format=false
run_fix_headers=false
usage="Invalid argument. Usage:\n$0 <option>\n\t--clang-format|-c\n\t--headers|-h\n\t--all|-a"
if [ -z "$1" ]; then
echo -e $usage
exit 0
fi
while [ $# -gt 0 ]; do
case "$1" in
--clang-format|-c)
run_clang_format=true
;;
--headers|-h)
run_fix_headers=true
;;
--all|-a)
run_clang_format=true
run_fix_headers=true
;;
*)
echo -e $usage
exit 0
esac
shift
done
echo "Removing generated files, some have binary data and make clang-format freeze."
find -name "*.gen.*" -delete
# Apply clang-format
if $run_clang_format; then
# Sync list with pre-commit hook
FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc .java .glsl"
for extension in ${FILE_EXTS}; do
echo -e "Formatting ${extension} files..."
find \( -path "./.git" \
-o -path "./thirdparty" \
-o -path "./platform/android/java/lib/src/com/google" \
\) -prune \
-o -name "*${extension}" \
-exec clang-format -i {} \;
done
fi
# Add missing copyright headers
if $run_fix_headers; then
echo "Fixing copyright headers in Godot code files..."
find \( -path "./.git" -o -path "./thirdparty" \) -prune \
-o -regex '.*\.\(c\|h\|cpp\|hpp\|cc\|hh\|cxx\|m\|mm\|java\)' \
> tmp-files
cat tmp-files | grep -v ".git\|thirdparty\|theme_data.h\|platform/android/java/lib/src/com/google\|platform/android/java/lib/src/org/godotengine/godot/input/InputManager" > files
python misc/scripts/fix_headers.py
rm -f tmp-files files
fi

View File

@ -1,48 +0,0 @@
#!/bin/sh
BLACK=black
BLACK_OPTIONS="-l 120"
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
# Travis only clones the PR branch and uses its HEAD commit as detached HEAD,
# so it's problematic when we want an exact commit range for format checks.
# We fetch upstream to ensure that we have the proper references to resolve.
# Ideally we would use $TRAVIS_COMMIT_RANGE but it doesn't play well with PR
# updates, as it only includes changes since the previous state of the PR.
if [ -z "$(git remote | grep upstream)" ]; then
git remote add upstream https://github.com/godotengine/godot \
--no-tags -f -t $TRAVIS_BRANCH
fi
RANGE="upstream/$TRAVIS_BRANCH HEAD"
else
# Test only the last commit, since $TRAVIS_COMMIT_RANGE wouldn't support
# force pushes.
RANGE=HEAD
fi
FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/| grep -E "(SConstruct|SCsub|\.py)$")
echo "Checking files:\n$FILES"
# create a random filename to store our generated patch
prefix="static-check-black"
suffix="$(date +%s)"
patch="/tmp/$prefix-$suffix.patch"
for file in $FILES; do
"$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 formatting rules.\n"
rm -f "$patch"
exit 0
fi
# a patch has been created, notify the user and exit
printf "\n*** The following differences were found between the code to commit "
printf "and the black formatting rules:\n\n"
pygmentize -l diff "$patch"
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
exit 1

View File

@ -1,43 +0,0 @@
#!/bin/bash
echo
echo "Download and install ccache ..."
echo
echo "Downloading sources ..."
curl -L -O https://www.samba.org/ftp/ccache/ccache-3.3.4.tar.gz # latest version available here: https://ccache.samba.org/download.html
echo "Extracting to build directory ..."
tar xzf ccache-3.3.4.tar.gz
cd ccache-3.3.4
echo "Compiling sources ..."
./configure --prefix=/usr/local --with-bundled-zlib > /dev/null
make
echo "Installing ..."
mkdir /usr/local/opt/ccache
mkdir /usr/local/opt/ccache/bin
cp ccache /usr/local/opt/ccache/bin
ln -s /usr/local/opt/ccache/bin/ccache /usr/local/bin/ccache
mkdir /usr/local/opt/ccache/libexec
links=(
clang
clang++
cc
gcc gcc2 gcc3 gcc-3.3 gcc-4.0 gcc-4.2 gcc-4.3 gcc-4.4 gcc-4.5 gcc-4.6 gcc-4.7 gcc-4.8 gcc-4.9 gcc-5 gcc-6 gcc-7
c++ c++3 c++-3.3 c++-4.0 c++-4.2 c++-4.3 c++-4.4 c++-4.5 c++-4.6 c++-4.7 c++-4.8 c++-4.9 c++-5 c++-6 c++-7
g++ g++2 g++3 g++-3.3 g++-4.0 g++-4.2 g++-4.3 g++-4.4 g++-4.5 g++-4.6 g++-4.7 g++-4.8 g++-4.9 g++-5 g++-6 g++-7
)
for link in "${links[@]}"; do
ln -s ../bin/ccache /usr/local/opt/ccache/libexec/$link
done
#/usr/local/bin/ccache -M 2G
cd $TRAVIS_BUILD_DIR
echo
echo "Done!"
echo

View File

@ -1,48 +0,0 @@
#!/bin/sh
CLANG_FORMAT=clang-format-8
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
# Travis only clones the PR branch and uses its HEAD commit as detached HEAD,
# so it's problematic when we want an exact commit range for format checks.
# We fetch upstream to ensure that we have the proper references to resolve.
# Ideally we would use $TRAVIS_COMMIT_RANGE but it doesn't play well with PR
# updates, as it only includes changes since the previous state of the PR.
if [ -z "$(git remote | grep upstream)" ]; then
git remote add upstream https://github.com/godotengine/godot \
--no-tags -f -t $TRAVIS_BRANCH
fi
RANGE="upstream/$TRAVIS_BRANCH HEAD"
else
# Test only the last commit, since $TRAVIS_COMMIT_RANGE wouldn't support
# force pushes.
RANGE=HEAD
fi
FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -v platform/android/java/lib/src/com/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java|glsl)$")
echo "Checking files:\n$FILES"
# create a random filename to store our generated patch
prefix="static-check-clang-format"
suffix="$(date +%s)"
patch="/tmp/$prefix-$suffix.patch"
for file in $FILES; do
"$CLANG_FORMAT" -style=file "$file" | \
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 "\n*** The following differences were found between the code to commit "
printf "and the clang-format rules:\n\n"
pygmentize -l diff "$patch"
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
exit 1

View File

@ -1864,7 +1864,7 @@ MonoObject *CSharpInstance::_internal_new_managed() {
bool die = _unreference_owner_unsafe();
// Not ok for the owner to die here. If there is a situation where this can happen, it will be considered a bug.
CRASH_COND(die == true);
CRASH_COND(die);
owner = NULL;
@ -2203,7 +2203,7 @@ CSharpInstance::~CSharpInstance() {
// Unreference the owner here, before the new "instance binding" references it.
// Otherwise, the unsafe reference debug checks will incorrectly detect a bug.
bool die = _unreference_owner_unsafe();
CRASH_COND(die == true); // `owner_keep_alive` holds a reference, so it can't die
CRASH_COND(die); // `owner_keep_alive` holds a reference, so it can't die
void *data = owner->get_script_instance_binding(CSharpLanguage::get_singleton()->get_language_index());
CRASH_COND(data == NULL);
@ -3015,7 +3015,7 @@ CSharpInstance *CSharpScript::_create_instance(const Variant **p_args, int p_arg
bool die = instance->_unreference_owner_unsafe();
// Not ok for the owner to die here. If there is a situation where this can happen, it will be considered a bug.
CRASH_COND(die == true);
CRASH_COND(die);
p_owner->set_script_instance(NULL);
r_error.error = Variant::CallError::CALL_ERROR_INSTANCE_IS_NULL;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;

View File

@ -118,9 +118,14 @@ namespace GodotTools.Build
string arguments = string.Empty;
if (buildTool == BuildTool.DotnetCli)
arguments += "msbuild "; // `dotnet msbuild` command
arguments += "msbuild"; // `dotnet msbuild` command
arguments += $@"""{buildInfo.Solution}"" /t:{string.Join(",", buildInfo.Targets)} " +
arguments += $@" ""{buildInfo.Solution}""";
if (buildInfo.Restore)
arguments += " /restore";
arguments += $@" /t:{string.Join(",", buildInfo.Targets)} " +
$@"""/p:{"Configuration=" + buildInfo.Configuration}"" /v:normal " +
$@"""/l:{typeof(GodotBuildLogger).FullName},{GodotBuildLogger.AssemblyPath};{buildInfo.LogsDirPath}""";

View File

@ -587,7 +587,7 @@ namespace Godot
/// Returns a vector transformed (multiplied) by the basis matrix.
/// </summary>
/// <param name="v">A vector to transform.</param>
/// <returns>The transfomed vector.</returns>
/// <returns>The transformed vector.</returns>
public Vector3 Xform(Vector3 v)
{
return new Vector3
@ -605,7 +605,7 @@ namespace Godot
/// basis matrix only if it represents a rotation-reflection.
/// </summary>
/// <param name="v">A vector to inversely transform.</param>
/// <returns>The inversely transfomed vector.</returns>
/// <returns>The inversely transformed vector.</returns>
public Vector3 XformInv(Vector3 v)
{
return new Vector3

View File

@ -109,7 +109,7 @@ namespace Godot
/// <summary>
/// Returns the shortest distance from this plane to the position `point`.
/// </summary>
/// <param name="point">The position to use for the calcualtion.</param>
/// <param name="point">The position to use for the calculation.</param>
/// <returns>The shortest distance.</returns>
public real_t DistanceTo(Vector3 point)
{

View File

@ -326,7 +326,7 @@ namespace Godot
/// Returns a vector transformed (multiplied) by this quaternion.
/// </summary>
/// <param name="v">A vector to transform.</param>
/// <returns>The transfomed vector.</returns>
/// <returns>The transformed vector.</returns>
public Vector3 Xform(Vector3 v)
{
#if DEBUG

View File

@ -248,7 +248,7 @@ namespace Godot
/// Returns a vector transformed (multiplied) by this transformation matrix.
/// </summary>
/// <param name="v">A vector to transform.</param>
/// <returns>The transfomed vector.</returns>
/// <returns>The transformed vector.</returns>
public Vector3 Xform(Vector3 v)
{
return new Vector3
@ -266,7 +266,7 @@ namespace Godot
/// transformation matrix only if it represents a rotation-reflection.
/// </summary>
/// <param name="v">A vector to inversely transform.</param>
/// <returns>The inversely transfomed vector.</returns>
/// <returns>The inversely transformed vector.</returns>
public Vector3 XformInv(Vector3 v)
{
Vector3 vInv = v - origin;

View File

@ -181,7 +181,7 @@ namespace Godot
/// This method does not account for translation (the origin vector).
/// </summary>
/// <param name="v">A vector to transform.</param>
/// <returns>The transfomed vector.</returns>
/// <returns>The transformed vector.</returns>
public Vector2 BasisXform(Vector2 v)
{
return new Vector2(Tdotx(v), Tdoty(v));
@ -195,7 +195,7 @@ namespace Godot
/// basis matrix only if it represents a rotation-reflection.
/// </summary>
/// <param name="v">A vector to inversely transform.</param>
/// <returns>The inversely transfomed vector.</returns>
/// <returns>The inversely transformed vector.</returns>
public Vector2 BasisXformInv(Vector2 v)
{
return new Vector2(x.Dot(v), y.Dot(v));
@ -355,7 +355,7 @@ namespace Godot
/// Returns a vector transformed (multiplied) by this transformation matrix.
/// </summary>
/// <param name="v">A vector to transform.</param>
/// <returns>The transfomed vector.</returns>
/// <returns>The transformed vector.</returns>
public Vector2 Xform(Vector2 v)
{
return new Vector2(Tdotx(v), Tdoty(v)) + origin;
@ -365,7 +365,7 @@ namespace Godot
/// Returns a vector transformed (multiplied) by the inverse transformation matrix.
/// </summary>
/// <param name="v">A vector to inversely transform.</param>
/// <returns>The inversely transfomed vector.</returns>
/// <returns>The inversely transformed vector.</returns>
public Vector2 XformInv(Vector2 v)
{
Vector2 vInv = v - origin;

View File

@ -164,7 +164,7 @@ def configure(env):
elif env["target"] == "debug":
env.Append(LINKFLAGS=["-O0"])
env.Append(CCFLAGS=["-O0", "-g", "-fno-limit-debug-info"])
env.Append(CPPDEFINES=["_DEBUG", "DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
env.Append(CPPDEFINES=["_DEBUG", "DEBUG_ENABLED"])
env.Append(CPPFLAGS=["-UNDEBUG"])
# Compiler configuration

View File

@ -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 */

View File

@ -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 */

View File

@ -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 */

View File

@ -62,7 +62,7 @@ def configure(env):
elif env["target"] == "debug":
env.Append(CCFLAGS=["-gdwarf-2", "-O0"])
env.Append(CPPDEFINES=["_DEBUG", ("DEBUG", 1), "DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
env.Append(CPPDEFINES=["_DEBUG", ("DEBUG", 1), "DEBUG_ENABLED"])
if env["use_lto"]:
env.Append(CCFLAGS=["-flto"])

View File

@ -66,7 +66,7 @@ def configure(env):
elif env["target"] == "debug":
env.Prepend(CCFLAGS=["-g3"])
env.Prepend(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
## Architecture

View File

@ -3135,7 +3135,7 @@ void OS_OSX::run() {
process_events(); // get rid of pending events
joypad_osx->process_joypads();
if (Main::iteration() == true) {
if (Main::iteration()) {
quit = true;
}
} @catch (NSException *exception) {

View File

@ -78,7 +78,7 @@ def configure(env):
elif env["target"] == "debug":
env.Prepend(CCFLAGS=["-g3"])
env.Prepend(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
env.Append(LINKFLAGS=["-rdynamic"])
## Architecture

View File

@ -69,7 +69,7 @@ def configure(env):
elif env["target"] == "debug":
env.Append(CCFLAGS=["/Zi"])
env.Append(CCFLAGS=["/MDd"])
env.Append(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
env.Append(CPPDEFINES=["DEBUG_ENABLED"])
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
env.Append(LINKFLAGS=["/DEBUG"])

View File

@ -196,7 +196,7 @@ def configure_msvc(env, manual_msvc_config):
elif env["target"] == "debug":
env.AppendUnique(CCFLAGS=["/Z7", "/Od", "/EHsc"])
env.AppendUnique(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED", "D3D_DEBUG_INFO"])
env.AppendUnique(CPPDEFINES=["DEBUG_ENABLED"])
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
env.Append(LINKFLAGS=["/DEBUG"])
@ -325,7 +325,7 @@ def configure_mingw(env):
elif env["target"] == "debug":
env.Append(CCFLAGS=["-g3"])
env.Append(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
env.Append(CPPDEFINES=["DEBUG_ENABLED"])
## Compiler configuration

View File

@ -109,7 +109,7 @@ def configure(env):
elif env["target"] == "debug":
env.Prepend(CCFLAGS=["-g3"])
env.Prepend(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
env.Prepend(CPPDEFINES=["DEBUG_ENABLED"])
env.Append(LINKFLAGS=["-rdynamic"])
## Architecture

View File

@ -689,7 +689,7 @@ void Tween::_tween_process(float p_delta) {
}
// Are all of the tweens complete?
bool all_finished = true;
int any_unfinished = 0;
// For each tween we wish to interpolate...
for (List<InterpolateData>::Element *E = interpolates.front(); E; E = E->next()) {
@ -697,13 +697,13 @@ void Tween::_tween_process(float p_delta) {
// Get the data from it
InterpolateData &data = E->get();
// Track if we hit one that isn't finished yet
all_finished = all_finished && data.finish;
// Is the data not active or already finished? No need to go any further
if (!data.active || data.finish)
continue;
// Track if we hit one that isn't finished yet
any_unfinished++;
// Get the target object for this interpolation
Object *object = ObjectDB::get_instance(data.id);
if (object == NULL)
@ -787,18 +787,17 @@ void Tween::_tween_process(float p_delta) {
emit_signal("tween_completed", object, NodePath(Vector<StringName>(), data.key, false));
// If we are not repeating the tween, remove it
if (!repeat)
if (!repeat) {
call_deferred("_remove_by_uid", data.uid);
} else if (!repeat) {
// Check whether all tweens are finished
all_finished = all_finished && data.finish;
any_unfinished--;
}
}
}
// One less update left to go
pending_update--;
// If all tweens are completed, we no longer need to be active
if (all_finished) {
if (any_unfinished == 0) {
set_active(false);
emit_signal("tween_all_completed");
}

View File

@ -127,7 +127,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
selection.creating = false;
selection.doubleclick = false;
if (OS::get_singleton()->has_virtual_keyboard()) {
if (OS::get_singleton()->has_virtual_keyboard() && virtual_keyboard_enabled) {
if (selection.enabled) {
OS::get_singleton()->show_virtual_keyboard(text, get_global_rect(), max_length, selection.begin, selection.end);
} else {
@ -323,7 +323,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
case KEY_ENTER: {
emit_signal("text_entered", text);
if (OS::get_singleton()->has_virtual_keyboard())
if (OS::get_singleton()->has_virtual_keyboard() && virtual_keyboard_enabled)
OS::get_singleton()->hide_virtual_keyboard();
} break;
@ -930,7 +930,7 @@ void LineEdit::_notification(int p_what) {
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos2);
}
if (OS::get_singleton()->has_virtual_keyboard()) {
if (OS::get_singleton()->has_virtual_keyboard() && virtual_keyboard_enabled) {
if (selection.enabled) {
OS::get_singleton()->show_virtual_keyboard(text, get_global_rect(), max_length, selection.begin, selection.end);
} else {
@ -949,7 +949,7 @@ void LineEdit::_notification(int p_what) {
ime_text = "";
ime_selection = Point2();
if (OS::get_singleton()->has_virtual_keyboard())
if (OS::get_singleton()->has_virtual_keyboard() && virtual_keyboard_enabled)
OS::get_singleton()->hide_virtual_keyboard();
} break;
@ -1667,6 +1667,14 @@ bool LineEdit::is_shortcut_keys_enabled() const {
return shortcut_keys_enabled;
}
void LineEdit::set_virtual_keyboard_enabled(bool p_enable) {
virtual_keyboard_enabled = p_enable;
}
bool LineEdit::is_virtual_keyboard_enabled() const {
return virtual_keyboard_enabled;
}
void LineEdit::set_selecting_enabled(bool p_enabled) {
selecting_enabled = p_enabled;
@ -1821,6 +1829,8 @@ void LineEdit::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_menu"), &LineEdit::get_menu);
ClassDB::bind_method(D_METHOD("set_context_menu_enabled", "enable"), &LineEdit::set_context_menu_enabled);
ClassDB::bind_method(D_METHOD("is_context_menu_enabled"), &LineEdit::is_context_menu_enabled);
ClassDB::bind_method(D_METHOD("set_virtual_keyboard_enabled", "enable"), &LineEdit::set_virtual_keyboard_enabled);
ClassDB::bind_method(D_METHOD("is_virtual_keyboard_enabled"), &LineEdit::is_virtual_keyboard_enabled);
ClassDB::bind_method(D_METHOD("set_clear_button_enabled", "enable"), &LineEdit::set_clear_button_enabled);
ClassDB::bind_method(D_METHOD("is_clear_button_enabled"), &LineEdit::is_clear_button_enabled);
ClassDB::bind_method(D_METHOD("set_shortcut_keys_enabled", "enable"), &LineEdit::set_shortcut_keys_enabled);
@ -1856,6 +1866,7 @@ void LineEdit::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "secret_character"), "set_secret_character", "get_secret_character");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "expand_to_text_length"), "set_expand_to_text_length", "get_expand_to_text_length");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "context_menu_enabled"), "set_context_menu_enabled", "is_context_menu_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "virtual_keyboard_enabled"), "set_virtual_keyboard_enabled", "is_virtual_keyboard_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "clear_button_enabled"), "set_clear_button_enabled", "is_clear_button_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shortcut_keys_enabled"), "set_shortcut_keys_enabled", "is_shortcut_keys_enabled");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "selecting_enabled"), "set_selecting_enabled", "is_selecting_enabled");

View File

@ -91,6 +91,8 @@ private:
bool shortcut_keys_enabled;
bool virtual_keyboard_enabled = true;
Ref<Texture> right_icon;
struct Selection {
@ -229,6 +231,9 @@ public:
void set_shortcut_keys_enabled(bool p_enabled);
bool is_shortcut_keys_enabled() const;
void set_virtual_keyboard_enabled(bool p_enable);
bool is_virtual_keyboard_enabled() const;
void set_selecting_enabled(bool p_enabled);
bool is_selecting_enabled() const;

View File

@ -1021,8 +1021,8 @@ void RichTextLabel::_notification(int p_what) {
visible_line_count = 0;
while (y < size.height && from_line < main->lines.size()) {
visible_line_count += _process_line(main, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_DRAW, base_font, base_color, font_color_shadow, use_outline, shadow_ofs, Point2i(), NULL, NULL, NULL, total_chars);
visible_line_count++;
_process_line(main, text_rect.get_position(), y, text_rect.get_size().width - scroll_w, from_line, PROCESS_DRAW, base_font, base_color, font_color_shadow, use_outline, shadow_ofs, Point2i(), NULL, NULL, NULL, total_chars);
total_chars += main->lines[from_line].char_count;
from_line++;

View File

@ -3597,6 +3597,8 @@ void Tree::scroll_to_item(TreeItem *p_item) {
TreeItem *Tree::_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards) {
TreeItem *from = p_at;
TreeItem *loop = nullptr; // Safe-guard against infinite loop.
while (p_at) {
for (int i = 0; i < columns.size(); i++) {
@ -3614,6 +3616,12 @@ TreeItem *Tree::_search_item_text(TreeItem *p_at, const String &p_find, int *r_c
if ((p_at) == from)
break;
if (!loop) {
loop = p_at;
} else if (loop == p_at) {
break;
}
}
return NULL;

View File

@ -821,8 +821,9 @@ int Animation::_insert(float p_time, T &p_keys, const V &p_value) {
// Condition for replacement.
if (idx > 0 && Math::is_equal_approx(p_keys[idx - 1].time, p_time)) {
float transition = p_keys[idx - 1].transition;
p_keys.write[idx - 1] = p_value;
p_keys.write[idx - 1].transition = transition;
return idx - 1;
// Condition for insert.

View File

@ -374,9 +374,8 @@ Collection of single-file libraries used in Godot components.
* License: zlib
- `stb_vorbis.c`
* Upstream: https://github.com/nothings/stb
* Version: 1.19
* Version: 1.20
* License: Public Domain (Unlicense) or MIT
* Modifications: `f->temp_offset += (sz+3)&~3;` changed to `f->temp_offset += (sz+7)&~7;` (needed until fixed upstream)
## nanosvg

View File

@ -1,4 +1,4 @@
// Ogg Vorbis audio decoder - v1.19 - public domain
// Ogg Vorbis audio decoder - v1.20 - public domain
// http://nothings.org/stb_vorbis/
//
// Original version written by Sean Barrett in 2007.
@ -31,9 +31,11 @@
// Phillip Bennefall Rohit Thiago Goulart
// github:manxorist saga musix github:infatum
// Timur Gagiev Maxwell Koo Peter Waller
// github:audinowho Dougall Johnson
// github:audinowho Dougall Johnson David Reid
// github:Clownacy Pedro J. Estebanez Remi Verschelde
//
// Partial history:
// 1.20 - 2020-07-11 - several small fixes
// 1.19 - 2020-02-05 - warnings
// 1.18 - 2020-02-02 - fix seek bugs; parse header comments; misc warnings etc.
// 1.17 - 2019-07-08 - fix CVE-2019-13217..CVE-2019-13223 (by ForAllSecure)
@ -577,7 +579,7 @@ enum STBVorbisError
#if defined(_MSC_VER) || defined(__MINGW32__)
#include <malloc.h>
#endif
#if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__)
#if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__) || defined(__NEWLIB__)
#include <alloca.h>
#endif
#else // STB_VORBIS_NO_CRT
@ -599,7 +601,9 @@ enum STBVorbisError
#undef __forceinline
#endif
#define __forceinline
#ifndef alloca
#define alloca __builtin_alloca
#endif
#elif !defined(_MSC_VER)
#if __GNUC__
#define __forceinline inline
@ -1600,7 +1604,8 @@ static uint32 get_bits(vorb *f, int n)
f->valid_bits += 8;
}
}
if (f->valid_bits < 0) return 0;
assert(f->valid_bits >= n);
z = f->acc & ((1 << n)-1);
f->acc >>= n;
f->valid_bits -= n;
@ -4256,7 +4261,7 @@ static void vorbis_init(stb_vorbis *p, const stb_vorbis_alloc *z)
memset(p, 0, sizeof(*p)); // NULL out all malloc'd pointers to start
if (z) {
p->alloc = *z;
p->alloc.alloc_buffer_length_in_bytes = (p->alloc.alloc_buffer_length_in_bytes+3) & ~3;
p->alloc.alloc_buffer_length_in_bytes &= ~7;
p->temp_offset = p->alloc.alloc_buffer_length_in_bytes;
}
p->eof = 0;