From f057d755abdb0328113ab9472c243b94694a8b04 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Sat, 8 Apr 2023 09:16:21 -0300 Subject: [PATCH] Remove unnecessary zero multiplications --- editor/editor_themes.cpp | 38 +++++++++---------- editor/plugins/node_3d_editor_plugin.cpp | 8 ++-- .../resources/default_theme/default_theme.cpp | 18 ++++----- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index f1688a83a19..de3265f716b 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -836,7 +836,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("font_focus_color", "MenuButton", font_focus_color); theme->set_color("font_outline_color", "MenuButton", font_outline_color); - theme->set_constant("outline_size", "MenuButton", 0 * EDSCALE); + theme->set_constant("outline_size", "MenuButton", 0); theme->set_stylebox("MenuHover", "EditorStyles", style_widget_hover); @@ -862,7 +862,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("icon_disabled_color", "Button", icon_disabled_color); theme->set_constant("h_separation", "Button", 2 * EDSCALE); - theme->set_constant("outline_size", "Button", 0 * EDSCALE); + theme->set_constant("outline_size", "Button", 0); const float ACTION_BUTTON_EXTRA_MARGIN = 32 * EDSCALE; @@ -919,7 +919,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("icon_disabled_color", "MenuBar", icon_disabled_color); theme->set_constant("h_separation", "MenuBar", 4 * EDSCALE); - theme->set_constant("outline_size", "MenuBar", 0 * EDSCALE); + theme->set_constant("outline_size", "MenuBar", 0); // OptionButton Ref style_option_button_focus = style_widget_focus->duplicate(); @@ -963,7 +963,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_constant("arrow_margin", "OptionButton", widget_default_margin.x - 2 * EDSCALE); theme->set_constant("modulate_arrow", "OptionButton", true); theme->set_constant("h_separation", "OptionButton", 4 * EDSCALE); - theme->set_constant("outline_size", "OptionButton", 0 * EDSCALE); + theme->set_constant("outline_size", "OptionButton", 0); // CheckButton theme->set_stylebox("normal", "CheckButton", style_menu); @@ -997,8 +997,8 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("icon_disabled_color", "CheckButton", icon_disabled_color); theme->set_constant("h_separation", "CheckButton", 8 * EDSCALE); - theme->set_constant("check_v_offset", "CheckButton", 0 * EDSCALE); - theme->set_constant("outline_size", "CheckButton", 0 * EDSCALE); + theme->set_constant("check_v_offset", "CheckButton", 0); + theme->set_constant("outline_size", "CheckButton", 0); // Checkbox Ref sb_checkbox = style_menu->duplicate(); @@ -1033,8 +1033,8 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("icon_disabled_color", "CheckBox", icon_disabled_color); theme->set_constant("h_separation", "CheckBox", 8 * EDSCALE); - theme->set_constant("check_v_offset", "CheckBox", 0 * EDSCALE); - theme->set_constant("outline_size", "CheckBox", 0 * EDSCALE); + theme->set_constant("check_v_offset", "CheckBox", 0); + theme->set_constant("outline_size", "CheckBox", 0); // PopupDialog theme->set_stylebox("panel", "PopupDialog", style_popup); @@ -1089,7 +1089,7 @@ Ref create_editor_theme(const Ref p_theme) { const int vsep_base = extra_spacing + default_margin_size + 6; const int force_even_vsep = vsep_base + (vsep_base % 2); theme->set_constant("v_separation", "PopupMenu", force_even_vsep * EDSCALE); - theme->set_constant("outline_size", "PopupMenu", 0 * EDSCALE); + theme->set_constant("outline_size", "PopupMenu", 0); theme->set_constant("item_start_padding", "PopupMenu", default_margin_size * 1.5 * EDSCALE); theme->set_constant("item_end_padding", "PopupMenu", default_margin_size * 1.5 * EDSCALE); @@ -1208,7 +1208,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_constant("button_margin", "Tree", default_margin_size * EDSCALE); theme->set_constant("scroll_border", "Tree", 40 * EDSCALE); theme->set_constant("scroll_speed", "Tree", 12); - theme->set_constant("outline_size", "Tree", 0 * EDSCALE); + theme->set_constant("outline_size", "Tree", 0); theme->set_constant("scrollbar_margin_left", "Tree", 0); theme->set_constant("scrollbar_margin_top", "Tree", 0); theme->set_constant("scrollbar_margin_right", "Tree", 0); @@ -1310,7 +1310,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_constant("h_separation", "ItemList", 6 * EDSCALE); theme->set_constant("icon_margin", "ItemList", 6 * EDSCALE); theme->set_constant("line_separation", "ItemList", 3 * EDSCALE); - theme->set_constant("outline_size", "ItemList", 0 * EDSCALE); + theme->set_constant("outline_size", "ItemList", 0); // TabBar & TabContainer Ref style_tabbar_background = make_flat_stylebox(dark_color_1, 0, 0, 0, 0, corner_radius * EDSCALE); @@ -1348,9 +1348,9 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_icon("drop_mark", "TabContainer", theme->get_icon(SNAME("GuiTabDropMark"), SNAME("EditorIcons"))); theme->set_icon("drop_mark", "TabBar", theme->get_icon(SNAME("GuiTabDropMark"), SNAME("EditorIcons"))); theme->set_constant("side_margin", "TabContainer", 0); - theme->set_constant("outline_size", "TabContainer", 0 * EDSCALE); + theme->set_constant("outline_size", "TabContainer", 0); theme->set_constant("h_separation", "TabBar", 4 * EDSCALE); - theme->set_constant("outline_size", "TabBar", 0 * EDSCALE); + theme->set_constant("outline_size", "TabBar", 0); // Content of each tab. Ref style_content_panel = style_default->duplicate(); @@ -1446,7 +1446,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("selection_color", "LineEdit", selection_color); theme->set_color("clear_button_color", "LineEdit", font_color); theme->set_color("clear_button_color_pressed", "LineEdit", accent_color); - theme->set_constant("outline_size", "LineEdit", 0 * EDSCALE); + theme->set_constant("outline_size", "LineEdit", 0); // TextEdit theme->set_stylebox("normal", "TextEdit", style_line_edit); @@ -1463,7 +1463,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0)); theme->set_constant("line_spacing", "TextEdit", 4 * EDSCALE); - theme->set_constant("outline_size", "TextEdit", 0 * EDSCALE); + theme->set_constant("outline_size", "TextEdit", 0); theme->set_icon("h_grabber", "SplitContainer", theme->get_icon(SNAME("GuiHsplitter"), SNAME("EditorIcons"))); theme->set_icon("v_grabber", "SplitContainer", theme->get_icon(SNAME("GuiVsplitter"), SNAME("EditorIcons"))); @@ -1600,7 +1600,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_constant("shadow_offset_x", "RichTextLabel", 1 * EDSCALE); theme->set_constant("shadow_offset_y", "RichTextLabel", 1 * EDSCALE); theme->set_constant("shadow_outline_size", "RichTextLabel", 1 * EDSCALE); - theme->set_constant("outline_size", "RichTextLabel", 0 * EDSCALE); + theme->set_constant("outline_size", "RichTextLabel", 0); theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox()); theme->set_stylebox("normal", "RichTextLabel", style_tree_bg); @@ -1644,7 +1644,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_constant("shadow_offset_y", "Label", 1 * EDSCALE); theme->set_constant("shadow_outline_size", "Label", 1 * EDSCALE); theme->set_constant("line_spacing", "Label", 3 * EDSCALE); - theme->set_constant("outline_size", "Label", 0 * EDSCALE); + theme->set_constant("outline_size", "Label", 0); // LinkButton theme->set_stylebox("focus", "LinkButton", style_empty); @@ -1656,7 +1656,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_color("font_disabled_color", "LinkButton", font_disabled_color); theme->set_color("font_outline_color", "LinkButton", font_outline_color); - theme->set_constant("outline_size", "LinkButton", 0 * EDSCALE); + theme->set_constant("outline_size", "LinkButton", 0); // TooltipPanel + TooltipLabel // TooltipPanel is also used for custom tooltips, while TooltipLabel @@ -1693,7 +1693,7 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_stylebox("fill", "ProgressBar", make_stylebox(theme->get_icon(SNAME("GuiProgressFill"), SNAME("EditorIcons")), 6, 6, 6, 6, 2, 1, 2, 1)); theme->set_color("font_color", "ProgressBar", font_color); theme->set_color("font_outline_color", "ProgressBar", font_outline_color); - theme->set_constant("outline_size", "ProgressBar", 0 * EDSCALE); + theme->set_constant("outline_size", "ProgressBar", 0); // GraphEdit theme->set_stylebox("bg", "GraphEdit", style_tree_bg); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 27c97ff9f43..00e0cc885ce 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -5162,10 +5162,10 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p position_control->set_navigation_mode(Node3DEditorViewport::NAVIGATION_MOVE); position_control->set_custom_minimum_size(Size2(navigation_control_size, navigation_control_size) * EDSCALE); position_control->set_h_size_flags(SIZE_SHRINK_END); - position_control->set_anchor_and_offset(SIDE_LEFT, ANCHOR_BEGIN, 0 * EDSCALE); + position_control->set_anchor_and_offset(SIDE_LEFT, ANCHOR_BEGIN, 0); position_control->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -navigation_control_size * EDSCALE); position_control->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_BEGIN, navigation_control_size * EDSCALE); - position_control->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0 * EDSCALE); + position_control->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0); position_control->set_viewport(this); surface->add_child(position_control); @@ -5175,8 +5175,8 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p look_control->set_h_size_flags(SIZE_SHRINK_END); look_control->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -navigation_control_size * EDSCALE); look_control->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -navigation_control_size * EDSCALE); - look_control->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, 0 * EDSCALE); - look_control->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0 * EDSCALE); + look_control->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, 0); + look_control->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, 0); look_control->set_viewport(this); surface->add_child(look_control); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 16b1ed07031..8addcea215f 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -162,7 +162,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_font("font", "Button", Ref()); theme->set_font_size("font_size", "Button", -1); - theme->set_constant("outline_size", "Button", 0 * scale); + theme->set_constant("outline_size", "Button", 0); theme->set_color("font_color", "Button", control_font_color); theme->set_color("font_pressed_color", "Button", control_font_pressed_color); @@ -191,7 +191,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_font("font", "MenuBar", Ref()); theme->set_font_size("font_size", "MenuBar", -1); - theme->set_constant("outline_size", "MenuBar", 0 * scale); + theme->set_constant("outline_size", "MenuBar", 0); theme->set_color("font_color", "MenuBar", control_font_color); theme->set_color("font_pressed_color", "MenuBar", control_font_pressed_color); @@ -316,7 +316,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_color("font_outline_color", "CheckBox", Color(1, 1, 1)); theme->set_constant("h_separation", "CheckBox", 4 * scale); - theme->set_constant("check_v_offset", "CheckBox", 0 * scale); + theme->set_constant("check_v_offset", "CheckBox", 0); theme->set_constant("outline_size", "CheckBox", 0); // CheckButton @@ -353,7 +353,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_color("font_outline_color", "CheckButton", Color(1, 1, 1)); theme->set_constant("h_separation", "CheckButton", 4 * scale); - theme->set_constant("check_v_offset", "CheckButton", 0 * scale); + theme->set_constant("check_v_offset", "CheckButton", 0); theme->set_constant("outline_size", "CheckButton", 0); // Label @@ -1045,7 +1045,7 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_constant("shadow_offset_y", "RichTextLabel", 1 * scale); theme->set_constant("shadow_outline_size", "RichTextLabel", 1 * scale); - theme->set_constant("line_separation", "RichTextLabel", 0 * scale); + theme->set_constant("line_separation", "RichTextLabel", 0); theme->set_constant("table_h_separation", "RichTextLabel", 3 * scale); theme->set_constant("table_v_separation", "RichTextLabel", 3 * scale); @@ -1068,10 +1068,10 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const theme->set_constant("separation", "BoxContainer", 4 * scale); theme->set_constant("separation", "HBoxContainer", 4 * scale); theme->set_constant("separation", "VBoxContainer", 4 * scale); - theme->set_constant("margin_left", "MarginContainer", 0 * scale); - theme->set_constant("margin_top", "MarginContainer", 0 * scale); - theme->set_constant("margin_right", "MarginContainer", 0 * scale); - theme->set_constant("margin_bottom", "MarginContainer", 0 * scale); + theme->set_constant("margin_left", "MarginContainer", 0); + theme->set_constant("margin_top", "MarginContainer", 0); + theme->set_constant("margin_right", "MarginContainer", 0); + theme->set_constant("margin_bottom", "MarginContainer", 0); theme->set_constant("h_separation", "GridContainer", 4 * scale); theme->set_constant("v_separation", "GridContainer", 4 * scale); theme->set_constant("separation", "SplitContainer", 12 * scale);