summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-04-07 13:04:59 +0200
committerGitHub <noreply@github.com>2019-04-07 13:04:59 +0200
commit6475c990a291ff525ca1a081d275e89a120f50f5 (patch)
tree01c16fc937b5aa5ddb08bbe7dcba23c19236da23 /editor/plugins
parent9984ebba173194c68443c9d9a8020800144488e3 (diff)
parent6c159acf474084a27f3160cd4ff92158f013218e (diff)
Merge pull request #25311 from qarmin/third_point
Add third point to change size RectangleShape2D in two axis
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/collision_shape_2d_editor_plugin.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/editor/plugins/collision_shape_2d_editor_plugin.cpp b/editor/plugins/collision_shape_2d_editor_plugin.cpp
index 10023d88bf..c8561d22a4 100644
--- a/editor/plugins/collision_shape_2d_editor_plugin.cpp
+++ b/editor/plugins/collision_shape_2d_editor_plugin.cpp
@@ -93,7 +93,7 @@ Variant CollisionShape2DEditor::get_handle_value(int idx) const {
case RECTANGLE_SHAPE: {
Ref<RectangleShape2D> rect = node->get_shape();
- if (idx < 2) {
+ if (idx < 3) {
return rect->get_extents().abs();
}
@@ -175,12 +175,15 @@ void CollisionShape2DEditor::set_handle(int idx, Point2 &p_point) {
} break;
case RECTANGLE_SHAPE: {
- if (idx < 2) {
+ if (idx < 3) {
Ref<RectangleShape2D> rect = node->get_shape();
Vector2 extents = rect->get_extents();
- extents[idx] = p_point[idx];
-
+ if (idx == 2) {
+ extents = p_point;
+ } else {
+ extents[idx] = p_point[idx];
+ }
rect->set_extents(extents.abs());
canvas_item_editor->update_viewport();
@@ -496,13 +499,15 @@ void CollisionShape2DEditor::forward_canvas_draw_over_viewport(Control *p_overla
case RECTANGLE_SHAPE: {
Ref<RectangleShape2D> shape = node->get_shape();
- handles.resize(2);
+ handles.resize(3);
Vector2 ext = shape->get_extents();
handles.write[0] = Point2(ext.x, 0);
handles.write[1] = Point2(0, -ext.y);
+ handles.write[2] = Point2(ext.x, -ext.y);
p_overlay->draw_texture(h, gt.xform(handles[0]) - size);
p_overlay->draw_texture(h, gt.xform(handles[1]) - size);
+ p_overlay->draw_texture(h, gt.xform(handles[2]) - size);
} break;