diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 3 | ||||
-rw-r--r-- | core/class_db.cpp | 13 | ||||
-rw-r--r-- | core/class_db.h | 1 | ||||
-rw-r--r-- | core/image.cpp | 15 | ||||
-rw-r--r-- | core/io/marshalls.cpp | 11 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 3 | ||||
-rw-r--r-- | core/math/audio_frame.h | 9 | ||||
-rw-r--r-- | core/math/basis.cpp | 4 | ||||
-rw-r--r-- | core/math/basis.h | 4 | ||||
-rw-r--r-- | core/math/expression.cpp | 6 | ||||
-rw-r--r-- | core/object.cpp | 3 | ||||
-rw-r--r-- | core/os/file_access.cpp | 32 | ||||
-rw-r--r-- | core/os/file_access.h | 3 | ||||
-rw-r--r-- | core/os/input.cpp | 1 | ||||
-rw-r--r-- | core/os/input.h | 4 | ||||
-rw-r--r-- | core/os/os.cpp | 10 | ||||
-rw-r--r-- | core/os/os.h | 5 | ||||
-rw-r--r-- | core/packed_data_container.cpp | 3 | ||||
-rw-r--r-- | core/project_settings.cpp | 6 | ||||
-rw-r--r-- | core/resource.cpp | 20 | ||||
-rw-r--r-- | core/resource.h | 10 | ||||
-rw-r--r-- | core/ustring.cpp | 18 | ||||
-rw-r--r-- | core/ustring.h | 8 | ||||
-rw-r--r-- | core/variant.cpp | 38 | ||||
-rw-r--r-- | core/variant_call.cpp | 2 | ||||
-rw-r--r-- | core/variant_op.cpp | 12 | ||||
-rw-r--r-- | core/variant_parser.cpp | 3 |
27 files changed, 200 insertions, 47 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 98d3e77f66..ba595b9627 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -2445,7 +2445,8 @@ void _Thread::_start_func(void *ud) { reason = "Method Not Found"; } break; - default: {} + default: { + } } ERR_EXPLAIN("Could not call function '" + t->target_method.operator String() + "'' starting thread ID: " + t->get_id() + " Reason: " + reason); diff --git a/core/class_db.cpp b/core/class_db.cpp index f7b446707d..0c844657a4 100644 --- a/core/class_db.cpp +++ b/core/class_db.cpp @@ -312,6 +312,19 @@ void ClassDB::get_inheriters_from_class(const StringName &p_class, List<StringNa } } +void ClassDB::get_direct_inheriters_from_class(const StringName &p_class, List<StringName> *p_classes) { + + OBJTYPE_RLOCK; + + const StringName *k = NULL; + + while ((k = classes.next(k))) { + + if (*k != p_class && get_parent_class(*k) == p_class) + p_classes->push_back(*k); + } +} + StringName ClassDB::get_parent_class_nocheck(const StringName &p_class) { OBJTYPE_RLOCK; diff --git a/core/class_db.h b/core/class_db.h index f18a7113d7..efa1a46866 100644 --- a/core/class_db.h +++ b/core/class_db.h @@ -214,6 +214,7 @@ public: static void get_class_list(List<StringName> *p_classes); static void get_inheriters_from_class(const StringName &p_class, List<StringName> *p_classes); + static void get_direct_inheriters_from_class(const StringName &p_class, List<StringName> *p_classes); static StringName get_parent_class_nocheck(const StringName &p_class); static StringName get_parent_class(const StringName &p_class); static bool class_exists(const StringName &p_class); diff --git a/core/image.cpp b/core/image.cpp index f547d7e973..90afd9f35a 100644 --- a/core/image.cpp +++ b/core/image.cpp @@ -1266,7 +1266,8 @@ void Image::shrink_x2() { case FORMAT_RGBAH: _generate_po2_mipmap<uint16_t, 4, false, Image::average_4_half, Image::renormalize_half>(reinterpret_cast<const uint16_t *>(r.ptr()), reinterpret_cast<uint16_t *>(w.ptr()), width, height); break; case FORMAT_RGBE9995: _generate_po2_mipmap<uint32_t, 1, false, Image::average_4_rgbe9995, Image::renormalize_rgbe9995>(reinterpret_cast<const uint32_t *>(r.ptr()), reinterpret_cast<uint32_t *>(w.ptr()), width, height); break; - default: {} + default: { + } } } @@ -1398,7 +1399,8 @@ Error Image::generate_mipmaps(bool p_renormalize) { _generate_po2_mipmap<uint32_t, 1, false, Image::average_4_rgbe9995, Image::renormalize_rgbe9995>(reinterpret_cast<const uint32_t *>(&wp[prev_ofs]), reinterpret_cast<uint32_t *>(&wp[ofs]), prev_w, prev_h); break; - default: {} + default: { + } } prev_ofs = ofs; @@ -1612,7 +1614,8 @@ void Image::create(const char **p_xpm) { if (y == (size_height - 1)) status = DONE; } break; - default: {} + default: { + } } line++; @@ -1685,7 +1688,8 @@ bool Image::is_invisible() const { case FORMAT_DXT5: { detected = true; } break; - default: {} + default: { + } } return !detected; @@ -1729,7 +1733,8 @@ Image::AlphaMode Image::detect_alpha() const { case FORMAT_DXT5: { detected = true; } break; - default: {} + default: { + } } if (detected) diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 363460311c..81b3829ffc 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -768,7 +768,9 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int r_variant = carray; } break; - default: { ERR_FAIL_V(ERR_BUG); } + default: { + ERR_FAIL_V(ERR_BUG); + } } return OK; @@ -823,7 +825,8 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo flags |= ENCODE_FLAG_OBJECT_AS_ID; } } break; - default: {} // nothing to do at this stage + default: { + } // nothing to do at this stage } if (buf) { @@ -1385,7 +1388,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo r_len += 4 * 4 * len; } break; - default: { ERR_FAIL_V(ERR_BUG); } + default: { + ERR_FAIL_V(ERR_BUG); + } } return OK; diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 42070cd132..f25abc4aab 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1725,7 +1725,8 @@ void ResourceFormatSaverBinaryInstance::_find_resources(const Variant &p_variant get_string_index(np.get_subname(i)); } break; - default: {} + default: { + } } } diff --git a/core/math/audio_frame.h b/core/math/audio_frame.h index ebe0356c93..98e4e33021 100644 --- a/core/math/audio_frame.h +++ b/core/math/audio_frame.h @@ -31,6 +31,7 @@ #ifndef AUDIOFRAME_H #define AUDIOFRAME_H +#include "core/math/vector2.h" #include "core/typedefs.h" static inline float undenormalise(volatile float f) { @@ -128,6 +129,14 @@ struct AudioFrame { return *this; } + _ALWAYS_INLINE_ operator Vector2() const { + return Vector2(l, r); + } + + _ALWAYS_INLINE_ AudioFrame(const Vector2 &p_v2) { + l = p_v2.x; + r = p_v2.y; + } _ALWAYS_INLINE_ AudioFrame() {} }; diff --git a/core/math/basis.cpp b/core/math/basis.cpp index 82b2f7006d..9fcecd1ba6 100644 --- a/core/math/basis.cpp +++ b/core/math/basis.cpp @@ -557,7 +557,7 @@ void Basis::set_euler_yxz(const Vector3 &p_euler) { *this = ymat * xmat * zmat; } -bool Basis::is_equal_approx(const Basis &a, const Basis &b,real_t p_epsilon) const { +bool Basis::is_equal_approx(const Basis &a, const Basis &b, real_t p_epsilon) const { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { @@ -569,7 +569,7 @@ bool Basis::is_equal_approx(const Basis &a, const Basis &b,real_t p_epsilon) con return true; } -bool Basis::is_equal_approx_ratio(const Basis &a, const Basis &b,real_t p_epsilon) const { +bool Basis::is_equal_approx_ratio(const Basis &a, const Basis &b, real_t p_epsilon) const { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { diff --git a/core/math/basis.h b/core/math/basis.h index aa0ddb280f..75037c2c52 100644 --- a/core/math/basis.h +++ b/core/math/basis.h @@ -133,8 +133,8 @@ public: return elements[0][2] * v[0] + elements[1][2] * v[1] + elements[2][2] * v[2]; } - bool is_equal_approx(const Basis &a, const Basis &b, real_t p_epsilon=CMP_EPSILON) const; - bool is_equal_approx_ratio(const Basis &a, const Basis &b, real_t p_epsilon=UNIT_EPSILON) const; + bool is_equal_approx(const Basis &a, const Basis &b, real_t p_epsilon = CMP_EPSILON) const; + bool is_equal_approx_ratio(const Basis &a, const Basis &b, real_t p_epsilon = UNIT_EPSILON) const; bool operator==(const Basis &p_matrix) const; bool operator!=(const Basis &p_matrix) const; diff --git a/core/math/expression.cpp b/core/math/expression.cpp index 05b49f0815..133dcc7ab9 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -760,7 +760,8 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return = String(color); } break; - default: {} + default: { + } } } @@ -1679,7 +1680,8 @@ Expression::ENode *Expression::_parse_expression() { case TK_OP_BIT_OR: op = Variant::OP_BIT_OR; break; case TK_OP_BIT_XOR: op = Variant::OP_BIT_XOR; break; case TK_OP_BIT_INVERT: op = Variant::OP_BIT_NEGATE; break; - default: {}; + default: { + }; } if (op == Variant::OP_MAX) { //stop appending stuff diff --git a/core/object.cpp b/core/object.cpp index 8b693f039c..03a11b8ca3 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1637,7 +1637,8 @@ void Object::_clear_internal_resource_paths(const Variant &p_var) { _clear_internal_resource_paths(d[E->get()]); } } break; - default: {} + default: { + } } } diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 39d9f45bd7..4be1364278 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -571,10 +571,16 @@ void FileAccess::store_buffer(const uint8_t *p_src, int p_length) { store_8(p_src[i]); } -Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path) { +Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path, Error *r_error) { - FileAccess *f = FileAccess::open(p_path, READ); - ERR_FAIL_COND_V(!f, Vector<uint8_t>()); + FileAccess *f = FileAccess::open(p_path, READ, r_error); + if (!f) { + if (r_error) { // if error requested, do not throw error + return Vector<uint8_t>(); + } else { + ERR_FAIL_COND_V(!f, Vector<uint8_t>()); + } + } Vector<uint8_t> data; data.resize(f->get_len()); f->get_buffer(data.ptrw(), data.size()); @@ -582,6 +588,26 @@ Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path) { return data; } +String FileAccess::get_file_as_string(const String &p_path, Error *r_error) { + + Error err; + Vector<uint8_t> array = get_file_as_array(p_path, &err); + if (r_error) { + *r_error = err; + } + if (err != OK) { + if (r_error) { + return String(); + } else { + ERR_FAIL_COND_V(err != OK, String()); + } + } + + String ret; + ret.parse_utf8((const char *)array.ptr(), array.size()); + return ret; +} + String FileAccess::get_md5(const String &p_file) { FileAccess *f = FileAccess::open(p_file, READ); diff --git a/core/os/file_access.h b/core/os/file_access.h index c65b75369c..9df2a5cade 100644 --- a/core/os/file_access.h +++ b/core/os/file_access.h @@ -164,7 +164,8 @@ public: static String get_sha256(const String &p_file); static String get_multiple_md5(const Vector<String> &p_file); - static Vector<uint8_t> get_file_as_array(const String &p_path); + static Vector<uint8_t> get_file_as_array(const String &p_path, Error *r_error = NULL); + static String get_file_as_string(const String &p_path, Error *r_error = NULL); template <class T> static void make_default(AccessType p_access) { diff --git a/core/os/input.cpp b/core/os/input.cpp index caa9fb1493..63bf1db499 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -89,6 +89,7 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("action_press", "action", "strength"), &Input::action_press, DEFVAL(1.f)); ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release); ClassDB::bind_method(D_METHOD("set_default_cursor_shape", "shape"), &Input::set_default_cursor_shape, DEFVAL(CURSOR_ARROW)); + ClassDB::bind_method(D_METHOD("get_current_cursor_shape"), &Input::get_current_cursor_shape); ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "shape", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(CURSOR_ARROW), DEFVAL(Vector2())); ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &Input::parse_input_event); ClassDB::bind_method(D_METHOD("set_use_accumulated_input", "enable"), &Input::set_use_accumulated_input); diff --git a/core/os/input.h b/core/os/input.h index c8b80b28d0..de04f239e6 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -121,10 +121,10 @@ public: virtual bool is_emulating_touch_from_mouse() const = 0; virtual bool is_emulating_mouse_from_touch() const = 0; - virtual CursorShape get_default_cursor_shape() = 0; + virtual CursorShape get_default_cursor_shape() const = 0; virtual void set_default_cursor_shape(CursorShape p_shape) = 0; + virtual CursorShape get_current_cursor_shape() const = 0; virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape = CURSOR_ARROW, const Vector2 &p_hotspot = Vector2()) = 0; - virtual void set_mouse_in_window(bool p_in_window) = 0; virtual String get_joy_button_string(int p_button) = 0; virtual String get_joy_axis_string(int p_axis) = 0; diff --git a/core/os/os.cpp b/core/os/os.cpp index 03e63f636e..ea378c9e83 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -220,6 +220,16 @@ int OS::get_virtual_keyboard_height() const { return 0; } +void OS::set_cursor_shape(CursorShape p_shape) { +} + +OS::CursorShape OS::get_cursor_shape() const { + return CURSOR_ARROW; +} + +void OS::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) { +} + void OS::print_all_resources(String p_to_file) { ERR_FAIL_COND(p_to_file != "" && _OSPRF); diff --git a/core/os/os.h b/core/os/os.h index d02d5a2c84..12012fba80 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -377,8 +377,9 @@ public: // returns height of the currently shown virtual keyboard (0 if keyboard is hidden) virtual int get_virtual_keyboard_height() const; - virtual void set_cursor_shape(CursorShape p_shape) = 0; - virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) = 0; + virtual void set_cursor_shape(CursorShape p_shape); + virtual CursorShape get_cursor_shape() const; + virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot); virtual bool get_swap_ok_cancel() { return false; } virtual void dump_memory_to_file(const char *p_file); diff --git a/core/packed_data_container.cpp b/core/packed_data_container.cpp index 99bed829c1..fa60be64a7 100644 --- a/core/packed_data_container.cpp +++ b/core/packed_data_container.cpp @@ -319,7 +319,8 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd } break; - default: {} + default: { + } } return OK; diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 5752cdca2b..c86d1567dd 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -501,7 +501,7 @@ Error ProjectSettings::_load_settings_binary(const String p_path) { d.resize(vlen); f->get_buffer(d.ptrw(), vlen); Variant value; - err = decode_variant(value, d.ptr(), d.size(), NULL, false); + err = decode_variant(value, d.ptr(), d.size(), NULL, true); ERR_EXPLAIN("Error decoding property: " + key); ERR_CONTINUE(err != OK); set(key, value); @@ -694,7 +694,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str file->store_string(key); int len; - err = encode_variant(value, NULL, len, false); + err = encode_variant(value, NULL, len, true); if (err != OK) memdelete(file); ERR_FAIL_COND_V(err != OK, ERR_INVALID_DATA); @@ -702,7 +702,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const Map<Str Vector<uint8_t> buff; buff.resize(len); - err = encode_variant(value, buff.ptrw(), len, false); + err = encode_variant(value, buff.ptrw(), len, true); if (err != OK) memdelete(file); ERR_FAIL_COND_V(err != OK, ERR_INVALID_DATA); diff --git a/core/resource.cpp b/core/resource.cpp index 74c93cd790..74e2c1ed6b 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -363,6 +363,26 @@ bool Resource::is_translation_remapped() const { return remapped_list.in_list(); } +#ifdef TOOLS_ENABLED +//helps keep IDs same number when loading/saving scenes. -1 clears ID and it Returns -1 when no id stored +void Resource::set_id_for_path(const String &p_path, int p_id) { + if (p_id == -1) { + id_for_path.erase(p_path); + } else { + id_for_path[p_path] = p_id; + } +} + +int Resource::get_id_for_path(const String &p_path) const { + + if (id_for_path.has(p_path)) { + return id_for_path[p_path]; + } else { + return -1; + } +} +#endif + void Resource::_bind_methods() { ClassDB::bind_method(D_METHOD("set_path", "path"), &Resource::_set_path); diff --git a/core/resource.h b/core/resource.h index a4d9e998ac..853b2859c7 100644 --- a/core/resource.h +++ b/core/resource.h @@ -88,7 +88,9 @@ protected: void _set_path(const String &p_path); void _take_over_path(const String &p_path); - +#ifdef TOOLS_ENABLED + Map<String, int> id_for_path; +#endif public: static Node *(*_get_local_scene_func)(); //used by editor @@ -137,6 +139,12 @@ public: virtual RID get_rid() const; // some resources may offer conversion to RID +#ifdef TOOLS_ENABLED + //helps keep IDs same number when loading/saving scenes. -1 clears ID and it Returns -1 when no id stored + void set_id_for_path(const String &p_path, int p_id); + int get_id_for_path(const String &p_path) const; +#endif + Resource(); ~Resource(); }; diff --git a/core/ustring.cpp b/core/ustring.cpp index ff8fcaaaaf..d60bd16921 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3748,6 +3748,24 @@ bool String::is_valid_html_color() const { return Color::html_is_valid(*this); } +bool String::is_valid_filename() const { + + String stripped = strip_edges(); + if (*this != stripped) { + return false; + } + + if (stripped == String()) { + return false; + } + + if (find(":") != -1 || find("/") != -1 || find("\\") != -1 || find("?") != -1 || find("*") != -1 || find("\"") != -1 || find("|") != -1 || find("%") != -1 || find("<") != -1 || find(">") != -1) { + return false; + } else { + return true; + } +} + bool String::is_valid_ip_address() const { if (find(":") >= 0) { diff --git a/core/ustring.h b/core/ustring.h index 9288c1526e..85103057df 100644 --- a/core/ustring.h +++ b/core/ustring.h @@ -335,6 +335,7 @@ public: bool is_valid_hex_number(bool p_with_prefix) const; bool is_valid_html_color() const; bool is_valid_ip_address() const; + bool is_valid_filename() const; /** * The constructors must not depend on other overloads @@ -406,11 +407,18 @@ _FORCE_INLINE_ bool is_str_less(const L *l_ptr, const R *r_ptr) { //tool translate #ifdef TOOLS_ENABLED +//gets parsed String TTR(const String &); +//use for c strings +#define TTRC(m_value) m_value +//use to avoid parsing (for use later with C strings) +#define TTRGET(m_value) TTR(m_value) #else #define TTR(m_val) (String()) +#define TTRCDEF(m_value) (m_value) +#define TTRC(m_value) (m_value) #endif diff --git a/core/variant.cpp b/core/variant.cpp index 2ee2e8e293..6c54faf233 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -179,7 +179,8 @@ String Variant::get_type_name(Variant::Type p_type) { return "PoolColorArray"; } break; - default: {} + default: { + } } return ""; @@ -403,7 +404,8 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { valid_types = valid; } break; - default: {} + default: { + } } if (valid_types) { @@ -649,7 +651,8 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type valid_types = valid; } break; - default: {} + default: { + } } if (valid_types) { @@ -841,7 +844,8 @@ bool Variant::is_zero() const { return reinterpret_cast<const PoolVector<Color> *>(_data._mem)->size() == 0; } break; - default: {} + default: { + } } return false; @@ -896,7 +900,9 @@ bool Variant::is_one() const { } break; - default: { return !is_zero(); } + default: { + return !is_zero(); + } } return false; @@ -1039,7 +1045,8 @@ void Variant::reference(const Variant &p_variant) { memnew_placement(_data._mem, PoolVector<Color>(*reinterpret_cast<const PoolVector<Color> *>(p_variant._data._mem))); } break; - default: {} + default: { + } } } @@ -1143,7 +1150,8 @@ void Variant::clear() { reinterpret_cast<PoolVector<Color> *>(_data._mem)->~PoolVector<Color>(); } break; - default: {} /* not needed */ + default: { + } /* not needed */ } type = NIL; @@ -1823,7 +1831,9 @@ inline DA _convert_array_from_variant(const Variant &p_variant) { case Variant::POOL_COLOR_ARRAY: { return _convert_array<DA, PoolVector<Color> >(p_variant.operator PoolVector<Color>()); } - default: { return DA(); } + default: { + return DA(); + } } return DA(); @@ -2642,7 +2652,8 @@ void Variant::operator=(const Variant &p_variant) { *reinterpret_cast<PoolVector<Color> *>(_data._mem) = *reinterpret_cast<const PoolVector<Color> *>(p_variant._data._mem); } break; - default: {} + default: { + } } } @@ -2919,7 +2930,8 @@ uint32_t Variant::hash() const { return hash; } break; - default: {} + default: { + } } return 0; @@ -3167,7 +3179,8 @@ bool Variant::is_shared() const { case OBJECT: return true; case ARRAY: return true; case DICTIONARY: return true; - default: {} + default: { + } } return false; @@ -3204,7 +3217,8 @@ Variant Variant::call(const StringName &p_method, VARIANT_ARG_DECLARE) { String err = "Too many arguments for method '" + p_method + "'"; ERR_PRINT(err.utf8().get_data()); } break; - default: {} + default: { + } } return ret; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index cbe24d4a63..143b07418e 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -294,6 +294,7 @@ struct _VariantCall { VCALL_LOCALMEM1R(String, is_valid_hex_number); VCALL_LOCALMEM0R(String, is_valid_html_color); VCALL_LOCALMEM0R(String, is_valid_ip_address); + VCALL_LOCALMEM0R(String, is_valid_filename); VCALL_LOCALMEM0R(String, to_int); VCALL_LOCALMEM0R(String, to_float); VCALL_LOCALMEM0R(String, hex_to_int); @@ -1542,6 +1543,7 @@ void register_variant_methods() { ADDFUNC1R(STRING, BOOL, String, is_valid_hex_number, BOOL, "with_prefix", varray(false)); ADDFUNC0R(STRING, BOOL, String, is_valid_html_color, varray()); ADDFUNC0R(STRING, BOOL, String, is_valid_ip_address, varray()); + ADDFUNC0R(STRING, BOOL, String, is_valid_filename, varray()); ADDFUNC0R(STRING, INT, String, to_int, varray()); ADDFUNC0R(STRING, REAL, String, to_float, varray()); ADDFUNC0R(STRING, INT, String, hex_to_int, varray()); diff --git a/core/variant_op.cpp b/core/variant_op.cpp index b40b6ce4a6..f3c9bcaa7e 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -2781,7 +2781,8 @@ bool Variant::in(const Variant &p_index, bool *r_valid) const { return false; } } break; - default: {} + default: { + } } if (r_valid) @@ -2912,7 +2913,8 @@ void Variant::get_property_list(List<PropertyInfo> *p_list) const { //nothing } break; - default: {} + default: { + } } } @@ -3251,7 +3253,8 @@ bool Variant::iter_next(Variant &r_iter, bool &valid) const { r_iter = idx; return true; } break; - default: {} + default: { + } } valid = false; @@ -3408,7 +3411,8 @@ Variant Variant::iter_get(const Variant &r_iter, bool &r_valid) const { #endif return arr->get(idx); } break; - default: {} + default: { + } } r_valid = false; diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 0056fc75b6..6377197282 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -1948,7 +1948,8 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str p_store_string_func(p_store_string_ud, " )"); } break; - default: {} + default: { + } } return OK; |