diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/bind/core_bind.cpp | 2 | ||||
| -rw-r--r-- | core/class_db.cpp | 8 | ||||
| -rw-r--r-- | core/io/resource_format_binary.cpp | 7 | ||||
| -rw-r--r-- | core/list.h | 4 | ||||
| -rw-r--r-- | core/math/matrix3.cpp | 15 | ||||
| -rw-r--r-- | core/math/matrix3.h | 2 | ||||
| -rw-r--r-- | core/math/transform.cpp | 12 | ||||
| -rw-r--r-- | core/method_bind.h | 2 | ||||
| -rw-r--r-- | core/script_language.h | 1 |
9 files changed, 36 insertions, 17 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index a446094643..0f217c8235 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -568,7 +568,7 @@ Dictionary _OS::get_time(bool utc) const { } /** - * Get a epoch time value from a dictionary of time values + * Get an epoch time value from a dictionary of time values * @p datetime must be populated with the following keys: * day, hour, minute, month, second, year. (dst is ignored). * diff --git a/core/class_db.cpp b/core/class_db.cpp index 872e466e72..f5ddd9c761 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -536,11 +536,9 @@ void ClassDB::get_method_list(StringName p_class, List<MethodInfo> *p_methods, b minfo.return_val = method->get_return_info(); minfo.flags = method->get_hint_flags(); - int defval_count = method->get_default_argument_count(); - minfo.default_arguments.resize(defval_count); - - for (int i = 0; i < defval_count; i++) { - minfo.default_arguments[i] = method->get_default_argument(defval_count - i - 1); + 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)); } p_methods->push_back(minfo); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index d090d7a20b..084d8ffcab 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -878,7 +878,7 @@ void ResourceInteractiveLoaderBinary::open(FileAccess *p_f) { if (ver_format > FORMAT_VERSION || ver_major > VERSION_MAJOR) { f->close(); - ERR_EXPLAIN("File Format '" + itos(FORMAT_VERSION) + "." + itos(ver_major) + "." + itos(ver_minor) + "' is too new! Please upgrade to a a new engine version: " + local_path); + ERR_EXPLAIN("File Format '" + itos(FORMAT_VERSION) + "." + itos(ver_major) + "." + itos(ver_minor) + "' is too new! Please upgrade to a new engine version: " + local_path); ERR_FAIL(); } @@ -1117,6 +1117,9 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons memdelete(f); } ERR_FAIL_COND_V(!fw, ERR_CANT_CREATE); + + uint8_t magic[4] = { 'R', 'S', 'R', 'C' }; + fw->store_buffer(magic, 4); } bool big_endian = f->get_32(); @@ -1178,7 +1181,7 @@ Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, cons memdelete(f); memdelete(fw); - ERR_EXPLAIN("File Format '" + itos(FORMAT_VERSION) + "." + itos(ver_major) + "." + itos(ver_minor) + "' is too new! Please upgrade to a a new engine version: " + local_path); + ERR_EXPLAIN("File Format '" + itos(FORMAT_VERSION) + "." + itos(ver_major) + "." + itos(ver_minor) + "' is too new! Please upgrade to a new engine version: " + local_path); ERR_FAIL_V(ERR_FILE_UNRECOGNIZED); } diff --git a/core/list.h b/core/list.h index 0cad6038ff..a67287a9ab 100644 --- a/core/list.h +++ b/core/list.h @@ -180,7 +180,7 @@ private: public: /** - * return an const iterator to the beginning of the list. + * return a const iterator to the beginning of the list. */ _FORCE_INLINE_ const Element *front() const { @@ -195,7 +195,7 @@ public: }; /** - * return an const iterator to the last member of the list. + * return a const iterator to the last member of the list. */ _FORCE_INLINE_ const Element *back() const { diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp index 9732a1ff37..4051de7afb 100644 --- a/core/math/matrix3.cpp +++ b/core/math/matrix3.cpp @@ -234,7 +234,22 @@ Basis Basis::scaled(const Vector3 &p_scale) const { return m; } +void Basis::set_scale(const Vector3 &p_scale) { + + set_axis(0, get_axis(0).normalized() * p_scale.x); + set_axis(1, get_axis(1).normalized() * p_scale.y); + set_axis(2, get_axis(2).normalized() * p_scale.z); +} + Vector3 Basis::get_scale() const { + + return Vector3( + Vector3(elements[0][0], elements[1][0], elements[2][0]).length(), + Vector3(elements[0][1], elements[1][1], elements[2][1]).length(), + Vector3(elements[0][2], elements[1][2], elements[2][2]).length()); +} + +Vector3 Basis::get_signed_scale() const { // FIXME: We are assuming M = R.S (R is rotation and S is scaling), and use polar decomposition to extract R and S. // A polar decomposition is M = O.P, where O is an orthogonal matrix (meaning rotation and reflection) and // P is a positive semi-definite matrix (meaning it contains absolute values of scaling along its diagonal). diff --git a/core/math/matrix3.h b/core/math/matrix3.h index 9c9080ac46..23429888e0 100644 --- a/core/math/matrix3.h +++ b/core/math/matrix3.h @@ -97,7 +97,9 @@ public: void scale(const Vector3 &p_scale); Basis scaled(const Vector3 &p_scale) const; + void set_scale(const Vector3 &p_scale); Vector3 get_scale() const; + Vector3 get_signed_scale() const; // transposed dot products _FORCE_INLINE_ real_t tdotx(const Vector3 &v) const { diff --git a/core/math/transform.cpp b/core/math/transform.cpp index 60df69a509..638a39ab73 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -118,17 +118,17 @@ Transform Transform::interpolate_with(const Transform &p_transform, real_t p_c) /* not sure if very "efficient" but good enough? */ - Vector3 src_scale = basis.get_scale(); - Quat src_rot = basis; + Vector3 src_scale = basis.get_signed_scale(); + Quat src_rot = basis.orthonormalized(); Vector3 src_loc = origin; - Vector3 dst_scale = p_transform.basis.get_scale(); + Vector3 dst_scale = p_transform.basis.get_signed_scale(); Quat dst_rot = p_transform.basis; Vector3 dst_loc = p_transform.origin; - Transform dst; - dst.basis = src_rot.slerp(dst_rot, p_c); - dst.basis.scale(src_scale.linear_interpolate(dst_scale, p_c)); + Transform dst; //this could be made faster by using a single function in Basis.. + dst.basis = src_rot.slerp(dst_rot, p_c).normalized(); + dst.basis.set_scale(src_scale.linear_interpolate(dst_scale, p_c)); dst.origin = src_loc.linear_interpolate(dst_loc, p_c); return dst; diff --git a/core/method_bind.h b/core/method_bind.h index 75f09b2cd9..3c43f86b54 100644 --- a/core/method_bind.h +++ b/core/method_bind.h @@ -369,7 +369,7 @@ MethodBind *create_vararg_method_bind(Variant (T::*p_method)(const Variant **, i // tale of an amazing hack.. // -// if you declare an nonexistent class.. +// if you declare a nonexistent class.. class __UnexistingClass; #include "method_bind.gen.inc" diff --git a/core/script_language.h b/core/script_language.h index 342d8c8072..2261737f9a 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -206,6 +206,7 @@ public: virtual int find_function(const String &p_function, const String &p_code) const = 0; virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const = 0; virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return ERR_UNAVAILABLE; } + virtual bool overrides_external_editor() { return false; } virtual Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, bool &r_force, String &r_call_hint) { return ERR_UNAVAILABLE; } |