|
Blender V4.3
|
#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.
| |
| 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) |
| void ED_view3d_smooth_view | ( | bContext * | C, |
| View3D * | v3d, | ||
| ARegion * | region, | ||
| const int | smooth_viewtx, | ||
| const V3D_SmoothParams * | sview ) |
Definition at line 385 of file view3d_navigate_smoothview.cc.
References 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(), V3D_SmoothParams::undo_grouped, and V3D_SmoothParams::undo_str.
Referenced by axis_set_view(), sync_viewport_camera_smoothview(), view3d_from_minmax(), view3d_setobjectascamera_exec(), view3d_zoom_border_exec(), view_camera_exec(), viewcenter_cursor_exec(), viewcenter_pick_invoke(), vieworbit_exec(), and viewroll_exec().
| 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().
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().
| 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().
Call before multiple smooth-view operations begin to properly handle undo.
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().
| void ED_view3d_smooth_view_undo_end | ( | bContext * | C, |
| const 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 71 of file view3d_navigate_smoothview.cc.
References View3D::camera, ED_view3d_camera_lock_undo_grouped_push(), ED_view3d_camera_lock_undo_push(), ED_view3d_camera_lock_undo_test(), Object::id, ID_TAG_DOIT, LISTBASE_FOREACH, ARegion::regiondata, RGN_TYPE_WINDOW, RegionView3D::sms, ID::tag, USER_GLOBALUNDO, and view3d_smoothview_apply_with_interp().
Referenced by ED_view3d_smooth_view(), view3d_all_exec(), and viewselected_exec().
| void VIEW3D_OT_smoothview | ( | wmOperatorType * | ot | ) |
Definition at line 605 of file view3d_navigate_smoothview.cc.
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 544 of file view3d_navigate_smoothview.cc.
References BLI_assert, depsgraph, ED_view3d_update_viewmat(), RegionView3D::sms, and view3d_smoothview_apply_and_finish_ex().
Referenced by ED_view3d_smooth_view_force_finish(), and ED_view3d_smooth_view_force_finish_no_camera_lock().
|
static |
Definition at line 185 of file view3d_navigate_smoothview.cc.
References copy_qt_qt(), copy_v3_v3(), RegionView3D::dist, SmoothView3DState::dist, SmoothView3DState::lens, View3D::lens, RegionView3D::ofs, SmoothView3DState::ofs, SmoothView3DState::quat, and RegionView3D::viewquat.
Referenced by ED_view3d_smooth_view_ex().
|
static |
Definition at line 195 of file view3d_navigate_smoothview.cc.
References copy_qt_qt(), copy_v3_v3(), RegionView3D::dist, SmoothView3DState::dist, SmoothView3DState::lens, View3D::lens, RegionView3D::ofs, SmoothView3DState::ofs, SmoothView3DState::quat, and RegionView3D::viewquat.
Referenced by ED_view3d_smooth_view_ex(), and view3d_smoothview_apply_and_finish_ex().
|
static |
Definition at line 491 of file view3d_navigate_smoothview.cc.
References CTX_wm_manager(), CTX_wm_window(), and view3d_smoothview_apply_and_finish_ex().
Referenced by view3d_smoothview_apply_from_timer().
|
static |
Apply the view-port transformation & free smooth-view related data.
Definition at line 445 of file view3d_navigate_smoothview.cc.
References CTX_data_ensure_evaluated_depsgraph(), depsgraph, SmoothView3DStore::dst, ED_view3d_camera_lock_autokey(), ED_view3d_camera_lock_sync(), MEM_freeN(), NC_SPACE, ND_SPACE_VIEW3D, SmoothView3DStore::org, SmoothView3DStore::org_view, SmoothView3DStore::org_view_axis_roll, RegionView3D::persp, RegionView3D::rflag, RV3D_CAMOB, RV3D_LOCK_FLAGS, RV3D_LOCK_ROTATION, RegionView3D::smooth_timer, RegionView3D::sms, SmoothView3DStore::to_camera, RegionView3D::view, view3d_smooth_view_state_restore(), RegionView3D::view_axis_roll, WM_event_add_mousemove(), WM_event_timer_remove(), and WM_main_add_notifier().
Referenced by view3d_smooth_view_force_finish_ex(), and view3d_smoothview_apply_and_finish().
|
static |
Definition at line 498 of file view3d_navigate_smoothview.cc.
References CTX_wm_area(), CTX_wm_manager(), ED_region_tag_redraw(), ED_screen_animation_playing(), float, RV3D_BOXVIEW, RV3D_LOCK_FLAGS, RegionView3D::smooth_timer, RegionView3D::sms, SmoothView3DStore::time_allowed, wmTimer::time_duration, view3d_boxview_copy(), view3d_smoothview_apply_and_finish(), and view3d_smoothview_apply_with_interp().
Referenced by view3d_smoothview_invoke().
|
static |
Apply with interpolation, on completion run view3d_smoothview_apply_and_finish.
Definition at line 416 of file view3d_navigate_smoothview.cc.
References CTX_data_ensure_evaluated_depsgraph(), depsgraph, RegionView3D::dist, SmoothView3DState::dist, SmoothView3DStore::dst, SmoothView3DStore::dyn_ofs, ED_view3d_camera_lock_autokey(), ED_view3d_camera_lock_sync(), interp_qt_qtqt(), interp_v3_v3v3(), interpf(), SmoothView3DState::lens, View3D::lens, RegionView3D::ofs, SmoothView3DState::ofs, SmoothView3DState::quat, RegionView3D::sms, SmoothView3DStore::src, SmoothView3DStore::use_dyn_ofs, view3d_orbit_apply_dyn_ofs(), and RegionView3D::viewquat.
Referenced by ED_view3d_smooth_view_undo_end(), and view3d_smoothview_apply_from_timer().
|
static |
Definition at line 528 of file view3d_navigate_smoothview.cc.
References CTX_wm_region(), CTX_wm_view3d(), wmEvent::customdata, OPERATOR_FINISHED, OPERATOR_PASS_THROUGH, RegionView3D::smooth_timer, and view3d_smoothview_apply_from_timer().
Referenced by VIEW3D_OT_smoothview().