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 /scene/resources | |
parent | 4a96fce801cae2d3e0fe42005c74ca7d60cc1582 (diff) |
Simplify GDVIRTUAL_CALL calls
Diffstat (limited to 'scene/resources')
-rw-r--r-- | scene/resources/material.cpp | 17 | ||||
-rw-r--r-- | scene/resources/style_box.cpp | 16 | ||||
-rw-r--r-- | scene/resources/texture.cpp | 18 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 16 |
4 files changed, 24 insertions, 43 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 8ae217dd1f..10d193f950 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -107,18 +107,15 @@ Shader::Mode Material::get_shader_mode() const { } bool Material::_can_do_next_pass() const { - bool ret; - if (GDVIRTUAL_CALL(_can_do_next_pass, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_can_do_next_pass, ret); + return ret; } + bool Material::_can_use_render_priority() const { - bool ret; - if (GDVIRTUAL_CALL(_can_use_render_priority, ret)) { - return ret; - } - return false; + bool ret = false; + GDVIRTUAL_CALL(_can_use_render_priority, ret); + return ret; } void Material::_bind_methods() { diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index cd893d8c23..f379f88bed 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -43,12 +43,9 @@ float StyleBox::get_style_margin(Side p_side) const { } bool StyleBox::test_mask(const Point2 &p_point, const Rect2 &p_rect) const { - bool ret; - if (GDVIRTUAL_CALL(_test_mask, p_point, p_rect, ret)) { - return ret; - } - - return true; + bool ret = true; + GDVIRTUAL_CALL(_test_mask, p_point, p_rect, ret); + return ret; } void StyleBox::draw(RID p_canvas_item, const Rect2 &p_rect) const { @@ -109,11 +106,8 @@ Point2 StyleBox::get_offset() const { Size2 StyleBox::get_center_size() const { Size2 ret; - if (GDVIRTUAL_CALL(_get_center_size, ret)) { - return ret; - } - - return Size2(); + GDVIRTUAL_CALL(_get_center_size, ret); + return ret; } Rect2 StyleBox::get_draw_rect(const Rect2 &p_rect) const { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 3a2b0ed9cb..43e4e26dda 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -60,20 +60,14 @@ Size2 Texture2D::get_size() const { } bool Texture2D::is_pixel_opaque(int p_x, int p_y) const { - bool ret; - if (GDVIRTUAL_CALL(_is_pixel_opaque, p_x, p_y, ret)) { - return ret; - } - - return true; + bool ret = true; + GDVIRTUAL_CALL(_is_pixel_opaque, p_x, p_y, ret); + return ret; } bool Texture2D::has_alpha() const { - bool ret; - if (GDVIRTUAL_CALL(_has_alpha, ret)) { - return ret; - } - - return true; + bool ret = true; + GDVIRTUAL_CALL(_has_alpha, ret); + return ret; } void Texture2D::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_modulate, bool p_transpose) const { diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 640f6dfcb7..b30ca3e721 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -456,11 +456,9 @@ void VisualShaderNodeCustom::update_ports() { } String VisualShaderNodeCustom::get_caption() const { - String ret; - if (GDVIRTUAL_CALL(_get_name, ret)) { - return ret; - } - return "Unnamed"; + String ret = "Unnamed"; + GDVIRTUAL_CALL(_get_name, ret); + return ret; } int VisualShaderNodeCustom::get_input_port_count() const { @@ -559,11 +557,9 @@ String VisualShaderNodeCustom::generate_global_per_func(Shader::Mode p_mode, Vis } bool VisualShaderNodeCustom::is_available(Shader::Mode p_mode, VisualShader::Type p_type) const { - bool ret; - if (GDVIRTUAL_CALL(_is_available, p_mode, p_type, ret)) { - return ret; - } - return true; + bool ret = true; + GDVIRTUAL_CALL(_is_available, p_mode, p_type, ret); + return ret; } void VisualShaderNodeCustom::set_input_port_default_value(int p_port, const Variant &p_value, const Variant &p_prev_value) { |