Anim: remove strip data as well when an action strip is removed #127837
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
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#127837
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "nathanvegdahl/blender:strip_data_removal"
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 is a follow up to #126559. In that PR, strip data is never deleted even
when the strip that uses it is. Thus, the strip data array just keeps growing as
more strips are added, and never shrinks.
This PR implements that deletion. The approach is simple: remove the strip data
from the array using a swap-remove that swaps in the last item in the data
array, and then loop over the strips in the action to update any that were
referencing that swapped-in item. Additionally, before removal we check to make
sure the data item isn't still being used by any strips, and if it is then we
don't remove it.
WIP: Anim: remove strip data as well when an action strip is removedto Anim: remove strip data as well when an action strip is removedlgtm
on a general note I am not super happy that the action has to be friends with the Strip and the Layer but I don't see that as critical
@ -146,0 +148,4 @@
* elements after the removed item over to fill the gap, it just swaps in the last
* element to where the removed element was.
*/
template<typename T> static void shrink_array_and_swap_remove(T **array, int *num, const int index)
I am a bit surprised those functions don't exist somewhere in Blender already. They seem very generic
Yeah, these should be moved to
DNA_array_utils.hh
at some point, so they can be used throughout the code base. Might be a good thing for me to tackle as part of my work in Q4?LGTM, with a few small notes that can be handled when landing.
@ -360,0 +375,4 @@
*
* \return True on success, false on failure.
*/
bool strip_keyframe_data_remove(int index);
Rename to
strip_keyframe_data_remove_if_unused()
because otherwise I'd definitely expect it to always remove.@ -875,3 +935,4 @@
return false;
}
const Strip::Type strip_type = this->strip(strip_index)->type();
If it's already known that
strip
has that index, why do you do two lookups again? Why not usestrip->type()
andstrip->data_index
here?Because I'm a goofball!
Thanks. :-)
@ -878,3 +941,4 @@
dna::array::remove_index(
&this->strip_array, &this->strip_array_num, nullptr, strip_index, strip_ptr_destructor);
switch (strip_type) {
Add a comment that things are done in this order because otherwise
strip_keyframe_data_remove()
will still see the to-be-removed strip as a user of the data, and not do anything.@ -880,1 +943,4 @@
switch (strip_type) {
case Strip::Type::Keyframe:
owning_action.strip_keyframe_data_remove(data_index);
Why is this function returning a
bool
if it's ignored in the only call site? It's probably clearer once the function is renamed, because then the "if unused" part is more obvious.Yeah, it's not necessary, but seemed like reasonable information to provide to the caller. But you're right, better to keep the API to what's actually used. It's easy to add the return value back in the future if it ends up actually being needed for something.
@blender-bot build