Fix #119615: Anim, Crash with NLA tweak mode and linked Armatures #119632

Merged

1 Commits

Author SHA1 Message Date
Sybren A. Stüvel cf0a5d1581 Fix #119615: Anim, Crash with NLA tweak mode and linked Armatures
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
Fix a crash when inserting a key with tweak mode enabled, but where
`AnimData::actstrip` was NULL.

The root cause of this is that two pointers in the `AnimData` struct
(`act_track` and `actstrip`) are expected to be set when NLA tweak mode
is enabled, BUT these are not exposed to RNA and thus invisible to the
library overrides system. As such, they are NULL when loading from disk,
while the `ADT_NLA_EDIT_ON` flag still indicates they are to be used.

Rather than adding a NULL pointer check (and having to add that in many
more places), I used this two-pronged approach:

- Extend the 'NLA tweakmode' override apply code, to set the `act_track`
  and `actstrip` pointers when they are incorrectly NULL. This is done
  by lookup of the track and strip by name.
- Add versioning code to exit out of tweak mode whenever the
  `ADT_NLA_EDIT_ON` flag is set, but those two pointers are still NULL.

The last step was necessary with the example file attached to the bug
report, as that was saved with a buggy blender version. New saves work
just fine.
2024-03-19 10:09:16 +01:00