LibOverride: keep some anim data from liboverride when it exists in both IDs. #110900

Closed
Bastien Montagne wants to merge 1 commits from mont29:liboverride-fix-animdata into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

So far when an anim data had to be created in liboverride (because none
existed in reference ID), and reference ID got an anim data added later,
that reference anim data would simply replace the one from the
liboverride, completely losing all animation-related work done so far in
the liboverride.

This commit fixes that, by adding some custom handling of anim data when
there is a liboverride operation defined on the animation_data RNA
property itself.

It then behaves as if everything that is overridable in the existing
liboverride was defined as overrides (and therefore kept), while
everything else is replaced by the reference animdata:

  • Action and temp action are kept.
  • Settings (extend mode, etc.) are kept.
  • Active NLA track and strip are kept, and tracks and strips from the
    liboverride are added at the end of the list of these from the
    reference data.

Note that this behavior is only expected to happen once, on the first
call to 'apply overrides' after anim data has been added to the reference
linked ID. After that, since both IDs have animdata, there should be no
liboverride property defined for the animation_data property itself,
but only for paths leading inside that animdata struct.

Implements #110067.

So far when an anim data had to be created in liboverride (because none existed in reference ID), and reference ID got an anim data added later, that reference anim data would simply replace the one from the liboverride, completely losing all animation-related work done so far in the liboverride. This commit fixes that, by adding some custom handling of anim data when there is a liboverride operation defined on the `animation_data` RNA property itself. It then behaves as if everything that is overridable in the existing liboverride was defined as overrides (and therefore kept), while everything else is replaced by the reference animdata: * Action and temp action are kept. * Settings (extend mode, etc.) are kept. * Active NLA track and strip are kept, and tracks and strips from the liboverride are added at the end of the list of these from the reference data. Note that this behavior is only expected to happen once, on the first call to 'apply overrides' after anim data has been added to the reference linked ID. After that, since both IDs have animdata, there should be no liboverride property defined for the `animation_data` property itself, but only for paths leading inside that animdata struct. Implements #110067.
Bastien Montagne requested review from Sybren A. Stüvel 2023-08-07 19:05:34 +02:00
Bastien Montagne requested review from Nathan Vegdahl 2023-08-07 19:05:56 +02:00
Author
Owner

@SimonThommes you may also be interested in testing this ;)

@SimonThommes you may also be interested in testing this ;)
Nathan Vegdahl added the
Interest
Animation & Rigging
label 2023-08-10 17:04:41 +02:00
Member

Looks good to me, although I certainly have less understanding of overrides than you do. :-)

I think it could use a bit of testing to make sure it behaves the way people generally want. I'll bring it up in the animation & rigging module meeting today and see if I can get some testers. And I'll test myself as well (probably next Monday).

Looks good to me, although I certainly have less understanding of overrides than you do. :-) I think it could use a bit of testing to make sure it behaves the way people generally want. I'll bring it up in the animation & rigging module meeting today and see if I can get some testers. And I'll test myself as well (probably next Monday).
Author
Owner

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR110900) when ready.
Bastien Montagne force-pushed liboverride-fix-animdata from c510924011 to 267db2e309 2023-08-11 12:05:27 +02:00 Compare
Author
Owner

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR110900) when ready.
Member

Just did a first test, and it worked great.

The test included four different object types (mesh, camera, lamp, and armature), and included animating both them and their data blocks in the linking file and then afterwards in the source library file. I also added a driver in the armature in in the library file. Everything worked as I would expect: the animation (actions) in the linking file are maintained, but the new driver from the library was brought over.

And then I realized I didn't try out any NLA stuff. So I'll give that a test next. But at least for basic animation and drivers in a simple test case, it's working as I would expect!

Just did a first test, and it worked great. The test included four different object types (mesh, camera, lamp, and armature), and included animating both them and their data blocks in the linking file and then afterwards in the source library file. I also added a driver in the armature in in the library file. Everything worked as I would expect: the animation (actions) in the linking file are maintained, but the new driver from the library was brought over. And then I realized I didn't try out any NLA stuff. So I'll give that a test next. But at least for basic animation and drivers in a simple test case, it's working as I would expect!
Member

The NLA stuff also works as described: the NLA tracks from the library file get added below the tracks in the linking file.

However, I'm now wondering if that's actually the behavior we want? Maybe we just entirely leave out the tracks from the library file, in the spirit of "this file has already defined its animation"? I'm really not sure, though. Probably best to get feedback on that from people with recent production experience.

The NLA stuff also works as described: the NLA tracks from the library file get added below the tracks in the linking file. However, I'm now wondering if that's actually the behavior we want? Maybe we just entirely leave out the tracks from the library file, in the spirit of "this file has already defined its animation"? I'm really not sure, though. Probably best to get feedback on that from people with recent production experience.
Author
Owner

The NLA stuff also works as described: the NLA tracks from the library file get added below the tracks in the linking file.

However, I'm now wondering if that's actually the behavior we want? Maybe we just entirely leave out the tracks from the library file, in the spirit of "this file has already defined its animation"? I'm really not sure, though. Probably best to get feedback on that from people with recent production experience.

This is the expected behavior of NLA tracks, similar to e.g. modifiers or constraints stacks: new items can be added in liboverrides, on top of existing ones from linked reference data.

Only catch here is that NLA tracks not having unique names, liboverrides have to use indices as references, which is fairly weak and limits liboverrides tracks to always be added after linked ones (unlike modifiers or constraints, where added items can be placed freely in the stack).

> The NLA stuff also works as described: the NLA tracks from the library file get added below the tracks in the linking file. > > However, I'm now wondering if that's actually the behavior we want? Maybe we just entirely leave out the tracks from the library file, in the spirit of "this file has already defined its animation"? I'm really not sure, though. Probably best to get feedback on that from people with recent production experience. This is the expected behavior of NLA tracks, similar to e.g. modifiers or constraints stacks: new items can be added in liboverrides, on top of existing ones from linked reference data. Only catch here is that NLA tracks not having unique names, liboverrides have to use indices as references, which is fairly weak and limits liboverrides tracks to always be added after linked ones (unlike modifiers or constraints, where added items can be placed freely in the stack).
Sybren A. Stüvel approved these changes 2023-08-15 15:15:12 +02:00
Sybren A. Stüvel left a comment
Member

The code LGTM! Just a tiny nag about a comment that can be handled when landing; the comments in general are much appreciated, and make it clear what's going on (and why).

The code LGTM! Just a tiny nag about a comment that can be handled when landing; the comments in general are much appreciated, and make it clear what's going on (and why).
@ -767,0 +771,4 @@
* by keeping the few overridable data from the liboverride, while using the animdata of the
* reference.
*
* Note that this case will not be encountered when the linked reference data already has an

when the linked reference data already has an anim data

Shouldn't this be "had"?

Also I think, since 'data' is uncountable & plural, this should either be "had anim data" or "had an anim data pointer".

> when the linked reference data already **has** an anim data Shouldn't this be "had"? Also I think, since 'data' is uncountable & plural, this should either be "had anim data" or "had an anim data pointer".
mont29 marked this conversation as resolved
Nathan Vegdahl approved these changes 2023-08-15 15:42:30 +02:00
Nathan Vegdahl left a comment
Member

Just gave it one last look over, and it looks good to me too!

Just gave it one last look over, and it looks good to me too!
Author
Owner

Thanks, committed as f188d6709f.

Thanks, committed as f188d6709fc17f75.
Bastien Montagne closed this pull request 2023-08-15 16:06:57 +02:00
Bastien Montagne deleted branch liboverride-fix-animdata 2023-08-15 16:07:09 +02:00
All checks were successful
buildbot/vexp-code-patch-coordinator Build done.

Pull request closed

Sign in to join this conversation.
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
4 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#110900
No description provided.