Blender  V3.3
Classes
view3d_navigate_smoothview.c File Reference
#include "DNA_camera_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BKE_context.h"
#include "DEG_depsgraph_query.h"
#include "WM_api.h"
#include "ED_screen.h"
#include "view3d_intern.h"
#include "view3d_navigate.h"

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.

static void view3d_smoothview_apply_ex (bContext *C, View3D *v3d, ARegion *region, bool sync_boxview, bool use_autokey, const float step, const bool finished)
 
static void view3d_smooth_view_state_backup (struct SmoothView3DState *sms_state, const View3D *v3d, const RegionView3D *rv3d)
 
static void view3d_smooth_view_state_restore (const struct 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 struct V3D_SmoothParams *sview)
 
static void view3d_smoothview_apply (bContext *C, View3D *v3d, ARegion *region, bool sync_boxview)
 
static int view3d_smoothview_invoke (bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
 
void ED_view3d_smooth_view_force_finish (bContext *C, 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 it's timer. In the case smooth-view executed the change immediately - an undo push is called.

NOTE(@campbellbarton): 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, ScrArea *area)
 
void ED_view3d_smooth_view_undo_end (bContext *C, ScrArea *area, const char *undo_str, const bool undo_grouped)
 

Function Documentation

◆ ED_view3d_smooth_view()

void ED_view3d_smooth_view ( bContext C,
View3D v3d,
ARegion region,
const int  smooth_viewtx,
const struct V3D_SmoothParams sview 
)

◆ ED_view3d_smooth_view_ex()

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 
)

Definition at line 197 of file view3d_navigate_smoothview.c.

References angle_signed_normalized_qtqt(), blender::compositor::area(), 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, V3D_SmoothParams::dist, SmoothView3DState::dist, RegionView3D::dist, double(), SmoothView3DStore::dst, V3D_SmoothParams::dyn_ofs, SmoothView3DStore::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, V3D_SmoothParams::lens, SmoothView3DState::lens, View3D::lens, LIB_TAG_DOIT, M_PI, MEM_mallocN, NULL, OB_CAMERA, OB_RENDER, Object::obmat, V3D_SmoothParams::ofs, SmoothView3DState::ofs, RegionView3D::ofs, SmoothView3DStore::org, SmoothView3DStore::org_view, RegionView3D::persp, V3D_SmoothParams::quat, SmoothView3DState::quat, ARegion::regiondata, RegionView3D::render_engine, 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::viewquat, WM_event_add_mousemove(), WM_event_add_timer(), and WM_event_remove_timer().

Referenced by ED_view3d_smooth_view().

◆ ED_view3d_smooth_view_force_finish()

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

◆ ED_view3d_smooth_view_undo_begin()

void ED_view3d_smooth_view_undo_begin ( struct bContext C,
struct 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 48 of file view3d_navigate_smoothview.c.

References blender::compositor::area(), C, View3D::camera, camera, ED_view3d_camera_lock_undo_test(), LIB_TAG_DOIT, LISTBASE_FOREACH, and RGN_TYPE_WINDOW.

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 ( struct bContext C,
struct ScrArea area,
const char *  undo_str,
bool  undo_grouped 
)

◆ VIEW3D_OT_smoothview()

void VIEW3D_OT_smoothview ( wmOperatorType ot)

◆ view3d_smooth_view_state_backup()

static void view3d_smooth_view_state_backup ( struct SmoothView3DState sms_state,
const View3D v3d,
const RegionView3D rv3d 
)
static

◆ view3d_smooth_view_state_restore()

static void view3d_smooth_view_state_restore ( const struct SmoothView3DState sms_state,
View3D v3d,
RegionView3D rv3d 
)
static

◆ view3d_smoothview_apply()

static void view3d_smoothview_apply ( bContext C,
View3D v3d,
ARegion region,
bool  sync_boxview 
)
static

◆ view3d_smoothview_apply_ex()

static void view3d_smoothview_apply_ex ( bContext C,
View3D v3d,
ARegion region,
bool  sync_boxview,
bool  use_autokey,
const float  step,
const bool  finished 
)
static

◆ view3d_smoothview_invoke()

static int view3d_smoothview_invoke ( bContext C,
wmOperator UNUSEDop,
const wmEvent event 
)
static