Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2019-10-08 14:53:27 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2019-10-08 17:26:37 +0300
commit7a1847f0e9fdeec8276ec3f274b4eb74b7956063 (patch)
tree7b50a6392999bf5bff318d87965cfe3361a2437d /source/blender/editors/space_view3d/view3d_walk.c
parent054ab92f8b2caa795162765dee08f749563994c7 (diff)
Fix T70585: Walk Navigation keyframe tweaks (still frame)
Walk Navigation was missing rotation keyframes on confirm (when animation wasnt playing) after rB22bdd08dfd0. Because for walk [in contrast to fly], the cursor is constantly warped (WM_cursor_warp in walkEvent), we cant do something reasonable with comparing mouse positions (to detect rotation) when mouse comes to rest. Now remember if rotation changed at any time. Also tweaked the insertion for location keyframes (which was always happening even if the camera did not move), now checking the real dvec (instead on relying on speed) Reviewed By: dfelinto Maniphest Tasks: T70585 Differential Revision: https://developer.blender.org/D6018
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_walk.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index ac9ad30d719..a7402a622d5 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -204,6 +204,8 @@ typedef struct WalkInfo {
* (this would need to un-key all previous frames).
*/
bool anim_playing;
+ bool need_rotation_keyframe;
+ bool need_translation_keyframe;
/** Previous 2D mouse values. */
int prev_mval[2];
@@ -538,6 +540,8 @@ static bool initWalkInfo(bContext *C, WalkInfo *walk, wmOperator *op)
#endif
walk->anim_playing = ED_screen_animation_playing(wm);
+ walk->need_rotation_keyframe = false;
+ walk->need_translation_keyframe = false;
walk->time_lastdraw = PIL_check_seconds_timer();
@@ -930,9 +934,12 @@ static void walkMoveCamera(bContext *C,
/* we only consider autokeying on playback or if user confirmed walk on the same frame
* otherwise we get a keyframe even if the user cancels. */
const bool use_autokey = is_confirm || walk->anim_playing;
-
ED_view3d_cameracontrol_update(
walk->v3d_camera_control, use_autokey, C, do_rotate, do_translate);
+ if (use_autokey) {
+ walk->need_rotation_keyframe = false;
+ walk->need_translation_keyframe = false;
+ }
}
static float getFreeFallDistance(const float gravity, const float time)
@@ -1280,9 +1287,10 @@ static int walkApply(bContext *C, WalkInfo *walk, bool is_confirm)
add_v3_v3(rv3d->ofs, dvec_tmp);
if (rv3d->persp == RV3D_CAMOB) {
- const bool do_rotate = (moffset[0] || moffset[1]);
- const bool do_translate = (walk->speed != 0.0f);
- walkMoveCamera(C, walk, do_rotate, do_translate, is_confirm);
+ walk->need_rotation_keyframe |= (moffset[0] || moffset[1]);
+ walk->need_translation_keyframe |= (len_squared_v3(dvec_tmp) > FLT_EPSILON);
+ walkMoveCamera(
+ C, walk, walk->need_rotation_keyframe, walk->need_translation_keyframe, is_confirm);
}
}
else {
@@ -1322,7 +1330,10 @@ static void walkApply_ndof(bContext *C, WalkInfo *walk, bool is_confirm)
walk->redraw = true;
if (walk->rv3d->persp == RV3D_CAMOB) {
- walkMoveCamera(C, walk, has_rotate, has_translate, is_confirm);
+ walk->need_rotation_keyframe |= has_rotate;
+ walk->need_translation_keyframe |= has_translate;
+ walkMoveCamera(
+ C, walk, walk->need_rotation_keyframe, walk->need_translation_keyframe, is_confirm);
}
}
}