Blender
V3.3
|
#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) |
void ED_view3d_smooth_view | ( | bContext * | C, |
View3D * | v3d, | ||
ARegion * | region, | ||
const int | smooth_viewtx, | ||
const struct V3D_SmoothParams * | sview | ||
) |
Definition at line 372 of file view3d_navigate_smoothview.c.
References blender::compositor::area(), C, CTX_data_ensure_evaluated_depsgraph(), CTX_wm_area(), CTX_wm_manager(), CTX_wm_window(), depsgraph, ED_view3d_smooth_view_ex(), ED_view3d_smooth_view_undo_begin(), ED_view3d_smooth_view_undo_end(), NULL, V3D_SmoothParams::undo_grouped, and V3D_SmoothParams::undo_str.
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().
void ED_view3d_smooth_view_force_finish | ( | struct bContext * | C, |
struct View3D * | v3d, | ||
struct 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 522 of file view3d_navigate_smoothview.c.
References C, CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), depsgraph, ED_view3d_update_viewmat(), NULL, ARegion::regiondata, scene, RegionView3D::sms, SmoothView3DStore::time_allowed, and view3d_smoothview_apply().
Referenced by view3d_from_minmax(), view_axis_exec(), view_camera_exec(), viewcenter_cursor_exec(), viewcenter_pick_invoke(), viewdolly_invoke(), viewmove_invoke(), vieworbit_exec(), viewroll_exec(), viewroll_invoke(), viewrotate_invoke(), and viewzoom_invoke().
Call before multiple smooth-view operations begin to properly handle undo.
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().
void ED_view3d_smooth_view_undo_end | ( | struct bContext * | C, |
struct ScrArea * | area, | ||
const char * | undo_str, | ||
bool | undo_grouped | ||
) |
Run after multiple smooth-view operations have run to push undo as needed.
Definition at line 73 of file view3d_navigate_smoothview.c.
References blender::compositor::area(), C, View3D::camera, camera, ED_view3d_camera_lock_undo_grouped_push(), ED_view3d_camera_lock_undo_push(), ED_view3d_camera_lock_undo_test(), LIB_TAG_DOIT, LISTBASE_FOREACH, NULL, ARegion::regiondata, RGN_TYPE_WINDOW, RegionView3D::sms, USER_GLOBALUNDO, and view3d_smoothview_apply_ex().
Referenced by ED_view3d_smooth_view(), view3d_all_exec(), and viewselected_exec().
void VIEW3D_OT_smoothview | ( | wmOperatorType * | ot | ) |
Definition at line 538 of file view3d_navigate_smoothview.c.
References ED_operator_view3d_active(), wmOperatorType::flag, wmOperatorType::idname, wmOperatorType::invoke, wmOperatorType::name, OPTYPE_INTERNAL, ot, wmOperatorType::poll, and view3d_smoothview_invoke().
Referenced by view3d_operatortypes().
|
static |
Definition at line 176 of file view3d_navigate_smoothview.c.
References copy_qt_qt(), copy_v3_v3(), SmoothView3DState::dist, RegionView3D::dist, SmoothView3DState::lens, View3D::lens, SmoothView3DState::ofs, RegionView3D::ofs, SmoothView3DState::quat, and RegionView3D::viewquat.
Referenced by ED_view3d_smooth_view_ex().
|
static |
Definition at line 186 of file view3d_navigate_smoothview.c.
References copy_qt_qt(), copy_v3_v3(), SmoothView3DState::dist, RegionView3D::dist, SmoothView3DState::lens, View3D::lens, SmoothView3DState::ofs, RegionView3D::ofs, SmoothView3DState::quat, and RegionView3D::viewquat.
Referenced by ED_view3d_smooth_view_ex(), and view3d_smoothview_apply_ex().
|
static |
Definition at line 487 of file view3d_navigate_smoothview.c.
References C, wmTimer::duration, float(), ARegion::regiondata, RegionView3D::smooth_timer, RegionView3D::sms, SmoothView3DStore::time_allowed, and view3d_smoothview_apply_ex().
Referenced by ED_view3d_smooth_view_force_finish(), and view3d_smoothview_invoke().
|
static |
Definition at line 400 of file view3d_navigate_smoothview.c.
References C, CTX_data_ensure_evaluated_depsgraph(), CTX_wm_area(), CTX_wm_manager(), CTX_wm_window(), depsgraph, SmoothView3DState::dist, RegionView3D::dist, SmoothView3DStore::dst, SmoothView3DStore::dyn_ofs, ED_region_tag_redraw(), ED_screen_animation_playing(), ED_view3d_camera_lock_autokey(), ED_view3d_camera_lock_sync(), interp_qt_qtqt(), interp_v3_v3v3(), SmoothView3DState::lens, View3D::lens, MEM_freeN, NC_SPACE, ND_SPACE_VIEW3D, NULL, SmoothView3DState::ofs, RegionView3D::ofs, SmoothView3DStore::org, SmoothView3DStore::org_view, RegionView3D::persp, SmoothView3DState::quat, ARegion::regiondata, RegionView3D::rflag, RV3D_BOXVIEW, RV3D_CAMOB, RV3D_LOCK_FLAGS, RV3D_LOCK_ROTATION, RV3D_NAVIGATING, RegionView3D::smooth_timer, RegionView3D::sms, SmoothView3DStore::src, SmoothView3DStore::to_camera, SmoothView3DStore::use_dyn_ofs, RegionView3D::view, view3d_boxview_copy(), view3d_orbit_apply_dyn_ofs(), view3d_smooth_view_state_restore(), RegionView3D::viewquat, WM_event_add_mousemove(), WM_event_add_notifier(), and WM_event_remove_timer().
Referenced by ED_view3d_smooth_view_undo_end(), and view3d_smoothview_apply().
|
static |
Definition at line 506 of file view3d_navigate_smoothview.c.
References C, CTX_wm_region(), CTX_wm_view3d(), wmEvent::customdata, NULL, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, ARegion::regiondata, RegionView3D::smooth_timer, and view3d_smoothview_apply().
Referenced by VIEW3D_OT_smoothview().