mirror of
https://github.com/tiennm99/godot.git
synced 2026-08-07 06:29:21 +00:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user