Refactor: make evaluate_fcurve()
take its FCurve as const instead of mutable
#121788
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#121788
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "nathanvegdahl/blender:const_fcurve_functions"
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?
This required making a whole bunch of other functions in the call chain
take const parameters as well. It also required changing some function
pointers in some types to take const parameters, which in turn required
changing all the functions that are pointed to by those function
pointers to take const parameters as well.
Additionally, there was one mutable usage of the
FModifier *
parameterin
fcm_cycles_time()
that had to be removed to make the call chainconst. However, this turned out to be a code path that shouldn't be
reachable, and would represent a bug elsewhere. So it was changed to
an assert.
All in all, the non-constness was deep and tangled.
There's still a lot more that we can make const, but I wanted to keep
this change as narrow and focused as possible.
Notes for Reviewers
evaluate_fcurve()
'sFCurve *
parameter const.evaluate_fcurve()
take its FCurve as const instead of mutable faa72df387@ -627,3 +636,3 @@
/* FIXME... */
if (fcm->prev) {
fcm->flag |= FMODIFIER_FLAG_DISABLED;
// fcm->flag |= FMODIFIER_FLAG_DISABLED;
Here is the (likely bogus) change that's otherwise blocking
evaluate_fcurve()
from being const.Looks like this logic would have to be pulled out and put into
evaluate_time_fmodifiers
directly (that's where this code likely should have been from the start).Thanks! That may indeed be the case.
However, that doesn't solve the problem because
evaluate_time_fmodifiers()
also needs to take those parameters as const for this PR. So it might be a good refactor, but isn't what's needed for this PR.Ah you're right indeed.
Looking at
add_fmodifier
, it seems that it's already not possible to add aFMODIFIER_TYPE_CYCLES
after the first one. Maybe this just needs to be an assert instead? Is that code actually ever hit? 😅I agree with @filedescriptor here. I don't think you can have a cycles modifier at any other place than the first one. Changing that out with an assert is a valid option. And in the long run we can maybe remove that limitation altogether.
Yes, also from what I can tell, all codepaths that add an fcurve modifier go through
add_fmodifier
. Even the Python API uses it (seerna_FCurve_modifiers_new
).Make `evaluate_fcurve()` take its FCurve as const instead of mutableto WIP: Make `evaluate_fcurve()` take its FCurve as const instead of mutableContext: this PR was inspired by a comment from @dr.sybren on #120428 (now #121661) about making
new_key_needed()
take a const FCurve reference.WIP: Make `evaluate_fcurve()` take its FCurve as const instead of mutableto Make `evaluate_fcurve()` take its FCurve as const instead of mutable@ChrisLend @filedescriptor I turned that one mutable usage into an assert as suggested. I think this is ready to land, pending a final review.
@blender-bot build
The title should probably be
Refactor:...
but else the PR looks good.Thanks for that, much nicer!
Make `evaluate_fcurve()` take its FCurve as const instead of mutableto Refactor: make `evaluate_fcurve()` take its FCurve as const instead of mutable