Transform: use transform Pivot for AutoDepth during navigation

To avoid the small jumps during the Pan operation, a feature was
implemented in the `ED_view3d_navigation_do` utility that replaces the
point used for AutoDepth.

As a result, the depth of the pivot point is now used during the
transform.

Also, to ensure minimal disruption to non-AutoDepth users, this feature
is enabled only when "Auto Depth" is enabled.

Pull Request: https://projects.blender.org/blender/blender/pulls/109451
This commit is contained in:
Germano Cavalcante
2023-07-31 16:06:37 +02:00
committed by Germano Cavalcante
parent 5ed14e9269
commit c6fb80cb9b
2 changed files with 14 additions and 5 deletions

View File

@@ -223,7 +223,8 @@ bool ED_view3d_depth_unproject_v3(const struct ARegion *region,
struct ViewOpsData *ED_view3d_navigation_init(struct bContext *C, const bool use_alt_navigation);
bool ED_view3d_navigation_do(struct bContext *C,
struct ViewOpsData *vod,
const struct wmEvent *event);
const struct wmEvent *event,
const float depth_loc_override[3]);
void ED_view3d_navigation_free(struct bContext *C, struct ViewOpsData *vod);
/* Projection */

View File

@@ -12,6 +12,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_math_vector_types.hh"
#include "BLI_rect.h"
#include "BLT_translation.h"
@@ -45,6 +46,8 @@
#include "view3d_navigate.hh" /* own include */
using namespace blender;
/* Prototypes. */
static const ViewOpsType *view3d_navigation_type_from_idname(const char *idname);
@@ -490,7 +493,8 @@ static int view3d_navigation_invoke_generic(bContext *C,
ViewOpsData *vod,
const wmEvent *event,
PointerRNA *ptr,
const ViewOpsType *nav_type)
const float dyn_ofs_override[3],
const eV3D_OpMode nav_type)
{
if (!nav_type->init_fn) {
return OPERATOR_CANCELLED;
@@ -1020,16 +1024,20 @@ static int view3d_navigation_invoke(bContext *C,
ViewOpsData *vod,
const wmEvent *event,
wmKeyMapItem *kmi,
const ViewOpsType *nav_type)
const float dyn_ofs_override[3],
eV3D_OpMode nav_type)
{
if (nav_type->poll_fn && !nav_type->poll_fn(C)) {
return OPERATOR_CANCELLED;
}
return view3d_navigation_invoke_generic(C, vod, event, kmi->ptr, nav_type);
return view3d_navigation_invoke_generic(C, vod, event, kmi->ptr, dyn_ofs_override, nav_type);
}
bool ED_view3d_navigation_do(bContext *C, ViewOpsData *vod, const wmEvent *event)
bool ED_view3d_navigation_do(bContext *C,
ViewOpsData *vod,
const wmEvent *event,
const float depth_loc_override[3])
{
if (!vod) {
return false;