Anim: make "XYZ to RGB" user preference work for layered actions #123022

Merged
Nathan Vegdahl merged 5 commits from nathanvegdahl/blender:baklava_xyz_to_rgb into main 2024-06-20 14:05:28 +02:00
Member

The approach taken here is to pass an optional PropertySubType parameter down
the call chain from insert_key_layered_action() and terminating at
create_fcurve_for_channel(), which uses it to determine the color mode for
new fcurves.

The parameter is optional to allow other callers (e.g. Python RNA functions)
to skip passing it, in which case any new fcurves will get the default rainbow
coloration.

Note to reviewers: I would like to land #122053 before this, just to avoid unnecessary risk of churn on that (more complex) PR.

The approach taken here is to pass an optional `PropertySubType` parameter down the call chain from `insert_key_layered_action()` and terminating at `create_fcurve_for_channel()`, which uses it to determine the color mode for new fcurves. The parameter is optional to allow other callers (e.g. Python RNA functions) to skip passing it, in which case any new fcurves will get the default rainbow coloration. Note to reviewers: I would like to land #122053 before this, just to avoid unnecessary risk of churn on that (more complex) PR.
Nathan Vegdahl added the
Module
Animation & Rigging
label 2024-06-10 17:17:04 +02:00
Nathan Vegdahl added 1 commit 2024-06-10 17:17:15 +02:00
Nathan Vegdahl added 1 commit 2024-06-10 17:57:43 +02:00
Nathan Vegdahl added 1 commit 2024-06-10 18:04:35 +02:00
Nathan Vegdahl added 1 commit 2024-06-10 18:08:55 +02:00
Nathan Vegdahl changed title from WIP: Anim: make "XYZ to RGB" user preference work for layered actions to Anim: make "XYZ to RGB" user preference work for layered actions 2024-06-10 18:18:19 +02:00
Nathan Vegdahl requested review from Sybren A. Stüvel 2024-06-10 18:18:36 +02:00
Nathan Vegdahl requested review from Christoph Lendenfeld 2024-06-10 18:18:43 +02:00
Christoph Lendenfeld approved these changes 2024-06-11 10:33:38 +02:00
Christoph Lendenfeld left a comment
Member

I am not super happy that we have to pass around this optional parameter that much.
But I see why you did it that way and I don't know a better way to pass the info around.
I guess the proper fix would be to refactor the color mode completely.

I am not super happy that we have to pass around this optional parameter that much. But I see why you did it that way and I don't know a better way to pass the info around. I guess the proper fix would be to refactor the color mode completely.
Author
Member

Yeah, I'm also not happy about that. But it seemed like the least bad option under the circumstances.

Indeed, I think it's weird that the fcurve colors are a stored property that's determined upon fcurve creation in the first place. The colors should be computed on the fly while rendering, IMO. And then when the user changes e.g. the "XYZ to RGB" preference, all curves would properly change to match. And getting someone else's file wouldn't lock you in to their fcurve color preferences. But that's a bigger change for the future.

Yeah, I'm also not happy about that. But it seemed like the least bad option under the circumstances. Indeed, I think it's weird that the fcurve colors are a stored property that's determined upon fcurve creation in the first place. The colors should be computed on the fly while rendering, IMO. And then when the user changes e.g. the "XYZ to RGB" preference, all curves would properly change to match. And getting someone else's file wouldn't lock you in to their fcurve color preferences. But that's a bigger change for the future.
Sybren A. Stüvel reviewed 2024-06-11 12:35:43 +02:00
Sybren A. Stüvel left a comment
Member

Would it make sense to include the std::optional<PropertySubType> prop_subtype in the KeyframeSettings struct? It would be slightly out of scope (it's not a "setting of a key" bit of data), but it would at least prevent all the functions that need to pass both from getting extended with yet another parameter (which is what the struct was intended for). And it would prevent the std::nullopt that's now added to so many places.

Would it make sense to include the `std::optional<PropertySubType> prop_subtype` in the `KeyframeSettings` struct? It would be slightly out of scope (it's not a "setting of a key" bit of data), but it would at least prevent all the functions that need to pass both from getting extended with yet another parameter (which is what the struct was intended for). And it would prevent the `std::nullopt` that's now added to so many places.
Sybren A. Stüvel requested review from Sybren A. Stüvel 2024-06-11 12:36:21 +02:00
Author
Member

@dr.sybren I think I would be even less happy with that solution, personally. It seems like an unexpected place for it to be, and I suspect that would make it rather "hidden" to people not already familiar with the code. Hiding details so people can focus on the high level is often a good thing, but I mean hiding in the sense of "I can't find it when I need it".

@dr.sybren I think I would be even less happy with that solution, personally. It seems like an unexpected place for it to be, and I suspect that would make it rather "hidden" to people not already familiar with the code. Hiding details so people can focus on the high level is often a good thing, but I mean hiding in the sense of "I can't find it when I need it".
Nathan Vegdahl added 1 commit 2024-06-11 17:23:26 +02:00
Merge branch 'main' into baklava_xyz_to_rgb
All checks were successful
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
2ea3ce2cab

Just to jot down what we discussed face-to-face:

  • I agree with Nathan's point above ("settings for the new key" and "settings for the new fcurve" are semantically different), and he agrees that this parameter is still very often relevant for keying functions.
  • He's going to rename the KeyframeSettings struct so that it encompasses both "settings for the new …" uses, so that things fit. That'll be a new PR.
Just to jot down what we discussed face-to-face: - I agree with Nathan's point above ("settings for the new key" and "settings for the new fcurve" are semantically different), and he agrees that this parameter is still very often relevant for keying functions. - He's going to rename the `KeyframeSettings` struct so that it encompasses both "settings for the new …" uses, so that things fit. That'll be a new PR.
Author
Member

After investigating folding the PropertySubType parameter into KeyframeSettings, it became clear that it would be rather awkward after all. However, it does make sense to instead fold it into a new struct along with the rna path and index parameters, effectively creating an "all the info we need to look up or create the appropriate fcurve" struct.

I discussed this with @dr.sybren in person last Friday, and suggested that it would make sense to first land this PR as-is, and then create and use the aforementioned struct in a follow up PR. He was at least okay with that, so that's what I'll be doing.

After investigating folding the `PropertySubType` parameter into `KeyframeSettings`, it became clear that it would be rather awkward after all. However, it *does* make sense to instead fold it into a new struct along with the rna path and index parameters, effectively creating an "all the info we need to look up or create the appropriate fcurve" struct. I discussed this with @dr.sybren in person last Friday, and suggested that it would make sense to first land this PR as-is, and then create and use the aforementioned struct in a follow up PR. He was at least okay with that, so that's what I'll be doing.
Author
Member

@blender-bot build

@blender-bot build
Sybren A. Stüvel approved these changes 2024-06-18 09:21:05 +02:00
Nathan Vegdahl merged commit 3ab3ac1b0a into main 2024-06-20 14:05:28 +02:00
Nathan Vegdahl deleted branch baklava_xyz_to_rgb 2024-06-20 14:05:41 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
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
Asset Browser Project
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
3 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#123022
No description provided.