Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-08-21 16:42:26 +0300
committerJacques Lucke <jacques@blender.org>2020-08-21 16:42:26 +0300
commitbed634c4f96cac7b1afaccc1ff646fc22f3efb29 (patch)
tree95bd87ada9c4fe9e751295e7173788356df8984b /source/blender/blenloader
parent71634d94ca4ce2b838206144089010a16bb3f1ff (diff)
Refactor: move nla code from blenloader to blenkernel
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c81
-rw-r--r--source/blender/blenloader/intern/writefile.c28
2 files changed, 5 insertions, 104 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a5e20a56475..a99f847d96e 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -141,6 +141,7 @@
#include "BKE_mesh_runtime.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
+#include "BKE_nla.h"
#include "BKE_node.h" // for tree type defines
#include "BKE_object.h"
#include "BKE_paint.h"
@@ -2757,60 +2758,6 @@ static void direct_link_action(BlendDataReader *reader, bAction *act)
}
}
-static void lib_link_nladata_strips(BlendLibReader *reader, ID *id, ListBase *list)
-{
- LISTBASE_FOREACH (NlaStrip *, strip, list) {
- /* check strip's children */
- lib_link_nladata_strips(reader, id, &strip->strips);
-
- /* check strip's F-Curves */
- BKE_fcurve_blend_lib_read(reader, id, &strip->fcurves);
-
- /* reassign the counted-reference to action */
- BLO_read_id_address(reader, id->lib, &strip->act);
- }
-}
-
-static void lib_link_nladata(BlendLibReader *reader, ID *id, ListBase *list)
-{
- /* we only care about the NLA strips inside the tracks */
- LISTBASE_FOREACH (NlaTrack *, nlt, list) {
- lib_link_nladata_strips(reader, id, &nlt->strips);
- }
-}
-
-/* This handles Animato NLA-Strips linking
- * NOTE: this assumes that link_list has already been called on the list
- */
-static void direct_link_nladata_strips(BlendDataReader *reader, ListBase *list)
-{
- LISTBASE_FOREACH (NlaStrip *, strip, list) {
- /* strip's child strips */
- BLO_read_list(reader, &strip->strips);
- direct_link_nladata_strips(reader, &strip->strips);
-
- /* strip's F-Curves */
- BLO_read_list(reader, &strip->fcurves);
- BKE_fcurve_blend_data_read(reader, &strip->fcurves);
-
- /* strip's F-Modifiers */
- BLO_read_list(reader, &strip->modifiers);
- BKE_fmodifiers_blend_data_read(reader, &strip->modifiers, NULL);
- }
-}
-
-/* NOTE: this assumes that BLO_read_list has already been called on the list */
-static void direct_link_nladata(BlendDataReader *reader, ListBase *list)
-{
- LISTBASE_FOREACH (NlaTrack *, nlt, list) {
- /* relink list of strips */
- BLO_read_list(reader, &nlt->strips);
-
- /* relink strip data */
- direct_link_nladata_strips(reader, &nlt->strips);
- }
-}
-
/* ------- */
static void lib_link_keyingsets(BlendLibReader *reader, ID *id, ListBase *list)
@@ -2856,7 +2803,7 @@ static void lib_link_animdata(BlendLibReader *reader, ID *id, AnimData *adt)
/* overrides don't have lib-link for now, so no need to do anything */
/* link NLA-data */
- lib_link_nladata(reader, id, &adt->nla_tracks);
+ BKE_nla_blend_lib_read(reader, id, &adt->nla_tracks);
}
static void direct_link_animdata(BlendDataReader *reader, AnimData *adt)
@@ -2876,7 +2823,7 @@ static void direct_link_animdata(BlendDataReader *reader, AnimData *adt)
/* link NLA-data */
BLO_read_list(reader, &adt->nla_tracks);
- direct_link_nladata(reader, &adt->nla_tracks);
+ BKE_nla_blend_data_read(reader, &adt->nla_tracks);
/* relink active track/strip - even though strictly speaking this should only be used
* if we're in 'tweaking mode', we need to be able to have this loaded back for
@@ -9777,23 +9724,6 @@ static void expand_constraint_channels(BlendExpander *expander, ListBase *chanba
}
}
-static void expand_animdata_nlastrips(BlendExpander *expander, ListBase *list)
-{
- LISTBASE_FOREACH (NlaStrip *, strip, list) {
- /* check child strips */
- expand_animdata_nlastrips(expander, &strip->strips);
-
- /* check F-Curves */
- BKE_fcurve_blend_expand(expander, &strip->fcurves);
-
- /* check F-Modifiers */
- BKE_fmodifiers_blend_expand(expander, &strip->modifiers);
-
- /* relink referenced action */
- BLO_expand(expander, strip->act);
- }
-}
-
static void expand_animdata(BlendExpander *expander, AnimData *adt)
{
/* own action */
@@ -9802,11 +9732,6 @@ static void expand_animdata(BlendExpander *expander, AnimData *adt)
/* drivers - assume that these F-Curves have driver data to be in this list... */
BKE_fcurve_blend_expand(expander, &adt->drivers);
-
- /* nla-data - referenced actions */
- LISTBASE_FOREACH (NlaTrack *, nlt, &adt->nla_tracks) {
- expand_animdata_nlastrips(expander, &nlt->strips);
- }
}
static void expand_id(BlendExpander *expander, ID *id);
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 1c6c70bab6d..9aac713668e 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -171,6 +171,7 @@
#include "BKE_lib_override.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
+#include "BKE_nla.h"
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_pointcache.h"
@@ -744,31 +745,6 @@ static void write_keyingsets(BlendWriter *writer, ListBase *list)
}
}
-static void write_nlastrips(BlendWriter *writer, ListBase *strips)
-{
- BLO_write_struct_list(writer, NlaStrip, strips);
- LISTBASE_FOREACH (NlaStrip *, strip, strips) {
- /* write the strip's F-Curves and modifiers */
- BKE_fcurve_blend_write(writer, &strip->fcurves);
- BKE_fmodifiers_blend_write(writer, &strip->modifiers);
-
- /* write the strip's children */
- write_nlastrips(writer, &strip->strips);
- }
-}
-
-static void write_nladata(BlendWriter *writer, ListBase *nlabase)
-{
- /* write all the tracks */
- LISTBASE_FOREACH (NlaTrack *, nlt, nlabase) {
- /* write the track first */
- BLO_write_struct(writer, NlaTrack, nlt);
-
- /* write the track's strips */
- write_nlastrips(writer, &nlt->strips);
- }
-}
-
static void write_animdata(BlendWriter *writer, AnimData *adt)
{
/* firstly, just write the AnimData block */
@@ -788,7 +764,7 @@ static void write_animdata(BlendWriter *writer, AnimData *adt)
// TODO write the remaps (if they are needed)
/* write NLA data */
- write_nladata(writer, &adt->nla_tracks);
+ BKE_nla_blend_write(writer, &adt->nla_tracks);
}
static void write_node_socket_default_value(BlendWriter *writer, bNodeSocket *sock)