diff options
102 files changed, 694 insertions, 416 deletions
diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 0173657e80..0000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,55 +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 -# Disabled for performance reasons until master is more stable. -# - GD_PLATFORM: windows -# TARGET: release -# TOOLS: no - -matrix: - fast_finish: true - -init: - - ps: if ($env:APPVEYOR_REPO_BRANCH -ne "master") { $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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index da597a9706..77554ea0ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -87,7 +87,7 @@ jobs: ${{runner.os}}-template ${{runner.os}} - # 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: @@ -216,7 +216,13 @@ jobs: steps: - uses: actions/checkout@v2 - # install all packages (except scons) + # 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 \ @@ -267,7 +273,13 @@ jobs: steps: - uses: actions/checkout@v2 - # install all packages (except scons) + # 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 \ @@ -287,7 +299,7 @@ jobs: ${{runner.os}}-template ${{runner.os}} - # 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: diff --git a/.travis.yml b/.travis.yml index 9c085d4ce0..cb576efee7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ env: - SCONS_CACHE=$HOME/.scons_cache/$TRAVIS_BRANCH - SCONS_CACHE_LIMIT=1024 - OPTIONS="debug_symbols=no verbose=yes progress=no" - - secure: "uch9QszCgsl1qVbuzY41P7S2hWL2IiNFV4SbAYRCdi0oJ9MIu+pVyrQdpf3+jG4rH6j4Rffl+sN17Zz4dIDDioFL1JwqyCqyCyswR8uACC0Rr8gr4Mi3+HIRbv+2s2P4cIQq41JM8FJe84k9jLEMGCGh69w+ibCWoWs74CokYVA=" cache: directories: @@ -19,32 +18,6 @@ cache: matrix: include: - - name: Linux editor (debug, GCC 9, with Mono) - stage: build - env: PLATFORM=linuxbsd 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: - - sourceline: "deb https://download.mono-project.com/repo/ubuntu stable-bionic main" - key_url: "https://raw.githubusercontent.com/travis-ci/apt-source-safelist/master/keys/mono.asc" - - sourceline: "ppa: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 7) - stage: build - env: PLATFORM=linuxbsd 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" @@ -55,18 +28,6 @@ matrix: 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" - os: osx - osx_image: xcode11.5 - compiler: clang - addons: - homebrew: - packages: - - scons - update: true - # TODO: iOS MoltenVK support # - name: iOS export template (debug, Clang) @@ -80,16 +41,6 @@ matrix: # packages: # - scons - - name: Linux export template (release_debug, GCC 7, without 3D support) - stage: build - env: PLATFORM=linuxbsd TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-gcc-7 EXTRA_ARGS="disable_3d=yes" - os: linux - compiler: gcc - addons: - apt: - packages: - - *linux_deps - - name: JavaScript export template (release, emscripten latest) stage: build env: PLATFORM=javascript TOOLS=no TARGET=release CACHE_NAME=${PLATFORM}-emcc-latest EXTRA_ARGS="use_closure_compiler=yes" @@ -113,12 +64,13 @@ install: 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; + misc/ci/android-tools-linux.sh; fi - if [ "$PLATFORM" = "javascript" ]; then - git clone --depth 1 "https://github.com/emscripten-core/emsdk.git"; + git clone --depth 1 https://github.com/emscripten-core/emsdk; ./emsdk/emsdk install latest; - ./emsdk/emsdk activate --no-embedded latest; + ./emsdk/emsdk activate latest; + source ./emsdk/emsdk_env.sh; fi before_script: @@ -128,9 +80,4 @@ before_script: fi script: - - 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.linuxbsd.opt.tools.64)\":" godot-tests/tests/project_export/export_presets.cfg; - godot-tests/tests/project_export/test_project.sh "bin/godot_server.linuxbsd.opt.tools.64"; - fi + - scons -j2 CC=$CC CXX=$CXX platform=$PLATFORM tools=$TOOLS target=$TARGET $OPTIONS $EXTRA_ARGS @@ -67,6 +67,7 @@ such as text and video tutorials, demos, etc. Consult the [community channels](h for more info. [![Travis Build Status](https://travis-ci.org/godotengine/godot.svg?branch=master)](https://travis-ci.org/godotengine/godot) +[![Actions Build Status](https://github.com/godotengine/godot/workflows/Godot/badge.svg?branch=master)](https://github.com/godotengine/godot/actions) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/bfiihqq6byxsjxxh/branch/master?svg=true)](https://ci.appveyor.com/project/akien-mga/godot) [![Code Triagers Badge](https://www.codetriage.com/godotengine/godot/badges/users.svg)](https://www.codetriage.com/godotengine/godot) [![Translate on Weblate](https://hosted.weblate.org/widgets/godot-engine/-/godot/svg-badge.svg)](https://hosted.weblate.org/engage/godot-engine/?utm_source=widget) diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 94da74cbda..2f8b11652b 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1690,7 +1690,7 @@ String _Directory::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); @@ -1701,7 +1701,7 @@ Error _Directory::make_dir(String 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); diff --git a/core/class_db.cpp b/core/class_db.cpp index 05c9850c39..88f1df3457 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -548,6 +548,29 @@ void ClassDB::_add_class2(const StringName &p_class, const StringName &p_inherit } } +#ifdef DEBUG_METHODS_ENABLED +static MethodInfo info_from_bind(MethodBind *p_method) { + MethodInfo minfo; + minfo.name = p_method->get_name(); + minfo.id = p_method->get_method_id(); + + for (int i = 0; i < p_method->get_argument_count(); i++) { + minfo.arguments.push_back(p_method->get_argument_info(i)); + } + + minfo.return_val = p_method->get_return_info(); + minfo.flags = p_method->get_hint_flags(); + + for (int i = 0; i < p_method->get_argument_count(); i++) { + if (p_method->has_default_argument(i)) { + minfo.default_arguments.push_back(p_method->get_default_argument(i)); + } + } + + return minfo; +} +#endif + void ClassDB::get_method_list(StringName p_class, List<MethodInfo> *p_methods, bool p_no_inheritance, bool p_exclude_from_properties) { OBJTYPE_RLOCK; @@ -570,29 +593,12 @@ void ClassDB::get_method_list(StringName p_class, List<MethodInfo> *p_methods, b } for (List<StringName>::Element *E = type->method_order.front(); E; E = E->next()) { - MethodBind *method = type->method_map.get(E->get()); - MethodInfo minfo; - minfo.name = E->get(); - minfo.id = method->get_method_id(); - - if (p_exclude_from_properties && type->methods_in_properties.has(minfo.name)) { + if (p_exclude_from_properties && type->methods_in_properties.has(E->get())) { continue; } - for (int i = 0; i < method->get_argument_count(); i++) { - //Variant::Type t=method->get_argument_type(i); - - minfo.arguments.push_back(method->get_argument_info(i)); - } - - minfo.return_val = method->get_return_info(); - minfo.flags = method->get_hint_flags(); - - for (int i = 0; i < method->get_argument_count(); i++) { - if (method->has_default_argument(i)) { - minfo.default_arguments.push_back(method->get_default_argument(i)); - } - } + MethodBind *method = type->method_map.get(E->get()); + MethodInfo minfo = info_from_bind(method); p_methods->push_back(minfo); } @@ -618,6 +624,57 @@ void ClassDB::get_method_list(StringName p_class, List<MethodInfo> *p_methods, b } } +bool ClassDB::get_method_info(StringName p_class, StringName p_method, MethodInfo *r_info, bool p_no_inheritance, bool p_exclude_from_properties) { + OBJTYPE_RLOCK; + + ClassInfo *type = classes.getptr(p_class); + + while (type) { + if (type->disabled) { + if (p_no_inheritance) { + break; + } + + type = type->inherits_ptr; + continue; + } + +#ifdef DEBUG_METHODS_ENABLED + MethodBind **method = type->method_map.getptr(p_method); + if (method && *method) { + if (r_info != nullptr) { + MethodInfo minfo = info_from_bind(*method); + *r_info = minfo; + } + return true; + } else if (type->virtual_methods_map.has(p_method)) { + if (r_info) { + *r_info = type->virtual_methods_map[p_method]; + } + return true; + } +#else + if (type->method_map.has(p_method)) { + if (r_info) { + MethodBind *m = type->method_map[p_method]; + MethodInfo mi; + mi.name = m->get_name(); + *r_info = mi; + } + return true; + } +#endif + + if (p_no_inheritance) { + break; + } + + type = type->inherits_ptr; + } + + return false; +} + MethodBind *ClassDB::get_method(StringName p_class, StringName p_name) { OBJTYPE_RLOCK; @@ -718,6 +775,25 @@ int ClassDB::get_integer_constant(const StringName &p_class, const StringName &p return 0; } +bool ClassDB::has_integer_constant(const StringName &p_class, const StringName &p_name, bool p_no_inheritance) { + OBJTYPE_RLOCK; + + ClassInfo *type = classes.getptr(p_class); + + while (type) { + if (type->constant_map.has(p_name)) { + return true; + } + if (p_no_inheritance) { + return false; + } + + type = type->inherits_ptr; + } + + return false; +} + StringName ClassDB::get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance) { OBJTYPE_RLOCK; @@ -784,6 +860,25 @@ void ClassDB::get_enum_constants(const StringName &p_class, const StringName &p_ } } +bool ClassDB::has_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance) { + OBJTYPE_RLOCK; + + ClassInfo *type = classes.getptr(p_class); + + while (type) { + if (type->enum_map.has(p_name)) { + return true; + } + if (p_no_inheritance) { + return false; + } + + type = type->inherits_ptr; + } + + return false; +} + void ClassDB::add_signal(StringName p_class, const MethodInfo &p_signal) { OBJTYPE_WLOCK; @@ -825,7 +920,7 @@ void ClassDB::get_signal_list(StringName p_class, List<MethodInfo> *p_signals, b } } -bool ClassDB::has_signal(StringName p_class, StringName p_signal) { +bool ClassDB::has_signal(StringName p_class, StringName p_signal, bool p_no_inheritance) { OBJTYPE_RLOCK; ClassInfo *type = classes.getptr(p_class); ClassInfo *check = type; @@ -833,6 +928,9 @@ bool ClassDB::has_signal(StringName p_class, StringName p_signal) { if (check->signal_map.has(p_signal)) { return true; } + if (p_no_inheritance) { + return false; + } check = check->inherits_ptr; } @@ -910,6 +1008,7 @@ void ClassDB::add_property(StringName p_class, const PropertyInfo &p_pinfo, cons OBJTYPE_WLOCK type->property_list.push_back(p_pinfo); + type->property_map[p_pinfo.name] = p_pinfo; #ifdef DEBUG_METHODS_ENABLED if (mb_get) { type->methods_in_properties.insert(p_getter); @@ -959,6 +1058,30 @@ void ClassDB::get_property_list(StringName p_class, List<PropertyInfo> *p_list, } } +bool ClassDB::get_property_info(StringName p_class, StringName p_property, PropertyInfo *r_info, bool p_no_inheritance, const Object *p_validator) { + OBJTYPE_RLOCK; + + ClassInfo *check = classes.getptr(p_class); + while (check) { + if (check->property_map.has(p_property)) { + PropertyInfo pinfo = check->property_map[p_property]; + if (p_validator) { + p_validator->_validate_property(pinfo); + } + if (r_info) { + *r_info = pinfo; + } + return true; + } + if (p_no_inheritance) { + break; + } + check = check->inherits_ptr; + } + + return false; +} + bool ClassDB::set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid) { ClassInfo *type = classes.getptr(p_object->get_class_name()); ClassInfo *check = type; @@ -1239,6 +1362,7 @@ void ClassDB::add_virtual_method(const StringName &p_class, const MethodInfo &p_ mi.flags |= METHOD_FLAG_VIRTUAL; } classes[p_class].virtual_methods.push_back(mi); + classes[p_class].virtual_methods_map[p_method.name] = mi; #endif } diff --git a/core/class_db.h b/core/class_db.h index eae2a9afd4..86ac2aa001 100644 --- a/core/class_db.h +++ b/core/class_db.h @@ -120,11 +120,13 @@ public: HashMap<StringName, List<StringName>> enum_map; HashMap<StringName, MethodInfo> signal_map; List<PropertyInfo> property_list; + HashMap<StringName, PropertyInfo> property_map; #ifdef DEBUG_METHODS_ENABLED List<StringName> constant_order; List<StringName> method_order; Set<StringName> methods_in_properties; List<MethodInfo> virtual_methods; + Map<StringName, MethodInfo> virtual_methods_map; StringName category; #endif HashMap<StringName, PropertySetGet> property_setget; @@ -328,7 +330,7 @@ public: } static void add_signal(StringName p_class, const MethodInfo &p_signal); - static bool has_signal(StringName p_class, StringName p_signal); + static bool has_signal(StringName p_class, StringName p_signal, bool p_no_inheritance = false); static bool get_signal(StringName p_class, StringName p_signal, MethodInfo *r_signal); static void get_signal_list(StringName p_class, List<MethodInfo> *p_signals, bool p_no_inheritance = false); @@ -337,6 +339,7 @@ public: static void add_property(StringName p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1); static void set_property_default_value(StringName p_class, const StringName &p_name, const Variant &p_default); static void get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance = false, const Object *p_validator = nullptr); + static bool get_property_info(StringName p_class, StringName p_property, PropertyInfo *r_info, bool p_no_inheritance = false, const Object *p_validator = nullptr); static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = nullptr); static bool get_property(Object *p_object, const StringName &p_property, Variant &r_value); static bool has_property(const StringName &p_class, const StringName &p_property, bool p_no_inheritance = false); @@ -349,6 +352,7 @@ public: static void set_method_flags(StringName p_class, StringName p_method, int p_flags); static void get_method_list(StringName p_class, List<MethodInfo> *p_methods, bool p_no_inheritance = false, bool p_exclude_from_properties = false); + static bool get_method_info(StringName p_class, StringName p_method, MethodInfo *r_info, bool p_no_inheritance = false, bool p_exclude_from_properties = false); static MethodBind *get_method(StringName p_class, StringName p_name); static void add_virtual_method(const StringName &p_class, const MethodInfo &p_method, bool p_virtual = true); @@ -357,10 +361,12 @@ public: static void bind_integer_constant(const StringName &p_class, const StringName &p_enum, const StringName &p_name, int p_constant); static void get_integer_constant_list(const StringName &p_class, List<String> *p_constants, bool p_no_inheritance = false); static int get_integer_constant(const StringName &p_class, const StringName &p_name, bool *p_success = nullptr); + static bool has_integer_constant(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false); static StringName get_integer_constant_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false); static void get_enum_list(const StringName &p_class, List<StringName> *p_enums, bool p_no_inheritance = false); static void get_enum_constants(const StringName &p_class, const StringName &p_enum, List<StringName> *p_constants, bool p_no_inheritance = false); + static bool has_enum(const StringName &p_class, const StringName &p_name, bool p_no_inheritance = false); static Variant class_get_default_property_value(const StringName &p_class, const StringName &p_property, bool *r_valid = nullptr); diff --git a/core/container_type_validate.h b/core/container_type_validate.h index f2724e884d..8a361aa0ef 100644 --- a/core/container_type_validate.h +++ b/core/container_type_validate.h @@ -38,7 +38,7 @@ struct ContainerTypeValidate { Variant::Type type = Variant::NIL; StringName class_name; Ref<Script> script; - const char *where = "conatiner"; + const char *where = "container"; _FORCE_INLINE_ bool can_reference(const ContainerTypeValidate &p_type) const { if (type == p_type.type) { diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 9dbb843902..1f495bf91a 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -856,7 +856,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. diff --git a/doc/classes/DynamicFont.xml b/doc/classes/DynamicFont.xml index 0864c3ba36..24df056c6b 100644 --- a/doc/classes/DynamicFont.xml +++ b/doc/classes/DynamicFont.xml @@ -26,6 +26,14 @@ Adds a fallback font. </description> </method> + <method name="get_available_chars" qualifiers="const"> + <return type="String"> + </return> + <description> + Returns a string containing all the characters available in the main and all the fallback fonts. + If a given character is included in more than one font, it appears only once in the returned string. + </description> + </method> <method name="get_fallback" qualifiers="const"> <return type="DynamicFontData"> </return> diff --git a/doc/classes/EditorFileSystem.xml b/doc/classes/EditorFileSystem.xml index 9bb51af2d0..5461dccd27 100644 --- a/doc/classes/EditorFileSystem.xml +++ b/doc/classes/EditorFileSystem.xml @@ -97,6 +97,7 @@ <argument index="0" name="resources" type="PackedStringArray"> </argument> <description> + Emitted if at least one resource is reloaded when the filesystem is scanned. </description> </signal> <signal name="sources_changed"> diff --git a/doc/classes/EditorFileSystemDirectory.xml b/doc/classes/EditorFileSystemDirectory.xml index 096fe5df8f..b852ae1063 100644 --- a/doc/classes/EditorFileSystemDirectory.xml +++ b/doc/classes/EditorFileSystemDirectory.xml @@ -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"> diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index 0aac59c727..ea2dfae9a5 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -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> diff --git a/doc/classes/EditorInspector.xml b/doc/classes/EditorInspector.xml index 2f62fe9e40..5fbe427f67 100644 --- a/doc/classes/EditorInspector.xml +++ b/doc/classes/EditorInspector.xml @@ -14,41 +14,50 @@ <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_deleted"> <argument index="0" name="property" type="String"> </argument> <description> + Emitted when a property is removed from the 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"> @@ -57,6 +66,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"> @@ -65,10 +76,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> diff --git a/doc/classes/EditorInterface.xml b/doc/classes/EditorInterface.xml index 1d877e632e..8b2b9c9350 100644 --- a/doc/classes/EditorInterface.xml +++ b/doc/classes/EditorInterface.xml @@ -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=""""> </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"> diff --git a/doc/classes/EditorNode3DGizmo.xml b/doc/classes/EditorNode3DGizmo.xml index 6d695ddeea..45541b9263 100644 --- a/doc/classes/EditorNode3DGizmo.xml +++ b/doc/classes/EditorNode3DGizmo.xml @@ -15,6 +15,7 @@ <argument index="0" name="segments" type="PackedVector3Array"> </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 Node3D this gizmo refers to changes (the [method Node3D.update_gizmo] is called). + This function is called when the [Node3D] this gizmo refers to changes (the [method Node3D.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 [Node3D] node for the gizmo. [code]node[/code] must inherit from [Node3D]. </description> </method> </methods> diff --git a/doc/classes/EditorNode3DGizmoPlugin.xml b/doc/classes/EditorNode3DGizmoPlugin.xml index ca75b47fbf..b81281b5b6 100644 --- a/doc/classes/EditorNode3DGizmoPlugin.xml +++ b/doc/classes/EditorNode3DGizmoPlugin.xml @@ -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"> diff --git a/doc/classes/EditorProperty.xml b/doc/classes/EditorProperty.xml index 4da3b58b94..f568263ff8 100644 --- a/doc/classes/EditorProperty.xml +++ b/doc/classes/EditorProperty.xml @@ -73,24 +73,25 @@ </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="deletable" type="bool" setter="set_deletable" getter="is_deletable" default="false"> + Used by the inspector, set to [code]true[/code] when the property can be deleted by the user. </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=""""> - 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> @@ -134,6 +135,7 @@ <argument index="0" name="property" type="StringName"> </argument> <description> + Emitted when a property was deleted. Used internally. </description> </signal> <signal name="property_keyed"> diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 19921ff5c8..0c6a2d61cd 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -5,11 +5,16 @@ </brief_description> <description> Object that holds the project-independent editor settings. These settings are generally visible in the [b]Editor > 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="PackedStringArray"> </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="PackedStringArray"> </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> diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml index 76153ae041..7e8f0807ac 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -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> diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index 0b0d71fccf..61e0d2e2b9 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -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> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 105def21ca..238bc970ef 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -112,7 +112,18 @@ <return type="PackedStringArray"> </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"> diff --git a/doc/classes/RigidBody3D.xml b/doc/classes/RigidBody3D.xml index efd55f5566..370e6bd19c 100644 --- a/doc/classes/RigidBody3D.xml +++ b/doc/classes/RigidBody3D.xml @@ -100,6 +100,13 @@ [b]Note:[/b] The result of this test is not immediate after moving objects. For performance, list of collisions is updated once per frame and before the physics step. Consider using signals instead. </description> </method> + <method name="get_inverse_inertia_tensor"> + <return type="Basis"> + </return> + <description> + Returns the inverse inertia tensor basis. This is used to calculate the angular acceleration resulting from a torque applied to the [RigidBody3D]. + </description> + </method> <method name="set_axis_lock"> <return type="void"> </return> diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 32895310d1..c97f99cfaa 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -154,7 +154,10 @@ <argument index="0" name="with" type="Vector2"> </argument> <description> - Returns the dot product with vector [code]b[/code]. + Returns the dot product with vector [code]b[/code]. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player. + The dot product will be [code]0[/code] for a straight angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees. + When using unit (normalized) vectors, the result will always be between [code]-1.0[/code] (180 degree angle) when the vectors are facing opposite directions, and [code]1.0[/code] (0 degree angle) when the vectors are aligned. + [b]Note:[/b] [code]a.dot(b)[/code] is equivalent to [code]b.dot(a)[/code]. </description> </method> <method name="floor"> diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 0c861e5ee2..7ba8cb5eed 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -123,7 +123,10 @@ <argument index="0" name="b" type="Vector3"> </argument> <description> - Returns the dot product with [code]b[/code]. + Returns the dot product with vector [code]b[/code]. This can be used to compare the angle between two vectors. For example, this can be used to determine whether an enemy is facing the player. + The dot product will be [code]0[/code] for a straight angle (90 degrees), greater than 0 for angles narrower than 90 degrees and lower than 0 for angles wider than 90 degrees. + When using unit (normalized) vectors, the result will always be between [code]-1.0[/code] (180 degree angle) when the vectors are facing opposite directions, and [code]1.0[/code] (0 degree angle) when the vectors are aligned. + [b]Note:[/b] [code]a.dot(b)[/code] is equivalent to [code]b.dot(a)[/code]. </description> </method> <method name="floor"> diff --git a/doc/classes/VisibilityEnabler2D.xml b/doc/classes/VisibilityEnabler2D.xml index a5abf16a8d..02fe7a7cd0 100644 --- a/doc/classes/VisibilityEnabler2D.xml +++ b/doc/classes/VisibilityEnabler2D.xml @@ -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> diff --git a/doc/classes/VisibilityEnabler3D.xml b/doc/classes/VisibilityEnabler3D.xml index 342a37e7a4..d78ebb55f2 100644 --- a/doc/classes/VisibilityEnabler3D.xml +++ b/doc/classes/VisibilityEnabler3D.xml @@ -5,7 +5,8 @@ </brief_description> <description> The VisibilityEnabler3D will disable [RigidBody3D] and [AnimationPlayer] nodes when they are not visible. It will only affect other nodes within the same scene as the VisibilityEnabler3D itself. - [b]Note:[/b] VisibilityEnabler3D 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 [Area3D] node as a child of a [Camera3D] node. + If you just want to receive notifications, use [VisibilityNotifier3D] instead. + [b]Note:[/b] VisibilityEnabler3D 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 [Area3D] node as a child of a [Camera3D] node and/or [method Vector3.dot]. [b]Note:[/b] VisibilityEnabler3D will not affect nodes added after scene initialization. </description> <tutorials> diff --git a/doc/classes/VisibilityNotifier2D.xml b/doc/classes/VisibilityNotifier2D.xml index 391163ef94..314a100989 100644 --- a/doc/classes/VisibilityNotifier2D.xml +++ b/doc/classes/VisibilityNotifier2D.xml @@ -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> diff --git a/doc/classes/VisibilityNotifier3D.xml b/doc/classes/VisibilityNotifier3D.xml index eb7bb91f26..e5d3116612 100644 --- a/doc/classes/VisibilityNotifier3D.xml +++ b/doc/classes/VisibilityNotifier3D.xml @@ -5,7 +5,8 @@ </brief_description> <description> The VisibilityNotifier3D detects when it is visible on the screen. It also notifies when its bounding rectangle enters or exits the screen or a [Camera3D]'s view. - [b]Note:[/b] VisibilityNotifier3D 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 [Area3D] node as a child of a [Camera3D] node. + If you want nodes to be disabled automatically when they exit the screen, use [VisibilityEnabler3D] instead. + [b]Note:[/b] VisibilityNotifier3D 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 [Area3D] node as a child of a [Camera3D] node and/or [method Vector3.dot]. </description> <tutorials> </tutorials> diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp index f37e21aa93..aa742bd599 100644 --- a/drivers/vulkan/rendering_device_vulkan.cpp +++ b/drivers/vulkan/rendering_device_vulkan.cpp @@ -5068,13 +5068,13 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma input_assembly_create_info.topology = topology_list[p_render_primitive]; input_assembly_create_info.primitiveRestartEnable = (p_render_primitive == RENDER_PRIMITIVE_TRIANGLE_STRIPS_WITH_RESTART_INDEX); - //tesselation - VkPipelineTessellationStateCreateInfo tesselation_create_info; - tesselation_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO; - tesselation_create_info.pNext = nullptr; - tesselation_create_info.flags = 0; + //tessellation + VkPipelineTessellationStateCreateInfo tessellation_create_info; + tessellation_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO; + tessellation_create_info.pNext = nullptr; + tessellation_create_info.flags = 0; ERR_FAIL_COND_V(p_rasterization_state.patch_control_points < 1 || p_rasterization_state.patch_control_points > limits.maxTessellationPatchSize, RID()); - tesselation_create_info.patchControlPoints = p_rasterization_state.patch_control_points; + tessellation_create_info.patchControlPoints = p_rasterization_state.patch_control_points; VkPipelineViewportStateCreateInfo viewport_state_create_info; viewport_state_create_info.sType = VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO; @@ -5286,7 +5286,7 @@ RID RenderingDeviceVulkan::render_pipeline_create(RID p_shader, FramebufferForma graphics_pipeline_create_info.pStages = shader->pipeline_stages.ptr(); graphics_pipeline_create_info.pVertexInputState = &pipeline_vertex_input_state_create_info; graphics_pipeline_create_info.pInputAssemblyState = &input_assembly_create_info; - graphics_pipeline_create_info.pTessellationState = &tesselation_create_info; + graphics_pipeline_create_info.pTessellationState = &tessellation_create_info; graphics_pipeline_create_info.pViewportState = &viewport_state_create_info; graphics_pipeline_create_info.pRasterizationState = &rasterization_state_create_info; graphics_pipeline_create_info.pMultisampleState = &multisample_state_create_info; diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index c3f0d1b712..2d50d25ff5 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2980,7 +2980,16 @@ Variant EditorPropertyResource::get_drag_data_fw(const Point2 &p_point, Control } bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const { - String allowed_type = base_type; + Vector<String> allowed_types = base_type.split(","); + int size = allowed_types.size(); + for (int i = 0; i < size; i++) { + String at = allowed_types[i].strip_edges(); + if (at == "StandardMaterial3D") { + allowed_types.append("Texture2D"); + } else if (at == "ShaderMaterial") { + allowed_types.append("Shader"); + } + } Dictionary drag_data = p_drag_data; @@ -2993,9 +3002,9 @@ bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const } if (res.is_valid()) { - for (int i = 0; i < allowed_type.get_slice_count(","); i++) { - String at = allowed_type.get_slice(",", i).strip_edges(); - if (res.is_valid() && ClassDB::is_parent_class(res->get_class(), at)) { + for (int i = 0; i < allowed_types.size(); i++) { + String at = allowed_types[i].strip_edges(); + if (ClassDB::is_parent_class(res->get_class(), at)) { return true; } } @@ -3009,8 +3018,8 @@ bool EditorPropertyResource::_is_drop_valid(const Dictionary &p_drag_data) const String ftype = EditorFileSystem::get_singleton()->get_file_type(file); if (ftype != "") { - for (int i = 0; i < allowed_type.get_slice_count(","); i++) { - String at = allowed_type.get_slice(",", i).strip_edges(); + for (int i = 0; i < allowed_types.size(); i++) { + String at = allowed_types[i].strip_edges(); if (ClassDB::is_parent_class(ftype, at)) { return true; } @@ -3039,24 +3048,49 @@ void EditorPropertyResource::drop_data_fw(const Point2 &p_point, const Variant & res = drag_data["resource"]; } - if (res.is_valid()) { - emit_changed(get_edited_property(), res); - update_property(); - return; - } - - if (drag_data.has("type") && String(drag_data["type"]) == "files") { + if (!res.is_valid() && drag_data.has("type") && String(drag_data["type"]) == "files") { Vector<String> files = drag_data["files"]; if (files.size() == 1) { String file = files[0]; - RES file_res = ResourceLoader::load(file); - if (file_res.is_valid()) { - emit_changed(get_edited_property(), file_res); - update_property(); - return; + res = ResourceLoader::load(file); + } + } + + if (res.is_valid()) { + bool need_convert = true; + + Vector<String> allowed_types = base_type.split(","); + for (int i = 0; i < allowed_types.size(); i++) { + String at = allowed_types[i].strip_edges(); + if (ClassDB::is_parent_class(res->get_class(), at)) { + need_convert = false; + break; + } + } + + if (need_convert) { + for (int i = 0; i < allowed_types.size(); i++) { + String at = allowed_types[i].strip_edges(); + if (at == "StandardMaterial3D" && ClassDB::is_parent_class(res->get_class(), "Texture2D")) { + Ref<StandardMaterial3D> mat = memnew(StandardMaterial3D); + mat->set_texture(StandardMaterial3D::TextureParam::TEXTURE_ALBEDO, res); + res = mat; + break; + } + + if (at == "ShaderMaterial" && ClassDB::is_parent_class(res->get_class(), "Shader")) { + Ref<ShaderMaterial> mat = memnew(ShaderMaterial); + mat->set_shader(res); + res = mat; + break; + } } } + + emit_changed(get_edited_property(), res); + update_property(); + return; } } diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 683db0e31d..bb144d2ed6 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -1229,10 +1229,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]; } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 44913abe8b..3c6556a310 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -2045,10 +2045,10 @@ 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]); } } @@ -2073,7 +2073,6 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) { } drag_from = transform.affine_inverse().xform(b->get_position()); - drag_selection = selection; _save_canvas_item_state(drag_selection); } return true; @@ -2395,16 +2394,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); } diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index b121a7ae3e..7fb751e3ed 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -1977,7 +1977,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) { PackedVector2Array segments; for (int i = 0; i < points.size() - 1; i++) { segments.push_back(points[i]); @@ -2669,7 +2669,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); } @@ -2706,13 +2706,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); - } - workspace->draw_line(polygon[polygon.size() - 1], polygon[0], c_border, 1); + 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); } + workspace->draw_line(polygon[polygon.size() - 1], polygon[0], c_border, 1); } if (shape == edited_occlusion_shape) { draw_handles = true; @@ -2756,7 +2754,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); } @@ -2796,7 +2794,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); } @@ -2845,7 +2843,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); } @@ -2863,7 +2861,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); } diff --git a/misc/travis/android-tools-linux.sh b/misc/ci/android-tools-linux.sh index 6114551861..6114551861 100755 --- a/misc/travis/android-tools-linux.sh +++ b/misc/ci/android-tools-linux.sh diff --git a/misc/ci/sources.list b/misc/ci/sources.list new file mode 100644 index 0000000000..4d8f94f35c --- /dev/null +++ b/misc/ci/sources.list @@ -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 diff --git a/misc/travis/ccache-osx.sh b/misc/travis/ccache-osx.sh deleted file mode 100755 index 5ce7a80cbc..0000000000 --- a/misc/travis/ccache-osx.sh +++ /dev/null @@ -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 diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index 70e137b16d..9dc307c629 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -158,10 +158,6 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf btVector3 bt_motion; G_TO_B(p_motion, bt_motion); - if (bt_motion.fuzzyZero()) { - return false; - } - ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->getornull(p_shape); ERR_FAIL_COND_V(!shape, false); @@ -180,6 +176,10 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf btTransform bt_xform_to(bt_xform_from); bt_xform_to.getOrigin() += bt_motion; + if ((bt_xform_to.getOrigin() - bt_xform_from.getOrigin()).fuzzyZero()) { + return false; + } + GodotClosestConvexResultCallback btResult(bt_xform_from.getOrigin(), bt_xform_to.getOrigin(), &p_exclude, p_collide_with_bodies, p_collide_with_areas); btResult.m_collisionFilterGroup = 0; btResult.m_collisionFilterMask = p_collision_mask; @@ -982,7 +982,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f motionVec->end(); #endif - for (int shIndex = 0; shIndex < shape_count && !motion.fuzzyZero(); ++shIndex) { + for (int shIndex = 0; shIndex < shape_count; ++shIndex) { if (p_body->is_shape_disabled(shIndex)) { continue; } @@ -1004,6 +1004,11 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f btTransform shape_world_to(shape_world_from); shape_world_to.getOrigin() += motion; + if ((shape_world_to.getOrigin() - shape_world_from.getOrigin()).fuzzyZero()) { + motion = btVector3(0, 0, 0); + break; + } + GodotKinClosestConvexResultCallback btResult(shape_world_from.getOrigin(), shape_world_to.getOrigin(), p_body, p_infinite_inertia); btResult.m_collisionFilterGroup = p_body->get_collision_layer(); btResult.m_collisionFilterMask = p_body->get_collision_mask(); diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 71d05bd732..ed85256695 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -43,6 +43,7 @@ #include "editor/editor_log.h" #include "editor/editor_node.h" #include "editor/editor_settings.h" +#include "platform/android/export/gradle_export_util.h" #include "platform/android/logo.gen.h" #include "platform/android/plugin/godot_plugin_config.h" #include "platform/android/run_icon.gen.h" @@ -2003,9 +2004,10 @@ public: EditorProgress ep("export", "Exporting for Android", 105, true); - if (bool(p_preset->get("custom_template/use_custom_build"))) { //custom build - //re-generate build.gradle and AndroidManifest.xml + bool use_custom_build = bool(p_preset->get("custom_template/use_custom_build")); + if (use_custom_build) { + //re-generate build.gradle and AndroidManifest.xml { //test that installed build version is alright FileAccessRef f = FileAccess::open("res://android/.build_version", FileAccess::READ); if (!f) { @@ -2018,6 +2020,14 @@ public: return ERR_UNCONFIGURED; } } + + // TODO: should we use "package/name" or "application/config/name"? + String project_name = get_project_name(p_preset->get("package/name")); + // instead of calling _fix_resources + Error err = _create_project_name_strings_files(p_preset, project_name); + if (err != OK) { + EditorNode::add_io_error("Unable to overwrite res://android/build/res/*.xml files with project name"); + } //build project if custom build is enabled String sdk_path = EDITOR_GET("export/android/custom_build_sdk_path"); @@ -2202,7 +2212,9 @@ public: } if (file == "resources.arsc") { - _fix_resources(p_preset, data); + if (!use_custom_build) { + _fix_resources(p_preset, data); + } } for (int i = 0; i < icon_densities_count; ++i) { diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index f988047483..622860c307 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -37,6 +37,13 @@ #include "core/os/os.h" #include "editor/editor_export.h" +const String godot_project_name_xml_string = R"(<?xml version="1.0" encoding="utf-8"?> +<!--WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> +<resources> + <string name="godot_project_name_string">%s</string> +</resources> +)"; + // Utility method used to create a directory. Error create_directory(const String &p_dir) { if (!DirAccess::exists(p_dir)) { @@ -94,8 +101,45 @@ Error store_string_at_path(const String &p_path, const String &p_data) { // This method will be called ONLY when custom build is enabled. Error rename_and_store_file_in_gradle_project(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) { String dst_path = p_path.replace_first("res://", "res://android/build/assets/"); - Error err = store_file_at_path(dst_path, p_data, Z_NO_COMPRESSION); + Error err = store_file_at_path(dst_path, p_data); return err; } +// Creates strings.xml files inside the gradle project for different locales. +Error _create_project_name_strings_files(const Ref<EditorExportPreset> &p_preset, const String &project_name) { + // Stores the string into the default values directory. + String processed_default_xml_string = vformat(godot_project_name_xml_string, project_name.xml_escape(true)); + store_string_at_path("res://android/build/res/values/godot_project_name_string.xml", processed_default_xml_string); + + // Searches the Gradle project res/ directory to find all supported locales + DirAccessRef da = DirAccess::open("res://android/build/res"); + if (!da) { + return ERR_CANT_OPEN; + } + da->list_dir_begin(); + while (true) { + String file = da->get_next(); + if (file == "") { + break; + } + if (!file.begins_with("values-")) { + // NOTE: This assumes all directories that start with "values-" are for localization. + continue; + } + String locale = file.replace("values-", "").replace("-r", "_"); + String property_name = "application/config/name_" + locale; + String locale_directory = "res://android/build/res/" + file + "/godot_project_name_string.xml"; + if (ProjectSettings::get_singleton()->has_setting(property_name)) { + String locale_project_name = ProjectSettings::get_singleton()->get(property_name); + String processed_xml_string = vformat(godot_project_name_xml_string, locale_project_name.xml_escape(true)); + store_string_at_path(locale_directory, processed_xml_string); + } else { + // TODO: Once the legacy build system is deprecated we don't need to have xml files for this else branch + store_string_at_path(locale_directory, processed_default_xml_string); + } + } + da->list_dir_end(); + return OK; +} + #endif //GODOT_GRADLE_EXPORT_UTIL_H diff --git a/platform/android/java/lib/res/values-ar/strings.xml b/platform/android/java/app/res/values-ar/godot_project_name_string.xml index 77cd61ea51..23aa5cf3e1 100644 --- a/platform/android/java/lib/res/values-ar/strings.xml +++ b/platform/android/java/app/res/values-ar/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-ar</string> </resources> diff --git a/platform/android/java/lib/res/values-bg/strings.xml b/platform/android/java/app/res/values-bg/godot_project_name_string.xml index 0f42d1f22b..dbb7e04ae5 100644 --- a/platform/android/java/lib/res/values-bg/strings.xml +++ b/platform/android/java/app/res/values-bg/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-bg</string> </resources> diff --git a/platform/android/java/lib/res/values-ca/strings.xml b/platform/android/java/app/res/values-ca/godot_project_name_string.xml index 291a44d5e2..709d0961e6 100644 --- a/platform/android/java/lib/res/values-ca/strings.xml +++ b/platform/android/java/app/res/values-ca/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-ca</string> </resources> diff --git a/platform/android/java/lib/res/values-cs/strings.xml b/platform/android/java/app/res/values-cs/godot_project_name_string.xml index 83ff73e12a..ab248a8032 100644 --- a/platform/android/java/lib/res/values-cs/strings.xml +++ b/platform/android/java/app/res/values-cs/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-cs</string> </resources> diff --git a/platform/android/java/lib/res/values-da/strings.xml b/platform/android/java/app/res/values-da/godot_project_name_string.xml index fd251a7c90..906bf44f57 100644 --- a/platform/android/java/lib/res/values-da/strings.xml +++ b/platform/android/java/app/res/values-da/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-da</string> </resources> diff --git a/platform/android/java/lib/res/values-de/strings.xml b/platform/android/java/app/res/values-de/godot_project_name_string.xml index f6e80b0b1a..0cacb0175f 100644 --- a/platform/android/java/lib/res/values-de/strings.xml +++ b/platform/android/java/app/res/values-de/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-de</string> </resources> diff --git a/platform/android/java/lib/res/values-el/strings.xml b/platform/android/java/app/res/values-el/godot_project_name_string.xml index adcdf13eb1..047de616a5 100644 --- a/platform/android/java/lib/res/values-el/strings.xml +++ b/platform/android/java/app/res/values-el/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-el</string> </resources> diff --git a/platform/android/java/lib/res/values-en/strings.xml b/platform/android/java/app/res/values-en/godot_project_name_string.xml index 1b251c9ab6..bb3a5dbef3 100644 --- a/platform/android/java/lib/res/values-en/strings.xml +++ b/platform/android/java/app/res/values-en/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-en</string> </resources> diff --git a/platform/android/java/lib/res/values-es-rES/strings.xml b/platform/android/java/app/res/values-es-rES/godot_project_name_string.xml index b580a8270b..d4537f3496 100644 --- a/platform/android/java/lib/res/values-es-rES/strings.xml +++ b/platform/android/java/app/res/values-es-rES/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-es_ES</string> </resources> diff --git a/platform/android/java/lib/res/values-es/strings.xml b/platform/android/java/app/res/values-es/godot_project_name_string.xml index 6aedd6870b..d63a16022e 100644 --- a/platform/android/java/lib/res/values-es/strings.xml +++ b/platform/android/java/app/res/values-es/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-es</string> </resources> diff --git a/platform/android/java/app/res/values-fa/godot_project_name_string.xml b/platform/android/java/app/res/values-fa/godot_project_name_string.xml new file mode 100644 index 0000000000..c303f13d5f --- /dev/null +++ b/platform/android/java/app/res/values-fa/godot_project_name_string.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> +<resources> + <string name="godot_project_name_string">godot-project-name-fa</string> +</resources> diff --git a/platform/android/java/lib/res/values-fi/strings.xml b/platform/android/java/app/res/values-fi/godot_project_name_string.xml index bd7ef059ab..bd6005574a 100644 --- a/platform/android/java/lib/res/values-fi/strings.xml +++ b/platform/android/java/app/res/values-fi/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-fi</string> </resources> diff --git a/platform/android/java/lib/res/values-fr/strings.xml b/platform/android/java/app/res/values-fr/godot_project_name_string.xml index 03994099cf..2e94b65a20 100644 --- a/platform/android/java/lib/res/values-fr/strings.xml +++ b/platform/android/java/app/res/values-fr/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-fr</string> </resources> diff --git a/platform/android/java/lib/res/values-hi/strings.xml b/platform/android/java/app/res/values-hi/godot_project_name_string.xml index 60d3b46861..0bf75dcd56 100644 --- a/platform/android/java/lib/res/values-hi/strings.xml +++ b/platform/android/java/app/res/values-hi/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-hi</string> </resources> diff --git a/platform/android/java/lib/res/values-hr/strings.xml b/platform/android/java/app/res/values-hr/godot_project_name_string.xml index e552a6f6ec..d3f75910f9 100644 --- a/platform/android/java/lib/res/values-hr/strings.xml +++ b/platform/android/java/app/res/values-hr/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-hr</string> </resources> diff --git a/platform/android/java/lib/res/values-hu/strings.xml b/platform/android/java/app/res/values-hu/godot_project_name_string.xml index ed21411acb..012b613af3 100644 --- a/platform/android/java/lib/res/values-hu/strings.xml +++ b/platform/android/java/app/res/values-hu/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-hu</string> </resources> diff --git a/platform/android/java/app/res/values-in/godot_project_name_string.xml b/platform/android/java/app/res/values-in/godot_project_name_string.xml new file mode 100644 index 0000000000..eedecff7a1 --- /dev/null +++ b/platform/android/java/app/res/values-in/godot_project_name_string.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> +<resources> + <string name="godot_project_name_string">godot-project-name-in</string> +</resources> diff --git a/platform/android/java/lib/res/values-it/strings.xml b/platform/android/java/app/res/values-it/godot_project_name_string.xml index 880b87e030..7e734047c4 100644 --- a/platform/android/java/lib/res/values-it/strings.xml +++ b/platform/android/java/app/res/values-it/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-it</string> </resources> diff --git a/platform/android/java/app/res/values-iw/godot_project_name_string.xml b/platform/android/java/app/res/values-iw/godot_project_name_string.xml new file mode 100644 index 0000000000..03893f0cbb --- /dev/null +++ b/platform/android/java/app/res/values-iw/godot_project_name_string.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> +<resources> + <string name="godot_project_name_string">godot-project-name-iw</string> +</resources> diff --git a/platform/android/java/lib/res/values-ja/strings.xml b/platform/android/java/app/res/values-ja/godot_project_name_string.xml index 27d3ba521e..f9dd4fab0d 100644 --- a/platform/android/java/lib/res/values-ja/strings.xml +++ b/platform/android/java/app/res/values-ja/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-ja</string> </resources> diff --git a/platform/android/java/app/res/values-ko/godot_project_name_string.xml b/platform/android/java/app/res/values-ko/godot_project_name_string.xml new file mode 100644 index 0000000000..26f5dac176 --- /dev/null +++ b/platform/android/java/app/res/values-ko/godot_project_name_string.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> +<resources> + <string name="godot_project_name_string">godot-project-name-ko</string> +</resources> diff --git a/platform/android/java/lib/res/values-lt/strings.xml b/platform/android/java/app/res/values-lt/godot_project_name_string.xml index 10a93926db..1c2e976cc5 100644 --- a/platform/android/java/lib/res/values-lt/strings.xml +++ b/platform/android/java/app/res/values-lt/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-lt</string> </resources> diff --git a/platform/android/java/lib/res/values-lv/strings.xml b/platform/android/java/app/res/values-lv/godot_project_name_string.xml index 4f230b97f8..b5e638ed73 100644 --- a/platform/android/java/lib/res/values-lv/strings.xml +++ b/platform/android/java/app/res/values-lv/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-lv</string> </resources> diff --git a/platform/android/java/lib/res/values-nb/strings.xml b/platform/android/java/app/res/values-nb/godot_project_name_string.xml index a85a3da39a..e6d89d6a3f 100644 --- a/platform/android/java/lib/res/values-nb/strings.xml +++ b/platform/android/java/app/res/values-nb/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-nb</string> </resources> diff --git a/platform/android/java/lib/res/values-nl/strings.xml b/platform/android/java/app/res/values-nl/godot_project_name_string.xml index c459f64397..93cb3a3878 100644 --- a/platform/android/java/lib/res/values-nl/strings.xml +++ b/platform/android/java/app/res/values-nl/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-nl</string> </resources> diff --git a/platform/android/java/lib/res/values-pl/strings.xml b/platform/android/java/app/res/values-pl/godot_project_name_string.xml index 34a846cc78..e5d6ac74fb 100644 --- a/platform/android/java/lib/res/values-pl/strings.xml +++ b/platform/android/java/app/res/values-pl/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-pl</string> </resources> diff --git a/platform/android/java/lib/res/values-pt/strings.xml b/platform/android/java/app/res/values-pt/godot_project_name_string.xml index 5f7a875eb5..a4624655c5 100644 --- a/platform/android/java/lib/res/values-pt/strings.xml +++ b/platform/android/java/app/res/values-pt/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-pt</string> </resources> diff --git a/platform/android/java/lib/res/values-ro/strings.xml b/platform/android/java/app/res/values-ro/godot_project_name_string.xml index de990e789b..19e026637e 100644 --- a/platform/android/java/lib/res/values-ro/strings.xml +++ b/platform/android/java/app/res/values-ro/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-ro</string> </resources> diff --git a/platform/android/java/lib/res/values-ru/strings.xml b/platform/android/java/app/res/values-ru/godot_project_name_string.xml index 73d8a27443..284845241f 100644 --- a/platform/android/java/lib/res/values-ru/strings.xml +++ b/platform/android/java/app/res/values-ru/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-ru</string> </resources> diff --git a/platform/android/java/lib/res/values-sk/strings.xml b/platform/android/java/app/res/values-sk/godot_project_name_string.xml index 053960efed..f8ab4a5b59 100644 --- a/platform/android/java/lib/res/values-sk/strings.xml +++ b/platform/android/java/app/res/values-sk/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-sk</string> </resources> diff --git a/platform/android/java/lib/res/values-sl/strings.xml b/platform/android/java/app/res/values-sl/godot_project_name_string.xml index d6dff8289a..98bd53e8d2 100644 --- a/platform/android/java/lib/res/values-sl/strings.xml +++ b/platform/android/java/app/res/values-sl/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-sl</string> </resources> diff --git a/platform/android/java/lib/res/values-sr/strings.xml b/platform/android/java/app/res/values-sr/godot_project_name_string.xml index b7e79e89ea..3f400f2a4d 100644 --- a/platform/android/java/lib/res/values-sr/strings.xml +++ b/platform/android/java/app/res/values-sr/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-sr</string> </resources> diff --git a/platform/android/java/lib/res/values-sv/strings.xml b/platform/android/java/app/res/values-sv/godot_project_name_string.xml index 9436c3870a..8670b7c9aa 100644 --- a/platform/android/java/lib/res/values-sv/strings.xml +++ b/platform/android/java/app/res/values-sv/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-sv</string> </resources> diff --git a/platform/android/java/lib/res/values-th/strings.xml b/platform/android/java/app/res/values-th/godot_project_name_string.xml index 629d77b9c2..a1cc1bcd49 100644 --- a/platform/android/java/lib/res/values-th/strings.xml +++ b/platform/android/java/app/res/values-th/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-th</string> </resources> diff --git a/platform/android/java/lib/res/values-tl/strings.xml b/platform/android/java/app/res/values-tl/godot_project_name_string.xml index f8832d6b1f..6d66d114cf 100644 --- a/platform/android/java/lib/res/values-tl/strings.xml +++ b/platform/android/java/app/res/values-tl/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-tl</string> </resources> diff --git a/platform/android/java/lib/res/values-tr/strings.xml b/platform/android/java/app/res/values-tr/godot_project_name_string.xml index f3a8f57de4..ba3bd7de36 100644 --- a/platform/android/java/lib/res/values-tr/strings.xml +++ b/platform/android/java/app/res/values-tr/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-tr</string> </resources> diff --git a/platform/android/java/lib/res/values-uk/strings.xml b/platform/android/java/app/res/values-uk/godot_project_name_string.xml index 8ba2bf86aa..5f14ab25a0 100644 --- a/platform/android/java/lib/res/values-uk/strings.xml +++ b/platform/android/java/app/res/values-uk/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-uk</string> </resources> diff --git a/platform/android/java/lib/res/values-vi/strings.xml b/platform/android/java/app/res/values-vi/godot_project_name_string.xml index 8bf063ed82..295378e111 100644 --- a/platform/android/java/lib/res/values-vi/strings.xml +++ b/platform/android/java/app/res/values-vi/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-vi</string> </resources> diff --git a/platform/android/java/lib/res/values-zh-rHK/strings.xml b/platform/android/java/app/res/values-zh-rHK/godot_project_name_string.xml index 8a6269da0f..40ab0f285a 100644 --- a/platform/android/java/lib/res/values-zh-rHK/strings.xml +++ b/platform/android/java/app/res/values-zh-rHK/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-zh_HK</string> </resources> diff --git a/platform/android/java/lib/res/values-zh-rTW/strings.xml b/platform/android/java/app/res/values-zh-rTW/godot_project_name_string.xml index b1bb39d5d6..095bd564e2 100644 --- a/platform/android/java/lib/res/values-zh-rTW/strings.xml +++ b/platform/android/java/app/res/values-zh-rTW/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-zh_TW</string> </resources> diff --git a/platform/android/java/lib/res/values-zh-rCN/strings.xml b/platform/android/java/app/res/values-zh/godot_project_name_string.xml index 6668c56bd9..31aa8c273a 100644 --- a/platform/android/java/lib/res/values-zh-rCN/strings.xml +++ b/platform/android/java/app/res/values-zh/godot_project_name_string.xml @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> <resources> <string name="godot_project_name_string">godot-project-name-zh</string> </resources> diff --git a/platform/android/java/app/res/values/godot_project_name_string.xml b/platform/android/java/app/res/values/godot_project_name_string.xml new file mode 100644 index 0000000000..7ec2738896 --- /dev/null +++ b/platform/android/java/app/res/values/godot_project_name_string.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- WARNING: THIS FILE WILL BE OVERWRITTEN AT BUILD TIME--> +<resources> + <string name="godot_project_name_string">godot-project-name</string> +</resources> diff --git a/platform/android/java/lib/res/values-fa/strings.xml b/platform/android/java/lib/res/values-fa/strings.xml index f1e29013c4..60b01accf1 100644 --- a/platform/android/java/lib/res/values-fa/strings.xml +++ b/platform/android/java/lib/res/values-fa/strings.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="godot_project_name_string">godot-project-name-fa</string> <string name="text_paused_cellular">آیا می خواهید بر روی اتصال داده همراه دانلود را شروع کنید؟ بر اساس نوع سطح داده شما این ممکن است برای شما هزینه مالی داشته باشد.</string> <string name="text_paused_cellular_2">اگر نمی خواهید بر روی اتصال داده همراه دانلود را شروع کنید ، دانلود به صورت خودکار در زمان دسترسی به وای-فای شروع می شود.</string> <string name="text_button_resume_cellular">ادامه دانلود</string> diff --git a/platform/android/java/lib/res/values-in/strings.xml b/platform/android/java/lib/res/values-in/strings.xml deleted file mode 100644 index 169b65decb..0000000000 --- a/platform/android/java/lib/res/values-in/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="godot_project_name_string">godot-project-name-id</string> -</resources> diff --git a/platform/android/java/lib/res/values-iw/strings.xml b/platform/android/java/lib/res/values-iw/strings.xml deleted file mode 100644 index b4826798c7..0000000000 --- a/platform/android/java/lib/res/values-iw/strings.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="godot_project_name_string">godot-project-name-he</string> -</resources> diff --git a/platform/android/java/lib/res/values-ko/strings.xml b/platform/android/java/lib/res/values-ko/strings.xml index efc5c7e015..7b62345977 100644 --- a/platform/android/java/lib/res/values-ko/strings.xml +++ b/platform/android/java/lib/res/values-ko/strings.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="godot_project_name_string">godot-project-name-ko</string> <string name="text_paused_cellular">모바일 네트워크를 사용하여 다운로드 하시겠습니까? 남은 데이터 사용량에 따라, 요금이 부과될 수 있습니다.</string> <string name="text_paused_cellular_2">모바일 네트워크를 사용하여 다운로드 하지 않을 경우, 와이파이 연결이 가능할 때 자동적으로 다운로드가 이루어집니다.</string> <string name="text_button_resume_cellular">다운로드 계속하기</string> diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index 1b55090451..1ae400abb5 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -467,6 +467,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC final Activity activity = getActivity(); Window window = activity.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); + window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING); mClipboard = (ClipboardManager)activity.getSystemService(Context.CLIPBOARD_SERVICE); pluginRegistry = GodotPluginRegistry.initializePluginRegistry(this); diff --git a/platform/osx/detect.py b/platform/osx/detect.py index ff4c024551..ca28e1e70e 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -24,7 +24,7 @@ def get_opts(): from SCons.Variables import BoolVariable, EnumVariable return [ - ("osxcross_sdk", "OSXCross SDK version", "darwin14"), + ("osxcross_sdk", "OSXCross SDK version", "darwin16"), ("MACOS_SDK_PATH", "Path to the macOS SDK", ""), BoolVariable( "use_static_mvk", @@ -86,16 +86,16 @@ def configure(env): if "OSXCROSS_ROOT" in os.environ: env["osxcross"] = True - if not "osxcross" in env: # regular native build - if env["arch"] == "arm64": - print("Building for macOS 10.15+, platform arm64.") - env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15", "-target", "arm64-apple-macos10.15"]) - env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15", "-target", "arm64-apple-macos10.15"]) - else: - print("Building for macOS 10.12+, platform x86-64.") - env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) - env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) + if env["arch"] == "arm64": + print("Building for macOS 10.15+, platform arm64.") + env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15", "-target", "arm64-apple-macos10.15"]) + env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15", "-target", "arm64-apple-macos10.15"]) + else: + print("Building for macOS 10.12+, platform x86-64.") + env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) + env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"]) + if not "osxcross" in env: # regular native build if env["macports_clang"] != "no": mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local") mpclangver = env["macports_clang"] @@ -116,7 +116,10 @@ def configure(env): else: # osxcross build root = os.environ.get("OSXCROSS_ROOT", 0) - basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-" + if env["arch"] == "arm64": + basecmd = root + "/target/bin/arm64-apple-" + env["osxcross_sdk"] + "-" + else: + basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-" ccache_path = os.environ.get("CCACHE") if ccache_path is None: diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index 5cc2b25910..baecb260b5 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -3492,9 +3492,7 @@ DisplayServerOSX::WindowID DisplayServerOSX::_create_window(WindowMode p_mode, c wd.window_view = [[GodotContentView alloc] init]; ERR_FAIL_COND_V_MSG(wd.window_view == nil, INVALID_WINDOW_ID, "Can't create a window view"); [wd.window_view setWindowID:window_id_counter]; - if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_14) { - [wd.window_view setWantsLayer:TRUE]; - } + [wd.window_view setWantsLayer:TRUE]; [wd.window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; [wd.window_object setContentView:wd.window_view]; diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 0251ffe664..6ee9b6d698 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -170,7 +170,7 @@ void DisplayServerWindows::clipboard_set(const String &p_text) { // Convert LF line endings to CRLF in clipboard content // Otherwise, line endings won't be visible when pasted in other software - String text = p_text.replace("\n", "\r\n"); + String text = p_text.replace("\r\n", "\n").replace("\n", "\r\n"); // avoid \r\r\n if (!OpenClipboard(windows[last_focused_window].hWnd)) { ERR_FAIL_MSG("Unable to open clipboard."); diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 72ae75b236..fc021e5532 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -358,6 +358,7 @@ void RigidBody3D::_direct_state_changed(Object *p_state) { set_global_transform(state->get_transform()); linear_velocity = state->get_linear_velocity(); angular_velocity = state->get_angular_velocity(); + inverse_inertia_tensor = state->get_inverse_inertia_tensor(); if (sleeping != state->is_sleeping()) { sleeping = state->is_sleeping(); emit_signal(SceneStringNames::get_singleton()->sleeping_state_changed); @@ -594,6 +595,10 @@ Vector3 RigidBody3D::get_angular_velocity() const { return angular_velocity; } +Basis RigidBody3D::get_inverse_inertia_tensor() { + return inverse_inertia_tensor; +} + void RigidBody3D::set_use_custom_integrator(bool p_enable) { if (custom_integrator == p_enable) { return; @@ -760,6 +765,8 @@ void RigidBody3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_angular_velocity", "angular_velocity"), &RigidBody3D::set_angular_velocity); ClassDB::bind_method(D_METHOD("get_angular_velocity"), &RigidBody3D::get_angular_velocity); + ClassDB::bind_method(D_METHOD("get_inverse_inertia_tensor"), &RigidBody3D::get_inverse_inertia_tensor); + ClassDB::bind_method(D_METHOD("set_gravity_scale", "gravity_scale"), &RigidBody3D::set_gravity_scale); ClassDB::bind_method(D_METHOD("get_gravity_scale"), &RigidBody3D::get_gravity_scale); diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h index 413b587fc4..9830a55183 100644 --- a/scene/3d/physics_body_3d.h +++ b/scene/3d/physics_body_3d.h @@ -123,6 +123,7 @@ protected: Vector3 linear_velocity; Vector3 angular_velocity; + Basis inverse_inertia_tensor; real_t gravity_scale; real_t linear_damp; real_t angular_damp; @@ -201,6 +202,8 @@ public: void set_angular_velocity(const Vector3 &p_velocity); Vector3 get_angular_velocity() const override; + Basis get_inverse_inertia_tensor(); + void set_gravity_scale(real_t p_gravity_scale); real_t get_gravity_scale() const; diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 854db5fee2..bd4396d680 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -701,21 +701,21 @@ 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()) { // 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 == nullptr) { @@ -802,17 +802,15 @@ void Tween::_tween_process(float p_delta) { // If we are not repeating the tween, remove it if (!repeat) { call_deferred("_remove_by_uid", data.uid); + any_unfinished--; } - } else if (!repeat) { - // Check whether all tweens are finished - all_finished = all_finished && data.finish; } } // 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"); } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 47761d724e..eeb7f9430d 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3419,6 +3419,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++) { if (p_at->get_text(i).findn(p_find) == 0 && (!p_selectable || p_at->is_selectable(i))) { @@ -3438,6 +3440,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 nullptr; diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp index 3d99556a10..99f87dd6ed 100644 --- a/scene/resources/dynamic_font.cpp +++ b/scene/resources/dynamic_font.cpp @@ -290,6 +290,21 @@ Size2 DynamicFontAtSize::get_char_size(CharType p_char, CharType p_next, const V return ret; } +String DynamicFontAtSize::get_available_chars() const { + String chars; + + FT_UInt gindex; + FT_ULong charcode = FT_Get_First_Char(face, &gindex); + while (gindex != 0) { + if (charcode != 0) { + chars += CharType(charcode); + } + charcode = FT_Get_Next_Char(face, charcode, &gindex); + } + + return chars; +} + float DynamicFontAtSize::draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks, bool p_advance_only, bool p_outline) const { if (!valid) { return 0; @@ -849,6 +864,25 @@ Size2 DynamicFont::get_char_size(CharType p_char, CharType p_next) const { return ret; } +String DynamicFont::get_available_chars() const { + if (!data_at_size.is_valid()) { + return ""; + } + + String chars = data_at_size->get_available_chars(); + + for (int i = 0; i < fallback_data_at_size.size(); i++) { + String fallback_chars = fallback_data_at_size[i]->get_available_chars(); + for (int j = 0; j < fallback_chars.length(); j++) { + if (chars.find_char(fallback_chars[j]) == -1) { + chars += fallback_chars[j]; + } + } + } + + return chars; +} + bool DynamicFont::is_distance_field_hint() const { return false; } @@ -964,6 +998,8 @@ void DynamicFont::_bind_methods() { ClassDB::bind_method(D_METHOD("set_font_data", "data"), &DynamicFont::set_font_data); ClassDB::bind_method(D_METHOD("get_font_data"), &DynamicFont::get_font_data); + ClassDB::bind_method(D_METHOD("get_available_chars"), &DynamicFont::get_available_chars); + ClassDB::bind_method(D_METHOD("set_size", "data"), &DynamicFont::set_size); ClassDB::bind_method(D_METHOD("get_size"), &DynamicFont::get_size); diff --git a/scene/resources/dynamic_font.h b/scene/resources/dynamic_font.h index 0afad428b3..e8637e7e34 100644 --- a/scene/resources/dynamic_font.h +++ b/scene/resources/dynamic_font.h @@ -189,6 +189,7 @@ public: float get_underline_thickness() const; Size2 get_char_size(CharType p_char, CharType p_next, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks) const; + String get_available_chars() const; float draw_char(RID p_canvas_item, const Point2 &p_pos, CharType p_char, CharType p_next, const Color &p_modulate, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks, bool p_advance_only = false, bool p_outline = false) const; @@ -277,6 +278,7 @@ public: virtual float get_underline_thickness() const override; virtual Size2 get_char_size(CharType p_char, CharType p_next = 0) const override; + String get_available_chars() const; virtual bool is_distance_field_hint() const override; diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp index 4ebed78996..495513d019 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.cpp @@ -238,7 +238,7 @@ void RasterizerSceneRD::_sdfgi_erase(RenderBuffers *rb) { const Vector3i RasterizerSceneRD::SDFGI::Cascade::DIRTY_ALL = Vector3i(0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF); void RasterizerSceneRD::sdfgi_update(RID p_render_buffers, RID p_environment, const Vector3 &p_world_position) { - Environent *env = environment_owner.getornull(p_environment); + Environment *env = environment_owner.getornull(p_environment); RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers); bool needs_sdfgi = env && env->sdfgi_enabled; @@ -1142,7 +1142,7 @@ void RasterizerSceneRD::sdfgi_update_probes(RID p_render_buffers, RID p_environm if (rb->sdfgi == nullptr) { return; } - Environent *env = environment_owner.getornull(p_environment); + Environment *env = environment_owner.getornull(p_environment); RENDER_TIMESTAMP(">SDFGI Update Probes"); @@ -1380,7 +1380,7 @@ void RasterizerSceneRD::_process_gi(RID p_render_buffers, RID p_normal_roughness RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers); ERR_FAIL_COND(rb == nullptr); - Environent *env = environment_owner.getornull(p_environment); + Environment *env = environment_owner.getornull(p_environment); GI::PushConstant push_constant; @@ -2695,53 +2695,53 @@ RasterizerStorageRD::MaterialData *RasterizerSceneRD::_create_sky_material_func( } RID RasterizerSceneRD::environment_create() { - return environment_owner.make_rid(Environent()); + return environment_owner.make_rid(Environment()); } void RasterizerSceneRD::environment_set_background(RID p_env, RS::EnvironmentBG p_bg) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->background = p_bg; } void RasterizerSceneRD::environment_set_sky(RID p_env, RID p_sky) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->sky = p_sky; } void RasterizerSceneRD::environment_set_sky_custom_fov(RID p_env, float p_scale) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->sky_custom_fov = p_scale; } void RasterizerSceneRD::environment_set_sky_orientation(RID p_env, const Basis &p_orientation) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->sky_orientation = p_orientation; } void RasterizerSceneRD::environment_set_bg_color(RID p_env, const Color &p_color) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->bg_color = p_color; } void RasterizerSceneRD::environment_set_bg_energy(RID p_env, float p_energy) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->bg_energy = p_energy; } void RasterizerSceneRD::environment_set_canvas_max_layer(RID p_env, int p_max_layer) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->canvas_max_layer = p_max_layer; } void RasterizerSceneRD::environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient, float p_energy, float p_sky_contribution, RS::EnvironmentReflectionSource p_reflection_source, const Color &p_ao_color) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->ambient_light = p_color; env->ambient_source = p_ambient; @@ -2752,85 +2752,85 @@ void RasterizerSceneRD::environment_set_ambient_light(RID p_env, const Color &p_ } RS::EnvironmentBG RasterizerSceneRD::environment_get_background(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, RS::ENV_BG_MAX); return env->background; } RID RasterizerSceneRD::environment_get_sky(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, RID()); return env->sky; } float RasterizerSceneRD::environment_get_sky_custom_fov(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->sky_custom_fov; } Basis RasterizerSceneRD::environment_get_sky_orientation(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Basis()); return env->sky_orientation; } Color RasterizerSceneRD::environment_get_bg_color(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Color()); return env->bg_color; } float RasterizerSceneRD::environment_get_bg_energy(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->bg_energy; } int RasterizerSceneRD::environment_get_canvas_max_layer(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->canvas_max_layer; } Color RasterizerSceneRD::environment_get_ambient_light_color(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Color()); return env->ambient_light; } RS::EnvironmentAmbientSource RasterizerSceneRD::environment_get_ambient_source(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, RS::ENV_AMBIENT_SOURCE_BG); return env->ambient_source; } float RasterizerSceneRD::environment_get_ambient_light_energy(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->ambient_light_energy; } float RasterizerSceneRD::environment_get_ambient_sky_contribution(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, 0); return env->ambient_sky_contribution; } RS::EnvironmentReflectionSource RasterizerSceneRD::environment_get_reflection_source(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, RS::ENV_REFLECTION_SOURCE_DISABLED); return env->reflection_source; } Color RasterizerSceneRD::environment_get_ao_color(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Color()); return env->ao_color; } void RasterizerSceneRD::environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white, bool p_auto_exposure, float p_min_luminance, float p_max_luminance, float p_auto_exp_speed, float p_auto_exp_scale) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->exposure = p_exposure; env->tone_mapper = p_tone_mapper; @@ -2846,7 +2846,7 @@ void RasterizerSceneRD::environment_set_tonemap(RID p_env, RS::EnvironmentToneMa } void RasterizerSceneRD::environment_set_glow(RID p_env, bool p_enable, int p_level_flags, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->glow_enabled = p_enable; env->glow_levels = p_level_flags; @@ -2865,7 +2865,7 @@ void RasterizerSceneRD::environment_glow_set_use_bicubic_upscale(bool p_enable) } void RasterizerSceneRD::environment_set_sdfgi(RID p_env, bool p_enable, RS::EnvironmentSDFGICascades p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, bool p_use_multibounce, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->sdfgi_enabled = p_enable; @@ -2889,7 +2889,7 @@ void RasterizerSceneRD::environment_set_sdfgi_frames_to_converge(RS::Environment } void RasterizerSceneRD::environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->ssr_enabled = p_enable; @@ -2908,7 +2908,7 @@ RS::EnvironmentSSRRoughnessQuality RasterizerSceneRD::environment_get_ssr_roughn } void RasterizerSceneRD::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_bias, float p_light_affect, float p_ao_channel_affect, RS::EnvironmentSSAOBlur p_blur, float p_bilateral_sharpness) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND(!env); env->ssao_enabled = p_enable; @@ -2926,30 +2926,30 @@ void RasterizerSceneRD::environment_set_ssao_quality(RS::EnvironmentSSAOQuality } bool RasterizerSceneRD::environment_is_ssao_enabled(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, false); return env->ssao_enabled; } float RasterizerSceneRD::environment_get_ssao_ao_affect(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, false); return env->ssao_ao_channel_affect; } float RasterizerSceneRD::environment_get_ssao_light_affect(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, false); return env->ssao_direct_light_affect; } bool RasterizerSceneRD::environment_is_ssr_enabled(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, false); return env->ssr_enabled; } bool RasterizerSceneRD::environment_is_sdfgi_enabled(RID p_env) const { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, false); return env->sdfgi_enabled; } @@ -2959,7 +2959,7 @@ bool RasterizerSceneRD::is_environment(RID p_env) const { } Ref<Image> RasterizerSceneRD::environment_bake_panorama(RID p_env, bool p_bake_irradiance, const Size2i &p_size) { - Environent *env = environment_owner.getornull(p_env); + Environment *env = environment_owner.getornull(p_env); ERR_FAIL_COND_V(!env, Ref<Image>()); if (env->background == RS::ENV_BG_CAMERA_FEED || env->background == RS::ENV_BG_CANVAS || env->background == RS::ENV_BG_KEEP) { @@ -4903,7 +4903,7 @@ void RasterizerSceneRD::_process_ssr(RID p_render_buffers, RID p_dest_framebuffe return; } - Environent *env = environment_owner.getornull(p_environment); + Environment *env = environment_owner.getornull(p_environment); ERR_FAIL_COND(!env); ERR_FAIL_COND(!env->ssr_enabled); @@ -4948,7 +4948,7 @@ void RasterizerSceneRD::_process_ssao(RID p_render_buffers, RID p_environment, R RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers); ERR_FAIL_COND(!rb); - Environent *env = environment_owner.getornull(p_environment); + Environment *env = environment_owner.getornull(p_environment); ERR_FAIL_COND(!env); if (rb->ssao.ao[0].is_valid() && rb->ssao.ao_full.is_valid() != ssao_half_size) { @@ -5015,7 +5015,7 @@ void RasterizerSceneRD::_render_buffers_post_process_and_tonemap(RID p_render_bu RenderBuffers *rb = render_buffers_owner.getornull(p_render_buffers); ERR_FAIL_COND(!rb); - Environent *env = environment_owner.getornull(p_environment); + Environment *env = environment_owner.getornull(p_environment); //glow (if enabled) CameraEffects *camfx = camera_effects_owner.getornull(p_camera_effects); diff --git a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h index f09f9dde65..bbc0f536aa 100644 --- a/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h +++ b/servers/rendering/rasterizer_rd/rasterizer_scene_rd.h @@ -623,7 +623,7 @@ private: /* ENVIRONMENT */ - struct Environent { + struct Environment { // BG RS::EnvironmentBG background = RS::ENV_BG_CLEAR_COLOR; RID sky; @@ -703,7 +703,7 @@ private: static uint64_t auto_exposure_counter; - mutable RID_Owner<Environent> environment_owner; + mutable RID_Owner<Environment> environment_owner; /* CAMERA EFFECTS */ diff --git a/servers/rendering/rendering_device_binds.h b/servers/rendering/rendering_device_binds.h index 319c6d9fde..66c6a1c3a9 100644 --- a/servers/rendering/rendering_device_binds.h +++ b/servers/rendering/rendering_device_binds.h @@ -620,7 +620,7 @@ protected: RD_BIND(Variant::INT, RDPipelineColorBlendState, logic_op); RD_BIND(Variant::COLOR, RDPipelineColorBlendState, blend_constant); - ClassDB::bind_method(D_METHOD("set_attachments", "atachments"), &RDPipelineColorBlendState::set_attachments); + ClassDB::bind_method(D_METHOD("set_attachments", "attachments"), &RDPipelineColorBlendState::set_attachments); ClassDB::bind_method(D_METHOD("get_attachments"), &RDPipelineColorBlendState::get_attachments); ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "attachments", PROPERTY_HINT_ARRAY_TYPE, "RDPipelineColorBlendStateAttachment"), "set_attachments", "get_attachments"); } diff --git a/thirdparty/README.md b/thirdparty/README.md index 43cd448a00..392abea85e 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -426,9 +426,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 diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp index 36b5131f80..55b160d752 100644 --- a/thirdparty/enet/godot.cpp +++ b/thirdparty/enet/godot.cpp @@ -44,15 +44,14 @@ /// Abstract ENet interface for UDP/DTLS. class ENetGodotSocket { - public: virtual Error bind(IP_Address p_ip, uint16_t p_port) = 0; virtual Error sendto(const uint8_t *p_buffer, int p_len, int &r_sent, IP_Address p_ip, uint16_t p_port) = 0; virtual Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port) = 0; virtual int set_option(ENetSocketOption p_option, int p_value) = 0; virtual void close() = 0; - virtual void set_refuse_new_connections(bool p_refuse) { /* Only used by dtls server */ } - virtual ~ENetGodotSocket(){}; + virtual void set_refuse_new_connections(bool p_enable) {} /* Only used by dtls server */ + virtual ~ENetGodotSocket() {} }; class ENetDTLSClient; @@ -60,21 +59,19 @@ class ENetDTLSServer; /// NetSocket interface class ENetUDP : public ENetGodotSocket { - friend class ENetDTLSClient; friend class ENetDTLSServer; private: Ref<NetSocket> sock; IP_Address address; - uint16_t port; - bool bound; + uint16_t port = 0; + bool bound = false; public: ENetUDP() { sock = Ref<NetSocket>(NetSocket::create()); IP::Type ip_type = IP::TYPE_ANY; - bound = false; sock->open(NetSocket::TYPE_UDP, ip_type); } @@ -95,8 +92,9 @@ public: Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port) { Error err = sock->poll(NetSocket::POLL_TYPE_IN, 0); - if (err != OK) + if (err != OK) { return err; + } return sock->recvfrom(p_buffer, p_len, r_read, r_ip, r_port); } @@ -149,11 +147,10 @@ public: /// DTLS Client ENet interface class ENetDTLSClient : public ENetGodotSocket { - - bool connected; + bool connected = false; Ref<PacketPeerUDP> udp; Ref<PacketPeerDTLS> dtls; - bool verify; + bool verify = false; String for_hostname; Ref<X509Certificate> cert; @@ -168,7 +165,6 @@ public: if (p_base->bound) { bind(p_base->address, p_base->port); } - connected = false; } ~ENetDTLSClient() { @@ -186,25 +182,29 @@ public: connected = true; } dtls->poll(); - if (dtls->get_status() == PacketPeerDTLS::STATUS_HANDSHAKING) + if (dtls->get_status() == PacketPeerDTLS::STATUS_HANDSHAKING) { return ERR_BUSY; - else if (dtls->get_status() != PacketPeerDTLS::STATUS_CONNECTED) + } else if (dtls->get_status() != PacketPeerDTLS::STATUS_CONNECTED) { return FAILED; + } r_sent = p_len; return dtls->put_packet(p_buffer, p_len); } Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port) { dtls->poll(); - if (dtls->get_status() == PacketPeerDTLS::STATUS_HANDSHAKING) + if (dtls->get_status() == PacketPeerDTLS::STATUS_HANDSHAKING) { return ERR_BUSY; - if (dtls->get_status() != PacketPeerDTLS::STATUS_CONNECTED) + } + if (dtls->get_status() != PacketPeerDTLS::STATUS_CONNECTED) { return FAILED; + } int pc = dtls->get_available_packet_count(); - if (pc == 0) + if (pc == 0) { return ERR_BUSY; - else if (pc < 0) + } else if (pc < 0) { return FAILED; + } const uint8_t *buffer; Error err = dtls->get_packet(&buffer, r_read); @@ -229,15 +229,13 @@ public: /// DTLSServer - ENet interface class ENetDTLSServer : public ENetGodotSocket { - Ref<DTLSServer> server; Ref<UDPServer> udp_server; - Map<String, Ref<PacketPeerDTLS> > peers; - int last_service; + Map<String, Ref<PacketPeerDTLS>> peers; + int last_service = 0; public: ENetDTLSServer(ENetUDP *p_base, Ref<CryptoKey> p_key, Ref<X509Certificate> p_cert) { - last_service = 0; udp_server.instance(); p_base->close(); if (p_base->bound) { @@ -264,12 +262,13 @@ public: ERR_FAIL_COND_V(!peers.has(key), ERR_UNAVAILABLE); Ref<PacketPeerDTLS> peer = peers[key]; Error err = peer->put_packet(p_buffer, p_len); - if (err == OK) + if (err == OK) { r_sent = p_len; - else if (err == ERR_BUSY) + } else if (err == ERR_BUSY) { r_sent = 0; - else + } else { r_sent = -1; + } return err; } @@ -291,13 +290,13 @@ public: List<String> remove; Error err = ERR_BUSY; // TODO this needs to be fair! - for (Map<String, Ref<PacketPeerDTLS> >::Element *E = peers.front(); E; E = E->next()) { + for (Map<String, Ref<PacketPeerDTLS>>::Element *E = peers.front(); E; E = E->next()) { Ref<PacketPeerDTLS> peer = E->get(); peer->poll(); - if (peer->get_status() == PacketPeerDTLS::STATUS_HANDSHAKING) + if (peer->get_status() == PacketPeerDTLS::STATUS_HANDSHAKING) { continue; - else if (peer->get_status() != PacketPeerDTLS::STATUS_CONNECTED) { + } else if (peer->get_status() != PacketPeerDTLS::STATUS_CONNECTED) { // Peer disconnected, removing it. remove.push_back(E->key()); continue; @@ -336,7 +335,7 @@ public: } void close() { - for (Map<String, Ref<PacketPeerDTLS> >::Element *E = peers.front(); E; E = E->next()) { + for (Map<String, Ref<PacketPeerDTLS>>::Element *E = peers.front(); E; E = E->next()) { E->get()->disconnect_from_peer(); } peers.clear(); @@ -348,7 +347,6 @@ public: static enet_uint32 timeBase = 0; int enet_initialize(void) { - return 0; } @@ -356,22 +354,18 @@ void enet_deinitialize(void) { } enet_uint32 enet_host_random_seed(void) { - return (enet_uint32)OS::get_singleton()->get_unix_time(); } enet_uint32 enet_time_get(void) { - return OS::get_singleton()->get_ticks_msec() - timeBase; } void enet_time_set(enet_uint32 newTimeBase) { - timeBase = OS::get_singleton()->get_ticks_msec() - newTimeBase; } int enet_address_set_host(ENetAddress *address, const char *name) { - IP_Address ip = IP::get_singleton()->resolve_hostname(name); ERR_FAIL_COND_V(!ip.is_valid(), -1); @@ -380,24 +374,20 @@ int enet_address_set_host(ENetAddress *address, const char *name) { } void enet_address_set_ip(ENetAddress *address, const uint8_t *ip, size_t size) { - int len = size > 16 ? 16 : size; memset(address->host, 0, 16); memcpy(address->host, ip, len); } int enet_address_get_host_ip(const ENetAddress *address, char *name, size_t nameLength) { - return -1; } int enet_address_get_host(const ENetAddress *address, char *name, size_t nameLength) { - return -1; } ENetSocket enet_socket_create(ENetSocketType type) { - ENetUDP *socket = memnew(ENetUDP); return socket; @@ -421,7 +411,6 @@ void enet_host_refuse_new_connections(ENetHost *host, int p_refuse) { } int enet_socket_bind(ENetSocket socket, const ENetAddress *address) { - IP_Address ip; if (address->wildcard) { ip = IP_Address("*"); @@ -443,8 +432,7 @@ void enet_socket_destroy(ENetSocket socket) { } int enet_socket_send(ENetSocket socket, const ENetAddress *address, const ENetBuffer *buffers, size_t bufferCount) { - - ERR_FAIL_COND_V(address == NULL, -1); + ERR_FAIL_COND_V(address == nullptr, -1); ENetGodotSocket *sock = (ENetGodotSocket *)socket; IP_Address dest; @@ -455,7 +443,7 @@ int enet_socket_send(ENetSocket socket, const ENetAddress *address, const ENetBu // Create a single packet. Vector<uint8_t> out; - uint8_t* w; + uint8_t *w; int size = 0; int pos = 0; for (i = 0; i < bufferCount; i++) { @@ -472,7 +460,6 @@ int enet_socket_send(ENetSocket socket, const ENetAddress *address, const ENetBu int sent = 0; err = sock->sendto((const uint8_t *)&w[0], size, sent, dest, address->port); if (err != OK) { - if (err == ERR_BUSY) { // Blocking call return 0; } @@ -485,7 +472,6 @@ int enet_socket_send(ENetSocket socket, const ENetAddress *address, const ENetBu } int enet_socket_receive(ENetSocket socket, ENetAddress *address, ENetBuffer *buffers, size_t bufferCount) { - ERR_FAIL_COND_V(bufferCount != 1, -1); ENetGodotSocket *sock = (ENetGodotSocket *)socket; @@ -494,11 +480,13 @@ int enet_socket_receive(ENetSocket socket, ENetAddress *address, ENetBuffer *buf IP_Address ip; Error err = sock->recvfrom((uint8_t *)buffers[0].data, buffers[0].dataLength, read, ip, address->port); - if (err == ERR_BUSY) + if (err == ERR_BUSY) { return 0; + } - if (err != OK) + if (err != OK) { return -1; + } enet_address_set_ip(address, ip.get_ipv6(), 16); @@ -507,47 +495,38 @@ int enet_socket_receive(ENetSocket socket, ENetAddress *address, ENetBuffer *buf // Not implemented int enet_socket_wait(ENetSocket socket, enet_uint32 *condition, enet_uint32 timeout) { - return 0; // do we need this function? } int enet_socket_get_address(ENetSocket socket, ENetAddress *address) { - return -1; // do we need this function? } int enet_socketset_select(ENetSocket maxSocket, ENetSocketSet *readSet, ENetSocketSet *writeSet, enet_uint32 timeout) { - return -1; } int enet_socket_listen(ENetSocket socket, int backlog) { - return -1; } int enet_socket_set_option(ENetSocket socket, ENetSocketOption option, int value) { - ENetGodotSocket *sock = (ENetGodotSocket *)socket; return sock->set_option(option, value); } int enet_socket_get_option(ENetSocket socket, ENetSocketOption option, int *value) { - return -1; } int enet_socket_connect(ENetSocket socket, const ENetAddress *address) { - return -1; } ENetSocket enet_socket_accept(ENetSocket socket, ENetAddress *address) { - - return NULL; + return nullptr; } int enet_socket_shutdown(ENetSocket socket, ENetSocketShutdown how) { - return -1; } diff --git a/thirdparty/misc/stb_vorbis.c b/thirdparty/misc/stb_vorbis.c index 52c9c666a2..a8cbfa6c23 100644 --- a/thirdparty/misc/stb_vorbis.c +++ b/thirdparty/misc/stb_vorbis.c @@ -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; |