diff options
author | Jacques Lucke <jacques@blender.org> | 2020-09-10 12:17:35 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-09-10 12:17:51 +0300 |
commit | b443f9b54c38570ca6b7cdc25a8eb1f3c97b735e (patch) | |
tree | 76f0a77d391155225377b204ea02bfb7f930eedc /source/blender/blenkernel/intern/anim_sys.c | |
parent | 60b2bb3a1cc24f25f27c5be0f000344703071694 (diff) |
Refactor: move keyingset .blend I/O to blenkernel
Ref T76372
Diffstat (limited to 'source/blender/blenkernel/intern/anim_sys.c')
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index 69e70cffdb2..98c01351f32 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -69,6 +69,8 @@ #include "RNA_access.h" +#include "BLO_read_write.h" + #include "nla_private.h" #include "atomic_ops.h" @@ -308,6 +310,55 @@ void BKE_keyingsets_free(ListBase *list) } } +void BKE_keyingsets_blend_write(BlendWriter *writer, ListBase *list) +{ + LISTBASE_FOREACH (KeyingSet *, ks, list) { + /* KeyingSet */ + BLO_write_struct(writer, KeyingSet, ks); + + /* Paths */ + LISTBASE_FOREACH (KS_Path *, ksp, &ks->paths) { + /* Path */ + BLO_write_struct(writer, KS_Path, ksp); + + if (ksp->rna_path) { + BLO_write_string(writer, ksp->rna_path); + } + } + } +} + +void BKE_keyingsets_blend_read_data(BlendDataReader *reader, ListBase *list) +{ + LISTBASE_FOREACH (KeyingSet *, ks, list) { + /* paths */ + BLO_read_list(reader, &ks->paths); + + LISTBASE_FOREACH (KS_Path *, ksp, &ks->paths) { + /* rna path */ + BLO_read_data_address(reader, &ksp->rna_path); + } + } +} + +void BKE_keyingsets_blend_read_lib(BlendLibReader *reader, ID *id, ListBase *list) +{ + LISTBASE_FOREACH (KeyingSet *, ks, list) { + LISTBASE_FOREACH (KS_Path *, ksp, &ks->paths) { + BLO_read_id_address(reader, id->lib, &ksp->id); + } + } +} + +void BKE_keyingsets_blend_read_expand(BlendExpander *expander, ListBase *list) +{ + LISTBASE_FOREACH (KeyingSet *, ks, list) { + LISTBASE_FOREACH (KS_Path *, ksp, &ks->paths) { + BLO_expand(expander, ksp->id); + } + } +} + /* ***************************************** */ /* Evaluation Data-Setting Backend */ |