Page MenuHome

VSE preview transform autokeying improvements
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on May 27 2022, 3:53 PM.

Details

Summary
NOTE: this patch originated in T98015 which was split into multiple reports. While it could be split into multiple patches these are very much related so keeping as one for now

Test builds: https://builder.blender.org/download/patch/D15047/

This patch fixes the following issues:

[1] autokeying transforms in preview only creates keyframes if there is
an FCurve already
[2] autokeying transforms in preview only creates keyframes for
rotation/scale if rotating/scaling around cursor (should keyframe
position as well)
[3] autokeying transforms in preview does not work during animation
playback

For [1], a param was added to ED_autokeyframe_property which can tweak
its default behavior of only creating keyframes on already keyed
properties (which was fine because this is mostly called from buttons
where this behavior is desired). Callers such as gizmos (or the VSE in
our case) can use this additional param so that keyframes are also
created on "not-yet-keyframed" properties.

For [2], the pivot is checked and position properties also keyed if
necessary (which is also consistent with the way objects are keyed in
the 3DView)

For [3], animrecord_check_state was changed to be able to work on
scenes as well and the transform system in the VSE preview was made
aware of the screen's animtimer.

NOTE: there are still things to be improved for keyframing in the VSE, the most obvious is probably a keyframe_insert operator (with keyingsets)

Fixes T98429, T98430, T98431

Diff Detail

Repository
rB Blender

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.May 27 2022, 3:53 PM
Philipp Oeser (lichtwerk) created this revision.

When checking functionality, I got crash after transformation if no keyframes were present - null dereference of fcu. Don't see fcurve created anywhere in this patch too.

When checking functionality, I got crash after transformation if no keyframes were present - null dereference of fcu.

Cannot repro, are you testing a Debug build?

Don't see fcurve created anywhere in this patch too.

This is eventually done by insert_keyframe

fix flipped condition for assert (Debug builds)

This revision is now accepted and ready to land.May 31 2022, 4:58 AM
source/blender/editors/include/ED_keyframing.h
664

Can the parameter be called only_if_property_keyed or something like this?

Philipp Oeser (lichtwerk) marked an inline comment as done.May 31 2022, 12:35 PM
Sybren A. Stüvel (sybren) requested changes to this revision.Jun 2 2022, 5:08 PM
Sybren A. Stüvel (sybren) added inline comments.
source/blender/editors/animation/keyframing.c
3122–3124

This logic is confusing. Here only_if_property_keyed is set to true, but the check if (only_if_property_keyed) { further down can only be reached if (driven || special) is false. This means that setting the variable here to true is only done for the immediately following condition, but not for the other use of the same variable.

I'm not a fan of boolean parameters in the first place, but having them change semantics throughout the function is really not a good idea.

Declare the parameter as const bool, and change the condition on the next line to

if (fcu == NULL && (driven || special || only_if_property_keyed)) {
  return changed;
}
3159

path is only used when fcu == NULL, so it's a bit inefficient to allocate memory, build the path, and free the memory again, when it's not going to be used.

source/blender/editors/include/ED_keyframing.h
665

Space after period

source/blender/editors/transform/transform_convert_sequencer_image.c
160

const

166–183

I think this is expressed in a clearer way like this:

const bool around_cursor = scene->toolsettings->sequencer_tool_settings->pivot_point ==
                           V3D_AROUND_CURSOR;
const bool do_loc = tmode == TFM_TRANSLATION || around_cursor;
const bool do_rot = tmode == TFM_ROTATION;
const bool do_scale = tmode == TFM_RESIZE;

That way you can use const bool instead of bool, and it's much simpler to see when a certain do_xxx is set or not.

This revision now requires changes to proceed.Jun 2 2022, 5:08 PM

address review comments

Sybren A. Stüvel (sybren) accepted this revision.EditedJun 3 2022, 3:30 PM

Just a small change; MEM_SAFE_FREE(x) is pretty much the same as the current code, but easier to read.

No need to re-review after changing.

source/blender/editors/animation/keyframing.c
3178–3181

MEM_SAFE_FREE(path);

This revision is now accepted and ready to land.Jun 3 2022, 3:30 PM