Fix: Autokeyframe with Insert Needed with no keyframes #116219
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#116219
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChrisLend/blender:fix_autokeyframe_keyed_channels"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Caused by #115522: Anim: Don't use keying sets when inserting keyframes during autokeying
The issue occurs when auto-keyframe AND "Only Insert Needed" enabled.
And only when no keyframes have been added yet.
Before the commit that caused the issue, moving an object with
G
wouldcreate only location keyframes. After it would key all.
That is because that commit removed the logic that checks the
eTfmMode
(Transform mode). That only works as long as there are alreadykeyframes on the object/bone because the logic needs an
existing value to compare against. In the case where the first keyframe is set,
it would always key everything.
The fix is to bring back the logic that checks the Transform mode and pass
a
Span
of rna paths to the autokeyframe function. This restores the behavior.This still has the issue that "Only Insert Needed" behaves differently if
keys exist vs inserting the first keys. While this isn't ideal, I don't see a way
to get values of an object/bone before and after the transformation.
We might be able to fix this in a future PR, but for now we restore the
old behavior.
👍 for the reasoning behind this PR.
I think some of the code is just put back pretty much as-is, so then I can finally complain about its state ;-)
Just a few small nags though, nothing shocking. Those can be addressed when landing.
@ -143,3 +143,3 @@
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id);
void autokeyframe_object(bContext *C, Scene *scene, Object *ob);
void autokeyframe_object(bContext *C, Scene *scene, Object *ob, Span<std::string> rna_paths);
Maybe add some documentation for the
rna_paths
parameter. It's otherwise hard to know whether it's "always key all these paths" or "never key anything outside this set".@ -163,0 +163,4 @@
Scene *scene,
Object *ob,
bPoseChannel *pose_channel,
Span<std::string> rna_paths,
Same request as above, to document
rna_paths
. I think the rest is either already documented or clear enough from the context.@ -17,2 +18,4 @@
Vector<float> get_rna_values(PointerRNA *ptr, PropertyRNA *prop);
/** Helper function to get the rna path for the given rotation mode. */
std::string get_rotation_mode_path(eRotationModes rotation_mode);
"Helper function to" can be removed; "Get the rna path for the given rotation mode." is clear enough.
@ -69,2 +70,4 @@
return values;
}
std::string get_rotation_mode_path(const eRotationModes rotation_mode)
Low prio: this might not need to be
std::string
, maybestd::string_view
orblender::StringRef
works just as well, and avoids a copy.Not for this PR though, as just moving the function as-is is better here.
@ -200,3 +187,3 @@
}
void autokeyframe_pose(bContext *C, Scene *scene, Object *ob, short targetless_ik)
void autokeyframe_pose_channel(bContext *C,
This function now grabs stuff from the context and creates the
AnimationEvalContext
for every pose channel:For this PR I think this is fine, but it might be worth looking into creating some
AutoKeyframeContext
struct that contains all of those, and pass that into this function instead.In the long term I'd like to remove the need for
AnimationEvalContext
from this function entirely@ -1268,1 +1269,4 @@
static blender::Vector<std::string> get_modified_rna_paths(const eTfmMode tmode,
ToolSettings *toolsettings,
std::string &rotation_path,
rotation_path
can be ablender::StringRef
.@ -1269,0 +1273,4 @@
const bool targetless_ik)
{
blender::Vector<std::string> rna_paths;
if (tmode == TFM_TRANSLATION) {
This should be a
switch (tmode)
instead.@ -1269,0 +1315,4 @@
}
blender::Vector<std::string> rna_paths;
std::string rotation_path = blender::animrig::get_rotation_mode_path(
const
, and possibly ablender::StringRef
@ -755,6 +756,70 @@ static bool motionpath_need_update_object(Scene *scene, Object *ob)
/** \name Recalc Data object
* \{ */
static blender::Vector<std::string> get_modified_rna_paths(const eTfmMode tmode,
The function name could be clearer. It's likely meant as "the RNA paths that were modified by the transform system", but that's only clear once you know what it does. Maybe
rna_paths_touched_by_transform_system
or something along those lines?This code also looks very much dependent on specifics of other areas of the code. I don't think we can totally avoid that without major rewrites of other areas. It would be nice, if it's doable, to add a comment here that explains which function(s) this logic should be in sync with.
named it
get_affected_rna_paths_from_transform_mode
and also used aswitch
here instead of the if/else chainAbout which functions this should be in sync with. Not sure what you mean. You mean that it needs to be in sync with the transform system in general?
Yeah, and with the code as it is now, that's obvious enough 👍