feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -423,7 +423,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
//Move the point in a single axis. Should only work when editing a polygon and while holding shift.
if (mode == MODE_EDIT && mm->is_shift_pressed()) {
Vector2 old_point = pre_move_edit.get(selected_point.vertex);
if (ABS(cpoint.x - old_point.x) > ABS(cpoint.y - old_point.y)) {
if (Math::abs(cpoint.x - old_point.x) > Math::abs(cpoint.y - old_point.y)) {
cpoint.y = old_point.y;
} else {
cpoint.x = old_point.x;
@ -707,12 +707,12 @@ AbstractPolygon2DEditor::PosVertex AbstractPolygon2DEditor::closest_edge_point(c
const int n_segments = n_points - (_is_line() ? 1 : 0);
for (int i = 0; i < n_segments; i++) {
Vector2 segment[2] = { xform.xform(points[i] + offset),
xform.xform(points[(i + 1) % n_points] + offset) };
const Vector2 segment_a = xform.xform(points[i] + offset);
const Vector2 segment_b = xform.xform(points[(i + 1) % n_points] + offset);
Vector2 cp = Geometry2D::get_closest_point_to_segment(p_pos, segment);
Vector2 cp = Geometry2D::get_closest_point_to_segment(p_pos, segment_a, segment_b);
if (cp.distance_squared_to(segment[0]) < eps2 || cp.distance_squared_to(segment[1]) < eps2) {
if (cp.distance_squared_to(segment_a) < eps2 || cp.distance_squared_to(segment_b) < eps2) {
continue; //not valid to reuse point
}
@ -737,18 +737,21 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(bool p_wip_destructive) {
button_create = memnew(Button);
button_create->set_theme_type_variation(SceneStringName(FlatButton));
button_create->set_accessibility_name(TTRC("Create Polygon Points"));
add_child(button_create);
button_create->connect(SceneStringName(pressed), callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_CREATE));
button_create->set_toggle_mode(true);
button_edit = memnew(Button);
button_edit->set_theme_type_variation(SceneStringName(FlatButton));
button_edit->set_accessibility_name(TTRC("Edit Polygon Points"));
add_child(button_edit);
button_edit->connect(SceneStringName(pressed), callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_EDIT));
button_edit->set_toggle_mode(true);
button_delete = memnew(Button);
button_delete->set_theme_type_variation(SceneStringName(FlatButton));
button_delete->set_accessibility_name(TTRC("Delete Polygon Points"));
add_child(button_delete);
button_delete->connect(SceneStringName(pressed), callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_DELETE));
button_delete->set_toggle_mode(true);
@ -783,6 +786,3 @@ AbstractPolygon2DEditorPlugin::AbstractPolygon2DEditorPlugin(AbstractPolygon2DEd
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(polygon_editor);
polygon_editor->hide();
}
AbstractPolygon2DEditorPlugin::~AbstractPolygon2DEditorPlugin() {
}