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-11 12:14:17 +0300
committerJacques Lucke <jacques@blender.org>2020-09-11 12:14:17 +0300
commit1b6dd42803df6698b10023ffc660319dab9be502 (patch)
treef04d660c51a131b6bc048ff0f1047c2ecc297bb3 /source/blender/blenloader
parent12f33daad708fa2cebd0c73dba4cbbc2189fb567 (diff)
Refactor: move Hair .blend I/O to IDTypeInfo callbacks
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c45
-rw-r--r--source/blender/blenloader/intern/writefile.c35
2 files changed, 3 insertions, 77 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index e6375ee6477..5003f185855 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6239,33 +6239,6 @@ static void lib_link_sound(BlendLibReader *reader, bSound *sound)
/** \} */
/* -------------------------------------------------------------------- */
-/** \name Read ID: Hair
- * \{ */
-
-static void lib_link_hair(BlendLibReader *reader, Hair *hair)
-{
- for (int a = 0; a < hair->totcol; a++) {
- BLO_read_id_address(reader, hair->id.lib, &hair->mat[a]);
- }
-}
-
-static void direct_link_hair(BlendDataReader *reader, Hair *hair)
-{
- BLO_read_data_address(reader, &hair->adt);
- BKE_animdata_blend_read_data(reader, hair->adt);
-
- /* Geometry */
- CustomData_blend_read(reader, &hair->pdata, hair->totpoint);
- CustomData_blend_read(reader, &hair->cdata, hair->totcurve);
- BKE_hair_update_customdata_pointers(hair);
-
- /* Materials */
- BLO_read_pointer_array(reader, (void **)&hair->mat);
-}
-
-/** \} */
-
-/* -------------------------------------------------------------------- */
/** \name Read ID: Point Cloud
* \{ */
@@ -6532,9 +6505,6 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
case ID_WS:
direct_link_workspace(&reader, (WorkSpace *)id, main);
break;
- case ID_HA:
- direct_link_hair(&reader, (Hair *)id);
- break;
case ID_PT:
direct_link_pointcloud(&reader, (PointCloud *)id);
break;
@@ -6569,6 +6539,7 @@ static bool direct_link_id(FileData *fd, Main *main, const int tag, ID *id, ID *
case ID_KE:
case ID_TE:
case ID_GD:
+ case ID_HA:
/* Do nothing. Handled by IDTypeInfo callback. */
break;
}
@@ -7204,9 +7175,6 @@ static void lib_link_all(FileData *fd, Main *bmain)
case ID_CF:
lib_link_cachefiles(&reader, (CacheFile *)id);
break;
- case ID_HA:
- lib_link_hair(&reader, (Hair *)id);
- break;
case ID_PT:
lib_link_pointcloud(&reader, (PointCloud *)id);
break;
@@ -7248,6 +7216,7 @@ static void lib_link_all(FileData *fd, Main *bmain)
case ID_KE:
case ID_TE:
case ID_GD:
+ case ID_HA:
/* Do nothing. Handled by IDTypeInfo callback. */
break;
}
@@ -8191,13 +8160,6 @@ static void expand_workspace(BlendExpander *expander, WorkSpace *workspace)
}
}
-static void expand_hair(BlendExpander *expander, Hair *hair)
-{
- for (int a = 0; a < hair->totcol; a++) {
- BLO_expand(expander, hair->mat[a]);
- }
-}
-
static void expand_pointcloud(BlendExpander *expander, PointCloud *pointcloud)
{
for (int a = 0; a < pointcloud->totcol; a++) {
@@ -8286,9 +8248,6 @@ void BLO_expand_main(void *fdhandle, Main *mainvar)
case ID_WS:
expand_workspace(&expander, (WorkSpace *)id);
break;
- case ID_HA:
- expand_hair(&expander, (Hair *)id);
- break;
case ID_PT:
expand_pointcloud(&expander, (PointCloud *)id);
break;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index b9320bb40e3..e8c5e09599c 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2104,37 +2104,6 @@ static void write_workspace(BlendWriter *writer, WorkSpace *workspace, const voi
}
}
-static void write_hair(BlendWriter *writer, Hair *hair, const void *id_address)
-{
- if (hair->id.us > 0 || BLO_write_is_undo(writer)) {
- CustomDataLayer *players = NULL, players_buff[CD_TEMP_CHUNK_SIZE];
- CustomDataLayer *clayers = NULL, clayers_buff[CD_TEMP_CHUNK_SIZE];
- CustomData_blend_write_prepare(&hair->pdata, &players, players_buff, ARRAY_SIZE(players_buff));
- CustomData_blend_write_prepare(&hair->cdata, &clayers, clayers_buff, ARRAY_SIZE(clayers_buff));
-
- /* Write LibData */
- BLO_write_id_struct(writer, Hair, id_address, &hair->id);
- BKE_id_blend_write(writer, &hair->id);
-
- /* Direct data */
- CustomData_blend_write(writer, &hair->pdata, players, hair->totpoint, CD_MASK_ALL, &hair->id);
- CustomData_blend_write(writer, &hair->cdata, clayers, hair->totcurve, CD_MASK_ALL, &hair->id);
-
- BLO_write_pointer_array(writer, hair->totcol, hair->mat);
- if (hair->adt) {
- BKE_animdata_blend_write(writer, hair->adt);
- }
-
- /* Remove temporary data. */
- if (players && players != players_buff) {
- MEM_freeN(players);
- }
- if (clayers && clayers != clayers_buff) {
- MEM_freeN(clayers);
- }
- }
-}
-
static void write_pointcloud(BlendWriter *writer, PointCloud *pointcloud, const void *id_address)
{
if (pointcloud->id.us > 0 || BLO_write_is_undo(writer)) {
@@ -2519,9 +2488,6 @@ static bool write_file_handle(Main *mainvar,
case ID_CF:
write_cachefile(&writer, (CacheFile *)id_buffer, id);
break;
- case ID_HA:
- write_hair(&writer, (Hair *)id_buffer, id);
- break;
case ID_PT:
write_pointcloud(&writer, (PointCloud *)id_buffer, id);
break;
@@ -2556,6 +2522,7 @@ static bool write_file_handle(Main *mainvar,
case ID_KE:
case ID_TE:
case ID_GD:
+ case ID_HA:
/* Do nothing, handled in IDTypeInfo callback. */
break;
case ID_LI: