From af0dd6591bd861e33fb2a54d72136dd52ff8ef88 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Sat, 8 Apr 2023 09:16:21 -0300 Subject: Remove unnecessary zero multiplications (cherry picked from commit f057d755abdb0328113ab9472c243b94694a8b04) --- editor/editor_themes.cpp | 38 ++++++++++++------------- editor/plugins/node_3d_editor_plugin.cpp | 8 +++--- scene/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 0d480c7896..178c1f175f 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -834,7 +834,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); @@ -860,7 +860,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; @@ -917,7 +917,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(); @@ -961,7 +961,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); @@ -995,8 +995,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(); @@ -1031,8 +1031,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); @@ -1087,7 +1087,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); @@ -1206,7 +1206,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); const Color guide_color = mono_color * Color(1, 1, 1, 0.05); Color relationship_line_color = mono_color * Color(1, 1, 1, relationship_line_opacity); @@ -1302,7 +1302,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); @@ -1340,9 +1340,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(); @@ -1438,7 +1438,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); @@ -1455,7 +1455,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"))); @@ -1592,7 +1592,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); @@ -1636,7 +1636,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); @@ -1648,7 +1648,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 @@ -1685,7 +1685,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 e443548550..e110e52454 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 11373c430c..35c81ea91b 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); @@ -190,7 +190,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); @@ -315,7 +315,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 @@ -352,7 +352,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 @@ -1034,7 +1034,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); @@ -1057,10 +1057,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); -- cgit v1.2.3