[Bf-blender-cvs] [0074becf736] soc-2021-curves: Fixed bug - improper extrusion for 2d curves
dilithjay
noreply at git.blender.org
Sun Jan 2 11:03:18 CET 2022
Commit: 0074becf73698a45e5495b82ea8d228422e2de4f
Author: dilithjay
Date: Sun Jan 2 15:32:43 2022 +0530
Branches: soc-2021-curves
https://developer.blender.org/rB0074becf73698a45e5495b82ea8d228422e2de4f
Fixed bug - improper extrusion for 2d curves
===================================================================
M release/datafiles/locale
D release/scripts/addons
M source/blender/editors/curve/editcurve_pen.c
===================================================================
diff --git a/release/datafiles/locale b/release/datafiles/locale
index 620b85f16d0..6ac775c595a 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 620b85f16d03a6aadd7cae56969c9c29b06b992d
+Subproject commit 6ac775c595a2dd40684cd6421d24f1f064fe3a6f
diff --git a/release/scripts/addons b/release/scripts/addons
deleted file mode 160000
index 8e194b49d8a..00000000000
--- a/release/scripts/addons
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 8e194b49d8a20559cac7fc37edb7782bd36d03e7
diff --git a/source/blender/editors/curve/editcurve_pen.c b/source/blender/editors/curve/editcurve_pen.c
index d427db45106..601e13d5f53 100644
--- a/source/blender/editors/curve/editcurve_pen.c
+++ b/source/blender/editors/curve/editcurve_pen.c
@@ -863,6 +863,36 @@ static void extrude_point_from_selected_vertex(const ViewContext *vc,
}
ED_view3d_win_to_3d_int(vc->v3d, vc->region, location, event->mval, location);
+
+ if (CU_IS_2D(cu)) {
+ const float eps = 1e-6f;
+
+ /* get the view vector to 'location' */
+ float view_dir[3];
+ ED_view3d_global_to_vector(vc->rv3d, location, view_dir);
+
+ /* get the plane */
+ float plane[4];
+ /* only normalize to avoid precision errors */
+ normalize_v3_v3(plane, vc->obedit->obmat[2]);
+ plane[3] = -dot_v3v3(plane, vc->obedit->obmat[3]);
+
+ if (fabsf(dot_v3v3(view_dir, plane)) < eps) {
+ /* can't project on an aligned plane. */
+ }
+ else {
+ float lambda;
+ if (isect_ray_plane_v3(location, view_dir, plane, &lambda, false)) {
+ /* check if we're behind the viewport */
+ float location_test[3];
+ madd_v3_v3v3fl(location_test, location, view_dir, lambda);
+ if ((vc->rv3d->is_persp == false) ||
+ (mul_project_m4_v3_zfac(vc->rv3d->persmat, location_test) > 0.0f)) {
+ copy_v3_v3(location, location_test);
+ }
+ }
+ }
+ }
EditNurb *editnurb = cu->editnurb;
float imat[4][4];
More information about the Bf-blender-cvs
mailing list