diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-08 15:18:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-08 16:35:04 +0300 |
commit | a48186c5d74b3d353c5c65cd4a930dd98cc9a603 (patch) | |
tree | c49fd2af2aaac151c5fd1265e414392617043253 /source/blender/editors/armature/armature_add.c | |
parent | 53a56b7b6c169b21df475ae94795208501581489 (diff) |
Orientation for 3D cursor
Currently set when setting the cursor location,
optionally used as an orientation type.
Intended for use by tools too.
See: D3208
Diffstat (limited to 'source/blender/editors/armature/armature_add.c')
-rw-r--r-- | source/blender/editors/armature/armature_add.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index 8109fc27cea..07c9225c443 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -126,7 +126,6 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op)) bArmature *arm; EditBone *ebone, *newbone, *flipbone; float mat[3][3], imat[3][3]; - const float *curs; int a, to_root = 0; Object *obedit; Scene *scene; @@ -188,8 +187,8 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op)) newbone->flag |= BONE_CONNECTED; } - curs = ED_view3d_cursor3d_get(scene, v3d); - copy_v3_v3(newbone->tail, curs); + const View3DCursor *curs = ED_view3d_cursor3d_get(scene, v3d); + copy_v3_v3(newbone->tail, curs->location); sub_v3_v3v3(newbone->tail, newbone->tail, obedit->obmat[3]); if (a == 1) @@ -221,26 +220,26 @@ static int armature_click_extrude_invoke(bContext *C, wmOperator *op, const wmEv Scene *scene; ARegion *ar; View3D *v3d; - float *fp, tvec[3], oldcurs[3], mval_f[2]; + float tvec[3], oldcurs[3], mval_f[2]; int retv; scene = CTX_data_scene(C); ar = CTX_wm_region(C); v3d = CTX_wm_view3d(C); - fp = ED_view3d_cursor3d_get(scene, v3d); + View3DCursor *cursor = ED_view3d_cursor3d_get(scene, v3d); - copy_v3_v3(oldcurs, fp); + copy_v3_v3(oldcurs, cursor->location); VECCOPY2D(mval_f, event->mval); - ED_view3d_win_to_3d(v3d, ar, fp, mval_f, tvec); - copy_v3_v3(fp, tvec); + ED_view3d_win_to_3d(v3d, ar, cursor->location, mval_f, tvec); + copy_v3_v3(cursor->location, tvec); /* extrude to the where new cursor is and store the operation result */ retv = armature_click_extrude_exec(C, op); /* restore previous 3d cursor position */ - copy_v3_v3(fp, oldcurs); + copy_v3_v3(cursor->location, oldcurs); return retv; } @@ -1013,7 +1012,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "name", name); - copy_v3_v3(curs, ED_view3d_cursor3d_get(CTX_data_scene(C), CTX_wm_view3d(C))); + copy_v3_v3(curs, ED_view3d_cursor3d_get(CTX_data_scene(C), CTX_wm_view3d(C))->location); /* Get inverse point for head and orientation for tail */ invert_m4_m4(obedit->imat, obedit->obmat); |