From 8e3f71d75060c70745f541d5cab509f7bea690df Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 13 Aug 2021 19:23:31 +0200 Subject: Rename LineShape2D to WorldMarginShape2D The new name makes it more obvious that it acts as an infinite plane, and is consistent with its 3D counterpart (WorldMarginShape3D). --- editor/icons/LineShape2D.svg | 1 - editor/icons/WorldMarginShape2D.svg | 1 + .../plugins/collision_shape_2d_editor_plugin.cpp | 22 +++++++++++----------- editor/plugins/collision_shape_2d_editor_plugin.h | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 editor/icons/LineShape2D.svg create mode 100644 editor/icons/WorldMarginShape2D.svg (limited to 'editor') diff --git a/editor/icons/LineShape2D.svg b/editor/icons/LineShape2D.svg deleted file mode 100644 index f1dbe97c6f..0000000000 --- a/editor/icons/LineShape2D.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/editor/icons/WorldMarginShape2D.svg b/editor/icons/WorldMarginShape2D.svg new file mode 100644 index 0000000000..f1dbe97c6f --- /dev/null +++ b/editor/icons/WorldMarginShape2D.svg @@ -0,0 +1 @@ + diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp index 4266e0f676..486f947e43 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -36,9 +36,9 @@ #include "scene/resources/circle_shape_2d.h" #include "scene/resources/concave_polygon_shape_2d.h" #include "scene/resources/convex_polygon_shape_2d.h" -#include "scene/resources/line_shape_2d.h" #include "scene/resources/rectangle_shape_2d.h" #include "scene/resources/segment_shape_2d.h" +#include "scene/resources/world_margin_shape_2d.h" void CollisionShape2DEditor::_node_removed(Node *p_node) { if (p_node == node) { @@ -74,8 +74,8 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const { case CONVEX_POLYGON_SHAPE: { } break; - case LINE_SHAPE: { - Ref line = node->get_shape(); + case WORLD_MARGIN_SHAPE: { + Ref line = node->get_shape(); if (idx == 0) { return line->get_distance(); @@ -142,9 +142,9 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) { case CONVEX_POLYGON_SHAPE: { } break; - case LINE_SHAPE: { + case WORLD_MARGIN_SHAPE: { if (idx < 2) { - Ref line = node->get_shape(); + Ref line = node->get_shape(); if (idx == 0) { line->set_distance(p_point.length()); @@ -241,8 +241,8 @@ void CollisionShape2DEditor::commit_handle(int idx, Variant &p_org) { // Cannot be edited directly, use CollisionPolygon2D instead. } break; - case LINE_SHAPE: { - Ref line = node->get_shape(); + case WORLD_MARGIN_SHAPE: { + Ref line = node->get_shape(); if (idx == 0) { undo_redo->add_do_method(line.ptr(), "set_distance", line->get_distance()); @@ -397,8 +397,8 @@ void CollisionShape2DEditor::_get_current_shape_type() { shape_type = CONCAVE_POLYGON_SHAPE; } else if (Object::cast_to(*s)) { shape_type = CONVEX_POLYGON_SHAPE; - } else if (Object::cast_to(*s)) { - shape_type = LINE_SHAPE; + } else if (Object::cast_to(*s)) { + shape_type = WORLD_MARGIN_SHAPE; } else if (Object::cast_to(*s)) { shape_type = RECTANGLE_SHAPE; } else if (Object::cast_to(*s)) { @@ -464,8 +464,8 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla case CONVEX_POLYGON_SHAPE: { } break; - case LINE_SHAPE: { - Ref shape = node->get_shape(); + case WORLD_MARGIN_SHAPE: { + Ref shape = node->get_shape(); handles.resize(2); handles.write[0] = shape->get_normal() * shape->get_distance(); diff --git a/editor/plugins/collision_shape_2d_editor_plugin.h b/editor/plugins/collision_shape_2d_editor_plugin.h index 130ec708cf..056e1b5b7d 100644 --- a/editor/plugins/collision_shape_2d_editor_plugin.h +++ b/editor/plugins/collision_shape_2d_editor_plugin.h @@ -46,7 +46,7 @@ class CollisionShape2DEditor : public Control { CIRCLE_SHAPE, CONCAVE_POLYGON_SHAPE, CONVEX_POLYGON_SHAPE, - LINE_SHAPE, + WORLD_MARGIN_SHAPE, RECTANGLE_SHAPE, SEGMENT_SHAPE }; -- cgit v1.2.3