[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57330] trunk/blender/source/blender/ editors/curve/editcurve.c: fix [#35669] Snap curvepoints dont work correct when another object is selected
Campbell Barton
ideasman42 at gmail.com
Mon Jun 10 05:56:50 CEST 2013
Revision: 57330
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57330
Author: campbellbarton
Date: 2013-06-10 03:56:50 +0000 (Mon, 10 Jun 2013)
Log Message:
-----------
fix [#35669] Snap curvepoints dont work correct when another object is selected
Ctrl+Click extrude curves now supports snapping to faces as with meshes.
Modified Paths:
--------------
trunk/blender/source/blender/editors/curve/editcurve.c
Modified: trunk/blender/source/blender/editors/curve/editcurve.c
===================================================================
--- trunk/blender/source/blender/editors/curve/editcurve.c 2013-06-10 02:28:19 UTC (rev 57329)
+++ trunk/blender/source/blender/editors/curve/editcurve.c 2013-06-10 03:56:50 UTC (rev 57330)
@@ -4624,19 +4624,20 @@
static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- RegionView3D *rv3d = CTX_wm_region_view3d(C);
+ ViewContext vc;
- if (rv3d && !RNA_struct_property_is_set(op->ptr, "location")) {
+ view3d_set_viewcontext(C, &vc);
+
+ 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 @@
}
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);
}
More information about the Bf-blender-cvs
mailing list