Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport HTTPRequest gzip decompression #48581

Closed
wants to merge 84 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
0ecbf77
Bump version to 3.3.1-rc
akien-mga Apr 22, 2021
e86d086
Fix crash on GDNative API json generator exit.
bruvzg Apr 22, 2021
b616f41
fbx: Fix include for zlib that broke unbundling
akien-mga Apr 22, 2021
bcbf7ce
Add type_traits include for `std::is_trivially_destructible`
akien-mga Apr 22, 2021
33d6b1f
CPU lightmapper environment energy fixes.
JFonS Apr 22, 2021
6662596
embree: Allow building against system library on Linux
akien-mga Apr 22, 2021
1e31661
Tweak lightmapper warning message to mention Rosetta emulation on macOS
Calinou Apr 22, 2021
aa84787
lightmapper: Disable build if raycast module can't build
akien-mga Apr 22, 2021
162c78f
Linux: Don't attempt linking embree3 on non-tools, link it for headle…
akien-mga Apr 23, 2021
5e16b10
Android: Fix get_buffer false positive on empty dest buffer
akien-mga Apr 23, 2021
3b44829
Updating KinematicBody2D "is_on" functions' descriptions
arthurpaulino Oct 12, 2020
dc98144
Link to Feature tags more explicitly in ProjectSettings documentation
Calinou Apr 22, 2021
bceaef6
Correct pre-deprication warning message regarding linuxbsd/x11 platform
YuriSizov Apr 22, 2021
9201ffa
Improve some argument names for core types
kleonc Apr 22, 2021
7a6a150
[3.2] Prevents default values of VSNodeCustom from overriding by a sc…
Chaosus Apr 12, 2021
3ab33d3
Check if _direct_state_changed() argument is valid
rafallus Mar 30, 2021
3111910
Make LSP update the filesystem of changed scripts
Razoric480 Apr 14, 2021
d696d89
Batching - GLES3 fix light pass modulates
lawnjelly Apr 24, 2021
1d8d7b0
Batching - fix number of verts in translation
lawnjelly Apr 23, 2021
3f31080
Fix AudioServer Crash when bus count equals 0
mrushyendra Apr 24, 2021
84dc716
Fix empty CSGShape error
madmiraal Apr 25, 2021
d8607d8
Fix CSGMesh undo not refreshing gizmo
madmiraal Apr 25, 2021
5a26bcd
OSX: Clarify min version requirement (10.12) in Info.plist
akien-mga Apr 27, 2021
feac30b
Linux: Remove use_static_cpp override on x86_32
akien-mga Apr 26, 2021
f172123
CI: Upgrade Emscripten to 2.0.15 (same as official standard builds)
akien-mga Apr 28, 2021
cde16a9
Fix LineEdit undo behaves strangely
ray90514 Apr 8, 2021
88cfde0
Add OpenSimplexNoise output change to changelog
ttencate Apr 24, 2021
278af7d
doc: Mark LargeTexture as deprecated (removed in 4.0)
akien-mga Apr 28, 2021
dbf71c1
Improve SpriteFrames get_animation_loop description
skyace65 Sep 10, 2020
890ec03
[Net] Fix socket poll timeout on Windows.
Faless Apr 26, 2021
46a5f3a
Android: Upgrade buildTools from 30.0.1 to 30.0.3
akien-mga Apr 26, 2021
00b70f6
Fix CSG Path Polygon cache being removed after connect
HaSa1002 Apr 27, 2021
7212256
Fixes #48178: WebXR broken when built with Emscripten 2.0.13 or later
dsnopek Apr 28, 2021
05a8ddf
SceneTree: Fix type hints for `global_menu_action` signal
akien-mga Apr 28, 2021
42c88d9
Add SkeletonIK function documentation
Apr 15, 2021
08bedba
Document that clearcoat/rim lighting is not visible on unshaded mater…
Calinou Apr 28, 2021
31bc9d8
[Android] Allow to build dev template with symbols
thebestnom Mar 10, 2021
8dc3d5e
[Android] fix generateDevTemplate
thebestnom Apr 28, 2021
e4cbf9c
[HTML5] Fix build for recent emscripten versions.
Faless Apr 30, 2021
2bd40b4
[iOS] Nonnegative start index for virtual keyboard range
naithar Apr 30, 2021
edf5a03
Document that `SceneTree.call_group()` is deferred
Calinou Apr 29, 2021
87aa694
Duplicate DynamicFontData resources in the editor preview generation …
bruvzg Apr 29, 2021
dacd16f
Fix 2d software skinning relative transforms
lawnjelly May 3, 2021
a93f52e
Add WebSocketMultiplayerPeer _incoming_packets check bound
MaxStgs Apr 30, 2021
839f602
TileMapEditor::_bucket_fill Check autotile coordinates only if autoti…
kleonc May 3, 2021
44a4df0
TileMapEditor Modulate autotile previews
kleonc May 3, 2021
387d2a6
Fix BakedLightmap bias bound check
MaxStgs Apr 30, 2021
703c290
Fix skinning initialization in MeshInstance when loaded from thread
pouleyKetchoupp Apr 26, 2021
62d80ba
Allow values > 1 for friction and bounce in PhysicsMaterial
pouleyKetchoupp May 4, 2021
045b85b
Make posmod use int64_t instead of int
kleonc May 3, 2021
508cd0b
Fix indent left line selection
KoalasinTraffic Apr 25, 2021
3c089f6
LineEdit: Now double click to select a word, and triple click to sele…
kuruk-mm Feb 28, 2021
c5332b1
Check PHashTranslation generate p_from is valid
MaxStgs May 3, 2021
06136d4
SCons: Add explicit dependencies on thirdparty code in cloned env
akien-mga Dec 17, 2020
4b8a1d2
CI: Add `--doctool` check to find missing classref updates
akien-mga May 3, 2021
1cfed0d
Switch to embree-aarch64
JFonS May 4, 2021
b97b37f
SCons: Disable embree-based modules on x86 (32-bit)
akien-mga May 5, 2021
6a84390
Add checks for __SSE2__ in the lightmap raycaster
JFonS May 5, 2021
ba4f15b
Batching fix polygon basis polarity
briansemrau May 4, 2021
b4529c7
Fix 3D scene preview generation.
CaptainProton42 Mar 19, 2021
b1cb84b
Document that `File.open_compressed()` can only open files saved by G…
Calinou Apr 28, 2021
7c5633c
Expose get_debug_mesh in Shape to scripting API
pouleyKetchoupp Apr 30, 2021
7e22dfd
Add PackedDataContainer data pointer check for non nullable
MaxStgs May 1, 2021
476bc51
Save project after opening
KoBeWi Mar 26, 2021
edd63ae
Check input mesh is valid in SurfaceTool methods
rafallus Apr 11, 2021
feaf4e6
Fix Array.max() navigating to @GDScript.max() etc.
AaronRecord Apr 23, 2021
e9c8889
Fixes the SkeletonIK twisting issue by using the skeleton global pose…
TwistedTwigleg Apr 27, 2021
e6186da
Fix crash with user-defined `ResourceFormatLoader.load`
akien-mga May 5, 2021
bb6b386
Only set base in Sprite3D when needed
clayjohn May 6, 2021
523faf0
Fixed usage of proxy textures on GLES2 sky
pixaline May 7, 2021
5514b16
Improve the AudioStreamPlayer(2D/3D) class descriptions
Calinou May 5, 2021
8821022
[HTML5] Use 64KiB chunk size in JS HTTPClient.
Faless May 6, 2021
e6cbb4d
Fixed cut/copy/paste visibility
likeich May 6, 2021
b622a9e
Remove extra separator
likeich May 6, 2021
488f448
[HTML5] Remove "fixed-size.html".
Faless May 7, 2021
3fc59fb
Tweak the setting hint for the custom editor theme setting
Calinou May 7, 2021
0a7193c
[HTML5] Fix target_fps when window loses focus.
Faless May 7, 2021
7eacb60
Fix EditorPropertyResource focus outline being drawn behind the preview
Calinou May 9, 2021
3299600
Document caveats of `OS.get_unique_id()`
Calinou May 9, 2021
dd20139
Allow negative contrast values in the editor theme settings
Calinou May 7, 2021
6f780d7
TileSet: Improve error message for invalid IDs
akien-mga May 9, 2021
5193c3c
Add ctrl+shift+a to instance scene in scenetree dock
likeich Mar 31, 2021
140cf0f
Create CollisionObject debug shapes using VS
trollodel Apr 27, 2021
04ebfaa
Work on porting HTTPRequest compression to 3.3
tavurth May 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/javascript_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:
GODOT_BASE_BRANCH: 3.x
SCONSFLAGS: platform=javascript verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
SCONS_CACHE_LIMIT: 4096
EM_VERSION: 1.39.20
EM_VERSION: 2.0.15
EM_CACHE_FOLDER: 'emsdk-cache'

jobs:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,11 @@ jobs:
echo "----- Run and test project -----"
DRI_PRIME=0 xvfb-run bin/godot.x11.tools.64s 30 --video-driver GLES3 --audio-driver Dummy --path test_project 2>&1 | tee sanitizers_log.txt || true
misc/scripts/check_ci_log.py sanitizers_log.txt

# Check class reference
- name: Check for class reference updates
run: |
echo "Running --doctool to see if this changes the public API without updating the documentation."
echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n"
DRI_PRIME=0 xvfb-run bin/godot.x11.tools.64s --doctool . 2>&1 > /dev/null || true
git diff --color --exit-code
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ See the [release announcement](https://godotengine.org/article/godot-3-3-has-arr
- [SVG images can now be used as a project icon](https://github.com/godotengine/godot/pull/43369).
- [Tweaked log file names for consistency between Mono and non-Mono builds](https://github.com/godotengine/godot/pull/44148).
- [Tweaked command line `--print-fps` display to display milliseconds per frame timings in addition to FPS](https://github.com/godotengine/godot/pull/47735).
- [OpenSimplexNoise is now guaranteed to give consistent results across platforms](https://github.com/godotengine/godot/issues/47211).
- This change breaks compatibility: you get different results even for the same seed.

#### Editor

Expand Down
5 changes: 5 additions & 0 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ Copyright: 2018, Eric Lasota
2018, Microsoft Corp.
License: Expat

Files: ./thirdparty/embree/
Comment: Embree
Copyright: 2009-2021 Intel Corporation
License: Apache-2.0

Files: ./thirdparty/enet/
Comment: ENet
Copyright: 2002-2020, Lee Salzman
Expand Down
3 changes: 2 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise e
# Thirdparty libraries
opts.Add(BoolVariable("builtin_bullet", "Use the built-in Bullet library", True))
opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True))
opts.Add(BoolVariable("builtin_embree", "Use the built-in Embree library", True))
opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True))
opts.Add(BoolVariable("builtin_freetype", "Use the built-in FreeType library", True))
opts.Add(BoolVariable("builtin_libogg", "Use the built-in libogg library", True))
Expand Down Expand Up @@ -212,7 +213,7 @@ else:
if selected_platform in ["linux", "bsd", "linuxbsd"]:
if selected_platform == "linuxbsd":
# Alias for forward compatibility.
print('Platform "linuxbsd" is still called "x11" in Godot 3.2.x. Building for platform "x11".')
print('Platform "linuxbsd" is still called "x11" in Godot 3.x. Building for platform "x11".')
# Alias for convenience.
selected_platform = "x11"

Expand Down
20 changes: 15 additions & 5 deletions core/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ with open("script_encryption_key.gen.cpp", "w") as f:


# Add required thirdparty code.

thirdparty_obj = []

env_thirdparty = env.Clone()
env_thirdparty.disable_warnings()

Expand All @@ -57,7 +60,7 @@ thirdparty_misc_sources = [
"clipper.cpp",
]
thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_misc_sources]
env_thirdparty.add_source_files(env.core_sources, thirdparty_misc_sources)
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_misc_sources)

# Zlib library, can be unbundled
if env["builtin_zlib"]:
Expand All @@ -83,7 +86,7 @@ if env["builtin_zlib"]:
if env["target"] == "debug":
env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"])

env_thirdparty.add_source_files(env.core_sources, thirdparty_zlib_sources)
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zlib_sources)

# Minizip library, could be unbundled in theory
# However, our version has some custom modifications, so it won't compile with the system one
Expand All @@ -94,7 +97,7 @@ thirdparty_minizip_sources = [
"zip.c",
]
thirdparty_minizip_sources = [thirdparty_minizip_dir + file for file in thirdparty_minizip_sources]
env_thirdparty.add_source_files(env.core_sources, thirdparty_minizip_sources)
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_minizip_sources)

# Zstd library, can be unbundled in theory
# though we currently use some private symbols
Expand Down Expand Up @@ -136,10 +139,14 @@ if env["builtin_zstd"]:
# Also needed in main env includes will trigger warnings
env.Append(CPPDEFINES=["ZSTD_STATIC_LINKING_ONLY"])

env_thirdparty.add_source_files(env.core_sources, thirdparty_zstd_sources)
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zstd_sources)


env.core_sources += thirdparty_obj


# Godot source files

# Godot's own sources
env.add_source_files(env.core_sources, "*.cpp")

# Certificates
Expand Down Expand Up @@ -185,3 +192,6 @@ SConscript("bind/SCsub")
# Build it all as a library
lib = env.add_library("core", env.core_sources)
env.Prepend(LIBS=[lib])

# Needed to force rebuilding the core files when the thirdparty code is updated.
env.Depends(lib, thirdparty_obj)
10 changes: 5 additions & 5 deletions core/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ struct Color {
Color inverted() const;
Color contrasted() const;

_FORCE_INLINE_ Color linear_interpolate(const Color &p_b, float p_t) const {
_FORCE_INLINE_ Color linear_interpolate(const Color &p_to, float p_weight) const {

Color res = *this;

res.r += (p_t * (p_b.r - r));
res.g += (p_t * (p_b.g - g));
res.b += (p_t * (p_b.b - b));
res.a += (p_t * (p_b.a - a));
res.r += (p_weight * (p_to.r - r));
res.g += (p_weight * (p_to.g - g));
res.b += (p_weight * (p_to.b - b));
res.a += (p_weight * (p_to.a - a));

return res;
}
Expand Down
1 change: 1 addition & 0 deletions core/compressed_translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct _PHashTranslationCmp {

void PHashTranslation::generate(const Ref<Translation> &p_from) {
#ifdef TOOLS_ENABLED
ERR_FAIL_COND(p_from.is_null());
List<StringName> keys;
p_from->get_message_list(&keys);

Expand Down
15 changes: 13 additions & 2 deletions core/crypto/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ env_crypto = env.Clone()

is_builtin = env["builtin_mbedtls"]
has_module = env["module_mbedtls_enabled"]
thirdparty_obj = []

if is_builtin or not has_module:
# Use our headers for builtin or if the module is not going to be compiled.
Expand Down Expand Up @@ -35,6 +36,16 @@ if not has_module:
"godot_core_mbedtls_platform.c",
]
thirdparty_mbedtls_sources = [thirdparty_mbedtls_dir + file for file in thirdparty_mbedtls_sources]
env_thirdparty.add_source_files(env.core_sources, thirdparty_mbedtls_sources)
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_mbedtls_sources)
env.core_sources += thirdparty_obj

env_crypto.add_source_files(env.core_sources, "*.cpp")

# Godot source files

core_obj = []

env_crypto.add_source_files(core_obj, "*.cpp")
env.core_sources += core_obj

# Needed to force rebuilding the core files when the thirdparty library is updated.
env.Depends(core_obj, thirdparty_obj)
86 changes: 86 additions & 0 deletions core/io/compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,94 @@ int Compression::decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p
ERR_FAIL_V(-1);
}

/**
This will handle both Gzip and Deflat streams. It will automatically allocate the output buffer into the provided p_dst_vect Vector.
This is required for compressed data who's final uncompressed size is unknown, as is the case for HTTP response bodies.
This is much slower however than using Compression::decompress because it may result in multiple full copies of the output buffer.
*/
int Compression::decompress_dynamic(PoolVector<uint8_t> *p_dst, int p_max_dst_size, const uint8_t *p_src, int p_src_size, Mode p_mode) {
int ret;
uint8_t *dst = nullptr;
int out_mark = 0;
z_stream strm;

ERR_FAIL_COND_V(p_src_size <= 0, Z_DATA_ERROR);

// This function only supports GZip and Deflate
int window_bits = p_mode == MODE_DEFLATE ? 15 : 15 + 16;
ERR_FAIL_COND_V(p_mode != MODE_DEFLATE && p_mode != MODE_GZIP, Z_ERRNO);

// Initialize the stream
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = 0;
strm.next_in = Z_NULL;

int err = inflateInit2(&strm, window_bits);
ERR_FAIL_COND_V(err != Z_OK, -1);

// Setup the stream inputs
strm.next_in = (Bytef *)p_src;
strm.avail_in = p_src_size;

// Ensure the destination buffer is empty
p_dst->resize(0);

// decompress until deflate stream ends or end of file
do {
// Add another chunk size to the output buffer
// This forces a copy of the whole buffer
p_dst->resize(p_dst->size() + gzip_chunk);
// Get pointer to the actual output buffer
dst = p_dst->write().ptr();

// Set the stream to the new output stream
// Since it was copied, we need to reset the stream to the new buffer
strm.next_out = &(dst[out_mark]);
strm.avail_out = gzip_chunk;

// run inflate() on input until output buffer is full and needs to be resized
// or input runs out
do {
ret = inflate(&strm, Z_SYNC_FLUSH);

switch (ret) {
case Z_NEED_DICT:
ret = Z_DATA_ERROR;
case Z_DATA_ERROR:
case Z_MEM_ERROR:
case Z_STREAM_ERROR:
WARN_PRINT(strm.msg);
(void)inflateEnd(&strm);
p_dst->resize(0);
return ret;
}
} while (strm.avail_out > 0 && strm.avail_in > 0);

out_mark += gzip_chunk;

// Encorce max output size
if (p_max_dst_size > -1 && strm.total_out > (uint64_t)p_max_dst_size) {
(void)inflateEnd(&strm);
p_dst->resize(0);
return Z_BUF_ERROR;
}
} while (ret != Z_STREAM_END);

// If all done successfully, resize the output if it's larger than the actual output
if (ret == Z_STREAM_END && (unsigned long)p_dst->size() > strm.total_out) {
p_dst->resize(strm.total_out);
}

// clean up and return
(void)inflateEnd(&strm);
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
}

int Compression::zlib_level = Z_DEFAULT_COMPRESSION;
int Compression::gzip_level = Z_DEFAULT_COMPRESSION;
int Compression::zstd_level = 3;
bool Compression::zstd_long_distance_matching = false;
int Compression::zstd_window_log_size = 27; // ZSTD_WINDOWLOG_LIMIT_DEFAULT
int Compression::gzip_chunk = 16384;
3 changes: 3 additions & 0 deletions core/io/compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#ifndef COMPRESSION_H
#define COMPRESSION_H

#include "core/pool_vector.h"
#include "core/typedefs.h"

class Compression {
Expand All @@ -41,6 +42,7 @@ class Compression {
static int zstd_level;
static bool zstd_long_distance_matching;
static int zstd_window_log_size;
static int gzip_chunk;

enum Mode {
MODE_FASTLZ,
Expand All @@ -52,6 +54,7 @@ class Compression {
static int compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size, Mode p_mode = MODE_ZSTD);
static int get_max_compressed_buffer_size(int p_src_size, Mode p_mode = MODE_ZSTD);
static int decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size, Mode p_mode = MODE_ZSTD);
static int decompress_dynamic(PoolVector<uint8_t> *p_dst, int p_max_dst_size, const uint8_t *p_src, int p_src_size, Mode p_mode);

Compression();
};
Expand Down
46 changes: 25 additions & 21 deletions core/io/resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,6 @@ class ResourceInteractiveLoaderDefault : public ResourceInteractiveLoader {
ResourceInteractiveLoaderDefault() {}
};

Ref<ResourceInteractiveLoader> ResourceFormatLoader::load_interactive(const String &p_path, const String &p_original_path, Error *r_error) {

//either this
Ref<Resource> res = load(p_path, p_original_path, r_error);
if (res.is_null())
return Ref<ResourceInteractiveLoader>();

Ref<ResourceInteractiveLoaderDefault> ril = Ref<ResourceInteractiveLoaderDefault>(memnew(ResourceInteractiveLoaderDefault));
ril->resource = res;
return ril;
}

bool ResourceFormatLoader::exists(const String &p_path) const {
return FileAccess::exists(p_path); //by default just check file
}
Expand All @@ -168,25 +156,41 @@ void ResourceFormatLoader::get_recognized_extensions(List<String> *p_extensions)
}
}

RES ResourceFormatLoader::load(const String &p_path, const String &p_original_path, Error *r_error) {
// Warning: Derived classes must override either `load` or `load_interactive`. The base code
// here can trigger an infinite recursion otherwise, since `load` calls `load_interactive`
// vice versa.

Ref<ResourceInteractiveLoader> ResourceFormatLoader::load_interactive(const String &p_path, const String &p_original_path, Error *r_error) {
// Warning: See previous note about the risk of infinite recursion.
Ref<Resource> res = load(p_path, p_original_path, r_error);
if (res.is_null()) {
return Ref<ResourceInteractiveLoader>();
}

Ref<ResourceInteractiveLoaderDefault> ril = Ref<ResourceInteractiveLoaderDefault>(memnew(ResourceInteractiveLoaderDefault));
ril->resource = res;
return ril;
}

RES ResourceFormatLoader::load(const String &p_path, const String &p_original_path, Error *r_error) {
// Check user-defined loader if there's any. Hard fail if it returns an error.
if (get_script_instance() && get_script_instance()->has_method("load")) {
Variant res = get_script_instance()->call("load", p_path, p_original_path);

if (res.get_type() == Variant::INT) {

if (r_error)
if (res.get_type() == Variant::INT) { // Error code, abort.
if (r_error) {
*r_error = (Error)res.operator int64_t();

} else {

if (r_error)
}
return RES();
} else { // Success, pass on result.
if (r_error) {
*r_error = OK;
}
return res;
}
}

//or this must be implemented
// Warning: See previous note about the risk of infinite recursion.
Ref<ResourceInteractiveLoader> ril = load_interactive(p_path, p_original_path, r_error);
if (!ril.is_valid())
return RES();
Expand Down
12 changes: 6 additions & 6 deletions core/math/basis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,16 +1033,16 @@ void Basis::set_diagonal(const Vector3 &p_diag) {
elements[2][2] = p_diag.z;
}

Basis Basis::slerp(const Basis &target, const real_t &t) const {
Basis Basis::slerp(const Basis &p_to, const real_t &p_weight) const {

//consider scale
Quat from(*this);
Quat to(target);
Quat to(p_to);

Basis b(from.slerp(to, t));
b.elements[0] *= Math::lerp(elements[0].length(), target.elements[0].length(), t);
b.elements[1] *= Math::lerp(elements[1].length(), target.elements[1].length(), t);
b.elements[2] *= Math::lerp(elements[2].length(), target.elements[2].length(), t);
Basis b(from.slerp(to, p_weight));
b.elements[0] *= Math::lerp(elements[0].length(), p_to.elements[0].length(), p_weight);
b.elements[1] *= Math::lerp(elements[1].length(), p_to.elements[1].length(), p_weight);
b.elements[2] *= Math::lerp(elements[2].length(), p_to.elements[2].length(), p_weight);

return b;
}
2 changes: 1 addition & 1 deletion core/math/basis.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class Basis {
bool is_diagonal() const;
bool is_rotation() const;

Basis slerp(const Basis &target, const real_t &t) const;
Basis slerp(const Basis &p_to, const real_t &p_weight) const;

operator String() const;

Expand Down
Loading