diff --git a/core/input/input.cpp b/core/input/input.cpp index eba7ded267ba..f2b3d03e3f22 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -427,7 +427,7 @@ Vector2 Input::get_joy_vibration_strength(int p_device) { if (joy_vibration.has(p_device)) { return Vector2(joy_vibration[p_device].weak_magnitude, joy_vibration[p_device].strong_magnitude); } else { - return Vector2(0, 0); + return Vector2(); } } diff --git a/core/io/image.cpp b/core/io/image.cpp index f7c286f820a5..53eb8c164546 100644 --- a/core/io/image.cpp +++ b/core/io/image.cpp @@ -2854,7 +2854,7 @@ Rect2i Image::get_used_rect() const { Ref Image::get_region(const Rect2i &p_region) const { Ref img = memnew(Image(p_region.size.x, p_region.size.y, mipmaps, format)); - img->blit_rect(Ref((Image *)this), p_region, Point2i(0, 0)); + img->blit_rect(Ref((Image *)this), p_region, Point2i()); return img; } diff --git a/core/math/a_star_grid_2d.h b/core/math/a_star_grid_2d.h index 1a9f6dcc11fa..255a10e509ea 100644 --- a/core/math/a_star_grid_2d.h +++ b/core/math/a_star_grid_2d.h @@ -66,7 +66,7 @@ class AStarGrid2D : public RefCounted { private: Rect2i region; Vector2 offset; - Size2 cell_size = Size2(1, 1); + Size2 cell_size = Size2(1); bool dirty = false; CellShape cell_shape = CELL_SHAPE_SQUARE; diff --git a/core/math/geometry_3d.h b/core/math/geometry_3d.h index ff39d825958b..c7e21af1fc42 100644 --- a/core/math/geometry_3d.h +++ b/core/math/geometry_3d.h @@ -832,7 +832,7 @@ class Geometry3D { _FORCE_INLINE_ static Vector3 octahedron_map_decode(const Vector2 &p_uv) { // https://twitter.com/Stubbesaurus/status/937994790553227264 - const Vector2 f = p_uv * 2.0f - Vector2(1.0f, 1.0f); + const Vector2 f = p_uv * 2.0f - Vector2(1); Vector3 n = Vector3(f.x, f.y, 1.0f - Math::abs(f.x) - Math::abs(f.y)); const real_t t = CLAMP(-n.z, 0.0f, 1.0f); n.x += n.x >= 0 ? -t : t; diff --git a/core/math/vector2.h b/core/math/vector2.h index edb47db6fd3b..541be3cc0e97 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -189,6 +189,10 @@ struct [[nodiscard]] Vector2 { x = p_x; y = p_y; } + _FORCE_INLINE_ Vector2(real_t p_v) { + x = p_v; + y = p_v; + } }; _FORCE_INLINE_ Vector2 Vector2::plane_project(real_t p_d, const Vector2 &p_vec) const { diff --git a/core/math/vector2i.h b/core/math/vector2i.h index fff9b0a658fb..c33a93632989 100644 --- a/core/math/vector2i.h +++ b/core/math/vector2i.h @@ -147,6 +147,10 @@ struct [[nodiscard]] Vector2i { x = p_x; y = p_y; } + inline Vector2i(int32_t p_v) { + x = p_v; + y = p_v; + } }; // Multiplication operators required to workaround issues with LLVM using implicit conversion. diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index c1ef31c784d6..e95e9e3d83e9 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -234,6 +234,8 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { } break; case VECTOR2: { static const Type valid[] = { + INT, + FLOAT, VECTOR2I, NIL, }; @@ -243,6 +245,8 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) { } break; case VECTOR2I: { static const Type valid[] = { + INT, + FLOAT, VECTOR2, NIL, }; @@ -577,6 +581,8 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type } break; case VECTOR2: { static const Type valid[] = { + INT, + FLOAT, VECTOR2I, NIL, }; @@ -586,6 +592,8 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type } break; case VECTOR2I: { static const Type valid[] = { + INT, + FLOAT, VECTOR2, NIL, }; @@ -1852,7 +1860,11 @@ String Variant::to_json_string() const { } Variant::operator Vector2() const { - if (type == VECTOR2) { + if (type == INT) { + return Vector2(_data._int, _data._int); + } else if (type == FLOAT) { + return Vector2(_data._float, _data._float); + } else if (type == VECTOR2) { return *reinterpret_cast(_data._mem); } else if (type == VECTOR2I) { return *reinterpret_cast(_data._mem); @@ -1870,7 +1882,11 @@ Variant::operator Vector2() const { } Variant::operator Vector2i() const { - if (type == VECTOR2I) { + if (type == INT) { + return Vector2(_data._int, _data._int); + } else if (type == FLOAT) { + return Vector2(_data._float, _data._float); + } else if (type == VECTOR2I) { return *reinterpret_cast(_data._mem); } else if (type == VECTOR2) { return *reinterpret_cast(_data._mem); diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp index 1edae407c249..02d3ff2462ad 100644 --- a/core/variant/variant_construct.cpp +++ b/core/variant/variant_construct.cpp @@ -84,11 +84,13 @@ void Variant::_register_variant_constructors() { add_constructor>(sarray()); add_constructor>(sarray("from")); add_constructor>(sarray("from")); + add_constructor>(sarray("from")); add_constructor>(sarray("x", "y")); add_constructor>(sarray()); add_constructor>(sarray("from")); add_constructor>(sarray("from")); + add_constructor>(sarray("from")); add_constructor>(sarray("x", "y")); add_constructor>(sarray()); diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp index 9a0dd712edc6..4d43aee02795 100644 --- a/core/variant/variant_parser.cpp +++ b/core/variant/variant_parser.cpp @@ -710,12 +710,16 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return err; } - if (args.size() != 2) { - r_err_str = "Expected 2 arguments for constructor"; + if (args.size() == 0) { + value = Vector2(); + } else if (args.size() == 1) { + value = Vector2(args[0], args[0]); + } else if (args.size() == 2) { + value = Vector2(args[0], args[1]); + } else { + r_err_str = "Expected at most 2 arguments for constructor"; return ERR_PARSE_ERROR; } - - value = Vector2(args[0], args[1]); } else if (id == "Vector2i") { Vector args; Error err = _parse_construct(p_stream, args, line, r_err_str); @@ -723,12 +727,16 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream, return err; } - if (args.size() != 2) { - r_err_str = "Expected 2 arguments for constructor"; + if (args.size() == 0) { + value = Vector2i(); + } else if (args.size() == 1) { + value = Vector2i(args[0], args[0]); + } else if (args.size() == 2) { + value = Vector2i(args[0], args[1]); + } else { + r_err_str = "Expected at most 2 arguments for constructor"; return ERR_PARSE_ERROR; } - - value = Vector2i(args[0], args[1]); } else if (id == "Rect2") { Vector args; Error err = _parse_construct(p_stream, args, line, r_err_str); diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 78183ae36ce4..b8b7d2e03664 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -38,6 +38,13 @@ Constructs a new [Vector2] from [Vector2i]. + + + + + Constructs a new [Vector2] from [float]. + + diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml index 4afc62e03878..50c7410628c6 100644 --- a/doc/classes/Vector2i.xml +++ b/doc/classes/Vector2i.xml @@ -34,6 +34,13 @@ Constructs a new [Vector2i] from the given [Vector2] by truncating components' fractional parts (rounding towards zero). For a different behavior consider passing the result of [method Vector2.ceil], [method Vector2.floor] or [method Vector2.round] to this constructor instead. + + + + + Constructs a new [Vector2] from [int]. + + diff --git a/drivers/gles3/effects/copy_effects.cpp b/drivers/gles3/effects/copy_effects.cpp index 47ca832bd7ab..45d72048f3f1 100644 --- a/drivers/gles3/effects/copy_effects.cpp +++ b/drivers/gles3/effects/copy_effects.cpp @@ -260,8 +260,8 @@ void CopyEffects::gaussian_blur(GLuint p_source_texture, int p_mipmap_count, con } float_size = Size2(base_size); - normalized_dest_region.position = Size2(dest_region.position) / float_size; - normalized_dest_region.size = Size2(dest_region.size) / float_size; + normalized_dest_region.position = Size2(dest_region.position / float_size); + normalized_dest_region.size = Size2(dest_region.size / float_size); copy.shader.version_set_uniform(CopyShaderGLES3::COPY_SECTION, normalized_dest_region.position.x, normalized_dest_region.position.y, normalized_dest_region.size.x, normalized_dest_region.size.y, copy.shader_version, CopyShaderGLES3::MODE_GAUSSIAN_BLUR); copy.shader.version_set_uniform(CopyShaderGLES3::SOURCE_SECTION, normalized_source_region.position.x, normalized_source_region.position.y, normalized_source_region.size.x, normalized_source_region.size.y, copy.shader_version, CopyShaderGLES3::MODE_GAUSSIAN_BLUR); diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 78fd8a6e4789..a703ff172063 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1035,7 +1035,7 @@ void RasterizerCanvasGLES3::_record_item_commands(const Item *p_item, RID p_rend Rect2 dst_rect(np->rect.position.x, np->rect.position.y, np->rect.size.x, np->rect.size.y); if (np->texture == RID()) { - texpixel_size = Size2(1, 1); + texpixel_size = Size2(1); src_rect = Rect2(0, 0, 1, 1); } else { @@ -1890,7 +1890,7 @@ void RasterizerCanvasGLES3::render_sdf(RID p_render_target, LightOccluderInstanc Transform2D to_clip; to_clip.columns[0] *= 2.0; to_clip.columns[1] *= 2.0; - to_clip.columns[2] = -Vector2(1.0, 1.0); + to_clip.columns[2] = Vector2(-1); to_clip = to_clip * to_sdf.affine_inverse(); @@ -2340,7 +2340,7 @@ void RasterizerCanvasGLES3::_prepare_canvas_texture(RID p_texture, RS::CanvasIte } // Enforce a 1x1 size if default white texture. - size_cache = ct->diffuse == default_texture_id ? Size2i(1, 1) : Size2i(texture->width, texture->height); + size_cache = ct->diffuse == default_texture_id ? Size2i(1) : Size2i(texture->width, texture->height); GLES3::Texture *normal_map = texture_storage->get_texture(ct->normal_map); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 2ee439c6c441..39552e565a07 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1499,7 +1499,7 @@ void RasterizerSceneGLES3::_setup_environment(const RenderDataGLES3 *p_render_da scene_state.ubo.viewport_size[0] = p_screen_size.x; scene_state.ubo.viewport_size[1] = p_screen_size.y; - Size2 screen_pixel_size = Vector2(1.0, 1.0) / Size2(p_screen_size); + Size2 screen_pixel_size = Size2(1) / Size2(p_screen_size); scene_state.ubo.screen_pixel_size[0] = screen_pixel_size.x; scene_state.ubo.screen_pixel_size[1] = screen_pixel_size.y; @@ -3639,7 +3639,7 @@ void RasterizerSceneGLES3::_render_uv2(const PagedArray(&render_list_params, &render_data, 0, render_list[RENDER_LIST_SECONDARY].elements.size()); } - render_list_params.uv_offset = Vector2(0, 0); + render_list_params.uv_offset = Vector2(); render_list_params.force_wireframe = false; _render_list_template(&render_list_params, &render_data, 0, render_list[RENDER_LIST_SECONDARY].elements.size()); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 4c70c43244fa..6487ff8d5516 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -570,7 +570,7 @@ class RasterizerSceneGLES3 : public RendererSceneRender { bool reverse_cull = false; uint64_t spec_constant_base_flags = 0; bool force_wireframe = false; - Vector2 uv_offset = Vector2(0, 0); + Vector2 uv_offset = Vector2(); RenderListParameters(GeometryInstanceSurface **p_elements, int p_element_count, bool p_reverse_cull, uint64_t p_spec_constant_base_flags, bool p_force_wireframe = false, Vector2 p_uv_offset = Vector2()) { elements = p_elements; @@ -641,8 +641,8 @@ class RasterizerSceneGLES3 : public RendererSceneRender { void _setup_lights(const RenderDataGLES3 *p_render_data, bool p_using_shadows, uint32_t &r_directional_light_count, uint32_t &r_omni_light_count, uint32_t &r_spot_light_count, uint32_t &r_directional_shadow_count); void _setup_environment(const RenderDataGLES3 *p_render_data, bool p_no_fog, const Size2i &p_screen_size, bool p_flip_y, const Color &p_default_bg_color, bool p_pancake_shadows, float p_shadow_bias = 0.0); void _fill_render_list(RenderListType p_render_list, const RenderDataGLES3 *p_render_data, PassMode p_pass_mode, bool p_append = false); - void _render_shadows(const RenderDataGLES3 *p_render_data, const Size2i &p_viewport_size = Size2i(1, 1)); - void _render_shadow_pass(RID p_light, RID p_shadow_atlas, int p_pass, const PagedArray &p_instances, float p_lod_distance_multiplier = 0, float p_screen_mesh_lod_threshold = 0.0, RenderingMethod::RenderInfo *p_render_info = nullptr, const Size2i &p_viewport_size = Size2i(1, 1), const Transform3D &p_main_cam_transform = Transform3D()); + void _render_shadows(const RenderDataGLES3 *p_render_data, const Size2i &p_viewport_size = Size2i(1)); + void _render_shadow_pass(RID p_light, RID p_shadow_atlas, int p_pass, const PagedArray &p_instances, float p_lod_distance_multiplier = 0, float p_screen_mesh_lod_threshold = 0.0, RenderingMethod::RenderInfo *p_render_info = nullptr, const Size2i &p_viewport_size = Size2i(1), const Transform3D &p_main_cam_transform = Transform3D()); void _render_post_processing(const RenderDataGLES3 *p_render_data); template @@ -713,7 +713,7 @@ class RasterizerSceneGLES3 : public RendererSceneRender { GLuint half_res_framebuffer = 0; GLuint quarter_res_pass = 0; GLuint quarter_res_framebuffer = 0; - Size2i screen_size = Size2i(0, 0); + Size2i screen_size = Size2i(); // Radiance Cubemap GLuint radiance = 0; diff --git a/drivers/gles3/storage/light_storage.cpp b/drivers/gles3/storage/light_storage.cpp index e0daa2dc296c..2eff9db8edd2 100644 --- a/drivers/gles3/storage/light_storage.cpp +++ b/drivers/gles3/storage/light_storage.cpp @@ -789,7 +789,7 @@ bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_ if (atlas->render_buffers.is_null()) { atlas->render_buffers.instantiate(); - atlas->render_buffers->configure_for_probe(Size2i(atlas->size, atlas->size)); + atlas->render_buffers->configure_for_probe(Size2i(atlas->size)); } // First we check if our atlas is initialized. diff --git a/drivers/gles3/storage/texture_storage.cpp b/drivers/gles3/storage/texture_storage.cpp index e96c8bb8a8fb..81ef52329b54 100644 --- a/drivers/gles3/storage/texture_storage.cpp +++ b/drivers/gles3/storage/texture_storage.cpp @@ -1863,7 +1863,7 @@ void TextureStorage::update_texture_atlas() { for (int i = 0; i < item_count; i++) { TextureAtlas::Texture *t = texture_atlas.textures.getptr(items[i].texture); - t->uv_rect.position = items[i].pos * border + Vector2i(border / 2, border / 2); + t->uv_rect.position = items[i].pos * border + Vector2i(border / 2); t->uv_rect.size = items[i].pixel_size; t->uv_rect.position /= Size2(texture_atlas.size); diff --git a/drivers/gles3/storage/texture_storage.h b/drivers/gles3/storage/texture_storage.h index 1b83efee3295..251594a03243 100644 --- a/drivers/gles3/storage/texture_storage.h +++ b/drivers/gles3/storage/texture_storage.h @@ -335,8 +335,8 @@ struct Texture { }; struct RenderTarget { - Point2i position = Point2i(0, 0); - Size2i size = Size2i(0, 0); + Point2i position = Point2i(); + Size2i size = Size2i(); uint32_t view_count = 1; int mipmap_count = 1; RID self; diff --git a/drivers/vulkan/rendering_device_driver_vulkan.cpp b/drivers/vulkan/rendering_device_driver_vulkan.cpp index 97fd156584cc..3faf101a7289 100644 --- a/drivers/vulkan/rendering_device_driver_vulkan.cpp +++ b/drivers/vulkan/rendering_device_driver_vulkan.cpp @@ -819,7 +819,7 @@ Error RenderingDeviceDriverVulkan::_check_device_capabilities() { vrs_capabilities.max_fragment_size.y = vrs_properties.maxFragmentSize.height; // generally the same as width // We'll attempt to default to a texel size of 16x16. - vrs_capabilities.texel_size = Vector2i(16, 16).clamp(vrs_capabilities.min_texel_size, vrs_capabilities.max_texel_size); + vrs_capabilities.texel_size = Vector2i(16).clamp(vrs_capabilities.min_texel_size, vrs_capabilities.max_texel_size); print_verbose(String(" Attachment fragment shading rate") + String(", min texel size: (") + itos(vrs_capabilities.min_texel_size.x) + String(", ") + itos(vrs_capabilities.min_texel_size.y) + String(")") + String(", max texel size: (") + itos(vrs_capabilities.max_texel_size.x) + String(", ") + itos(vrs_capabilities.max_texel_size.y) + String(")") + String(", max fragment size: (") + itos(vrs_capabilities.max_fragment_size.x) + String(", ") + itos(vrs_capabilities.max_fragment_size.y) + String(")")); } diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 7d9af1df044f..2448da9eb134 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -670,7 +670,7 @@ void AnimationBezierTrackEdit::set_animation_and_track(const Ref &p_a } Size2 AnimationBezierTrackEdit::get_minimum_size() const { - return Vector2(1, 1); + return Size2(1); } void AnimationBezierTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) { diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index f14b81c1ea39..c067a70de350 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1445,7 +1445,7 @@ void AnimationTimelineEdit::_notification(int p_what) { } break; case NOTIFICATION_RESIZED: { - len_hb->set_position(Vector2(get_size().width - get_buttons_width(), 0)); + len_hb->set_position(Point2(get_size().width - get_buttons_width(), 0)); len_hb->set_size(Size2(get_buttons_width(), get_size().height)); } break; @@ -1618,7 +1618,7 @@ void AnimationTimelineEdit::_notification(int p_what) { } } - draw_line(Vector2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE)); + draw_line(Point2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE)); update_values(); } break; } @@ -1922,7 +1922,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() { play_position->connect(SceneStringName(draw), callable_mp(this, &AnimationTimelineEdit::_play_position_draw)); add_track = memnew(MenuButton); - add_track->set_position(Vector2(0, 0)); + add_track->set_position(Point2()); add_child(add_track); add_track->set_text(TTR("Add Track")); @@ -1940,7 +1940,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() { length->set_max(36000); length->set_step(SECOND_DECIMAL); length->set_allow_greater(true); - length->set_custom_minimum_size(Vector2(70 * EDSCALE, 0)); + length->set_custom_minimum_size(Size2(70 * EDSCALE, 0)); length->set_hide_slider(true); length->set_tooltip_text(TTR("Animation length (seconds)")); length->connect(SceneStringName(value_changed), callable_mp(this, &AnimationTimelineEdit::_anim_length_changed)); @@ -2053,7 +2053,7 @@ void AnimationTrackEdit::_notification(int p_what) { text_color.a *= 0.7; } else if (node) { Ref icon = EditorNode::get_singleton()->get_object_icon(node, "Node"); - const Vector2 icon_size = Vector2(1, 1) * get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); + const Size2 icon_size = Size2(get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor))); draw_texture_rect(icon, Rect2(Point2(ofs, int(get_size().height - icon_size.y) / 2), icon_size)); icon_cache = icon; @@ -2174,7 +2174,7 @@ void AnimationTrackEdit::_notification(int p_what) { if (!read_only) { if (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_AUDIO) { - draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2)); + draw_texture(down_icon, Point2(ofs, int(get_size().height - down_icon->get_height()) / 2)); update_mode_rect.size.x += down_icon->get_width(); } else if (animation->track_get_type(track) == Animation::TYPE_BEZIER) { update_mode_rect.size.x += down_icon->get_width(); @@ -2213,7 +2213,7 @@ void AnimationTrackEdit::_notification(int p_what) { interp_mode_rect.size.x += hsep / 2; if (!read_only && !animation->track_is_compressed(track) && (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_BLEND_SHAPE || animation->track_get_type(track) == Animation::TYPE_POSITION_3D || animation->track_get_type(track) == Animation::TYPE_SCALE_3D || animation->track_get_type(track) == Animation::TYPE_ROTATION_3D)) { - draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2)); + draw_texture(down_icon, Point2(ofs, int(get_size().height - down_icon->get_height()) / 2)); interp_mode_rect.size.x += down_icon->get_width(); } else { interp_mode_rect = Rect2(); @@ -2246,7 +2246,7 @@ void AnimationTrackEdit::_notification(int p_what) { loop_wrap_rect.size.x += hsep / 2; if (!read_only && !animation->track_is_compressed(track) && (animation->track_get_type(track) == Animation::TYPE_VALUE || animation->track_get_type(track) == Animation::TYPE_BLEND_SHAPE || animation->track_get_type(track) == Animation::TYPE_POSITION_3D || animation->track_get_type(track) == Animation::TYPE_SCALE_3D || animation->track_get_type(track) == Animation::TYPE_ROTATION_3D)) { - draw_texture(down_icon, Vector2(ofs, int(get_size().height - down_icon->get_height()) / 2)); + draw_texture(down_icon, Point2(ofs, int(get_size().height - down_icon->get_height()) / 2)); loop_wrap_rect.size.x += down_icon->get_width(); } else { loop_wrap_rect = Rect2(); @@ -2275,17 +2275,17 @@ void AnimationTrackEdit::_notification(int p_what) { } if (in_group) { - draw_line(Vector2(timeline->get_name_limit(), get_size().height), get_size(), linecolor, Math::round(EDSCALE)); + draw_line(Point2(timeline->get_name_limit(), get_size().height), get_size(), linecolor, Math::round(EDSCALE)); } else { - draw_line(Vector2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE)); + draw_line(Point2(0, get_size().height), get_size(), linecolor, Math::round(EDSCALE)); } if (dropping_at != 0) { Color drop_color = get_theme_color(SNAME("accent_color"), EditorStringName(Editor)); if (dropping_at < 0) { - draw_line(Vector2(0, 0), Vector2(get_size().width, 0), drop_color, Math::round(EDSCALE)); + draw_line(Point2(), Point2(get_size().width, 0), drop_color, Math::round(EDSCALE)); } else { - draw_line(Vector2(0, get_size().height), get_size(), drop_color, Math::round(EDSCALE)); + draw_line(Point2(0, get_size().height), get_size(), drop_color, Math::round(EDSCALE)); } } } break; @@ -2407,7 +2407,7 @@ void AnimationTrackEdit::draw_key(int p_index, float p_pixels_sec, int p_x, bool int limit = MAX(0, p_clip_right - p_x - icon_to_draw->get_width()); if (limit > 0) { - draw_string(font, Vector2(p_x + icon_to_draw->get_width(), int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), text, HORIZONTAL_ALIGNMENT_LEFT, limit, font_size, color); + draw_string(font, Point2(p_x + icon_to_draw->get_width(), int(get_size().height - font->get_height(font_size)) / 2 + font->get_ascent(font_size)), text, HORIZONTAL_ALIGNMENT_LEFT, limit, font_size, color); } } @@ -2513,7 +2513,7 @@ Size2 AnimationTrackEdit::get_minimum_size() const { int max_h = MAX(texture->get_height(), font->get_height(font_size)); max_h = MAX(max_h, get_key_height()); - return Vector2(1, max_h + separation); + return Size2(1, max_h + separation); } void AnimationTrackEdit::set_timeline(AnimationTimelineEdit *p_timeline) { @@ -2850,7 +2850,7 @@ void AnimationTrackEdit::gui_input(const Ref &p_event) { moving_selection_attempt = false; moving_selection = false; - Vector2 popup_pos = get_screen_position() + update_mode_rect.position + Vector2(0, update_mode_rect.size.height); + Point2 popup_pos = get_screen_position() + update_mode_rect.position + Point2(0, update_mode_rect.size.height); menu->set_position(popup_pos); menu->popup(); accept_event(); @@ -2899,7 +2899,7 @@ void AnimationTrackEdit::gui_input(const Ref &p_event) { moving_selection_attempt = false; moving_selection = false; - Vector2 popup_pos = get_screen_position() + interp_mode_rect.position + Vector2(0, interp_mode_rect.size.height); + Point2 popup_pos = get_screen_position() + interp_mode_rect.position + Point2(0, interp_mode_rect.size.height); menu->set_position(popup_pos); menu->popup(); accept_event(); @@ -2919,7 +2919,7 @@ void AnimationTrackEdit::gui_input(const Ref &p_event) { moving_selection_attempt = false; moving_selection = false; - Vector2 popup_pos = get_screen_position() + loop_wrap_rect.position + Vector2(0, loop_wrap_rect.size.height); + Point2 popup_pos = get_screen_position() + loop_wrap_rect.position + Point2(0, loop_wrap_rect.size.height); menu->set_position(popup_pos); menu->popup(); accept_event(); @@ -3435,7 +3435,7 @@ AnimationTrackEdit *AnimationTrackEditPlugin::create_animation_track_edit(Object void AnimationTrackEditGroup::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: { - icon_size = Vector2(1, 1) * get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); + icon_size = Size2(get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor))); } break; case NOTIFICATION_DRAW: { @@ -3508,7 +3508,7 @@ Size2 AnimationTrackEditGroup::get_minimum_size() const { int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label")); int separation = get_theme_constant(SNAME("v_separation"), SNAME("ItemList")); - return Vector2(0, MAX(font->get_height(font_size), icon_size.y) + separation); + return Size2(0, MAX(font->get_height(font_size), icon_size.y) + separation); } void AnimationTrackEditGroup::set_timeline(AnimationTimelineEdit *p_timeline) { @@ -6865,7 +6865,7 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { } break; case EDIT_CLEAN_UP_ANIMATION: { - cleanup_dialog->popup_centered(Size2(300, 0) * EDSCALE); + cleanup_dialog->popup_centered(Size2(300 * EDSCALE, 0)); } break; case EDIT_CLEAN_UP_ANIMATION_CONFIRM: { @@ -7249,7 +7249,7 @@ AnimationTrackEditor::AnimationTrackEditor() { bezier_edit->hide(); bezier_edit->set_v_size_flags(SIZE_EXPAND_FILL); - timeline_vbox->set_custom_minimum_size(Size2(0, 150) * EDSCALE); + timeline_vbox->set_custom_minimum_size(Size2(0, 150 * EDSCALE)); hscroll = memnew(HScrollBar); hscroll->share(timeline); @@ -7329,7 +7329,7 @@ AnimationTrackEditor::AnimationTrackEditor() { step->set_max(1000000); step->set_step(SECOND_DECIMAL); step->set_hide_slider(true); - step->set_custom_minimum_size(Size2(100, 0) * EDSCALE); + step->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); step->set_tooltip_text(TTR("Animation step value.")); bottom_hb->add_child(step); step->connect(SceneStringName(value_changed), callable_mp(this, &AnimationTrackEditor::_update_step)); @@ -7352,7 +7352,7 @@ AnimationTrackEditor::AnimationTrackEditor() { zoom->set_min(0.0); zoom->set_max(2.0); zoom->set_value(1.0); - zoom->set_custom_minimum_size(Size2(200, 0) * EDSCALE); + zoom->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); zoom->set_v_size_flags(SIZE_SHRINK_CENTER); bottom_hb->add_child(zoom); timeline->set_zoom(zoom); diff --git a/editor/animation_track_editor.h b/editor/animation_track_editor.h index 4c7c1a58f83a..57924e389e22 100644 --- a/editor/animation_track_editor.h +++ b/editor/animation_track_editor.h @@ -362,7 +362,7 @@ class AnimationBezierTrackEdit; class AnimationTrackEditGroup : public Control { GDCLASS(AnimationTrackEditGroup, Control); Ref icon; - Vector2 icon_size; + Size2 icon_size; String node_name; NodePath node; Node *root = nullptr; diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index 0297aaaf7f35..40308589ed0d 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -172,12 +172,12 @@ void AnimationTrackEditColor::draw_key(int p_index, float p_pixels_sec, int p_x, int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; - Rect2 rect(Vector2(p_x - fh / 2, int(get_size().height - fh) / 2), Size2(fh, fh)); + Rect2 rect(Point2(p_x - fh / 2, int(get_size().height - fh) / 2), Size2(fh)); draw_rect_clipped(Rect2(rect.position, rect.size / 2), Color(0.4, 0.4, 0.4)); draw_rect_clipped(Rect2(rect.position + rect.size / 2, rect.size / 2), Color(0.4, 0.4, 0.4)); - draw_rect_clipped(Rect2(rect.position + Vector2(rect.size.x / 2, 0), rect.size / 2), Color(0.6, 0.6, 0.6)); - draw_rect_clipped(Rect2(rect.position + Vector2(0, rect.size.y / 2), rect.size / 2), Color(0.6, 0.6, 0.6)); + draw_rect_clipped(Rect2(rect.position + Point2(rect.size.x / 2, 0), rect.size / 2), Color(0.6, 0.6, 0.6)); + draw_rect_clipped(Rect2(rect.position + Point2(0, rect.size.y / 2), rect.size / 2), Color(0.6, 0.6, 0.6)); draw_rect_clipped(rect, color); if (p_selected) { @@ -337,7 +337,7 @@ void AnimationTrackEditAudio::draw_key(int p_index, float p_pixels_sec, int p_x, Ref font = get_theme_font(SceneStringName(font), SNAME("Label")); int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; - Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh)); + Rect2 rect(Point2(p_x, int(get_size().height - fh) / 2), Size2(fh)); Color color = get_theme_color(SceneStringName(font_color), SNAME("Label")); draw_rect_clipped(rect, color); @@ -708,7 +708,7 @@ void AnimationTrackEditSubAnim::draw_key(int p_index, float p_pixels_sec, int p_ Ref font = get_theme_font(SceneStringName(font), SNAME("Label")); int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; - Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh)); + Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh)); Color color = get_theme_color(SceneStringName(font_color), SNAME("Label")); draw_rect_clipped(rect, color); @@ -748,7 +748,7 @@ void AnimationTrackEditVolumeDB::draw_fg(int p_clip_left, int p_clip_right) { int y_from = (get_size().height - tex_h) / 2; int db0 = y_from + (24 / 80.0) * tex_h; - draw_line(Vector2(p_clip_left, db0), Vector2(p_clip_right, db0), Color(1, 1, 1, 0.3)); + draw_line(Point2(p_clip_left, db0), Point2(p_clip_right, db0), Color(1, 1, 1, 0.3)); } void AnimationTrackEditVolumeDB::draw_key_link(int p_index, float p_pixels_sec, int p_x, int p_next_x, int p_clip_left, int p_clip_right) { @@ -1313,7 +1313,7 @@ void AnimationTrackEditTypeAnimation::draw_key(int p_index, float p_pixels_sec, Ref font = get_theme_font(SceneStringName(font), SNAME("Label")); int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label")); int fh = font->get_height(font_size) * 0.8; - Rect2 rect(Vector2(p_x, int(get_size().height - fh) / 2), Size2(fh, fh)); + Rect2 rect(Point2(p_x, int(get_size().height - fh) / 2), Size2(fh)); Color color = get_theme_color(SceneStringName(font_color), SNAME("Label")); draw_rect_clipped(rect, color); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 8664c167b584..3a7be980b249 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -255,7 +255,7 @@ void FindReplaceBar::_replace_all() { text_editor->disconnect(SceneStringName(text_changed), callable_mp(this, &FindReplaceBar::_editor_text_changed)); // Line as x so it gets priority in comparison, column as y. Point2i orig_cursor(text_editor->get_caret_line(0), text_editor->get_caret_column(0)); - Point2i prev_match = Point2(-1, -1); + Point2i prev_match = Point2(-1); bool selection_enabled = text_editor->has_selection(0); if (!is_selection_only()) { diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index eb0ab1174b32..3bff1ca7d11d 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -708,7 +708,7 @@ void ConnectDialog::_advanced_pressed() { } ConnectDialog::ConnectDialog() { - set_min_size(Size2(0, 500) * EDSCALE); + set_min_size(Size2(0, 500 * EDSCALE)); HBoxContainer *main_hb = memnew(HBoxContainer); add_child(main_hb); @@ -716,7 +716,7 @@ ConnectDialog::ConnectDialog() { VBoxContainer *vbc_left = memnew(VBoxContainer); main_hb->add_child(vbc_left); vbc_left->set_h_size_flags(Control::SIZE_EXPAND_FILL); - vbc_left->set_custom_minimum_size(Vector2(400 * EDSCALE, 0)); + vbc_left->set_custom_minimum_size(Size2(400 * EDSCALE, 0)); from_signal = memnew(LineEdit); vbc_left->add_margin_child(TTR("From Signal:"), from_signal); @@ -759,7 +759,7 @@ ConnectDialog::ConnectDialog() { method_popup = memnew(AcceptDialog); method_popup->set_title(TTR("Select Method")); - method_popup->set_min_size(Vector2(400, 600) * EDSCALE); + method_popup->set_min_size(Size2(400, 600) * EDSCALE); add_child(method_popup); VBoxContainer *method_vbc = memnew(VBoxContainer); @@ -800,7 +800,7 @@ ConnectDialog::ConnectDialog() { vbc_right = memnew(VBoxContainer); main_hb->add_child(vbc_right); vbc_right->set_h_size_flags(Control::SIZE_EXPAND_FILL); - vbc_right->set_custom_minimum_size(Vector2(150 * EDSCALE, 0)); + vbc_right->set_custom_minimum_size(Size2(150 * EDSCALE, 0)); vbc_right->hide(); HBoxContainer *add_bind_hb = memnew(HBoxContainer); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 204636e128cd..78b3737bc250 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -787,7 +787,7 @@ CreateDialog::CreateDialog() { recent->add_theme_constant_override("draw_guides", 1); VBoxContainer *vbc = memnew(VBoxContainer); - vbc->set_custom_minimum_size(Size2(300, 0) * EDSCALE); + vbc->set_custom_minimum_size(Size2(300 * EDSCALE, 0)); vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); hsc->add_child(vbc); diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index 816bd6b72c39..2e5b0d0e1667 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -273,7 +273,7 @@ void EditorDebuggerInspector::add_stack_variable(const Array &p_array) { void EditorDebuggerInspector::clear_stack_variables() { variables->clear(); variables->update(); - set_custom_minimum_size(Size2(0, 0)); + set_custom_minimum_size(Size2()); } String EditorDebuggerInspector::get_stack_variable(const String &p_var) { diff --git a/editor/debugger/editor_performance_profiler.cpp b/editor/debugger/editor_performance_profiler.cpp index 1ea9a6653478..69006947ff3a 100644 --- a/editor/debugger/editor_performance_profiler.cpp +++ b/editor/debugger/editor_performance_profiler.cpp @@ -128,7 +128,7 @@ void EditorPerformanceProfiler::_monitor_draw() { for (int i = 0; i < active.size(); i++) { Monitor ¤t = monitors[active[i]]; - Rect2i rect(Point2i(i % columns, i / columns) * cell_size + Point2i(MARGIN, MARGIN), cell_size - Point2i(MARGIN, MARGIN) * 2); + Rect2i rect(Point2i(i % columns, i / columns) * cell_size + Point2i(MARGIN), cell_size - Point2i(MARGIN) * 2); monitor_draw->draw_style_box(graph_style_box, rect); rect.position += graph_style_box->get_offset(); @@ -154,13 +154,13 @@ void EditorPerformanceProfiler::_monitor_draw() { if (line_count > 0) { Color horizontal_line_color; horizontal_line_color.set_hsv(draw_color.get_h(), draw_color.get_s() * 0.5f, draw_color.get_v() * 0.5f, 0.3f); - monitor_draw->draw_line(rect.position, rect.position + Vector2(rect.size.width, 0), horizontal_line_color, Math::round(EDSCALE)); - monitor_draw->draw_string(graph_font, rect.position + Vector2(0, graph_font->get_ascent(font_size)), _create_label(current.max, current.type), HORIZONTAL_ALIGNMENT_LEFT, rect.size.width, font_size, horizontal_line_color); + monitor_draw->draw_line(rect.position, rect.position + Point2(rect.size.width, 0), horizontal_line_color, Math::round(EDSCALE)); + monitor_draw->draw_string(graph_font, rect.position + Point2(0, graph_font->get_ascent(font_size)), _create_label(current.max, current.type), HORIZONTAL_ALIGNMENT_LEFT, rect.size.width, font_size, horizontal_line_color); for (int j = 0; j < line_count; j++) { - Vector2 y_offset = Vector2(0, rect.size.height * (1.0f - float(j) / float(line_count))); - monitor_draw->draw_line(rect.position + y_offset, rect.position + Vector2(rect.size.width, 0) + y_offset, horizontal_line_color, Math::round(EDSCALE)); - monitor_draw->draw_string(graph_font, rect.position - Vector2(0, graph_font->get_descent(font_size)) + y_offset, _create_label(current.max * float(j) / float(line_count), current.type), HORIZONTAL_ALIGNMENT_LEFT, rect.size.width, font_size, horizontal_line_color); + Point2 y_offset = Point2(0, rect.size.height * (1.0f - float(j) / float(line_count))); + monitor_draw->draw_line(rect.position + y_offset, rect.position + Point2(rect.size.width, 0) + y_offset, horizontal_line_color, Math::round(EDSCALE)); + monitor_draw->draw_string(graph_font, rect.position - Point2(0, graph_font->get_descent(font_size)) + y_offset, _create_label(current.max * float(j) / float(line_count), current.type), HORIZONTAL_ALIGNMENT_LEFT, rect.size.width, font_size, horizontal_line_color); } } @@ -187,7 +187,7 @@ void EditorPerformanceProfiler::_monitor_draw() { String label = _create_label(e->get(), current.type); Size2 size = graph_font->get_string_size(label, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size); - Vector2 text_top_left_position = Vector2(from, h2) - (size + Vector2(MARKER_MARGIN, MARKER_MARGIN)); + Point2 text_top_left_position = Point2(from, h2) - (size + Point2(MARKER_MARGIN)); if (text_top_left_position.x < 0) { text_top_left_position.x = from + MARKER_MARGIN; } @@ -270,7 +270,7 @@ void EditorPerformanceProfiler::_marker_input(const Ref &p_event) { } Size2i cell_size = Size2i(monitor_draw->get_size()) / Size2i(columns, rows); Vector2i index = mb->get_position() / cell_size; - Rect2i rect(index * cell_size + Point2i(MARGIN, MARGIN), cell_size - Point2i(MARGIN, MARGIN) * 2); + Rect2i rect(index * cell_size + Point2i(MARGIN), cell_size - Point2i(MARGIN) * 2); if (rect.has_point(mb->get_position())) { if (index.x + index.y * columns < active.size()) { marker_key = active[index.x + index.y * columns]; diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index 24bb6948608d..d5e5b86bc8bb 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -444,11 +444,11 @@ void EditorProfiler::_graph_tex_draw() { if (seeking) { int frame = cursor_metric_edit->get_value() - _get_frame_metric(0).frame_number; int cur_x = (2 * frame + 1) * graph->get_size().x / (2 * frame_metrics.size()) + 1; - graph->draw_line(Vector2(cur_x, 0), Vector2(cur_x, graph->get_size().y), theme_cache.seek_line_color); + graph->draw_line(Point2(cur_x, 0), Point2(cur_x, graph->get_size().y), theme_cache.seek_line_color); } if (hover_metric > -1 && hover_metric < total_metrics) { int cur_x = (2 * hover_metric + 1) * graph->get_size().x / (2 * frame_metrics.size()) + 1; - graph->draw_line(Vector2(cur_x, 0), Vector2(cur_x, graph->get_size().y), theme_cache.seek_line_hover_color); + graph->draw_line(Point2(cur_x, 0), Point2(cur_x, graph->get_size().y), theme_cache.seek_line_hover_color); } } @@ -681,7 +681,7 @@ EditorProfiler::EditorProfiler() { variables = memnew(Tree); variables->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); - variables->set_custom_minimum_size(Size2(320, 0) * EDSCALE); + variables->set_custom_minimum_size(Size2(320 * EDSCALE, 0)); variables->set_hide_folding(true); h_split->add_child(variables); variables->set_hide_root(true); diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index 17977fcb29ba..72b21e7becda 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -460,8 +460,8 @@ void EditorVisualProfiler::_graph_tex_draw() { int half_width = graph->get_size().x / 2; int cur_x = frame * half_width / max_frames; - graph->draw_line(Vector2(cur_x, 0), Vector2(cur_x, graph->get_size().y), color * Color(1, 1, 1)); - graph->draw_line(Vector2(cur_x + half_width, 0), Vector2(cur_x + half_width, graph->get_size().y), color * Color(1, 1, 1)); + graph->draw_line(Point2(cur_x, 0), Point2(cur_x, graph->get_size().y), color * Color(1, 1, 1)); + graph->draw_line(Point2(cur_x + half_width, 0), Point2(cur_x + half_width, graph->get_size().y), color * Color(1, 1, 1)); } if (graph_height_cpu > 0) { @@ -469,10 +469,10 @@ void EditorVisualProfiler::_graph_tex_draw() { int half_width = graph->get_size().x / 2; - graph->draw_line(Vector2(0, frame_y), Vector2(half_width, frame_y), color * Color(1, 1, 1, 0.5)); + graph->draw_line(Point2(0, frame_y), Point2(half_width, frame_y), color * Color(1, 1, 1, 0.5)); const String limit_str = String::num(graph_limit, 2) + " ms"; - graph->draw_string(font, Vector2(half_width - font->get_string_size(limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1, 0.75)); + graph->draw_string(font, Point2(half_width - font->get_string_size(limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1, 0.75)); } if (graph_height_gpu > 0) { @@ -480,14 +480,14 @@ void EditorVisualProfiler::_graph_tex_draw() { int half_width = graph->get_size().x / 2; - graph->draw_line(Vector2(half_width, frame_y), Vector2(graph->get_size().x, frame_y), color * Color(1, 1, 1, 0.5)); + graph->draw_line(Point2(half_width, frame_y), Point2(graph->get_size().x, frame_y), color * Color(1, 1, 1, 0.5)); const String limit_str = String::num(graph_limit, 2) + " ms"; - graph->draw_string(font, Vector2(half_width * 2 - font->get_string_size(limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1, 0.75)); + graph->draw_string(font, Point2(half_width * 2 - font->get_string_size(limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x - 2, frame_y - 2), limit_str, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1, 0.75)); } - graph->draw_string(font, Vector2(font->get_string_size("X", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x, font->get_ascent(font_size) + 2), "CPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1)); - graph->draw_string(font, Vector2(font->get_string_size("X", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x + graph->get_size().width / 2, font->get_ascent(font_size) + 2), "GPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1)); + graph->draw_string(font, Point2(font->get_string_size("X", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x, font->get_ascent(font_size) + 2), "CPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1)); + graph->draw_string(font, Point2(font->get_string_size("X", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x + graph->get_size().width / 2, font->get_ascent(font_size) + 2), "GPU:", HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color * Color(1, 1, 1)); } void EditorVisualProfiler::_graph_tex_mouse_exit() { @@ -779,7 +779,7 @@ EditorVisualProfiler::EditorVisualProfiler() { h_split->set_v_size_flags(SIZE_EXPAND_FILL); variables = memnew(Tree); - variables->set_custom_minimum_size(Size2(300, 0) * EDSCALE); + variables->set_custom_minimum_size(Size2(300 * EDSCALE, 0)); variables->set_hide_folding(true); h_split->add_child(variables); variables->set_hide_root(true); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 782a866bfa42..4471940b50cc 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -900,7 +900,7 @@ void ScriptEditorDebugger::_notification(int p_what) { Point2 offset = state["ofs"]; Transform2D transform; - transform.scale_basis(Size2(zoom, zoom)); + transform.scale_basis(Size2(zoom)); transform.columns[2] = -offset * zoom; Array msg; @@ -1602,7 +1602,7 @@ void ScriptEditorDebugger::_breakpoints_item_rmb_selected(const Vector2 &p_pos, } breakpoints_menu->clear(); - breakpoints_menu->set_size(Size2(1, 1)); + breakpoints_menu->set_size(Size2(1)); const TreeItem *selected = breakpoints_tree->get_selected(); String file = selected->get_text(0); @@ -2033,7 +2033,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { vmem_hb->add_child(memnew(Label(TTR("Total:") + " "))); vmem_total = memnew(LineEdit); vmem_total->set_editable(false); - vmem_total->set_custom_minimum_size(Size2(100, 0) * EDSCALE); + vmem_total->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); vmem_hb->add_child(vmem_total); vmem_refresh = memnew(Button); vmem_refresh->set_theme_type_variation("FlatButton"); diff --git a/editor/directory_create_dialog.cpp b/editor/directory_create_dialog.cpp index 604531f109d5..0384b9779166 100644 --- a/editor/directory_create_dialog.cpp +++ b/editor/directory_create_dialog.cpp @@ -136,7 +136,7 @@ void DirectoryCreateDialog::_bind_methods() { DirectoryCreateDialog::DirectoryCreateDialog() { set_title(TTR("Create Folder")); - set_min_size(Size2i(480, 0) * EDSCALE); + set_min_size(Size2i(480 * EDSCALE, 0)); VBoxContainer *vb = memnew(VBoxContainer); add_child(vb); diff --git a/editor/editor_atlas_packer.cpp b/editor/editor_atlas_packer.cpp index a0f5f1bf1186..414bc5b3b745 100644 --- a/editor/editor_atlas_packer.cpp +++ b/editor/editor_atlas_packer.cpp @@ -59,7 +59,7 @@ void EditorAtlasPacker::chart_pack(Vector &charts, int &r_width, int &r_h Ref src_bitmap; src_bitmap.instantiate(); - src_bitmap->create((aabb.size + Vector2(divide_by - 1, divide_by - 1)) / divide_by); + src_bitmap->create((aabb.size + Size2i(divide_by - 1)) / divide_by); int w = src_bitmap->get_size().width; int h = src_bitmap->get_size().height; @@ -229,7 +229,7 @@ void EditorAtlasPacker::chart_pack(Vector &charts, int &r_width, int &r_h SWAP(offset.x, offset.y); } - Vector2 final_pos = Vector2(best_height_offset * divide_by, best_height * divide_by) + Vector2(divide_by, divide_by) - offset; + Vector2 final_pos = Vector2(best_height_offset * divide_by, best_height * divide_by) + Vector2(divide_by) - offset; charts.write[bitmaps[i].chart_index].final_offset = final_pos; charts.write[bitmaps[i].chart_index].transposed = bitmaps[i].transposed; } diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 3b337997e066..5a341010f2fd 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -386,8 +386,8 @@ float EditorAudioBus::_scaled_db_to_normalized_volume(float db) { * results of the positive db range in order to get the desired numerical * value on the negative side. */ float positive_x = Math::pow(Math::abs(db) / 45.0f, 1.0f / 3.0f) + 1.0f; - Vector2 translation = Vector2(1.0f, 0.0f) - Vector2(positive_x, Math::abs(db)); - Vector2 reflected_position = Vector2(1.0, 0.0f) + translation; + Vector2 translation = Vector2(1, 0) - Vector2(positive_x, Math::abs(db)); + Vector2 reflected_position = Vector2(1, 0) + translation; return reflected_position.x; } else { return Math::pow(db / 45.0f, 1.0f / 3.0f) + 1.0f; @@ -930,7 +930,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { effects = memnew(Tree); effects->set_hide_root(true); - effects->set_custom_minimum_size(Size2(0, 80) * EDSCALE); + effects->set_custom_minimum_size(Size2(0, 80 * EDSCALE)); effects->set_hide_folding(true); effects->set_v_size_flags(SIZE_EXPAND_FILL); vb->add_child(effects); @@ -992,7 +992,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { void EditorAudioBusDrop::_notification(int p_what) { switch (p_what) { case NOTIFICATION_DRAW: { - draw_style_box(get_theme_stylebox(CoreStringName(normal), SNAME("Button")), Rect2(Vector2(), get_size())); + draw_style_box(get_theme_stylebox(CoreStringName(normal), SNAME("Button")), Rect2(Point2(), get_size())); if (hovering_drop) { Color accent = get_theme_color(SNAME("accent_color"), EditorStringName(Editor)); @@ -1473,14 +1473,14 @@ void EditorAudioMeterNotches::_draw_audio_notches() { float font_height = theme_cache.font->get_height(theme_cache.font_size); for (const AudioNotch &n : notches) { - draw_line(Vector2(0, (1.0f - n.relative_position) * (get_size().y - btm_padding - top_padding) + top_padding), - Vector2(line_length * EDSCALE, (1.0f - n.relative_position) * (get_size().y - btm_padding - top_padding) + top_padding), + draw_line(Point2(0, (1.0f - n.relative_position) * (get_size().y - btm_padding - top_padding) + top_padding), + Point2(line_length * EDSCALE, (1.0f - n.relative_position) * (get_size().y - btm_padding - top_padding) + top_padding), theme_cache.notch_color, Math::round(EDSCALE)); if (n.render_db_value) { draw_string(theme_cache.font, - Vector2((line_length + label_space) * EDSCALE, + Point2((line_length + label_space) * EDSCALE, (1.0f - n.relative_position) * (get_size().y - btm_padding - top_padding) + (font_height / 4) + top_padding), String::num(Math::abs(n.db_value)) + "dB", HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.font_size, diff --git a/editor/editor_dock_manager.cpp b/editor/editor_dock_manager.cpp index 753d9ba2b8ef..edeb3a5f70f3 100644 --- a/editor/editor_dock_manager.cpp +++ b/editor/editor_dock_manager.cpp @@ -232,7 +232,7 @@ Control *EditorDockManager::_close_window(WindowWrapper *p_wrapper) { void EditorDockManager::_open_dock_in_window(Control *p_dock, bool p_show_window, bool p_reset_size) { ERR_FAIL_NULL(p_dock); - Size2 borders = Size2(4, 4) * EDSCALE; + Size2 borders = Size2(4 * EDSCALE); // Remember size and position before removing it from the main window. Size2 dock_size = p_dock->get_size() + borders * 2; Point2 dock_screen_pos = p_dock->get_screen_position(); @@ -812,7 +812,7 @@ void EditorDockManager::register_dock_slot(DockSlot p_dock_slot, TabContainer *p dock_slot[p_dock_slot] = p_tab_container; - p_tab_container->set_custom_minimum_size(Size2(170, 0) * EDSCALE); + p_tab_container->set_custom_minimum_size(Size2(170 * EDSCALE, 0)); p_tab_container->set_v_size_flags(Control::SIZE_EXPAND_FILL); p_tab_container->set_popup(dock_context_popup); p_tab_container->connect("pre_popup_pressed", callable_mp(dock_context_popup, &DockContextPopup::select_current_dock_in_dock_slot).bind(p_dock_slot)); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 683e4e5cdaac..ae3d3552b9d0 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -422,7 +422,7 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum, bool p_is void EditorHelp::_add_type_icon(const String &p_type, int p_size, const String &p_fallback) { Ref icon = EditorNode::get_singleton()->get_class_icon(p_type, p_fallback); - Vector2i size = Vector2i(icon->get_width(), icon->get_height()); + Vector2i size = icon->get_size(); if (p_size > 0) { // Ensures icon scales proportionally on both axes, based on icon height. float ratio = p_size / float(size.height); @@ -2687,7 +2687,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, const C p_rt->push_cell(); p_rt->set_cell_row_background_color(code_bg_color, Color(code_bg_color, 0.99)); p_rt->set_cell_padding(Rect2(0, 10 * EDSCALE, 0, 10 * EDSCALE)); - p_rt->set_cell_size_override(Vector2(1, 1), Vector2(10, 10) * EDSCALE); + p_rt->set_cell_size_override(Vector2(1), Vector2(10 * EDSCALE)); p_rt->push_meta("^" + codeblock_copy_text, RichTextLabel::META_UNDERLINE_ON_HOVER); p_rt->add_image(p_owner_node->get_editor_theme_icon(SNAME("ActionCopy")), 24 * EDSCALE, 24 * EDSCALE, Color(link_property_color, 0.3), INLINE_ALIGNMENT_BOTTOM_TO, Rect2(), Variant(), false, TTR("Click to copy.")); p_rt->pop(); // meta @@ -4072,7 +4072,7 @@ FindBar::FindBar() { Control *space = memnew(Control); add_child(space); - space->set_custom_minimum_size(Size2(4, 0) * EDSCALE); + space->set_custom_minimum_size(Size2(4 * EDSCALE, 0)); hide_button = memnew(TextureButton); add_child(hide_button); diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index ff5bc6ba8778..8436e01d1f0f 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -312,7 +312,7 @@ EditorHelpSearch::EditorHelpSearch() { vbox->add_child(hbox); search_box = memnew(LineEdit); - search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE); + search_box->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_box->set_clear_button_enabled(true); search_box->connect(SceneStringName(gui_input), callable_mp(this, &EditorHelpSearch::_search_box_gui_input)); @@ -338,7 +338,7 @@ EditorHelpSearch::EditorHelpSearch() { hbox->add_child(hierarchy_button); filter_combo = memnew(OptionButton); - filter_combo->set_custom_minimum_size(Size2(200, 0) * EDSCALE); + filter_combo->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); filter_combo->set_stretch_ratio(0); // Fixed width. filter_combo->add_item(TTR("Display All"), SEARCH_ALL); filter_combo->add_separator(); @@ -365,7 +365,7 @@ EditorHelpSearch::EditorHelpSearch() { results_tree->set_column_expand(1, false); results_tree->set_column_custom_minimum_width(1, 150 * EDSCALE); results_tree->set_column_clip_content(1, true); - results_tree->set_custom_minimum_size(Size2(0, 100) * EDSCALE); + results_tree->set_custom_minimum_size(Size2(0, 100 * EDSCALE)); results_tree->set_hide_root(true); results_tree->set_select_mode(Tree::SELECT_ROW); results_tree->connect("item_activated", callable_mp(this, &EditorHelpSearch::_confirmed)); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 199383c3918b..2cb3f388c925 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -256,7 +256,7 @@ void EditorProperty::_notification(int p_what) { size.height = 0; } else { Ref sb = get_theme_stylebox(selected ? SNAME("bg_selected") : SNAME("bg")); - draw_style_box(sb, Rect2(Vector2(), size)); + draw_style_box(sb, Rect2(Point2(), size)); } Ref bg_stylebox = get_theme_stylebox(SNAME("child_bg")); @@ -298,7 +298,7 @@ void EditorProperty::_notification(int p_what) { } check_rect = Rect2(ofs, ((size.height - checkbox->get_height()) / 2), checkbox->get_width(), checkbox->get_height()); if (rtl) { - draw_texture(checkbox, Vector2(size.width - check_rect.position.x - checkbox->get_width(), check_rect.position.y), color2); + draw_texture(checkbox, Point2(size.width - check_rect.position.x - checkbox->get_width(), check_rect.position.y), color2); } else { draw_texture(checkbox, check_rect.position, color2); } @@ -321,7 +321,7 @@ void EditorProperty::_notification(int p_what) { color2.b *= 1.2; } if (rtl) { - draw_texture(reload_icon, Vector2(size.width - revert_rect.position.x - reload_icon->get_width(), revert_rect.position.y), color2); + draw_texture(reload_icon, Point2(size.width - revert_rect.position.x - reload_icon->get_width(), revert_rect.position.y), color2); } else { draw_texture(reload_icon, revert_rect.position, color2); } @@ -336,9 +336,9 @@ void EditorProperty::_notification(int p_what) { int text_w = font->get_string_size(label, rtl ? HORIZONTAL_ALIGNMENT_RIGHT : HORIZONTAL_ALIGNMENT_LEFT, text_limit - total_icon_w, font_size).x; int y = (size.height - pinned_icon->get_height()) / 2; if (rtl) { - draw_texture(pinned_icon, Vector2(size.width - ofs - text_w - total_icon_w, y), color); + draw_texture(pinned_icon, Point2(size.width - ofs - text_w - total_icon_w, y), color); } else { - draw_texture(pinned_icon, Vector2(ofs + text_w + margin_w, y), color); + draw_texture(pinned_icon, Point2(ofs + text_w + margin_w, y), color); } text_limit -= total_icon_w; } @@ -371,7 +371,7 @@ void EditorProperty::_notification(int p_what) { } keying_rect = Rect2(ofs, ((size.height - key->get_height()) / 2), key->get_width(), key->get_height()); if (rtl) { - draw_texture(key, Vector2(size.width - keying_rect.position.x - key->get_width(), keying_rect.position.y), color2); + draw_texture(key, Point2(size.width - keying_rect.position.x - key->get_width(), keying_rect.position.y), color2); } else { draw_texture(key, keying_rect.position, color2); } @@ -395,7 +395,7 @@ void EditorProperty::_notification(int p_what) { } delete_rect = Rect2(ofs, ((size.height - close->get_height()) / 2), close->get_width(), close->get_height()); if (rtl) { - draw_texture(close, Vector2(size.width - delete_rect.position.x - close->get_width(), delete_rect.position.y), color2); + draw_texture(close, Point2(size.width - delete_rect.position.x - close->get_width(), delete_rect.position.y), color2); } else { draw_texture(close, delete_rect.position, color2); } @@ -1223,7 +1223,7 @@ void EditorInspectorCategory::_notification(int p_what) { case NOTIFICATION_DRAW: { Ref sb = get_theme_stylebox(SNAME("bg")); - draw_style_box(sb, Rect2(Vector2(), get_size())); + draw_style_box(sb, Rect2(Point2(), get_size())); Ref font = get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); int font_size = get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); @@ -1242,7 +1242,7 @@ void EditorInspectorCategory::_notification(int p_what) { float v_margin_offset = sb->get_content_margin(SIDE_TOP) - sb->get_content_margin(SIDE_BOTTOM); if (icon.is_valid()) { - Size2 rect_size = Size2(icon_size, icon_size); + Size2 rect_size = Size2(icon_size); Point2 rect_pos = Point2(ofs, (get_size().height - icon_size) / 2 + v_margin_offset).round(); if (is_layout_rtl()) { rect_pos.x = get_size().width - rect_pos.x - icon_size; @@ -1390,9 +1390,9 @@ void EditorInspectorSection::_notification(int p_what) { inspector_margin += section_indent_style->get_margin(SIDE_LEFT) + section_indent_style->get_margin(SIDE_RIGHT); } - Size2 size = get_size() - Vector2(inspector_margin, 0); + Size2 size = get_size() - Size2(inspector_margin, 0); int header_height = _get_header_height(); - Vector2 offset = Vector2(is_layout_rtl() ? 0 : inspector_margin, header_height); + Point2 offset = Point2(is_layout_rtl() ? 0 : inspector_margin, header_height); for (int i = 0; i < get_child_count(); i++) { Control *c = as_sortable_control(get_child(i)); if (!c) { @@ -1422,7 +1422,7 @@ void EditorInspectorSection::_notification(int p_what) { // Draw header area. int header_height = _get_header_height(); - Rect2 header_rect = Rect2(Vector2(header_offset_x, 0.0), Vector2(header_width, header_height)); + Rect2 header_rect = Rect2(Point2(header_offset_x, 0.0), Size2(header_width, header_height)); Color c = bg_color; c.a *= 0.4; if (foldable && header_rect.has_point(get_local_mouse_position())) { @@ -1508,7 +1508,7 @@ void EditorInspectorSection::_notification(int p_what) { // Draw section indentation. if (section_indent_style.is_valid() && section_indent > 0) { - Rect2 indent_rect = Rect2(Vector2(), Vector2(indent_depth * section_indent_size, get_size().height)); + Rect2 indent_rect = Rect2(Point2(), Size2(indent_depth * section_indent_size, get_size().height)); if (rtl) { indent_rect.position.x = get_size().width - section_indent + section_indent_style->get_margin(SIDE_RIGHT); } else { @@ -1751,7 +1751,7 @@ void EditorInspectorArray::_rmb_popup_id_pressed(int p_id) { case OPTION_RESIZE_ARRAY: new_size_spin_box->set_value(count); resize_dialog->get_ok_button()->set_disabled(true); - resize_dialog->popup_centered(Size2(250, 0) * EDSCALE); + resize_dialog->popup_centered(Size2(250 * EDSCALE, 0)); new_size_spin_box->get_line_edit()->grab_focus(); new_size_spin_box->get_line_edit()->select_all(); break; @@ -1793,7 +1793,7 @@ void EditorInspectorArray::_panel_draw(int p_index) { return; } if (array_elements[p_index].panel->has_focus()) { - array_elements[p_index].panel->draw_style_box(style, Rect2(Vector2(), array_elements[p_index].panel->get_size())); + array_elements[p_index].panel->draw_style_box(style, Rect2(Point2(), array_elements[p_index].panel->get_size())); } } @@ -2137,7 +2137,7 @@ int EditorInspectorArray::_drop_position() const { Size2 size = ae.panel->get_size(); Vector2 mp = ae.panel->get_local_mouse_position(); - if (Rect2(Vector2(), size).has_point(mp)) { + if (Rect2(Point2(), size).has_point(mp)) { if (mp.y < size.y / 2) { return i; } else { @@ -3510,7 +3510,7 @@ void EditorInspector::update_tree() { if (!hide_metadata && !object->call("_hide_metadata_from_inspector")) { // Add 4px of spacing between the "Add Metadata" button and the content above it. Control *spacer = memnew(Control); - spacer->set_custom_minimum_size(Size2(0, 4) * EDSCALE); + spacer->set_custom_minimum_size(Size2(0, 4 * EDSCALE)); main_vbox->add_child(spacer); Button *add_md = EditorInspector::create_inspector_action_button(TTR("Add Metadata")); diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp index 60326056842c..3377b4b77bd4 100644 --- a/editor/editor_layouts_dialog.cpp +++ b/editor/editor_layouts_dialog.cpp @@ -115,7 +115,7 @@ EditorLayoutsDialog::EditorLayoutsDialog() { layout_names = memnew(ItemList); layout_names->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); layout_names->set_auto_height(true); - layout_names->set_custom_minimum_size(Size2(300 * EDSCALE, 50 * EDSCALE)); + layout_names->set_custom_minimum_size(Size2(300, 50) * EDSCALE); layout_names->set_visible(true); layout_names->set_offset(SIDE_TOP, 5); layout_names->set_v_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index fab379b5241c..3165cfbbf248 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -446,7 +446,7 @@ EditorLog::EditorLog() { HBoxContainer *hb = this; VBoxContainer *vb_left = memnew(VBoxContainer); - vb_left->set_custom_minimum_size(Size2(0, 180) * EDSCALE); + vb_left->set_custom_minimum_size(Size2(0, 180 * EDSCALE)); vb_left->set_v_size_flags(SIZE_EXPAND_FILL); vb_left->set_h_size_flags(SIZE_EXPAND_FILL); hb->add_child(vb_left); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 37025cb35d2a..4c58c28da9df 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5460,7 +5460,7 @@ bool EditorNode::immediate_confirmation_dialog(const String &p_text, const Strin cd->set_cancel_button_text(p_cancel_text); if (p_wrap_width > 0) { cd->set_autowrap(true); - cd->get_label()->set_custom_minimum_size(Size2(p_wrap_width, 0) * EDSCALE); + cd->get_label()->set_custom_minimum_size(Size2(p_wrap_width * EDSCALE, 0)); } cd->connect(SceneStringName(confirmed), callable_mp(singleton, &EditorNode::_immediate_dialog_confirmed)); @@ -5746,7 +5746,7 @@ Dictionary EditorNode::drag_files_and_dirs(const Vector &p_paths, Contro icon->set_texture(theme->get_icon(SNAME("File"), EditorStringName(EditorIcons))); } icon->set_stretch_mode(TextureRect::STRETCH_KEEP_CENTERED); - icon->set_size(Size2(16, 16)); + icon->set_size(Size2(16)); hbox->add_child(icon); hbox->add_child(label); vbox->add_child(hbox); @@ -6953,7 +6953,7 @@ EditorNode::EditorNode() { gui_base->set_anchors_and_offsets_preset(Control::PRESET_FULL_RECT); gui_base->set_anchor(SIDE_RIGHT, Control::ANCHOR_END); gui_base->set_anchor(SIDE_BOTTOM, Control::ANCHOR_END); - gui_base->set_end(Point2(0, 0)); + gui_base->set_end(Point2()); main_vbox = memnew(VBoxContainer); gui_base->add_child(main_vbox); @@ -7559,7 +7559,7 @@ EditorNode::EditorNode() { save_confirmation = memnew(ConfirmationDialog); save_confirmation->add_button(TTR("Don't Save"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard"); gui_base->add_child(save_confirmation); - save_confirmation->set_min_size(Vector2(450.0 * EDSCALE, 0)); + save_confirmation->set_min_size(Size2(450 * EDSCALE, 0)); save_confirmation->connect(SceneStringName(confirmed), callable_mp(this, &EditorNode::_menu_confirm_current)); save_confirmation->connect("custom_action", callable_mp(this, &EditorNode::_discard_changes)); save_confirmation->connect("canceled", callable_mp(this, &EditorNode::_cancel_close_scene_tab)); @@ -7594,7 +7594,7 @@ EditorNode::EditorNode() { install_android_build_template->set_ok_button_text(TTR("Install")); install_android_build_template->connect(SceneStringName(confirmed), callable_mp(this, &EditorNode::_menu_confirm_current)); install_android_build_template->add_child(vbox); - install_android_build_template->set_min_size(Vector2(500.0 * EDSCALE, 0)); + install_android_build_template->set_min_size(Size2(500 * EDSCALE, 0)); gui_base->add_child(install_android_build_template); } diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index c90222a09f36..3c427476f908 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -214,7 +214,7 @@ void EditorPropertyMultilineText::_notification(int p_what) { font = get_theme_font(SceneStringName(font), SNAME("TextEdit")); font_size = get_theme_font_size(SceneStringName(font_size), SNAME("TextEdit")); } - text->set_custom_minimum_size(Vector2(0, font->get_height(font_size) * 6)); + text->set_custom_minimum_size(Size2(0, font->get_height(font_size) * 6)); } break; } } @@ -860,7 +860,7 @@ EditorPropertyLayersGrid::EditorPropertyLayersGrid() { Size2 EditorPropertyLayersGrid::get_grid_size() const { Ref font = get_theme_font(SceneStringName(font), SNAME("Label")); int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label")); - return Vector2(0, font->get_height(font_size) * 3); + return Size2(0, font->get_height(font_size) * 3); } void EditorPropertyLayersGrid::set_read_only(bool p_read_only) { @@ -1018,7 +1018,7 @@ void EditorPropertyLayersGrid::_notification(int p_what) { for (int i = 0; i < 2; i++) { for (int j = 0; j < layer_group_size; j++) { const bool on = value & (1 << layer_index); - Rect2 rect2 = Rect2(ofs, Size2(bsize, bsize)); + Rect2 rect2 = Rect2(ofs, Size2(bsize)); color.a = on ? 0.6 : 0.2; if (layer_index == hovered_index) { @@ -1255,7 +1255,7 @@ void EditorPropertyLayers::_button_pressed() { Rect2 gp = button->get_screen_rect(); layers->reset_size(); - Vector2 popup_pos = gp.position - Vector2(layers->get_contents_minimum_size().x, 0); + Point2 popup_pos = gp.position - Point2(layers->get_contents_minimum_size().x, 0); layers->set_position(popup_pos); layers->popup(); } diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 06efb5ab64de..bcbeca0b4b20 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -188,7 +188,7 @@ void EditorResourcePicker::_update_menu() { Rect2 gt = edit_button->get_screen_rect(); edit_menu->reset_size(); int ms = edit_menu->get_contents_minimum_size().width; - Vector2 popup_pos = gt.get_end() - Vector2(ms, 0); + Point2 popup_pos = gt.get_end() - Point2(ms, 0); edit_menu->set_position(popup_pos); edit_menu->popup(); } @@ -401,7 +401,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) { _gather_resources_to_duplicate(edited_resource, root); duplicate_resources_dialog->reset_size(); - duplicate_resources_dialog->popup_centered(Vector2(500, 400) * EDSCALE); + duplicate_resources_dialog->popup_centered(Point2(500, 400) * EDSCALE); } break; case OBJ_MENU_SAVE: { diff --git a/editor/editor_resource_picker.h b/editor/editor_resource_picker.h index 05e392da2c77..0bd17cae2297 100644 --- a/editor/editor_resource_picker.h +++ b/editor/editor_resource_picker.h @@ -64,7 +64,7 @@ class EditorResourcePicker : public HBoxContainer { ConfirmationDialog *duplicate_resources_dialog = nullptr; Tree *duplicate_resources_tree = nullptr; - Size2i assign_button_min_size = Size2i(1, 1); + Size2i assign_button_min_size = Size2i(1); enum MenuOption { OBJ_MENU_LOAD, diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp index 71865f7e8cc0..53e3650eb806 100644 --- a/editor/editor_resource_preview.cpp +++ b/editor/editor_resource_preview.cpp @@ -196,9 +196,9 @@ void EditorResourcePreview::_generate_preview(Ref &r_texture, Ref< Ref generated; if (p_item.resource.is_valid()) { - generated = preview_generators.write[i]->generate(p_item.resource, Vector2(thumbnail_size, thumbnail_size), p_metadata); + generated = preview_generators.write[i]->generate(p_item.resource, Size2(thumbnail_size), p_metadata); } else { - generated = preview_generators.write[i]->generate_from_path(p_item.path, Vector2(thumbnail_size, thumbnail_size), p_metadata); + generated = preview_generators.write[i]->generate_from_path(p_item.path, Size2(thumbnail_size), p_metadata); } r_texture = generated; @@ -206,9 +206,9 @@ void EditorResourcePreview::_generate_preview(Ref &r_texture, Ref< Ref generated_small; Dictionary d; if (p_item.resource.is_valid()) { - generated_small = preview_generators.write[i]->generate(p_item.resource, Vector2(small_thumbnail_size, small_thumbnail_size), d); + generated_small = preview_generators.write[i]->generate(p_item.resource, Size2(small_thumbnail_size), d); } else { - generated_small = preview_generators.write[i]->generate_from_path(p_item.path, Vector2(small_thumbnail_size, small_thumbnail_size), d); + generated_small = preview_generators.write[i]->generate_from_path(p_item.path, Size2(small_thumbnail_size), d); } r_small_texture = generated_small; } diff --git a/editor/editor_sectioned_inspector.cpp b/editor/editor_sectioned_inspector.cpp index bc7bfcfa58d8..8b9fb0c49ff0 100644 --- a/editor/editor_sectioned_inspector.cpp +++ b/editor/editor_sectioned_inspector.cpp @@ -328,7 +328,7 @@ SectionedInspector::SectionedInspector() : add_theme_constant_override("autohide", 1); // Fixes the dragger always showing up VBoxContainer *left_vb = memnew(VBoxContainer); - left_vb->set_custom_minimum_size(Size2(190, 0) * EDSCALE); + left_vb->set_custom_minimum_size(Size2(190 * EDSCALE, 0)); add_child(left_vb); sections->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); @@ -338,7 +338,7 @@ SectionedInspector::SectionedInspector() : left_vb->add_child(sections, true); VBoxContainer *right_vb = memnew(VBoxContainer); - right_vb->set_custom_minimum_size(Size2(300, 0) * EDSCALE); + right_vb->set_custom_minimum_size(Size2(300 * EDSCALE, 0)); right_vb->set_h_size_flags(SIZE_EXPAND_FILL); add_child(right_vb); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index efb42288a57d..9019e7abe4ba 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -817,7 +817,7 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { for (int i = 0; i < DisplayServer::get_singleton()->get_screen_count(); i++) { screen_hints += ",Screen " + itos(i + 1) + ":" + itos(i); } - _initial_set("run/window_placement/rect_custom_position", Vector2()); + _initial_set("run/window_placement/rect_custom_position", Point2()); EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "run/window_placement/screen", -5, screen_hints) #endif // Should match the ANDROID_WINDOW_* constants in 'platform/android/java/editor/src/main/java/org/godotengine/editor/GodotEditor.kt' diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp index 32346620ffaf..b7cc51726a8f 100644 --- a/editor/export/export_template_manager.cpp +++ b/editor/export/export_template_manager.cpp @@ -960,7 +960,7 @@ ExportTemplateManager::ExportTemplateManager() { download_install_hb->add_child(mirrors_label); mirrors_list = memnew(OptionButton); - mirrors_list->set_custom_minimum_size(Size2(280, 0) * EDSCALE); + mirrors_list->set_custom_minimum_size(Size2(280 * EDSCALE, 0)); if (downloads_available) { mirrors_list->add_item(TTR("Best available mirror"), 0); } else { @@ -1047,7 +1047,7 @@ ExportTemplateManager::ExportTemplateManager() { installed_table = memnew(Tree); installed_table->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); installed_table->set_hide_root(true); - installed_table->set_custom_minimum_size(Size2(0, 100) * EDSCALE); + installed_table->set_custom_minimum_size(Size2(0, 100 * EDSCALE)); installed_table->set_v_size_flags(Control::SIZE_EXPAND_FILL); main_vb->add_child(installed_table); installed_table->connect("button_clicked", callable_mp(this, &ExportTemplateManager::_installed_table_button_cbk)); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 0256863aab2d..f9623e4d91fa 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -102,15 +102,15 @@ bool FileSystemList::edit_selected() { Rect2 rect; Rect2 popup_rect; - Vector2 ofs; + Point2 ofs; - Vector2 icon_size = get_item_icon(s)->get_size(); + Size2 icon_size = get_item_icon(s)->get_size(); // Handles the different icon modes (TOP/LEFT). switch (get_icon_mode()) { case ItemList::ICON_MODE_LEFT: rect = get_item_rect(s, true); - ofs = Vector2(0, Math::floor((MAX(line_editor->get_minimum_size().height, rect.size.height) - rect.size.height) / 2)); + ofs = Point2(0, Math::floor((MAX(line_editor->get_minimum_size().height, rect.size.height) - rect.size.height) / 2)); popup_rect.position = get_screen_position() + rect.position - ofs; popup_rect.size = rect.size; @@ -941,10 +941,10 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { files->set_icon_mode(ItemList::ICON_MODE_TOP); files->set_fixed_column_width(thumbnail_size * 3 / 2); files->set_max_text_lines(2); - files->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); + files->set_fixed_icon_size(Size2(thumbnail_size)); const int icon_size = get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); - files->set_fixed_tag_icon_size(Size2(icon_size, icon_size)); + files->set_fixed_tag_icon_size(Size2(icon_size)); if (thumbnail_size < 64) { folder_thumbnail = get_editor_theme_icon(SNAME("FolderMediumThumb")); @@ -962,7 +962,7 @@ void FileSystemDock::_update_file_list(bool p_keep_selection) { files->set_max_text_lines(1); files->set_fixed_column_width(0); const int icon_size = get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); - files->set_fixed_icon_size(Size2(icon_size, icon_size)); + files->set_fixed_icon_size(Size2(icon_size)); } Ref folder_icon = (use_thumbnails) ? folder_thumbnail : get_theme_icon(SNAME("folder"), SNAME("FileDialog")); @@ -3808,7 +3808,7 @@ void FileSystemDock::_set_dock_horizontal(bool p_enable) { set_display_mode(new_display_mode); set_file_list_display_mode(new_file_display_mode); - set_custom_minimum_size(Size2(0, 200) * EDSCALE); + set_custom_minimum_size(Size2(0, 200 * EDSCALE)); } else { set_meta("_bottom_display_mode", get_display_mode()); set_meta("_bottom_file_display_mode", get_file_list_display_mode()); @@ -3821,7 +3821,7 @@ void FileSystemDock::_set_dock_horizontal(bool p_enable) { set_display_mode(new_display_mode); set_file_list_display_mode(new_file_display_mode); - set_custom_minimum_size(Size2(0, 0)); + set_custom_minimum_size(Size2()); } button_dock_placement->set_visible(p_enable); @@ -4036,7 +4036,7 @@ FileSystemDock::FileSystemDock() { SET_DRAG_FORWARDING_GCD(tree, FileSystemDock); tree->set_allow_rmb_select(true); tree->set_select_mode(Tree::SELECT_MULTI); - tree->set_custom_minimum_size(Size2(40 * EDSCALE, 15 * EDSCALE)); + tree->set_custom_minimum_size(Size2(40, 15) * EDSCALE); tree->set_column_clip_content(0, true); split_box->add_child(tree); @@ -4126,7 +4126,7 @@ FileSystemDock::FileSystemDock() { overwrite_dialog_scroll = memnew(ScrollContainer); overwrite_dialog_vb->add_child(overwrite_dialog_scroll); - overwrite_dialog_scroll->set_custom_minimum_size(Vector2(400, 600) * EDSCALE); + overwrite_dialog_scroll->set_custom_minimum_size(Size2(400, 600) * EDSCALE); overwrite_dialog_file_list = memnew(Label); overwrite_dialog_scroll->add_child(overwrite_dialog_file_list); diff --git a/editor/gui/editor_file_dialog.cpp b/editor/gui/editor_file_dialog.cpp index 29f11174aff7..9043954445ab 100644 --- a/editor/gui/editor_file_dialog.cpp +++ b/editor/gui/editor_file_dialog.cpp @@ -925,7 +925,7 @@ void EditorFileDialog::update_file_list() { item_list->set_fixed_column_width(thumbnail_size * 3 / 2); item_list->set_max_text_lines(2); item_list->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS); - item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); + item_list->set_fixed_icon_size(Size2(thumbnail_size)); if (thumbnail_size < 64) { folder_thumbnail = theme_cache.folder_medium_thumbnail; @@ -2243,7 +2243,7 @@ EditorFileDialog::EditorFileDialog() { VBoxContainer *item_vb = memnew(VBoxContainer); list_hb->add_child(item_vb); - item_vb->set_custom_minimum_size(Size2(320, 0) * EDSCALE); + item_vb->set_custom_minimum_size(Size2(320 * EDSCALE, 0)); HBoxContainer *preview_hb = memnew(HBoxContainer); preview_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/editor/gui/editor_object_selector.cpp b/editor/gui/editor_object_selector.cpp index 5b303760b02f..cda815bad9f1 100644 --- a/editor/gui/editor_object_selector.cpp +++ b/editor/gui/editor_object_selector.cpp @@ -204,7 +204,7 @@ void EditorObjectSelector::_notification(int p_what) { int icon_size = get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); - current_object_icon->set_custom_minimum_size(Size2(icon_size, icon_size)); + current_object_icon->set_custom_minimum_size(Size2(icon_size)); current_object_label->add_theme_font_override(SceneStringName(font), get_theme_font(SNAME("main"), EditorStringName(EditorFonts))); sub_objects_icon->set_texture(get_theme_icon(SNAME("arrow"), SNAME("OptionButton"))); sub_objects_menu->add_theme_constant_override("icon_max_width", icon_size); diff --git a/editor/gui/editor_scene_tabs.cpp b/editor/gui/editor_scene_tabs.cpp index 4862b3436e18..b6af74815651 100644 --- a/editor/gui/editor_scene_tabs.cpp +++ b/editor/gui/editor_scene_tabs.cpp @@ -322,7 +322,7 @@ void EditorSceneTabs::_tab_preview_done(const String &p_path, const Refget_tab_rect(p_tab); rect.position += scene_tabs->get_global_position(); - tab_preview_panel->set_global_position(rect.position + Vector2(0, rect.size.height)); + tab_preview_panel->set_global_position(rect.position + Point2(0, rect.size.height)); tab_preview_panel->show(); } } @@ -429,14 +429,14 @@ EditorSceneTabs::EditorSceneTabs() { add_child(tab_preview_anchor); tab_preview_panel = memnew(Panel); - tab_preview_panel->set_size(Size2(100, 100) * EDSCALE); + tab_preview_panel->set_size(Size2(100 * EDSCALE)); tab_preview_panel->hide(); tab_preview_panel->set_self_modulate(Color(1, 1, 1, 0.7)); tab_preview_anchor->add_child(tab_preview_panel); tab_preview = memnew(TextureRect); tab_preview->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); - tab_preview->set_size(Size2(96, 96) * EDSCALE); - tab_preview->set_position(Point2(2, 2) * EDSCALE); + tab_preview->set_size(Size2(96 * EDSCALE)); + tab_preview->set_position(Point2(2 * EDSCALE)); tab_preview_panel->add_child(tab_preview); } diff --git a/editor/gui/editor_spin_slider.cpp b/editor/gui/editor_spin_slider.cpp index d219a0274da5..e6b5bec9a8c5 100644 --- a/editor/gui/editor_spin_slider.cpp +++ b/editor/gui/editor_spin_slider.cpp @@ -312,11 +312,11 @@ void EditorSpinSlider::_draw_spin_slider() { RID ci = get_canvas_item(); bool rtl = is_layout_rtl(); - Vector2 size = get_size(); + Size2 size = get_size(); Ref sb = get_theme_stylebox(is_read_only() ? SNAME("read_only") : CoreStringName(normal), SNAME("LineEdit")); if (!flat) { - draw_style_box(sb, Rect2(Vector2(), size)); + draw_style_box(sb, Rect2(Point2(), size)); } Ref font = get_theme_font(SceneStringName(font), SNAME("LineEdit")); int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("LineEdit")); @@ -338,21 +338,21 @@ void EditorSpinSlider::_draw_spin_slider() { if (flat && !label.is_empty()) { Ref label_bg = get_theme_stylebox(SNAME("label_bg"), SNAME("EditorSpinSlider")); if (rtl) { - draw_style_box(label_bg, Rect2(Vector2(size.width - (sb->get_offset().x * 2 + label_width), 0), Vector2(sb->get_offset().x * 2 + label_width, size.height))); + draw_style_box(label_bg, Rect2(Point2(size.width - (sb->get_offset().x * 2 + label_width), 0), Size2(sb->get_offset().x * 2 + label_width, size.height))); } else { - draw_style_box(label_bg, Rect2(Vector2(), Vector2(sb->get_offset().x * 2 + label_width, size.height))); + draw_style_box(label_bg, Rect2(Point2(), Size2(sb->get_offset().x * 2 + label_width, size.height))); } } if (has_focus()) { Ref focus = get_theme_stylebox(SNAME("focus"), SNAME("LineEdit")); - draw_style_box(focus, Rect2(Vector2(), size)); + draw_style_box(focus, Rect2(Point2(), size)); } if (rtl) { - draw_string(font, Vector2(Math::round(size.width - sb->get_offset().x - label_width), vofs), label, HORIZONTAL_ALIGNMENT_RIGHT, -1, font_size, lc * Color(1, 1, 1, 0.5)); + draw_string(font, Point2(Math::round(size.width - sb->get_offset().x - label_width), vofs), label, HORIZONTAL_ALIGNMENT_RIGHT, -1, font_size, lc * Color(1, 1, 1, 0.5)); } else { - draw_string(font, Vector2(Math::round(sb->get_offset().x), vofs), label, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, lc * Color(1, 1, 1, 0.5)); + draw_string(font, Point2(Math::round(sb->get_offset().x), vofs), label, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, lc * Color(1, 1, 1, 0.5)); } int suffix_start = numstr.length(); @@ -360,7 +360,7 @@ void EditorSpinSlider::_draw_spin_slider() { TS->shaped_text_add_string(num_rid, numstr + U"\u2009" + suffix, font->get_rids(), font_size, font->get_opentype_features()); float text_start = rtl ? Math::round(sb->get_offset().x) : Math::round(sb->get_offset().x + label_width + sep); - Vector2 text_ofs = rtl ? Vector2(text_start + (number_width - TS->shaped_text_get_width(num_rid)), vofs) : Vector2(text_start, vofs); + Point2 text_ofs = rtl ? Point2(text_start + (number_width - TS->shaped_text_get_width(num_rid)), vofs) : Point2(text_start, vofs); int v_size = TS->shaped_text_get_glyph_count(num_rid); const Glyph *glyphs = TS->shaped_text_get_glyphs(num_rid); for (int i = 0; i < v_size; i++) { @@ -371,9 +371,9 @@ void EditorSpinSlider::_draw_spin_slider() { color.a *= 0.4; } if (glyphs[i].font_rid != RID()) { - TS->font_draw_glyph(glyphs[i].font_rid, ci, glyphs[i].font_size, text_ofs + Vector2(glyphs[i].x_off, glyphs[i].y_off), glyphs[i].index, color); + TS->font_draw_glyph(glyphs[i].font_rid, ci, glyphs[i].font_size, text_ofs + Point2(glyphs[i].x_off, glyphs[i].y_off), glyphs[i].index, color); } else if ((glyphs[i].flags & TextServer::GRAPHEME_IS_VIRTUAL) != TextServer::GRAPHEME_IS_VIRTUAL) { - TS->draw_hex_code_box(ci, glyphs[i].font_size, text_ofs + Vector2(glyphs[i].x_off, glyphs[i].y_off), glyphs[i].index, color); + TS->draw_hex_code_box(ci, glyphs[i].font_size, text_ofs + Point2(glyphs[i].x_off, glyphs[i].y_off), glyphs[i].index, color); } } text_ofs.x += glyphs[i].advance; @@ -394,7 +394,7 @@ void EditorSpinSlider::_draw_spin_slider() { if (hover_updown) { c *= Color(1.2, 1.2, 1.2); } - draw_texture(updown2, Vector2(updown_offset, updown_vofs), c); + draw_texture(updown2, Point2(updown_offset, updown_vofs), c); if (rtl) { updown_offset += updown2->get_width(); } diff --git a/editor/gui/editor_toaster.cpp b/editor/gui/editor_toaster.cpp index 24f19db578f0..023c3397110a 100644 --- a/editor/gui/editor_toaster.cpp +++ b/editor/gui/editor_toaster.cpp @@ -48,7 +48,7 @@ void EditorToaster::_notification(int p_what) { // Check if one element is hovered, if so, don't elapse time. bool hovered = false; for (const KeyValue &element : toasts) { - if (Rect2(Vector2(), element.key->get_size()).has_point(element.key->get_local_mouse_position())) { + if (Rect2(Point2(), element.key->get_size()).has_point(element.key->get_local_mouse_position())) { hovered = true; break; } @@ -184,8 +184,8 @@ void EditorToaster::_error_handler_impl(const String &p_file, int p_line, const void EditorToaster::_update_vbox_position() { // This is kind of a workaround because it's hard to keep the VBox anchroed to the bottom. - vbox_container->set_size(Vector2()); - vbox_container->set_position(get_global_position() - vbox_container->get_size() + Vector2(get_size().x, -5 * EDSCALE)); + vbox_container->set_size(Size2()); + vbox_container->set_position(get_global_position() - vbox_container->get_size() + Point2(get_size().x, -5 * EDSCALE)); } void EditorToaster::_update_disable_notifications_button() { @@ -201,7 +201,7 @@ void EditorToaster::_update_disable_notifications_button() { disable_notifications_panel->hide(); } else { disable_notifications_panel->show(); - disable_notifications_panel->set_position(get_global_position() + Vector2(5 * EDSCALE, -disable_notifications_panel->get_minimum_size().y) + Vector2(get_size().x, -5 * EDSCALE)); + disable_notifications_panel->set_position(get_global_position() + Point2(5 * EDSCALE, -disable_notifications_panel->get_minimum_size().y) + Point2(get_size().x, -5 * EDSCALE)); } } @@ -282,7 +282,7 @@ void EditorToaster::_draw_button() { default: break; } - main_button->draw_circle(Vector2(button_radius * 2, button_radius * 2), button_radius, color); + main_button->draw_circle(Point2(button_radius * 2), button_radius, color); } void EditorToaster::_draw_progress(Control *panel) { @@ -304,7 +304,7 @@ void EditorToaster::_draw_progress(Control *panel) { default: break; } - panel->draw_style_box(stylebox, Rect2(Vector2(), size)); + panel->draw_style_box(stylebox, Rect2(Point2(), size)); } } diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index 4a22507e5532..b2a283908f4f 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -1329,7 +1329,7 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from HBoxContainer *hb = memnew(HBoxContainer); TextureRect *tf = memnew(TextureRect); int icon_size = get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); - tf->set_custom_minimum_size(Size2(icon_size, icon_size)); + tf->set_custom_minimum_size(Size2(icon_size)); tf->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); tf->set_expand_mode(TextureRect::EXPAND_IGNORE_SIZE); tf->set_texture(icons[i]); @@ -1582,7 +1582,7 @@ SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_ope tree->set_anchor(SIDE_RIGHT, ANCHOR_END); tree->set_anchor(SIDE_BOTTOM, ANCHOR_END); tree->set_begin(Point2(0, p_label ? 18 : 0)); - tree->set_end(Point2(0, 0)); + tree->set_end(Point2()); tree->set_allow_reselect(true); tree->add_theme_constant_override("button_margin", 0); @@ -1716,7 +1716,7 @@ void SceneTreeDialog::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: { filter->set_right_icon(get_editor_theme_icon(SNAME("Search"))); for (TextureRect *trect : valid_type_icons) { - trect->set_custom_minimum_size(Vector2(get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)), 0)); + trect->set_custom_minimum_size(Size2(get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)), 0)); trect->set_texture(trect->get_meta("icon")); } } break; diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 00ce3d6a7a5d..514acd0b71ec 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -1336,7 +1336,7 @@ DynamicFontImportSettingsDialog::DynamicFontImportSettingsDialog() { inspector_general = memnew(EditorInspector); inspector_general->set_v_size_flags(Control::SIZE_EXPAND_FILL); - inspector_general->set_custom_minimum_size(Size2(300 * EDSCALE, 250 * EDSCALE)); + inspector_general->set_custom_minimum_size(Size2(300, 250) * EDSCALE); page1_hb->add_child(inspector_general); inspector_general->connect("property_edited", callable_mp(this, &DynamicFontImportSettingsDialog::_main_prop_changed)); @@ -1468,7 +1468,7 @@ DynamicFontImportSettingsDialog::DynamicFontImportSettingsDialog() { inspector_text = memnew(EditorInspector); inspector_text->set_v_size_flags(Control::SIZE_EXPAND_FILL); - inspector_text->set_custom_minimum_size(Size2(300 * EDSCALE, 250 * EDSCALE)); + inspector_text->set_custom_minimum_size(Size2(300, 250) * EDSCALE); page2_1_hb->add_child(inspector_text); inspector_text->connect("property_edited", callable_mp(this, &DynamicFontImportSettingsDialog::_change_text_opts)); diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp index d6ce39f6a66c..73bd45235677 100644 --- a/editor/import/resource_importer_texture_atlas.cpp +++ b/editor/import/resource_importer_texture_atlas.cpp @@ -252,7 +252,7 @@ Error ResourceImporterTextureAtlas::import_group_file(const String &p_group_file Ref bit_map; bit_map.instantiate(); bit_map->create_from_image_alpha(image); - Vector> polygons = bit_map->clip_opaque_to_polygons(Rect2(Vector2(), image->get_size())); + Vector> polygons = bit_map->clip_opaque_to_polygons(Rect2(Point2(), image->get_size())); for (int j = 0; j < polygons.size(); j++) { EditorAtlasPacker::Chart chart; diff --git a/editor/input_event_configuration_dialog.cpp b/editor/input_event_configuration_dialog.cpp index dc839b02f663..af7ec614721e 100644 --- a/editor/input_event_configuration_dialog.cpp +++ b/editor/input_event_configuration_dialog.cpp @@ -622,7 +622,7 @@ void InputEventConfigurationDialog::popup_and_configure(const Ref &p set_title(TTR("Event Configuration")); } - popup_centered(Size2(0, 400) * EDSCALE); + popup_centered(Size2(0, 400 * EDSCALE)); } Ref InputEventConfigurationDialog::get_event() const { @@ -637,13 +637,13 @@ void InputEventConfigurationDialog::set_allowed_input_types(int p_type_masks) { InputEventConfigurationDialog::InputEventConfigurationDialog() { allowed_input_types = INPUT_KEY | INPUT_MOUSE_BUTTON | INPUT_JOY_BUTTON | INPUT_JOY_MOTION; - set_min_size(Size2i(550, 0) * EDSCALE); + set_min_size(Size2i(550 * EDSCALE, 0)); VBoxContainer *main_vbox = memnew(VBoxContainer); add_child(main_vbox); event_as_text = memnew(Label); - event_as_text->set_custom_minimum_size(Size2(500, 0) * EDSCALE); + event_as_text->set_custom_minimum_size(Size2(500 * EDSCALE, 0)); event_as_text->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART); event_as_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); event_as_text->add_theme_font_size_override(SceneStringName(font_size), 18 * EDSCALE); diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 77ae70781dcc..b95eaadee53f 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -100,7 +100,7 @@ void AbstractPolygon2DEditor::_action_set_polygon(int p_idx, const Variant &p_pr } Vector2 AbstractPolygon2DEditor::_get_offset(int p_idx) const { - return Vector2(0, 0); + return Vector2(); } void AbstractPolygon2DEditor::_commit_action() { @@ -517,7 +517,7 @@ void AbstractPolygon2DEditor::forward_canvas_draw_over_viewport(Control *p_overl if (wip_active && j == edited_point.polygon) { points = Variant(wip); - offset = Vector2(0, 0); + offset = Vector2(); } else { if (j == -1) { continue; diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 7d580e8de95c..e0c5fb2d4ddb 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -317,10 +317,10 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_draw() { float mind = 5 * EDSCALE; float maxd = 15 * EDSCALE; - blend_space_draw->draw_line(gui_point + Vector2(mind, 0), gui_point + Vector2(maxd, 0), color, Math::round(2 * EDSCALE)); - blend_space_draw->draw_line(gui_point + Vector2(-mind, 0), gui_point + Vector2(-maxd, 0), color, Math::round(2 * EDSCALE)); - blend_space_draw->draw_line(gui_point + Vector2(0, mind), gui_point + Vector2(0, maxd), color, Math::round(2 * EDSCALE)); - blend_space_draw->draw_line(gui_point + Vector2(0, -mind), gui_point + Vector2(0, -maxd), color, Math::round(2 * EDSCALE)); + blend_space_draw->draw_line(gui_point + Point2(mind, 0), gui_point + Point2(maxd, 0), color, Math::round(2 * EDSCALE)); + blend_space_draw->draw_line(gui_point + Point2(-mind, 0), gui_point + Point2(-maxd, 0), color, Math::round(2 * EDSCALE)); + blend_space_draw->draw_line(gui_point + Point2(0, mind), gui_point + Point2(0, maxd), color, Math::round(2 * EDSCALE)); + blend_space_draw->draw_line(gui_point + Point2(0, -mind), gui_point + Point2(0, -maxd), color, Math::round(2 * EDSCALE)); } } diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 55949df54f73..c0311c42dfee 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -462,7 +462,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() { blend_space_draw->draw_line(Point2(1, 0), Point2(1, s.height - 1), linecolor, Math::round(EDSCALE)); blend_space_draw->draw_line(Point2(1, s.height - 1), Point2(s.width - 1, s.height - 1), linecolor, Math::round(EDSCALE)); - blend_space_draw->draw_line(Point2(0, 0), Point2(5 * EDSCALE, 0), linecolor, Math::round(EDSCALE)); + blend_space_draw->draw_line(Point2(), Point2(5 * EDSCALE, 0), linecolor, Math::round(EDSCALE)); if (blend_space->get_min_space().y < 0) { int y = (blend_space->get_max_space().y / (blend_space->get_max_space().y - blend_space->get_min_space().y)) * s.height; blend_space_draw->draw_line(Point2(0, y), Point2(5 * EDSCALE, y), linecolor, Math::round(EDSCALE)); @@ -623,10 +623,10 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_draw() { float mind = 5 * EDSCALE; float maxd = 15 * EDSCALE; - blend_space_draw->draw_line(point + Vector2(mind, 0), point + Vector2(maxd, 0), color, Math::round(2 * EDSCALE)); - blend_space_draw->draw_line(point + Vector2(-mind, 0), point + Vector2(-maxd, 0), color, Math::round(2 * EDSCALE)); - blend_space_draw->draw_line(point + Vector2(0, mind), point + Vector2(0, maxd), color, Math::round(2 * EDSCALE)); - blend_space_draw->draw_line(point + Vector2(0, -mind), point + Vector2(0, -maxd), color, Math::round(2 * EDSCALE)); + blend_space_draw->draw_line(point + Point2(mind, 0), point + Point2(maxd, 0), color, Math::round(2 * EDSCALE)); + blend_space_draw->draw_line(point + Point2(-mind, 0), point + Point2(-maxd, 0), color, Math::round(2 * EDSCALE)); + blend_space_draw->draw_line(point + Point2(0, mind), point + Point2(0, maxd), color, Math::round(2 * EDSCALE)); + blend_space_draw->draw_line(point + Point2(0, -mind), point + Point2(0, -maxd), color, Math::round(2 * EDSCALE)); } } diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index a28fe016667a..55b8caf425aa 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -257,7 +257,7 @@ void AnimationNodeBlendTreeEditor::update_graph() { } pb->set_show_percentage(false); - pb->set_custom_minimum_size(Vector2(0, 14) * EDSCALE); + pb->set_custom_minimum_size(Size2(0, 14 * EDSCALE)); animations[E] = pb; node->add_child(pb); @@ -921,7 +921,7 @@ void AnimationNodeBlendTreeEditor::_inspect_filters(const String &p_which) { return; } - filter_dialog->popup_centered(Size2(500, 500) * EDSCALE); + filter_dialog->popup_centered(Size2(500 * EDSCALE)); } void AnimationNodeBlendTreeEditor::_update_editor_settings() { diff --git a/editor/plugins/animation_library_editor.cpp b/editor/plugins/animation_library_editor.cpp index 38f8b16b3411..2a3619a1f65a 100644 --- a/editor/plugins/animation_library_editor.cpp +++ b/editor/plugins/animation_library_editor.cpp @@ -598,7 +598,7 @@ void AnimationLibraryEditor::_button_pressed(TreeItem *p_item, int p_column, int file_popup->add_separator(); file_popup->add_item(TTR("Open in Inspector"), FILE_MENU_EDIT_LIBRARY); Rect2 pos = tree->get_item_rect(p_item, 1, 0); - Vector2 popup_pos = tree->get_screen_transform().xform(pos.position + Vector2(0, pos.size.height)); + Point2 popup_pos = tree->get_screen_transform().xform(pos.position + Point2(0, pos.size.height)); file_popup->popup(Rect2(popup_pos, Size2())); file_dialog_animation = StringName(); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 0161b3670967..f93bfd4d0216 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -688,7 +688,7 @@ void AnimationPlayerEditor::_edit_animation_blend() { return; } - blend_editor.dialog->popup_centered(Size2(400, 400) * EDSCALE); + blend_editor.dialog->popup_centered(Size2(400 * EDSCALE)); _update_animation_blend(); } @@ -1671,7 +1671,7 @@ void AnimationPlayerEditor::_prepare_onion_layers_2_prolog() { // Tweak the root viewport to ensure it's rendered before our target. RID root_vp = get_tree()->get_root()->get_viewport_rid(); - onion.temp.screen_rect = Rect2(Vector2(), DisplayServer::get_singleton()->window_get_size(DisplayServer::MAIN_WINDOW_ID)); + onion.temp.screen_rect = Rect2(Point2(), DisplayServer::get_singleton()->window_get_size(DisplayServer::MAIN_WINDOW_ID)); RS::get_singleton()->viewport_attach_to_screen(root_vp, Rect2(), DisplayServer::INVALID_WINDOW_ID); RS::get_singleton()->viewport_set_update_mode(root_vp, RS::VIEWPORT_UPDATE_ALWAYS); @@ -1941,7 +1941,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug frame = memnew(SpinBox); hb->add_child(frame); - frame->set_custom_minimum_size(Size2(80, 0) * EDSCALE); + frame->set_custom_minimum_size(Size2(80 * EDSCALE, 0)); frame->set_stretch_ratio(2); frame->set_step(0.0001); frame->set_tooltip_text(TTR("Animation position (in seconds).")); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index e9dd54f73be9..0074ca79c0fa 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -868,7 +868,7 @@ void AnimationNodeStateMachineEditor::_connection_draw(const Vector2 &p_from, co state_machine_draw->draw_set_transform_matrix(xf); if (!p_is_across_group) { - state_machine_draw->draw_texture(icon, Vector2(), icon_color); + state_machine_draw->draw_texture(icon, Point2(), icon_color); } state_machine_draw->draw_set_transform_matrix(Transform2D()); } @@ -1137,7 +1137,7 @@ void AnimationNodeStateMachineEditor::_state_machine_draw() { nr.name.position = offset + Vector2(0, (h - theme_cache.node_title_font->get_height(theme_cache.node_title_font_size)) / 2).floor(); nr.name.size = Vector2(name_string_size, theme_cache.node_title_font->get_height(theme_cache.node_title_font_size)); - state_machine_draw->draw_string(theme_cache.node_title_font, nr.name.position + Vector2(0, theme_cache.node_title_font->get_ascent(theme_cache.node_title_font_size)), name, HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.node_title_font_size, theme_cache.node_title_font_color); + state_machine_draw->draw_string(theme_cache.node_title_font, nr.name.position + Point2(0, theme_cache.node_title_font->get_ascent(theme_cache.node_title_font_size)), name, HORIZONTAL_ALIGNMENT_LEFT, -1, theme_cache.node_title_font_size, theme_cache.node_title_font_color); offset.x += name_string_size + sep; nr.can_edit = needs_editor; diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index 757d410b788e..b51f416e9d44 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -305,7 +305,7 @@ void AnimationTreeEditorPlugin::make_visible(bool p_visible) { AnimationTreeEditorPlugin::AnimationTreeEditorPlugin() { anim_tree_editor = memnew(AnimationTreeEditor); - anim_tree_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE); + anim_tree_editor->set_custom_minimum_size(Size2(0, 300 * EDSCALE)); button = EditorNode::get_bottom_panel()->add_item(TTR("AnimationTree"), anim_tree_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_animation_tree_bottom_panel", TTR("Toggle AnimationTree Bottom Panel"))); button->hide(); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 56a31fbb0d8a..bc6e4d52bbeb 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -135,7 +135,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) { add_child(hb); icon = memnew(TextureButton); - icon->set_custom_minimum_size(Size2(64, 64) * EDSCALE); + icon->set_custom_minimum_size(Size2(64 * EDSCALE)); hb->add_child(icon); VBoxContainer *vb = memnew(VBoxContainer); @@ -324,7 +324,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { item = memnew(EditorAssetLibraryItem); desc_vbox->add_child(item); - desc_vbox->set_custom_minimum_size(Size2(440 * EDSCALE, 440 * EDSCALE)); + desc_vbox->set_custom_minimum_size(Size2(440 * EDSCALE)); description = memnew(RichTextLabel); desc_vbox->add_child(description); @@ -344,13 +344,13 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() { previews_vbox->add_child(preview); preview->set_expand_mode(TextureRect::EXPAND_IGNORE_SIZE); preview->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); - preview->set_custom_minimum_size(Size2(640 * EDSCALE, 345 * EDSCALE)); + preview->set_custom_minimum_size(Size2(640, 345) * EDSCALE); preview->set_v_size_flags(Control::SIZE_EXPAND_FILL); preview->set_h_size_flags(Control::SIZE_EXPAND_FILL); previews_bg = memnew(PanelContainer); previews_vbox->add_child(previews_bg); - previews_bg->set_custom_minimum_size(Size2(640 * EDSCALE, 101 * EDSCALE)); + previews_bg->set_custom_minimum_size(Size2(640, 101) * EDSCALE); previews = memnew(ScrollContainer); previews_bg->add_child(previews); @@ -607,7 +607,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { hb2->add_child(retry_button); hb2->add_child(install_button); - set_custom_minimum_size(Size2(310, 0) * EDSCALE); + set_custom_minimum_size(Size2(310 * EDSCALE, 0)); download = memnew(HTTPRequest); panel->add_child(download); diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp index f691bad3c316..74f3154f0e8b 100644 --- a/editor/plugins/audio_stream_editor_plugin.cpp +++ b/editor/plugins/audio_stream_editor_plugin.cpp @@ -215,7 +215,7 @@ void AudioStreamEditor::set_stream(const Ref &p_stream) { } AudioStreamEditor::AudioStreamEditor() { - set_custom_minimum_size(Size2(1, 100) * EDSCALE); + set_custom_minimum_size(Size2(1, 100 * EDSCALE)); _player = memnew(AudioStreamPlayer); _player->connect(SceneStringName(finished), callable_mp(this, &AudioStreamEditor::_on_finished)); diff --git a/editor/plugins/bit_map_editor_plugin.cpp b/editor/plugins/bit_map_editor_plugin.cpp index 668ea04d6982..a2a527a6aa71 100644 --- a/editor/plugins/bit_map_editor_plugin.cpp +++ b/editor/plugins/bit_map_editor_plugin.cpp @@ -44,7 +44,7 @@ BitMapEditor::BitMapEditor() { texture_rect = memnew(TextureRect); texture_rect->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); texture_rect->set_texture_filter(TEXTURE_FILTER_NEAREST); - texture_rect->set_custom_minimum_size(Size2(0, 250) * EDSCALE); + texture_rect->set_custom_minimum_size(Size2(0, 250 * EDSCALE)); add_child(texture_rect); size_label = memnew(Label); diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index c00436b01f83..2ec1e702d655 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -306,7 +306,7 @@ void BoneMapper::create_editor() { bone_mapper_field = memnew(AspectRatioContainer); bone_mapper_field->set_stretch_mode(AspectRatioContainer::STRETCH_FIT); - bone_mapper_field->set_custom_minimum_size(Vector2(0, 256.0) * EDSCALE); + bone_mapper_field->set_custom_minimum_size(Size2(0, 256 * EDSCALE)); bone_mapper_field->set_h_size_flags(Control::SIZE_FILL); add_child(bone_mapper_field); @@ -351,7 +351,7 @@ void BoneMapper::update_group_idx() { void BoneMapper::_pick_bone(const StringName &p_bone_name) { picker_key_name = p_bone_name; - picker->popup_bones_tree(Size2(500, 500) * EDSCALE); + picker->popup_bones_tree(Size2(500 * EDSCALE)); } void BoneMapper::_apply_picker_selection() { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index fbc5ffabb82a..2671a4e22582 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -364,8 +364,8 @@ Point2 CanvasItemEditor::snap_point(Point2 p_target, unsigned int p_modes, unsig // Parent sides and center if ((is_snap_active && snap_node_parent && (p_modes & SNAP_NODE_PARENT)) || (p_forced_modes & SNAP_NODE_PARENT)) { if (const Control *c = Object::cast_to(p_self_canvas_item)) { - Point2 begin = p_self_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(0, 0))); - Point2 end = p_self_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(1, 1))); + Point2 begin = p_self_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2())); + Point2 end = p_self_canvas_item->get_global_transform_with_canvas().xform(_anchor_to_position(c, Point2(1))); _snap_if_closer_point(p_target, output, snap_target, begin, SNAP_TARGET_PARENT, rotation); _snap_if_closer_point(p_target, output, snap_target, (begin + end) / 2.0, SNAP_TARGET_PARENT, rotation); _snap_if_closer_point(p_target, output, snap_target, end, SNAP_TARGET_PARENT, rotation); @@ -735,7 +735,7 @@ void CanvasItemEditor::_find_canvas_items_in_rect(const Rect2 &p_rect, Node *p_n Rect2 rect = ci->_edit_get_rect(); if (p_rect.has_point(xform.xform(rect.position)) && p_rect.has_point(xform.xform(rect.position + Vector2(rect.size.x, 0))) && - p_rect.has_point(xform.xform(rect.position + Vector2(rect.size.x, rect.size.y))) && + p_rect.has_point(xform.xform(rect.position + rect.size)) && p_rect.has_point(xform.xform(rect.position + Vector2(0, rect.size.y)))) { r_items->push_back(ci); } @@ -1959,7 +1959,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref &p_event) { drag_type = DRAG_SCALE_BOTH; if (show_transformation_gizmos) { - Size2 scale_factor = Size2(SCALE_HANDLE_DISTANCE, SCALE_HANDLE_DISTANCE); + Size2 scale_factor = Size2(SCALE_HANDLE_DISTANCE); Rect2 x_handle_rect = Rect2(scale_factor.x * EDSCALE, -5 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE); if (x_handle_rect.has_point(simple_xform.affine_inverse().xform(b->get_position()))) { drag_type = DRAG_SCALE_X; @@ -2017,7 +2017,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref &p_event) { } else { Size2 scale_factor = Vector2(offset.x, -offset.y) / SCALE_HANDLE_DISTANCE; Size2 parent_scale = parent_xform.get_scale(); - scale_factor *= Vector2(1.0 / parent_scale.x, 1.0 / parent_scale.y); + scale_factor *= Size2(1) / parent_scale; if (drag_type == DRAG_SCALE_X) { scale.x += scale_factor.x; @@ -2110,12 +2110,12 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { Transform2D simple_xform = viewport->get_transform() * unscaled_transform; if (show_transformation_gizmos) { - Size2 move_factor = Size2(MOVE_HANDLE_DISTANCE, MOVE_HANDLE_DISTANCE); - Rect2 x_handle_rect = Rect2(move_factor.x * EDSCALE, -5 * EDSCALE, 10 * EDSCALE, 10 * EDSCALE); + Size2 move_factor = Size2(MOVE_HANDLE_DISTANCE); + Rect2 x_handle_rect = Rect2(Point2(move_factor.x, -5) * EDSCALE, Size2(10 * EDSCALE)); if (x_handle_rect.has_point(simple_xform.affine_inverse().xform(b->get_position()))) { drag_type = DRAG_MOVE_X; } - Rect2 y_handle_rect = Rect2(-5 * EDSCALE, move_factor.y * EDSCALE, 10 * EDSCALE, 10 * EDSCALE); + Rect2 y_handle_rect = Rect2(Point2(-5, move_factor.y) * EDSCALE, Size2(10 * EDSCALE)); if (y_handle_rect.has_point(simple_xform.affine_inverse().xform(b->get_position()))) { drag_type = DRAG_MOVE_Y; } @@ -2236,8 +2236,8 @@ bool CanvasItemEditor::_gui_input_move(const Ref &p_event) { } drag_type = DRAG_KEY_MOVE; - drag_from = Vector2(); - drag_to = Vector2(); + drag_from = Point2(); + drag_to = Point2(); _save_canvas_item_state(drag_selection, true); } @@ -2844,16 +2844,16 @@ void CanvasItemEditor::_draw_text_at_position(Point2 p_position, const String &p Size2 text_size = font->get_string_size(p_string, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size); switch (p_side) { case SIDE_LEFT: - p_position += Vector2(-text_size.x - 5, text_size.y / 2); + p_position += Point2(-text_size.x - 5, text_size.y / 2); break; case SIDE_TOP: - p_position += Vector2(-text_size.x / 2, -5); + p_position += Point2(-text_size.x / 2, -5); break; case SIDE_RIGHT: - p_position += Vector2(5, text_size.y / 2); + p_position += Point2(5, text_size.y / 2); break; case SIDE_BOTTOM: - p_position += Vector2(-text_size.x / 2, text_size.y + 5); + p_position += Point2(-text_size.x / 2, text_size.y + 5); break; } viewport->draw_string(font, p_position, p_string, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, color); @@ -2937,17 +2937,17 @@ void CanvasItemEditor::_draw_smart_snapping() { Color line_color = EDITOR_GET("editors/2d/smart_snapping_line_color"); Transform2D xform = transform * snap_transform; if (snap_target[0] != SNAP_TARGET_NONE && snap_target[0] != SNAP_TARGET_GRID) { - _draw_straight_line(xform.xform(Point2(0, 0)), xform.xform(Point2(0, 1)), line_color); + _draw_straight_line(xform.xform(Point2()), xform.xform(Point2(0, 1)), line_color); } if (snap_target[1] != SNAP_TARGET_NONE && snap_target[1] != SNAP_TARGET_GRID) { - _draw_straight_line(xform.xform(Point2(0, 0)), xform.xform(Point2(1, 0)), line_color); + _draw_straight_line(xform.xform(Point2()), xform.xform(Point2(1, 0)), line_color); } xform = transform * snap_transform2; if (snap_target2[0] != SNAP_TARGET_NONE && snap_target2[0] != SNAP_TARGET_GRID) { - _draw_straight_line(xform.xform(Point2(0, 0)), xform.xform(Point2(0, 1)), line_color); + _draw_straight_line(xform.xform(Point2()), xform.xform(Point2(0, 1)), line_color); } if (snap_target2[1] != SNAP_TARGET_NONE && snap_target2[1] != SNAP_TARGET_GRID) { - _draw_straight_line(xform.xform(Point2(0, 0)), xform.xform(Point2(1, 0)), line_color); + _draw_straight_line(xform.xform(Point2()), xform.xform(Point2(1, 0)), line_color); } } @@ -2971,7 +2971,7 @@ void CanvasItemEditor::_draw_rulers() { ruler_transform.scale_basis(grid_step * Math::pow(2.0, grid_step_multiplier)); } while ((transform * ruler_transform).get_scale().x < 50 || (transform * ruler_transform).get_scale().y < 50) { - ruler_transform.scale_basis(Point2(2, 2)); + ruler_transform.scale_basis(Point2(2)); } } else { real_t basic_rule = 100; @@ -2981,17 +2981,17 @@ void CanvasItemEditor::_draw_rulers() { for (int i = 0; basic_rule * zoom < 100; i++) { basic_rule *= (i % 2) ? 2.0 : 5.0; } - ruler_transform.scale(Size2(basic_rule, basic_rule)); + ruler_transform.scale(Size2(basic_rule)); } // Subdivisions int major_subdivision = 2; Transform2D major_subdivide; - major_subdivide.scale(Size2(1.0 / major_subdivision, 1.0 / major_subdivision)); + major_subdivide.scale(Size2(1.0 / major_subdivision)); int minor_subdivision = 5; Transform2D minor_subdivide; - minor_subdivide.scale(Size2(1.0 / minor_subdivision, 1.0 / minor_subdivision)); + minor_subdivide.scale(Size2(1.0 / minor_subdivision)); // First and last graduations to draw (in the ruler space) Point2 first = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(Point2(RULER_WIDTH, RULER_WIDTH)); @@ -3037,7 +3037,7 @@ void CanvasItemEditor::_draw_rulers() { } // Draw the top left corner - viewport->draw_rect(Rect2(Point2(), Size2(RULER_WIDTH, RULER_WIDTH)), graduation_color); + viewport->draw_rect(Rect2(Point2(), Size2(RULER_WIDTH)), graduation_color); } void CanvasItemEditor::_draw_grid() { @@ -3142,7 +3142,7 @@ void CanvasItemEditor::_draw_ruler_tool() { const float text_width = 76; const float angle_text_width = 54; - Point2 text_pos = (begin + end) / 2 - Vector2(text_width / 2, text_height / 2); + Point2 text_pos = (begin + end) / 2 - Point2(text_width / 2, text_height / 2); text_pos.x = CLAMP(text_pos.x, text_width / 2, viewport->get_rect().size.x - text_width * 1.5); text_pos.y = CLAMP(text_pos.y, text_height * 1.5, viewport->get_rect().size.y - text_height * 1.5); @@ -3233,7 +3233,7 @@ void CanvasItemEditor::_draw_ruler_tool() { } if (grid_snap_active) { - text_pos = (begin + end) / 2 + Vector2(-text_width / 2, text_height / 2); + text_pos = (begin + end) / 2 + Point2(-text_width / 2, text_height / 2); text_pos.x = CLAMP(text_pos.x, text_width / 2, viewport->get_rect().size.x - text_width * 1.5); text_pos.y = CLAMP(text_pos.y, text_height * 2.5, viewport->get_rect().size.y - text_height / 2); @@ -3283,15 +3283,15 @@ void CanvasItemEditor::_draw_control_anchors(Control *control) { // Draw the anchors handles Rect2 anchor_rects[4]; if (control->is_layout_rtl()) { - anchor_rects[0] = Rect2(anchors_pos[0] - Vector2(0.0, anchor_handle->get_size().y), Point2(-anchor_handle->get_size().x, anchor_handle->get_size().y)); + anchor_rects[0] = Rect2(anchors_pos[0] - Point2(0.0, anchor_handle->get_size().y), Size2(-anchor_handle->get_size().x, anchor_handle->get_size().y)); anchor_rects[1] = Rect2(anchors_pos[1] - anchor_handle->get_size(), anchor_handle->get_size()); - anchor_rects[2] = Rect2(anchors_pos[2] - Vector2(anchor_handle->get_size().x, 0.0), Point2(anchor_handle->get_size().x, -anchor_handle->get_size().y)); + anchor_rects[2] = Rect2(anchors_pos[2] - Point2(anchor_handle->get_size().x, 0.0), Size2(anchor_handle->get_size().x, -anchor_handle->get_size().y)); anchor_rects[3] = Rect2(anchors_pos[3], -anchor_handle->get_size()); } else { anchor_rects[0] = Rect2(anchors_pos[0] - anchor_handle->get_size(), anchor_handle->get_size()); - anchor_rects[1] = Rect2(anchors_pos[1] - Vector2(0.0, anchor_handle->get_size().y), Point2(-anchor_handle->get_size().x, anchor_handle->get_size().y)); + anchor_rects[1] = Rect2(anchors_pos[1] - Point2(0.0, anchor_handle->get_size().y), Size2(-anchor_handle->get_size().x, anchor_handle->get_size().y)); anchor_rects[2] = Rect2(anchors_pos[2], -anchor_handle->get_size()); - anchor_rects[3] = Rect2(anchors_pos[3] - Vector2(anchor_handle->get_size().x, 0.0), Point2(anchor_handle->get_size().x, -anchor_handle->get_size().y)); + anchor_rects[3] = Rect2(anchors_pos[3] - Point2(anchor_handle->get_size().x, 0.0), Size2(anchor_handle->get_size().x, -anchor_handle->get_size().y)); } for (int i = 0; i < 4; i++) { @@ -3395,11 +3395,11 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) { case DRAG_LEFT: case DRAG_TOP_LEFT: case DRAG_BOTTOM_LEFT: - _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), SIDE_BOTTOM); + _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Point2(0, 5), SIDE_BOTTOM); [[fallthrough]]; case DRAG_MOVE: - start = Vector2(node_pos_in_parent[0], Math::lerp(node_pos_in_parent[1], node_pos_in_parent[3], ratio)); - end = start - Vector2(control->get_offset(SIDE_LEFT), 0); + start = Point2(node_pos_in_parent[0], Math::lerp(node_pos_in_parent[1], node_pos_in_parent[3], ratio)); + end = start - Point2(control->get_offset(SIDE_LEFT), 0); _draw_margin_at_position(control->get_offset(SIDE_LEFT), parent_transform.xform((start + end) / 2), SIDE_TOP); viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, Math::round(EDSCALE)); break; @@ -3410,11 +3410,11 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) { case DRAG_RIGHT: case DRAG_TOP_RIGHT: case DRAG_BOTTOM_RIGHT: - _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Vector2(0, 5), SIDE_BOTTOM); + _draw_margin_at_position(control->get_size().width, parent_transform.xform(Vector2((node_pos_in_parent[0] + node_pos_in_parent[2]) / 2, node_pos_in_parent[3])) + Point2(0, 5), SIDE_BOTTOM); [[fallthrough]]; case DRAG_MOVE: - start = Vector2(node_pos_in_parent[2], Math::lerp(node_pos_in_parent[3], node_pos_in_parent[1], ratio)); - end = start - Vector2(control->get_offset(SIDE_RIGHT), 0); + start = Point2(node_pos_in_parent[2], Math::lerp(node_pos_in_parent[3], node_pos_in_parent[1], ratio)); + end = start - Point2(control->get_offset(SIDE_RIGHT), 0); _draw_margin_at_position(control->get_offset(SIDE_RIGHT), parent_transform.xform((start + end) / 2), SIDE_BOTTOM); viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, Math::round(EDSCALE)); break; @@ -3425,11 +3425,11 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) { case DRAG_TOP: case DRAG_TOP_LEFT: case DRAG_TOP_RIGHT: - _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Vector2(5, 0), SIDE_RIGHT); + _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2)) + Point2(5, 0), SIDE_RIGHT); [[fallthrough]]; case DRAG_MOVE: - start = Vector2(Math::lerp(node_pos_in_parent[0], node_pos_in_parent[2], ratio), node_pos_in_parent[1]); - end = start - Vector2(0, control->get_offset(SIDE_TOP)); + start = Point2(Math::lerp(node_pos_in_parent[0], node_pos_in_parent[2], ratio), node_pos_in_parent[1]); + end = start - Point2(0, control->get_offset(SIDE_TOP)); _draw_margin_at_position(control->get_offset(SIDE_TOP), parent_transform.xform((start + end) / 2), SIDE_LEFT); viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, Math::round(EDSCALE)); break; @@ -3440,11 +3440,11 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) { case DRAG_BOTTOM: case DRAG_BOTTOM_LEFT: case DRAG_BOTTOM_RIGHT: - _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Vector2(5, 0)), SIDE_RIGHT); + _draw_margin_at_position(control->get_size().height, parent_transform.xform(Vector2(node_pos_in_parent[2], (node_pos_in_parent[1] + node_pos_in_parent[3]) / 2) + Point2(5, 0)), SIDE_RIGHT); [[fallthrough]]; case DRAG_MOVE: - start = Vector2(Math::lerp(node_pos_in_parent[2], node_pos_in_parent[0], ratio), node_pos_in_parent[3]); - end = start - Vector2(0, control->get_offset(SIDE_BOTTOM)); + start = Point2(Math::lerp(node_pos_in_parent[2], node_pos_in_parent[0], ratio), node_pos_in_parent[3]); + end = start - Point2(0, control->get_offset(SIDE_BOTTOM)); _draw_margin_at_position(control->get_offset(SIDE_BOTTOM), parent_transform.xform((start + end) / 2), SIDE_RIGHT); viewport->draw_line(parent_transform.xform(start), parent_transform.xform(end), color_base, Math::round(EDSCALE)); break; @@ -3463,8 +3463,8 @@ void CanvasItemEditor::_draw_control_helpers(Control *control) { case DRAG_BOTTOM: case DRAG_BOTTOM_LEFT: case DRAG_MOVE: - if (control->get_rotation() != 0.0 || control->get_scale() != Vector2(1, 1)) { - Rect2 rect = Rect2(Vector2(node_pos_in_parent[0], node_pos_in_parent[1]), control->get_size()); + if (control->get_rotation() != 0.0 || control->get_scale() != Vector2(1)) { + Rect2 rect = Rect2(Point2(node_pos_in_parent[0], node_pos_in_parent[1]), control->get_size()); viewport->draw_rect(parent_transform.xform(rect), color_base, false, Math::round(EDSCALE)); } break; @@ -3580,22 +3580,22 @@ void CanvasItemEditor::_draw_selection() { Transform2D unscaled_transform = (xform * ci->get_transform().affine_inverse() * ci->_edit_get_transform()).orthonormalized(); Transform2D simple_xform = viewport->get_transform() * unscaled_transform; - Size2 move_factor = Size2(MOVE_HANDLE_DISTANCE, MOVE_HANDLE_DISTANCE); + Size2 move_factor = Size2(MOVE_HANDLE_DISTANCE); viewport->draw_set_transform_matrix(simple_xform); Vector points = { - Vector2(move_factor.x * EDSCALE, 5 * EDSCALE), - Vector2(move_factor.x * EDSCALE, -5 * EDSCALE), - Vector2((move_factor.x + 10) * EDSCALE, 0) + Point2(move_factor.x, 5) * EDSCALE, + Point2(move_factor.x, -5) * EDSCALE, + Point2((move_factor.x + 10) * EDSCALE, 0) }; viewport->draw_colored_polygon(points, get_theme_color(SNAME("axis_x_color"), EditorStringName(Editor))); viewport->draw_line(Point2(), Point2(move_factor.x * EDSCALE, 0), get_theme_color(SNAME("axis_x_color"), EditorStringName(Editor)), Math::round(EDSCALE)); points.clear(); - points.push_back(Vector2(5 * EDSCALE, move_factor.y * EDSCALE)); - points.push_back(Vector2(-5 * EDSCALE, move_factor.y * EDSCALE)); - points.push_back(Vector2(0, (move_factor.y + 10) * EDSCALE)); + points.push_back(Point2(5, move_factor.y) * EDSCALE); + points.push_back(Point2(-5, move_factor.y) * EDSCALE); + points.push_back(Point2(0, (move_factor.y + 10) * EDSCALE)); viewport->draw_colored_polygon(points, get_theme_color(SNAME("axis_y_color"), EditorStringName(Editor))); viewport->draw_line(Point2(), Point2(0, move_factor.y * EDSCALE), get_theme_color(SNAME("axis_y_color"), EditorStringName(Editor)), Math::round(EDSCALE)); @@ -3610,7 +3610,7 @@ void CanvasItemEditor::_draw_selection() { Transform2D unscaled_transform = (xform * ci->get_transform().affine_inverse() * ci->_edit_get_transform()).orthonormalized(); Transform2D simple_xform = viewport->get_transform() * unscaled_transform; - Size2 scale_factor = Size2(SCALE_HANDLE_DISTANCE, SCALE_HANDLE_DISTANCE); + Size2 scale_factor = Size2(SCALE_HANDLE_DISTANCE); bool uniform = Input::get_singleton()->is_key_pressed(Key::SHIFT); Point2 offset = (simple_xform.affine_inverse().xform(drag_to) - simple_xform.affine_inverse().xform(drag_from)) * zoom; @@ -3721,7 +3721,7 @@ void CanvasItemEditor::_draw_axis() { Size2 screen_size = Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height")); Vector2 screen_endpoints[4] = { - transform.xform(Vector2(0, 0)), + transform.xform(Vector2()), transform.xform(Vector2(screen_size.width, 0)), transform.xform(Vector2(screen_size.width, screen_size.height)), transform.xform(Vector2(0, screen_size.height)) @@ -3771,7 +3771,7 @@ void CanvasItemEditor::_draw_invisible_nodes_positions(Node *p_node, const Trans void CanvasItemEditor::_draw_hover() { List previous_rects; - Vector2 icon_size = Vector2(1, 1) * get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); + Size2 icon_size = Size2(get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor))); for (int i = 0; i < hovering_results.size(); i++) { Ref node_icon = hovering_results[i].icon; @@ -3830,7 +3830,7 @@ void CanvasItemEditor::_draw_message() { case DRAG_SCALE_X: case DRAG_SCALE_Y: case DRAG_SCALE_BOTH: { - Vector2 original_scale = (Math::is_zero_approx(original_transform.get_scale().x) || Math::is_zero_approx(original_transform.get_scale().y)) ? Vector2(CMP_EPSILON, CMP_EPSILON) : original_transform.get_scale(); + Vector2 original_scale = (Math::is_zero_approx(original_transform.get_scale().x) || Math::is_zero_approx(original_transform.get_scale().y)) ? Vector2(CMP_EPSILON) : original_transform.get_scale(); Vector2 delta = current_transform.get_scale() / original_scale; if (drag_type == DRAG_SCALE_BOTH) { message = TTR("Scaling:") + String::utf8(" ×(") + FORMAT(delta.x) + ", " + FORMAT(delta.y) + ")"; @@ -3854,9 +3854,9 @@ void CanvasItemEditor::_draw_message() { Ref font = get_theme_font(SceneStringName(font), SNAME("Label")); int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label")); Point2 msgpos = Point2(RULER_WIDTH + 5 * EDSCALE, viewport->get_size().y - 20 * EDSCALE); - viewport->draw_string(font, msgpos + Point2(1, 1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); - viewport->draw_string(font, msgpos + Point2(-1, -1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); - viewport->draw_string(font, msgpos, message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 1)); + viewport->draw_string(font, msgpos + Point2(1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); + viewport->draw_string(font, msgpos + Point2(-1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); + viewport->draw_string(font, msgpos, message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size); } void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p_parent_xform, const Transform2D &p_canvas_xform) { @@ -3892,13 +3892,13 @@ void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p Ref lock = get_editor_theme_icon(SNAME("LockViewport")); if (show_lock_gizmos && p_node->has_meta("_edit_lock_")) { - lock->draw(viewport_ci, (transform * canvas_xform * parent_xform).xform(Point2(0, 0)) + Point2(offset, 0)); + lock->draw(viewport_ci, (transform * canvas_xform * parent_xform).xform(Point2()) + Point2(offset, 0)); offset += lock->get_size().x; } Ref group = get_editor_theme_icon(SNAME("GroupViewport")); if (show_group_gizmos && ci->has_meta("_edit_group_")) { - group->draw(viewport_ci, (transform * canvas_xform * parent_xform).xform(Point2(0, 0)) + Point2(offset, 0)); + group->draw(viewport_ci, (transform * canvas_xform * parent_xform).xform(Point2()) + Point2(offset, 0)); //offset += group->get_size().x; } } @@ -3907,7 +3907,7 @@ void CanvasItemEditor::_draw_locks_and_groups(Node *p_node, const Transform2D &p void CanvasItemEditor::_draw_viewport() { // Update the transform transform = Transform2D(); - transform.scale_basis(Size2(zoom, zoom)); + transform.scale_basis(Size2(zoom)); transform.columns[2] = -view_offset * zoom; EditorNode::get_singleton()->get_scene_root()->set_global_canvas_transform(transform); @@ -4130,8 +4130,8 @@ void CanvasItemEditor::_selection_changed() { } selected_from_canvas = false; - if (temp_pivot != Vector2(INFINITY, INFINITY)) { - temp_pivot = Vector2(INFINITY, INFINITY); + if (temp_pivot != Vector2(INFINITY)) { + temp_pivot = Vector2(INFINITY); viewport->queue_redraw(); } } @@ -4151,8 +4151,8 @@ void CanvasItemEditor::_update_scrollbars() { updating_scroll = true; // Move the zoom buttons. - Point2 controls_vb_begin = Point2(5, 5); - controls_vb_begin += (show_rulers) ? Point2(RULER_WIDTH, RULER_WIDTH) : Point2(); + Point2 controls_vb_begin = Point2(5); + controls_vb_begin += (show_rulers) ? Point2(RULER_WIDTH) : Point2(); controls_vb->set_begin(controls_vb_begin); Size2 hmin = h_scroll->get_minimum_size(); @@ -4697,13 +4697,13 @@ void CanvasItemEditor::_popup_callback(int p_op) { Node2D *n2d = Object::cast_to(ci); if (key_pos) { - n2d->set_position(Vector2()); + n2d->set_position(Point2()); } if (key_rot) { n2d->set_rotation(0); } if (key_scale) { - n2d->set_scale(Vector2(1, 1)); + n2d->set_scale(Size2(1)); } } else if (Object::cast_to(ci)) { Control *ctrl = Object::cast_to(ci); @@ -4832,7 +4832,7 @@ void CanvasItemEditor::_focus_selection(int p_op) { Vector2 scale = xform.get_scale(); real_t angle = xform.get_rotation(); - Transform2D t(angle, Vector2(0.f, 0.f)); + Transform2D t(angle, Vector2(0)); item_rect = t.xform(item_rect); Rect2 canvas_item_rect(pos + scale * item_rect.position, scale * item_rect.size); if (count == 1) { @@ -5106,8 +5106,8 @@ void CanvasItemEditor::clear() { _update_scrollbars(); grid_offset = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "grid_offset", Vector2()); - grid_step = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "grid_step", Vector2(8, 8)); - primary_grid_step = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "primary_grid_step", Vector2i(8, 8)); + grid_step = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "grid_step", Vector2(8)); + primary_grid_step = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "primary_grid_step", Vector2i(8)); snap_rotation_step = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "snap_rotation_step", Math::deg_to_rad(15.0)); snap_rotation_offset = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "snap_rotation_offset", 0.0); snap_scale_step = EditorSettings::get_singleton()->get_project_metadata("2d_editor", "snap_scale_step", 0.1); @@ -5253,7 +5253,7 @@ CanvasItemEditor::CanvasItemEditor() { scene_tree->add_child(EditorNode::get_singleton()->get_scene_root()); controls_vb = memnew(VBoxContainer); - controls_vb->set_begin(Point2(5, 5)); + controls_vb->set_begin(Point2(5)); ED_SHORTCUT("canvas_item_editor/cancel_transform", TTR("Cancel Transformation"), Key::ESCAPE); @@ -5660,7 +5660,7 @@ CanvasItemEditor::CanvasItemEditor() { selection_menu = memnew(PopupMenu); add_child(selection_menu); - selection_menu->set_min_size(Vector2(100, 0)); + selection_menu->set_min_size(Size2(100, 0)); selection_menu->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); selection_menu->connect(SceneStringName(id_pressed), callable_mp(this, &CanvasItemEditor::_selection_result_pressed)); selection_menu->connect("popup_hide", callable_mp(this, &CanvasItemEditor::_selection_menu_hide), CONNECT_DEFERRED); @@ -5798,7 +5798,7 @@ void CanvasItemEditorViewport::_create_preview(const Vector &files) cons Sprite2D *sprite = memnew(Sprite2D); sprite->set_texture(get_editor_theme_icon(SNAME("AudioStreamPlayer2D"))); sprite->set_modulate(Color(1, 1, 1, 0.7f)); - sprite->set_position(Vector2(0, -sprite->get_texture()->get_size().height) * EDSCALE); + sprite->set_position(Point2(0, -sprite->get_texture()->get_size().height) * EDSCALE); preview_node->add_child(sprite); add_preview = true; } @@ -5884,9 +5884,9 @@ void CanvasItemEditorViewport::_create_texture_node(Node *p_parent, Node *p_chil } else if (Object::cast_to(p_child)) { Size2 texture_size = texture->get_size(); Vector list = { - Vector2(0, 0), + Vector2(), Vector2(texture_size.width, 0), - Vector2(texture_size.width, texture_size.height), + texture_size, Vector2(0, texture_size.height) }; undo_redo->add_do_property(p_child, "polygon", list); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 025ed297aa0b..2cace97d49fa 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -255,7 +255,7 @@ class CanvasItemEditor : public VBoxContainer { bool key_scale = false; bool pan_pressed = false; - Vector2 temp_pivot = Vector2(INFINITY, INFINITY); + Vector2 temp_pivot = Vector2(INFINITY); bool ruler_tool_active = false; Point2 ruler_tool_origin; diff --git a/editor/plugins/cast_2d_editor_plugin.cpp b/editor/plugins/cast_2d_editor_plugin.cpp index 3da7d4a7dc25..108321b1650c 100644 --- a/editor/plugins/cast_2d_editor_plugin.cpp +++ b/editor/plugins/cast_2d_editor_plugin.cpp @@ -117,7 +117,7 @@ void Cast2DEditor::forward_canvas_draw_over_viewport(Control *p_overlay) { Transform2D gt = canvas_item_editor->get_canvas_transform() * node->get_global_transform(); const Ref handle = get_editor_theme_icon(SNAME("EditorHandle")); - p_overlay->draw_texture(handle, gt.xform((Vector2)node->get("target_position")) - handle->get_size() / 2); + p_overlay->draw_texture(handle, gt.xform(node->get("target_position").operator Vector2()) - handle->get_size() / 2); } void Cast2DEditor::edit(Node2D *p_node) { diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index d27036654e7b..ca37aae6eda1 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -171,7 +171,7 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) { case RECTANGLE_SHAPE: { if (idx < 8) { Ref rect = node->get_shape(); - Vector2 size = (Point2)original; + Vector2 size = (original.operator Vector2()); if (RECT_HANDLES[idx].x != 0) { size.x = p_point.x * RECT_HANDLES[idx].x * 2; @@ -184,9 +184,9 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) { rect->set_size(size.abs()); node->set_global_position(original_transform.get_origin()); } else { - rect->set_size(((Point2)original + (size - (Point2)original) * 0.5).abs()); + rect->set_size(((original.operator Vector2()) + (size - (original.operator Vector2())) * 0.5).abs()); Point2 pos = original_transform.affine_inverse().xform(original_transform.get_origin()); - pos += (size - (Point2)original) * 0.5 * RECT_HANDLES[idx] * 0.5; + pos += (size - (original.operator Vector2())) * 0.5 * RECT_HANDLES[idx] * 0.5; node->set_global_position(original_transform.xform(pos)); } } diff --git a/editor/plugins/collision_shape_2d_editor_plugin.h b/editor/plugins/collision_shape_2d_editor_plugin.h index 672e1d9ce0ab..9da208dd47da 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.h +++ b/editor/plugins/collision_shape_2d_editor_plugin.h @@ -52,11 +52,11 @@ class CollisionShape2DEditor : public Control { const Point2 RECT_HANDLES[8] = { Point2(1, 0), - Point2(1, 1), + Point2(1), Point2(0, 1), Point2(-1, 1), Point2(-1, 0), - Point2(-1, -1), + Point2(-1), Point2(0, -1), Point2(1, -1), }; diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp index df20395ac5ab..6f4c07e2a0f1 100644 --- a/editor/plugins/control_editor_plugin.cpp +++ b/editor/plugins/control_editor_plugin.cpp @@ -466,7 +466,7 @@ bool EditorInspectorPluginControl::parse_property(Object *p_object, const Varian // Toolbars controls. Size2 ControlEditorPopupButton::get_minimum_size() const { - Vector2 base_size = Vector2(26, 26) * EDSCALE; + Vector2 base_size = Vector2(26 * EDSCALE); if (arrow_icon.is_null()) { return base_size; @@ -510,7 +510,7 @@ void ControlEditorPopupButton::_notification(int p_what) { case NOTIFICATION_DRAW: { if (arrow_icon.is_valid()) { - Vector2 arrow_pos = Point2(26, 0) * EDSCALE; + Vector2 arrow_pos = Point2(26 * EDSCALE, 0); arrow_pos.y = get_size().y / 2 - arrow_icon->get_height() / 2; draw_texture(arrow_icon, arrow_pos); } @@ -547,7 +547,7 @@ void ControlEditorPresetPicker::_add_row_button(HBoxContainer *p_row, const int ERR_FAIL_COND(preset_buttons.has(p_preset)); Button *b = memnew(Button); - b->set_custom_minimum_size(Size2i(36, 36) * EDSCALE); + b->set_custom_minimum_size(Size2i(36 * EDSCALE)); b->set_icon_alignment(HORIZONTAL_ALIGNMENT_CENTER); b->set_tooltip_text(p_name); b->set_flat(true); @@ -559,7 +559,7 @@ void ControlEditorPresetPicker::_add_row_button(HBoxContainer *p_row, const int void ControlEditorPresetPicker::_add_separator(BoxContainer *p_box, Separator *p_separator) { p_separator->add_theme_constant_override("separation", grid_separation); - p_separator->set_custom_minimum_size(Size2i(1, 1)); + p_separator->set_custom_minimum_size(Size2i(1)); p_box->add_child(p_separator); } diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index 180de700b7ba..e31b601b18d7 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -106,7 +106,7 @@ void CurveEdit::set_snap_count(int p_snap_count) { } Size2 CurveEdit::get_minimum_size() const { - return Vector2(64, MAX(135, get_size().x * ASPECT_RATIO)) * EDSCALE; + return Size2(64, MAX(135, get_size().x * ASPECT_RATIO)) * EDSCALE; } void CurveEdit::_notification(int p_what) { @@ -417,7 +417,7 @@ int CurveEdit::get_point_at(Vector2 p_pos) const { } // Use a square-shaped hover region. If hovering multiple points, pick the closer one. - const Rect2 hover_rect = Rect2(p_pos, Vector2(0, 0)).grow(hover_radius); + const Rect2 hover_rect = Rect2(p_pos, Size2()).grow(hover_radius); int closest_idx = -1; float closest_dist_squared = hover_radius * hover_radius * 2; @@ -437,7 +437,7 @@ CurveEdit::TangentIndex CurveEdit::get_tangent_at(Vector2 p_pos) const { return TANGENT_NONE; } - const Rect2 hover_rect = Rect2(p_pos, Vector2(0, 0)).grow(tangent_hover_radius); + const Rect2 hover_rect = Rect2(p_pos, Size2()).grow(tangent_hover_radius); if (selected_index != 0) { Vector2 control_pos = get_tangent_view_pos(selected_index, TANGENT_LEFT); @@ -667,7 +667,7 @@ void CurveEdit::update_view_transform() { Transform2D world_trans; world_trans.translate_local(-world_rect.position - Vector2(0, world_rect.size.y)); - world_trans.scale(Vector2(scale.x, -scale.y)); + world_trans.scale(Size2(scale.x, -scale.y)); Transform2D view_trans; view_trans.translate_local(view_margin); @@ -722,7 +722,7 @@ static void plot_curve_accurate(const Curve &curve, float step, Vector2 scaling, // Not enough points to make a curve, so it's just a straight line. // The added tiny vectors make the drawn line stay exactly within the bounds in practice. float y = curve.sample(0); - plot_func(Vector2(0, y) * scaling + Vector2(0.5, 0), Vector2(1.f, y) * scaling - Vector2(1.5, 0), true); + plot_func(Vector2(0, y) * scaling + Vector2(0.5, 0), Vector2(1, y) * scaling - Vector2(1.5, 0), true); } else { Vector2 first_point = curve.get_point_position(0); @@ -796,19 +796,19 @@ void CurveEdit::_redraw() { const Vector2i grid_steps = Vector2i(4, 2); const Vector2 step_size = Vector2(1, curve->get_range()) / grid_steps; - draw_line(Vector2(min_edge.x, curve->get_min_value()), Vector2(max_edge.x, curve->get_min_value()), grid_color_primary); - draw_line(Vector2(max_edge.x, curve->get_max_value()), Vector2(min_edge.x, curve->get_max_value()), grid_color_primary); - draw_line(Vector2(0, min_edge.y), Vector2(0, max_edge.y), grid_color_primary); - draw_line(Vector2(1, max_edge.y), Vector2(1, min_edge.y), grid_color_primary); + draw_line(Point2(min_edge.x, curve->get_min_value()), Point2(max_edge.x, curve->get_min_value()), grid_color_primary); + draw_line(Point2(max_edge.x, curve->get_max_value()), Point2(min_edge.x, curve->get_max_value()), grid_color_primary); + draw_line(Point2(0, min_edge.y), Point2(0, max_edge.y), grid_color_primary); + draw_line(Point2(1, max_edge.y), Point2(1, min_edge.y), grid_color_primary); for (int i = 1; i < grid_steps.x; i++) { real_t x = i * step_size.x; - draw_line(Vector2(x, min_edge.y), Vector2(x, max_edge.y), grid_color); + draw_line(Point2(x, min_edge.y), Point2(x, max_edge.y), grid_color); } for (int i = 1; i < grid_steps.y; i++) { real_t y = curve->get_min_value() + i * step_size.y; - draw_line(Vector2(min_edge.x, y), Vector2(max_edge.x, y), grid_color); + draw_line(Point2(min_edge.x, y), Point2(max_edge.x, y), grid_color); } // Draw number markings. @@ -821,7 +821,7 @@ void CurveEdit::_redraw() { for (int i = 0; i <= grid_steps.x; ++i) { real_t x = i * step_size.x; - draw_string(font, get_view_pos(Vector2(x - step_size.x / 2, curve->get_min_value())) + Vector2(0, font_height - Math::round(2 * EDSCALE)), String::num(x, 2), HORIZONTAL_ALIGNMENT_CENTER, get_view_pos(Vector2(step_size.x, 0)).x, font_size, text_color); + draw_string(font, get_view_pos(Point2(x - step_size.x / 2, curve->get_min_value())) + Point2(0, font_height - Math::round(2 * EDSCALE)), String::num(x, 2), HORIZONTAL_ALIGNMENT_CENTER, get_view_pos(Vector2(step_size.x, 0)).x, font_size, text_color); } for (int i = 0; i <= grid_steps.y; ++i) { @@ -833,7 +833,7 @@ void CurveEdit::_redraw() { // An unusual transform so we can offset the curve before scaling it up, allowing the curve to be antialiased. // The scaling up ensures that the curve rendering doesn't break when we use a quad line to draw it. - draw_set_transform_matrix(Transform2D(0, get_view_pos(Vector2(0, 0)))); + draw_set_transform_matrix(Transform2D(0, get_view_pos(Vector2()))); const Color line_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor)); const Color edge_line_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor)) * Color(1, 1, 1, 0.75); @@ -851,10 +851,10 @@ void CurveEdit::_redraw() { for (int i = 0; i < curve->get_point_count(); ++i) { Vector2 pos = get_view_pos(curve->get_point_position(i)); if (selected_index != i) { - draw_rect(Rect2(pos, Vector2(0, 0)).grow(point_radius), point_color); + draw_rect(Rect2(pos, Size2()).grow(point_radius), point_color); } if (hovered_index == i && hovered_tangent_index == TANGENT_NONE) { - draw_rect(Rect2(pos, Vector2(0, 0)).grow(hover_radius - Math::round(3 * EDSCALE)), line_color, false, Math::round(1 * EDSCALE)); + draw_rect(Rect2(pos, Size2()).grow(hover_radius - Math::round(3 * EDSCALE)), line_color, false, Math::round(1 * EDSCALE)); } } @@ -870,7 +870,7 @@ void CurveEdit::_redraw() { const Color tangent_color = get_theme_color(SceneStringName(font_color), EditorStringName(Editor)).darkened(0.25); if (selected_index != 0) { - Vector2 control_pos = get_tangent_view_pos(selected_index, TANGENT_LEFT); + Point2 control_pos = get_tangent_view_pos(selected_index, TANGENT_LEFT); Color left_tangent_color = (selected_tangent_index == TANGENT_LEFT) ? selected_tangent_color : tangent_color; draw_line(get_view_pos(point_pos), control_pos, left_tangent_color, 0.5 * EDSCALE, true); @@ -878,16 +878,16 @@ void CurveEdit::_redraw() { if (curve->get_point_left_mode(selected_index) == Curve::TANGENT_FREE) { draw_circle(control_pos, tangent_radius, left_tangent_color); } else { - draw_rect(Rect2(control_pos, Vector2(0, 0)).grow(tangent_radius), left_tangent_color); + draw_rect(Rect2(control_pos, Size2()).grow(tangent_radius), left_tangent_color); } // Hover indicator. if (hovered_tangent_index == TANGENT_LEFT || (hovered_tangent_index == TANGENT_RIGHT && !shift_pressed && curve->get_point_left_mode(selected_index) != Curve::TANGENT_LINEAR)) { - draw_rect(Rect2(control_pos, Vector2(0, 0)).grow(tangent_hover_radius - Math::round(3 * EDSCALE)), tangent_color, false, Math::round(1 * EDSCALE)); + draw_rect(Rect2(control_pos, Size2()).grow(tangent_hover_radius - Math::round(3 * EDSCALE)), tangent_color, false, Math::round(1 * EDSCALE)); } } if (selected_index != curve->get_point_count() - 1) { - Vector2 control_pos = get_tangent_view_pos(selected_index, TANGENT_RIGHT); + Point2 control_pos = get_tangent_view_pos(selected_index, TANGENT_RIGHT); Color right_tangent_color = (selected_tangent_index == TANGENT_RIGHT) ? selected_tangent_color : tangent_color; draw_line(get_view_pos(point_pos), control_pos, right_tangent_color, 0.5 * EDSCALE, true); @@ -895,16 +895,16 @@ void CurveEdit::_redraw() { if (curve->get_point_right_mode(selected_index) == Curve::TANGENT_FREE) { draw_circle(control_pos, tangent_radius, right_tangent_color); } else { - draw_rect(Rect2(control_pos, Vector2(0, 0)).grow(tangent_radius), right_tangent_color); + draw_rect(Rect2(control_pos, Size2()).grow(tangent_radius), right_tangent_color); } // Hover indicator. if (hovered_tangent_index == TANGENT_RIGHT || (hovered_tangent_index == TANGENT_LEFT && !shift_pressed && curve->get_point_right_mode(selected_index) != Curve::TANGENT_LINEAR)) { - draw_rect(Rect2(control_pos, Vector2(0, 0)).grow(tangent_hover_radius - Math::round(3 * EDSCALE)), tangent_color, false, Math::round(1 * EDSCALE)); + draw_rect(Rect2(control_pos, Size2()).grow(tangent_hover_radius - Math::round(3 * EDSCALE)), tangent_color, false, Math::round(1 * EDSCALE)); } } } - draw_rect(Rect2(get_view_pos(point_pos), Vector2(0, 0)).grow(point_radius), selected_point_color); + draw_rect(Rect2(get_view_pos(point_pos), Size2()).grow(point_radius), selected_point_color); } // Draw help text. @@ -913,21 +913,21 @@ void CurveEdit::_redraw() { float width = view_size.x - 50 * EDSCALE; text_color.a *= 0.4; - draw_multiline_string(font, Vector2(25 * EDSCALE, font_height - Math::round(2 * EDSCALE)), TTR("Hold Shift to edit tangents individually"), HORIZONTAL_ALIGNMENT_CENTER, width, font_size, -1, text_color); + draw_multiline_string(font, Point2(25 * EDSCALE, font_height - Math::round(2 * EDSCALE)), TTR("Hold Shift to edit tangents individually"), HORIZONTAL_ALIGNMENT_CENTER, width, font_size, -1, text_color); } else if (selected_index != -1 && selected_tangent_index == TANGENT_NONE) { const Vector2 point_pos = curve->get_point_position(selected_index); float width = view_size.x - 50 * EDSCALE; text_color.a *= 0.8; - draw_string(font, Vector2(25 * EDSCALE, font_height - Math::round(2 * EDSCALE)), vformat("(%.2f, %.2f)", point_pos.x, point_pos.y), HORIZONTAL_ALIGNMENT_CENTER, width, font_size, text_color); + draw_string(font, Point2(25 * EDSCALE, font_height - Math::round(2 * EDSCALE)), vformat("(%.2f, %.2f)", point_pos.x, point_pos.y), HORIZONTAL_ALIGNMENT_CENTER, width, font_size, text_color); } else if (selected_index != -1 && selected_tangent_index != TANGENT_NONE) { float width = view_size.x - 50 * EDSCALE; text_color.a *= 0.8; real_t theta = Math::rad_to_deg(Math::atan(selected_tangent_index == TANGENT_LEFT ? -1 * curve->get_point_left_tangent(selected_index) : curve->get_point_right_tangent(selected_index))); - draw_string(font, Vector2(25 * EDSCALE, font_height - Math::round(2 * EDSCALE)), String::num(theta, 1) + String::utf8(" °"), HORIZONTAL_ALIGNMENT_CENTER, width, font_size, text_color); + draw_string(font, Point2(25 * EDSCALE, font_height - Math::round(2 * EDSCALE)), String::num(theta, 1) + String::utf8(" °"), HORIZONTAL_ALIGNMENT_CENTER, width, font_size, text_color); } // Draw temporary constraints and snapping axes. @@ -937,13 +937,13 @@ void CurveEdit::_redraw() { float prev_point_offset = (selected_index > 0) ? curve->get_point_position(selected_index - 1).x : 0.0; float next_point_offset = (selected_index < curve->get_point_count() - 1) ? curve->get_point_position(selected_index + 1).x : 1.0; - draw_line(Vector2(prev_point_offset, curve->get_min_value()), Vector2(prev_point_offset, curve->get_max_value()), Color(point_color, 0.6)); - draw_line(Vector2(next_point_offset, curve->get_min_value()), Vector2(next_point_offset, curve->get_max_value()), Color(point_color, 0.6)); + draw_line(Point2(prev_point_offset, curve->get_min_value()), Point2(prev_point_offset, curve->get_max_value()), Color(point_color, 0.6)); + draw_line(Point2(next_point_offset, curve->get_min_value()), Point2(next_point_offset, curve->get_max_value()), Color(point_color, 0.6)); } if (shift_pressed && grabbing != GRAB_NONE && selected_tangent_index == TANGENT_NONE) { - draw_line(Vector2(initial_grab_pos.x, curve->get_min_value()), Vector2(initial_grab_pos.x, curve->get_max_value()), get_theme_color(SNAME("axis_x_color"), EditorStringName(Editor)).darkened(0.4)); - draw_line(Vector2(0, initial_grab_pos.y), Vector2(1, initial_grab_pos.y), get_theme_color(SNAME("axis_y_color"), EditorStringName(Editor)).darkened(0.4)); + draw_line(Point2(initial_grab_pos.x, curve->get_min_value()), Point2(initial_grab_pos.x, curve->get_max_value()), get_theme_color(SNAME("axis_x_color"), EditorStringName(Editor)).darkened(0.4)); + draw_line(Point2(0, initial_grab_pos.y), Point2(1, initial_grab_pos.y), get_theme_color(SNAME("axis_y_color"), EditorStringName(Editor)).darkened(0.4)); } } @@ -1027,7 +1027,7 @@ CurveEditor::CurveEditor() { // Some empty space below. Not a part of the curve editor so it can't draw in it. Control *empty_space = memnew(Control); - empty_space->set_custom_minimum_size(Vector2(0, spacing)); + empty_space->set_custom_minimum_size(Size2(0, spacing)); add_child(empty_space); set_mouse_filter(MOUSE_FILTER_STOP); diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 7ac924571d36..9eaf9718a92b 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -127,14 +127,14 @@ Ref EditorTexturePreviewPlugin::generate(const Ref &p_from, img->convert(Image::FORMAT_RGBA8); } - Vector2 new_size = img->get_size(); + Size2 new_size = img->get_size(); if (new_size.x > p_size.x) { - new_size = Vector2(p_size.x, new_size.y * p_size.x / new_size.x); + new_size = Size2(p_size.x, new_size.y * p_size.x / new_size.x); } if (new_size.y > p_size.y) { - new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y); + new_size = Size2(new_size.x * p_size.y / new_size.y, p_size.y); } - Vector2i new_size_i = Vector2i(new_size).maxi(1); + Size2i new_size_i = Size2i(new_size).maxi(1); img->resize(new_size_i.x, new_size_i.y, Image::INTERPOLATE_CUBIC); post_process_preview(img); @@ -168,12 +168,12 @@ Ref EditorImagePreviewPlugin::generate(const Ref &p_from, c img->convert(Image::FORMAT_RGBA8); } - Vector2 new_size = img->get_size(); + Size2 new_size = img->get_size(); if (new_size.x > p_size.x) { - new_size = Vector2(p_size.x, new_size.y * p_size.x / new_size.x); + new_size = Size2(p_size.x, new_size.y * p_size.x / new_size.x); } if (new_size.y > p_size.y) { - new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y); + new_size = Size2(new_size.x * p_size.y / new_size.y, p_size.y); } img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC); post_process_preview(img); @@ -229,12 +229,12 @@ Ref EditorBitmapPreviewPlugin::generate(const Ref &p_from, img->convert(Image::FORMAT_RGBA8); } - Vector2 new_size = img->get_size(); + Size2 new_size = img->get_size(); if (new_size.x > p_size.x) { - new_size = Vector2(p_size.x, new_size.y * p_size.x / new_size.x); + new_size = Size2(p_size.x, new_size.y * p_size.x / new_size.x); } if (new_size.y > p_size.y) { - new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y); + new_size = Size2(new_size.x * p_size.y / new_size.y, p_size.y); } img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC); post_process_preview(img); @@ -406,7 +406,7 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() { Vector2 uv(Math::atan2(v[m_idx].x, v[m_idx].z), Math::atan2(-v[m_idx].y, v[m_idx].z)); \ uv /= Math_PI; \ uv *= 4.0; \ - uv = uv * 0.5 + Vector2(0.5, 0.5); \ + uv = uv * 0.5 + Vector2(0.5); \ uvs.push_back(uv); \ } \ { \ @@ -736,12 +736,12 @@ Ref EditorMeshPreviewPlugin::generate(const Ref &p_from, co img->convert(Image::FORMAT_RGBA8); - Vector2 new_size = img->get_size(); + Size2 new_size = img->get_size(); if (new_size.x > p_size.x) { - new_size = Vector2(p_size.x, new_size.y * p_size.x / new_size.x); + new_size = Size2(p_size.x, new_size.y * p_size.x / new_size.x); } if (new_size.y > p_size.y) { - new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y); + new_size = Size2(new_size.x * p_size.y / new_size.y, p_size.y); } img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC); post_process_preview(img); @@ -846,12 +846,12 @@ Ref EditorFontPreviewPlugin::generate_from_path(const String &p_path, img->convert(Image::FORMAT_RGBA8); - Vector2 new_size = img->get_size(); + Size2 new_size = img->get_size(); if (new_size.x > p_size.x) { - new_size = Vector2(p_size.x, new_size.y * p_size.x / new_size.x); + new_size = Size2(p_size.x, new_size.y * p_size.x / new_size.x); } if (new_size.y > p_size.y) { - new_size = Vector2(new_size.x * p_size.y / new_size.y, p_size.y); + new_size = Size2(new_size.x * p_size.y / new_size.y, p_size.y); } img->resize(new_size.x, new_size.y, Image::INTERPOLATE_CUBIC); post_process_preview(img); diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp index e6ce63fe36b8..bedfdc49f409 100644 --- a/editor/plugins/font_config_plugin.cpp +++ b/editor/plugins/font_config_plugin.cpp @@ -962,7 +962,7 @@ void FontPreview::_notification(int p_what) { void FontPreview::_bind_methods() {} Size2 FontPreview::get_minimum_size() const { - return Vector2(64, 64) * EDSCALE; + return Size2(64 * EDSCALE); } void FontPreview::set_data(const Ref &p_f) { diff --git a/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp index 01492c1dd040..c15a9022ee18 100644 --- a/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/collision_shape_3d_gizmo_plugin.cpp @@ -358,8 +358,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i <= 360; i++) { float ra = Math::deg_to_rad((float)i); float rb = Math::deg_to_rad((float)i + 1); - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * r; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * r; points.push_back(Vector3(a.x, 0, a.y)); points.push_back(Vector3(b.x, 0, b.y)); @@ -374,8 +374,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i < 64; i++) { float ra = i * (Math_TAU / 64.0); float rb = (i + 1) * (Math_TAU / 64.0); - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * r; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * r; collision_segments.push_back(Vector3(a.x, 0, a.y)); collision_segments.push_back(Vector3(b.x, 0, b.y)); @@ -424,8 +424,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i < 360; i++) { float ra = Math::deg_to_rad((float)i); float rb = Math::deg_to_rad((float)i + 1); - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * radius; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * radius; points.push_back(Vector3(a.x, 0, a.y) + d); points.push_back(Vector3(b.x, 0, b.y) + d); @@ -453,8 +453,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i < 64; i++) { float ra = i * (Math_TAU / 64.0); float rb = (i + 1) * (Math_TAU / 64.0); - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * radius; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * radius; collision_segments.push_back(Vector3(a.x, 0, a.y) + d); collision_segments.push_back(Vector3(b.x, 0, b.y) + d); @@ -495,8 +495,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i < 360; i++) { float ra = Math::deg_to_rad((float)i); float rb = Math::deg_to_rad((float)i + 1); - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * radius; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * radius; points.push_back(Vector3(a.x, 0, a.y) + d); points.push_back(Vector3(b.x, 0, b.y) + d); @@ -517,8 +517,8 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i < 64; i++) { float ra = i * (Math_TAU / 64.0); float rb = (i + 1) * (Math_TAU / 64.0); - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * radius; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * radius; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * radius; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * radius; collision_segments.push_back(Vector3(a.x, 0, a.y) + d); collision_segments.push_back(Vector3(b.x, 0, b.y) + d); diff --git a/editor/plugins/gizmos/gpu_particles_collision_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/gpu_particles_collision_3d_gizmo_plugin.cpp index 6f20a5345913..6d8990dbbfc1 100644 --- a/editor/plugins/gizmos/gpu_particles_collision_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/gpu_particles_collision_3d_gizmo_plugin.cpp @@ -175,8 +175,8 @@ void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i <= 360; i++) { float ra = Math::deg_to_rad((float)i); float rb = Math::deg_to_rad((float)i + 1); - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * r; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * r; points.push_back(Vector3(a.x, 0, a.y)); points.push_back(Vector3(b.x, 0, b.y)); @@ -191,8 +191,8 @@ void GPUParticlesCollision3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i < 64; i++) { float ra = i * (Math_TAU / 64.0); float rb = (i + 1) * (Math_TAU / 64.0); - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * r; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * r; collision_segments.push_back(Vector3(a.x, 0, a.y)); collision_segments.push_back(Vector3(b.x, 0, b.y)); diff --git a/editor/plugins/gizmos/joint_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/joint_3d_gizmo_plugin.cpp index ae24b4250e17..8f3d02349077 100644 --- a/editor/plugins/gizmos/joint_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/joint_3d_gizmo_plugin.cpp @@ -244,8 +244,8 @@ void JointGizmosDrawer::draw_cone(const Transform3D &p_offset, const Basis &p_ba for (int i = 0; i < 360; i += 10) { float ra = Math::deg_to_rad((float)i); float rb = Math::deg_to_rad((float)i + 10); - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * w; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * w; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * w; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * w; r_points.push_back(p_offset.translated_local(p_base.xform(Vector3(d, a.x, a.y))).origin); r_points.push_back(p_offset.translated_local(p_base.xform(Vector3(d, b.x, b.y))).origin); @@ -268,8 +268,8 @@ void JointGizmosDrawer::draw_cone(const Transform3D &p_offset, const Basis &p_ba float rb = Math::deg_to_rad((float)i + 5); float c = i / 720.0; float cn = (i + 5) / 720.0; - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * w * c; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * w * cn; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * w * c; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * w * cn; r_points.push_back(p_offset.translated_local(p_base.xform(Vector3(c, a.x, a.y))).origin); r_points.push_back(p_offset.translated_local(p_base.xform(Vector3(cn, b.x, b.y))).origin); diff --git a/editor/plugins/gizmos/light_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/light_3d_gizmo_plugin.cpp index 967f8a65ceeb..e98dedeaaefa 100644 --- a/editor/plugins/gizmos/light_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/light_3d_gizmo_plugin.cpp @@ -213,8 +213,8 @@ void Light3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { // Create a circle const float ra = Math::deg_to_rad((float)(i * 3)); const float rb = Math::deg_to_rad((float)((i + 1) * 3)); - const Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; - const Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; + const Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * r; + const Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * r; // Draw axis-aligned circles points.push_back(Vector3(a.x, 0, a.y)); @@ -258,8 +258,8 @@ void Light3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { // Draw a circle const float ra = Math::deg_to_rad((float)(i * 3)); const float rb = Math::deg_to_rad((float)((i + 1) * 3)); - const Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * w; - const Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * w; + const Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * w; + const Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * w; points_primary.push_back(Vector3(a.x, a.y, -d)); points_primary.push_back(Vector3(b.x, b.y, -d)); diff --git a/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp index 51d15a0a70f7..9c9b739f3425 100644 --- a/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/navigation_link_3d_gizmo_plugin.cpp @@ -80,8 +80,8 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { // Create a circle const float ra = Math::deg_to_rad((float)(i * 12)); const float rb = Math::deg_to_rad((float)((i + 1) * 12)); - const Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * search_radius; - const Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * search_radius; + const Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * search_radius; + const Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * search_radius; // Draw axis-aligned circle switch (up_axis) { @@ -105,8 +105,8 @@ void NavigationLink3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { // Create a circle const float ra = Math::deg_to_rad((float)(i * 12)); const float rb = Math::deg_to_rad((float)((i + 1) * 12)); - const Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * search_radius; - const Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * search_radius; + const Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * search_radius; + const Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * search_radius; // Draw axis-aligned circle switch (up_axis) { diff --git a/editor/plugins/gizmos/vehicle_body_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/vehicle_body_3d_gizmo_plugin.cpp index 1015e46965c5..9599a3e7db0f 100644 --- a/editor/plugins/gizmos/vehicle_body_3d_gizmo_plugin.cpp +++ b/editor/plugins/gizmos/vehicle_body_3d_gizmo_plugin.cpp @@ -63,8 +63,8 @@ void VehicleWheel3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) { for (int i = 0; i <= 360; i += skip) { float ra = Math::deg_to_rad((float)i); float rb = Math::deg_to_rad((float)i + skip); - Point2 a = Vector2(Math::sin(ra), Math::cos(ra)) * r; - Point2 b = Vector2(Math::sin(rb), Math::cos(rb)) * r; + Point2 a = Point2(Math::sin(ra), Math::cos(ra)) * r; + Point2 b = Point2(Math::sin(rb), Math::cos(rb)) * r; points.push_back(Vector3(0, a.x, a.y)); points.push_back(Vector3(0, b.x, b.y)); diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp index 8bf5dad97fd2..b9628f980bcc 100644 --- a/editor/plugins/gradient_editor_plugin.cpp +++ b/editor/plugins/gradient_editor_plugin.cpp @@ -92,7 +92,7 @@ void GradientEdit::_show_color_picker() { bool show_above = get_global_position().y + get_size().y + minsize.y > viewport_height && get_global_position().y * 2 + get_size().y > viewport_height; float v_offset = show_above ? -minsize.y : get_size().y; - popup->set_position(get_screen_position() + Vector2(0, v_offset)); + popup->set_position(get_screen_position() + Point2(0, v_offset)); popup->popup(); } @@ -492,9 +492,9 @@ void GradientEdit::_redraw() { if (selected_index == i) { // Handle is selected. draw_rect(rect, border_col, false, handle_thickness); - draw_line(Vector2(handle_x_pos, 0), Vector2(handle_x_pos, h / 2 - handle_thickness), border_col, handle_thickness); + draw_line(Point2(handle_x_pos, 0), Point2(handle_x_pos, h / 2 - handle_thickness), border_col, handle_thickness); if (inside_col.a < 1) { - draw_line(Vector2(handle_start_x + handle_thickness / 2.0, h * 0.9 - handle_thickness), Vector2(handle_start_x + handle_width - handle_thickness / 2.0, h * 0.9 - handle_thickness), border_col, handle_thickness); + draw_line(Point2(handle_start_x + handle_thickness / 2.0, h * 0.9 - handle_thickness), Point2(handle_start_x + handle_width - handle_thickness / 2.0, h * 0.9 - handle_thickness), border_col, handle_thickness); } rect = rect.grow(-handle_thickness); const Color focus_col = get_theme_color(SNAME("accent_color"), EditorStringName(Editor)); @@ -505,9 +505,9 @@ void GradientEdit::_redraw() { // Handle isn't selected. border_col.a = 0.9; draw_rect(rect, border_col, false, handle_thickness); - draw_line(Vector2(handle_x_pos, 0), Vector2(handle_x_pos, h / 2 - handle_thickness), border_col, handle_thickness); + draw_line(Point2(handle_x_pos, 0), Point2(handle_x_pos, h / 2 - handle_thickness), border_col, handle_thickness); if (inside_col.a < 1) { - draw_line(Vector2(handle_start_x + handle_thickness / 2.0, h * 0.9 - handle_thickness), Vector2(handle_start_x + handle_width - handle_thickness / 2.0, h * 0.9 - handle_thickness), border_col, handle_thickness); + draw_line(Point2(handle_start_x + handle_thickness / 2.0, h * 0.9 - handle_thickness), Point2(handle_start_x + handle_width - handle_thickness / 2.0, h * 0.9 - handle_thickness), border_col, handle_thickness); } if (hovered_index == i) { // Draw a subtle translucent rect inside the handle if it's being hovered. @@ -533,8 +533,8 @@ void GradientEdit::_redraw() { } else { // If no color is selected, draw gray color with 'X' on top. draw_rect(Rect2(button_offset, 0, h, h), Color(0.5, 0.5, 0.5, 1)); - draw_line(Vector2(button_offset, 0), Vector2(button_offset + h, h), Color(0.8, 0.8, 0.8)); - draw_line(Vector2(button_offset, h), Vector2(button_offset + h, 0), Color(0.8, 0.8, 0.8)); + draw_line(Point2(button_offset, 0), Point2(button_offset + h, h), Color(0.8, 0.8, 0.8)); + draw_line(Point2(button_offset, h), Point2(button_offset + h, 0), Color(0.8, 0.8, 0.8)); } } @@ -567,7 +567,7 @@ void GradientEdit::_bind_methods() { GradientEdit::GradientEdit() { set_focus_mode(FOCUS_ALL); - set_custom_minimum_size(Size2(0, 60) * EDSCALE); + set_custom_minimum_size(Size2(0, 60 * EDSCALE)); picker = memnew(ColorPicker); int picker_shape = EDITOR_GET("interface/inspector/default_color_picker_shape"); diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index 602e6f945c30..54ce6ed0742e 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -171,7 +171,7 @@ MaterialEditor::MaterialEditor() { rect_instance = memnew(ColorRect); layout_2d->add_child(rect_instance); - rect_instance->set_custom_minimum_size(Size2(150, 150) * EDSCALE); + rect_instance->set_custom_minimum_size(Size2(150 * EDSCALE)); layout_2d->set_visible(false); @@ -228,7 +228,7 @@ MaterialEditor::MaterialEditor() { box_mesh.instantiate(); box_instance->set_mesh(box_mesh); - set_custom_minimum_size(Size2(1, 150) * EDSCALE); + set_custom_minimum_size(Size2(1, 150 * EDSCALE)); layout_3d = memnew(HBoxContainer); add_child(layout_3d); diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index c8eda600b845..39bbb4064f48 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -134,7 +134,7 @@ MeshEditor::MeshEditor() { mesh_instance = memnew(MeshInstance3D); rotation->add_child(mesh_instance); - set_custom_minimum_size(Size2(1, 150) * EDSCALE); + set_custom_minimum_size(Size2(1, 150 * EDSCALE)); HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index 4ebacbd0b37e..9fdccf81c1b9 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -239,7 +239,7 @@ void MeshInstance3DEditor::_menu_option(int p_option) { } break; case MENU_OPTION_CREATE_OUTLINE_MESH: { - outline_dialog->popup_centered(Vector2(200, 90)); + outline_dialog->popup_centered(Point2(200, 90)); } break; case MENU_OPTION_CREATE_DEBUG_TANGENTS: { EditorUndoRedoManager *ur = EditorUndoRedoManager::get_singleton(); @@ -466,8 +466,8 @@ void MeshInstance3DEditor::_debug_uv_draw() { } debug_uv->set_clip_contents(true); - debug_uv->draw_rect(Rect2(Vector2(), debug_uv->get_size()), get_theme_color(SNAME("dark_color_3"), EditorStringName(Editor))); - debug_uv->draw_set_transform(Vector2(), 0, debug_uv->get_size()); + debug_uv->draw_rect(Rect2(Point2(), debug_uv->get_size()), get_theme_color(SNAME("dark_color_3"), EditorStringName(Editor))); + debug_uv->draw_set_transform(Point2(), 0, debug_uv->get_size()); // Use a translucent color to allow overlapping triangles to be visible. debug_uv->draw_multiline(uv_lines, get_theme_color(SNAME("mono_color"), EditorStringName(Editor)) * Color(1, 1, 1, 0.5)); } @@ -605,7 +605,7 @@ MeshInstance3DEditor::MeshInstance3DEditor() { debug_uv_dialog->set_title(TTR("UV Channel Debug")); add_child(debug_uv_dialog); debug_uv = memnew(Control); - debug_uv->set_custom_minimum_size(Size2(600, 600) * EDSCALE); + debug_uv->set_custom_minimum_size(Size2(600 * EDSCALE)); debug_uv->connect(SceneStringName(draw), callable_mp(this, &MeshInstance3DEditor::_debug_uv_draw)); debug_uv_dialog->add_child(debug_uv); } diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 0b2549986c9e..6ad69730b49c 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -261,7 +261,7 @@ MeshLibraryEditor::MeshLibraryEditor() { menu = memnew(MenuButton); Node3DEditor::get_singleton()->add_control_to_menu_panel(menu); - menu->set_position(Point2(1, 1)); + menu->set_position(Point2(1)); menu->set_text(TTR("MeshLibrary")); menu->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MeshLibrary"), EditorStringName(EditorIcons))); menu->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM); diff --git a/editor/plugins/node_3d_editor_gizmos.cpp b/editor/plugins/node_3d_editor_gizmos.cpp index 9c07b664341c..97846589e865 100644 --- a/editor/plugins/node_3d_editor_gizmos.cpp +++ b/editor/plugins/node_3d_editor_gizmos.cpp @@ -339,9 +339,9 @@ void EditorNode3DGizmo::add_unscaled_billboard(const Ref &p_material, }; Vector uv = { - Vector2(0, 0), + Vector2(), Vector2(1, 0), - Vector2(1, 1), + Vector2(1), Vector2(0, 1) }; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 6ee3c043bf16..f36abf69cf21 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -3119,7 +3119,7 @@ void Node3DEditorViewport::_notification(int p_what) { // when numbers vary rapidly. This minimum width is set based on a // GPU time of 999.99 ms in the current editor language. const float min_width = get_theme_font(SNAME("main"), EditorStringName(EditorFonts))->get_string_size(vformat(TTR("GPU Time: %s ms"), 999.99)).x; - frame_time_panel->set_custom_minimum_size(Size2(min_width, 0) * EDSCALE); + frame_time_panel->set_custom_minimum_size(Size2(min_width * EDSCALE, 0)); frame_time_vbox->add_theme_constant_override("separation", Math::round(-1 * EDSCALE)); cinema_label->add_theme_style_override(CoreStringName(normal), information_3d_stylebox); @@ -3153,13 +3153,13 @@ static void draw_indicator_bar(Control &p_surface, real_t p_fill, const Refget_size(); - const Vector2 icon_pos = Vector2(r.position.x - (icon_size.x - r.size.x) / 2, r.position.y + r.size.y + 2 * EDSCALE); + const Size2 icon_size = p_icon->get_size(); + const Point2 icon_pos = Point2(r.position.x - (icon_size.x - r.size.x) / 2, r.position.y + r.size.y + 2 * EDSCALE); p_surface.draw_texture(p_icon, icon_pos, p_color); // Draw text below the bar (for speed/zoom information). - p_surface.draw_string_outline(p_font, Vector2(icon_pos.x, icon_pos.y + icon_size.y + 16 * EDSCALE), p_text, HORIZONTAL_ALIGNMENT_LEFT, -1.f, p_font_size, Math::round(2 * EDSCALE), Color(0, 0, 0)); - p_surface.draw_string(p_font, Vector2(icon_pos.x, icon_pos.y + icon_size.y + 16 * EDSCALE), p_text, HORIZONTAL_ALIGNMENT_LEFT, -1.f, p_font_size, p_color); + p_surface.draw_string_outline(p_font, Point2(icon_pos.x, icon_pos.y + icon_size.y + 16 * EDSCALE), p_text, HORIZONTAL_ALIGNMENT_LEFT, -1.f, p_font_size, Math::round(2 * EDSCALE), Color(0, 0, 0)); + p_surface.draw_string(p_font, Point2(icon_pos.x, icon_pos.y + icon_size.y + 16 * EDSCALE), p_text, HORIZONTAL_ALIGNMENT_LEFT, -1.f, p_font_size, p_color); } void Node3DEditorViewport::_draw() { @@ -3199,9 +3199,9 @@ void Node3DEditorViewport::_draw() { Ref font = get_theme_font(SceneStringName(font), SNAME("Label")); int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label")); Point2 msgpos = Point2(5, get_size().y - 20); - font->draw_string(ci, msgpos + Point2(1, 1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); - font->draw_string(ci, msgpos + Point2(-1, -1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); - font->draw_string(ci, msgpos, message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 1)); + font->draw_string(ci, msgpos + Point2(1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); + font->draw_string(ci, msgpos + Point2(-1), message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); + font->draw_string(ci, msgpos, message, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1)); } if (_edit.mode == TRANSFORM_ROTATE && _edit.show_rotation_line) { @@ -3253,7 +3253,7 @@ void Node3DEditorViewport::_draw() { } break; } - draw_rect = Rect2(Vector2(), s).intersection(draw_rect); + draw_rect = Rect2(Point2(), s).intersection(draw_rect); surface->draw_rect(draw_rect, Color(0.6, 0.6, 0.1, 0.5), false, Math::round(2 * EDSCALE)); @@ -5497,7 +5497,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p position_control = memnew(ViewportNavigationControl); 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_custom_minimum_size(Size2(navigation_control_size * EDSCALE)); position_control->set_h_size_flags(SIZE_SHRINK_END); 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); @@ -5508,7 +5508,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p look_control = memnew(ViewportNavigationControl); look_control->set_navigation_mode(Node3DEditorViewport::NAVIGATION_LOOK); - look_control->set_custom_minimum_size(Size2(navigation_control_size, navigation_control_size) * EDSCALE); + look_control->set_custom_minimum_size(Size2(navigation_control_size * EDSCALE)); 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); @@ -5518,7 +5518,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p surface->add_child(look_control); rotation_control = memnew(ViewportRotationControl); - rotation_control->set_custom_minimum_size(Size2(80, 80) * EDSCALE); + rotation_control->set_custom_minimum_size(Size2(80 * EDSCALE)); rotation_control->set_h_size_flags(SIZE_SHRINK_END); rotation_control->set_viewport(this); top_right_vbox->add_child(rotation_control); @@ -5550,7 +5550,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p selection_menu = memnew(PopupMenu); add_child(selection_menu); - selection_menu->set_min_size(Size2(100, 0) * EDSCALE); + selection_menu->set_min_size(Size2(100 * EDSCALE, 0)); selection_menu->connect(SceneStringName(id_pressed), callable_mp(this, &Node3DEditorViewport::_selection_result_pressed)); selection_menu->connect("popup_hide", callable_mp(this, &Node3DEditorViewport::_selection_menu_hide)); @@ -5694,37 +5694,37 @@ void Node3DEditorViewportContainer::_notification(int p_what) { } break; case VIEW_USE_2_VIEWPORTS: { - draw_texture(v_grabber, Vector2((size.width - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2)); + draw_texture(v_grabber, Point2((size.width - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2)); set_default_cursor_shape(CURSOR_VSPLIT); } break; case VIEW_USE_2_VIEWPORTS_ALT: { - draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, (size.height - h_grabber->get_height()) / 2)); + draw_texture(h_grabber, Point2(mid_w - h_grabber->get_width() / 2, (size.height - h_grabber->get_height()) / 2)); set_default_cursor_shape(CURSOR_HSPLIT); } break; case VIEW_USE_3_VIEWPORTS: { if ((hovering_v && hovering_h && !dragging_v && !dragging_h) || (dragging_v && dragging_h)) { - draw_texture(hdiag_grabber, Vector2(mid_w - hdiag_grabber->get_width() / 2, mid_h - v_grabber->get_height() / 4)); + draw_texture(hdiag_grabber, Point2(mid_w - hdiag_grabber->get_width() / 2, mid_h - v_grabber->get_height() / 4)); set_default_cursor_shape(CURSOR_DRAG); } else if ((hovering_v && !dragging_h) || dragging_v) { - draw_texture(v_grabber, Vector2((size.width - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2)); + draw_texture(v_grabber, Point2((size.width - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2)); set_default_cursor_shape(CURSOR_VSPLIT); } else if (hovering_h || dragging_h) { - draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, mid_h + v_grabber->get_height() / 2 + (size_bottom - h_grabber->get_height()) / 2)); + draw_texture(h_grabber, Point2(mid_w - h_grabber->get_width() / 2, mid_h + v_grabber->get_height() / 2 + (size_bottom - h_grabber->get_height()) / 2)); set_default_cursor_shape(CURSOR_HSPLIT); } } break; case VIEW_USE_3_VIEWPORTS_ALT: { if ((hovering_v && hovering_h && !dragging_v && !dragging_h) || (dragging_v && dragging_h)) { - draw_texture(vdiag_grabber, Vector2(mid_w - vdiag_grabber->get_width() + v_grabber->get_height() / 4, mid_h - vdiag_grabber->get_height() / 2)); + draw_texture(vdiag_grabber, Point2(mid_w - vdiag_grabber->get_width() + v_grabber->get_height() / 4, mid_h - vdiag_grabber->get_height() / 2)); set_default_cursor_shape(CURSOR_DRAG); } else if ((hovering_v && !dragging_h) || dragging_v) { - draw_texture(v_grabber, Vector2((size_left - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2)); + draw_texture(v_grabber, Point2((size_left - v_grabber->get_width()) / 2, mid_h - v_grabber->get_height() / 2)); set_default_cursor_shape(CURSOR_VSPLIT); } else if (hovering_h || dragging_h) { - draw_texture(h_grabber, Vector2(mid_w - h_grabber->get_width() / 2, (size.height - h_grabber->get_height()) / 2)); + draw_texture(h_grabber, Point2(mid_w - h_grabber->get_width() / 2, (size.height - h_grabber->get_height()) / 2)); set_default_cursor_shape(CURSOR_HSPLIT); } @@ -5799,8 +5799,8 @@ void Node3DEditorViewportContainer::_notification(int p_what) { } } - fit_child_in_rect(viewports[0], Rect2(Vector2(), Vector2(size.width, size_top))); - fit_child_in_rect(viewports[2], Rect2(Vector2(0, mid_h + v_sep / 2), Vector2(size.width, size_bottom))); + fit_child_in_rect(viewports[0], Rect2(Point2(), Size2(size.width, size_top))); + fit_child_in_rect(viewports[2], Rect2(Point2(0, mid_h + v_sep / 2), Size2(size.width, size_bottom))); } break; case VIEW_USE_2_VIEWPORTS_ALT: { @@ -5811,8 +5811,8 @@ void Node3DEditorViewportContainer::_notification(int p_what) { viewports[i]->show(); } } - fit_child_in_rect(viewports[0], Rect2(Vector2(), Vector2(size_left, size.height))); - fit_child_in_rect(viewports[2], Rect2(Vector2(mid_w + h_sep / 2, 0), Vector2(size_right, size.height))); + fit_child_in_rect(viewports[0], Rect2(Point2(), Size2(size_left, size.height))); + fit_child_in_rect(viewports[2], Rect2(Point2(mid_w + h_sep / 2, 0), Size2(size_right, size.height))); } break; case VIEW_USE_3_VIEWPORTS: { @@ -5824,9 +5824,9 @@ void Node3DEditorViewportContainer::_notification(int p_what) { } } - fit_child_in_rect(viewports[0], Rect2(Vector2(), Vector2(size.width, size_top))); - fit_child_in_rect(viewports[2], Rect2(Vector2(0, mid_h + v_sep / 2), Vector2(size_left, size_bottom))); - fit_child_in_rect(viewports[3], Rect2(Vector2(mid_w + h_sep / 2, mid_h + v_sep / 2), Vector2(size_right, size_bottom))); + fit_child_in_rect(viewports[0], Rect2(Point2(), Size2(size.width, size_top))); + fit_child_in_rect(viewports[2], Rect2(Point2(0, mid_h + v_sep / 2), Size2(size_left, size_bottom))); + fit_child_in_rect(viewports[3], Rect2(Point2(mid_w + h_sep / 2, mid_h + v_sep / 2), Size2(size_right, size_bottom))); } break; case VIEW_USE_3_VIEWPORTS_ALT: { @@ -5838,9 +5838,9 @@ void Node3DEditorViewportContainer::_notification(int p_what) { } } - fit_child_in_rect(viewports[0], Rect2(Vector2(), Vector2(size_left, size_top))); - fit_child_in_rect(viewports[2], Rect2(Vector2(0, mid_h + v_sep / 2), Vector2(size_left, size_bottom))); - fit_child_in_rect(viewports[3], Rect2(Vector2(mid_w + h_sep / 2, 0), Vector2(size_right, size.height))); + fit_child_in_rect(viewports[0], Rect2(Point2(), Size2(size_left, size_top))); + fit_child_in_rect(viewports[2], Rect2(Point2(0, mid_h + v_sep / 2), Size2(size_left, size_bottom))); + fit_child_in_rect(viewports[3], Rect2(Point2(mid_w + h_sep / 2, 0), Size2(size_right, size.height))); } break; case VIEW_USE_4_VIEWPORTS: { @@ -5848,10 +5848,10 @@ void Node3DEditorViewportContainer::_notification(int p_what) { viewports[i]->show(); } - fit_child_in_rect(viewports[0], Rect2(Vector2(), Vector2(size_left, size_top))); - fit_child_in_rect(viewports[1], Rect2(Vector2(mid_w + h_sep / 2, 0), Vector2(size_right, size_top))); - fit_child_in_rect(viewports[2], Rect2(Vector2(0, mid_h + v_sep / 2), Vector2(size_left, size_bottom))); - fit_child_in_rect(viewports[3], Rect2(Vector2(mid_w + h_sep / 2, mid_h + v_sep / 2), Vector2(size_right, size_bottom))); + fit_child_in_rect(viewports[0], Rect2(Point2(), Size2(size_left, size_top))); + fit_child_in_rect(viewports[1], Rect2(Point2(mid_w + h_sep / 2, 0), Size2(size_right, size_top))); + fit_child_in_rect(viewports[2], Rect2(Point2(0, mid_h + v_sep / 2), Size2(size_left, size_bottom))); + fit_child_in_rect(viewports[3], Rect2(Point2(mid_w + h_sep / 2, mid_h + v_sep / 2), Size2(size_right, size_bottom))); } break; } @@ -6604,7 +6604,7 @@ void Node3DEditor::_menu_item_pressed(int p_option) { } break; case MENU_VIEW_CAMERA_SETTINGS: { - settings_dialog->popup_centered(settings_vbc->get_combined_minimum_size() + Size2(50, 50)); + settings_dialog->popup_centered(settings_vbc->get_combined_minimum_size() + Size2(50)); } break; case MENU_SNAP_TO_FLOOR: { snap_selected_nodes_to_floor(); @@ -7791,7 +7791,7 @@ void Node3DEditor::shortcut_input(const Ref &p_event) { void Node3DEditor::_sun_environ_settings_pressed() { Vector2 pos = sun_environ_settings->get_screen_position() + sun_environ_settings->get_size(); - sun_environ_popup->set_position(pos - Vector2(sun_environ_popup->get_contents_minimum_size().width / 2, 0)); + sun_environ_popup->set_position(pos - Point2(sun_environ_popup->get_contents_minimum_size().width / 2, 0)); sun_environ_popup->reset_size(); sun_environ_popup->popup(); // Grabbing the focus is required for Shift modifier checking to be functional @@ -8365,7 +8365,7 @@ void Node3DEditor::clear() { } void Node3DEditor::_sun_direction_draw() { - sun_direction->draw_rect(Rect2(Vector2(), sun_direction->get_size()), Color(1, 1, 1, 1)); + sun_direction->draw_rect(Rect2(Point2(), sun_direction->get_size()), Color(1, 1, 1)); Vector3 z_axis = preview_sun->get_transform().basis.get_column(Vector3::AXIS_Z); z_axis = get_editor_viewport(0)->camera->get_camera_transform().basis.xform_inv(z_axis); sun_direction_material->set_shader_parameter("sun_direction", Vector3(z_axis.x, -z_axis.y, z_axis.z)); @@ -8833,7 +8833,7 @@ Node3DEditor::Node3DEditor() { settings_dialog->set_title(TTR("Viewport Settings")); add_child(settings_dialog); settings_vbc = memnew(VBoxContainer); - settings_vbc->set_custom_minimum_size(Size2(200, 0) * EDSCALE); + settings_vbc->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); settings_dialog->add_child(settings_vbc); settings_fov = memnew(SpinBox); @@ -8965,7 +8965,7 @@ Node3DEditor::Node3DEditor() { CenterContainer *sun_direction_center = memnew(CenterContainer); sun_direction = memnew(Control); - sun_direction->set_custom_minimum_size(Size2(128, 128) * EDSCALE); + sun_direction->set_custom_minimum_size(Size2(128 * EDSCALE)); sun_direction_center->add_child(sun_direction); sun_vb->add_margin_child(TTR("Sun Direction"), sun_direction_center); sun_direction->connect(SceneStringName(gui_input), callable_mp(this, &Node3DEditor::_sun_direction_input)); @@ -9008,7 +9008,7 @@ void fragment() { sun_angle_altitude_vbox->add_child(sun_angle_altitude); sun_angle_hbox->add_child(sun_angle_altitude_vbox); VBoxContainer *sun_angle_azimuth_vbox = memnew(VBoxContainer); - sun_angle_azimuth_vbox->set_custom_minimum_size(Vector2(100, 0)); + sun_angle_azimuth_vbox->set_custom_minimum_size(Size2(100, 0)); Label *sun_angle_azimuth_label = memnew(Label); sun_angle_azimuth_label->set_text(TTR("Azimuth")); sun_angle_azimuth_vbox->add_child(sun_angle_azimuth_label); diff --git a/editor/plugins/particle_process_material_editor_plugin.cpp b/editor/plugins/particle_process_material_editor_plugin.cpp index 79c9c6958432..10300c47f6df 100644 --- a/editor/plugins/particle_process_material_editor_plugin.cpp +++ b/editor/plugins/particle_process_material_editor_plugin.cpp @@ -54,7 +54,7 @@ void ParticleProcessMaterialMinMaxPropertyEditor::_range_edit_draw() { bool widget_active = mouse_inside || drag != Drag::NONE; // FIXME: Need to offset by 1 due to some outline bug. - range_edit_widget->draw_rect(Rect2(margin + Vector2(1, 1), usable_area - Vector2(1, 1)), widget_active ? background_color.lerp(normal_color, 0.3) : background_color, false, 1.0); + range_edit_widget->draw_rect(Rect2(margin + Point2(1), usable_area - Size2(1)), widget_active ? background_color.lerp(normal_color, 0.3) : background_color, false, 1.0); Color draw_color; @@ -68,7 +68,7 @@ void ParticleProcessMaterialMinMaxPropertyEditor::_range_edit_draw() { } else { draw_color = normal_color; } - range_edit_widget->draw_texture(range_slider_left_icon, Vector2(icon_offset, margin.y), draw_color); + range_edit_widget->draw_texture(range_slider_left_icon, Point2(icon_offset, margin.y), draw_color); icon_offset = _get_right_offset(); @@ -79,7 +79,7 @@ void ParticleProcessMaterialMinMaxPropertyEditor::_range_edit_draw() { } else { draw_color = normal_color; } - range_edit_widget->draw_texture(range_slider_right_icon, Vector2(icon_offset, margin.y), draw_color); + range_edit_widget->draw_texture(range_slider_right_icon, Point2(icon_offset, margin.y), draw_color); } if (drag == Drag::MIDDLE || drag == Drag::SCALE) { @@ -91,8 +91,8 @@ void ParticleProcessMaterialMinMaxPropertyEditor::_range_edit_draw() { } range_edit_widget->draw_rect(_get_middle_rect(), draw_color); - Rect2 midpoint_rect(Vector2(margin.x + usable_area.x * (_get_min_ratio() + _get_max_ratio()) * 0.5 - 1, margin.y + 2), - Vector2(2, usable_area.y - 4)); + Rect2 midpoint_rect(Point2(margin.x + usable_area.x * (_get_min_ratio() + _get_max_ratio()) * 0.5 - 1, margin.y + 2), + Size2(2, usable_area.y - 4)); range_edit_widget->draw_rect(midpoint_rect, midpoint_color); } @@ -145,9 +145,9 @@ void ParticleProcessMaterialMinMaxPropertyEditor::_range_edit_gui_input(const Re const Hover prev_hover = hover; float left_icon_offset = _get_left_offset() - range_slider_left_icon->get_width() - 1; - if (Rect2(Vector2(left_icon_offset, 0), range_slider_left_icon->get_size()).has_point(mm->get_position())) { + if (Rect2(Point2(left_icon_offset, 0), range_slider_left_icon->get_size()).has_point(mm->get_position())) { hover = Hover::LEFT; - } else if (Rect2(Vector2(_get_right_offset(), 0), range_slider_right_icon->get_size()).has_point(mm->get_position())) { + } else if (Rect2(Point2(_get_right_offset(), 0), range_slider_right_icon->get_size()).has_point(mm->get_position())) { hover = Hover::RIGHT; } else if (_get_middle_rect().has_point(mm->get_position())) { hover = Hover::MIDDLE; @@ -217,8 +217,8 @@ Rect2 ParticleProcessMaterialMinMaxPropertyEditor::_get_middle_rect() const { } return Rect2( - Vector2(_get_left_offset() - 1, margin.y), - Vector2(usable_area.x * (_get_max_ratio() - _get_min_ratio()) + 1, usable_area.y)); + Point2(_get_left_offset() - 1, margin.y), + Size2(usable_area.x * (_get_max_ratio() - _get_min_ratio()) + 1, usable_area.y)); } void ParticleProcessMaterialMinMaxPropertyEditor::_set_clamped_values(float p_min, float p_max) { @@ -361,7 +361,7 @@ void ParticleProcessMaterialMinMaxPropertyEditor::_notification(int p_what) { drag_color = hovered_color.lerp(accent_color, 0.8); midpoint_color = dark_theme ? Color(1, 1, 1) : Color(0, 0, 0); - range_edit_widget->set_custom_minimum_size(Vector2(0, range_slider_left_icon->get_height() + 8)); + range_edit_widget->set_custom_minimum_size(Size2(0, range_slider_left_icon->get_height() + 8)); } break; } } diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 86dbfbba9520..c8a6646a04d9 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -195,7 +195,7 @@ bool Path2DEditor::forward_gui_input(const Ref &p_event) { } const Vector2 new_point = xform.affine_inverse().xform(gpoint2); - curve->add_point(new_point, Vector2(0, 0), Vector2(0, 0), insertion_point + 1); + curve->add_point(new_point, Vector2(), Vector2(), insertion_point + 1); action = ACTION_MOVING_NEW_POINT_FROM_SPLIT; action_point = insertion_point + 1; diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index cd644e08ca62..ffce817555db 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -310,7 +310,7 @@ void Polygon2DEditor::_uv_edit_mode_select(int p_mode) { bone_paint_radius->show(); bone_paint_radius_label->show(); _update_bone_list(); - bone_paint_pos = Vector2(-100000, -100000); //send brush away when switching + bone_paint_pos = Vector2(-100000); //send brush away when switching } uv_edit->set_size(uv_edit->get_size()); // Necessary readjustment of the popup window. @@ -507,7 +507,7 @@ void Polygon2DEditor::_uv_input(const Ref &p_input) { Transform2D mtx; mtx.columns[2] = -uv_draw_ofs * uv_draw_zoom; - mtx.scale_basis(Vector2(uv_draw_zoom, uv_draw_zoom)); + mtx.scale_basis(Size2(uv_draw_zoom)); EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); @@ -983,7 +983,7 @@ void Polygon2DEditor::_center_view() { Size2 texture_size; if (node->get_texture().is_valid()) { texture_size = node->get_texture()->get_size(); - Vector2 zoom_factor = (uv_edit_draw->get_size() - Vector2(1, 1) * 50 * EDSCALE) / texture_size; + Vector2 zoom_factor = (uv_edit_draw->get_size() - Vector2(50 * EDSCALE)) / texture_size; zoom_widget->set_zoom(MIN(zoom_factor.x, zoom_factor.y)); } else { zoom_widget->set_zoom(EDSCALE); @@ -1032,7 +1032,7 @@ void Polygon2DEditor::_update_zoom_and_pan(bool p_zoom_at_center) { max_corner = max_corner.max(points[i]); } Size2 page_size = uv_edit_draw->get_size() / uv_draw_zoom; - Vector2 margin = Vector2(50, 50) * EDSCALE / uv_draw_zoom; + Vector2 margin = Vector2(50 * EDSCALE) / uv_draw_zoom; min_corner -= page_size - margin; max_corner += page_size - margin; @@ -1067,7 +1067,7 @@ void Polygon2DEditor::_uv_draw() { Transform2D mtx; mtx.columns[2] = -uv_draw_ofs * uv_draw_zoom; - mtx.scale_basis(Vector2(uv_draw_zoom, uv_draw_zoom)); + mtx.scale_basis(Vector2(uv_draw_zoom)); // Draw texture as a background if editing uvs or no uv mapping exist. if (uv_edit_mode[0]->is_pressed() || uv_mode == UV_MODE_CREATE || node->get_polygon().is_empty() || node->get_uv().size() != node->get_polygon().size()) { @@ -1220,7 +1220,7 @@ void Polygon2DEditor::_uv_draw() { if (weight_r) { Vector2 draw_pos = mtx.xform(uvs[i]); float weight = weight_r[i]; - uv_edit_draw->draw_rect(Rect2(draw_pos - Vector2(2, 2) * EDSCALE, Vector2(5, 5) * EDSCALE), Color(weight, weight, weight, 1.0), Math::round(EDSCALE)); + uv_edit_draw->draw_rect(Rect2(draw_pos - Point2(2 * EDSCALE), Size2(5 * EDSCALE)), Color(weight, weight, weight, 1.0), Math::round(EDSCALE)); } else { if (i < uv_draw_max) { uv_edit_draw->draw_texture(handle, mtx.xform(uvs[i]) - handle->get_size() * 0.5); @@ -1315,7 +1315,7 @@ Vector2 Polygon2DEditor::snap_point(Vector2 p_target) const { Polygon2DEditor::Polygon2DEditor() { snap_offset = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_offset", Vector2()); // A power-of-two value works better as a default grid size. - snap_step = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_step", Vector2(8, 8)); + snap_step = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_step", Vector2(8)); use_snap = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "snap_enabled", false); snap_show_grid = EditorSettings::get_singleton()->get_project_metadata("polygon_2d_uv_editor", "show_grid", false); @@ -1431,7 +1431,7 @@ Polygon2DEditor::Polygon2DEditor() { uv_edit_background = memnew(Panel); uv_main_hsc->add_child(uv_edit_background); uv_edit_background->set_h_size_flags(SIZE_EXPAND_FILL); - uv_edit_background->set_custom_minimum_size(Size2(200, 200) * EDSCALE); + uv_edit_background->set_custom_minimum_size(Size2(200 * EDSCALE)); uv_edit_background->set_clip_contents(true); preview_polygon = memnew(Polygon2D); diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index ba6699fcc4c5..c369c2607906 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -423,7 +423,7 @@ void ResourcePreloaderEditorPlugin::make_visible(bool p_visible) { ResourcePreloaderEditorPlugin::ResourcePreloaderEditorPlugin() { preloader_editor = memnew(ResourcePreloaderEditor); - preloader_editor->set_custom_minimum_size(Size2(0, 250) * EDSCALE); + preloader_editor->set_custom_minimum_size(Size2(0, 250 * EDSCALE)); button = EditorNode::get_bottom_panel()->add_item("ResourcePreloader", preloader_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_resource_preloader_bottom_panel", TTR("Toggle ResourcePreloader Bottom Panel"))); button->hide(); diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 8b31aa92b34e..2aa795a41563 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -157,7 +157,7 @@ void EditorPropertyRootMotion::_node_assign() { } filters->ensure_cursor_is_visible(); - filter_dialog->popup_centered(Size2(500, 500) * EDSCALE); + filter_dialog->popup_centered(Size2(500 * EDSCALE)); } void EditorPropertyRootMotion::_node_clear() { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 80e1b17768c6..f9a980834241 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -4075,7 +4075,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { overview_vbox->add_child(members_overview); members_overview->set_allow_reselect(true); - members_overview->set_custom_minimum_size(Size2(0, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing + members_overview->set_custom_minimum_size(Size2(0, 60 * EDSCALE)); //need to give a bit of limit to avoid it from disappearing members_overview->set_v_size_flags(SIZE_EXPAND_FILL); members_overview->set_allow_rmb_select(true); @@ -4083,7 +4083,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { help_overview->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); overview_vbox->add_child(help_overview); help_overview->set_allow_reselect(true); - help_overview->set_custom_minimum_size(Size2(0, 60) * EDSCALE); //need to give a bit of limit to avoid it from disappearing + help_overview->set_custom_minimum_size(Size2(0, 60 * EDSCALE)); //need to give a bit of limit to avoid it from disappearing help_overview->set_v_size_flags(SIZE_EXPAND_FILL); VBoxContainer *code_editor_container = memnew(VBoxContainer); @@ -4091,7 +4091,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { tab_container = memnew(TabContainer); tab_container->set_tabs_visible(false); - tab_container->set_custom_minimum_size(Size2(200, 0) * EDSCALE); + tab_container->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); code_editor_container->add_child(tab_container); tab_container->set_h_size_flags(SIZE_EXPAND_FILL); tab_container->set_v_size_flags(SIZE_EXPAND_FILL); @@ -4313,7 +4313,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { add_child(find_in_files_dialog); find_in_files = memnew(FindInFilesPanel); find_in_files_button = EditorNode::get_bottom_panel()->add_item(TTR("Search Results"), find_in_files, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_search_results_bottom_panel", TTR("Toggle Search Results Bottom Panel"))); - find_in_files->set_custom_minimum_size(Size2(0, 200) * EDSCALE); + find_in_files->set_custom_minimum_size(Size2(0, 200 * EDSCALE)); find_in_files->connect(FindInFilesPanel::SIGNAL_RESULT_SELECTED, callable_mp(this, &ScriptEditor::_on_find_in_files_result_selected)); find_in_files->connect(FindInFilesPanel::SIGNAL_FILES_MODIFIED, callable_mp(this, &ScriptEditor::_on_find_in_files_modified_files)); find_in_files->connect(FindInFilesPanel::SIGNAL_CLOSE_BUTTON_CLICKED, callable_mp(this, &ScriptEditor::_on_find_in_files_close_button_clicked)); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index b340dd976e00..65033201f073 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -810,7 +810,7 @@ void Skeleton3DEditor::create_editors() { ScrollContainer *s_con = memnew(ScrollContainer); s_con->set_h_size_flags(SIZE_EXPAND_FILL); - s_con->set_custom_minimum_size(Size2(1, 350) * EDSCALE); + s_con->set_custom_minimum_size(Size2(1, 350 * EDSCALE)); bones_section->get_vbox()->add_child(s_con); joint_tree = memnew(Tree); diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp index 3647fa2d5967..fd18d56bff24 100644 --- a/editor/plugins/sprite_2d_editor_plugin.cpp +++ b/editor/plugins/sprite_2d_editor_plugin.cpp @@ -172,7 +172,7 @@ void Sprite2DEditor::_update_mesh_data() { } Rect2 rect = node->is_region_enabled() ? node->get_region_rect() : Rect2(Point2(), image->get_size()); - rect.size /= Vector2(node->get_hframes(), node->get_vframes()); + rect.size /= Size2(node->get_hframes(), node->get_vframes()); rect.position += node->get_frame_coords() * rect.size; Ref bm; @@ -456,7 +456,7 @@ void Sprite2DEditor::_debug_uv_input(const Ref &p_input) { } void Sprite2DEditor::_debug_uv_draw() { - debug_uv->draw_set_transform(-draw_offset * draw_zoom, 0, Vector2(draw_zoom, draw_zoom)); + debug_uv->draw_set_transform(-draw_offset * draw_zoom, 0, Size2(draw_zoom)); Ref tex = node->get_texture(); ERR_FAIL_COND(!tex.is_valid()); @@ -481,7 +481,7 @@ void Sprite2DEditor::_debug_uv_draw() { void Sprite2DEditor::_center_view() { Ref tex = node->get_texture(); ERR_FAIL_COND(!tex.is_valid()); - Vector2 zoom_factor = (debug_uv->get_size() - Vector2(1, 1) * 50 * EDSCALE) / tex->get_size(); + Vector2 zoom_factor = (debug_uv->get_size() - Vector2(50 * EDSCALE)) / tex->get_size(); zoom_widget->set_zoom(MIN(zoom_factor.x, zoom_factor.y)); // Recalculate scroll limits. _update_zoom_and_pan(false); @@ -522,7 +522,7 @@ void Sprite2DEditor::_update_zoom_and_pan(bool p_zoom_at_center) { Point2 min_corner; Point2 max_corner = tex->get_size(); Size2 page_size = debug_uv->get_size() / draw_zoom; - Vector2 margin = Vector2(50, 50) * EDSCALE / draw_zoom; + Vector2 margin = Vector2(50 * EDSCALE) / draw_zoom; min_corner -= page_size - margin; max_corner += page_size - margin; diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 48087e3166aa..92a2eebf2516 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -98,36 +98,36 @@ void SpriteFramesEditor::_sheet_preview_draw() { const Size2 draw_offset = Size2(_get_offset()) * sheet_zoom; const Size2 draw_sep = Size2(separation) * sheet_zoom; const Size2 draw_frame_size = Size2(_get_frame_size()) * sheet_zoom; - const Size2 draw_size = draw_frame_size * frame_count + draw_sep * (frame_count - Size2i(1, 1)); + const Size2 draw_size = draw_frame_size * frame_count + draw_sep * (frame_count - Size2i(1)); const Color line_color = Color(1, 1, 1, 0.3); const Color shadow_color = Color(0, 0, 0, 0.3); // Vertical lines. - _draw_shadowed_line(split_sheet_preview, draw_offset, Vector2(0, draw_size.y), Vector2(1, 0), line_color, shadow_color); + _draw_shadowed_line(split_sheet_preview, draw_offset, Size2(0, draw_size.y), Size2(1, 0), line_color, shadow_color); for (int i = 0; i < frame_count.x - 1; i++) { - const Point2 start = draw_offset + Vector2(i * draw_sep.x + (i + 1) * draw_frame_size.x, 0); + const Point2 start = draw_offset + Point2(i * draw_sep.x + (i + 1) * draw_frame_size.x, 0); if (separation.x == 0) { - _draw_shadowed_line(split_sheet_preview, start, Vector2(0, draw_size.y), Vector2(1, 0), line_color, shadow_color); + _draw_shadowed_line(split_sheet_preview, start, Size2(0, draw_size.y), Size2(1, 0), line_color, shadow_color); } else { const Size2 size = Size2(draw_sep.x, draw_size.y); split_sheet_preview->draw_rect(Rect2(start, size), line_color); } } - _draw_shadowed_line(split_sheet_preview, draw_offset + Vector2(draw_size.x, 0), Vector2(0, draw_size.y), Vector2(1, 0), line_color, shadow_color); + _draw_shadowed_line(split_sheet_preview, draw_offset + Point2(draw_size.x, 0), Size2(0, draw_size.y), Size2(1, 0), line_color, shadow_color); // Horizontal lines. - _draw_shadowed_line(split_sheet_preview, draw_offset, Vector2(draw_size.x, 0), Vector2(0, 1), line_color, shadow_color); + _draw_shadowed_line(split_sheet_preview, draw_offset, Size2(draw_size.x, 0), Size2(0, 1), line_color, shadow_color); for (int i = 0; i < frame_count.y - 1; i++) { - const Point2 start = draw_offset + Vector2(0, i * draw_sep.y + (i + 1) * draw_frame_size.y); + const Point2 start = draw_offset + Point2(0, i * draw_sep.y + (i + 1) * draw_frame_size.y); if (separation.y == 0) { - _draw_shadowed_line(split_sheet_preview, start, Vector2(draw_size.x, 0), Vector2(0, 1), line_color, shadow_color); + _draw_shadowed_line(split_sheet_preview, start, Size2(draw_size.x, 0), Size2(0, 1), line_color, shadow_color); } else { const Size2 size = Size2(draw_size.x, draw_sep.y); split_sheet_preview->draw_rect(Rect2(start, size), line_color); } } - _draw_shadowed_line(split_sheet_preview, draw_offset + Vector2(0, draw_size.y), Vector2(draw_size.x, 0), Vector2(0, 1), line_color, shadow_color); + _draw_shadowed_line(split_sheet_preview, draw_offset + Point2(0, draw_size.y), Size2(draw_size.x, 0), Size2(0, 1), line_color, shadow_color); if (frames_selected.size() == 0) { split_sheet_dialog->get_ok_button()->set_disabled(true); @@ -148,13 +148,13 @@ void SpriteFramesEditor::_sheet_preview_draw() { const int x = idx % frame_count.x; const int y = idx / frame_count.x; const Point2 pos = draw_offset + Point2(x, y) * (draw_frame_size + draw_sep); - split_sheet_preview->draw_rect(Rect2(pos + Size2(5, 5), draw_frame_size - Size2(10, 10)), Color(0, 0, 0, 0.35), true); + split_sheet_preview->draw_rect(Rect2(pos + Size2(5), draw_frame_size - Size2(10)), Color(0, 0, 0, 0.35), true); split_sheet_preview->draw_rect(Rect2(pos, draw_frame_size), Color(0, 0, 0, 1), false); - split_sheet_preview->draw_rect(Rect2(pos + Size2(1, 1), draw_frame_size - Size2(2, 2)), Color(0, 0, 0, 1), false); - split_sheet_preview->draw_rect(Rect2(pos + Size2(2, 2), draw_frame_size - Size2(4, 4)), accent, false); - split_sheet_preview->draw_rect(Rect2(pos + Size2(3, 3), draw_frame_size - Size2(6, 6)), accent, false); - split_sheet_preview->draw_rect(Rect2(pos + Size2(4, 4), draw_frame_size - Size2(8, 8)), Color(0, 0, 0, 1), false); - split_sheet_preview->draw_rect(Rect2(pos + Size2(5, 5), draw_frame_size - Size2(10, 10)), Color(0, 0, 0, 1), false); + split_sheet_preview->draw_rect(Rect2(pos + Size2(1), draw_frame_size - Size2(2)), Color(0, 0, 0), false); + split_sheet_preview->draw_rect(Rect2(pos + Size2(2), draw_frame_size - Size2(4)), accent, false); + split_sheet_preview->draw_rect(Rect2(pos + Size2(3), draw_frame_size - Size2(6)), accent, false); + split_sheet_preview->draw_rect(Rect2(pos + Size2(4), draw_frame_size - Size2(8)), Color(0, 0, 0), false); + split_sheet_preview->draw_rect(Rect2(pos + Size2(5), draw_frame_size - Size2(10)), Color(0, 0, 0), false); const String text = itos(i); const Vector2 string_size = font->get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size); @@ -471,7 +471,7 @@ void SpriteFramesEditor::_sheet_spin_changed(double p_value, int p_dominant_para split_sheet_offset_x->set_max(offset_max.x); split_sheet_offset_y->set_max(offset_max.y); - const Size2i gap_count = count - Size2i(1, 1); + const Size2i gap_count = count - Size2i(1); split_sheet_sep_x->set_max(gap_count.x == 0 ? size.x : (size.x - count.x) / gap_count.x); split_sheet_sep_y->set_max(gap_count.y == 0 ? size.y : (size.y - count.y) / gap_count.y); @@ -1248,7 +1248,7 @@ void SpriteFramesEditor::_zoom_in() { thumbnail_zoom *= scale_ratio; int thumbnail_size = (int)(thumbnail_default_size * thumbnail_zoom); frame_list->set_fixed_column_width(thumbnail_size * 3 / 2); - frame_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); + frame_list->set_fixed_icon_size(Size2(thumbnail_size)); } } @@ -1261,14 +1261,14 @@ void SpriteFramesEditor::_zoom_out() { thumbnail_zoom /= scale_ratio; int thumbnail_size = (int)(thumbnail_default_size * thumbnail_zoom); frame_list->set_fixed_column_width(thumbnail_size * 3 / 2); - frame_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); + frame_list->set_fixed_icon_size(Size2(thumbnail_size)); } } void SpriteFramesEditor::_zoom_reset() { thumbnail_zoom = MAX(1.0f, EDSCALE); frame_list->set_fixed_column_width(thumbnail_default_size * 3 / 2); - frame_list->set_fixed_icon_size(Size2(thumbnail_default_size, thumbnail_default_size)); + frame_list->set_fixed_icon_size(Size2(thumbnail_default_size)); } void SpriteFramesEditor::_update_library(bool p_skip_selector) { @@ -1774,7 +1774,7 @@ void SpriteFramesEditor::_node_removed(Node *p_node) { SpriteFramesEditor::SpriteFramesEditor() { VBoxContainer *vbc_animlist = memnew(VBoxContainer); add_child(vbc_animlist); - vbc_animlist->set_custom_minimum_size(Size2(150, 0) * EDSCALE); + vbc_animlist->set_custom_minimum_size(Size2(150 * EDSCALE, 0)); VBoxContainer *sub_vb = memnew(VBoxContainer); vbc_animlist->add_margin_child(TTR("Animations:"), sub_vb, true); @@ -2362,7 +2362,7 @@ void SpriteFramesEditorPlugin::make_visible(bool p_visible) { SpriteFramesEditorPlugin::SpriteFramesEditorPlugin() { frames_editor = memnew(SpriteFramesEditor); - frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE); + frames_editor->set_custom_minimum_size(Size2(0, 300 * EDSCALE)); button = EditorNode::get_bottom_panel()->add_item(TTR("SpriteFrames"), frames_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_sprite_frames_bottom_panel", TTR("Toggle SpriteFrames Bottom Panel"))); button->hide(); } diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index 6ecbff3bb47b..b7ca51de8872 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -104,7 +104,7 @@ void StyleBoxPreview::_redraw() { StyleBoxPreview::StyleBoxPreview() { set_clip_contents(true); - set_custom_minimum_size(Size2(0, 150) * EDSCALE); + set_custom_minimum_size(Size2(0, 150 * EDSCALE)); set_stretch_mode(TextureRect::STRETCH_TILE); set_texture_repeat(CanvasItem::TEXTURE_REPEAT_ENABLED); set_anchors_and_offsets_preset(PRESET_FULL_RECT); diff --git a/editor/plugins/texture_3d_editor_plugin.cpp b/editor/plugins/texture_3d_editor_plugin.cpp index fa90e982febf..600682229b85 100644 --- a/editor/plugins/texture_3d_editor_plugin.cpp +++ b/editor/plugins/texture_3d_editor_plugin.cpp @@ -109,8 +109,8 @@ void Texture3DEditor::_texture_rect_update_area() { int ofs_x = (size.width - tex_width) / 2; int ofs_y = (size.height - tex_height) / 2; - texture_rect->set_position(Vector2(ofs_x, ofs_y)); - texture_rect->set_size(Vector2(tex_width, tex_height)); + texture_rect->set_position(Point2(ofs_x, ofs_y)); + texture_rect->set_size(Size2(tex_width, tex_height)); } void Texture3DEditor::edit(Ref p_texture) { diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index e9d7aa9eb850..69b55c1577ff 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -127,7 +127,7 @@ TexturePreview::TexturePreview(Ref p_texture, bool p_show_metadata) { checkerboard = memnew(TextureRect); checkerboard->set_stretch_mode(TextureRect::STRETCH_TILE); checkerboard->set_texture_repeat(CanvasItem::TEXTURE_REPEAT_ENABLED); - checkerboard->set_custom_minimum_size(Size2(0.0, 256.0) * EDSCALE); + checkerboard->set_custom_minimum_size(Size2(0, 256 * EDSCALE)); add_child(checkerboard); texture_display = memnew(TextureRect); diff --git a/editor/plugins/texture_layered_editor_plugin.cpp b/editor/plugins/texture_layered_editor_plugin.cpp index 4ec9c91cf9a8..3ae503c969e3 100644 --- a/editor/plugins/texture_layered_editor_plugin.cpp +++ b/editor/plugins/texture_layered_editor_plugin.cpp @@ -175,8 +175,8 @@ void TextureLayeredEditor::_texture_rect_update_area() { int ofs_x = (size.width - tex_width) / 2; int ofs_y = (size.height - tex_height) / 2; - texture_rect->set_position(Vector2(ofs_x, ofs_y)); - texture_rect->set_size(Vector2(tex_width, tex_height)); + texture_rect->set_position(Point2(ofs_x, ofs_y)); + texture_rect->set_size(Size2(tex_width, tex_height)); } void TextureLayeredEditor::edit(Ref p_texture) { diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index a8126334809c..ba498a287d67 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -51,7 +51,7 @@ Transform2D TextureRegionEditor::_get_offset_transform() const { Transform2D mtx; mtx.columns[2] = -draw_ofs * draw_zoom; - mtx.scale_basis(Vector2(draw_zoom, draw_zoom)); + mtx.scale_basis(Size2(draw_zoom)); return mtx; } @@ -302,7 +302,7 @@ void TextureRegionEditor::_texture_overlay_input(const Ref &p_input) Transform2D mtx; mtx.columns[2] = -draw_ofs * draw_zoom; - mtx.scale_basis(Vector2(draw_zoom, draw_zoom)); + mtx.scale_basis(Size2(draw_zoom)); EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); Ref mb = p_input; @@ -316,11 +316,11 @@ void TextureRegionEditor::_texture_overlay_input(const Ref &p_input) // Position of selection handles. const Vector2 endpoints[8] = { - mtx.xform(rect.position) + Vector2(-handle_offset, -handle_offset), + mtx.xform(rect.position) + Vector2(-handle_offset), mtx.xform(rect.position + Vector2(rect.size.x / 2, 0)) + Vector2(0, -handle_offset), mtx.xform(rect.position + Vector2(rect.size.x, 0)) + Vector2(handle_offset, -handle_offset), mtx.xform(rect.position + Vector2(rect.size.x, rect.size.y / 2)) + Vector2(handle_offset, 0), - mtx.xform(rect.position + rect.size) + Vector2(handle_offset, handle_offset), + mtx.xform(rect.position + rect.size) + Vector2(handle_offset), mtx.xform(rect.position + Vector2(rect.size.x / 2, rect.size.y)) + Vector2(0, handle_offset), mtx.xform(rect.position + Vector2(0, rect.size.y)) + Vector2(-handle_offset, handle_offset), mtx.xform(rect.position + Vector2(0, rect.size.y / 2)) + Vector2(-handle_offset, 0) @@ -1117,7 +1117,7 @@ TextureRegionEditor::TextureRegionEditor() { // A power-of-two value works better as a default grid size. snap_offset = EditorSettings::get_singleton()->get_project_metadata("texture_region_editor", "snap_offset", Vector2()); - snap_step = EditorSettings::get_singleton()->get_project_metadata("texture_region_editor", "snap_step", Vector2(8, 8)); + snap_step = EditorSettings::get_singleton()->get_project_metadata("texture_region_editor", "snap_step", Vector2(8)); snap_separation = EditorSettings::get_singleton()->get_project_metadata("texture_region_editor", "snap_separation", Vector2()); snap_mode = (SnapMode)(int)EditorSettings::get_singleton()->get_project_metadata("texture_region_editor", "snap_mode", SNAP_NONE); @@ -1223,7 +1223,7 @@ TextureRegionEditor::TextureRegionEditor() { HBoxContainer *zoom_hb = memnew(HBoxContainer); texture_overlay->add_child(zoom_hb); - zoom_hb->set_begin(Point2(5, 5)); + zoom_hb->set_begin(Point2(5)); zoom_out = memnew(Button); zoom_out->set_flat(true); diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 99635a25319c..9ee9c35ceb6e 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -940,7 +940,7 @@ ThemeItemImportTree::ThemeItemImportTree() { import_items_tree->set_column_clip_content(2, true); ScrollContainer *import_bulk_sc = memnew(ScrollContainer); - import_bulk_sc->set_custom_minimum_size(Size2(260.0, 0.0) * EDSCALE); + import_bulk_sc->set_custom_minimum_size(Size2(260 * EDSCALE, 0)); import_bulk_sc->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED); import_main_hb->add_child(import_bulk_sc); VBoxContainer *import_bulk_vb = memnew(VBoxContainer); @@ -1921,7 +1921,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito tc->set_tab_title(0, TTR("Edit Items")); VBoxContainer *edit_dialog_side_vb = memnew(VBoxContainer); - edit_dialog_side_vb->set_custom_minimum_size(Size2(200.0, 0.0) * EDSCALE); + edit_dialog_side_vb->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); edit_dialog_hs->add_child(edit_dialog_side_vb); Label *edit_type_label = memnew(Label); @@ -2274,7 +2274,7 @@ Control *ThemeItemLabel::make_custom_tooltip(const String &p_text) const { VBoxContainer *ThemeTypeEditor::_create_item_list(Theme::DataType p_data_type) { VBoxContainer *items_tab = memnew(VBoxContainer); - items_tab->set_custom_minimum_size(Size2(0, 160) * EDSCALE); + items_tab->set_custom_minimum_size(Size2(0, 160 * EDSCALE)); data_type_tabs->add_child(items_tab); data_type_tabs->set_tab_title(data_type_tabs->get_tab_count() - 1, ""); @@ -3481,7 +3481,7 @@ ThemeTypeEditor::ThemeTypeEditor() { stylebox_items_list = _create_item_list(Theme::DATA_TYPE_STYLEBOX); VBoxContainer *type_settings_tab = memnew(VBoxContainer); - type_settings_tab->set_custom_minimum_size(Size2(0, 160) * EDSCALE); + type_settings_tab->set_custom_minimum_size(Size2(0, 160 * EDSCALE)); data_type_tabs->add_child(type_settings_tab); data_type_tabs->set_tab_title(data_type_tabs->get_tab_count() - 1, ""); @@ -3727,7 +3727,7 @@ ThemeEditor::ThemeEditor() { VBoxContainer *preview_tabs_vb = memnew(VBoxContainer); preview_tabs_vb->set_h_size_flags(SIZE_EXPAND_FILL); - preview_tabs_vb->set_custom_minimum_size(Size2(520, 0) * EDSCALE); + preview_tabs_vb->set_custom_minimum_size(Size2(520 * EDSCALE, 0)); preview_tabs_vb->add_theme_constant_override("separation", 2 * EDSCALE); main_hs->add_child(preview_tabs_vb); HBoxContainer *preview_tabbar_hb = memnew(HBoxContainer); @@ -3767,7 +3767,7 @@ ThemeEditor::ThemeEditor() { preview_scene_dialog->connect("file_selected", callable_mp(this, &ThemeEditor::_preview_scene_dialog_cbk)); main_hs->add_child(theme_type_editor); - theme_type_editor->set_custom_minimum_size(Size2(280, 0) * EDSCALE); + theme_type_editor->set_custom_minimum_size(Size2(280 * EDSCALE, 0)); } /////////////////////// @@ -3864,7 +3864,7 @@ bool ThemeEditorPlugin::can_auto_hide() const { ThemeEditorPlugin::ThemeEditorPlugin() { theme_editor = memnew(ThemeEditor); theme_editor->plugin = this; - theme_editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE); + theme_editor->set_custom_minimum_size(Size2(0, 200 * EDSCALE)); button = EditorNode::get_bottom_panel()->add_item(TTR("Theme"), theme_editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_theme_bottom_panel", TTR("Toggle Theme Bottom Panel"))); button->hide(); diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index 4d98b24ccc0f..a09a0cbd332a 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -124,7 +124,7 @@ void ThemeEditorPreview::_draw_picker_overlay() { return; } - picker_overlay->draw_rect(Rect2(Vector2(0.0, 0.0), picker_overlay->get_size()), theme_cache.preview_picker_overlay_color); + picker_overlay->draw_rect(Rect2(Point2(), picker_overlay->get_size()), theme_cache.preview_picker_overlay_color); if (hovered_control) { Rect2 highlight_rect = hovered_control->get_global_rect(); highlight_rect.position = picker_overlay->get_global_transform().affine_inverse().xform(highlight_rect.position); @@ -145,7 +145,7 @@ void ThemeEditorPreview::_draw_picker_overlay() { highlight_label_rect.size.x += margin_left + margin_right; highlight_label_rect.size.y += margin_top + margin_bottom; - highlight_label_rect.position = highlight_label_rect.position.clamp(Vector2(), picker_overlay->get_size()); + highlight_label_rect.position = highlight_label_rect.position.clamp(Point2(), picker_overlay->get_size()); picker_overlay->draw_style_box(theme_cache.preview_picker_label, highlight_label_rect); @@ -246,7 +246,7 @@ ThemeEditorPreview::ThemeEditorPreview() { picker_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeEditorPreview::_picker_button_cbk)); MarginContainer *preview_body = memnew(MarginContainer); - preview_body->set_custom_minimum_size(Size2(480, 0) * EDSCALE); + preview_body->set_custom_minimum_size(Size2(480 * EDSCALE, 0)); preview_body->set_v_size_flags(SIZE_EXPAND_FILL); add_child(preview_body); @@ -256,7 +256,7 @@ ThemeEditorPreview::ThemeEditorPreview() { preview_root = memnew(MarginContainer); preview_container->add_child(preview_root); preview_root->set_clip_contents(true); - preview_root->set_custom_minimum_size(Size2(450, 0) * EDSCALE); + preview_root->set_custom_minimum_size(Size2(450 * EDSCALE, 0)); preview_root->set_v_size_flags(SIZE_EXPAND_FILL); preview_root->set_h_size_flags(SIZE_EXPAND_FILL); @@ -381,13 +381,13 @@ DefaultThemeEditorPreview::DefaultThemeEditorPreview() { second_vb->add_child(le); TextEdit *te = memnew(TextEdit); te->set_text("TextEdit"); - te->set_custom_minimum_size(Size2(0, 100) * EDSCALE); + te->set_custom_minimum_size(Size2(0, 100 * EDSCALE)); second_vb->add_child(te); second_vb->add_child(memnew(SpinBox)); HBoxContainer *vhb = memnew(HBoxContainer); second_vb->add_child(vhb); - vhb->set_custom_minimum_size(Size2(0, 100) * EDSCALE); + vhb->set_custom_minimum_size(Size2(0, 100 * EDSCALE)); vhb->add_child(memnew(VSlider)); VScrollBar *vsb = memnew(VScrollBar); vsb->set_page(25); @@ -416,7 +416,7 @@ DefaultThemeEditorPreview::DefaultThemeEditorPreview() { TabContainer *tc = memnew(TabContainer); third_vb->add_child(tc); - tc->set_custom_minimum_size(Size2(0, 135) * EDSCALE); + tc->set_custom_minimum_size(Size2(0, 135 * EDSCALE)); Control *tcc = memnew(Control); tcc->set_name(TTR("Tab 1")); tc->add_child(tcc); @@ -430,7 +430,7 @@ DefaultThemeEditorPreview::DefaultThemeEditorPreview() { Tree *test_tree = memnew(Tree); third_vb->add_child(test_tree); - test_tree->set_custom_minimum_size(Size2(0, 175) * EDSCALE); + test_tree->set_custom_minimum_size(Size2(0, 175 * EDSCALE)); TreeItem *item = test_tree->create_item(); item->set_text(0, "Tree"); diff --git a/editor/plugins/tiles/atlas_merging_dialog.cpp b/editor/plugins/tiles/atlas_merging_dialog.cpp index e25005f9968a..edf29f3103e3 100644 --- a/editor/plugins/tiles/atlas_merging_dialog.cpp +++ b/editor/plugins/tiles/atlas_merging_dialog.cpp @@ -312,7 +312,7 @@ AtlasMergingDialog::AtlasMergingDialog() { // Atlas sources item list. atlas_merging_atlases_list = memnew(ItemList); atlas_merging_atlases_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); - atlas_merging_atlases_list->set_fixed_icon_size(Size2(60, 60) * EDSCALE); + atlas_merging_atlases_list->set_fixed_icon_size(Size2(60 * EDSCALE)); atlas_merging_atlases_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); atlas_merging_atlases_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); atlas_merging_atlases_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST_WITH_MIPMAPS); diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index b806d1e0429b..fe11e4f4e85a 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -102,24 +102,24 @@ void TileAtlasView::_update_zoom_and_panning(bool p_zoom_on_mouse_pos) { // Compute the minimum sizes. Size2i base_tiles_control_size = _compute_base_tiles_control_size(); - base_tiles_root_control->set_custom_minimum_size(Vector2(base_tiles_control_size) * zoom); + base_tiles_root_control->set_custom_minimum_size(Size2(base_tiles_control_size) * zoom); Size2i alternative_tiles_control_size = _compute_alternative_tiles_control_size(); - alternative_tiles_root_control->set_custom_minimum_size(Vector2(alternative_tiles_control_size) * zoom); + alternative_tiles_root_control->set_custom_minimum_size(Size2(alternative_tiles_control_size) * zoom); // Set the texture for the base tiles. Ref texture = tile_set_atlas_source->get_texture(); // Set the scales. if (base_tiles_control_size.x > 0 && base_tiles_control_size.y > 0) { - base_tiles_drawing_root->set_scale(Vector2(zoom, zoom)); + base_tiles_drawing_root->set_scale(Vector2(zoom)); } else { - base_tiles_drawing_root->set_scale(Vector2(1, 1)); + base_tiles_drawing_root->set_scale(Vector2(1)); } if (alternative_tiles_control_size.x > 0 && alternative_tiles_control_size.y > 0) { - alternative_tiles_drawing_root->set_scale(Vector2(zoom, zoom)); + alternative_tiles_drawing_root->set_scale(Vector2(zoom)); } else { - alternative_tiles_drawing_root->set_scale(Vector2(1, 1)); + alternative_tiles_drawing_root->set_scale(Vector2(1)); } // Update the margin container's margins. @@ -197,7 +197,7 @@ void TileAtlasView::_draw_base_tiles() { Vector2i coords = Vector2i(x, y); if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { Rect2i rect = Rect2i((texture_region_size + separation) * coords + margins, texture_region_size + separation); - rect = rect.intersection(Rect2i(Vector2(), texture->get_size())); + rect = rect.intersection(Rect2i(Point2(), texture->get_size())); if (rect.size.x > 0 && rect.size.y > 0) { base_tiles_draw->draw_texture_rect_region(texture, rect, rect); } @@ -211,7 +211,7 @@ void TileAtlasView::_draw_base_tiles() { Vector2i coords = Vector2i(x, y); if (tile_set_atlas_source->get_tile_at_coords(coords) == TileSetSource::INVALID_ATLAS_COORDS) { Rect2i rect = Rect2i((texture_region_size + separation) * coords + margins, texture_region_size + separation); - rect = rect.intersection(Rect2i(Vector2(), texture->get_size())); + rect = rect.intersection(Rect2i(Point2(), texture->get_size())); if (rect.size.x > 0 && rect.size.y > 0) { base_tiles_draw->draw_rect(rect, Color(0.0, 0.0, 0.0, 0.5)); } @@ -350,7 +350,7 @@ void TileAtlasView::_draw_base_tiles_texture_grid() { if (base_tile_coords == Vector2i(x, y)) { // Draw existing tile. Vector2i size_in_atlas = tile_set_atlas_source->get_tile_size_in_atlas(base_tile_coords); - Vector2 region_size = texture_region_size * size_in_atlas + separation * (size_in_atlas - Vector2i(1, 1)); + Vector2 region_size = texture_region_size * size_in_atlas + separation * (size_in_atlas - Vector2i(1)); base_tiles_texture_grid->draw_rect(Rect2i(origin, region_size), Color(1.0, 1.0, 1.0, 0.8), false); } } else { @@ -372,7 +372,7 @@ void TileAtlasView::_draw_base_tiles_shape_grid() { for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) { Vector2i tile_id = tile_set_atlas_source->get_tile_id(i); Vector2 in_tile_base_offset = tile_set_atlas_source->get_tile_data(tile_id, 0)->get_texture_origin(); - if (tile_set_atlas_source->is_rect_in_tile_texture_region(tile_id, 0, Rect2(Vector2(-tile_shape_size) / 2, tile_shape_size))) { + if (tile_set_atlas_source->is_rect_in_tile_texture_region(tile_id, 0, Rect2(Point2(-tile_shape_size) / 2, tile_shape_size))) { for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(tile_id); frame++) { Color color = grid_color; if (frame > 0) { @@ -449,11 +449,11 @@ void TileAtlasView::_draw_alternatives() { } void TileAtlasView::_draw_background_left() { - background_left->draw_texture_rect(theme_cache.checkerboard, Rect2(Vector2(), background_left->get_size()), true); + background_left->draw_texture_rect(theme_cache.checkerboard, Rect2(Point2(), background_left->get_size()), true); } void TileAtlasView::_draw_background_right() { - background_right->draw_texture_rect(theme_cache.checkerboard, Rect2(Vector2(), background_right->get_size()), true); + background_right->draw_texture_rect(theme_cache.checkerboard, Rect2(Point2(), background_right->get_size()), true); } void TileAtlasView::set_atlas_source(TileSet *p_tile_set, TileSetAtlasSource *p_tile_set_atlas_source, int p_source_id) { @@ -530,7 +530,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 = ret.clamp(Vector2i(), size - Vector2i(1, 1)); + ret = ret.clamp(Vector2i(), size - Vector2i(1)); } return ret; diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 03177b7d2912..0c851be52e40 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -153,7 +153,7 @@ void GenericTilePolygonEditor::_base_control_draw() { // Draw the focus rectangle. if (base_control->has_focus()) { - base_control->draw_style_box(focus_stylebox, Rect2(Vector2(), base_control->get_size())); + base_control->draw_style_box(focus_stylebox, Rect2(Point2(), base_control->get_size())); } // Draw tile-related things. @@ -161,11 +161,11 @@ void GenericTilePolygonEditor::_base_control_draw() { Transform2D xform; xform.set_origin(base_control->get_size() / 2 + panning); - xform.set_scale(Vector2(editor_zoom_widget->get_zoom(), editor_zoom_widget->get_zoom())); + xform.set_scale(Size2(editor_zoom_widget->get_zoom())); base_control->draw_set_transform_matrix(xform); // Draw fill rect under texture region. - Rect2 texture_rect(Vector2(), background_region.size); + Rect2 texture_rect(Point2(), background_region.size); if (tile_data) { texture_rect.position -= tile_data->get_texture_origin(); if (tile_data->get_transpose()) { @@ -199,16 +199,16 @@ void GenericTilePolygonEditor::_base_control_draw() { Vector2 spacing = base_tile_size / snap_subdivision->get_value(); Vector2 origin = -base_tile_size / 2; for (real_t y = origin.y; y < grid_area.get_end().y; y += spacing.y) { - base_control->draw_line(Vector2(grid_area.get_position().x, y), Vector2(grid_area.get_end().x, y), Color(1, 1, 1, 0.33)); + base_control->draw_line(Point2(grid_area.get_position().x, y), Point2(grid_area.get_end().x, y), Color(1, 1, 1, 0.33)); } for (real_t y = origin.y - spacing.y; y > grid_area.get_position().y; y -= spacing.y) { - base_control->draw_line(Vector2(grid_area.get_position().x, y), Vector2(grid_area.get_end().x, y), Color(1, 1, 1, 0.33)); + base_control->draw_line(Point2(grid_area.get_position().x, y), Point2(grid_area.get_end().x, y), Color(1, 1, 1, 0.33)); } for (real_t x = origin.x; x < grid_area.get_end().x; x += spacing.x) { - base_control->draw_line(Vector2(x, grid_area.get_position().y), Vector2(x, grid_area.get_end().y), Color(1, 1, 1, 0.33)); + base_control->draw_line(Point2(x, grid_area.get_position().y), Point2(x, grid_area.get_end().y), Color(1, 1, 1, 0.33)); } for (real_t x = origin.x - spacing.x; x > grid_area.get_position().x; x -= spacing.x) { - base_control->draw_line(Vector2(x, grid_area.get_position().y), Vector2(x, grid_area.get_end().y), Color(1, 1, 1, 0.33)); + base_control->draw_line(Point2(x, grid_area.get_position().y), Point2(x, grid_area.get_end().y), Color(1, 1, 1, 0.33)); } } @@ -521,7 +521,7 @@ void GenericTilePolygonEditor::_base_control_gui_input(Ref p_event) Transform2D xform; xform.set_origin(base_control->get_size() / 2 + panning); - xform.set_scale(Vector2(editor_zoom_widget->get_zoom(), editor_zoom_widget->get_zoom())); + xform.set_scale(Size2(editor_zoom_widget->get_zoom())); Ref mm = p_event; if (mm.is_valid()) { @@ -986,7 +986,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { editor_zoom_widget = memnew(EditorZoomWidget); editor_zoom_widget->setup_zoom_limits(0.125, 128.0); - editor_zoom_widget->set_position(Vector2(5, 5)); + editor_zoom_widget->set_position(Point2(5)); editor_zoom_widget->connect("zoom_changed", callable_mp(this, &GenericTilePolygonEditor::_zoom_changed).unbind(1)); editor_zoom_widget->set_shortcut_context(this); root->add_child(editor_zoom_widget); @@ -1256,11 +1256,11 @@ void TileDataDefaultEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform2 if (value.get_type() == Variant::BOOL) { Ref texture = (bool)value ? tile_bool_checked : tile_bool_unchecked; int size = MIN(tile_set->get_tile_size().x, tile_set->get_tile_size().y) / 3; - Rect2 rect = p_transform.xform(Rect2(Vector2(-size / 2, -size / 2) - texture_origin, Vector2(size, size))); + Rect2 rect = p_transform.xform(Rect2(Point2(-size / 2) - texture_origin, Size2(size))); p_canvas_item->draw_texture_rect(texture, rect); } else if (value.get_type() == Variant::COLOR) { int size = MIN(tile_set->get_tile_size().x, tile_set->get_tile_size().y) / 3; - Rect2 rect = p_transform.xform(Rect2(Vector2(-size / 2, -size / 2) - texture_origin, Vector2(size, size))); + Rect2 rect = p_transform.xform(Rect2(Point2(-size / 2) - texture_origin, Size2(size))); p_canvas_item->draw_rect(rect, value); } else { Ref font = TileSetEditor::get_singleton()->get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); @@ -1385,7 +1385,7 @@ void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Tran TileSetSource *source = *(tile_set->get_source(p_cell.source_id)); TileSetAtlasSource *atlas_source = Object::cast_to(source); - if (atlas_source->is_rect_in_tile_texture_region(p_cell.get_atlas_coords(), p_cell.alternative_tile, Rect2(Vector2(-tile_set_tile_size) / 2, tile_set_tile_size))) { + if (atlas_source->is_rect_in_tile_texture_region(p_cell.get_atlas_coords(), p_cell.alternative_tile, Rect2(Point2(-tile_set_tile_size) / 2, tile_set_tile_size))) { tile_set->draw_tile_shape(p_canvas_item, p_transform.scaled_local(tile_set_tile_size), color); } @@ -1398,8 +1398,8 @@ void TileDataTextureOriginEditor::draw_over_tile(CanvasItem *p_canvas_item, Tran Vector2 texture_origin = tile_data->get_texture_origin(); String text = vformat("%s", texture_origin); Vector2 string_size = font->get_string_size(text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size); - p_canvas_item->draw_string_outline(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, 1, Color(0, 0, 0, 1)); - p_canvas_item->draw_string(font, p_transform.xform(-texture_origin) + Vector2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color); + p_canvas_item->draw_string_outline(font, p_transform.xform(-texture_origin) + Point2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, 1, Color(0, 0, 0)); + p_canvas_item->draw_string(font, p_transform.xform(-texture_origin) + Point2i(-string_size.x / 2, string_size.y / 2), text, HORIZONTAL_ALIGNMENT_CENTER, string_size.x, font_size, color); } } @@ -1801,10 +1801,10 @@ void TileDataCollisionEditor::draw_over_tile(CanvasItem *p_canvas_item, Transfor if (tile_data->is_collision_polygon_one_way(physics_layer, i)) { PackedVector2Array uvs; uvs.resize(polygon.size()); - Vector2 size_1 = Vector2(1, 1) / tile_set->get_tile_size(); + Vector2 size_1 = Vector2(1) / tile_set->get_tile_size(); for (int j = 0; j < polygon.size(); j++) { - uvs.write[j] = polygon[j] * size_1 + Vector2(0.5, 0.5); + uvs.write[j] = polygon[j] * size_1 + Vector2(0.5); } Vector color2; @@ -1834,7 +1834,7 @@ void TileDataTerrainsEditor::_update_terrain_selector() { terrain_property_editor->hide(); } else { options.clear(); - Vector>> icons = tile_set->generate_terrains_icons(Size2(16, 16) * EDSCALE); + Vector>> icons = tile_set->generate_terrains_icons(Size2(16 * EDSCALE)); options.push_back(String(TTR("No terrain")) + String(":-1")); for (int i = 0; i < tile_set->get_terrains_count(terrain_set); i++) { String name = tile_set->get_terrain_name(terrain_set, i); @@ -2031,9 +2031,9 @@ void TileDataTerrainsEditor::forward_draw_over_atlas(TileAtlasView *p_tile_atlas Vector2 end = p_transform.affine_inverse().xform(p_canvas_item->get_local_mouse_position()); Vector mouse_pos_rect_polygon; mouse_pos_rect_polygon.push_back(drag_start_pos); - mouse_pos_rect_polygon.push_back(Vector2(end.x, drag_start_pos.y)); + mouse_pos_rect_polygon.push_back(Point2(end.x, drag_start_pos.y)); mouse_pos_rect_polygon.push_back(end); - mouse_pos_rect_polygon.push_back(Vector2(drag_start_pos.x, end.y)); + mouse_pos_rect_polygon.push_back(Point2(drag_start_pos.x, end.y)); Vector color; color.push_back(Color(1.0, 1.0, 1.0, 0.5)); @@ -2514,9 +2514,9 @@ void TileDataTerrainsEditor::forward_painting_atlas_gui_input(TileAtlasView *p_t Vector mouse_pos_rect_polygon; mouse_pos_rect_polygon.push_back(drag_start_pos); - mouse_pos_rect_polygon.push_back(Vector2(mb->get_position().x, drag_start_pos.y)); + mouse_pos_rect_polygon.push_back(Point2(mb->get_position().x, drag_start_pos.y)); mouse_pos_rect_polygon.push_back(mb->get_position()); - mouse_pos_rect_polygon.push_back(Vector2(drag_start_pos.x, mb->get_position().y)); + mouse_pos_rect_polygon.push_back(Point2(drag_start_pos.x, mb->get_position().y)); undo_redo->create_action(TTR("Painting Terrain")); for (const TileMapCell &E : edited) { diff --git a/editor/plugins/tiles/tile_map_layer_editor.cpp b/editor/plugins/tiles/tile_map_layer_editor.cpp index fbf88cc472af..99fe2b0f8438 100644 --- a/editor/plugins/tiles/tile_map_layer_editor.cpp +++ b/editor/plugins/tiles/tile_map_layer_editor.cpp @@ -123,7 +123,7 @@ void TileMapLayerEditorTilesPlugin::_update_transform_buttons() { if (has_scene_tile) { _set_transform_buttons_state({}, { transform_button_rotate_left, transform_button_rotate_right, transform_button_flip_h, transform_button_flip_v }, TTR("Can't transform scene tiles.")); - } else if (tile_set->get_tile_shape() != TileSet::TILE_SHAPE_SQUARE && selection_pattern->get_size() != Vector2i(1, 1)) { + } else if (tile_set->get_tile_shape() != TileSet::TILE_SHAPE_SQUARE && selection_pattern->get_size() != Vector2i(1)) { _set_transform_buttons_state({ transform_button_flip_h, transform_button_flip_v }, { transform_button_rotate_left, transform_button_rotate_right }, TTR("Can't rotate patterns when using non-square tile grid.")); } else { @@ -444,8 +444,7 @@ void TileMapLayerEditorTilesPlugin::_update_scenes_collection_view() { } // Icon size update. - int int_size = int(EDITOR_GET("filesystem/file_dialog/thumbnail_size")) * EDSCALE; - scene_tiles_list->set_fixed_icon_size(Vector2(int_size, int_size)); + scene_tiles_list->set_fixed_icon_size(Size2(int(EDITOR_GET("filesystem/file_dialog/thumbnail_size")) * EDSCALE)); } void TileMapLayerEditorTilesPlugin::_scene_thumbnail_done(const String &p_path, const Ref &p_preview, const Ref &p_small_preview, const Variant &p_ud) { @@ -825,7 +824,7 @@ void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p if (drag_type == DRAG_TYPE_PICK) { // Draw the area being picked. Rect2i rect = Rect2i(tile_set->local_to_map(drag_start_mouse_pos), tile_set->local_to_map(mpos) - tile_set->local_to_map(drag_start_mouse_pos)).abs(); - rect.size += Vector2i(1, 1); + rect.size += Vector2i(1); for (int x = rect.position.x; x < rect.get_end().x; x++) { for (int y = rect.position.y; y < rect.get_end().y; y++) { Vector2i coords = Vector2i(x, y); @@ -838,7 +837,7 @@ void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p } else if (drag_type == DRAG_TYPE_SELECT) { // Draw the area being selected. Rect2i rect = Rect2i(tile_set->local_to_map(drag_start_mouse_pos), tile_set->local_to_map(mpos) - tile_set->local_to_map(drag_start_mouse_pos)).abs(); - rect.size += Vector2i(1, 1); + rect.size += Vector2i(1); RBSet to_draw; for (int x = rect.position.x; x < rect.get_end().x; x++) { for (int y = rect.position.y; y < rect.get_end().y; y++) { @@ -872,7 +871,7 @@ void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p } } else if (drag_type == DRAG_TYPE_CLIPBOARD_PASTE) { // Preview when pasting. - Vector2 mouse_offset = (Vector2(tile_map_clipboard->get_size()) / 2.0 - Vector2(0.5, 0.5)) * tile_set->get_tile_size(); + Vector2 mouse_offset = (Vector2(tile_map_clipboard->get_size()) / 2.0 - Vector2(0.5)) * tile_set->get_tile_size(); TypedArray clipboard_used_cells = tile_map_clipboard->get_used_cells(); for (int i = 0; i < clipboard_used_cells.size(); i++) { Vector2i coords = tile_set->map_pattern(tile_set->local_to_map(mpos - mouse_offset), clipboard_used_cells[i], tile_map_clipboard); @@ -909,7 +908,7 @@ void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p for (const KeyValue &E : preview) { drawn_grid_rect.expand_to(E.key); } - drawn_grid_rect.size += Vector2i(1, 1); + drawn_grid_rect.size += Vector2i(1); } } @@ -1012,9 +1011,9 @@ void TileMapLayerEditorTilesPlugin::forward_canvas_draw_over_viewport(Control *p text += vformat(" %s (%dx%d)", TTR("Drawing Rect:"), ABS(size.x) + 1, ABS(size.y) + 1); } - p_overlay->draw_string(font, msgpos + Point2(1, 1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); - p_overlay->draw_string(font, msgpos + Point2(-1, -1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); - p_overlay->draw_string(font, msgpos, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1, 1)); + p_overlay->draw_string(font, msgpos + Point2(1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); + p_overlay->draw_string(font, msgpos + Point2(-1), text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(0, 0, 0, 0.8)); + p_overlay->draw_string(font, msgpos, text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, Color(1, 1, 1)); } } @@ -1101,7 +1100,7 @@ HashMap TileMapLayerEditorTilesPlugin::_draw_line(Vector2 } else { // Paint the pattern. // If we paint several tiles, we virtually move the mouse as if it was in the center of the "brush" - Vector2 mouse_offset = (Vector2(pattern->get_size()) / 2.0 - Vector2(0.5, 0.5)) * tile_set->get_tile_size(); + Vector2 mouse_offset = (Vector2(pattern->get_size()) / 2.0 - Vector2(0.5)) * tile_set->get_tile_size(); Vector2i last_hovered_cell = tile_set->local_to_map(p_from_mouse_pos - mouse_offset); Vector2i new_hovered_cell = tile_set->local_to_map(p_to_mouse_pos - mouse_offset); Vector2i drag_start_cell = tile_set->local_to_map(p_start_drag_mouse_pos - mouse_offset); @@ -1134,7 +1133,7 @@ HashMap TileMapLayerEditorTilesPlugin::_draw_rect(Vector2 // Create the rect to draw. Rect2i rect = Rect2i(p_start_cell, p_end_cell - p_start_cell).abs(); - rect.size += Vector2i(1, 1); + rect.size += Vector2i(1); // Get or create the pattern. Ref pattern = p_erase ? erase_pattern : selection_pattern; @@ -1245,7 +1244,7 @@ HashMap TileMapLayerEditorTilesPlugin::_draw_bucket_fill( if (source_cell.source_id == TileSet::INVALID_SOURCE) { Rect2i rect = edited_layer->get_used_rect(); if (!rect.has_area()) { - rect = Rect2i(p_coords, Vector2i(1, 1)); + rect = Rect2i(p_coords, Vector2i(1)); } for (int x = boundaries.position.x; x < boundaries.get_end().x; x++) { for (int y = boundaries.position.y; y < boundaries.get_end().y; y++) { @@ -1407,7 +1406,7 @@ void TileMapLayerEditorTilesPlugin::_stop_dragging() { } break; case DRAG_TYPE_PICK: { Rect2i rect = Rect2i(tile_set->local_to_map(drag_start_mouse_pos), tile_set->local_to_map(mpos) - tile_set->local_to_map(drag_start_mouse_pos)).abs(); - rect.size += Vector2i(1, 1); + rect.size += Vector2i(1); int picked_source = -1; TypedArray coords_array; @@ -1486,7 +1485,7 @@ void TileMapLayerEditorTilesPlugin::_stop_dragging() { undo_redo->commit_action(false); } break; case DRAG_TYPE_CLIPBOARD_PASTE: { - Vector2 mouse_offset = (Vector2(tile_map_clipboard->get_size()) / 2.0 - Vector2(0.5, 0.5)) * tile_set->get_tile_size(); + Vector2 mouse_offset = (Vector2(tile_map_clipboard->get_size()) / 2.0 - Vector2(0.5)) * tile_set->get_tile_size(); undo_redo->create_action(TTR("Paste tiles")); TypedArray used_cells = tile_map_clipboard->get_used_cells(); for (int i = 0; i < used_cells.size(); i++) { @@ -1752,9 +1751,9 @@ void TileMapLayerEditorTilesPlugin::_update_selection_pattern_from_tileset_tiles // Compute the encompassing rect for the organized pattern. HashMap::Iterator E_cell = organized_pattern.begin(); if (E_cell) { - encompassing_rect_coords = Rect2i(E_cell->key, Vector2i(1, 1)); + encompassing_rect_coords = Rect2i(E_cell->key, Vector2i(1)); for (; E_cell; ++E_cell) { - encompassing_rect_coords.expand_to(E_cell->key + Vector2i(1, 1)); + encompassing_rect_coords.expand_to(E_cell->key + Vector2i(1)); encompassing_rect_coords.expand_to(E_cell->key); } } @@ -1876,7 +1875,7 @@ void TileMapLayerEditorTilesPlugin::_tile_atlas_control_draw() { Vector2i end_tile = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position(), true); Rect2i region = Rect2i(start_tile, end_tile - start_tile).abs(); - region.size += Vector2i(1, 1); + region.size += Vector2i(1); RBSet to_draw; for (int x = region.position.x; x < region.get_end().x; x++) { @@ -1972,7 +1971,7 @@ void TileMapLayerEditorTilesPlugin::_tile_atlas_control_gui_input(const Refget_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position(), true); if (start_tile != TileSetSource::INVALID_ATLAS_COORDS && end_tile != TileSetSource::INVALID_ATLAS_COORDS) { Rect2i region = Rect2i(start_tile, end_tile - start_tile).abs(); - region.size += Vector2i(1, 1); + region.size += Vector2i(1); // To update the selection, we copy the selected/not selected status of the tiles we drag from. Vector2i start_coords = atlas->get_tile_at_coords(start_tile); @@ -2198,7 +2197,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { selection_pattern.instantiate(); erase_pattern.instantiate(); - erase_pattern->set_cell(Vector2i(0, 0), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE); + erase_pattern->set_cell(Vector2i(), TileSet::INVALID_SOURCE, TileSetSource::INVALID_ATLAS_COORDS, TileSetSource::INVALID_TILE_ALTERNATIVE); // --- Toolbar --- toolbar = memnew(HBoxContainer); @@ -2387,7 +2386,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { split_container_left_side->set_h_size_flags(Control::SIZE_EXPAND_FILL); split_container_left_side->set_v_size_flags(Control::SIZE_EXPAND_FILL); split_container_left_side->set_stretch_ratio(0.25); - split_container_left_side->set_custom_minimum_size(Size2(70, 0) * EDSCALE); + split_container_left_side->set_custom_minimum_size(Size2(70 * EDSCALE, 0)); atlas_sources_split_container->add_child(split_container_left_side); HBoxContainer *sources_bottom_actions = memnew(HBoxContainer); @@ -2409,11 +2408,11 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { sources_list = memnew(ItemList); sources_list->set_auto_translate_mode(Node::AUTO_TRANSLATE_MODE_DISABLED); - sources_list->set_fixed_icon_size(Size2(60, 60) * EDSCALE); + sources_list->set_fixed_icon_size(Size2(60 * EDSCALE)); sources_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); sources_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); sources_list->set_stretch_ratio(0.25); - sources_list->set_custom_minimum_size(Size2(70, 0) * EDSCALE); + sources_list->set_custom_minimum_size(Size2(70 * EDSCALE, 0)); sources_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); sources_list->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_source_display).unbind(1)); sources_list->connect(SceneStringName(item_selected), callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::set_sources_lists_current)); @@ -2478,7 +2477,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { patterns_item_list->set_icon_mode(ItemList::ICON_MODE_TOP); patterns_item_list->set_fixed_column_width(thumbnail_size * 3 / 2); patterns_item_list->set_max_text_lines(2); - patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); + patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size)); patterns_item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); patterns_item_list->connect(SceneStringName(gui_input), callable_mp(this, &TileMapLayerEditorTilesPlugin::_patterns_item_list_gui_input)); patterns_item_list->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_selection_pattern_from_tileset_pattern_selection).unbind(1)); @@ -2764,7 +2763,7 @@ RBSet TileMapLayerEditorTerrainsPlugin::_get_cells_for_bucket_fill(Vec if (source_cell.source_id == TileSet::INVALID_SOURCE) { Rect2i rect = edited_layer->get_used_rect(); if (!rect.has_area()) { - rect = Rect2i(p_coords, Vector2i(1, 1)); + rect = Rect2i(p_coords, Vector2i(1)); } for (int x = boundaries.position.x; x < boundaries.get_end().x; x++) { for (int y = boundaries.position.y; y < boundaries.get_end().y; y++) { @@ -3222,7 +3221,7 @@ void TileMapLayerEditorTerrainsPlugin::forward_canvas_draw_over_viewport(Control // Expand the grid if needed if (expand_grid && !preview.is_empty()) { - drawn_grid_rect = Rect2i(preview.front()->get(), Vector2i(1, 1)); + drawn_grid_rect = Rect2i(preview.front()->get(), Vector2i(1)); for (const Vector2i &E : preview) { drawn_grid_rect.expand_to(E); } @@ -3354,7 +3353,7 @@ void TileMapLayerEditorTerrainsPlugin::_update_terrains_tree() { } // Fill in the terrain list. - Vector>> icons = tile_set->generate_terrains_icons(Size2(16, 16) * EDSCALE); + Vector>> icons = tile_set->generate_terrains_icons(Size2(16 * EDSCALE)); for (int terrain_set_index = 0; terrain_set_index < tile_set->get_terrain_sets_count(); terrain_set_index++) { // Add an item for the terrain set. TreeItem *terrain_set_tree_item = terrains_tree->create_item(); @@ -3528,7 +3527,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() { terrains_tree = memnew(Tree); terrains_tree->set_h_size_flags(Control::SIZE_EXPAND_FILL); terrains_tree->set_stretch_ratio(0.25); - terrains_tree->set_custom_minimum_size(Size2(70, 0) * EDSCALE); + terrains_tree->set_custom_minimum_size(Size2(70 * EDSCALE, 0)); terrains_tree->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); terrains_tree->set_hide_root(true); terrains_tree->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_tiles_list)); @@ -3539,7 +3538,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() { terrains_tile_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); terrains_tile_list->set_max_columns(0); terrains_tile_list->set_same_column_width(true); - terrains_tile_list->set_fixed_icon_size(Size2(32, 32) * EDSCALE); + terrains_tile_list->set_fixed_icon_size(Size2(32 * EDSCALE)); terrains_tile_list->set_texture_filter(CanvasItem::TEXTURE_FILTER_NEAREST); tilemap_tab_terrains->add_child(terrains_tile_list); diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 7e34a36a6e1d..02366d1c7a26 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -1002,7 +1002,7 @@ void TileSetAtlasSourceEditor::_update_atlas_view() { button->add_theme_style_override("focus", memnew(StyleBoxEmpty)); button->add_theme_style_override(SceneStringName(pressed), memnew(StyleBoxEmpty)); button->connect(SceneStringName(pressed), callable_mp(tile_set_atlas_source, &TileSetAtlasSource::create_alternative_tile).bind(tile_id, TileSetSource::INVALID_TILE_ALTERNATIVE)); - button->set_rect(Rect2(Vector2(pos.x, pos.y + (y_increment - texture_region_base_size.y) / 2.0), Vector2(texture_region_base_size_min, texture_region_base_size_min))); + button->set_rect(Rect2(Point2(pos.x, pos.y + (y_increment - texture_region_base_size.y) / 2.0), Size2(texture_region_base_size_min))); button->set_expand_icon(true); alternative_tiles_control->add_child(button); @@ -1094,10 +1094,10 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Refhas_room_for_tile(new_rect.position, new_rect.size, tile_set_atlas_source->get_tile_animation_columns(drag_current_tile), tile_set_atlas_source->get_tile_animation_separation(drag_current_tile), tile_set_atlas_source->get_tile_animation_frames_count(drag_current_tile), drag_current_tile)) { // Move and resize the tile. @@ -1106,8 +1106,8 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref line = Geometry2D::bresenham_line(last_base_tiles_coords, new_base_tiles_coords); for (int i = 0; i < line.size(); i++) { @@ -1121,8 +1121,8 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Ref line = Geometry2D::bresenham_line(last_base_tiles_coords, new_base_tiles_coords); for (int i = 0; i < line.size(); i++) { @@ -1135,7 +1135,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Refget_local_mouse_position(); } else if (drag_type == DRAG_TYPE_MOVE_TILE) { // Move tile. - Vector2 mouse_offset = (Vector2(tile_set_atlas_source->get_tile_size_in_atlas(drag_current_tile)) / 2.0 - Vector2(0.5, 0.5)) * tile_set->get_tile_size(); + Vector2 mouse_offset = (Vector2(tile_set_atlas_source->get_tile_size_in_atlas(drag_current_tile)) / 2.0 - Vector2(0.5)) * tile_set->get_tile_size(); Vector2i coords = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position() - mouse_offset); if (drag_current_tile != coords && tile_set_atlas_source->has_room_for_tile(coords, tile_set_atlas_source->get_tile_size_in_atlas(drag_current_tile), tile_set_atlas_source->get_tile_animation_columns(drag_current_tile), tile_set_atlas_source->get_tile_animation_separation(drag_current_tile), tile_set_atlas_source->get_tile_animation_frames_count(drag_current_tile), drag_current_tile)) { tile_set_atlas_source->move_tile_in_atlas(drag_current_tile, coords); @@ -1282,7 +1282,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_gui_input(const Refget_tile_texture_region(selected.tile); Size2 zoomed_size = resize_handle->get_size() / tile_atlas_view->get_zoom(); Rect2 rect = region.grow_individual(zoomed_size.x, zoomed_size.y, 0, 0); - const Vector2i coords[] = { Vector2i(0, 0), Vector2i(1, 0), Vector2i(1, 1), Vector2i(0, 1) }; + const Vector2i coords[] = { Vector2i(), Vector2i(1, 0), Vector2i(1), Vector2i(0, 1) }; const Vector2i directions[] = { Vector2i(0, -1), Vector2i(1, 0), Vector2i(0, 1), Vector2i(-1, 0) }; bool can_grow[4]; for (int i = 0; i < 4; i++) { @@ -1409,7 +1409,7 @@ void TileSetAtlasSourceEditor::_end_dragging() { Vector2i start_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_mouse_pos, true); Vector2i new_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position(), true); Rect2i area = Rect2i(start_base_tiles_coords, new_base_tiles_coords - start_base_tiles_coords).abs(); - area.set_end((area.get_end() + Vector2i(1, 1)).min(tile_set_atlas_source->get_atlas_grid_size())); + area.set_end((area.get_end() + Vector2i(1)).min(tile_set_atlas_source->get_atlas_grid_size())); undo_redo->create_action(TTR("Create tiles")); for (int x = area.get_position().x; x < area.get_end().x; x++) { for (int y = area.get_position().y; y < area.get_end().y; y++) { @@ -1426,7 +1426,7 @@ void TileSetAtlasSourceEditor::_end_dragging() { Vector2i start_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_mouse_pos, true); Vector2i new_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position(), true); Rect2i area = Rect2i(start_base_tiles_coords, new_base_tiles_coords - start_base_tiles_coords).abs(); - area.set_end((area.get_end() + Vector2i(1, 1)).min(tile_set_atlas_source->get_atlas_grid_size())); + area.set_end((area.get_end() + Vector2i(1)).min(tile_set_atlas_source->get_atlas_grid_size())); List list; tile_set_atlas_source->get_property_list(&list); HashMap> per_tile = _group_properties_per_tiles(list, tile_set_atlas_source); @@ -1480,7 +1480,7 @@ void TileSetAtlasSourceEditor::_end_dragging() { ERR_FAIL_COND(new_base_tiles_coords == TileSetSource::INVALID_ATLAS_COORDS); Rect2i region = Rect2i(start_base_tiles_coords, new_base_tiles_coords - start_base_tiles_coords).abs(); - region.size += Vector2i(1, 1); + region.size += Vector2i(1); undo_redo->create_action(TTR("Select tiles")); undo_redo->add_undo_method(this, "_set_selection_from_array", _get_selection_as_array()); @@ -1754,7 +1754,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() { Size2 zoomed_size = resize_handle->get_size() / tile_atlas_view->get_zoom(); Rect2 region = tile_set_atlas_source->get_tile_texture_region(selected.tile); Rect2 rect = region.grow_individual(zoomed_size.x, zoomed_size.y, 0, 0); - const Vector2i coords[] = { Vector2i(0, 0), Vector2i(1, 0), Vector2i(1, 1), Vector2i(0, 1) }; + const Vector2i coords[] = { Vector2i(), Vector2i(1, 0), Vector2i(1), Vector2i(0, 1) }; const Vector2i directions[] = { Vector2i(0, -1), Vector2i(1, 0), Vector2i(0, 1), Vector2i(-1, 0) }; bool can_grow[4]; for (int i = 0; i < 4; i++) { @@ -1791,7 +1791,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() { Vector2i start_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_mouse_pos, true); Vector2i new_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position(), true); Rect2i area = Rect2i(start_base_tiles_coords, new_base_tiles_coords - start_base_tiles_coords).abs(); - area.set_end((area.get_end() + Vector2i(1, 1)).min(tile_set_atlas_source->get_atlas_grid_size())); + area.set_end((area.get_end() + Vector2i(1)).min(tile_set_atlas_source->get_atlas_grid_size())); Color color = Color(0.0, 0.0, 0.0); if (drag_type == DRAG_TYPE_RECT_SELECT) { @@ -1821,7 +1821,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() { Vector2i start_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_mouse_pos, true); Vector2i new_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position(), true); Rect2i area = Rect2i(start_base_tiles_coords, new_base_tiles_coords - start_base_tiles_coords).abs(); - area.set_end((area.get_end() + Vector2i(1, 1)).min(tile_set_atlas_source->get_atlas_grid_size())); + area.set_end((area.get_end() + Vector2i(1)).min(tile_set_atlas_source->get_atlas_grid_size())); for (int x = area.get_position().x; x < area.get_end().x; x++) { for (int y = area.get_position().y; y < area.get_end().y; y++) { Vector2i coords = Vector2i(x, y); @@ -1839,12 +1839,12 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_draw() { Vector2i start_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(drag_start_mouse_pos, true); Vector2i new_base_tiles_coords = tile_atlas_view->get_atlas_tile_coords_at_pos(tile_atlas_control->get_local_mouse_position(), true); Rect2i area = Rect2i(start_base_tiles_coords, new_base_tiles_coords - start_base_tiles_coords).abs(); - area.set_end((area.get_end() + Vector2i(1, 1)).min(tile_set_atlas_source->get_atlas_grid_size())); + area.set_end((area.get_end() + Vector2i(1)).min(tile_set_atlas_source->get_atlas_grid_size())); Vector2i margins = tile_set_atlas_source->get_margins(); Vector2i separation = tile_set_atlas_source->get_separation(); Vector2i tile_size = tile_set_atlas_source->get_texture_region_size(); Vector2i origin = margins + (area.position * (tile_size + separation)); - Vector2i size = area.size * tile_size + (area.size - Vector2i(1, 1)).maxi(0) * separation; + Vector2i size = area.size * tile_size + (area.size - Vector2i(1)).maxi(0) * separation; TilesEditorUtils::draw_selection_rect(tile_atlas_control, Rect2i(origin, size)); } else { Vector2i grid_size = tile_set_atlas_source->get_atlas_grid_size(); @@ -2508,7 +2508,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { // Middle panel. VBoxContainer *middle_vbox_container = memnew(VBoxContainer); - middle_vbox_container->set_custom_minimum_size(Size2(200, 0) * EDSCALE); + middle_vbox_container->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); add_child(middle_vbox_container); // -- Toolbox -- @@ -2671,7 +2671,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { tile_atlas_view = memnew(TileAtlasView); tile_atlas_view->set_h_size_flags(SIZE_EXPAND_FILL); tile_atlas_view->set_v_size_flags(SIZE_EXPAND_FILL); - tile_atlas_view->set_custom_minimum_size(Size2(200, 0) * EDSCALE); + tile_atlas_view->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); tile_atlas_view->connect("transform_changed", callable_mp(TilesEditorUtils::get_singleton(), &TilesEditorUtils::set_atlas_view_transform)); tile_atlas_view->connect("transform_changed", callable_mp(this, &TileSetAtlasSourceEditor::_tile_atlas_view_transform_changed).unbind(2)); right_panel->add_child(tile_atlas_view); @@ -2972,7 +2972,7 @@ Control::CursorShape TileSetAtlasSourceEditor::TileAtlasControl::get_cursor_shap Rect2 region = editor->tile_set_atlas_source->get_tile_texture_region(selected.tile); Size2 zoomed_size = editor->resize_handle->get_size() / editor->tile_atlas_view->get_zoom(); Rect2 rect = region.grow_individual(zoomed_size.x, zoomed_size.y, 0, 0); - const Vector2i coords[] = { Vector2i(0, 0), Vector2i(1, 0), Vector2i(1, 1), Vector2i(0, 1) }; + const Vector2i coords[] = { Vector2i(), Vector2i(1, 0), Vector2i(1), Vector2i(0, 1) }; const Vector2i directions[] = { Vector2i(0, -1), Vector2i(1, 0), Vector2i(0, 1), Vector2i(-1, 0) }; bool can_grow[4]; for (int i = 0; i < 4; i++) { diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 263e9cfa3b4a..41f435a693d0 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -773,7 +773,7 @@ void TileSetEditor::add_expanded_editor(Control *p_editor) { expanded_editor->set_meta("reparented", true); expanded_editor->reparent(expanded_area); expanded_area->show(); - expanded_area->set_size(Vector2(parent_container->get_global_rect().get_end().x - expanded_area->get_global_position().x, expanded_area->get_size().y)); + expanded_area->set_size(Size2(parent_container->get_global_rect().get_end().x - expanded_area->get_global_position().x, expanded_area->get_size().y)); for (SplitContainer *split : disable_on_expand) { split->set_dragger_visibility(SplitContainer::DRAGGER_HIDDEN); @@ -840,7 +840,7 @@ TileSetEditor::TileSetEditor() { split_container_left_side->set_h_size_flags(SIZE_EXPAND_FILL); split_container_left_side->set_v_size_flags(SIZE_EXPAND_FILL); split_container_left_side->set_stretch_ratio(0.25); - split_container_left_side->set_custom_minimum_size(Size2(70, 0) * EDSCALE); + split_container_left_side->set_custom_minimum_size(Size2(70 * EDSCALE, 0)); split_container->add_child(split_container_left_side); source_sort_button = memnew(MenuButton); @@ -858,7 +858,7 @@ TileSetEditor::TileSetEditor() { sources_list = memnew(ItemList); sources_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); - sources_list->set_fixed_icon_size(Size2(60, 60) * EDSCALE); + sources_list->set_fixed_icon_size(Size2(60 * EDSCALE)); sources_list->set_h_size_flags(SIZE_EXPAND_FILL); sources_list->set_v_size_flags(SIZE_EXPAND_FILL); sources_list->connect(SceneStringName(item_selected), callable_mp(this, &TileSetEditor::_source_selected)); @@ -944,7 +944,7 @@ TileSetEditor::TileSetEditor() { patterns_item_list->set_icon_mode(ItemList::ICON_MODE_TOP); patterns_item_list->set_fixed_column_width(thumbnail_size * 3 / 2); patterns_item_list->set_max_text_lines(2); - patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size, thumbnail_size)); + patterns_item_list->set_fixed_icon_size(Size2(thumbnail_size)); patterns_item_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); patterns_item_list->connect(SceneStringName(gui_input), callable_mp(this, &TileSetEditor::_patterns_item_list_gui_input)); main_vb->add_child(patterns_item_list); @@ -987,7 +987,7 @@ void TileSourceInspectorPlugin::_show_id_edit_dialog(Object *p_for_source) { } edited_source = p_for_source; id_input->set_value(p_for_source->get("id")); - id_edit_dialog->popup_centered(Vector2i(400, 0) * EDSCALE); + id_edit_dialog->popup_centered(Vector2i(400 * EDSCALE, 0)); callable_mp((Control *)id_input->get_line_edit(), &Control::grab_focus).call_deferred(); } diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp index 22ef779b8d90..cbdf108eabcc 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -349,8 +349,7 @@ void TileSetScenesCollectionSourceEditor::_update_scenes_list() { } // Icon size update. - int int_size = int(EDITOR_GET("filesystem/file_dialog/thumbnail_size")) * EDSCALE; - scene_tiles_list->set_fixed_icon_size(Vector2(int_size, int_size)); + scene_tiles_list->set_fixed_icon_size(Size2(int(EDITOR_GET("filesystem/file_dialog/thumbnail_size")) * EDSCALE)); } void TileSetScenesCollectionSourceEditor::_notification(int p_what) { @@ -516,7 +515,7 @@ TileSetScenesCollectionSourceEditor::TileSetScenesCollectionSourceEditor() { // Middle panel. ScrollContainer *middle_panel = memnew(ScrollContainer); middle_panel->set_horizontal_scroll_mode(ScrollContainer::SCROLL_MODE_DISABLED); - middle_panel->set_custom_minimum_size(Size2(200, 0) * EDSCALE); + middle_panel->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); split_container_right_side->add_child(middle_panel); VBoxContainer *middle_vbox_container = memnew(VBoxContainer); diff --git a/editor/plugins/tiles/tiles_editor_plugin.cpp b/editor/plugins/tiles/tiles_editor_plugin.cpp index 3213c290fd1f..4d7f413e0816 100644 --- a/editor/plugins/tiles/tiles_editor_plugin.cpp +++ b/editor/plugins/tiles/tiles_editor_plugin.cpp @@ -85,7 +85,7 @@ void TilesEditorUtils::_thread() { int thumbnail_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size"); thumbnail_size *= EDSCALE; - Vector2 thumbnail_size2 = Vector2(thumbnail_size, thumbnail_size); + Vector2 thumbnail_size2 = Vector2(thumbnail_size); if (item.pattern.is_valid() && !item.pattern->is_empty()) { // Generate the pattern preview @@ -292,10 +292,10 @@ void TilesEditorUtils::draw_selection_rect(CanvasItem *p_ci, const Rect2 &p_rect Ref selection_texture = EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("TileSelection"), EditorStringName(EditorIcons)); real_t scale = p_ci->get_global_transform().get_scale().x * 0.5; - p_ci->draw_set_transform(p_rect.position, 0, Vector2(1, 1) / scale); + p_ci->draw_set_transform(p_rect.position, 0, Vector2(1 / scale)); RS::get_singleton()->canvas_item_add_nine_patch( - p_ci->get_canvas_item(), Rect2(Vector2(), p_rect.size * scale), Rect2(), selection_texture->get_rid(), - Vector2(2, 2), Vector2(2, 2), RS::NINE_PATCH_STRETCH, RS::NINE_PATCH_STRETCH, false, p_color); + p_ci->get_canvas_item(), Rect2(Point2(), p_rect.size * scale), Rect2(), selection_texture->get_rid(), + Vector2(2), Vector2(2), RS::NINE_PATCH_STRETCH, RS::NINE_PATCH_STRETCH, false, p_color); p_ci->draw_set_transform_matrix(Transform2D()); } @@ -496,7 +496,7 @@ TileMapEditorPlugin::TileMapEditorPlugin() { editor = memnew(TileMapLayerEditor); editor->set_h_size_flags(Control::SIZE_EXPAND_FILL); editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); - editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE); + editor->set_custom_minimum_size(Size2(0, 200 * EDSCALE)); editor->hide(); button = EditorNode::get_bottom_panel()->add_item(TTR("TileMap"), editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_tile_map_bottom_panel", TTR("Toggle TileMap Bottom Panel"))); @@ -547,7 +547,7 @@ TileSetEditorPlugin::TileSetEditorPlugin() { editor = memnew(TileSetEditor); editor->set_h_size_flags(Control::SIZE_EXPAND_FILL); editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); - editor->set_custom_minimum_size(Size2(0, 200) * EDSCALE); + editor->set_custom_minimum_size(Size2(0, 200 * EDSCALE)); editor->hide(); button = EditorNode::get_bottom_panel()->add_item(TTR("TileSet"), editor, ED_SHORTCUT_AND_COMMAND("bottom_panels/toggle_tile_set_bottom_panel", TTR("Toggle TileSet Bottom Panel"))); diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index 071be1369254..2b5dda228a74 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -1473,7 +1473,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { version_control_dock = memnew(VBoxContainer); version_control_dock->set_v_size_flags(Control::SIZE_EXPAND_FILL); - version_control_dock->set_custom_minimum_size(Size2(0, 300) * EDSCALE); + version_control_dock->set_custom_minimum_size(Size2(0, 300 * EDSCALE)); version_control_dock->hide(); HBoxContainer *diff_heading = memnew(HBoxContainer); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index b2f09fff4769..1e2614605dac 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -115,7 +115,7 @@ void VSGraphNode::_draw_port(int p_slot_index, Point2i p_pos, bool p_left, const icon_offset = -port_icon->get_size() * 0.5; // Draw "shadow"/outline in the connection rim color. - draw_texture_rect(port_icon, Rect2(p_pos + (icon_offset - Size2(2, 2)) * EDSCALE, (port_icon->get_size() + Size2(4, 4)) * EDSCALE), false, p_rim_color); + draw_texture_rect(port_icon, Rect2(p_pos + (icon_offset - Size2(2)) * EDSCALE, (port_icon->get_size() + Size2(4)) * EDSCALE), false, p_rim_color); draw_texture_rect(port_icon, Rect2(p_pos + icon_offset * EDSCALE, port_icon->get_size() * EDSCALE), false, p_color); } @@ -153,7 +153,7 @@ VSRerouteNode::VSRerouteNode() { Label *title_lbl = Object::cast_to