Fix: Inserting keys no longer sets the FCurve channel color #115297

Merged
Christoph Lendenfeld merged 4 commits from ChrisLend/blender:fix_fcurve_color into main 2023-11-24 13:05:19 +01:00

When pressing I in the viewport, the colors of the FCurve channels were no longer set correctly.

Caused by #113504: Anim: Insert keyframes without keying sets

Fix by removing the flag that determined that in the first place,
and read straight from the user preferences. Then move the code
that sets the mode on the FCurve into the function that actually creates it.

For 99% of cases the code went to the user preference flag AUTOKEY_FLAG_XYZ2RGB
and if that was set, the INSERTKEY_XYZ2RGB would be set. The only case where this
was not from the user preferences was from custom keying sets.
There was an override flag for FCurve colors on custom keying sets.
I removed that with this patch since the use case is not apparent
and custom keying sets are hardly used.

When pressing `I` in the viewport, the colors of the FCurve channels were no longer set correctly. Caused by [#113504: Anim: Insert keyframes without keying sets](https://projects.blender.org/blender/blender/pulls/113504) Fix by removing the flag that determined that in the first place, and read straight from the user preferences. Then move the code that sets the mode on the FCurve into the function that actually creates it. For 99% of cases the code went to the user preference flag `AUTOKEY_FLAG_XYZ2RGB` and if that was set, the `INSERTKEY_XYZ2RGB` would be set. The only case where this was not from the user preferences was from custom keying sets. There was an override flag for FCurve colors on custom keying sets. I removed that with this patch since the use case is not apparent and custom keying sets are hardly used.
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2023-11-23 12:54:36 +01:00
Christoph Lendenfeld added 1 commit 2023-11-23 12:54:49 +01:00
Christoph Lendenfeld requested review from Nathan Vegdahl 2023-11-23 12:55:21 +01:00
Christoph Lendenfeld added 1 commit 2023-11-23 13:18:14 +01:00
Christoph Lendenfeld added 1 commit 2023-11-23 13:23:35 +01:00
Christoph Lendenfeld added 1 commit 2023-11-23 16:50:16 +01:00
Nathan Vegdahl approved these changes 2023-11-24 12:33:37 +01:00
Nathan Vegdahl left a comment
Member

Looks good to me! I just have one comment, but it might be best to address it in a separate cleanup PR.

Looks good to me! I just have one comment, but it might be best to address it in a separate cleanup PR.
@ -57,6 +60,22 @@ FCurve *action_fcurve_ensure(Main *bmain,
fcu->rna_path = BLI_strdup(rna_path);
fcu->array_index = array_index;
if (U.autokey_flag & AUTOKEY_FLAG_XYZ2RGB) {
Member

It feels weird to me that this is in autokey_flag when it's not specific to auto keying. I think this should be cleaned up to put the flag in a more obviously "for all keying" place, but not sure if that belongs in this PR or if it should be a separate cleanup PR. I'll leave that up to you.

It feels weird to me that this is in `autokey_flag` when it's not specific to auto keying. I think this should be cleaned up to put the flag in a more obviously "for all keying" place, but not sure if that belongs in this PR or if it should be a separate cleanup PR. I'll leave that up to you.
Author
Member

I feel the same but I'll leave that for a separate PR
do you know if there are any issues with versioning when renaming that?

I feel the same but I'll leave that for a separate PR do you know if there are any issues with versioning when renaming that?
Member

As I understand it, if you just rename a DNA field without doing anything else, DNA sees that as removing the old field and creating a new unrelated one. So if you just e.g. rename autokey_flag -> keying_flag or something like that, then loading older files would ignore whatever was in autokey_flag and end up with whatever the default flags are.

However, I was imagining keeping autokey_flag for auto-key specific flags, and instead moving just that one flag to somewhere more appropriate. Maybe a new keying_flag field. And then in the versioning code you could check autokey_flag for that one flag to move it over. Or something like that.

Having said that, I haven't looked super closely at it, so maybe there are reasons to take another approach. But that's what I'm thinking off the top of my head, at least.

As I understand it, if you just rename a DNA field without doing anything else, DNA sees that as removing the old field and creating a new unrelated one. So if you just e.g. rename `autokey_flag` -> `keying_flag` or something like that, then loading older files would ignore whatever was in `autokey_flag` and end up with whatever the default flags are. However, I was imagining keeping `autokey_flag` for auto-key specific flags, and instead moving just that one flag to somewhere more appropriate. Maybe a new `keying_flag` field. And then in the versioning code you could check `autokey_flag` for that one flag to move it over. Or something like that. Having said that, I haven't looked super closely at it, so maybe there are reasons to take another approach. But that's what I'm thinking off the top of my head, at least.
Author
Member

thanks for the insight :)
Yeah splitting the flag would also work. I'll see what I am going to do when I get to it

thanks for the insight :) Yeah splitting the flag would also work. I'll see what I am going to do when I get to it
Christoph Lendenfeld merged commit 30b0c5b225 into main 2023-11-24 13:05:19 +01:00
Christoph Lendenfeld deleted branch fix_fcurve_color 2023-11-24 13:05:22 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
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
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#115297
No description provided.