diff options
author | kobewi <kobewi4e@gmail.com> | 2022-10-18 18:47:44 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-10-19 00:05:48 +0200 |
commit | d06a8320e5d5117f8a057da16d33443f410a5d9f (patch) | |
tree | 895f507322e9b4371c6fd7141e2c6d3d3c67278a /servers | |
parent | 4a96fce801cae2d3e0fe42005c74ca7d60cc1582 (diff) |
Simplify GDVIRTUAL_CALL calls
Diffstat (limited to 'servers')
-rw-r--r-- | servers/audio/audio_effect.cpp | 8 | ||||
-rw-r--r-- | servers/audio/audio_stream.cpp | 58 | ||||
-rw-r--r-- | servers/text/text_server_extension.cpp | 742 | ||||
-rw-r--r-- | servers/xr/xr_interface_extension.cpp | 152 |
4 files changed, 333 insertions, 627 deletions
diff --git a/servers/audio/audio_effect.cpp b/servers/audio/audio_effect.cpp index f38d0adfb2..ef0e3197e1 100644 --- a/servers/audio/audio_effect.cpp +++ b/servers/audio/audio_effect.cpp @@ -36,11 +36,9 @@ void AudioEffectInstance::process(const AudioFrame *p_src_frames, AudioFrame *p_ } } bool AudioEffectInstance::process_silence() const { - bool ret; - if (GDVIRTUAL_CALL(_process_silence, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_process_silence, ret); + return ret; } void AudioEffectInstance::_bind_methods() { diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp index 1bfe6a3eb5..33d4c816f2 100644 --- a/servers/audio/audio_stream.cpp +++ b/servers/audio/audio_stream.cpp @@ -54,11 +54,9 @@ bool AudioStreamPlayback::is_playing() const { } int AudioStreamPlayback::get_loop_count() const { - int ret; - if (GDVIRTUAL_CALL(_get_loop_count, ret)) { - return ret; - } - return 0; + int ret = 0; + GDVIRTUAL_CALL(_get_loop_count, ret); + return ret; } double AudioStreamPlayback::get_playback_position() const { @@ -69,9 +67,7 @@ double AudioStreamPlayback::get_playback_position() const { ERR_FAIL_V_MSG(0, "AudioStreamPlayback::get_playback_position unimplemented!"); } void AudioStreamPlayback::seek(double p_time) { - if (GDVIRTUAL_CALL(_seek, p_time)) { - return; - } + GDVIRTUAL_CALL(_seek, p_time); } int AudioStreamPlayback::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) { @@ -201,58 +197,44 @@ Ref<AudioStreamPlayback> AudioStream::instantiate_playback() { } String AudioStream::get_stream_name() const { String ret; - if (GDVIRTUAL_CALL(_get_stream_name, ret)) { - return ret; - } - return String(); + GDVIRTUAL_CALL(_get_stream_name, ret); + return ret; } double AudioStream::get_length() const { - double ret; - if (GDVIRTUAL_CALL(_get_length, ret)) { - return ret; - } - return 0; + double ret = 0; + GDVIRTUAL_CALL(_get_length, ret); + return ret; } bool AudioStream::is_monophonic() const { - bool ret; - if (GDVIRTUAL_CALL(_is_monophonic, ret)) { - return ret; - } - return true; + bool ret = true; + GDVIRTUAL_CALL(_is_monophonic, ret); + return ret; } double AudioStream::get_bpm() const { double ret = 0; - if (GDVIRTUAL_CALL(_get_bpm, ret)) { - return ret; - } - return 0; + GDVIRTUAL_CALL(_get_bpm, ret); + return ret; } bool AudioStream::has_loop() const { bool ret = 0; - if (GDVIRTUAL_CALL(_has_loop, ret)) { - return ret; - } - return 0; + GDVIRTUAL_CALL(_has_loop, ret); + return ret; } int AudioStream::get_bar_beats() const { int ret = 0; - if (GDVIRTUAL_CALL(_get_bar_beats, ret)) { - return ret; - } - return 0; + GDVIRTUAL_CALL(_get_bar_beats, ret); + return ret; } int AudioStream::get_beat_count() const { int ret = 0; - if (GDVIRTUAL_CALL(_get_beat_count, ret)) { - return ret; - } - return 0; + GDVIRTUAL_CALL(_get_beat_count, ret); + return ret; } void AudioStream::tag_used(float p_offset) { diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index 0e1069dcf4..dd4cb5accb 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -311,27 +311,21 @@ void TextServerExtension::_bind_methods() { } bool TextServerExtension::has_feature(Feature p_feature) const { - bool ret; - if (GDVIRTUAL_CALL(_has_feature, p_feature, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_has_feature, p_feature, ret); + return ret; } String TextServerExtension::get_name() const { - String ret; - if (GDVIRTUAL_CALL(_get_name, ret)) { - return ret; - } - return "Unknown"; + String ret = "Unknown"; + GDVIRTUAL_CALL(_get_name, ret); + return ret; } int64_t TextServerExtension::get_features() const { - int64_t ret; - if (GDVIRTUAL_CALL(_get_features, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_get_features, ret); + return ret; } void TextServerExtension::free_rid(const RID &p_rid) { @@ -339,67 +333,51 @@ void TextServerExtension::free_rid(const RID &p_rid) { } bool TextServerExtension::has(const RID &p_rid) { - bool ret; - if (GDVIRTUAL_CALL(_has, p_rid, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_has, p_rid, ret); + return ret; } bool TextServerExtension::load_support_data(const String &p_filename) { - bool ret; - if (GDVIRTUAL_CALL(_load_support_data, p_filename, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_load_support_data, p_filename, ret); + return ret; } String TextServerExtension::get_support_data_filename() const { String ret; - if (GDVIRTUAL_CALL(_get_support_data_filename, ret)) { - return ret; - } - return String(); + GDVIRTUAL_CALL(_get_support_data_filename, ret); + return ret; } String TextServerExtension::get_support_data_info() const { String ret; - if (GDVIRTUAL_CALL(_get_support_data_info, ret)) { - return ret; - } - return String(); + GDVIRTUAL_CALL(_get_support_data_info, ret); + return ret; } bool TextServerExtension::save_support_data(const String &p_filename) const { - bool ret; - if (GDVIRTUAL_CALL(_save_support_data, p_filename, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_save_support_data, p_filename, ret); + return ret; } bool TextServerExtension::is_locale_right_to_left(const String &p_locale) const { - bool ret; - if (GDVIRTUAL_CALL(_is_locale_right_to_left, p_locale, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_is_locale_right_to_left, p_locale, ret); + return ret; } int64_t TextServerExtension::name_to_tag(const String &p_name) const { - int64_t ret; - if (GDVIRTUAL_CALL(_name_to_tag, p_name, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_name_to_tag, p_name, ret); + return ret; } String TextServerExtension::tag_to_name(int64_t p_tag) const { String ret; - if (GDVIRTUAL_CALL(_tag_to_name, p_tag, ret)) { - return ret; - } - return ""; + GDVIRTUAL_CALL(_tag_to_name, p_tag, ret); + return ret; } /*************************************************************************/ @@ -408,10 +386,8 @@ String TextServerExtension::tag_to_name(int64_t p_tag) const { RID TextServerExtension::create_font() { RID ret; - if (GDVIRTUAL_CALL(_create_font, ret)) { - return ret; - } - return RID(); + GDVIRTUAL_CALL(_create_font, ret); + return ret; } void TextServerExtension::font_set_data(const RID &p_font_rid, const PackedByteArray &p_data) { @@ -427,19 +403,15 @@ void TextServerExtension::font_set_face_index(const RID &p_font_rid, int64_t p_i } int64_t TextServerExtension::font_get_face_index(const RID &p_font_rid) const { - int64_t ret; - if (GDVIRTUAL_CALL(_font_get_face_index, p_font_rid, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_font_get_face_index, p_font_rid, ret); + return ret; } int64_t TextServerExtension::font_get_face_count(const RID &p_font_rid) const { - int64_t ret; - if (GDVIRTUAL_CALL(_font_get_face_count, p_font_rid, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_font_get_face_count, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_style(const RID &p_font_rid, BitField<TextServer::FontStyle> p_style) { @@ -448,10 +420,8 @@ void TextServerExtension::font_set_style(const RID &p_font_rid, BitField<TextSer BitField<TextServer::FontStyle> TextServerExtension::font_get_style(const RID &p_font_rid) const { BitField<TextServer::FontStyle> ret = 0; - if (GDVIRTUAL_CALL(_font_get_style, p_font_rid, ret)) { - return ret; - } - return 0; + GDVIRTUAL_CALL(_font_get_style, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_style_name(const RID &p_font_rid, const String &p_name) { @@ -460,10 +430,8 @@ void TextServerExtension::font_set_style_name(const RID &p_font_rid, const Strin String TextServerExtension::font_get_style_name(const RID &p_font_rid) const { String ret; - if (GDVIRTUAL_CALL(_font_get_style_name, p_font_rid, ret)) { - return ret; - } - return String(); + GDVIRTUAL_CALL(_font_get_style_name, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_name(const RID &p_font_rid, const String &p_name) { @@ -472,10 +440,8 @@ void TextServerExtension::font_set_name(const RID &p_font_rid, const String &p_n String TextServerExtension::font_get_name(const RID &p_font_rid) const { String ret; - if (GDVIRTUAL_CALL(_font_get_name, p_font_rid, ret)) { - return ret; - } - return String(); + GDVIRTUAL_CALL(_font_get_name, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_antialiasing(const RID &p_font_rid, TextServer::FontAntialiasing p_antialiasing) { @@ -483,11 +449,9 @@ void TextServerExtension::font_set_antialiasing(const RID &p_font_rid, TextServe } TextServer::FontAntialiasing TextServerExtension::font_get_antialiasing(const RID &p_font_rid) const { - TextServer::FontAntialiasing ret; - if (GDVIRTUAL_CALL(_font_get_antialiasing, p_font_rid, ret)) { - return ret; - } - return TextServer::FONT_ANTIALIASING_NONE; + TextServer::FontAntialiasing ret = TextServer::FONT_ANTIALIASING_NONE; + GDVIRTUAL_CALL(_font_get_antialiasing, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_generate_mipmaps(const RID &p_font_rid, bool p_generate_mipmaps) { @@ -495,11 +459,9 @@ void TextServerExtension::font_set_generate_mipmaps(const RID &p_font_rid, bool } bool TextServerExtension::font_get_generate_mipmaps(const RID &p_font_rid) const { - bool ret; - if (GDVIRTUAL_CALL(_font_get_generate_mipmaps, p_font_rid, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_font_get_generate_mipmaps, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_multichannel_signed_distance_field(const RID &p_font_rid, bool p_msdf) { @@ -507,11 +469,9 @@ void TextServerExtension::font_set_multichannel_signed_distance_field(const RID } bool TextServerExtension::font_is_multichannel_signed_distance_field(const RID &p_font_rid) const { - bool ret; - if (GDVIRTUAL_CALL(_font_is_multichannel_signed_distance_field, p_font_rid, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_font_is_multichannel_signed_distance_field, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_msdf_pixel_range(const RID &p_font_rid, int64_t p_msdf_pixel_range) { @@ -519,11 +479,9 @@ void TextServerExtension::font_set_msdf_pixel_range(const RID &p_font_rid, int64 } int64_t TextServerExtension::font_get_msdf_pixel_range(const RID &p_font_rid) const { - int64_t ret; - if (GDVIRTUAL_CALL(_font_get_msdf_pixel_range, p_font_rid, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_font_get_msdf_pixel_range, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_msdf_size(const RID &p_font_rid, int64_t p_msdf_size) { @@ -531,11 +489,9 @@ void TextServerExtension::font_set_msdf_size(const RID &p_font_rid, int64_t p_ms } int64_t TextServerExtension::font_get_msdf_size(const RID &p_font_rid) const { - int64_t ret; - if (GDVIRTUAL_CALL(_font_get_msdf_size, p_font_rid, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_font_get_msdf_size, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_fixed_size(const RID &p_font_rid, int64_t p_fixed_size) { @@ -543,11 +499,9 @@ void TextServerExtension::font_set_fixed_size(const RID &p_font_rid, int64_t p_f } int64_t TextServerExtension::font_get_fixed_size(const RID &p_font_rid) const { - int64_t ret; - if (GDVIRTUAL_CALL(_font_get_fixed_size, p_font_rid, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_font_get_fixed_size, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_force_autohinter(const RID &p_font_rid, bool p_force_autohinter) { @@ -555,11 +509,9 @@ void TextServerExtension::font_set_force_autohinter(const RID &p_font_rid, bool } bool TextServerExtension::font_is_force_autohinter(const RID &p_font_rid) const { - bool ret; - if (GDVIRTUAL_CALL(_font_is_force_autohinter, p_font_rid, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_font_is_force_autohinter, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_hinting(const RID &p_font_rid, TextServer::Hinting p_hinting) { @@ -567,11 +519,9 @@ void TextServerExtension::font_set_hinting(const RID &p_font_rid, TextServer::Hi } TextServer::Hinting TextServerExtension::font_get_hinting(const RID &p_font_rid) const { - TextServer::Hinting ret; - if (GDVIRTUAL_CALL(_font_get_hinting, p_font_rid, ret)) { - return (TextServer::Hinting)ret; - } - return TextServer::Hinting::HINTING_NONE; + TextServer::Hinting ret = TextServer::HINTING_NONE; + GDVIRTUAL_CALL(_font_get_hinting, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_subpixel_positioning(const RID &p_font_rid, TextServer::SubpixelPositioning p_subpixel) { @@ -579,11 +529,9 @@ void TextServerExtension::font_set_subpixel_positioning(const RID &p_font_rid, T } TextServer::SubpixelPositioning TextServerExtension::font_get_subpixel_positioning(const RID &p_font_rid) const { - TextServer::SubpixelPositioning ret; - if (GDVIRTUAL_CALL(_font_get_subpixel_positioning, p_font_rid, ret)) { - return (TextServer::SubpixelPositioning)ret; - } - return TextServer::SubpixelPositioning::SUBPIXEL_POSITIONING_DISABLED; + TextServer::SubpixelPositioning ret = TextServer::SUBPIXEL_POSITIONING_DISABLED; + GDVIRTUAL_CALL(_font_get_subpixel_positioning, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_embolden(const RID &p_font_rid, double p_strength) { @@ -591,11 +539,9 @@ void TextServerExtension::font_set_embolden(const RID &p_font_rid, double p_stre } double TextServerExtension::font_get_embolden(const RID &p_font_rid) const { - double ret; - if (GDVIRTUAL_CALL(_font_get_embolden, p_font_rid, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_font_get_embolden, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) { @@ -604,10 +550,8 @@ void TextServerExtension::font_set_transform(const RID &p_font_rid, const Transf Transform2D TextServerExtension::font_get_transform(const RID &p_font_rid) const { Transform2D ret; - if (GDVIRTUAL_CALL(_font_get_transform, p_font_rid, ret)) { - return ret; - } - return Transform2D(); + GDVIRTUAL_CALL(_font_get_transform, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_variation_coordinates(const RID &p_font_rid, const Dictionary &p_variation_coordinates) { @@ -616,10 +560,8 @@ void TextServerExtension::font_set_variation_coordinates(const RID &p_font_rid, Dictionary TextServerExtension::font_get_variation_coordinates(const RID &p_font_rid) const { Dictionary ret; - if (GDVIRTUAL_CALL(_font_get_variation_coordinates, p_font_rid, ret)) { - return ret; - } - return Dictionary(); + GDVIRTUAL_CALL(_font_get_variation_coordinates, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_oversampling(const RID &p_font_rid, double p_oversampling) { @@ -627,19 +569,15 @@ void TextServerExtension::font_set_oversampling(const RID &p_font_rid, double p_ } double TextServerExtension::font_get_oversampling(const RID &p_font_rid) const { - double ret; - if (GDVIRTUAL_CALL(_font_get_oversampling, p_font_rid, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_font_get_oversampling, p_font_rid, ret); + return ret; } TypedArray<Vector2i> TextServerExtension::font_get_size_cache_list(const RID &p_font_rid) const { TypedArray<Vector2i> ret; - if (GDVIRTUAL_CALL(_font_get_size_cache_list, p_font_rid, ret)) { - return ret; - } - return TypedArray<Vector2i>(); + GDVIRTUAL_CALL(_font_get_size_cache_list, p_font_rid, ret); + return ret; } void TextServerExtension::font_clear_size_cache(const RID &p_font_rid) { @@ -655,11 +593,9 @@ void TextServerExtension::font_set_ascent(const RID &p_font_rid, int64_t p_size, } double TextServerExtension::font_get_ascent(const RID &p_font_rid, int64_t p_size) const { - double ret; - if (GDVIRTUAL_CALL(_font_get_ascent, p_font_rid, p_size, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_font_get_ascent, p_font_rid, p_size, ret); + return ret; } void TextServerExtension::font_set_descent(const RID &p_font_rid, int64_t p_size, double p_descent) { @@ -667,11 +603,9 @@ void TextServerExtension::font_set_descent(const RID &p_font_rid, int64_t p_size } double TextServerExtension::font_get_descent(const RID &p_font_rid, int64_t p_size) const { - double ret; - if (GDVIRTUAL_CALL(_font_get_descent, p_font_rid, p_size, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_font_get_descent, p_font_rid, p_size, ret); + return ret; } void TextServerExtension::font_set_underline_position(const RID &p_font_rid, int64_t p_size, double p_underline_position) { @@ -679,11 +613,9 @@ void TextServerExtension::font_set_underline_position(const RID &p_font_rid, int } double TextServerExtension::font_get_underline_position(const RID &p_font_rid, int64_t p_size) const { - double ret; - if (GDVIRTUAL_CALL(_font_get_underline_position, p_font_rid, p_size, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_font_get_underline_position, p_font_rid, p_size, ret); + return ret; } void TextServerExtension::font_set_underline_thickness(const RID &p_font_rid, int64_t p_size, double p_underline_thickness) { @@ -691,11 +623,9 @@ void TextServerExtension::font_set_underline_thickness(const RID &p_font_rid, in } double TextServerExtension::font_get_underline_thickness(const RID &p_font_rid, int64_t p_size) const { - double ret; - if (GDVIRTUAL_CALL(_font_get_underline_thickness, p_font_rid, p_size, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_font_get_underline_thickness, p_font_rid, p_size, ret); + return ret; } void TextServerExtension::font_set_scale(const RID &p_font_rid, int64_t p_size, double p_scale) { @@ -703,19 +633,15 @@ void TextServerExtension::font_set_scale(const RID &p_font_rid, int64_t p_size, } double TextServerExtension::font_get_scale(const RID &p_font_rid, int64_t p_size) const { - double ret; - if (GDVIRTUAL_CALL(_font_get_scale, p_font_rid, p_size, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_font_get_scale, p_font_rid, p_size, ret); + return ret; } int64_t TextServerExtension::font_get_texture_count(const RID &p_font_rid, const Vector2i &p_size) const { - int64_t ret; - if (GDVIRTUAL_CALL(_font_get_texture_count, p_font_rid, p_size, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_font_get_texture_count, p_font_rid, p_size, ret); + return ret; } void TextServerExtension::font_clear_textures(const RID &p_font_rid, const Vector2i &p_size) { @@ -732,10 +658,8 @@ void TextServerExtension::font_set_texture_image(const RID &p_font_rid, const Ve Ref<Image> TextServerExtension::font_get_texture_image(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { Ref<Image> ret; - if (GDVIRTUAL_CALL(_font_get_texture_image, p_font_rid, p_size, p_texture_index, ret)) { - return ret; - } - return Ref<Image>(); + GDVIRTUAL_CALL(_font_get_texture_image, p_font_rid, p_size, p_texture_index, ret); + return ret; } void TextServerExtension::font_set_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index, const PackedInt32Array &p_offset) { @@ -744,18 +668,14 @@ void TextServerExtension::font_set_texture_offsets(const RID &p_font_rid, const PackedInt32Array TextServerExtension::font_get_texture_offsets(const RID &p_font_rid, const Vector2i &p_size, int64_t p_texture_index) const { PackedInt32Array ret; - if (GDVIRTUAL_CALL(_font_get_texture_offsets, p_font_rid, p_size, p_texture_index, ret)) { - return ret; - } - return PackedInt32Array(); + GDVIRTUAL_CALL(_font_get_texture_offsets, p_font_rid, p_size, p_texture_index, ret); + return ret; } PackedInt32Array TextServerExtension::font_get_glyph_list(const RID &p_font_rid, const Vector2i &p_size) const { PackedInt32Array ret; - if (GDVIRTUAL_CALL(_font_get_glyph_list, p_font_rid, p_size, ret)) { - return ret; - } - return PackedInt32Array(); + GDVIRTUAL_CALL(_font_get_glyph_list, p_font_rid, p_size, ret); + return ret; } void TextServerExtension::font_clear_glyphs(const RID &p_font_rid, const Vector2i &p_size) { @@ -768,10 +688,8 @@ void TextServerExtension::font_remove_glyph(const RID &p_font_rid, const Vector2 Vector2 TextServerExtension::font_get_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph) const { Vector2 ret; - if (GDVIRTUAL_CALL(_font_get_glyph_advance, p_font_rid, p_size, p_glyph, ret)) { - return ret; - } - return Vector2(); + GDVIRTUAL_CALL(_font_get_glyph_advance, p_font_rid, p_size, p_glyph, ret); + return ret; } void TextServerExtension::font_set_glyph_advance(const RID &p_font_rid, int64_t p_size, int64_t p_glyph, const Vector2 &p_advance) { @@ -780,10 +698,8 @@ void TextServerExtension::font_set_glyph_advance(const RID &p_font_rid, int64_t Vector2 TextServerExtension::font_get_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Vector2 ret; - if (GDVIRTUAL_CALL(_font_get_glyph_offset, p_font_rid, p_size, p_glyph, ret)) { - return ret; - } - return Vector2(); + GDVIRTUAL_CALL(_font_get_glyph_offset, p_font_rid, p_size, p_glyph, ret); + return ret; } void TextServerExtension::font_set_glyph_offset(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_offset) { @@ -792,10 +708,8 @@ void TextServerExtension::font_set_glyph_offset(const RID &p_font_rid, const Vec Vector2 TextServerExtension::font_get_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Vector2 ret; - if (GDVIRTUAL_CALL(_font_get_glyph_size, p_font_rid, p_size, p_glyph, ret)) { - return ret; - } - return Vector2(); + GDVIRTUAL_CALL(_font_get_glyph_size, p_font_rid, p_size, p_glyph, ret); + return ret; } void TextServerExtension::font_set_glyph_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Vector2 &p_gl_size) { @@ -804,10 +718,8 @@ void TextServerExtension::font_set_glyph_size(const RID &p_font_rid, const Vecto Rect2 TextServerExtension::font_get_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Rect2 ret; - if (GDVIRTUAL_CALL(_font_get_glyph_uv_rect, p_font_rid, p_size, p_glyph, ret)) { - return ret; - } - return Rect2(); + GDVIRTUAL_CALL(_font_get_glyph_uv_rect, p_font_rid, p_size, p_glyph, ret); + return ret; } void TextServerExtension::font_set_glyph_uv_rect(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, const Rect2 &p_uv_rect) { @@ -815,11 +727,9 @@ void TextServerExtension::font_set_glyph_uv_rect(const RID &p_font_rid, const Ve } int64_t TextServerExtension::font_get_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { - int64_t ret; - if (GDVIRTUAL_CALL(_font_get_glyph_texture_idx, p_font_rid, p_size, p_glyph, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_font_get_glyph_texture_idx, p_font_rid, p_size, p_glyph, ret); + return ret; } void TextServerExtension::font_set_glyph_texture_idx(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph, int64_t p_texture_idx) { @@ -828,34 +738,26 @@ void TextServerExtension::font_set_glyph_texture_idx(const RID &p_font_rid, cons RID TextServerExtension::font_get_glyph_texture_rid(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { RID ret; - if (GDVIRTUAL_CALL(_font_get_glyph_texture_rid, p_font_rid, p_size, p_glyph, ret)) { - return ret; - } - return RID(); + GDVIRTUAL_CALL(_font_get_glyph_texture_rid, p_font_rid, p_size, p_glyph, ret); + return ret; } Size2 TextServerExtension::font_get_glyph_texture_size(const RID &p_font_rid, const Vector2i &p_size, int64_t p_glyph) const { Size2 ret; - if (GDVIRTUAL_CALL(_font_get_glyph_texture_size, p_font_rid, p_size, p_glyph, ret)) { - return ret; - } - return Size2(); + GDVIRTUAL_CALL(_font_get_glyph_texture_size, p_font_rid, p_size, p_glyph, ret); + return ret; } Dictionary TextServerExtension::font_get_glyph_contours(const RID &p_font_rid, int64_t p_size, int64_t p_index) const { Dictionary ret; - if (GDVIRTUAL_CALL(_font_get_glyph_contours, p_font_rid, p_size, p_index, ret)) { - return ret; - } - return Dictionary(); + GDVIRTUAL_CALL(_font_get_glyph_contours, p_font_rid, p_size, p_index, ret); + return ret; } TypedArray<Vector2i> TextServerExtension::font_get_kerning_list(const RID &p_font_rid, int64_t p_size) const { TypedArray<Vector2i> ret; - if (GDVIRTUAL_CALL(_font_get_kerning_list, p_font_rid, p_size, ret)) { - return ret; - } - return TypedArray<Vector2i>(); + GDVIRTUAL_CALL(_font_get_kerning_list, p_font_rid, p_size, ret); + return ret; } void TextServerExtension::font_clear_kerning_map(const RID &p_font_rid, int64_t p_size) { @@ -872,34 +774,26 @@ void TextServerExtension::font_set_kerning(const RID &p_font_rid, int64_t p_size Vector2 TextServerExtension::font_get_kerning(const RID &p_font_rid, int64_t p_size, const Vector2i &p_glyph_pair) const { Vector2 ret; - if (GDVIRTUAL_CALL(_font_get_kerning, p_font_rid, p_size, p_glyph_pair, ret)) { - return ret; - } - return Vector2(); + GDVIRTUAL_CALL(_font_get_kerning, p_font_rid, p_size, p_glyph_pair, ret); + return ret; } int64_t TextServerExtension::font_get_glyph_index(const RID &p_font_rid, int64_t p_size, int64_t p_char, int64_t p_variation_selector) const { - int64_t ret; - if (GDVIRTUAL_CALL(_font_get_glyph_index, p_font_rid, p_size, p_char, p_variation_selector, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_font_get_glyph_index, p_font_rid, p_size, p_char, p_variation_selector, ret); + return ret; } bool TextServerExtension::font_has_char(const RID &p_font_rid, int64_t p_char) const { - bool ret; - if (GDVIRTUAL_CALL(_font_has_char, p_font_rid, p_char, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_font_has_char, p_font_rid, p_char, ret); + return ret; } String TextServerExtension::font_get_supported_chars(const RID &p_font_rid) const { String ret; - if (GDVIRTUAL_CALL(_font_get_supported_chars, p_font_rid, ret)) { - return ret; - } - return String(); + GDVIRTUAL_CALL(_font_get_supported_chars, p_font_rid, ret); + return ret; } void TextServerExtension::font_render_range(const RID &p_font_rid, const Vector2i &p_size, int64_t p_start, int64_t p_end) { @@ -919,11 +813,9 @@ void TextServerExtension::font_draw_glyph_outline(const RID &p_font_rid, const R } bool TextServerExtension::font_is_language_supported(const RID &p_font_rid, const String &p_language) const { - bool ret; - if (GDVIRTUAL_CALL(_font_is_language_supported, p_font_rid, p_language, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_font_is_language_supported, p_font_rid, p_language, ret); + return ret; } void TextServerExtension::font_set_language_support_override(const RID &p_font_rid, const String &p_language, bool p_supported) { @@ -931,11 +823,9 @@ void TextServerExtension::font_set_language_support_override(const RID &p_font_r } bool TextServerExtension::font_get_language_support_override(const RID &p_font_rid, const String &p_language) { - bool ret; - if (GDVIRTUAL_CALL(_font_get_language_support_override, p_font_rid, p_language, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_font_get_language_support_override, p_font_rid, p_language, ret); + return ret; } void TextServerExtension::font_remove_language_support_override(const RID &p_font_rid, const String &p_language) { @@ -944,18 +834,14 @@ void TextServerExtension::font_remove_language_support_override(const RID &p_fon PackedStringArray TextServerExtension::font_get_language_support_overrides(const RID &p_font_rid) { PackedStringArray ret; - if (GDVIRTUAL_CALL(_font_get_language_support_overrides, p_font_rid, ret)) { - return ret; - } - return PackedStringArray(); + GDVIRTUAL_CALL(_font_get_language_support_overrides, p_font_rid, ret); + return ret; } bool TextServerExtension::font_is_script_supported(const RID &p_font_rid, const String &p_script) const { - bool ret; - if (GDVIRTUAL_CALL(_font_is_script_supported, p_font_rid, p_script, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_font_is_script_supported, p_font_rid, p_script, ret); + return ret; } void TextServerExtension::font_set_script_support_override(const RID &p_font_rid, const String &p_script, bool p_supported) { @@ -963,11 +849,9 @@ void TextServerExtension::font_set_script_support_override(const RID &p_font_rid } bool TextServerExtension::font_get_script_support_override(const RID &p_font_rid, const String &p_script) { - bool ret; - if (GDVIRTUAL_CALL(_font_get_script_support_override, p_font_rid, p_script, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_font_get_script_support_override, p_font_rid, p_script, ret); + return ret; } void TextServerExtension::font_remove_script_support_override(const RID &p_font_rid, const String &p_script) { @@ -976,10 +860,8 @@ void TextServerExtension::font_remove_script_support_override(const RID &p_font_ PackedStringArray TextServerExtension::font_get_script_support_overrides(const RID &p_font_rid) { PackedStringArray ret; - if (GDVIRTUAL_CALL(_font_get_script_support_overrides, p_font_rid, ret)) { - return ret; - } - return PackedStringArray(); + GDVIRTUAL_CALL(_font_get_script_support_overrides, p_font_rid, ret); + return ret; } void TextServerExtension::font_set_opentype_feature_overrides(const RID &p_font_rid, const Dictionary &p_overrides) { @@ -988,34 +870,26 @@ void TextServerExtension::font_set_opentype_feature_overrides(const RID &p_font_ Dictionary TextServerExtension::font_get_opentype_feature_overrides(const RID &p_font_rid) const { Dictionary ret; - if (GDVIRTUAL_CALL(_font_get_opentype_feature_overrides, p_font_rid, ret)) { - return ret; - } - return Dictionary(); + GDVIRTUAL_CALL(_font_get_opentype_feature_overrides, p_font_rid, ret); + return ret; } Dictionary TextServerExtension::font_supported_feature_list(const RID &p_font_rid) const { Dictionary ret; - if (GDVIRTUAL_CALL(_font_supported_feature_list, p_font_rid, ret)) { - return ret; - } - return Dictionary(); + GDVIRTUAL_CALL(_font_supported_feature_list, p_font_rid, ret); + return ret; } Dictionary TextServerExtension::font_supported_variation_list(const RID &p_font_rid) const { Dictionary ret; - if (GDVIRTUAL_CALL(_font_supported_variation_list, p_font_rid, ret)) { - return ret; - } - return Dictionary(); + GDVIRTUAL_CALL(_font_supported_variation_list, p_font_rid, ret); + return ret; } double TextServerExtension::font_get_global_oversampling() const { - double ret; - if (GDVIRTUAL_CALL(_font_get_global_oversampling, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_font_get_global_oversampling, ret); + return ret; } void TextServerExtension::font_set_global_oversampling(double p_oversampling) { @@ -1042,10 +916,8 @@ void TextServerExtension::draw_hex_code_box(const RID &p_canvas, int64_t p_size, RID TextServerExtension::create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) { RID ret; - if (GDVIRTUAL_CALL(_create_shaped_text, p_direction, p_orientation, ret)) { - return ret; - } - return RID(); + GDVIRTUAL_CALL(_create_shaped_text, p_direction, p_orientation, ret); + return ret; } void TextServerExtension::shaped_text_clear(const RID &p_shaped) { @@ -1057,19 +929,15 @@ void TextServerExtension::shaped_text_set_direction(const RID &p_shaped, TextSer } TextServer::Direction TextServerExtension::shaped_text_get_direction(const RID &p_shaped) const { - TextServer::Direction ret; - if (GDVIRTUAL_CALL(_shaped_text_get_direction, p_shaped, ret)) { - return (TextServer::Direction)ret; - } - return TextServer::Direction::DIRECTION_AUTO; + TextServer::Direction ret = TextServer::DIRECTION_AUTO; + GDVIRTUAL_CALL(_shaped_text_get_direction, p_shaped, ret); + return ret; } TextServer::Direction TextServerExtension::shaped_text_get_inferred_direction(const RID &p_shaped) const { - TextServer::Direction ret; - if (GDVIRTUAL_CALL(_shaped_text_get_inferred_direction, p_shaped, ret)) { - return (TextServer::Direction)ret; - } - return TextServer::Direction::DIRECTION_LTR; + TextServer::Direction ret = TextServer::DIRECTION_LTR; + GDVIRTUAL_CALL(_shaped_text_get_inferred_direction, p_shaped, ret); + return ret; } void TextServerExtension::shaped_text_set_orientation(const RID &p_shaped, TextServer::Orientation p_orientation) { @@ -1077,11 +945,9 @@ void TextServerExtension::shaped_text_set_orientation(const RID &p_shaped, TextS } TextServer::Orientation TextServerExtension::shaped_text_get_orientation(const RID &p_shaped) const { - TextServer::Orientation ret; - if (GDVIRTUAL_CALL(_shaped_text_get_orientation, p_shaped, ret)) { - return (TextServer::Orientation)ret; - } - return TextServer::Orientation::ORIENTATION_HORIZONTAL; + TextServer::Orientation ret = TextServer::ORIENTATION_HORIZONTAL; + GDVIRTUAL_CALL(_shaped_text_get_orientation, p_shaped, ret); + return ret; } void TextServerExtension::shaped_text_set_bidi_override(const RID &p_shaped, const Array &p_override) { @@ -1094,10 +960,8 @@ void TextServerExtension::shaped_text_set_custom_punctuation(const RID &p_shaped String TextServerExtension::shaped_text_get_custom_punctuation(const RID &p_shaped) const { String ret; - if (GDVIRTUAL_CALL(_shaped_text_get_custom_punctuation, p_shaped, ret)) { - return ret; - } - return String(); + GDVIRTUAL_CALL(_shaped_text_get_custom_punctuation, p_shaped, ret); + return ret; } void TextServerExtension::shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) { @@ -1105,11 +969,9 @@ void TextServerExtension::shaped_text_set_preserve_invalid(const RID &p_shaped, } bool TextServerExtension::shaped_text_get_preserve_invalid(const RID &p_shaped) const { - bool ret; - if (GDVIRTUAL_CALL(_shaped_text_get_preserve_invalid, p_shaped, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_shaped_text_get_preserve_invalid, p_shaped, ret); + return ret; } void TextServerExtension::shaped_text_set_preserve_control(const RID &p_shaped, bool p_enabled) { @@ -1117,11 +979,9 @@ void TextServerExtension::shaped_text_set_preserve_control(const RID &p_shaped, } bool TextServerExtension::shaped_text_get_preserve_control(const RID &p_shaped) const { - bool ret; - if (GDVIRTUAL_CALL(_shaped_text_get_preserve_control, p_shaped, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_shaped_text_get_preserve_control, p_shaped, ret); + return ret; } void TextServerExtension::shaped_text_set_spacing(const RID &p_shaped, TextServer::SpacingType p_spacing, int64_t p_value) { @@ -1129,51 +989,39 @@ void TextServerExtension::shaped_text_set_spacing(const RID &p_shaped, TextServe } int64_t TextServerExtension::shaped_text_get_spacing(const RID &p_shaped, TextServer::SpacingType p_spacing) const { - int64_t ret; - if (GDVIRTUAL_CALL(_shaped_text_get_spacing, p_shaped, p_spacing, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_shaped_text_get_spacing, p_shaped, p_spacing, ret); + return ret; } bool TextServerExtension::shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { - bool ret; - if (GDVIRTUAL_CALL(_shaped_text_add_string, p_shaped, p_text, p_fonts, p_size, p_opentype_features, p_language, p_meta, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_shaped_text_add_string, p_shaped, p_text, p_fonts, p_size, p_opentype_features, p_language, p_meta, ret); + return ret; } bool TextServerExtension::shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align, int64_t p_length) { - bool ret; - if (GDVIRTUAL_CALL(_shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_shaped_text_add_object, p_shaped, p_key, p_size, p_inline_align, p_length, ret); + return ret; } bool TextServerExtension::shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align) { - bool ret; - if (GDVIRTUAL_CALL(_shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_shaped_text_resize_object, p_shaped, p_key, p_size, p_inline_align, ret); + return ret; } int64_t TextServerExtension::shaped_get_span_count(const RID &p_shaped) const { - int64_t ret; - if (GDVIRTUAL_CALL(_shaped_get_span_count, p_shaped, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_shaped_get_span_count, p_shaped, ret); + return ret; } Variant TextServerExtension::shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const { - Variant ret; - if (GDVIRTUAL_CALL(_shaped_get_span_meta, p_shaped, p_index, ret)) { - return ret; - } - return false; + Variant ret = false; + GDVIRTUAL_CALL(_shaped_get_span_meta, p_shaped, p_index, ret); + return ret; } void TextServerExtension::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { @@ -1182,98 +1030,74 @@ void TextServerExtension::shaped_set_span_update_font(const RID &p_shaped, int64 RID TextServerExtension::shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const { RID ret; - if (GDVIRTUAL_CALL(_shaped_text_substr, p_shaped, p_start, p_length, ret)) { - return ret; - } - return RID(); + GDVIRTUAL_CALL(_shaped_text_substr, p_shaped, p_start, p_length, ret); + return ret; } RID TextServerExtension::shaped_text_get_parent(const RID &p_shaped) const { RID ret; - if (GDVIRTUAL_CALL(_shaped_text_get_parent, p_shaped, ret)) { - return ret; - } - return RID(); + GDVIRTUAL_CALL(_shaped_text_get_parent, p_shaped, ret); + return ret; } double TextServerExtension::shaped_text_fit_to_width(const RID &p_shaped, double p_width, BitField<TextServer::JustificationFlag> p_jst_flags) { - double ret; - if (GDVIRTUAL_CALL(_shaped_text_fit_to_width, p_shaped, p_width, p_jst_flags, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_shaped_text_fit_to_width, p_shaped, p_width, p_jst_flags, ret); + return ret; } double TextServerExtension::shaped_text_tab_align(const RID &p_shaped, const PackedFloat32Array &p_tab_stops) { - double ret; - if (GDVIRTUAL_CALL(_shaped_text_tab_align, p_shaped, p_tab_stops, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_shaped_text_tab_align, p_shaped, p_tab_stops, ret); + return ret; } bool TextServerExtension::shaped_text_shape(const RID &p_shaped) { - bool ret; - if (GDVIRTUAL_CALL(_shaped_text_shape, p_shaped, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_shaped_text_shape, p_shaped, ret); + return ret; } bool TextServerExtension::shaped_text_update_breaks(const RID &p_shaped) { - bool ret; - if (GDVIRTUAL_CALL(_shaped_text_update_breaks, p_shaped, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_shaped_text_update_breaks, p_shaped, ret); + return ret; } bool TextServerExtension::shaped_text_update_justification_ops(const RID &p_shaped) { - bool ret; - if (GDVIRTUAL_CALL(_shaped_text_update_justification_ops, p_shaped, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_shaped_text_update_justification_ops, p_shaped, ret); + return ret; } bool TextServerExtension::shaped_text_is_ready(const RID &p_shaped) const { - bool ret; - if (GDVIRTUAL_CALL(_shaped_text_is_ready, p_shaped, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_shaped_text_is_ready, p_shaped, ret); + return ret; } const Glyph *TextServerExtension::shaped_text_get_glyphs(const RID &p_shaped) const { GDNativeConstPtr<const Glyph> ret; - if (GDVIRTUAL_CALL(_shaped_text_get_glyphs, p_shaped, ret)) { - return ret; - } - return nullptr; + GDVIRTUAL_CALL(_shaped_text_get_glyphs, p_shaped, ret); + return ret; } const Glyph *TextServerExtension::shaped_text_sort_logical(const RID &p_shaped) { GDNativeConstPtr<const Glyph> ret; - if (GDVIRTUAL_CALL(_shaped_text_sort_logical, p_shaped, ret)) { - return ret; - } - return nullptr; + GDVIRTUAL_CALL(_shaped_text_sort_logical, p_shaped, ret); + return ret; } int64_t TextServerExtension::shaped_text_get_glyph_count(const RID &p_shaped) const { - int64_t ret; - if (GDVIRTUAL_CALL(_shaped_text_get_glyph_count, p_shaped, ret)) { - return ret; - } - return 0; + int64_t ret = 0; + GDVIRTUAL_CALL(_shaped_text_get_glyph_count, p_shaped, ret); + return ret; } Vector2i TextServerExtension::shaped_text_get_range(const RID &p_shaped) const { Vector2i ret; - if (GDVIRTUAL_CALL(_shaped_text_get_range, p_shaped, ret)) { - return ret; - } - return Vector2i(); + GDVIRTUAL_CALL(_shaped_text_get_range, p_shaped, ret); + return ret; } PackedInt32Array TextServerExtension::shaped_text_get_line_breaks_adv(const RID &p_shaped, const PackedFloat32Array &p_width, int64_t p_start, bool p_once, BitField<TextServer::LineBreakFlag> p_break_flags) const { @@ -1301,35 +1125,27 @@ PackedInt32Array TextServerExtension::shaped_text_get_word_breaks(const RID &p_s } int64_t TextServerExtension::shaped_text_get_trim_pos(const RID &p_shaped) const { - int64_t ret; - if (GDVIRTUAL_CALL(_shaped_text_get_trim_pos, p_shaped, ret)) { - return ret; - } - return -1; + int64_t ret = -1; + GDVIRTUAL_CALL(_shaped_text_get_trim_pos, p_shaped, ret); + return ret; } int64_t TextServerExtension::shaped_text_get_ellipsis_pos(const RID &p_shaped) const { - int64_t ret; - if (GDVIRTUAL_CALL(_shaped_text_get_ellipsis_pos, p_shaped, ret)) { - return ret; - } - return -1; + int64_t ret = -1; + GDVIRTUAL_CALL(_shaped_text_get_ellipsis_pos, p_shaped, ret); + return ret; } const Glyph *TextServerExtension::shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const { GDNativeConstPtr<const Glyph> ret; - if (GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyphs, p_shaped, ret)) { - return ret; - } - return nullptr; + GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyphs, p_shaped, ret); + return ret; } int64_t TextServerExtension::shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const { - int64_t ret; - if (GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyph_count, p_shaped, ret)) { - return ret; - } - return -1; + int64_t ret = -1; + GDVIRTUAL_CALL(_shaped_text_get_ellipsis_glyph_count, p_shaped, ret); + return ret; } void TextServerExtension::shaped_text_overrun_trim_to_width(const RID &p_shaped_line, double p_width, BitField<TextServer::TextOverrunFlag> p_trim_flags) { @@ -1338,66 +1154,50 @@ void TextServerExtension::shaped_text_overrun_trim_to_width(const RID &p_shaped_ Array TextServerExtension::shaped_text_get_objects(const RID &p_shaped) const { Array ret; - if (GDVIRTUAL_CALL(_shaped_text_get_objects, p_shaped, ret)) { - return ret; - } - return Array(); + GDVIRTUAL_CALL(_shaped_text_get_objects, p_shaped, ret); + return ret; } Rect2 TextServerExtension::shaped_text_get_object_rect(const RID &p_shaped, const Variant &p_key) const { Rect2 ret; - if (GDVIRTUAL_CALL(_shaped_text_get_object_rect, p_shaped, p_key, ret)) { - return ret; - } - return Rect2(); + GDVIRTUAL_CALL(_shaped_text_get_object_rect, p_shaped, p_key, ret); + return ret; } Size2 TextServerExtension::shaped_text_get_size(const RID &p_shaped) const { Size2 ret; - if (GDVIRTUAL_CALL(_shaped_text_get_size, p_shaped, ret)) { - return ret; - } - return Size2(); + GDVIRTUAL_CALL(_shaped_text_get_size, p_shaped, ret); + return ret; } double TextServerExtension::shaped_text_get_ascent(const RID &p_shaped) const { - double ret; - if (GDVIRTUAL_CALL(_shaped_text_get_ascent, p_shaped, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_shaped_text_get_ascent, p_shaped, ret); + return ret; } double TextServerExtension::shaped_text_get_descent(const RID &p_shaped) const { - double ret; - if (GDVIRTUAL_CALL(_shaped_text_get_descent, p_shaped, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_shaped_text_get_descent, p_shaped, ret); + return ret; } double TextServerExtension::shaped_text_get_width(const RID &p_shaped) const { - double ret; - if (GDVIRTUAL_CALL(_shaped_text_get_width, p_shaped, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_shaped_text_get_width, p_shaped, ret); + return ret; } double TextServerExtension::shaped_text_get_underline_position(const RID &p_shaped) const { - double ret; - if (GDVIRTUAL_CALL(_shaped_text_get_underline_position, p_shaped, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_shaped_text_get_underline_position, p_shaped, ret); + return ret; } double TextServerExtension::shaped_text_get_underline_thickness(const RID &p_shaped) const { - double ret; - if (GDVIRTUAL_CALL(_shaped_text_get_underline_thickness, p_shaped, ret)) { - return ret; - } - return 0.0; + double ret = 0; + GDVIRTUAL_CALL(_shaped_text_get_underline_thickness, p_shaped, ret); + return ret; } TextServer::Direction TextServerExtension::shaped_text_get_dominant_direction_in_range(const RID &p_shaped, int64_t p_start, int64_t p_end) const { @@ -1495,11 +1295,9 @@ String TextServerExtension::parse_number(const String &p_string, const String &p } String TextServerExtension::percent_sign(const String &p_language) const { - String ret; - if (GDVIRTUAL_CALL(_percent_sign, p_language, ret)) { - return ret; - } - return "%"; + String ret = "%"; + GDVIRTUAL_CALL(_percent_sign, p_language, ret); + return ret; } bool TextServerExtension::is_valid_identifier(const String &p_string) const { @@ -1536,18 +1334,14 @@ String TextServerExtension::string_to_lower(const String &p_string, const String TypedArray<Vector2i> TextServerExtension::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const { TypedArray<Vector2i> ret; - if (GDVIRTUAL_CALL(_parse_structured_text, p_parser_type, p_args, p_text, ret)) { - return ret; - } - return TypedArray<Vector2i>(); + GDVIRTUAL_CALL(_parse_structured_text, p_parser_type, p_args, p_text, ret); + return ret; } PackedInt32Array TextServerExtension::string_get_word_breaks(const String &p_string, const String &p_language) const { PackedInt32Array ret; - if (GDVIRTUAL_CALL(_string_get_word_breaks, p_string, p_language, ret)) { - return ret; - } - return PackedInt32Array(); + GDVIRTUAL_CALL(_string_get_word_breaks, p_string, p_language, ret); + return ret; } int64_t TextServerExtension::is_confusable(const String &p_string, const PackedStringArray &p_dict) const { diff --git a/servers/xr/xr_interface_extension.cpp b/servers/xr/xr_interface_extension.cpp index 0d4a53d287..f90e32a987 100644 --- a/servers/xr/xr_interface_extension.cpp +++ b/servers/xr/xr_interface_extension.cpp @@ -100,33 +100,21 @@ StringName XRInterfaceExtension::get_name() const { } uint32_t XRInterfaceExtension::get_capabilities() const { - uint32_t capabilities; - - if (GDVIRTUAL_CALL(_get_capabilities, capabilities)) { - return capabilities; - } - - return 0; + uint32_t capabilities = 0; + GDVIRTUAL_CALL(_get_capabilities, capabilities); + return capabilities; } bool XRInterfaceExtension::is_initialized() const { bool initialised = false; - - if (GDVIRTUAL_CALL(_is_initialized, initialised)) { - return initialised; - } - - return false; + GDVIRTUAL_CALL(_is_initialized, initialised); + return initialised; } bool XRInterfaceExtension::initialize() { bool initialised = false; - - if (GDVIRTUAL_CALL(_initialize, initialised)) { - return initialised; - } - - return false; + GDVIRTUAL_CALL(_initialize, initialised); + return initialised; } void XRInterfaceExtension::uninitialize() { @@ -150,13 +138,9 @@ PackedStringArray XRInterfaceExtension::get_suggested_pose_names(const StringNam } XRInterface::TrackingStatus XRInterfaceExtension::get_tracking_status() const { - uint32_t status; - - if (GDVIRTUAL_CALL(_get_tracking_status, status)) { - return TrackingStatus(status); - } - - return XR_UNKNOWN_TRACKING; + uint32_t status = XR_UNKNOWN_TRACKING; + GDVIRTUAL_CALL(_get_tracking_status, status); + return TrackingStatus(status); } void XRInterfaceExtension::trigger_haptic_pulse(const String &p_action_name, const StringName &p_tracker_name, double p_frequency, double p_amplitude, double p_duration_sec, double p_delay_sec) { @@ -164,52 +148,34 @@ void XRInterfaceExtension::trigger_haptic_pulse(const String &p_action_name, con } bool XRInterfaceExtension::supports_play_area_mode(XRInterface::PlayAreaMode p_mode) { - bool is_supported; - - if (GDVIRTUAL_CALL(_supports_play_area_mode, p_mode, is_supported)) { - return is_supported; - } - - return false; + bool is_supported = false; + GDVIRTUAL_CALL(_supports_play_area_mode, p_mode, is_supported); + return is_supported; } XRInterface::PlayAreaMode XRInterfaceExtension::get_play_area_mode() const { - uint32_t mode; - - if (GDVIRTUAL_CALL(_get_play_area_mode, mode)) { - return XRInterface::PlayAreaMode(mode); - } - - return XRInterface::XR_PLAY_AREA_UNKNOWN; + uint32_t mode = XR_PLAY_AREA_UNKNOWN; + GDVIRTUAL_CALL(_get_play_area_mode, mode); + return XRInterface::PlayAreaMode(mode); } bool XRInterfaceExtension::set_play_area_mode(XRInterface::PlayAreaMode p_mode) { - bool success; - - if (GDVIRTUAL_CALL(_set_play_area_mode, p_mode, success)) { - return success; - } - - return false; + bool success = false; + GDVIRTUAL_CALL(_set_play_area_mode, p_mode, success); + return success; } PackedVector3Array XRInterfaceExtension::get_play_area() const { PackedVector3Array arr; - GDVIRTUAL_CALL(_get_play_area, arr); - return arr; } /** these will only be implemented on AR interfaces, so we want dummies for VR **/ bool XRInterfaceExtension::get_anchor_detection_is_enabled() const { - bool enabled; - - if (GDVIRTUAL_CALL(_get_anchor_detection_is_enabled, enabled)) { - return enabled; - } - - return false; + bool enabled = false; + GDVIRTUAL_CALL(_get_anchor_detection_is_enabled, enabled); + return enabled; } void XRInterfaceExtension::set_anchor_detection_is_enabled(bool p_enable) { @@ -218,53 +184,33 @@ void XRInterfaceExtension::set_anchor_detection_is_enabled(bool p_enable) { } int XRInterfaceExtension::get_camera_feed_id() { - int feed_id; - - if (GDVIRTUAL_CALL(_get_camera_feed_id, feed_id)) { - return feed_id; - } - - return 0; + int feed_id = 0; + GDVIRTUAL_CALL(_get_camera_feed_id, feed_id); + return feed_id; } Size2 XRInterfaceExtension::get_render_target_size() { Size2 size; - - if (GDVIRTUAL_CALL(_get_render_target_size, size)) { - return size; - } - - return Size2(0, 0); + GDVIRTUAL_CALL(_get_render_target_size, size); + return size; } uint32_t XRInterfaceExtension::get_view_count() { - uint32_t view_count; - - if (GDVIRTUAL_CALL(_get_view_count, view_count)) { - return view_count; - } - - return 1; + uint32_t view_count = 1; + GDVIRTUAL_CALL(_get_view_count, view_count); + return view_count; } Transform3D XRInterfaceExtension::get_camera_transform() { Transform3D transform; - - if (GDVIRTUAL_CALL(_get_camera_transform, transform)) { - return transform; - } - - return Transform3D(); + GDVIRTUAL_CALL(_get_camera_transform, transform); + return transform; } Transform3D XRInterfaceExtension::get_transform_for_view(uint32_t p_view, const Transform3D &p_cam_transform) { Transform3D transform; - - if (GDVIRTUAL_CALL(_get_transform_for_view, p_view, p_cam_transform, transform)) { - return transform; - } - - return Transform3D(); + GDVIRTUAL_CALL(_get_transform_for_view, p_view, p_cam_transform, transform); + return transform; } Projection XRInterfaceExtension::get_projection_for_view(uint32_t p_view, double p_aspect, double p_z_near, double p_z_far) { @@ -294,29 +240,20 @@ RID XRInterfaceExtension::get_vrs_texture() { RID XRInterfaceExtension::get_color_texture() { RID texture; - if (GDVIRTUAL_CALL(_get_color_texture, texture)) { - return texture; - } else { - return RID(); - } + GDVIRTUAL_CALL(_get_color_texture, texture); + return texture; } RID XRInterfaceExtension::get_depth_texture() { RID texture; - if (GDVIRTUAL_CALL(_get_depth_texture, texture)) { - return texture; - } else { - return RID(); - } + GDVIRTUAL_CALL(_get_depth_texture, texture); + return texture; } RID XRInterfaceExtension::get_velocity_texture() { RID texture; - if (GDVIRTUAL_CALL(_get_velocity_texture, texture)) { - return texture; - } else { - return RID(); - } + GDVIRTUAL_CALL(_get_velocity_texture, texture); + return texture; } void XRInterfaceExtension::add_blit(RID p_render_target, Rect2 p_src_rect, Rect2i p_dst_rect, bool p_use_layer, uint32_t p_layer, bool p_apply_lens_distortion, Vector2 p_eye_center, double p_k1, double p_k2, double p_upscale, double p_aspect_ratio) { @@ -351,13 +288,8 @@ void XRInterfaceExtension::pre_render() { bool XRInterfaceExtension::pre_draw_viewport(RID p_render_target) { bool do_render = true; - - if (GDVIRTUAL_CALL(_pre_draw_viewport, p_render_target, do_render)) { - return do_render; - } else { - // if not implemented we're returning true - return true; - } + GDVIRTUAL_CALL(_pre_draw_viewport, p_render_target, do_render); + return do_render; // If not implemented we're returning true. } Vector<BlitToScreen> XRInterfaceExtension::post_draw_viewport(RID p_render_target, const Rect2 &p_screen_rect) { |