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).
This commit is contained in:
Hugo Locurcio
2021-08-14 03:12:13 +02:00
parent 3a48474c49
commit 8e3f71d750
19 changed files with 82 additions and 81 deletions
@@ -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<LineShape2D> line = node->get_shape();
case WORLD_MARGIN_SHAPE: {
Ref<WorldMarginShape2D> 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<LineShape2D> line = node->get_shape();
Ref<WorldMarginShape2D> 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<LineShape2D> line = node->get_shape();
case WORLD_MARGIN_SHAPE: {
Ref<WorldMarginShape2D> 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<ConvexPolygonShape2D>(*s)) {
shape_type = CONVEX_POLYGON_SHAPE;
} else if (Object::cast_to<LineShape2D>(*s)) {
shape_type = LINE_SHAPE;
} else if (Object::cast_to<WorldMarginShape2D>(*s)) {
shape_type = WORLD_MARGIN_SHAPE;
} else if (Object::cast_to<RectangleShape2D>(*s)) {
shape_type = RECTANGLE_SHAPE;
} else if (Object::cast_to<SegmentShape2D>(*s)) {
@@ -464,8 +464,8 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
case CONVEX_POLYGON_SHAPE: {
} break;
case LINE_SHAPE: {
Ref<LineShape2D> shape = node->get_shape();
case WORLD_MARGIN_SHAPE: {
Ref<WorldMarginShape2D> shape = node->get_shape();
handles.resize(2);
handles.write[0] = shape->get_normal() * shape->get_distance();