40 {0,
nullptr, 0,
nullptr,
nullptr},
58 const float axis_limit =
DEG2RADF(45 / 3);
62 float viewquat_inv[4];
63 float zaxis[3] = {0, 0, 1};
73 for (
x = -1;
x < 2;
x++) {
74 for (
y = -1;
y < 2;
y++) {
75 for (
z = -1;
z < 2;
z++) {
93 float quat_roll[4], quat_final[4], quat_best[4], quat_snap[4];
94 float viewquat_align[4];
95 float viewquat_align_inv[4];
96 float best_angle = axis_limit;
115 for (j = 0; j < 8; j++) {
117 float xaxis1[3] = {1, 0, 0};
118 float xaxis2[3] = {1, 0, 0};
119 float quat_final_inv[4];
133 if (
angle <= best_angle) {
162 rv3d->
persp = vod->
init.persp_with_auto_persp_applied;
173 float axis[3], q1[4], dvec[3], newvec[3];
177 const int event_xy_offset[2] = {
178 event_xy[0] + vod->
init.event_xy_offset[0],
179 event_xy[1] + vod->
init.event_xy_offset[1],
190 angle *=
U.view_rotate_sensitivity_trackball;
207 float quat_local_x[4], quat_global_z[4];
210 const float zvec_global[3] = {0.0f, 0.0f, 1.0f};
214 const float sensitivity =
U.view_rotate_sensitivity_turntable /
UI_SCALE_FAC;
250 if (
dot_v3v3(xaxis, m_inv[0]) < 0) {
254 fac =
fabsf(fac - 0.5f) * 2;
274 quat_global_z,
'Z', sensitivity * vod->
reverse * (event_xy[0] - vod->
prev.event_xy[0]));
292 vod->
prev.event_xy[0] = event_xy[0];
293 vod->
prev.event_xy[1] = event_xy[1];
305 bool use_autokey =
false;
308 switch (event_code) {
355 m_xy[0] = 2 *
event->xy[0] -
event->prev_xy[0];
356 m_xy[1] = 2 *
event->xy[1] -
event->prev_xy[1];
378 ot->
name =
"Rotate View";
#define RV3D_VIEW_IS_AXIS(view)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
bool ED_view3d_camera_lock_autokey(View3D *v3d, RegionView3D *rv3d, bContext *C, bool do_rotate, bool do_translate)
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
bool ED_view3d_quat_to_axis_view_and_reset_quat(float quat[4], float epsilon, eRegionView3D_View *r_view, eRegionView3D_ViewAxisRoll *r_view_axis_roll)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
static void viewrotate_apply(ViewOpsData *vod, const int event_xy[2])
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void viewrotate_apply_dyn_ofs(ViewOpsData *vod, const float viewquat_new[4])
void viewrotate_modal_keymap(wmKeyConfig *keyconf)
void vec_to_quat(float q[4], const float vec[3], short axis, short upflag)
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
void view3d_operator_properties_common(wmOperatorType *ot, const enum eV3D_OpPropFlag flag)
float normalize_qt(float q[4])
bool ED_view3d_camera_lock_sync(const Depsgraph *depsgraph, View3D *v3d, RegionView3D *rv3d)
float angle_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
static void viewrotate_apply_snap(ViewOpsData *vod)
void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
static wmOperatorStatus viewrotate_modal_impl(bContext *C, ViewOpsData *vod, const eV3D_OpEvent event_code, const int xy[2])
void mul_qt_qtqt(float q[4], const float a[4], const float b[4])
void VIEW3D_OT_rotate(wmOperatorType *ot)
void ED_region_tag_redraw(ARegion *region)
void mul_qt_v3(const float q[4], float r[3])
void quat_to_mat3(float m[3][3], const float q[4])
wmOperatorStatus view3d_navigate_invoke_impl(bContext *C, wmOperator *op, const wmEvent *event, const ViewOpsType *nav_type)
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
static wmOperatorStatus viewrotate_invoke_impl(bContext *C, ViewOpsData *vod, const wmEvent *event, PointerRNA *)
void copy_qt_qt(float q[4], const float a[4])
wmWindowManager * CTX_wm_manager(const bContext *C)
const ViewOpsType ViewOpsType_rotate
void axis_angle_to_quat_single(float q[4], char axis, float angle)
void invert_qt_normalized(float q[4])
MINLINE void negate_v3(float r[3])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void calctrackballvec(const rcti *rect, const int event_xy[2], float r_dir[3])
bool view3d_rotation_poll(bContext *C)
@ VIEWOPS_FLAG_DEPTH_NAVIGATE
@ VIEWOPS_FLAG_ORBIT_SELECT
@ VIEWOPS_FLAG_PERSP_ENSURE
@ VIEWROT_MODAL_AXIS_SNAP_ENABLE
@ VIEWROT_MODAL_AXIS_SNAP_DISABLE
@ VIEWROT_MODAL_SWITCH_MOVE
@ VIEWROT_MODAL_SWITCH_ZOOM
MINLINE float normalize_v3(float n[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void view3d_navigate_cancel_fn(bContext *C, wmOperator *op)
static wmOperatorStatus viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
@ V3D_OP_PROP_USE_MOUSE_INIT
void invert_qt_qt_normalized(float q1[4], const float q2[4])
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
bScreen * ED_screen_animation_playing(const wmWindowManager *wm)
float angle_wrap_rad(float angle)
wmOperatorStatus view3d_navigate_modal_fn(bContext *C, wmOperator *op, const wmEvent *event)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eRegionView3D_ViewAxisRoll view_axis_roll
eRegionView3D_Persp persp
struct blender::ViewOpsData::@013213354235237006300365026145043140112021271057 prev
bool use_dyn_ofs_ortho_correction
struct blender::ViewOpsData::@337054214024237015354033064215073157327063021373 curr
struct blender::ViewOpsData::@130157306301264131203124134151333300254160116071 init
void(*) cancel(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
#define V3D_OP_TRACKBALLSIZE