Refactor: Move mask foreach_id to new IDTypeInfo structure.
This commit is contained in:
parent
c44d6fb987
commit
7ff933089a
|
@ -972,16 +972,7 @@ static void library_foreach_ID_link(Main *bmain,
|
|||
}
|
||||
|
||||
case ID_MSK: {
|
||||
Mask *mask = (Mask *)id;
|
||||
|
||||
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
|
||||
LISTBASE_FOREACH (MaskSpline *, mask_spline, &mask_layer->splines) {
|
||||
for (i = 0; i < mask_spline->tot_point; i++) {
|
||||
MaskSplinePoint *point = &mask_spline->points[i];
|
||||
CALLBACK_INVOKE_ID(point->parent.id, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_assert(0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "BKE_image.h"
|
||||
#include "BKE_lib_id.h"
|
||||
#include "BKE_lib_query.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_mask.h"
|
||||
#include "BKE_movieclip.h"
|
||||
|
@ -79,6 +80,20 @@ static void mask_free_data(ID *id)
|
|||
BKE_mask_layer_free_list(&mask->masklayers);
|
||||
}
|
||||
|
||||
static void mask_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
{
|
||||
Mask *mask = (Mask *)id;
|
||||
|
||||
LISTBASE_FOREACH (MaskLayer *, mask_layer, &mask->masklayers) {
|
||||
LISTBASE_FOREACH (MaskSpline *, mask_spline, &mask_layer->splines) {
|
||||
for (int i = 0; i < mask_spline->tot_point; i++) {
|
||||
MaskSplinePoint *point = &mask_spline->points[i];
|
||||
BKE_LIB_FOREACHID_PROCESS_ID(data, point->parent.id, IDWALK_CB_USER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IDTypeInfo IDType_ID_MSK = {
|
||||
.id_code = ID_MSK,
|
||||
.id_filter = FILTER_ID_MSK,
|
||||
|
@ -93,6 +108,7 @@ IDTypeInfo IDType_ID_MSK = {
|
|||
.copy_data = mask_copy_data,
|
||||
.free_data = mask_free_data,
|
||||
.make_local = NULL,
|
||||
.foreach_id = mask_foreach_id,
|
||||
};
|
||||
|
||||
static struct {
|
||||
|
|
Loading…
Reference in New Issue