Skip to content

Commit

Permalink
Merge pull request #61626 from Haydoggo/path-editor-handle-swap
Browse files Browse the repository at this point in the history
Swap Path3DGizmo control points order
  • Loading branch information
akien-mga authored Jun 2, 2022
2 parents f606225 + 90b39f9 commit 1baee21
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions editor/plugins/path_3d_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ String Path3DGizmo::get_handle_name(int p_id, bool p_secondary) const {
int idx = p_id / 2;
int t = p_id % 2;
String n = TTR("Curve Point #") + itos(idx);
if (t == 0) {
if (t == 1) {
n += " In";
} else {
n += " Out";
Expand All @@ -78,7 +78,7 @@ Variant Path3DGizmo::get_handle_value(int p_id, bool p_secondary) const {
int t = p_id % 2;

Vector3 ofs;
if (t == 0) {
if (t == 1) {
ofs = c->get_point_in(idx);
} else {
ofs = c->get_point_out(idx);
Expand Down Expand Up @@ -144,7 +144,7 @@ void Path3DGizmo::set_handle(int p_id, bool p_secondary, Camera3D *p_camera, con
local.snap(Vector3(snap, snap, snap));
}

if (t == 0) {
if (t == 1) {
c->set_point_in(idx, local);
if (Path3DEditorPlugin::singleton->mirror_angle_enabled()) {
c->set_point_out(idx, Path3DEditorPlugin::singleton->mirror_length_enabled() ? -local : (-local.normalized() * orig_out_length));
Expand Down Expand Up @@ -184,7 +184,7 @@ void Path3DGizmo::commit_handle(int p_id, bool p_secondary, const Variant &p_res
int idx = p_id / 2;
int t = p_id % 2;

if (t == 0) {
if (t == 1) {
if (p_cancel) {
c->set_point_in(p_id, p_restore);
return;
Expand Down Expand Up @@ -263,17 +263,17 @@ void Path3DGizmo::redraw() {
for (int i = 0; i < c->get_point_count(); i++) {
Vector3 p = c->get_point_position(i);
handles.push_back(p);
if (i > 0) {
v3p.push_back(p);
v3p.push_back(p + c->get_point_in(i));
sec_handles.push_back(p + c->get_point_in(i));
}

// push Out points first so they get selected if the In and Out points are on top of each other.
if (i < c->get_point_count() - 1) {
v3p.push_back(p);
v3p.push_back(p + c->get_point_out(i));
sec_handles.push_back(p + c->get_point_out(i));
}
if (i > 0) {
v3p.push_back(p);
v3p.push_back(p + c->get_point_in(i));
sec_handles.push_back(p + c->get_point_in(i));
}
}

if (v3p.size() > 1) {
Expand Down

0 comments on commit 1baee21

Please sign in to comment.