Anim: set default 'last slot handle' when versioning legacy Actions

Initialise the Action's `last_slot_handle` field to its default value.
The DNA 'defaults' system doesn't do this automatically when versioning
legacy Actions, so now it's done explicitly in the versioning code.

It's fine to only apply this to the existing versioning code, and not as
a new versioning rule. Existing slotted Actions should just keep that
field to whatever it is now.

The default value was introduced in be921b8ddb

Pull Request: https://projects.blender.org/blender/blender/pulls/131498
This commit is contained in:
Sybren A. Stüvel
2024-12-06 17:03:37 +01:00
parent afcad646bf
commit ff0a2d6dbf

View File

@@ -14,6 +14,8 @@
/* Define macros in `DNA_genfile.h`. */
#define DNA_GENFILE_VERSIONING_MACROS
#include "DNA_action_defaults.h"
#include "DNA_action_types.h"
#include "DNA_anim_types.h"
#include "DNA_brush_types.h"
#include "DNA_camera_types.h"
@@ -122,6 +124,10 @@ static void convert_action_in_place(blender::animrig::Action &action)
const int16_t idtype = action.idroot;
action.idroot = 0;
/* Initialise the Action's last_slot_handle field to its default value, before
* we create a new slot. */
action.last_slot_handle = DNA_DEFAULT_ACTION_LAST_SLOT_HANDLE;
Slot &slot = action.slot_add();
slot.idtype = idtype;
slot.identifier_ensure_prefix();