diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_atlas_packer.cpp | 3 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 6 | ||||
-rw-r--r-- | editor/editor_resource_picker.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/animation_state_machine_editor.cpp | 10 | ||||
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/skeleton_3d_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/tiles/tile_atlas_view.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/version_control_editor_plugin.cpp | 3 |
8 files changed, 11 insertions, 24 deletions
diff --git a/editor/editor_atlas_packer.cpp b/editor/editor_atlas_packer.cpp index 5de4869c88..a0f5f1bf11 100644 --- a/editor/editor_atlas_packer.cpp +++ b/editor/editor_atlas_packer.cpp @@ -72,8 +72,7 @@ void EditorAtlasPacker::chart_pack(Vector<Chart> &charts, int &r_width, int &r_h Vector2 vtx = chart.vertices[chart.faces[j].vertex[k]]; vtx -= aabb.position; vtx /= divide_by; - vtx.x = MIN(vtx.x, w - 1); - vtx.y = MIN(vtx.y, h - 1); + vtx = vtx.min(Vector2(w - 1, h - 1)); v[k] = vtx; } diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index a14c6e8462..ff2b305a46 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -86,8 +86,7 @@ Size2 EditorProperty::get_minimum_size() const { } Size2 minsize = c->get_combined_minimum_size(); - ms.width = MAX(ms.width, minsize.width); - ms.height = MAX(ms.height, minsize.height); + ms = ms.max(minsize); } if (keying) { @@ -1463,8 +1462,7 @@ Size2 EditorInspectorSection::get_minimum_size() const { continue; } Size2 minsize = c->get_combined_minimum_size(); - ms.width = MAX(ms.width, minsize.width); - ms.height = MAX(ms.height, minsize.height); + ms = ms.max(minsize); } Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree")); diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index a9225a3057..5450040bea 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -112,7 +112,7 @@ void EditorResourcePicker::_update_resource_preview(const String &p_path, const preview_rect->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); int thumbnail_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size"); thumbnail_size *= EDSCALE; - assign_button->set_custom_minimum_size(Size2(MAX(1, assign_button_min_size.x), MAX(thumbnail_size, assign_button_min_size.y))); + assign_button->set_custom_minimum_size(assign_button_min_size.max(Size2(1, thumbnail_size))); } preview_rect->set_texture(p_preview); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index dbfb143b22..15dc518a67 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -337,10 +337,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT && tool_select->is_pressed()) { box_selecting = true; box_selecting_from = box_selecting_to = state_machine_draw->get_local_mouse_position(); - box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x), - MIN(box_selecting_from.y, box_selecting_to.y), - ABS(box_selecting_from.x - box_selecting_to.x), - ABS(box_selecting_from.y - box_selecting_to.y)); + box_selecting_rect = Rect2(box_selecting_from.min(box_selecting_to), (box_selecting_from - box_selecting_to).abs()); if (mb->is_command_or_control_pressed() || mb->is_shift_pressed()) { previous_selected = selected_nodes; @@ -423,10 +420,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv if (mm.is_valid() && box_selecting) { box_selecting_to = state_machine_draw->get_local_mouse_position(); - box_selecting_rect = Rect2(MIN(box_selecting_from.x, box_selecting_to.x), - MIN(box_selecting_from.y, box_selecting_to.y), - ABS(box_selecting_from.x - box_selecting_to.x), - ABS(box_selecting_from.y - box_selecting_to.y)); + box_selecting_rect = Rect2(box_selecting_from.min(box_selecting_to), (box_selecting_from - box_selecting_to).abs()); for (int i = 0; i < node_rects.size(); i++) { bool in_box = node_rects[i].node.intersects(box_selecting_rect); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index e8804fdf12..70213b280c 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -130,7 +130,7 @@ Ref<Texture2D> EditorTexturePreviewPlugin::generate(const Ref<Resource> &p_from, if (new_size.y > p_size.y) { new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y); } - Vector2i new_size_i(MAX(1, (int)new_size.x), MAX(1, (int)new_size.y)); + Vector2i new_size_i = Vector2i(new_size).max(Vector2i(1, 1)); img->resize(new_size_i.x, new_size_i.y, Image::INTERPOLATE_CUBIC); post_process_preview(img); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index ffc59a3429..6a66a984c0 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -505,10 +505,8 @@ void Skeleton3DEditor::_file_selected(const String &p_file) { position_max = Vector2(grest.origin.x, grest.origin.y); position_min = Vector2(grest.origin.x, grest.origin.y); } else { - position_max.x = MAX(grest.origin.x, position_max.x); - position_max.y = MAX(grest.origin.y, position_max.y); - position_min.x = MIN(grest.origin.x, position_min.x); - position_min.y = MIN(grest.origin.y, position_min.y); + position_max = position_max.max(Vector2(grest.origin.x, grest.origin.y)); + position_min = position_min.min(Vector2(grest.origin.x, grest.origin.y)); } } diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index 8c2cb68413..c3900b8235 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -501,8 +501,7 @@ Vector2i TileAtlasView::get_atlas_tile_coords_at_pos(const Vector2 p_pos, bool p // Clamp. if (p_clamp) { Vector2i size = tile_set_atlas_source->get_atlas_grid_size(); - ret.x = CLAMP(ret.x, 0, size.x - 1); - ret.y = CLAMP(ret.y, 0, size.y - 1); + ret = ret.clamp(Vector2i(), size - Vector2i(1, 1)); } return ret; diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index 9460f9fef2..1a602568fe 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -93,8 +93,7 @@ void VersionControlEditorPlugin::popup_vcs_set_up_dialog(const Control *p_gui_ba if (!available_plugins.is_empty()) { Size2 popup_size = Size2(400, 100); Size2 window_size = p_gui_base->get_viewport_rect().size; - popup_size.x = MIN(window_size.x * 0.5, popup_size.x); - popup_size.y = MIN(window_size.y * 0.5, popup_size.y); + popup_size = popup_size.min(window_size * 0.5); _populate_available_vcs_names(); |