Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/curve/editcurve.c
| Show First 20 Lines • Show All 5,556 Lines • ▼ Show 20 Lines | static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| ViewContext vc; | ViewContext vc; | ||||
| ED_view3d_viewcontext_init(C, &vc, depsgraph); | ED_view3d_viewcontext_init(C, &vc, depsgraph); | ||||
| if (vc.rv3d && !RNA_struct_property_is_set(op->ptr, "location")) { | if (vc.rv3d && !RNA_struct_property_is_set(op->ptr, "location")) { | ||||
| Curve *cu; | Curve *cu; | ||||
| float location[3]; | float location[3]; | ||||
| const bool use_proj = ((vc.scene->toolsettings->snap_flag & SCE_SNAP) && | const bool use_proj = ((vc.scene->toolsettings->snap_flag & SCE_SNAP) && | ||||
| (vc.scene->toolsettings->snap_mode == SCE_SNAP_MODE_FACE)); | (vc.scene->toolsettings->snap_mode == SCE_SNAP_MODE_FACE_RAYCAST)); | ||||
| Nurb *nu; | Nurb *nu; | ||||
| BezTriple *bezt; | BezTriple *bezt; | ||||
| BPoint *bp; | BPoint *bp; | ||||
| cu = vc.obedit->data; | cu = vc.obedit->data; | ||||
| ED_curve_nurb_vert_selected_find(cu, vc.v3d, &nu, &bezt, &bp); | ED_curve_nurb_vert_selected_find(cu, vc.v3d, &nu, &bezt, &bp); | ||||
| Show All 16 Lines | if (use_proj) { | ||||
| struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create(vc.scene, | struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create(vc.scene, | ||||
| 0); | 0); | ||||
| ED_transform_snap_object_project_view3d( | ED_transform_snap_object_project_view3d( | ||||
| snap_context, | snap_context, | ||||
| vc.depsgraph, | vc.depsgraph, | ||||
| vc.region, | vc.region, | ||||
| vc.v3d, | vc.v3d, | ||||
| SCE_SNAP_MODE_FACE, | SCE_SNAP_MODE_FACE_RAYCAST, | ||||
| &(const struct SnapObjectParams){ | &(const struct SnapObjectParams){ | ||||
| .snap_target_select = (vc.obedit != NULL) ? SCE_SNAP_TARGET_NOT_ACTIVE : | .snap_target_select = (vc.obedit != NULL) ? SCE_SNAP_TARGET_NOT_ACTIVE : | ||||
| SCE_SNAP_TARGET_ALL, | SCE_SNAP_TARGET_ALL, | ||||
| .edit_mode_type = SNAP_GEOM_FINAL, | .edit_mode_type = SNAP_GEOM_FINAL, | ||||
| }, | }, | ||||
| NULL, | |||||
| mval, | mval, | ||||
| NULL, | NULL, | ||||
| NULL, | NULL, | ||||
| location, | location, | ||||
| NULL); | NULL); | ||||
| ED_transform_snap_object_context_destroy(snap_context); | ED_transform_snap_object_context_destroy(snap_context); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,519 Lines • Show Last 20 Lines | |||||