Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-06-10 07:56:50 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-06-10 07:56:50 +0400
commite3afec146116900b1af0296c65b8b3765385ae4c (patch)
tree1792532fb6c9fe53531241d750af887f56fb447f
parent355f87d3d4eec44f98caa0f159b102a4f58c8bf0 (diff)
fix [#35669] Snap curvepoints dont work correct when another object is selected
Ctrl+Click extrude curves now supports snapping to faces as with meshes.
-rw-r--r--source/blender/editors/curve/editcurve.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 0383c0d1d1a..ae65cc9dbbe 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -4624,19 +4624,20 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- RegionView3D *rv3d = CTX_wm_region_view3d(C);
+ ViewContext vc;
+
+ view3d_set_viewcontext(C, &vc);
- if (rv3d && !RNA_struct_property_is_set(op->ptr, "location")) {
+ if (vc.rv3d && !RNA_struct_property_is_set(op->ptr, "location")) {
Curve *cu;
- ViewContext vc;
float location[3];
+ const bool use_proj = ((vc.scene->toolsettings->snap_flag & SCE_SNAP) &&
+ (vc.scene->toolsettings->snap_mode == SCE_SNAP_MODE_FACE));
Nurb *nu;
BezTriple *bezt;
BPoint *bp;
- view3d_set_viewcontext(C, &vc);
-
cu = vc.obedit->data;
findselectedNurbvert(&cu->editnurb->nurbs, &nu, &bezt, &bp);
@@ -4652,6 +4653,14 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
ED_view3d_win_to_3d_int(vc.ar, location, event->mval, location);
+
+ if (use_proj) {
+ const float mval[2] = {UNPACK2(event->mval)};
+ float no_dummy[3];
+ float dist_px_dummy;
+ snapObjectsContext(C, mval, &dist_px_dummy, location, no_dummy, SNAP_NOT_OBEDIT);
+ }
+
RNA_float_set_array(op->ptr, "location", location);
}