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-09-10 19:00:44 +0300
committerJacques Lucke <jacques@blender.org>2020-09-10 19:01:55 +0300
commit11df9cb9fb7391825220eaa7e4975a298f339674 (patch)
tree25f179032c9312823eb696de6b7f871ce99eca8b /source/blender/blenloader
parentb0741e1dcbc5e4549e95745b1f1b501f8cd33add (diff)
Refactor: move Key .blend I/O to IDTypeInfo callbacks
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c69
-rw-r--r--source/blender/blenloader/intern/writefile.c25
2 files changed, 3 insertions, 91 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 9b8564cf817..3d42330dd4f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2801,59 +2801,6 @@ void blo_do_versions_key_uidgen(Key *key)
}
}
-static void lib_link_key(BlendLibReader *reader, Key *key)
-{
- BLI_assert((key->id.tag & LIB_TAG_EXTERN) == 0);
-
- BLO_read_id_address(reader, key->id.lib, &key->ipo); // XXX deprecated - old animation system
- BLO_read_id_address(reader, key->id.lib, &key->from);
-}
-
-static void switch_endian_keyblock(Key *key, KeyBlock *kb)
-{
- int elemsize = key->elemsize;
- char *data = kb->data;
-
- for (int a = 0; a < kb->totelem; a++) {
- const char *cp = key->elemstr;
- char *poin = data;
-
- while (cp[0]) { /* cp[0] == amount */
- switch (cp[1]) { /* cp[1] = type */
- case IPO_FLOAT:
- case IPO_BPOINT:
- case IPO_BEZTRIPLE: {
- int b = cp[0];
- BLI_endian_switch_float_array((float *)poin, b);
- poin += sizeof(float) * b;
- break;
- }
- }
-
- cp += 2;
- }
- data += elemsize;
- }
-}
-
-static void direct_link_key(BlendDataReader *reader, Key *key)
-{
- BLO_read_list(reader, &(key->block));
-
- BLO_read_data_address(reader, &key->adt);
- BKE_animdata_blend_read_data(reader, key->adt);
-
- BLO_read_data_address(reader, &key->refkey);
-
- LISTBASE_FOREACH (KeyBlock *, kb, &key->block) {
- BLO_read_data_address(reader, &kb->data);
-
- if (BLO_read_requires_endian_switch(reader)) {
- switch_endian_keyblock(key, kb);
- }
- }
-}
-
/** \} */
/* -------------------------------------------------------------------- */
@@ -6689,9 +6636,6 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
case ID_IP:
direct_link_ipo(&reader, (Ipo *)id);
break;
- case ID_KE:
- direct_link_key(&reader, (Key *)id);
- break;
case ID_LI:
direct_link_library(fd, (Library *)id, main);
break;
@@ -6747,6 +6691,7 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
case ID_SPK:
case ID_AR:
case ID_LP:
+ case ID_KE:
/* Do nothing. Handled by IDTypeInfo callback. */
break;
}
@@ -7397,9 +7342,6 @@ static void lib_link_all(FileData *fd, Main *bmain)
case ID_GD:
lib_link_gpencil(&reader, (bGPdata *)id);
break;
- case ID_KE:
- lib_link_key(&reader, (Key *)id);
- break;
case ID_SIM:
lib_link_simulation(&reader, (Simulation *)id);
break;
@@ -7432,6 +7374,7 @@ static void lib_link_all(FileData *fd, Main *bmain)
case ID_SPK:
case ID_AR:
case ID_LP:
+ case ID_KE:
/* Do nothing. Handled by IDTypeInfo callback. */
break;
}
@@ -8117,11 +8060,6 @@ static void expand_collection(BlendExpander *expander, Collection *collection)
#endif
}
-static void expand_key(BlendExpander *expander, Key *key)
-{
- BLO_expand(expander, key->ipo); // XXX deprecated - old animation system
-}
-
static void expand_texture(BlendExpander *expander, Tex *tex)
{
BLO_expand(expander, tex->ima);
@@ -8477,9 +8415,6 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
case ID_TE:
expand_texture(&expander, (Tex *)id);
break;
- case ID_KE:
- expand_key(&expander, (Key *)id);
- break;
case ID_SO:
expand_sound(&expander, (bSound *)id);
break;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index cae6990fbb0..d4e3f4646d6 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1393,27 +1393,6 @@ static void write_object(BlendWriter *writer, Object *ob, const void *id_address
}
}
-static void write_key(BlendWriter *writer, Key *key, const void *id_address)
-{
- if (key->id.us > 0 || BLO_write_is_undo(writer)) {
- /* write LibData */
- BLO_write_id_struct(writer, Key, id_address, &key->id);
- BKE_id_blend_write(writer, &key->id);
-
- if (key->adt) {
- BKE_animdata_blend_write(writer, key->adt);
- }
-
- /* direct data */
- LISTBASE_FOREACH (KeyBlock *, kb, &key->block) {
- BLO_write_struct(writer, KeyBlock, kb);
- if (kb->data) {
- BLO_write_raw(writer, kb->totelem * key->elemsize, kb->data);
- }
- }
- }
-}
-
static void write_texture(BlendWriter *writer, Tex *tex, const void *id_address)
{
if (tex->id.us > 0 || BLO_write_is_undo(writer)) {
@@ -2592,9 +2571,6 @@ static bool write_file_handle(Main *mainvar,
case ID_SCE:
write_scene(&writer, (Scene *)id_buffer, id);
break;
- case ID_KE:
- write_key(&writer, (Key *)id_buffer, id);
- break;
case ID_SO:
write_sound(&writer, (bSound *)id_buffer, id);
break;
@@ -2650,6 +2626,7 @@ static bool write_file_handle(Main *mainvar,
case ID_SPK:
case ID_AR:
case ID_LP:
+ case ID_KE:
/* Do nothing, handled in IDTypeInfo callback. */
break;
case ID_LI: