diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/class_db.cpp | 19 | ||||
| -rw-r--r-- | core/class_db.h | 1 | ||||
| -rw-r--r-- | core/command_queue_mt.h | 46 | ||||
| -rw-r--r-- | core/image.cpp | 1 | ||||
| -rw-r--r-- | core/io/logger.cpp | 6 | ||||
| -rw-r--r-- | core/io/resource_format_binary.cpp | 18 | ||||
| -rw-r--r-- | core/make_binders.py | 2 | ||||
| -rw-r--r-- | core/math/math_funcs.h | 17 | ||||
| -rw-r--r-- | core/math/matrix3.cpp | 13 | ||||
| -rw-r--r-- | core/math/matrix3.h | 15 | ||||
| -rw-r--r-- | core/os/input_event.cpp | 2 | ||||
| -rw-r--r-- | core/os/main_loop.cpp | 1 | ||||
| -rw-r--r-- | core/script_debugger_remote.cpp | 12 | ||||
| -rw-r--r-- | core/variant.h | 8 | ||||
| -rw-r--r-- | core/variant_op.cpp | 8 |
15 files changed, 116 insertions, 53 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp index 12310f6151..57e88044b5 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -187,6 +187,25 @@ MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_ return md; } +MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11) { + + MethodDefinition md; + md.name = StaticCString::create(p_name); + md.args.resize(11); + md.args[0] = StaticCString::create(p_arg1); + md.args[1] = StaticCString::create(p_arg2); + md.args[2] = StaticCString::create(p_arg3); + md.args[3] = StaticCString::create(p_arg4); + md.args[4] = StaticCString::create(p_arg5); + md.args[5] = StaticCString::create(p_arg6); + md.args[6] = StaticCString::create(p_arg7); + md.args[7] = StaticCString::create(p_arg8); + md.args[8] = StaticCString::create(p_arg9); + md.args[9] = StaticCString::create(p_arg10); + md.args[10] = StaticCString::create(p_arg11); + return md; +} + #endif ClassDB::APIType ClassDB::current_api = API_CORE; diff --git a/core/class_db.h b/core/class_db.h index 5910a2ce01..24db4c61bb 100644 --- a/core/class_db.h +++ b/core/class_db.h @@ -66,6 +66,7 @@ MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_ MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8); MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9); MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10); +MethodDefinition D_METHOD(const char *p_name, const char *p_arg1, const char *p_arg2, const char *p_arg3, const char *p_arg4, const char *p_arg5, const char *p_arg6, const char *p_arg7, const char *p_arg8, const char *p_arg9, const char *p_arg10, const char *p_arg11); #else diff --git a/core/command_queue_mt.h b/core/command_queue_mt.h index f99e16da15..e37d593f9f 100644 --- a/core/command_queue_mt.h +++ b/core/command_queue_mt.h @@ -227,6 +227,27 @@ class CommandQueueMT { virtual void call() { (instance->*method)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } }; + template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class P11, class P12> + struct Command12 : public CommandBase { + + T *instance; + M method; + typename GetSimpleTypeT<P1>::type_t p1; + typename GetSimpleTypeT<P2>::type_t p2; + typename GetSimpleTypeT<P3>::type_t p3; + typename GetSimpleTypeT<P4>::type_t p4; + typename GetSimpleTypeT<P5>::type_t p5; + typename GetSimpleTypeT<P6>::type_t p6; + typename GetSimpleTypeT<P7>::type_t p7; + typename GetSimpleTypeT<P8>::type_t p8; + typename GetSimpleTypeT<P9>::type_t p9; + typename GetSimpleTypeT<P10>::type_t p10; + typename GetSimpleTypeT<P11>::type_t p11; + typename GetSimpleTypeT<P12>::type_t p12; + + virtual void call() { (instance->*method)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } + }; + /* comands that return */ template <class T, class M, class R> @@ -906,6 +927,31 @@ public: if (sync) sync->post(); } + template <class T, class M, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8, class P9, class P10, class P11, class P12> + void push(T *p_instance, M p_method, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8, P9 p9, P10 p10, P11 p11, P12 p12) { + + Command12<T, M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12> *cmd = allocate_and_lock<Command12<T, M, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12> >(); + + cmd->instance = p_instance; + cmd->method = p_method; + cmd->p1 = p1; + cmd->p2 = p2; + cmd->p3 = p3; + cmd->p4 = p4; + cmd->p5 = p5; + cmd->p6 = p6; + cmd->p7 = p7; + cmd->p8 = p8; + cmd->p9 = p9; + cmd->p10 = p10; + cmd->p11 = p11; + cmd->p12 = p12; + + unlock(); + + if (sync) sync->post(); + } + /*** PUSH AND RET COMMANDS ***/ template <class T, class M, class R> diff --git a/core/image.cpp b/core/image.cpp index 943cbaf51d..42684e7ea7 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1061,7 +1061,6 @@ Error Image::generate_mipmaps() { int size = _get_dst_image_size(width, height, format, mmcount); data.resize(size); - print_line("to gen mipmaps w " + itos(width) + " h " + itos(height) + " format " + get_format_name(format) + " mipmaps " + itos(mmcount) + " new size is: " + itos(size)); PoolVector<uint8_t>::Write wp = data.write(); diff --git a/core/io/logger.cpp b/core/io/logger.cpp index ad6371f1e1..ce2ce44b1d 100644 --- a/core/io/logger.cpp +++ b/core/io/logger.cpp @@ -110,7 +110,7 @@ void RotatedFileLogger::close_file() { void RotatedFileLogger::clear_old_backups() { int max_backups = max_files - 1; // -1 for the current file - String basename = base_path.get_basename(); + String basename = base_path.get_file().get_basename(); String extension = "." + base_path.get_extension(); DirAccess *da = DirAccess::open(base_path.get_base_dir()); @@ -122,7 +122,7 @@ void RotatedFileLogger::clear_old_backups() { String f = da->get_next(); Set<String> backups; while (f != String()) { - if (!da->current_is_dir() && f.begins_with(basename) && f.ends_with(extension) && f != base_path) { + if (!da->current_is_dir() && f.begins_with(basename) && f.ends_with(extension) && f != base_path.get_file()) { backups.insert(f); } f = da->get_next(); @@ -149,7 +149,7 @@ void RotatedFileLogger::rotate_file() { char timestamp[21]; OS::Date date = OS::get_singleton()->get_date(); OS::Time time = OS::get_singleton()->get_time(); - sprintf(timestamp, "-%04d-%02d-%02d-%02d-%02d-%02d", date.year, date.month, date.day + 1, time.hour, time.min, time.sec); + sprintf(timestamp, "-%04d-%02d-%02d-%02d-%02d-%02d", date.year, date.month, date.day, time.hour, time.min, time.sec); String backup_name = base_path.get_basename() + timestamp + "." + base_path.get_extension(); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 900db7c2dc..03c3c5f615 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -282,7 +282,6 @@ Error ResourceInteractiveLoaderBinary::parse_variant(Variant &r_v) { property = _get_string(); NodePath np = NodePath(names, subnames, absolute, property); - //print_line("got path: "+String(np)); r_v = np; @@ -640,7 +639,6 @@ Error ResourceInteractiveLoaderBinary::poll() { String path = external_resources[s].path; - print_line("load external res: " + path); if (remaps.has(path)) { path = remaps[path]; } @@ -706,8 +704,6 @@ Error ResourceInteractiveLoaderBinary::poll() { String t = get_unicode_string(); - // print_line("loading resource of type "+t+" path is "+path); - Object *obj = ClassDB::instance(t); if (!obj) { error = ERR_FILE_CORRUPT; @@ -907,20 +903,6 @@ void ResourceInteractiveLoaderBinary::open(FileAccess *p_f) { external_resources.push_back(er); } - //see if the exporter has different set of external resources for more efficient loading - /* - String preload_depts = "deps/"+res_path.md5_text(); - if (Globals::get_singleton()->has(preload_depts)) { - external_resources.clear(); - //ignore external resources and use these - NodePath depts=Globals::get_singleton()->get(preload_depts); - external_resources.resize(depts.get_name_count()); - for(int i=0;i<depts.get_name_count();i++) { - external_resources[i].path=depts.get_name(i); - } - print_line(res_path+" - EXTERNAL RESOURCES: "+itos(external_resources.size())); - }*/ - print_bl("ext resources: " + itos(ext_resources_size)); uint32_t int_resources_size = f->get_32(); diff --git a/core/make_binders.py b/core/make_binders.py index 6468c029f0..6f42c6e8eb 100644 --- a/core/make_binders.py +++ b/core/make_binders.py @@ -244,7 +244,7 @@ def make_version(template, nargs, argmax, const, ret): def run(target, source, env): - versions = 10 + versions = 11 versions_ext = 6 text = "" text_ext = "" diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index d63da322a5..65b2ffb0df 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -387,6 +387,23 @@ public: return hf; } + + static _ALWAYS_INLINE_ float snap_scalar(float p_offset, float p_step, float p_target) { + return p_step != 0 ? Math::stepify(p_target - p_offset, p_step) + p_offset : p_target; + } + + static _ALWAYS_INLINE_ float snap_scalar_seperation(float p_offset, float p_step, float p_target, float p_separation) { + if (p_step != 0) { + float a = Math::stepify(p_target - p_offset, p_step + p_separation) + p_offset; + float b = a; + if (p_target >= 0) + b -= p_separation; + else + b += p_step; + return (Math::abs(p_target - a) < Math::abs(p_target - b)) ? a : b; + } + return p_target; + } }; #endif // MATH_FUNCS_H diff --git a/core/math/matrix3.cpp b/core/math/matrix3.cpp index 4051de7afb..85421c074b 100644 --- a/core/math/matrix3.cpp +++ b/core/math/matrix3.cpp @@ -538,7 +538,7 @@ Basis::operator String() const { return mtx; } -Basis::operator Quat() const { +Quat Basis::get_quat() const { //commenting this check because precision issues cause it to fail when it shouldn't //#ifdef MATH_CHECKS //ERR_FAIL_COND_V(is_rotation() == false, Quat()); @@ -710,12 +710,7 @@ void Basis::get_axis_angle(Vector3 &r_axis, real_t &r_angle) const { r_angle = angle; } -Basis::Basis(const Vector3 &p_euler) { - - set_euler(p_euler); -} - -Basis::Basis(const Quat &p_quat) { +void Basis::set_quat(const Quat &p_quat) { real_t d = p_quat.length_squared(); real_t s = 2.0 / d; @@ -750,7 +745,3 @@ void Basis::set_axis_angle(const Vector3 &p_axis, real_t p_phi) { elements[2][1] = p_axis.y * p_axis.z * (1.0 - cosine) + p_axis.x * sine; elements[2][2] = axis_sq.z + cosine * (1.0 - axis_sq.z); } - -Basis::Basis(const Vector3 &p_axis, real_t p_phi) { - set_axis_angle(p_axis, p_phi); -} diff --git a/core/math/matrix3.h b/core/math/matrix3.h index 23429888e0..9a33b8203d 100644 --- a/core/math/matrix3.h +++ b/core/math/matrix3.h @@ -88,8 +88,11 @@ public: Vector3 get_euler_yxz() const; void set_euler_yxz(const Vector3 &p_euler); - Vector3 get_euler() const { return get_euler_yxz(); }; - void set_euler(const Vector3 &p_euler) { set_euler_yxz(p_euler); }; + Quat get_quat() const; + void set_quat(const Quat &p_quat); + + Vector3 get_euler() const { return get_euler_yxz(); } + void set_euler(const Vector3 &p_euler) { set_euler_yxz(p_euler); } void get_axis_angle(Vector3 &r_axis, real_t &r_angle) const; void set_axis_angle(const Vector3 &p_axis, real_t p_phi); @@ -205,11 +208,11 @@ public: bool is_symmetric() const; Basis diagonalize(); - operator Quat() const; + operator Quat() const { return get_quat(); } - Basis(const Quat &p_quat); // euler - Basis(const Vector3 &p_euler); // euler - Basis(const Vector3 &p_axis, real_t p_phi); + Basis(const Quat &p_quat) { set_quat(p_quat); }; + Basis(const Vector3 &p_euler) { set_euler(p_euler); } + Basis(const Vector3 &p_axis, real_t p_phi) { set_axis_angle(p_axis, p_phi); } _FORCE_INLINE_ Basis(const Vector3 &row0, const Vector3 &row1, const Vector3 &row2) { elements[0] = row0; diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index bef98ac3f2..6b43f2c63b 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -637,7 +637,7 @@ bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event) const if (jm.is_null()) return false; - return (axis == jm->axis && (axis_value < 0) == (jm->axis_value < 0)); + return (axis == jm->axis && ((axis_value < 0) == (jm->axis_value < 0) || jm->axis_value == 0)); } String InputEventJoypadMotion::as_text() const { diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index b146d370f1..8b4449586b 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -52,6 +52,7 @@ void MainLoop::_bind_methods() { BIND_CONSTANT(NOTIFICATION_WM_FOCUS_IN); BIND_CONSTANT(NOTIFICATION_WM_FOCUS_OUT); BIND_CONSTANT(NOTIFICATION_WM_QUIT_REQUEST); + BIND_CONSTANT(NOTIFICATION_WM_GO_BACK_REQUEST); BIND_CONSTANT(NOTIFICATION_WM_UNFOCUS_REQUEST); BIND_CONSTANT(NOTIFICATION_OS_MEMORY_WARNING); BIND_CONSTANT(NOTIFICATION_TRANSLATION_CHANGED); diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index 4653ade294..2feb068ecb 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -855,15 +855,19 @@ void ScriptDebuggerRemote::_print_handler(void *p_this, const String &p_string) } sdr->char_count += allowed_chars; - - if (sdr->char_count >= sdr->max_cps) { - s += "\n[output overflow, print less text!]\n"; - } + bool overflowed = sdr->char_count >= sdr->max_cps; sdr->mutex->lock(); if (!sdr->locking && sdr->tcp_client->is_connected_to_host()) { + if (overflowed) + s += "[...]"; + sdr->output_strings.push_back(s); + + if (overflowed) { + sdr->output_strings.push_back("[output overflow, print less text!]"); + } } sdr->mutex->unlock(); } diff --git a/core/variant.h b/core/variant.h index e0d0bf05c8..45066af401 100644 --- a/core/variant.h +++ b/core/variant.h @@ -99,15 +99,15 @@ public: _RID, OBJECT, DICTIONARY, - ARRAY, // 20 + ARRAY, // arrays - POOL_BYTE_ARRAY, + POOL_BYTE_ARRAY, // 20 POOL_INT_ARRAY, POOL_REAL_ARRAY, POOL_STRING_ARRAY, - POOL_VECTOR2_ARRAY, // 25 - POOL_VECTOR3_ARRAY, + POOL_VECTOR2_ARRAY, + POOL_VECTOR3_ARRAY, // 25 POOL_COLOR_ARRAY, VARIANT_MAX diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 03ec336291..6362090902 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -1655,13 +1655,13 @@ Variant Variant::get_named(const StringName &p_index, bool *r_valid) const { } else if (p_index == CoreStringNames::singleton->a) { return v->a; } else if (p_index == CoreStringNames::singleton->r8) { - return v->r * 255.0; + return int(v->r * 255.0); } else if (p_index == CoreStringNames::singleton->g8) { - return v->g * 255.0; + return int(v->g * 255.0); } else if (p_index == CoreStringNames::singleton->b8) { - return v->b * 255.0; + return int(v->b * 255.0); } else if (p_index == CoreStringNames::singleton->a8) { - return v->a * 255.0; + return int(v->a * 255.0); } else if (p_index == CoreStringNames::singleton->h) { return v->get_h(); } else if (p_index == CoreStringNames::singleton->s) { |