Blender V4.3
view3d_navigate_smoothview.cc File Reference
#include "DNA_camera_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math_rotation.h"
#include "BLI_math_vector.h"
#include "BKE_context.hh"
#include "DEG_depsgraph_query.hh"
#include "WM_api.hh"
#include "ED_screen.hh"
#include "view3d_intern.hh"
#include "view3d_navigate.hh"

Go to the source code of this file.

Classes

struct  SmoothView3DState
 
struct  SmoothView3DStore
 

Functions

Smooth View Operator & Utilities

Use for view transitions to have smooth (animated) transitions.

Note
This operator is one of the "timer refresh" ones, similar to animation playback.
static void view3d_smoothview_apply_with_interp (bContext *C, View3D *v3d, RegionView3D *rv3d, const bool use_autokey, const float factor)
 
static void view3d_smooth_view_state_backup (SmoothView3DState *sms_state, const View3D *v3d, const RegionView3D *rv3d)
 
static void view3d_smooth_view_state_restore (const SmoothView3DState *sms_state, View3D *v3d, RegionView3D *rv3d)
 
void ED_view3d_smooth_view_ex (const Depsgraph *depsgraph, wmWindowManager *wm, wmWindow *win, ScrArea *area, View3D *v3d, ARegion *region, const int smooth_viewtx, const V3D_SmoothParams *sview)
 
void ED_view3d_smooth_view (bContext *C, View3D *v3d, ARegion *region, const int smooth_viewtx, const V3D_SmoothParams *sview)
 
static void view3d_smoothview_apply_and_finish_ex (wmWindowManager *wm, wmWindow *win, View3D *v3d, RegionView3D *rv3d, bContext *C_for_camera_lock)
 
static void view3d_smoothview_apply_and_finish (bContext *C, View3D *v3d, RegionView3D *rv3d)
 
static void view3d_smoothview_apply_from_timer (bContext *C, View3D *v3d, ARegion *region)
 
static int view3d_smoothview_invoke (bContext *C, wmOperator *, const wmEvent *event)
 
static void view3d_smooth_view_force_finish_ex (const Depsgraph *depsgraph, wmWindowManager *wm, wmWindow *win, const Scene *scene, View3D *v3d, ARegion *region, bContext *C_for_camera_lock)
 
void ED_view3d_smooth_view_force_finish (bContext *C, View3D *v3d, ARegion *region)
 
void ED_view3d_smooth_view_force_finish_no_camera_lock (const Depsgraph *depsgraph, wmWindowManager *wm, wmWindow *win, const Scene *scene, View3D *v3d, ARegion *region)
 
void VIEW3D_OT_smoothview (wmOperatorType *ot)
 
Smooth View Undo Handling

When the camera is locked to the viewport smooth-view operations may need to perform an undo push.

In this case the smooth-view camera transformation is temporarily completed, undo is pushed then the change is rewound, and smooth-view completes from its timer. In the case smooth-view executed the change immediately - an undo push is called.

NOTE(@ideasman42): While this is not ideal it's necessary as making the undo-push once smooth-view is complete because smooth-view is non-blocking and it's possible other operations are executed once smooth-view has started.

void ED_view3d_smooth_view_undo_begin (bContext *C, const ScrArea *area)
 
void ED_view3d_smooth_view_undo_end (bContext *C, const ScrArea *area, const char *undo_str, const bool undo_grouped)
 

Function Documentation

◆ ED_view3d_smooth_view()

◆ ED_view3d_smooth_view_ex()

void ED_view3d_smooth_view_ex ( const Depsgraph * depsgraph,
wmWindowManager * wm,
wmWindow * win,
ScrArea * area,
View3D * v3d,
ARegion * region,
int smooth_viewtx,
const V3D_SmoothParams * sview )

The arguments are the desired situation.

Definition at line 205 of file view3d_navigate_smoothview.cc.

References angle_signed_normalized_qtqt(), BLI_assert, BLI_assert_msg, CAM_ORTHO, V3D_SmoothParams::camera, View3D::camera, V3D_SmoothParams::camera_old, copy_qt_qt(), copy_v3_v3(), Object::data, DEG_get_evaluated_object(), depsgraph, RegionView3D::dist, SmoothView3DState::dist, V3D_SmoothParams::dist, double(), SmoothView3DStore::dst, SmoothView3DStore::dyn_ofs, V3D_SmoothParams::dyn_ofs, ED_region_tag_redraw(), ED_view3d_camera_lock_init(), ED_view3d_camera_lock_sync(), ED_view3d_from_object(), ED_view3d_offset_distance(), equals_v3v3(), equals_v4v4(), fabsf, Object::id, RegionView3D::is_persp, SmoothView3DState::lens, V3D_SmoothParams::lens, View3D::lens, M_PI, MEM_mallocN, OB_CAMERA, OB_RENDER, RegionView3D::ofs, SmoothView3DState::ofs, V3D_SmoothParams::ofs, SmoothView3DStore::org, SmoothView3DStore::org_view, SmoothView3DStore::org_view_axis_roll, RegionView3D::persp, SmoothView3DState::quat, V3D_SmoothParams::quat, RegionView3D::rflag, RV3D_BOXVIEW, RV3D_LOCK_FLAGS, RV3D_LOCK_ROTATION, RV3D_NAVIGATING, RV3D_ORTHO, RV3D_PERSP, RV3D_VIEW_USER, View3D::shading, RegionView3D::smooth_timer, RegionView3D::sms, SmoothView3DStore::src, ID::tag, SmoothView3DStore::time_allowed, TIMER1, SmoothView3DStore::to_camera, Object::type, View3DShading::type, V3D_SmoothParams::undo_str, SmoothView3DStore::use_dyn_ofs, RegionView3D::view, view3d_boxview_copy(), VIEW3D_DIST_FALLBACK, view3d_orbit_apply_dyn_ofs(), view3d_smooth_view_state_backup(), view3d_smooth_view_state_restore(), RegionView3D::view_axis_roll, RegionView3D::view_render, RegionView3D::viewquat, WM_event_add_mousemove(), WM_event_timer_add(), and WM_event_timer_remove().

Referenced by ED_view3d_smooth_view(), view3d_localview_exit(), and view3d_localview_init().

◆ ED_view3d_smooth_view_force_finish()

void ED_view3d_smooth_view_force_finish ( bContext * C,
View3D * v3d,
ARegion * region )

Apply the smooth-view immediately, use when we need to start a new view operation. (so we don't end up half-applying a view operation when pressing keys quickly).

Definition at line 564 of file view3d_navigate_smoothview.cc.

References CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), CTX_wm_manager(), CTX_wm_window(), depsgraph, RegionView3D::sms, and view3d_smooth_view_force_finish_ex().

Referenced by view3d_from_minmax(), view3d_navigation_invoke_generic(), view_axis_exec(), view_camera_exec(), viewcenter_cursor_exec(), viewcenter_pick_invoke(), viewdolly_invoke(), vieworbit_exec(), and viewroll_invoke().

◆ ED_view3d_smooth_view_force_finish_no_camera_lock()

void ED_view3d_smooth_view_force_finish_no_camera_lock ( const Depsgraph * depsgraph,
wmWindowManager * wm,
wmWindow * win,
const Scene * scene,
View3D * v3d,
ARegion * region )

A version of ED_view3d_smooth_view_force_finish that doesn't support camera locking or auto-keying. Use for viewport actions that don't control the camera, entering/exiting the local-view for example (see code-comments for details).

Definition at line 578 of file view3d_navigate_smoothview.cc.

References depsgraph, RegionView3D::sms, and view3d_smooth_view_force_finish_ex().

Referenced by view3d_localview_exit(), and view3d_localview_init().

◆ ED_view3d_smooth_view_undo_begin()

void ED_view3d_smooth_view_undo_begin ( bContext * C,
const ScrArea * area )

Call before multiple smooth-view operations begin to properly handle undo.

Note
Only use explicit undo calls when multiple calls to smooth-view are necessary or when calling ED_view3d_smooth_view_ex. Otherwise pass in V3D_SmoothParams.undo_str so an undo step is pushed as needed.

Definition at line 46 of file view3d_navigate_smoothview.cc.

References View3D::camera, ED_view3d_camera_lock_undo_test(), Object::id, ID_TAG_DOIT, LISTBASE_FOREACH, RGN_TYPE_WINDOW, and ID::tag.

Referenced by ED_view3d_smooth_view(), view3d_all_exec(), and viewselected_exec().

◆ ED_view3d_smooth_view_undo_end()

void ED_view3d_smooth_view_undo_end ( bContext * C,
const ScrArea * area,
const char * undo_str,
bool undo_grouped )

◆ VIEW3D_OT_smoothview()

◆ view3d_smooth_view_force_finish_ex()

static void view3d_smooth_view_force_finish_ex ( const Depsgraph * depsgraph,
wmWindowManager * wm,
wmWindow * win,
const Scene * scene,
View3D * v3d,
ARegion * region,
bContext * C_for_camera_lock )
static

◆ view3d_smooth_view_state_backup()

◆ view3d_smooth_view_state_restore()

◆ view3d_smoothview_apply_and_finish()

static void view3d_smoothview_apply_and_finish ( bContext * C,
View3D * v3d,
RegionView3D * rv3d )
static

◆ view3d_smoothview_apply_and_finish_ex()

◆ view3d_smoothview_apply_from_timer()

◆ view3d_smoothview_apply_with_interp()

◆ view3d_smoothview_invoke()