Refactor: Move hair foreach_id to new IDTypeInfo structure.

This commit is contained in:
Bastien Montagne 2020-05-20 16:40:58 +02:00
parent e2d961809b
commit 4d613018ee
2 changed files with 11 additions and 4 deletions

View File

@ -22,6 +22,7 @@
#include "DNA_defaults.h"
#include "DNA_hair_types.h"
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "BLI_listbase.h"
@ -95,6 +96,14 @@ static void hair_free_data(ID *id)
MEM_SAFE_FREE(hair->mat);
}
static void hair_foreach_id(ID *id, LibraryForeachIDData *data)
{
Hair *hair = (Hair *)id;
for (int i = 0; i < hair->totcol; i++) {
BKE_LIB_FOREACHID_PROCESS(data, hair->mat[i], IDWALK_CB_USER);
}
}
IDTypeInfo IDType_ID_HA = {
.id_code = ID_HA,
.id_filter = FILTER_ID_HA,
@ -109,6 +118,7 @@ IDTypeInfo IDType_ID_HA = {
.copy_data = hair_copy_data,
.free_data = hair_free_data,
.make_local = NULL,
.foreach_id = hair_foreach_id,
};
static void hair_random(Hair *hair)

View File

@ -865,10 +865,7 @@ static void library_foreach_ID_link(Main *bmain,
break;
}
case ID_HA: {
Hair *hair = (Hair *)id;
for (i = 0; i < hair->totcol; i++) {
CALLBACK_INVOKE(hair->mat[i], IDWALK_CB_USER);
}
BLI_assert(0);
break;
}
case ID_PT: {