[Bf-blender-cvs] [b44c3ac1e9f] master: Fix/Cleanup: Move some animdata versioning code out of liblinking process.
Bastien Montagne
noreply at git.blender.org
Tue May 26 12:33:38 CEST 2020
Commit: b44c3ac1e9fa48d97c1acb6a45d84647be4ab5f2
Author: Bastien Montagne
Date: Tue May 26 12:25:17 2020 +0200
Branches: master
https://developer.blender.org/rBb44c3ac1e9fa48d97c1acb6a45d84647be4ab5f2
Fix/Cleanup: Move some animdata versioning code out of liblinking process.
This was propably added way before we had the after-lib-link versionning
code, but now doing that sort of fixes at liblink time is bad.
===================================================================
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/versioning_250.c
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 322993f4be5..3b00c004778 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3415,11 +3415,6 @@ static void lib_link_nladata_strips(FileData *fd, ID *id, ListBase *list)
/* reassign the counted-reference to action */
strip->act = newlibadr(fd, id->lib, strip->act);
-
- /* fix action id-root (i.e. if it comes from a pre 2.57 .blend file) */
- if ((strip->act) && (strip->act->idroot == 0)) {
- strip->act->idroot = GS(id->name);
- }
}
}
@@ -3514,14 +3509,6 @@ static void lib_link_animdata(FileData *fd, ID *id, AnimData *adt)
adt->action = newlibadr(fd, id->lib, adt->action);
adt->tmpact = newlibadr(fd, id->lib, adt->tmpact);
- /* fix action id-roots (i.e. if they come from a pre 2.57 .blend file) */
- if ((adt->action) && (adt->action->idroot == 0)) {
- adt->action->idroot = GS(id->name);
- }
- if ((adt->tmpact) && (adt->tmpact->idroot == 0)) {
- adt->tmpact->idroot = GS(id->name);
- }
-
/* link drivers */
lib_link_fcurves(fd, id, &adt->drivers);
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index 62cda5d8feb..a68a366f22b 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -61,6 +61,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
+#include "BKE_anim_data.h"
#include "BKE_anim_visualization.h"
#include "BKE_armature.h"
#include "BKE_colortools.h"
@@ -2352,4 +2353,32 @@ void do_versions_after_linking_250(Main *bmain)
}
FOREACH_NODETREE_END;
}
+
+ if (!MAIN_VERSION_ATLEAST(bmain, 258, 0)) {
+ /* Some very old (original comments claim pre-2.57) versionning that was wrongly done in
+ * lib-linking code... Putting it here just to be sure (this is also checked at runtime anyway
+ * by `action_idcode_patch_check`). */
+ ID *id;
+ FOREACH_MAIN_ID_BEGIN (bmain, id) {
+ AnimData *adt = BKE_animdata_from_id(id);
+ if (adt != NULL) {
+ /* Fix actions' id-roots (i.e. if they come from a pre 2.57 .blend file). */
+ if ((adt->action) && (adt->action->idroot == 0)) {
+ adt->action->idroot = GS(id->name);
+ }
+ if ((adt->tmpact) && (adt->tmpact->idroot == 0)) {
+ adt->tmpact->idroot = GS(id->name);
+ }
+
+ LISTBASE_FOREACH (NlaTrack *, nla_track, &adt->nla_tracks) {
+ LISTBASE_FOREACH (NlaStrip *, nla_strip, &nla_track->strips) {
+ if ((nla_strip->act) && (nla_strip->act->idroot == 0)) {
+ nla_strip->act->idroot = GS(id->name);
+ }
+ }
+ }
+ }
+ }
+ FOREACH_MAIN_ID_END;
+ }
}
More information about the Bf-blender-cvs
mailing list