diff options
Diffstat (limited to 'core')
61 files changed, 298 insertions, 0 deletions
diff --git a/core/array.cpp b/core/array.cpp index 75efe8f8ff..1a8a833404 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -83,9 +83,11 @@ const Variant &Array::operator[](int p_idx) const { int Array::size() const { return _p->array.size(); } + bool Array::empty() const { return _p->array.empty(); } + void Array::clear() { _p->array.clear(); } @@ -151,6 +153,7 @@ void Array::_assign(const Array &p_array) { void Array::operator=(const Array &p_array) { _assign(p_array); } + void Array::push_back(const Variant &p_value) { ERR_FAIL_COND(!_p->typed.validate(p_value, "push_back")); _p->array.push_back(p_value); @@ -509,6 +512,7 @@ Array::Array() { _p = memnew(ArrayPrivate); _p->refcount.init(); } + Array::~Array() { _unref(); } diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index a5809d6678..7c7ef4e03c 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -69,6 +69,7 @@ _ResourceLoader *_ResourceLoader::singleton = nullptr; Error _ResourceLoader::load_threaded_request(const String &p_path, const String &p_type_hint, bool p_use_sub_threads) { return ResourceLoader::load_threaded_request(p_path, p_type_hint, p_use_sub_threads); } + _ResourceLoader::ThreadLoadStatus _ResourceLoader::load_threaded_get_status(const String &p_path, Array r_progress) { float progress = 0; ResourceLoader::ThreadLoadStatus tls = ResourceLoader::load_threaded_get_status(p_path, &progress); @@ -76,6 +77,7 @@ _ResourceLoader::ThreadLoadStatus _ResourceLoader::load_threaded_get_status(cons r_progress[0] = progress; return (ThreadLoadStatus)tls; } + RES _ResourceLoader::load_threaded_get(const String &p_path) { Error error; RES res = ResourceLoader::load_threaded_get(p_path, &error); @@ -198,6 +200,7 @@ void _OS::set_use_file_access_save_and_swap(bool p_enable) { void _OS::set_low_processor_usage_mode(bool p_enabled) { OS::get_singleton()->set_low_processor_usage_mode(p_enabled); } + bool _OS::is_in_low_processor_usage_mode() const { return OS::get_singleton()->is_in_low_processor_usage_mode(); } @@ -252,6 +255,7 @@ int _OS::get_process_id() const { bool _OS::has_environment(const String &p_var) const { return OS::get_singleton()->has_environment(p_var); } + String _OS::get_environment(const String &p_var) const { return OS::get_singleton()->get_environment(p_var); } @@ -259,6 +263,7 @@ String _OS::get_environment(const String &p_var) const { String _OS::get_name() const { return OS::get_singleton()->get_name(); } + Vector<String> _OS::get_cmdline_args() { List<String> cmdline = OS::get_singleton()->get_cmdline_args(); Vector<String> cmdlinev; @@ -811,6 +816,7 @@ Vector<Plane> _Geometry::build_box_planes(const Vector3 &p_extents) { Vector<Plane> _Geometry::build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis) { return Geometry::build_cylinder_planes(p_radius, p_height, p_sides, p_axis); } + Vector<Plane> _Geometry::build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis) { return Geometry::build_capsule_planes(p_radius, p_height, p_sides, p_lats, p_axis); } @@ -860,22 +866,27 @@ Vector<Vector3> _Geometry::get_closest_points_between_segments(const Vector3 &p1 r.set(1, r2); return r; } + Vector2 _Geometry::get_closest_point_to_segment_2d(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b) { Vector2 s[2] = { p_a, p_b }; return Geometry::get_closest_point_to_segment_2d(p_point, s); } + Vector3 _Geometry::get_closest_point_to_segment(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b) { Vector3 s[2] = { p_a, p_b }; return Geometry::get_closest_point_to_segment(p_point, s); } + Vector2 _Geometry::get_closest_point_to_segment_uncapped_2d(const Vector2 &p_point, const Vector2 &p_a, const Vector2 &p_b) { Vector2 s[2] = { p_a, p_b }; return Geometry::get_closest_point_to_segment_uncapped_2d(p_point, s); } + Vector3 _Geometry::get_closest_point_to_segment_uncapped(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b) { Vector3 s[2] = { p_a, p_b }; return Geometry::get_closest_point_to_segment_uncapped(p_point, s); } + Variant _Geometry::ray_intersects_triangle(const Vector3 &p_from, const Vector3 &p_dir, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2) { Vector3 res; if (Geometry::ray_intersects_triangle(p_from, p_dir, p_v0, p_v1, p_v2, &res)) @@ -883,6 +894,7 @@ Variant _Geometry::ray_intersects_triangle(const Vector3 &p_from, const Vector3 else return Variant(); } + Variant _Geometry::segment_intersects_triangle(const Vector3 &p_from, const Vector3 &p_to, const Vector3 &p_v0, const Vector3 &p_v1, const Vector3 &p_v2) { Vector3 res; if (Geometry::segment_intersects_triangle(p_from, p_to, p_v0, p_v1, p_v2, &res)) @@ -906,6 +918,7 @@ Vector<Vector3> _Geometry::segment_intersects_sphere(const Vector3 &p_from, cons r.set(1, norm); return r; } + Vector<Vector3> _Geometry::segment_intersects_cylinder(const Vector3 &p_from, const Vector3 &p_to, float p_height, float p_radius) { Vector<Vector3> r; Vector3 res, norm; @@ -917,6 +930,7 @@ Vector<Vector3> _Geometry::segment_intersects_cylinder(const Vector3 &p_from, co r.set(1, norm); return r; } + Vector<Vector3> _Geometry::segment_intersects_convex(const Vector3 &p_from, const Vector3 &p_to, const Vector<Plane> &p_planes) { Vector<Vector3> r; Vector3 res, norm; @@ -1198,9 +1212,11 @@ void _File::close() { memdelete(f); f = nullptr; } + bool _File::is_open() const { return f != nullptr; } + String _File::get_path() const { ERR_FAIL_COND_V_MSG(!f, "", "File must be opened before use."); return f->get_path(); @@ -1215,10 +1231,12 @@ void _File::seek(int64_t p_position) { ERR_FAIL_COND_MSG(!f, "File must be opened before use."); f->seek(p_position); } + void _File::seek_end(int64_t p_position) { ERR_FAIL_COND_MSG(!f, "File must be opened before use."); f->seek_end(p_position); } + int64_t _File::get_position() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); return f->get_position(); @@ -1238,14 +1256,17 @@ uint8_t _File::get_8() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); return f->get_8(); } + uint16_t _File::get_16() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); return f->get_16(); } + uint32_t _File::get_32() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); return f->get_32(); } + uint64_t _File::get_64() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); return f->get_64(); @@ -1255,10 +1276,12 @@ float _File::get_float() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); return f->get_float(); } + double _File::get_double() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); return f->get_double(); } + real_t _File::get_real() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); return f->get_real(); @@ -1332,6 +1355,7 @@ void _File::set_endian_swap(bool p_swap) { if (f) f->set_endian_swap(p_swap); } + bool _File::get_endian_swap() { return eswap; } @@ -1347,16 +1371,19 @@ void _File::store_8(uint8_t p_dest) { f->store_8(p_dest); } + void _File::store_16(uint16_t p_dest) { ERR_FAIL_COND_MSG(!f, "File must be opened before use."); f->store_16(p_dest); } + void _File::store_32(uint32_t p_dest) { ERR_FAIL_COND_MSG(!f, "File must be opened before use."); f->store_32(p_dest); } + void _File::store_64(uint64_t p_dest) { ERR_FAIL_COND_MSG(!f, "File must be opened before use."); @@ -1368,11 +1395,13 @@ void _File::store_float(float p_dest) { f->store_float(p_dest); } + void _File::store_double(double p_dest) { ERR_FAIL_COND_MSG(!f, "File must be opened before use."); f->store_double(p_dest); } + void _File::store_real(real_t p_real) { ERR_FAIL_COND_MSG(!f, "File must be opened before use."); @@ -1562,6 +1591,7 @@ String _Directory::get_next() { } return next; } + bool _Directory::current_is_dir() const { ERR_FAIL_COND_V_MSG(!d, false, "Directory must be opened before use."); return d->current_is_dir(); @@ -1576,10 +1606,12 @@ int _Directory::get_drive_count() { ERR_FAIL_COND_V_MSG(!d, 0, "Directory must be opened before use."); return d->get_drive_count(); } + String _Directory::get_drive(int p_drive) { ERR_FAIL_COND_V_MSG(!d, "", "Directory must be opened before use."); return d->get_drive(p_drive); } + int _Directory::get_current_drive() { ERR_FAIL_COND_V_MSG(!d, 0, "Directory must be opened before use."); return d->get_current_drive(); @@ -1589,10 +1621,12 @@ Error _Directory::change_dir(String p_dir) { ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory must be opened before use."); return d->change_dir(p_dir); } + String _Directory::get_current_dir() { ERR_FAIL_COND_V_MSG(!d, "", "Directory must be opened before use."); return d->get_current_dir(); } + Error _Directory::make_dir(String p_dir) { ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory must be opened before use."); if (!p_dir.is_rel_path()) { @@ -1603,6 +1637,7 @@ Error _Directory::make_dir(String p_dir) { } return d->make_dir(p_dir); } + Error _Directory::make_dir_recursive(String p_dir) { ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory must be opened before use."); if (!p_dir.is_rel_path()) { @@ -1646,6 +1681,7 @@ Error _Directory::copy(String p_from, String p_to) { ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory must be opened before use."); return d->copy(p_from, p_to); } + Error _Directory::rename(String p_from, String p_to) { ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory must be opened before use."); if (!p_from.is_rel_path()) { @@ -1657,6 +1693,7 @@ Error _Directory::rename(String p_from, String p_to) { return d->rename(p_from, p_to); } + Error _Directory::remove(String p_name) { ERR_FAIL_COND_V_MSG(!d, ERR_UNCONFIGURED, "Directory must be opened before use."); if (!p_name.is_rel_path()) { @@ -1915,6 +1952,7 @@ String _Thread::get_id() const { bool _Thread::is_active() const { return active; } + Variant _Thread::wait_to_finish() { ERR_FAIL_COND_V_MSG(!thread, Variant(), "Thread must exist to wait for its completion."); ERR_FAIL_COND_V_MSG(!active, Variant(), "Thread must be active to wait for its completion."); @@ -1961,6 +1999,7 @@ PackedStringArray _ClassDB::get_class_list() const { return ret; } + PackedStringArray _ClassDB::get_inheriters_from_class(const StringName &p_class) const { List<StringName> classes; ClassDB::get_inheriters_from_class(p_class, &classes); @@ -1974,18 +2013,23 @@ PackedStringArray _ClassDB::get_inheriters_from_class(const StringName &p_class) return ret; } + StringName _ClassDB::get_parent_class(const StringName &p_class) const { return ClassDB::get_parent_class(p_class); } + bool _ClassDB::class_exists(const StringName &p_class) const { return ClassDB::class_exists(p_class); } + bool _ClassDB::is_parent_class(const StringName &p_class, const StringName &p_inherits) const { return ClassDB::is_parent_class(p_class, p_inherits); } + bool _ClassDB::can_instance(const StringName &p_class) const { return ClassDB::can_instance(p_class); } + Variant _ClassDB::instance(const StringName &p_class) const { Object *obj = ClassDB::instance(p_class); if (!obj) @@ -2002,6 +2046,7 @@ Variant _ClassDB::instance(const StringName &p_class) const { bool _ClassDB::has_signal(StringName p_class, StringName p_signal) const { return ClassDB::has_signal(p_class, p_signal); } + Dictionary _ClassDB::get_signal(StringName p_class, StringName p_signal) const { MethodInfo signal; if (ClassDB::get_signal(p_class, p_signal, &signal)) { @@ -2010,6 +2055,7 @@ Dictionary _ClassDB::get_signal(StringName p_class, StringName p_signal) const { return Dictionary(); } } + Array _ClassDB::get_signal_list(StringName p_class, bool p_no_inheritance) const { List<MethodInfo> signals; ClassDB::get_signal_list(p_class, &signals, p_no_inheritance); @@ -2098,6 +2144,7 @@ int _ClassDB::get_integer_constant(const StringName &p_class, const StringName & ERR_FAIL_COND_V(!found, 0); return c; } + StringName _ClassDB::get_category(const StringName &p_node) const { return ClassDB::get_category(p_node); } @@ -2141,6 +2188,7 @@ void _ClassDB::_bind_methods() { void _Engine::set_iterations_per_second(int p_ips) { Engine::get_singleton()->set_iterations_per_second(p_ips); } + int _Engine::get_iterations_per_second() const { return Engine::get_singleton()->get_iterations_per_second(); } diff --git a/core/callable.cpp b/core/callable.cpp index dc2d034cc6..b7bdc715f8 100644 --- a/core/callable.cpp +++ b/core/callable.cpp @@ -72,6 +72,7 @@ ObjectID Callable::get_object_id() const { return ObjectID(object); } } + StringName Callable::get_method() const { ERR_FAIL_COND_V_MSG(is_custom(), StringName(), vformat("Can't get method on CallableCustom \"%s\".", operator String())); @@ -117,9 +118,11 @@ bool Callable::operator==(const Callable &p_callable) const { return false; } } + bool Callable::operator!=(const Callable &p_callable) const { return !(*this == p_callable); } + bool Callable::operator<(const Callable &p_callable) const { bool custom_a = is_custom(); bool custom_b = p_callable.is_custom(); @@ -222,6 +225,7 @@ Callable::Callable(ObjectID p_object, const StringName &p_method) { object = p_object; method = p_method; } + Callable::Callable(CallableCustom *p_custom) { if (p_custom->referenced) { object = 0; @@ -231,6 +235,7 @@ Callable::Callable(CallableCustom *p_custom) { object = 0; //ensure object is all zero, since pointer may be 32 bits custom = p_custom; } + Callable::Callable(const Callable &p_callable) { if (p_callable.is_custom()) { if (!p_callable.custom->ref_count.ref()) { @@ -262,9 +267,11 @@ CallableCustom::CallableCustom() { Object *Signal::get_object() const { return ObjectDB::get_instance(object); } + ObjectID Signal::get_object_id() const { return object; } + StringName Signal::get_name() const { return name; } @@ -307,17 +314,20 @@ Error Signal::emit(const Variant **p_arguments, int p_argcount) const { return obj->emit_signal(name, p_arguments, p_argcount); } + Error Signal::connect(const Callable &p_callable, const Vector<Variant> &p_binds, uint32_t p_flags) { Object *object = get_object(); ERR_FAIL_COND_V(!object, ERR_UNCONFIGURED); return object->connect(name, p_callable, p_binds, p_flags); } + void Signal::disconnect(const Callable &p_callable) { Object *object = get_object(); ERR_FAIL_COND(!object); object->disconnect(name, p_callable); } + bool Signal::is_connected(const Callable &p_callable) const { Object *object = get_object(); ERR_FAIL_COND_V(!object, false); diff --git a/core/class_db.cpp b/core/class_db.cpp index 79e145248c..0a187416f4 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -255,6 +255,7 @@ bool ClassDB::is_parent_class(const StringName &p_class, const StringName &p_inh return false; } + void ClassDB::get_class_list(List<StringName> *p_classes) { OBJTYPE_RLOCK; @@ -505,6 +506,7 @@ Object *ClassDB::instance(const StringName &p_class) { #endif return ti->creation_func(); } + bool ClassDB::can_instance(const StringName &p_class) { OBJTYPE_RLOCK; @@ -934,6 +936,7 @@ void ClassDB::get_property_list(StringName p_class, List<PropertyInfo> *p_list, check = check->inherits_ptr; } } + 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; @@ -978,6 +981,7 @@ bool ClassDB::set_property(Object *p_object, const StringName &p_property, const return false; } + bool ClassDB::get_property(Object *p_object, const StringName &p_property, Variant &r_value) { ClassInfo *type = classes.getptr(p_object->get_class_name()); ClassInfo *check = type; diff --git a/core/color.cpp b/core/color.cpp index 328b2e3568..4bee14f3ba 100644 --- a/core/color.cpp +++ b/core/color.cpp @@ -213,6 +213,7 @@ void Color::invert() { g = 1.0 - g; b = 1.0 - b; } + void Color::contrast() { r = Math::fmod(r + 0.5, 1.0); g = Math::fmod(g + 0.5, 1.0); diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 89e738e596..dd46e23505 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -269,6 +269,7 @@ void PHashTranslation::_get_property_list(List<PropertyInfo> *p_list) const { p_list->push_back(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "strings")); p_list->push_back(PropertyInfo(Variant::OBJECT, "load_from", PROPERTY_HINT_RESOURCE_TYPE, "Translation", PROPERTY_USAGE_EDITOR)); } + void PHashTranslation::_bind_methods() { ClassDB::bind_method(D_METHOD("generate", "from"), &PHashTranslation::generate); } diff --git a/core/crypto/crypto.cpp b/core/crypto/crypto.cpp index 60db329e64..ed27d2ebc3 100644 --- a/core/crypto/crypto.cpp +++ b/core/crypto/crypto.cpp @@ -154,6 +154,7 @@ void ResourceFormatSaverCrypto::get_recognized_extensions(const RES &p_resource, p_extensions->push_back("key"); } } + bool ResourceFormatSaverCrypto::recognize(const RES &p_resource) const { return Object::cast_to<X509Certificate>(*p_resource) || Object::cast_to<CryptoKey>(*p_resource); } diff --git a/core/debugger/script_debugger.cpp b/core/debugger/script_debugger.cpp index 9dd669f816..179745b11e 100644 --- a/core/debugger/script_debugger.cpp +++ b/core/debugger/script_debugger.cpp @@ -62,11 +62,13 @@ void ScriptDebugger::remove_breakpoint(int p_line, const StringName &p_source) { if (breakpoints[p_line].size() == 0) breakpoints.erase(p_line); } + bool ScriptDebugger::is_breakpoint(int p_line, const StringName &p_source) const { if (!breakpoints.has(p_line)) return false; return breakpoints[p_line].has(p_source); } + bool ScriptDebugger::is_breakpoint_line(int p_line) const { return breakpoints.has(p_line); } diff --git a/core/dictionary.cpp b/core/dictionary.cpp index bc8e795da7..0ef26cfc62 100644 --- a/core/dictionary.cpp +++ b/core/dictionary.cpp @@ -79,6 +79,7 @@ Variant &Dictionary::operator[](const Variant &p_key) { const Variant &Dictionary::operator[](const Variant &p_key) const { return _p->variant_map[p_key]; } + const Variant *Dictionary::getptr(const Variant &p_key) const { OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator>::ConstElement E = ((const OrderedHashMap<Variant, Variant, VariantHasher, VariantComparator> *)&_p->variant_map)->find(p_key); @@ -115,6 +116,7 @@ Variant Dictionary::get(const Variant &p_key, const Variant &p_default) const { int Dictionary::size() const { return _p->variant_map.size(); } + bool Dictionary::empty() const { return !_p->variant_map.size(); } @@ -170,6 +172,7 @@ void Dictionary::_unref() const { } _p = nullptr; } + uint32_t Dictionary::hash() const { uint32_t h = hash_djb2_one_32(Variant::DICTIONARY); @@ -254,6 +257,7 @@ Dictionary::Dictionary() { _p = memnew(DictionaryPrivate); _p->refcount.init(); } + Dictionary::~Dictionary() { _unref(); } diff --git a/core/engine.cpp b/core/engine.cpp index bd86535a70..25eac27921 100644 --- a/core/engine.cpp +++ b/core/engine.cpp @@ -40,6 +40,7 @@ void Engine::set_iterations_per_second(int p_ips) { ERR_FAIL_COND_MSG(p_ips <= 0, "Engine iterations per second must be greater than 0."); ips = p_ips; } + int Engine::get_iterations_per_second() const { return ips; } diff --git a/core/image.cpp b/core/image.cpp index 4cbecbf44f..3fff93ed91 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -2283,6 +2283,7 @@ Error Image::decompress() { Error Image::compress(CompressMode p_mode, CompressSource p_source, float p_lossy_quality) { return compress_from_channels(p_mode, detect_used_channels(p_source), p_lossy_quality); } + Error Image::compress_from_channels(CompressMode p_mode, UsedChannels p_channels, float p_lossy_quality) { switch (p_mode) { case COMPRESS_S3TC: { @@ -3359,6 +3360,7 @@ void Image::convert_rg_to_ra_rgba8() { w[i + 2] = 0; } } + void Image::convert_ra_rgba8_to_rg() { ERR_FAIL_COND(format != FORMAT_RGBA8); ERR_FAIL_COND(!data.size()); diff --git a/core/input/input.cpp b/core/input/input.cpp index a9921f791a..e81dfcf30f 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -672,6 +672,7 @@ void Input::set_mouse_position(const Point2 &p_posf) { Point2 Input::get_mouse_position() const { return mouse_pos; } + Point2 Input::get_last_mouse_speed() const { return mouse_speed_track.speed; } @@ -812,6 +813,7 @@ void Input::accumulate_input_event(const Ref<InputEvent> &p_event) { accumulated_events.push_back(p_event); } + void Input::flush_accumulated_events() { while (accumulated_events.front()) { parse_input_event(accumulated_events.front()->get()); diff --git a/core/input/input_event.cpp b/core/input/input_event.cpp index 094ed0bc56..497ce79038 100644 --- a/core/input/input_event.cpp +++ b/core/input/input_event.cpp @@ -131,6 +131,7 @@ void InputEventFromWindow::_bind_methods() { void InputEventFromWindow::set_window_id(int64_t p_id) { window_id = p_id; } + int64_t InputEventFromWindow::get_window_id() const { return window_id; } @@ -148,6 +149,7 @@ bool InputEventWithModifiers::get_shift() const { void InputEventWithModifiers::set_alt(bool p_enabled) { alt = p_enabled; } + bool InputEventWithModifiers::get_alt() const { return alt; } @@ -155,6 +157,7 @@ bool InputEventWithModifiers::get_alt() const { void InputEventWithModifiers::set_control(bool p_enabled) { control = p_enabled; } + bool InputEventWithModifiers::get_control() const { return control; } @@ -162,6 +165,7 @@ bool InputEventWithModifiers::get_control() const { void InputEventWithModifiers::set_metakey(bool p_enabled) { meta = p_enabled; } + bool InputEventWithModifiers::get_metakey() const { return meta; } @@ -169,6 +173,7 @@ bool InputEventWithModifiers::get_metakey() const { void InputEventWithModifiers::set_command(bool p_enabled) { command = p_enabled; } + bool InputEventWithModifiers::get_command() const { return command; } @@ -359,6 +364,7 @@ void InputEventKey::_bind_methods() { void InputEventMouse::set_button_mask(int p_mask) { button_mask = p_mask; } + int InputEventMouse::get_button_mask() const { return button_mask; } @@ -366,6 +372,7 @@ int InputEventMouse::get_button_mask() const { void InputEventMouse::set_position(const Vector2 &p_pos) { pos = p_pos; } + Vector2 InputEventMouse::get_position() const { return pos; } @@ -373,6 +380,7 @@ Vector2 InputEventMouse::get_position() const { void InputEventMouse::set_global_position(const Vector2 &p_global_pos) { global_pos = p_global_pos; } + Vector2 InputEventMouse::get_global_position() const { return global_pos; } @@ -405,6 +413,7 @@ float InputEventMouseButton::get_factor() const { void InputEventMouseButton::set_button_index(int p_index) { button_index = p_index; } + int InputEventMouseButton::get_button_index() const { return button_index; } @@ -412,6 +421,7 @@ int InputEventMouseButton::get_button_index() const { void InputEventMouseButton::set_pressed(bool p_pressed) { pressed = p_pressed; } + bool InputEventMouseButton::is_pressed() const { return pressed; } @@ -419,6 +429,7 @@ bool InputEventMouseButton::is_pressed() const { void InputEventMouseButton::set_doubleclick(bool p_doubleclick) { doubleclick = p_doubleclick; } + bool InputEventMouseButton::is_doubleclick() const { return doubleclick; } @@ -739,6 +750,7 @@ int InputEventJoypadButton::get_button_index() const { void InputEventJoypadButton::set_pressed(bool p_pressed) { pressed = p_pressed; } + bool InputEventJoypadButton::is_pressed() const { return pressed; } @@ -746,6 +758,7 @@ bool InputEventJoypadButton::is_pressed() const { void InputEventJoypadButton::set_pressure(float p_pressure) { pressure = p_pressure; } + float InputEventJoypadButton::get_pressure() const { return pressure; } @@ -798,6 +811,7 @@ void InputEventJoypadButton::_bind_methods() { void InputEventScreenTouch::set_index(int p_index) { index = p_index; } + int InputEventScreenTouch::get_index() const { return index; } @@ -805,6 +819,7 @@ int InputEventScreenTouch::get_index() const { void InputEventScreenTouch::set_position(const Vector2 &p_pos) { pos = p_pos; } + Vector2 InputEventScreenTouch::get_position() const { return pos; } @@ -812,6 +827,7 @@ Vector2 InputEventScreenTouch::get_position() const { void InputEventScreenTouch::set_pressed(bool p_pressed) { pressed = p_pressed; } + bool InputEventScreenTouch::is_pressed() const { return pressed; } @@ -860,6 +876,7 @@ int InputEventScreenDrag::get_index() const { void InputEventScreenDrag::set_position(const Vector2 &p_pos) { pos = p_pos; } + Vector2 InputEventScreenDrag::get_position() const { return pos; } @@ -867,6 +884,7 @@ Vector2 InputEventScreenDrag::get_position() const { void InputEventScreenDrag::set_relative(const Vector2 &p_relative) { relative = p_relative; } + Vector2 InputEventScreenDrag::get_relative() const { return relative; } @@ -874,6 +892,7 @@ Vector2 InputEventScreenDrag::get_relative() const { void InputEventScreenDrag::set_speed(const Vector2 &p_speed) { speed = p_speed; } + Vector2 InputEventScreenDrag::get_speed() const { return speed; } @@ -922,6 +941,7 @@ void InputEventScreenDrag::_bind_methods() { void InputEventAction::set_action(const StringName &p_action) { action = p_action; } + StringName InputEventAction::get_action() const { return action; } @@ -929,6 +949,7 @@ StringName InputEventAction::get_action() const { void InputEventAction::set_pressed(bool p_pressed) { pressed = p_pressed; } + bool InputEventAction::is_pressed() const { return pressed; } diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index 902d3cde9f..334c8f143e 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -78,6 +78,7 @@ void ConfigFile::set_value(const String &p_section, const String &p_key, const V values[p_section][p_key] = p_value; } } + Variant ConfigFile::get_value(const String &p_section, const String &p_key, Variant p_default) const { if (!values.has(p_section) || !values[p_section].has(p_key)) { ERR_FAIL_COND_V_MSG(p_default.get_type() == Variant::NIL, Variant(), @@ -91,6 +92,7 @@ Variant ConfigFile::get_value(const String &p_section, const String &p_key, Vari bool ConfigFile::has_section(const String &p_section) const { return values.has(p_section); } + bool ConfigFile::has_section_key(const String &p_section, const String &p_key) const { if (!values.has(p_section)) return false; @@ -102,6 +104,7 @@ void ConfigFile::get_sections(List<String> *r_sections) const { r_sections->push_back(E.key()); } } + void ConfigFile::get_section_keys(const String &p_section, List<String> *r_keys) const { ERR_FAIL_COND_MSG(!values.has(p_section), vformat("Cannot get keys from nonexistent section \"%s\".", p_section)); diff --git a/core/io/file_access_compressed.cpp b/core/io/file_access_compressed.cpp index cbb9786af4..422100010c 100644 --- a/core/io/file_access_compressed.cpp +++ b/core/io/file_access_compressed.cpp @@ -132,6 +132,7 @@ Error FileAccessCompressed::_open(const String &p_path, int p_mode_flags) { return OK; } + void FileAccessCompressed::close() { if (!f) return; @@ -221,6 +222,7 @@ void FileAccessCompressed::seek_end(int64_t p_position) { seek(read_total + p_position); } } + size_t FileAccessCompressed::get_position() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); if (writing) { @@ -229,6 +231,7 @@ size_t FileAccessCompressed::get_position() const { return read_block * block_size + read_pos; } } + size_t FileAccessCompressed::get_len() const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); if (writing) { @@ -277,6 +280,7 @@ uint8_t FileAccessCompressed::get_8() const { return ret; } + int FileAccessCompressed::get_buffer(uint8_t *p_dst, int p_length) const { ERR_FAIL_COND_V_MSG(!f, 0, "File must be opened before use."); ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode."); diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index aaf21ad143..ceda6c5eb2 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -113,6 +113,7 @@ Error FileAccessEncrypted::open_and_parse_password(FileAccess *p_base, const Str Error FileAccessEncrypted::_open(const String &p_path, int p_mode_flags) { return OK; } + void FileAccessEncrypted::close() { if (!file) return; @@ -189,9 +190,11 @@ void FileAccessEncrypted::seek(size_t p_position) { void FileAccessEncrypted::seek_end(int64_t p_position) { seek(data.size() + p_position); } + size_t FileAccessEncrypted::get_position() const { return pos; } + size_t FileAccessEncrypted::get_len() const { return data.size(); } @@ -211,6 +214,7 @@ uint8_t FileAccessEncrypted::get_8() const { pos++; return b; } + int FileAccessEncrypted::get_buffer(uint8_t *p_dst, int p_length) const { ERR_FAIL_COND_V_MSG(writing, 0, "File has not been opened in read mode."); diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index 690a2bb269..4b7f99e5b0 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -300,6 +300,7 @@ void FileAccessNetwork::close() { opened = false; nc->unlock_mutex(); } + bool FileAccessNetwork::is_open() const { return opened; } @@ -318,10 +319,12 @@ void FileAccessNetwork::seek(size_t p_position) { void FileAccessNetwork::seek_end(int64_t p_position) { seek(total_size + p_position); } + size_t FileAccessNetwork::get_position() const { ERR_FAIL_COND_V_MSG(!opened, 0, "File must be opened before use."); return pos; } + size_t FileAccessNetwork::get_len() const { ERR_FAIL_COND_V_MSG(!opened, 0, "File must be opened before use."); return total_size; diff --git a/core/io/file_access_pack.cpp b/core/io/file_access_pack.cpp index 4fd4d117af..bb65a1afbc 100644 --- a/core/io/file_access_pack.cpp +++ b/core/io/file_access_pack.cpp @@ -224,12 +224,15 @@ void FileAccessPack::seek(size_t p_position) { f->seek(pf.offset + p_position); pos = p_position; } + void FileAccessPack::seek_end(int64_t p_position) { seek(pf.size + p_position); } + size_t FileAccessPack::get_position() const { return pos; } + size_t FileAccessPack::get_len() const { return pf.size; } @@ -343,12 +346,15 @@ String DirAccessPack::get_next() { return String(); } } + bool DirAccessPack::current_is_dir() const { return cdir; } + bool DirAccessPack::current_is_hidden() const { return false; } + void DirAccessPack::list_dir_end() { list_dirs.clear(); list_files.clear(); @@ -357,6 +363,7 @@ void DirAccessPack::list_dir_end() { int DirAccessPack::get_drive_count() { return 0; } + String DirAccessPack::get_drive(int p_drive) { return ""; } @@ -440,6 +447,7 @@ Error DirAccessPack::make_dir(String p_dir) { Error DirAccessPack::rename(String p_from, String p_to) { return ERR_UNAVAILABLE; } + Error DirAccessPack::remove(String p_name) { return ERR_UNAVAILABLE; } diff --git a/core/io/multiplayer_api.cpp b/core/io/multiplayer_api.cpp index b819725155..a2f65660f2 100644 --- a/core/io/multiplayer_api.cpp +++ b/core/io/multiplayer_api.cpp @@ -179,6 +179,7 @@ void _profile_node_data(const String &p_what, ObjectID p_id) { EngineDebugger::profiler_add_frame_data("multiplayer", values); } } + void _profile_bandwidth_data(const String &p_inout, int p_size) { if (EngineDebugger::is_profiling("multiplayer")) { Array values; @@ -668,6 +669,7 @@ Error MultiplayerAPI::_encode_and_compress_variant(const Variant &p_variant, uin return OK; } + Error MultiplayerAPI::_decode_and_decompress_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int *r_len) { const uint8_t *buf = p_buffer; int len = p_len; diff --git a/core/io/packet_peer.cpp b/core/io/packet_peer.cpp index 34fb5510b9..fe1c9a2eb1 100644 --- a/core/io/packet_peer.cpp +++ b/core/io/packet_peer.cpp @@ -117,6 +117,7 @@ Variant PacketPeer::_bnd_get_var(bool p_allow_objects) { Error PacketPeer::_put_packet(const Vector<uint8_t> &p_buffer) { return put_packet_buffer(p_buffer); } + Vector<uint8_t> PacketPeer::_get_packet() { Vector<uint8_t> raw; last_get_error = get_packet_buffer(raw); diff --git a/core/io/packet_peer_udp.cpp b/core/io/packet_peer_udp.cpp index 0640d56c47..e36de8c228 100644 --- a/core/io/packet_peer_udp.cpp +++ b/core/io/packet_peer_udp.cpp @@ -291,6 +291,7 @@ Error PacketPeerUDP::_poll() { return OK; } + bool PacketPeerUDP::is_listening() const { return _sock.is_valid() && _sock->is_open(); } diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 77fe331929..230925c29b 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -607,6 +607,7 @@ void ResourceLoaderBinary::set_local_path(const String &p_local_path) { Ref<Resource> ResourceLoaderBinary::get_resource() { return resource; } + Error ResourceLoaderBinary::load() { if (error != OK) return error; @@ -996,6 +997,7 @@ void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String p_extensions->push_back(ext); } } + void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_extensions) const { List<String> extensions; ClassDB::get_resource_base_extensions(&extensions); diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 361f40cbc6..8490cb5627 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -260,6 +260,7 @@ void ResourceLoader::_thread_load_function(void *p_userdata) { thread_load_mutex->unlock(); } + Error ResourceLoader::load_threaded_request(const String &p_path, const String &p_type_hint, bool p_use_sub_threads, const String &p_source_resource) { String local_path; if (p_path.is_rel_path()) @@ -412,6 +413,7 @@ ResourceLoader::ThreadLoadStatus ResourceLoader::load_threaded_get_status(const return status; } + RES ResourceLoader::load_threaded_get(const String &p_path, Error *r_error) { String local_path; if (p_path.is_rel_path()) diff --git a/core/io/stream_peer.cpp b/core/io/stream_peer.cpp index 2e63adcae9..e6175e78da 100644 --- a/core/io/stream_peer.cpp +++ b/core/io/stream_peer.cpp @@ -122,6 +122,7 @@ void StreamPeer::put_u8(uint8_t p_val) { void StreamPeer::put_8(int8_t p_val) { put_data((const uint8_t *)&p_val, 1); } + void StreamPeer::put_u16(uint16_t p_val) { if (big_endian) { p_val = BSWAP16(p_val); @@ -130,6 +131,7 @@ void StreamPeer::put_u16(uint16_t p_val) { encode_uint16(p_val, buf); put_data(buf, 2); } + void StreamPeer::put_16(int16_t p_val) { if (big_endian) { p_val = BSWAP16(p_val); @@ -138,6 +140,7 @@ void StreamPeer::put_16(int16_t p_val) { encode_uint16(p_val, buf); put_data(buf, 2); } + void StreamPeer::put_u32(uint32_t p_val) { if (big_endian) { p_val = BSWAP32(p_val); @@ -146,6 +149,7 @@ void StreamPeer::put_u32(uint32_t p_val) { encode_uint32(p_val, buf); put_data(buf, 4); } + void StreamPeer::put_32(int32_t p_val) { if (big_endian) { p_val = BSWAP32(p_val); @@ -154,6 +158,7 @@ void StreamPeer::put_32(int32_t p_val) { encode_uint32(p_val, buf); put_data(buf, 4); } + void StreamPeer::put_u64(uint64_t p_val) { if (big_endian) { p_val = BSWAP64(p_val); @@ -162,6 +167,7 @@ void StreamPeer::put_u64(uint64_t p_val) { encode_uint64(p_val, buf); put_data(buf, 8); } + void StreamPeer::put_64(int64_t p_val) { if (big_endian) { p_val = BSWAP64(p_val); @@ -170,6 +176,7 @@ void StreamPeer::put_64(int64_t p_val) { encode_uint64(p_val, buf); put_data(buf, 8); } + void StreamPeer::put_float(float p_val) { uint8_t buf[4]; @@ -181,6 +188,7 @@ void StreamPeer::put_float(float p_val) { put_data(buf, 4); } + void StreamPeer::put_double(double p_val) { uint8_t buf[8]; encode_double(p_val, buf); @@ -190,16 +198,19 @@ void StreamPeer::put_double(double p_val) { } put_data(buf, 8); } + void StreamPeer::put_string(const String &p_string) { CharString cs = p_string.ascii(); put_u32(cs.length()); put_data((const uint8_t *)cs.get_data(), cs.length()); } + void StreamPeer::put_utf8_string(const String &p_string) { CharString cs = p_string.utf8(); put_u32(cs.length()); put_data((const uint8_t *)cs.get_data(), cs.length()); } + void StreamPeer::put_var(const Variant &p_variant, bool p_full_objects) { int len = 0; Vector<uint8_t> buf; @@ -215,11 +226,13 @@ uint8_t StreamPeer::get_u8() { get_data(buf, 1); return buf[0]; } + int8_t StreamPeer::get_8() { uint8_t buf[1]; get_data(buf, 1); return buf[0]; } + uint16_t StreamPeer::get_u16() { uint8_t buf[2]; get_data(buf, 2); @@ -229,6 +242,7 @@ uint16_t StreamPeer::get_u16() { } return r; } + int16_t StreamPeer::get_16() { uint8_t buf[2]; get_data(buf, 2); @@ -238,6 +252,7 @@ int16_t StreamPeer::get_16() { } return r; } + uint32_t StreamPeer::get_u32() { uint8_t buf[4]; get_data(buf, 4); @@ -247,6 +262,7 @@ uint32_t StreamPeer::get_u32() { } return r; } + int32_t StreamPeer::get_32() { uint8_t buf[4]; get_data(buf, 4); @@ -256,6 +272,7 @@ int32_t StreamPeer::get_32() { } return r; } + uint64_t StreamPeer::get_u64() { uint8_t buf[8]; get_data(buf, 8); @@ -265,6 +282,7 @@ uint64_t StreamPeer::get_u64() { } return r; } + int64_t StreamPeer::get_64() { uint8_t buf[8]; get_data(buf, 8); @@ -274,6 +292,7 @@ int64_t StreamPeer::get_64() { } return r; } + float StreamPeer::get_float() { uint8_t buf[4]; get_data(buf, 4); @@ -297,6 +316,7 @@ double StreamPeer::get_double() { return decode_double(buf); } + String StreamPeer::get_string(int p_bytes) { if (p_bytes < 0) p_bytes = get_u32(); @@ -310,6 +330,7 @@ String StreamPeer::get_string(int p_bytes) { buf.write[p_bytes] = 0; return buf.ptr(); } + String StreamPeer::get_utf8_string(int p_bytes) { if (p_bytes < 0) p_bytes = get_u32(); @@ -325,6 +346,7 @@ String StreamPeer::get_utf8_string(int p_bytes) { ret.parse_utf8((const char *)buf.ptr(), buf.size()); return ret; } + Variant StreamPeer::get_var(bool p_allow_objects) { int len = get_32(); Vector<uint8_t> var; @@ -382,6 +404,7 @@ void StreamPeer::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "big_endian"), "set_big_endian", "is_big_endian_enabled"); } + //////////////////////////////// void StreamPeerBuffer::_bind_methods() { @@ -455,6 +478,7 @@ void StreamPeerBuffer::seek(int p_pos) { ERR_FAIL_COND(p_pos > data.size()); pointer = p_pos; } + int StreamPeerBuffer::get_size() const { return data.size(); } diff --git a/core/io/translation_loader_po.cpp b/core/io/translation_loader_po.cpp index b47e634a5a..5e109699f5 100644 --- a/core/io/translation_loader_po.cpp +++ b/core/io/translation_loader_po.cpp @@ -190,6 +190,7 @@ void TranslationLoaderPO::get_recognized_extensions(List<String> *p_extensions) p_extensions->push_back("po"); //p_extensions->push_back("mo"); //mo in the future... } + bool TranslationLoaderPO::handles_type(const String &p_type) const { return (p_type == "Translation"); } diff --git a/core/io/xml_parser.cpp b/core/io/xml_parser.cpp index 2926f4c92a..d575e75f0c 100644 --- a/core/io/xml_parser.cpp +++ b/core/io/xml_parser.cpp @@ -390,6 +390,7 @@ Error XMLParser::read() { XMLParser::NodeType XMLParser::get_node_type() { return node_type; } + String XMLParser::get_node_data() const { ERR_FAIL_COND_V(node_type != NODE_TEXT, ""); return node_name; @@ -399,17 +400,21 @@ String XMLParser::get_node_name() const { ERR_FAIL_COND_V(node_type == NODE_TEXT, ""); return node_name; } + int XMLParser::get_attribute_count() const { return attributes.size(); } + String XMLParser::get_attribute_name(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, attributes.size(), ""); return attributes[p_idx].name; } + String XMLParser::get_attribute_value(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, attributes.size(), ""); return attributes[p_idx].value; } + bool XMLParser::has_attribute(const String &p_name) const { for (int i = 0; i < attributes.size(); i++) { if (attributes[i].name == p_name) @@ -418,6 +423,7 @@ bool XMLParser::has_attribute(const String &p_name) const { return false; } + String XMLParser::get_attribute_value(const String &p_name) const { int idx = -1; for (int i = 0; i < attributes.size(); i++) { @@ -445,6 +451,7 @@ String XMLParser::get_attribute_value_safe(const String &p_name) const { return ""; return attributes[idx].value; } + bool XMLParser::is_empty() const { return node_empty; } @@ -526,6 +533,7 @@ XMLParser::XMLParser() { special_characters.push_back("\"quot;"); special_characters.push_back("'apos;"); } + XMLParser::~XMLParser() { if (data) memdelete_arr(data); diff --git a/core/math/aabb.cpp b/core/math/aabb.cpp index 588ee84f58..d9cb928944 100644 --- a/core/math/aabb.cpp +++ b/core/math/aabb.cpp @@ -39,6 +39,7 @@ real_t AABB::get_area() const { bool AABB::operator==(const AABB &p_rval) const { return ((position == p_rval.position) && (size == p_rval.size)); } + bool AABB::operator!=(const AABB &p_rval) const { return ((position != p_rval.position) || (size != p_rval.size)); } @@ -238,6 +239,7 @@ Vector3 AABB::get_longest_axis() const { return axis; } + int AABB::get_longest_axis_index() const { int axis = 0; real_t max_size = size.x; @@ -269,6 +271,7 @@ Vector3 AABB::get_shortest_axis() const { return axis; } + int AABB::get_shortest_axis_index() const { int axis = 0; real_t max_size = size.x; @@ -290,11 +293,13 @@ AABB AABB::merge(const AABB &p_with) const { aabb.merge_with(p_with); return aabb; } + AABB AABB::expand(const Vector3 &p_vector) const { AABB aabb = *this; aabb.expand_to(p_vector); return aabb; } + AABB AABB::grow(real_t p_by) const { AABB aabb = *this; aabb.grow_by(p_by); diff --git a/core/math/basis.cpp b/core/math/basis.cpp index e6bf6110f7..9981b673ed 100644 --- a/core/math/basis.cpp +++ b/core/math/basis.cpp @@ -327,6 +327,7 @@ void Basis::rotate_local(const Vector3 &p_axis, real_t p_phi) { // M -> (M.R.Minv).M = M.R. *this = rotated_local(p_axis, p_phi); } + Basis Basis::rotated_local(const Vector3 &p_axis, real_t p_phi) const { return (*this) * Basis(p_axis, p_phi); } diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp index 4b147bd987..c7a3918fe5 100644 --- a/core/math/camera_matrix.cpp +++ b/core/math/camera_matrix.cpp @@ -238,6 +238,7 @@ real_t CameraMatrix::get_z_far() const { return new_plane.d; } + real_t CameraMatrix::get_z_near() const { const real_t *matrix = (const real_t *)this->matrix; Plane new_plane = Plane(matrix[3] + matrix[2], diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index 3085997225..f1676ec152 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -51,6 +51,7 @@ bool Geometry::is_point_in_polygon(const Vector2 &p_point, const Vector<Vector2> } return false; } + */ void Geometry::MeshData::optimize_vertices() { diff --git a/core/math/octree.h b/core/math/octree.h index 0782a39804..067103112d 100644 --- a/core/math/octree.h +++ b/core/math/octree.h @@ -1218,6 +1218,7 @@ void Octree<T, use_pairs, AL>::set_pair_callback(PairCallback p_callback, void * pair_callback = p_callback; pair_callback_userdata = p_userdata; } + template <class T, bool use_pairs, class AL> void Octree<T, use_pairs, AL>::set_unpair_callback(UnpairCallback p_callback, void *p_userdata) { unpair_callback = p_callback; diff --git a/core/math/transform.cpp b/core/math/transform.cpp index 0f62c8b2c0..0274dd18af 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -145,6 +145,7 @@ void Transform::scale_basis(const Vector3 &p_scale) { void Transform::translate(real_t p_tx, real_t p_ty, real_t p_tz) { translate(Vector3(p_tx, p_ty, p_tz)); } + void Transform::translate(const Vector3 &p_translation) { for (int i = 0; i < 3; i++) { origin[i] += basis[i].dot(p_translation); @@ -174,6 +175,7 @@ bool Transform::is_equal_approx(const Transform &p_transform) const { bool Transform::operator==(const Transform &p_transform) const { return (basis == p_transform.basis && origin == p_transform.origin); } + bool Transform::operator!=(const Transform &p_transform) const { return (basis != p_transform.basis || origin != p_transform.origin); } diff --git a/core/math/transform.h b/core/math/transform.h index 7f7e9ce833..71847d36ac 100644 --- a/core/math/transform.h +++ b/core/math/transform.h @@ -117,6 +117,7 @@ _FORCE_INLINE_ Vector3 Transform::xform(const Vector3 &p_vector) const { basis[1].dot(p_vector) + origin.y, basis[2].dot(p_vector) + origin.z); } + _FORCE_INLINE_ Vector3 Transform::xform_inv(const Vector3 &p_vector) const { Vector3 v = p_vector - origin; @@ -138,6 +139,7 @@ _FORCE_INLINE_ Plane Transform::xform(const Plane &p_plane) const { return Plane(normal, d); } + _FORCE_INLINE_ Plane Transform::xform_inv(const Plane &p_plane) const { Vector3 point = p_plane.normal * p_plane.d; Vector3 point_dir = point + p_plane.normal; diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp index f82d1d99c4..eecfc862f5 100644 --- a/core/math/transform_2d.cpp +++ b/core/math/transform_2d.cpp @@ -123,15 +123,18 @@ void Transform2D::scale(const Size2 &p_scale) { scale_basis(p_scale); elements[2] *= p_scale; } + void Transform2D::scale_basis(const Size2 &p_scale) { elements[0][0] *= p_scale.x; elements[0][1] *= p_scale.y; elements[1][0] *= p_scale.x; elements[1][1] *= p_scale.y; } + void Transform2D::translate(real_t p_tx, real_t p_ty) { translate(Vector2(p_tx, p_ty)); } + void Transform2D::translate(const Vector2 &p_translation) { elements[2] += basis_xform(p_translation); } diff --git a/core/math/transform_2d.h b/core/math/transform_2d.h index 66958257d7..46e97abaa7 100644 --- a/core/math/transform_2d.h +++ b/core/math/transform_2d.h @@ -153,6 +153,7 @@ Vector2 Transform2D::xform(const Vector2 &p_vec) const { tdoty(p_vec)) + elements[2]; } + Vector2 Transform2D::xform_inv(const Vector2 &p_vec) const { Vector2 v = p_vec - elements[2]; @@ -160,6 +161,7 @@ Vector2 Transform2D::xform_inv(const Vector2 &p_vec) const { elements[0].dot(v), elements[1].dot(v)); } + Rect2 Transform2D::xform(const Rect2 &p_rect) const { Vector2 x = elements[0] * p_rect.size.x; Vector2 y = elements[1] * p_rect.size.y; diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp index d06f64b40b..7f264ce119 100644 --- a/core/math/vector2.cpp +++ b/core/math/vector2.cpp @@ -192,13 +192,16 @@ bool Vector2::is_equal_approx(const Vector2 &p_v) const { Vector2i Vector2i::operator+(const Vector2i &p_v) const { return Vector2i(x + p_v.x, y + p_v.y); } + void Vector2i::operator+=(const Vector2i &p_v) { x += p_v.x; y += p_v.y; } + Vector2i Vector2i::operator-(const Vector2i &p_v) const { return Vector2i(x - p_v.x, y - p_v.y); } + void Vector2i::operator-=(const Vector2i &p_v) { x -= p_v.x; y -= p_v.y; @@ -236,6 +239,7 @@ Vector2i Vector2i::operator-() const { bool Vector2i::operator==(const Vector2i &p_vec2) const { return x == p_vec2.x && y == p_vec2.y; } + bool Vector2i::operator!=(const Vector2i &p_vec2) const { return x != p_vec2.x || y != p_vec2.y; } diff --git a/core/math/vector2.h b/core/math/vector2.h index 5aa40d45f7..e5774f1d55 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -157,13 +157,16 @@ _FORCE_INLINE_ Vector2 operator*(real_t p_scalar, const Vector2 &p_vec) { _FORCE_INLINE_ Vector2 Vector2::operator+(const Vector2 &p_v) const { return Vector2(x + p_v.x, y + p_v.y); } + _FORCE_INLINE_ void Vector2::operator+=(const Vector2 &p_v) { x += p_v.x; y += p_v.y; } + _FORCE_INLINE_ Vector2 Vector2::operator-(const Vector2 &p_v) const { return Vector2(x - p_v.x, y - p_v.y); } + _FORCE_INLINE_ void Vector2::operator-=(const Vector2 &p_v) { x -= p_v.x; y -= p_v.y; @@ -201,6 +204,7 @@ _FORCE_INLINE_ Vector2 Vector2::operator-() const { _FORCE_INLINE_ bool Vector2::operator==(const Vector2 &p_vec2) const { return x == p_vec2.x && y == p_vec2.y; } + _FORCE_INLINE_ bool Vector2::operator!=(const Vector2 &p_vec2) const { return x != p_vec2.x || y != p_vec2.y; } diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp index 8acbe31f35..4a9b251406 100644 --- a/core/math/vector3.cpp +++ b/core/math/vector3.cpp @@ -46,6 +46,7 @@ void Vector3::set_axis(int p_axis, real_t p_value) { ERR_FAIL_INDEX(p_axis, 3); coord[p_axis] = p_value; } + real_t Vector3::get_axis(int p_axis) const { ERR_FAIL_INDEX_V(p_axis, 3, 0); return operator[](p_axis); @@ -54,6 +55,7 @@ real_t Vector3::get_axis(int p_axis) const { int Vector3::min_axis() const { return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2); } + int Vector3::max_axis() const { return x < y ? (y < z ? 2 : 1) : (x < z ? 2 : 0); } @@ -63,6 +65,7 @@ void Vector3::snap(Vector3 p_val) { y = Math::stepify(y, p_val.y); z = Math::stepify(z, p_val.z); } + Vector3 Vector3::snapped(Vector3 p_val) const { Vector3 v = *this; v.snap(p_val); diff --git a/core/math/vector3.h b/core/math/vector3.h index 5fc412628f..3e35a5bba2 100644 --- a/core/math/vector3.h +++ b/core/math/vector3.h @@ -256,6 +256,7 @@ Vector3 &Vector3::operator-=(const Vector3 &p_v) { z -= p_v.z; return *this; } + Vector3 Vector3::operator-(const Vector3 &p_v) const { return Vector3(x - p_v.x, y - p_v.y, z - p_v.z); } @@ -266,6 +267,7 @@ Vector3 &Vector3::operator*=(const Vector3 &p_v) { z *= p_v.z; return *this; } + Vector3 Vector3::operator*(const Vector3 &p_v) const { return Vector3(x * p_v.x, y * p_v.y, z * p_v.z); } diff --git a/core/math/vector3i.cpp b/core/math/vector3i.cpp index e621d5493a..718a1553a0 100644 --- a/core/math/vector3i.cpp +++ b/core/math/vector3i.cpp @@ -34,6 +34,7 @@ void Vector3i::set_axis(int p_axis, int32_t p_value) { ERR_FAIL_INDEX(p_axis, 3); coord[p_axis] = p_value; } + int32_t Vector3i::get_axis(int p_axis) const { ERR_FAIL_INDEX_V(p_axis, 3, 0); return operator[](p_axis); @@ -42,6 +43,7 @@ int32_t Vector3i::get_axis(int p_axis) const { int Vector3i::min_axis() const { return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2); } + int Vector3i::max_axis() const { return x < y ? (y < z ? 2 : 1) : (x < z ? 2 : 0); } diff --git a/core/math/vector3i.h b/core/math/vector3i.h index 5ecd3228b2..524f45b452 100644 --- a/core/math/vector3i.h +++ b/core/math/vector3i.h @@ -132,6 +132,7 @@ Vector3i &Vector3i::operator-=(const Vector3i &p_v) { z -= p_v.z; return *this; } + Vector3i Vector3i::operator-(const Vector3i &p_v) const { return Vector3i(x - p_v.x, y - p_v.y, z - p_v.z); } @@ -142,6 +143,7 @@ Vector3i &Vector3i::operator*=(const Vector3i &p_v) { z *= p_v.z; return *this; } + Vector3i Vector3i::operator*(const Vector3i &p_v) const { return Vector3i(x * p_v.x, y * p_v.y, z * p_v.z); } diff --git a/core/message_queue.cpp b/core/message_queue.cpp index 4de4c48578..36914de0ba 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -118,6 +118,7 @@ Error MessageQueue::push_call(Object *p_object, const StringName &p_method, VARI Error MessageQueue::push_notification(Object *p_object, int p_notification) { return push_notification(p_object->get_instance_id(), p_notification); } + Error MessageQueue::push_set(Object *p_object, const StringName &p_prop, const Variant &p_value) { return push_set(p_object->get_instance_id(), p_prop, p_value); } diff --git a/core/method_bind.cpp b/core/method_bind.cpp index 610111a3e8..a88e6e21b0 100644 --- a/core/method_bind.cpp +++ b/core/method_bind.cpp @@ -59,6 +59,7 @@ void MethodBind::_set_returns(bool p_returns) { StringName MethodBind::get_name() const { return name; } + void MethodBind::set_name(const StringName &p_name) { name = p_name; } @@ -67,6 +68,7 @@ void MethodBind::set_name(const StringName &p_name) { void MethodBind::set_argument_names(const Vector<StringName> &p_names) { arg_names = p_names; } + Vector<StringName> MethodBind::get_argument_names() const { return arg_names; } diff --git a/core/node_path.cpp b/core/node_path.cpp index 0e4f2eeaf0..fd28815704 100644 --- a/core/node_path.cpp +++ b/core/node_path.cpp @@ -62,12 +62,14 @@ bool NodePath::is_absolute() const { return data->absolute; } + int NodePath::get_name_count() const { if (!data) return 0; return data->path.size(); } + StringName NodePath::get_name(int p_idx) const { ERR_FAIL_COND_V(!data, StringName()); ERR_FAIL_INDEX_V(p_idx, data->path.size(), StringName()); @@ -80,6 +82,7 @@ int NodePath::get_subname_count() const { return data->subpath.size(); } + StringName NodePath::get_subname(int p_idx) const { ERR_FAIL_COND_V(!data, StringName()); ERR_FAIL_INDEX_V(p_idx, data->subpath.size(), StringName()); @@ -133,6 +136,7 @@ bool NodePath::operator==(const NodePath &p_path) const { return true; } + bool NodePath::operator!=(const NodePath &p_path) const { return (!(*this == p_path)); } diff --git a/core/object.cpp b/core/object.cpp index 50bf7d4d28..64b519f1b9 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -160,11 +160,13 @@ MethodInfo::MethodInfo(const String &p_name) : name(p_name), flags(METHOD_FLAG_NORMAL) { } + MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1) : name(p_name), flags(METHOD_FLAG_NORMAL) { arguments.push_back(p_param1); } + MethodInfo::MethodInfo(const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2) : name(p_name), flags(METHOD_FLAG_NORMAL) { @@ -209,12 +211,14 @@ MethodInfo::MethodInfo(Variant::Type ret, const String &p_name) : flags(METHOD_FLAG_NORMAL) { return_val.type = ret; } + MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1) : name(p_name), flags(METHOD_FLAG_NORMAL) { return_val.type = ret; arguments.push_back(p_param1); } + MethodInfo::MethodInfo(Variant::Type ret, const String &p_name, const PropertyInfo &p_param1, const PropertyInfo &p_param2) : name(p_name), flags(METHOD_FLAG_NORMAL) { @@ -320,6 +324,7 @@ bool Object::Connection::operator<(const Connection &p_conn) const { return signal < p_conn.signal; } } + Object::Connection::Connection(const Variant &p_variant) { Dictionary d = p_variant; if (d.has("signal")) @@ -349,6 +354,7 @@ void Object::_postinitialize() { void Object::get_valid_parents_static(List<String> *p_parents) { } + void Object::_get_valid_parents_static(List<String> *p_parents) { } @@ -739,6 +745,7 @@ Variant Object::getvar(const Variant &p_key, bool *r_valid) const { *r_valid = false; return Variant(); } + void Object::setvar(const Variant &p_key, const Variant &p_value, bool *r_valid) { if (r_valid) *r_valid = false; @@ -997,6 +1004,7 @@ Vector<String> Object::_get_meta_list_bind() const { return _metaret; } + void Object::get_meta_list(List<String> *p_list) const { List<Variant> keys; metadata.get_key_list(&keys); @@ -1318,6 +1326,7 @@ void Object::get_signals_connected_to_this(List<Connection> *p_connections) cons Error Object::connect_compat(const StringName &p_signal, Object *p_to_object, const StringName &p_to_method, const Vector<Variant> &p_binds, uint32_t p_flags) { return connect(p_signal, Callable(p_to_object, p_to_method), p_binds, p_flags); } + Error Object::connect(const StringName &p_signal, const Callable &p_callable, const Vector<Variant> &p_binds, uint32_t p_flags) { ERR_FAIL_COND_V(p_callable.is_null(), ERR_INVALID_PARAMETER); diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index 520968c9a9..5763c74862 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -45,6 +45,7 @@ String DirAccess::_get_root_path() const { return ""; } } + String DirAccess::_get_root_string() const { switch (_access_type) { case ACCESS_RESOURCES: diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index f31842bcae..8b13e53812 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -170,6 +170,7 @@ uint16_t FileAccess::get_16() const { return res; } + uint32_t FileAccess::get_32() const { uint32_t res; uint16_t a, b; @@ -187,6 +188,7 @@ uint32_t FileAccess::get_32() const { return res; } + uint64_t FileAccess::get_64() const { uint64_t res; uint32_t a, b; @@ -394,6 +396,7 @@ void FileAccess::store_16(uint16_t p_dest) { store_8(a); store_8(b); } + void FileAccess::store_32(uint32_t p_dest) { uint16_t a, b; @@ -407,6 +410,7 @@ void FileAccess::store_32(uint32_t p_dest) { store_16(a); store_16(b); } + void FileAccess::store_64(uint64_t p_dest) { uint32_t a, b; diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index 7c00af8d1f..1ce49b544b 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -65,12 +65,14 @@ void MainLoop::init() { if (get_script_instance()) get_script_instance()->call("_initialize"); } + bool MainLoop::iteration(float p_time) { if (get_script_instance()) return get_script_instance()->call("_iteration", p_time); return false; } + bool MainLoop::idle(float p_time) { if (get_script_instance()) return get_script_instance()->call("_idle", p_time); diff --git a/core/os/os.cpp b/core/os/os.cpp index 02d1dfe895..4414b582bd 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -82,15 +82,18 @@ String OS::get_iso_date_time(bool local) const { uint64_t OS::get_splash_tick_msec() const { return _msec_splash; } + uint64_t OS::get_unix_time() const { return 0; }; uint64_t OS::get_system_time_secs() const { return 0; } + uint64_t OS::get_system_time_msecs() const { return 0; } + void OS::debug_break(){ // something @@ -224,6 +227,7 @@ bool OS::is_no_window_mode_enabled() const { int OS::get_exit_code() const { return _exit_code; } + void OS::set_exit_code(int p_code) { _exit_code = p_code; } diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index b8f83f96a5..cbaf7e883b 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -329,6 +329,7 @@ Variant PackedDataContainer::_iter_init(const Array &p_iter) { Variant PackedDataContainer::_iter_next(const Array &p_iter) { return _iter_next_ofs(p_iter, 0); } + Variant PackedDataContainer::_iter_get(const Variant &p_iter) { return _iter_get_ofs(p_iter, 0); } @@ -354,6 +355,7 @@ Variant PackedDataContainerRef::_iter_init(const Array &p_iter) { Variant PackedDataContainerRef::_iter_next(const Array &p_iter) { return from->_iter_next_ofs(p_iter, offset); } + Variant PackedDataContainerRef::_iter_get(const Variant &p_iter) { return from->_iter_get_ofs(p_iter, offset); } diff --git a/core/pool_allocator.cpp b/core/pool_allocator.cpp index 20b5edd412..63fd1d7bd1 100644 --- a/core/pool_allocator.cpp +++ b/core/pool_allocator.cpp @@ -491,6 +491,7 @@ void *PoolAllocator::get(ID p_mem) { return ptr; } + void PoolAllocator::unlock(ID p_mem) { if (!needs_locking) return; diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 42440c8085..fee9423a5e 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -114,6 +114,7 @@ void ProjectSettings::set_initial_value(const String &p_name, const Variant &p_v ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + "."); props[p_name].initial = p_value; } + void ProjectSettings::set_restart_if_changed(const String &p_name, bool p_restart) { ERR_FAIL_COND_MSG(!props.has(p_name), "Request for nonexistent project setting: " + p_name + "."); props[p_name].restart_if_changed = p_restart; @@ -181,6 +182,7 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) { return true; } + bool ProjectSettings::_get(const StringName &p_name, Variant &r_ret) const { _THREAD_SAFE_METHOD_ diff --git a/core/resource.cpp b/core/resource.cpp index 0d8a223b78..7d0e29d664 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -105,6 +105,7 @@ void Resource::set_name(const String &p_name) { name = p_name; _change_notify("resource_name"); } + String Resource::get_name() const { return name; } @@ -444,6 +445,7 @@ bool ResourceCache::has(const String &p_path) { return b; } + Resource *ResourceCache::get(const String &p_path) { lock->read_lock(); diff --git a/core/script_language.cpp b/core/script_language.cpp index d7287d9532..6e5363e916 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -215,16 +215,20 @@ void ScriptServer::add_global_class(const StringName &p_class, const StringName g.base = p_base; global_classes[p_class] = g; } + void ScriptServer::remove_global_class(const StringName &p_class) { global_classes.erase(p_class); } + bool ScriptServer::is_global_class(const StringName &p_class) { return global_classes.has(p_class); } + StringName ScriptServer::get_global_class_language(const StringName &p_class) { ERR_FAIL_COND_V(!global_classes.has(p_class), StringName()); return global_classes[p_class].language; } + String ScriptServer::get_global_class_path(const String &p_class) { ERR_FAIL_COND_V(!global_classes.has(p_class), String()); return global_classes[p_class].path; @@ -234,6 +238,7 @@ StringName ScriptServer::get_global_class_base(const String &p_class) { ERR_FAIL_COND_V(!global_classes.has(p_class), String()); return global_classes[p_class].base; } + StringName ScriptServer::get_global_class_native_base(const String &p_class) { ERR_FAIL_COND_V(!global_classes.has(p_class), String()); String base = global_classes[p_class].base; @@ -242,6 +247,7 @@ StringName ScriptServer::get_global_class_native_base(const String &p_class) { } return base; } + void ScriptServer::get_global_class_list(List<StringName> *r_global_classes) { const StringName *K = nullptr; List<StringName> classes; @@ -253,6 +259,7 @@ void ScriptServer::get_global_class_list(List<StringName> *r_global_classes) { r_global_classes->push_back(E->get()); } } + void ScriptServer::save_global_classes() { List<StringName> gc; get_global_class_list(&gc); @@ -366,6 +373,7 @@ bool PlaceHolderScriptInstance::set(const StringName &p_name, const Variant &p_v } return false; } + bool PlaceHolderScriptInstance::get(const StringName &p_name, Variant &r_ret) const { if (values.has(p_name)) { r_ret = values[p_name]; @@ -431,6 +439,7 @@ void PlaceHolderScriptInstance::get_method_list(List<MethodInfo> *p_list) const script->get_script_method_list(p_list); } } + bool PlaceHolderScriptInstance::has_method(const StringName &p_method) const { if (script->is_placeholder_fallback_enabled()) return false; diff --git a/core/string_name.cpp b/core/string_name.cpp index 5e6d56e516..7f2da6151e 100644 --- a/core/string_name.cpp +++ b/core/string_name.cpp @@ -334,6 +334,7 @@ StringName StringName::search(const CharType *p_name) { return StringName(); //does not exist } + StringName StringName::search(const String &p_name) { ERR_FAIL_COND_V(p_name == "", StringName()); diff --git a/core/translation.cpp b/core/translation.cpp index a33cd48b88..2eaccc6c4e 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -851,6 +851,7 @@ void Translation::set_locale(const String &p_locale) { void Translation::add_message(const StringName &p_src_text, const StringName &p_xlated_text) { translation_map[p_src_text] = p_xlated_text; } + StringName Translation::get_message(const StringName &p_src_text) const { const Map<StringName, StringName>::Element *E = translation_map.find(p_src_text); if (!E) @@ -1011,6 +1012,7 @@ Vector<String> TranslationServer::get_all_locale_names() { void TranslationServer::add_translation(const Ref<Translation> &p_translation) { translations.insert(p_translation); } + void TranslationServer::remove_translation(const Ref<Translation> &p_translation) { translations.erase(p_translation); } diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index da7c0ac248..d1a71a6b64 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -136,6 +136,7 @@ void UndoRedo::add_undo_method(Object *p_object, const StringName &p_method, VAR } actions.write[current_action + 1].undo_ops.push_back(undo_op); } + void UndoRedo::add_do_property(Object *p_object, const StringName &p_property, const Variant &p_value) { ERR_FAIL_COND(p_object == nullptr); ERR_FAIL_COND(action_level <= 0); @@ -150,6 +151,7 @@ void UndoRedo::add_do_property(Object *p_object, const StringName &p_property, c do_op.args[0] = p_value; actions.write[current_action + 1].do_ops.push_back(do_op); } + void UndoRedo::add_undo_property(Object *p_object, const StringName &p_property, const Variant &p_value) { ERR_FAIL_COND(p_object == nullptr); ERR_FAIL_COND(action_level <= 0); @@ -169,6 +171,7 @@ void UndoRedo::add_undo_property(Object *p_object, const StringName &p_property, undo_op.args[0] = p_value; actions.write[current_action + 1].undo_ops.push_back(undo_op); } + void UndoRedo::add_do_reference(Object *p_object) { ERR_FAIL_COND(p_object == nullptr); ERR_FAIL_COND(action_level <= 0); @@ -181,6 +184,7 @@ void UndoRedo::add_do_reference(Object *p_object) { do_op.type = Operation::TYPE_REFERENCE; actions.write[current_action + 1].do_ops.push_back(do_op); } + void UndoRedo::add_undo_reference(Object *p_object) { ERR_FAIL_COND(p_object == nullptr); ERR_FAIL_COND(action_level <= 0); diff --git a/core/ustring.cpp b/core/ustring.cpp index 249a61f3f9..a1a2280066 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -247,6 +247,7 @@ String String::operator+(CharType p_chr) const { res+=p_chr; return res; } + */ String &String::operator+=(const String &p_str) { if (empty()) { @@ -607,6 +608,7 @@ String String::get_with_code_lines() const { } return ret; } + int String::get_slice_count(String p_splitter) const { if (empty()) return 0; @@ -959,6 +961,7 @@ String String::chr(CharType p_char) { CharType c[2] = { p_char, 0 }; return String(c); } + String String::num(double p_num, int p_decimals) { #ifndef NO_USE_STDLIB @@ -1522,6 +1525,7 @@ String::String(CharType p_char) { shared=nullptr; copy_from(p_char); } + */ String::String(const char *p_str) { @@ -2073,6 +2077,7 @@ String operator+(const char *p_chr, const String &p_str) { tmp += p_str; return tmp; } + String operator+(CharType p_chr, const String &p_str) { return (String::chr(p_chr) + p_str); } @@ -2217,6 +2222,7 @@ String String::insert(int p_at_pos, const String &p_string) const { return pre + p_string + post; } + String String::substr(int p_from, int p_chars) const { if (p_chars == -1) p_chars = length() - p_from; @@ -2467,6 +2473,7 @@ int String::rfind(const String &p_str, int p_from) const { return -1; } + int String::rfindn(const String &p_str, int p_from) const { // establish a limit int limit = length() - p_str.length(); @@ -2540,6 +2547,7 @@ bool String::begins_with(const String &p_string) const { // only if i == l the p_string matches the beginning return i == l; } + bool String::begins_with(const char *p_string) const { int l = length(); if (l == 0 || !p_string) @@ -2846,6 +2854,7 @@ String String::replace_first(const String &p_key, const String &p_with) const { return *this; } + String String::replacen(const String &p_key, const String &p_with) const { String new_string; int search_from = 0; @@ -3110,6 +3119,7 @@ String String::humanize_size(uint64_t p_size) { return String::num(p_size / divisor).pad_decimals(digits) + " " + prefixes[prefix_idx]; } + bool String::is_abs_path() const { if (length() > 1) return (operator[](0) == '/' || operator[](0) == '\\' || find(":/") != -1 || find(":\\") != -1); @@ -3742,6 +3752,7 @@ String String::percent_encode() const { return encoded; } + String String::percent_decode() const { CharString pe; @@ -3824,6 +3835,7 @@ String String::rpad(int min_length, const String &character) const { return s; } + // Left-pad with a character. String String::lpad(int min_length, const String &character) const { String s = *this; diff --git a/core/variant.cpp b/core/variant.cpp index b2bb7fe309..1098d031e5 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -1374,6 +1374,7 @@ Variant::operator signed int() const { } } } + Variant::operator unsigned int() const { switch (type) { case NIL: @@ -1517,6 +1518,7 @@ Variant::operator signed short() const { } } } + Variant::operator unsigned short() const { switch (type) { case NIL: @@ -1534,6 +1536,7 @@ Variant::operator unsigned short() const { } } } + Variant::operator signed char() const { switch (type) { case NIL: @@ -1551,6 +1554,7 @@ Variant::operator signed char() const { } } } + Variant::operator unsigned char() const { switch (type) { case NIL: @@ -1590,6 +1594,7 @@ Variant::operator float() const { } } } + Variant::operator double() const { switch (type) { case NIL: @@ -1935,6 +1940,7 @@ Variant::operator Plane() const { else return Plane(); } + Variant::operator ::AABB() const { if (type == AABB) return *_data._aabb; @@ -2077,6 +2083,7 @@ Variant::operator Node *() const { else return nullptr; } + Variant::operator Control *() const { if (type == OBJECT) return Object::cast_to<Control>(_get_obj().obj); @@ -2169,12 +2176,14 @@ Variant::operator Vector<uint8_t>() const { else return _convert_array_from_variant<Vector<uint8_t>>(*this); } + Variant::operator Vector<int32_t>() const { if (type == PACKED_INT32_ARRAY) return static_cast<PackedArrayRef<int32_t> *>(_data.packed_array)->array; else return _convert_array_from_variant<Vector<int>>(*this); } + Variant::operator Vector<int64_t>() const { if (type == PACKED_INT64_ARRAY) return static_cast<PackedArrayRef<int64_t> *>(_data.packed_array)->array; @@ -2202,12 +2211,14 @@ Variant::operator Vector<String>() const { else return _convert_array_from_variant<Vector<String>>(*this); } + Variant::operator Vector<Vector3>() const { if (type == PACKED_VECTOR3_ARRAY) return static_cast<PackedArrayRef<Vector3> *>(_data.packed_array)->array; else return _convert_array_from_variant<Vector<Vector3>>(*this); } + Variant::operator Vector<Vector2>() const { if (type == PACKED_VECTOR2_ARRAY) return static_cast<PackedArrayRef<Vector2> *>(_data.packed_array)->array; @@ -2280,6 +2291,7 @@ Variant::operator Vector<Variant>() const { return variants; } + Variant::operator Vector<StringName>() const { Vector<String> from = operator Vector<String>(); Vector<StringName> to; @@ -2294,6 +2306,7 @@ Variant::operator Vector<StringName>() const { Variant::operator Margin() const { return (Margin) operator int(); } + Variant::operator Orientation() const { return (Orientation) operator int(); } @@ -2326,6 +2339,7 @@ Variant::Variant(signed int p_int) { type = INT; _data._int = p_int; } + Variant::Variant(unsigned int p_int) { type = INT; _data._int = p_int; @@ -2337,6 +2351,7 @@ Variant::Variant(signed long p_int) { type = INT; _data._int = p_int; } + Variant::Variant(unsigned long p_int) { type = INT; _data._int = p_int; @@ -2357,22 +2372,27 @@ Variant::Variant(signed short p_short) { type = INT; _data._int = p_short; } + Variant::Variant(unsigned short p_short) { type = INT; _data._int = p_short; } + Variant::Variant(signed char p_char) { type = INT; _data._int = p_char; } + Variant::Variant(unsigned char p_char) { type = INT; _data._int = p_char; } + Variant::Variant(float p_float) { type = FLOAT; _data._float = p_float; } + Variant::Variant(double p_double) { type = FLOAT; _data._float = p_double; @@ -2387,6 +2407,7 @@ Variant::Variant(const StringName &p_string) { type = STRING_NAME; memnew_placement(_data._mem, StringName(p_string)); } + Variant::Variant(const String &p_string) { type = STRING; memnew_placement(_data._mem, String(p_string)); @@ -2401,10 +2422,12 @@ Variant::Variant(const CharType *p_wstring) { type = STRING; memnew_placement(_data._mem, String(p_wstring)); } + Variant::Variant(const Vector3 &p_vector3) { type = VECTOR3; memnew_placement(_data._mem, Vector3(p_vector3)); } + Variant::Variant(const Vector3i &p_vector3i) { type = VECTOR3I; memnew_placement(_data._mem, Vector3i(p_vector3i)); @@ -2434,6 +2457,7 @@ Variant::Variant(const Plane &p_plane) { type = PLANE; memnew_placement(_data._mem, Plane(p_plane)); } + Variant::Variant(const ::AABB &p_aabb) { type = AABB; _data._aabb = memnew(::AABB(p_aabb)); @@ -2448,6 +2472,7 @@ Variant::Variant(const Quat &p_quat) { type = QUAT; memnew_placement(_data._mem, Quat(p_quat)); } + Variant::Variant(const Transform &p_transform) { type = TRANSFORM; _data._transform = memnew(Transform(p_transform)); @@ -2457,6 +2482,7 @@ Variant::Variant(const Transform2D &p_transform) { type = TRANSFORM2D; _data._transform2d = memnew(Transform2D(p_transform)); } + Variant::Variant(const Color &p_color) { type = COLOR; memnew_placement(_data._mem, Color(p_color)); @@ -2499,6 +2525,7 @@ Variant::Variant(const Callable &p_callable) { type = CALLABLE; memnew_placement(_data._mem, Callable(p_callable)); } + Variant::Variant(const Signal &p_callable) { type = SIGNAL; memnew_placement(_data._mem, Signal(p_callable)); @@ -2543,6 +2570,7 @@ Variant::Variant(const Vector<uint8_t> &p_byte_array) { _data.packed_array = PackedArrayRef<uint8_t>::create(p_byte_array); } + Variant::Variant(const Vector<int32_t> &p_int32_array) { type = PACKED_INT32_ARRAY; _data.packed_array = PackedArrayRef<int32_t>::create(p_int32_array); @@ -2567,6 +2595,7 @@ Variant::Variant(const Vector<String> &p_string_array) { type = PACKED_STRING_ARRAY; _data.packed_array = PackedArrayRef<String>::create(p_string_array); } + Variant::Variant(const Vector<Vector3> &p_vector3_array) { type = PACKED_VECTOR3_ARRAY; _data.packed_array = PackedArrayRef<Vector3>::create(p_vector3_array); @@ -2576,6 +2605,7 @@ Variant::Variant(const Vector<Vector2> &p_vector2_array) { type = PACKED_VECTOR2_ARRAY; _data.packed_array = PackedArrayRef<Vector2>::create(p_vector2_array); } + Variant::Variant(const Vector<Color> &p_color_array) { type = PACKED_COLOR_ARRAY; _data.packed_array = PackedArrayRef<Color>::create(p_color_array); @@ -3275,12 +3305,14 @@ Vector<Variant> varray(const Variant &p_arg1) { v.push_back(p_arg1); return v; } + Vector<Variant> varray(const Variant &p_arg1, const Variant &p_arg2) { Vector<Variant> v; v.push_back(p_arg1); v.push_back(p_arg2); return v; } + Vector<Variant> varray(const Variant &p_arg1, const Variant &p_arg2, const Variant &p_arg3) { Vector<Variant> v; v.push_back(p_arg1); @@ -3288,6 +3320,7 @@ Vector<Variant> varray(const Variant &p_arg1, const Variant &p_arg2, const Varia v.push_back(p_arg3); return v; } + Vector<Variant> varray(const Variant &p_arg1, const Variant &p_arg2, const Variant &p_arg3, const Variant &p_arg4) { Vector<Variant> v; v.push_back(p_arg1); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index b7678d8f43..1d75d52db0 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -115,6 +115,7 @@ TYPE(PREFIX, OP, PACKED_VECTOR3_ARRAY), \ TYPE(PREFIX, OP, PACKED_COLOR_ARRAY), \ } + /* clang-format on */ #define CASES(PREFIX) static const void *switch_table_##PREFIX[25][Variant::VARIANT_MAX] = { \ @@ -3536,6 +3537,7 @@ bool Variant::iter_init(Variant &r_iter, bool &valid) const { valid = false; return false; } + bool Variant::iter_next(Variant &r_iter, bool &valid) const { valid = true; switch (type) { diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 0184de46ee..3a38720a27 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -42,6 +42,7 @@ CharType VariantParser::StreamFile::get_char() { bool VariantParser::StreamFile::is_utf8() const { return true; } + bool VariantParser::StreamFile::is_eof() const { return f->eof_reached(); } @@ -62,6 +63,7 @@ CharType VariantParser::StreamString::get_char() { bool VariantParser::StreamString::is_utf8() const { return false; } + bool VariantParser::StreamString::is_eof() const { return pos > s.length(); } |