diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-04-29 20:05:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-04-29 20:06:42 +0300 |
commit | fbd172a00aed4546d3b4cbd0711a5ce94a4ee1b2 (patch) | |
tree | 7990613cb6083b86470ec3f8436b6a454f949c10 /source/blender/editors/space_view3d/view3d_edit.c | |
parent | b0a72c98bb1abbfe0dc62b29dc538fb0d90a9f4a (diff) | |
parent | 0fbce637b3dba02bf1f496d0e902b317793915fc (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 42e8759c6dc..63024b489e1 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -698,22 +698,21 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3]) } enum eViewOpsOrbit { - VIEWOPS_ORBIT_DEFAULT = 0, - VIEWOPS_ORBIT_SELECT = 1, - VIEWOPS_ORBIT_DEPTH = 2, + VIEWOPS_ORBIT_SELECT = (1 << 0), + VIEWOPS_ORBIT_DEPTH = (1 << 1), }; static enum eViewOpsOrbit viewops_orbit_mode_ex(bool use_select, bool use_depth) { + enum eViewOpsOrbit flag = 0; if (use_select) { - return VIEWOPS_ORBIT_SELECT; + flag |= VIEWOPS_ORBIT_SELECT; } - else if (use_depth) { - return VIEWOPS_ORBIT_DEPTH; - } - else { - return VIEWOPS_ORBIT_DEFAULT; + if (use_depth) { + flag |= VIEWOPS_ORBIT_DEPTH; } + + return flag; } static enum eViewOpsOrbit viewops_orbit_mode(void) @@ -734,7 +733,7 @@ static void viewops_data_create_ex( RegionView3D *rv3d = vod->rv3d; /* we need the depth info before changing any viewport options */ - if (orbit_mode == VIEWOPS_ORBIT_DEPTH) { + if (orbit_mode & VIEWOPS_ORBIT_DEPTH) { struct Depsgraph *graph = CTX_data_depsgraph(C); float fallback_depth_pt[3]; @@ -774,15 +773,16 @@ static void viewops_data_create_ex( vod->origkey = event->type; /* the key that triggered the operator. */ copy_v3_v3(vod->ofs, rv3d->ofs); - if (orbit_mode == VIEWOPS_ORBIT_SELECT) { - - vod->use_dyn_ofs = true; - - view3d_orbit_calc_center(C, vod->dyn_ofs); - - negate_v3(vod->dyn_ofs); + if (orbit_mode & VIEWOPS_ORBIT_SELECT) { + float ofs[3]; + if (view3d_orbit_calc_center(C, ofs) || (vod->use_dyn_ofs == false)) { + vod->use_dyn_ofs = true; + negate_v3_v3(vod->dyn_ofs, ofs); + orbit_mode &= ~VIEWOPS_ORBIT_DEPTH; + } } - else if (orbit_mode == VIEWOPS_ORBIT_DEPTH) { + + if (orbit_mode & VIEWOPS_ORBIT_DEPTH) { if (vod->use_dyn_ofs) { if (rv3d->is_persp) { float my_origin[3]; /* original G.vd->ofs */ |