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:
authorCampbell Barton <ideasman42@gmail.com>2014-02-07 23:07:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-02-07 23:24:05 +0400
commitb3afbcab8ff2330c1473647be330a3ffe9b11885 (patch)
treee86b9c7d9676e63b8da92da79889dee13b8be186 /source/blender/blenkernel/intern
parent1c24d954f4ac63f22b703756b6664a4ad1b363d4 (diff)
ListBase API: add utility api funcs for clearing and checking empty
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/action.c9
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c10
-rw-r--r--source/blender/blenkernel/intern/armature.c2
-rw-r--r--source/blender/blenkernel/intern/blender.c2
-rw-r--r--source/blender/blenkernel/intern/bpath.c2
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/context.c3
-rw-r--r--source/blender/blenkernel/intern/curve.c8
-rw-r--r--source/blender/blenkernel/intern/deform.c2
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c10
-rw-r--r--source/blender/blenkernel/intern/displist.c7
-rw-r--r--source/blender/blenkernel/intern/fcurve.c8
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c4
-rw-r--r--source/blender/blenkernel/intern/freestyle.c8
-rw-r--r--source/blender/blenkernel/intern/gpencil.c10
-rw-r--r--source/blender/blenkernel/intern/group.c4
-rw-r--r--source/blender/blenkernel/intern/implicit.c2
-rw-r--r--source/blender/blenkernel/intern/ipo.c2
-rw-r--r--source/blender/blenkernel/intern/key.c2
-rw-r--r--source/blender/blenkernel/intern/linestyle.c11
-rw-r--r--source/blender/blenkernel/intern/mask.c10
-rw-r--r--source/blender/blenkernel/intern/material.c6
-rw-r--r--source/blender/blenkernel/intern/mball.c8
-rw-r--r--source/blender/blenkernel/intern/nla.c8
-rw-r--r--source/blender/blenkernel/intern/node.c8
-rw-r--r--source/blender/blenkernel/intern/object.c16
-rw-r--r--source/blender/blenkernel/intern/object_deform.c3
-rw-r--r--source/blender/blenkernel/intern/object_dupli.c4
-rw-r--r--source/blender/blenkernel/intern/particle.c6
-rw-r--r--source/blender/blenkernel/intern/particle_system.c4
-rw-r--r--source/blender/blenkernel/intern/pointcache.c7
-rw-r--r--source/blender/blenkernel/intern/report.c2
-rw-r--r--source/blender/blenkernel/intern/scene.c2
-rw-r--r--source/blender/blenkernel/intern/screen.c16
-rw-r--r--source/blender/blenkernel/intern/seqcache.c2
-rw-r--r--source/blender/blenkernel/intern/seqmodifier.c2
-rw-r--r--source/blender/blenkernel/intern/sequencer.c12
-rw-r--r--source/blender/blenkernel/intern/sketch.c3
-rw-r--r--source/blender/blenkernel/intern/smoke.c2
-rw-r--r--source/blender/blenkernel/intern/text.c8
-rw-r--r--source/blender/blenkernel/intern/tracking.c8
41 files changed, 119 insertions, 126 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 8967df14b24..3a32cad0873 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -193,7 +193,7 @@ bAction *BKE_action_copy(bAction *src)
BLI_duplicatelist(&dst->markers, &src->markers);
/* copy F-Curves, fixing up the links as we go */
- dst->curves.first = dst->curves.last = NULL;
+ BLI_listbase_clear(&dst->curves);
for (sfcu = src->curves.first; sfcu; sfcu = sfcu->next) {
/* duplicate F-Curve */
@@ -319,7 +319,7 @@ void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
return;
/* if no channels anywhere, just add to two lists at the same time */
- if (act->curves.first == NULL) {
+ if (BLI_listbase_is_empty(&act->curves)) {
fcurve->next = fcurve->prev = NULL;
agrp->channels.first = agrp->channels.last = fcurve;
@@ -390,8 +390,7 @@ void action_groups_remove_channel(bAction *act, FCurve *fcu)
if (agrp->channels.first == agrp->channels.last) {
if (agrp->channels.first == fcu) {
- agrp->channels.first = NULL;
- agrp->channels.last = NULL;
+ BLI_listbase_clear(&agrp->channels);
}
}
else if (agrp->channels.first == fcu) {
@@ -998,7 +997,7 @@ void BKE_pose_remove_group(Object *ob)
/* now, remove it from the pose */
BLI_freelinkN(&pose->agroups, grp);
pose->active_group--;
- if (pose->active_group < 0 || pose->agroups.first == NULL) {
+ if (pose->active_group < 0 || BLI_listbase_is_empty(&pose->agroups)) {
pose->active_group = 0;
}
}
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index a46b308f76b..5c50b9d6bec 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -273,7 +273,7 @@ AnimData *BKE_copy_animdata(AnimData *adt, const bool do_action)
copy_fcurves(&dadt->drivers, &adt->drivers);
/* don't copy overrides */
- dadt->overrides.first = dadt->overrides.last = NULL;
+ BLI_listbase_clear(&dadt->overrides);
/* return */
return dadt;
@@ -465,7 +465,7 @@ void action_move_fcurves_by_basepath(bAction *srcAct, bAction *dstAct, const cha
/* if group is empty and tagged, then we can remove as this operation
* moved out all the channels that were formerly here
*/
- if (agrp->channels.first == NULL)
+ if (BLI_listbase_is_empty(&agrp->channels))
BLI_freelinkN(&srcAct->groups, agrp);
else
agrp->flag &= ~AGRP_TEMP;
@@ -1900,7 +1900,7 @@ static void nlaevalchan_buffers_accumulate(ListBase *channels, ListBase *tmp_buf
NlaEvalChannel *nec, *necn, *necd;
/* optimize - abort if no channels */
- if (tmp_buffer->first == NULL)
+ if (BLI_listbase_is_empty(tmp_buffer))
return;
/* accumulate results in tmp_channels buffer to the accumulation buffer */
@@ -2308,7 +2308,7 @@ static void animsys_evaluate_nla(ListBase *echannels, PointerRNA *ptr, AnimData
}
/* only continue if there are strips to evaluate */
- if (estrips.first == NULL)
+ if (BLI_listbase_is_empty(&estrips))
return;
@@ -2524,7 +2524,7 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
* however, if there are some curves, we will need to make sure that their 'ctime' property gets
* set correctly, so this optimization must be skipped in that case...
*/
- if ((main->action.first == NULL) && (main->curve.first == NULL)) {
+ if (BLI_listbase_is_empty(&main->action) && BLI_listbase_is_empty(&main->curve)) {
if (G.debug & G_DEBUG)
printf("\tNo Actions, so no animation needs to be evaluated...\n");
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 699e71393c8..caec93a6627 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -2537,7 +2537,7 @@ static int minmax_armature(Object *ob, float r_min[3], float r_max[3])
minmax_v3v3_v3(r_min, r_max, pchan->pose_tail);
}
- return (ob->pose->chanbase.first != NULL);
+ return (BLI_listbase_is_empty(&ob->pose->chanbase) == false);
}
static void boundbox_armature(Object *ob, float loc[3], float size[3])
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 2b87a7684d2..ed48bf5f3a4 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -204,7 +204,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, const char *filepath
char mode;
/* 'u' = undo save, 'n' = no UI load */
- if (bfd->main->screen.first == NULL) mode = 'u';
+ if (BLI_listbase_is_empty(&bfd->main->screen)) mode = 'u';
else if (G.fileflags & G_FILE_NO_UI) mode = 'n';
else mode = 0;
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index b7a6cf4153a..00fff61c6a2 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -755,7 +755,7 @@ void BKE_bpath_list_restore(Main *bmain, const int flag, void *ls_handle)
void BKE_bpath_list_free(void *ls_handle)
{
ListBase *ls = ls_handle;
- BLI_assert(ls->first == NULL); /* assumes we were used */
+ BLI_assert(BLI_listbase_is_empty(ls)); /* assumes we were used */
BLI_freelistN(ls);
MEM_freeN(ls);
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 2eca9f30bfb..c14e8dd5e16 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -4490,7 +4490,7 @@ void BKE_copy_constraints(ListBase *dst, const ListBase *src, int do_extern)
{
bConstraint *con, *srccon;
- dst->first = dst->last = NULL;
+ BLI_listbase_clear(dst);
BLI_duplicatelist(dst, src);
for (con = dst->first, srccon = src->first; con && srccon; srccon = srccon->next, con = con->next) {
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 2eb763831e4..a63807f4bcb 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -366,8 +366,7 @@ static int ctx_data_collection_get(const bContext *C, const char *member, ListBa
return 1;
}
- list->first = NULL;
- list->last = NULL;
+ BLI_listbase_clear(list);
return 0;
}
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index c5979686afb..8567a57d153 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -206,7 +206,7 @@ Curve *BKE_curve_copy(Curve *cu)
int a;
cun = BKE_libblock_copy(&cu->id);
- cun->nurb.first = cun->nurb.last = NULL;
+ BLI_listbase_clear(&cun->nurb);
BKE_nurbList_duplicate(&(cun->nurb), &(cu->nurb));
cun->mat = MEM_dupallocN(cu->mat);
@@ -534,7 +534,7 @@ void BKE_nurbList_free(ListBase *lb)
BKE_nurb_free(nu);
nu = next;
}
- lb->first = lb->last = NULL;
+ BLI_listbase_clear(lb);
}
Nurb *BKE_nurb_duplicate(Nurb *nu)
@@ -1628,7 +1628,7 @@ void BKE_curve_bevel_make(Scene *scene, Object *ob, ListBase *disp, int forRende
int nr, a;
cu = ob->data;
- disp->first = disp->last = NULL;
+ BLI_listbase_clear(disp);
/* if a font object is being edited, then do nothing */
// XXX if ( ob == obedit && ob->type == OB_FONT ) return;
@@ -4039,7 +4039,7 @@ bool BKE_curve_minmax(Curve *cu, bool use_radius, float min[3], float max[3])
for (nu = nurb_lb->first; nu; nu = nu->next)
BKE_nurb_minmax(nu, use_radius, min, max);
- return (nurb_lb->first != NULL);
+ return (BLI_listbase_is_empty(nurb_lb) == false);
}
bool BKE_curve_center_median(Curve *cu, float cent[3])
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 6ff27e50bf8..82b6dded29c 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -71,7 +71,7 @@ void defgroup_copy_list(ListBase *outbase, ListBase *inbase)
{
bDeformGroup *defgroup, *defgroupn;
- outbase->first = outbase->last = NULL;
+ BLI_listbase_clear(outbase);
for (defgroup = inbase->first; defgroup; defgroup = defgroup->next) {
defgroupn = defgroup_duplicate(defgroup);
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 5f4bfc8ad23..af84055fb50 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -1379,7 +1379,7 @@ static void dag_scene_build(Main *bmain, Scene *sce)
ListBase tempbase;
Base *base;
- tempbase.first = tempbase.last = NULL;
+ BLI_listbase_clear(&tempbase);
build_dag(bmain, sce, DAG_RL_ALL_BUT_DATA);
@@ -1941,7 +1941,7 @@ static void dag_object_time_update_flags(Main *bmain, Scene *scene, Object *ob)
break;
case OB_FONT:
cu = ob->data;
- if (cu->nurb.first == NULL && cu->str && cu->vfont)
+ if (BLI_listbase_is_empty(&cu->nurb) && cu->str && cu->vfont)
ob->recalc |= OB_RECALC_DATA;
break;
case OB_LATTICE:
@@ -2078,7 +2078,7 @@ static void dag_current_scene_layers(Main *bmain, ListBase *lb)
wmWindowManager *wm;
wmWindow *win;
- lb->first = lb->last = NULL;
+ BLI_listbase_clear(lb);
/* if we have a windowmanager, look into windows */
if ((wm = bmain->wm.first)) {
@@ -2411,7 +2411,7 @@ void DAG_ids_flush_tagged(Main *bmain)
/* get list of visible scenes and layers */
dag_current_scene_layers(bmain, &listbase);
- if (listbase.first == NULL)
+ if (BLI_listbase_is_empty(&listbase))
return;
/* loop over all ID types */
@@ -2774,7 +2774,7 @@ void DAG_pose_sort(Object *ob)
dag_check_cycle(dag);
/* now we try to sort... */
- tempbase.first = tempbase.last = NULL;
+ BLI_listbase_clear(&tempbase);
nqueue = queue_create(DAGQUEUEALLOC);
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index ee2c42d33cd..517c8329567 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -462,7 +462,7 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, const float normal_proj
if (dispbase == NULL)
return;
- if (dispbase->first == NULL)
+ if (BLI_listbase_is_empty(dispbase))
return;
sf_arena = BLI_memarena_new(BLI_SCANFILL_ARENA_SIZE, __func__);
@@ -588,7 +588,8 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
float *fp, *fp1;
int a, dpoly;
- front.first = front.last = back.first = back.last = NULL;
+ BLI_listbase_clear(&front);
+ BLI_listbase_clear(&back);
dl = dispbase->first;
while (dl) {
@@ -1409,7 +1410,7 @@ static void do_makeDispListCurveTypes(Scene *scene, Object *ob, ListBase *dispba
if (bl->nr) { /* blank bevel lists can happen */
/* exception handling; curve without bevel or extrude, with width correction */
- if (dlbev.first == NULL) {
+ if (BLI_listbase_is_empty(&dlbev)) {
dl = MEM_callocN(sizeof(DispList), "makeDispListbev");
dl->verts = MEM_callocN(3 * sizeof(float) * bl->nr, "dlverts");
BLI_addtail(dispbase, dl);
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index c93181bd903..bcdb066a965 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -112,7 +112,7 @@ void free_fcurves(ListBase *list)
}
/* clear pointers just in case */
- list->first = list->last = NULL;
+ BLI_listbase_clear(list);
}
/* ---------------------- Copy --------------------------- */
@@ -159,7 +159,7 @@ void copy_fcurves(ListBase *dst, ListBase *src)
return;
/* clear destination list first */
- dst->first = dst->last = NULL;
+ BLI_listbase_clear(dst);
/* copy one-by-one */
for (sfcu = src->first; sfcu; sfcu = sfcu->next) {
@@ -1588,7 +1588,7 @@ ChannelDriver *fcurve_copy_driver(ChannelDriver *driver)
ndriver->expr_comp = NULL;
/* copy variables */
- ndriver->variables.first = ndriver->variables.last = NULL;
+ BLI_listbase_clear(&ndriver->variables);
BLI_duplicatelist(&ndriver->variables, &driver->variables);
for (dvar = ndriver->variables.first; dvar; dvar = dvar->next) {
@@ -1648,7 +1648,7 @@ static float evaluate_driver(ChannelDriver *driver, const float evaltime)
case DRIVER_TYPE_SUM: /* sum values of driver targets */
{
/* check how many variables there are first (i.e. just one?) */
- if (driver->variables.first == driver->variables.last) {
+ if (BLI_listbase_is_single(&driver->variables)) {
/* just one target, so just use that */
dvar = driver->variables.first;
driver->curval = driver_get_variable_value(driver, dvar);
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index 325a26d7a16..6c98808f087 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -1102,7 +1102,7 @@ FModifier *add_fmodifier(ListBase *modifiers, int type)
BLI_addtail(modifiers, fcm);
/* tag modifier as "active" if no other modifiers exist in the stack yet */
- if (modifiers->first == modifiers->last)
+ if (BLI_listbase_is_single(modifiers))
fcm->flag |= FMODIFIER_FLAG_ACTIVE;
/* add modifier's data */
@@ -1149,7 +1149,7 @@ void copy_fmodifiers(ListBase *dst, ListBase *src)
if (ELEM(NULL, dst, src))
return;
- dst->first = dst->last = NULL;
+ BLI_listbase_clear(dst);
BLI_duplicatelist(dst, src);
for (fcm = dst->first, srcfcm = src->first; fcm && srcfcm; srcfcm = srcfcm->next, fcm = fcm->next) {
diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c
index 3e0668ba05c..f5a9ba4e241 100644
--- a/source/blender/blenkernel/intern/freestyle.c
+++ b/source/blender/blenkernel/intern/freestyle.c
@@ -50,13 +50,13 @@ void BKE_freestyle_config_init(FreestyleConfig *config)
{
config->mode = FREESTYLE_CONTROL_EDITOR_MODE;
- config->modules.first = config->modules.last = NULL;
+ BLI_listbase_clear(&config->modules);
config->flags = 0;
config->sphere_radius = 0.1f;
config->dkr_epsilon = 0.0f;
config->crease_angle = DEG2RADF(134.43f);
- config->linesets.first = config->linesets.last = NULL;
+ BLI_listbase_clear(&config->linesets);
}
void BKE_freestyle_config_free(FreestyleConfig *config)
@@ -88,14 +88,14 @@ void BKE_freestyle_config_copy(FreestyleConfig *new_config, FreestyleConfig *con
new_config->dkr_epsilon = config->dkr_epsilon;
new_config->crease_angle = config->crease_angle;
- new_config->linesets.first = new_config->linesets.last = NULL;
+ BLI_listbase_clear(&new_config->linesets);
for (lineset = (FreestyleLineSet *)config->linesets.first; lineset; lineset = lineset->next) {
new_lineset = alloc_lineset();
copy_lineset(new_lineset, lineset);
BLI_addtail(&new_config->linesets, (void *)new_lineset);
}
- new_config->modules.first = new_config->modules.last = NULL;
+ BLI_listbase_clear(&new_config->modules);
for (module = (FreestyleModuleConfig *)config->modules.first; module; module = module->next) {
new_module = alloc_module();
copy_module(new_module, module);
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 9bace5e1ee3..2eed25cde0e 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -61,7 +61,7 @@
bool free_gpencil_strokes(bGPDframe *gpf)
{
bGPDstroke *gps, *gpsn;
- bool changed = (gpf->strokes.first != NULL);
+ bool changed = (BLI_listbase_is_empty(&gpf->strokes) == false);
/* free strokes */
for (gps = gpf->strokes.first; gps; gps = gpsn) {
@@ -234,7 +234,7 @@ bGPDframe *gpencil_frame_duplicate(bGPDframe *src)
dst->prev = dst->next = NULL;
/* copy strokes */
- dst->strokes.first = dst->strokes.last = NULL;
+ BLI_listbase_clear(&dst->strokes);
for (gps = src->strokes.first; gps; gps = gps->next) {
/* make copy of source stroke, then adjust pointer to points too */
gpsd = MEM_dupallocN(gps);
@@ -262,7 +262,7 @@ bGPDlayer *gpencil_layer_duplicate(bGPDlayer *src)
dst->prev = dst->next = NULL;
/* copy frames */
- dst->frames.first = dst->frames.last = NULL;
+ BLI_listbase_clear(&dst->frames);
for (gpf = src->frames.first; gpf; gpf = gpf->next) {
/* make a copy of source frame */
gpfd = gpencil_frame_duplicate(gpf);
@@ -291,7 +291,7 @@ bGPdata *gpencil_data_duplicate(bGPdata *src)
dst = MEM_dupallocN(src);
/* copy layers */
- dst->layers.first = dst->layers.last = NULL;
+ BLI_listbase_clear(&dst->layers);
for (gpl = src->layers.first; gpl; gpl = gpl->next) {
/* make a copy of source layer and its data */
gpld = gpencil_layer_duplicate(gpl);
@@ -319,7 +319,7 @@ void gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
BLI_freelinkN(&gpf->strokes, gps);
/* if frame has no strokes after this, delete it */
- if (gpf->strokes.first == NULL) {
+ if (BLI_listbase_is_empty(&gpf->strokes)) {
gpencil_layer_delframe(gpl, gpf);
gpencil_layer_getframe(gpl, cfra, 0);
}
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index 82b6c0c04d5..2a61b2e7453 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -306,7 +306,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
if (done == 0) {
/* clear nla & action from object */
nlastrips = target->nlastrips;
- target->nlastrips.first = target->nlastrips.last = NULL;
+ BLI_listbase_clear(&target->nlastrips);
action = target->action;
target->action = NULL;
target->nlaflag |= OB_NLA_OVERRIDE;
@@ -323,7 +323,7 @@ static void group_replaces_nla(Object *parent, Object *target, char mode)
target->nlastrips = nlastrips;
target->action = action;
- nlastrips.first = nlastrips.last = NULL; /* not needed, but yah... :) */
+ BLI_listbase_clear(&nlastrips); /* not needed, but yah... :) */
action = NULL;
done = FALSE;
}
diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c
index d328c90aab3..08959850fb9 100644
--- a/source/blender/blenkernel/intern/implicit.c
+++ b/source/blender/blenkernel/intern/implicit.c
@@ -746,7 +746,7 @@ int implicit_init(Object *UNUSED(ob), ClothModifierData *clmd)
printf("implicit_init\n");
// init memory guard
- // MEMORY_BASE.first = MEMORY_BASE.last = NULL;
+ // BLI_listbase_clear(&MEMORY_BASE);
cloth = (Cloth *)clmd->clothObject;
verts = cloth->verts;
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 8ef3b7ef23d..cf66d866c2c 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -1455,7 +1455,7 @@ static void action_to_animato(ID *id, bAction *act, ListBase *groups, ListBase *
bConstraintChannel *conchan, *conchann;
/* only continue if there are Action Channels (indicating unconverted data) */
- if (act->chanbase.first == NULL)
+ if (BLI_listbase_is_empty(&act->chanbase))
return;
/* get rid of all Action Groups */
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index d2080b4922c..93833f5c5ae 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1397,7 +1397,7 @@ float *BKE_key_evaluate_object_ex(Scene *scene, Object *ob, int *r_totelem,
char *out;
int tot = 0, size = 0;
- if (key == NULL || key->block.first == NULL)
+ if (key == NULL || BLI_listbase_is_empty(&key->block))
return NULL;
/* compute size of output array */
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c
index 71c917d4528..3622174975a 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -90,10 +90,10 @@ static void default_linestyle_settings(FreestyleLineStyle *linestyle)
linestyle->max_length = 10000.0f;
linestyle->split_length = 100;
- linestyle->color_modifiers.first = linestyle->color_modifiers.last = NULL;
- linestyle->alpha_modifiers.first = linestyle->alpha_modifiers.last = NULL;
- linestyle->thickness_modifiers.first = linestyle->thickness_modifiers.last = NULL;
- linestyle->geometry_modifiers.first = linestyle->geometry_modifiers.last = NULL;
+ BLI_listbase_clear(&linestyle->color_modifiers);
+ BLI_listbase_clear(&linestyle->alpha_modifiers);
+ BLI_listbase_clear(&linestyle->thickness_modifiers);
+ BLI_listbase_clear(&linestyle->geometry_modifiers);
BKE_add_linestyle_geometry_modifier(linestyle, LS_MODIFIER_SAMPLING);
@@ -1005,7 +1005,8 @@ void BKE_list_modifier_color_ramps(FreestyleLineStyle *linestyle, ListBase *list
ColorBand *color_ramp;
LinkData *link;
- listbase->first = listbase->last = NULL;
+ BLI_listbase_clear(listbase);
+
for (m = (LineStyleModifier *)linestyle->color_modifiers.first; m; m = m->next) {
switch (m->type) {
case LS_MODIFIER_ALONG_STROKE:
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index 33e758ed754..23c0401c1fe 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -742,8 +742,7 @@ Mask *BKE_mask_copy_nolib(Mask *mask)
/*take care here! - we may want to copy anim data */
mask_new->adt = NULL;
- mask_new->masklayers.first = NULL;
- mask_new->masklayers.last = NULL;
+ BLI_listbase_clear(&mask_new->masklayers);
BKE_mask_layer_copy_list(&mask_new->masklayers, &mask->masklayers);
@@ -762,8 +761,7 @@ Mask *BKE_mask_copy(Mask *mask)
mask_new = BKE_libblock_copy(&mask->id);
- mask_new->masklayers.first = NULL;
- mask_new->masklayers.last = NULL;
+ BLI_listbase_clear(&mask_new->masklayers);
BKE_mask_layer_copy_list(&mask_new->masklayers, &mask->masklayers);
@@ -1947,7 +1945,7 @@ int BKE_mask_get_duration(Mask *mask)
static void mask_clipboard_free_ex(bool final_free)
{
BKE_mask_spline_free_list(&mask_clipboard.splines);
- mask_clipboard.splines.first = mask_clipboard.splines.last = NULL;
+ BLI_listbase_clear(&mask_clipboard.splines);
if (mask_clipboard.id_hash) {
if (final_free) {
BLI_ghash_free(mask_clipboard.id_hash, NULL, MEM_freeN);
@@ -2005,7 +2003,7 @@ void BKE_mask_clipboard_copy_from_layer(MaskLayer *mask_layer)
/* Check clipboard is empty. */
bool BKE_mask_clipboard_is_empty(void)
{
- return mask_clipboard.splines.first == NULL;
+ return BLI_listbase_is_empty(&mask_clipboard.splines);
}
/* Paste the contents of clipboard to given mask layer */
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 1cae95e99b3..5f6331315f8 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -245,7 +245,7 @@ Material *BKE_material_copy(Material *ma)
man->nodetree = ntreeCopyTree(ma->nodetree);
}
- man->gpumaterial.first = man->gpumaterial.last = NULL;
+ BLI_listbase_clear(&man->gpumaterial);
return man;
}
@@ -275,7 +275,7 @@ Material *localize_material(Material *ma)
if (ma->nodetree)
man->nodetree = ntreeLocalize(ma->nodetree);
- man->gpumaterial.first = man->gpumaterial.last = NULL;
+ BLI_listbase_clear(&man->gpumaterial);
return man;
}
@@ -1567,7 +1567,7 @@ void copy_matcopybuf(Material *ma)
}
matcopybuf.nodetree = ntreeCopyTree_ex(ma->nodetree, FALSE);
matcopybuf.preview = NULL;
- matcopybuf.gpumaterial.first = matcopybuf.gpumaterial.last = NULL;
+ BLI_listbase_clear(&matcopybuf.gpumaterial);
matcopied = 1;
}
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index e5fdc449dbd..9e83d97b450 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -1901,8 +1901,7 @@ static void subdivide_metaball_octal_node(octal_node *node, float size_x, float
for (i = 0; i < 8; i++)
node->nodes[a]->nodes[i] = NULL;
node->nodes[a]->parent = node;
- node->nodes[a]->elems.first = NULL;
- node->nodes[a]->elems.last = NULL;
+ BLI_listbase_clear(&node->nodes[a]->elems);
node->nodes[a]->count = 0;
node->nodes[a]->neg = 0;
node->nodes[a]->pos = 0;
@@ -2171,8 +2170,7 @@ static void init_metaball_octal_tree(PROCESS *process, int depth)
process->metaball_tree->neg = node->neg = 0;
process->metaball_tree->pos = node->pos = 0;
- node->elems.first = NULL;
- node->elems.last = NULL;
+ BLI_listbase_clear(&node->elems);
node->count = 0;
for (a = 0; a < 8; a++)
@@ -2420,7 +2418,7 @@ bool BKE_mball_minmax(MetaBall *mb, float min[3], float max[3])
minmax_v3v3_v3(min, max, &ml->x);
}
- return (mb->elems.first != NULL);
+ return (BLI_listbase_is_empty(&mb->elems) == false);
}
bool BKE_mball_center_median(MetaBall *mb, float r_cent[3])
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 56796756ab5..06a12bdade1 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -152,7 +152,7 @@ void free_nladata(ListBase *tracks)
}
/* clear the list's pointers to be safe */
- tracks->first = tracks->last = NULL;
+ BLI_listbase_clear(tracks);
}
/* Copying ------------------------------------------- */
@@ -180,7 +180,7 @@ NlaStrip *copy_nlastrip(NlaStrip *strip)
copy_fmodifiers(&strip_d->modifiers, &strip->modifiers);
/* make a copy of all the child-strips, one at a time */
- strip_d->strips.first = strip_d->strips.last = NULL;
+ BLI_listbase_clear(&strip_d->strips);
for (cs = strip->strips.first; cs; cs = cs->next) {
cs_d = copy_nlastrip(cs);
@@ -206,7 +206,7 @@ NlaTrack *copy_nlatrack(NlaTrack *nlt)
nlt_d->next = nlt_d->prev = NULL;
/* make a copy of all the strips, one at a time */
- nlt_d->strips.first = nlt_d->strips.last = NULL;
+ BLI_listbase_clear(&nlt_d->strips);
for (strip = nlt->strips.first; strip; strip = strip->next) {
strip_d = copy_nlastrip(strip);
@@ -227,7 +227,7 @@ void copy_nladata(ListBase *dst, ListBase *src)
return;
/* clear out the destination list first for precautions... */
- dst->first = dst->last = NULL;
+ BLI_listbase_clear(dst);
/* copy each NLA-track, one at a time */
for (nlt = src->first; nlt; nlt = nlt->next) {
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index bc616934fef..27a8730fe03 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1136,8 +1136,8 @@ static bNodeTree *ntreeCopyTree_internal(bNodeTree *ntree, Main *bmain, bool do_
/* in case a running nodetree is copied */
newtree->execdata = NULL;
- newtree->nodes.first = newtree->nodes.last = NULL;
- newtree->links.first = newtree->links.last = NULL;
+ BLI_listbase_clear(&newtree->nodes);
+ BLI_listbase_clear(&newtree->links);
last = ntree->nodes.last;
for (node = ntree->nodes.first; node; node = node->next) {
@@ -2538,13 +2538,13 @@ void BKE_node_clipboard_clear(void)
link_next = link->next;
nodeRemLink(NULL, link);
}
- node_clipboard.links.first = node_clipboard.links.last = NULL;
+ BLI_listbase_clear(&node_clipboard.links);
for (node = node_clipboard.nodes.first; node; node = node_next) {
node_next = node->next;
node_free_node_ex(NULL, node, false, false);
}
- node_clipboard.nodes.first = node_clipboard.nodes.last = NULL;
+ BLI_listbase_clear(&node_clipboard.nodes);
#ifdef USE_NODE_CB_VALIDATE
BLI_freelistN(&node_clipboard.nodes_extra_info);
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 05365a86828..6c9ffa5ab46 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1014,7 +1014,7 @@ Object *BKE_object_add_only_object(Main *bmain, int type, const char *name)
/* NT fluid sim defaults */
ob->fluidsimSettings = NULL;
- ob->pc_ids.first = ob->pc_ids.last = NULL;
+ BLI_listbase_clear(&ob->pc_ids);
/* Animation Visualization defaults */
animviz_settings_init(&ob->avs);
@@ -1284,8 +1284,8 @@ static ParticleSystem *copy_particlesystem(ParticleSystem *psys)
psysn->effectors = NULL;
psysn->tree = NULL;
- psysn->pathcachebufs.first = psysn->pathcachebufs.last = NULL;
- psysn->childcachebufs.first = psysn->childcachebufs.last = NULL;
+ BLI_listbase_clear(&psysn->pathcachebufs);
+ BLI_listbase_clear(&psysn->childcachebufs);
psysn->renderdata = NULL;
psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches, FALSE);
@@ -1311,7 +1311,7 @@ void BKE_object_copy_particlesystems(Object *obn, Object *ob)
return;
}
- obn->particlesystem.first = obn->particlesystem.last = NULL;
+ BLI_listbase_clear(&obn->particlesystem);
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
npsys = copy_particlesystem(psys);
@@ -1459,7 +1459,7 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, int copy_caches)
if (ob->bb) obn->bb = MEM_dupallocN(ob->bb);
obn->flag &= ~OB_FROMGROUP;
- obn->modifiers.first = obn->modifiers.last = NULL;
+ BLI_listbase_clear(&obn->modifiers);
for (md = ob->modifiers.first; md; md = md->next) {
ModifierData *nmd = modifier_new(md->type);
@@ -1468,7 +1468,7 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, int copy_caches)
BLI_addtail(&obn->modifiers, nmd);
}
- obn->prop.first = obn->prop.last = NULL;
+ BLI_listbase_clear(&obn->prop);
BKE_bproperty_copy_list(&obn->prop, &ob->prop);
copy_sensors(&obn->sensors, &ob->sensors);
@@ -1516,8 +1516,8 @@ Object *BKE_object_copy_ex(Main *bmain, Object *ob, int copy_caches)
obn->derivedDeform = NULL;
obn->derivedFinal = NULL;
- obn->gpulamp.first = obn->gpulamp.last = NULL;
- obn->pc_ids.first = obn->pc_ids.last = NULL;
+ BLI_listbase_clear(&obn->gpulamp);
+ BLI_listbase_clear(&obn->pc_ids);
obn->mpath = NULL;
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
index 77c5e57f382..f313c098f4b 100644
--- a/source/blender/blenkernel/intern/object_deform.c
+++ b/source/blender/blenkernel/intern/object_deform.c
@@ -29,6 +29,7 @@
#include "BLI_utildefines.h"
#include "BLI_ghash.h"
+#include "BLI_listbase.h"
#include "BKE_action.h"
#include "BKE_object_deform.h" /* own include */
@@ -75,7 +76,7 @@ bool *BKE_objdef_validmap_get(Object *ob, const int defbase_tot)
//int defbase_tot = BLI_countlist(&ob->defbase);
VirtualModifierData virtualModifierData;
- if (ob->defbase.first == NULL) {
+ if (BLI_listbase_is_empty(&ob->defbase)) {
return NULL;
}
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index dd9f1a268b2..74426df58c7 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -337,7 +337,7 @@ static void make_duplis_frames(const DupliContext *ctx)
/* if we don't have any data/settings which will lead to object movement,
* don't waste time trying, as it will all look the same...
*/
- if (ob->parent == NULL && ob->constraints.first == NULL && ob->adt == NULL)
+ if (ob->parent == NULL && BLI_listbase_is_empty(&ob->constraints) && ob->adt == NULL)
return;
/* make a copy of the object's original data (before any dupli-data overwrites it)
@@ -877,7 +877,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
return;
}
else { /*PART_DRAW_GR */
- if (part->dup_group == NULL || part->dup_group->gobject.first == NULL)
+ if (part->dup_group == NULL || BLI_listbase_is_empty(&part->dup_group->gobject))
return;
if (BLI_findptr(&part->dup_group->gobject, par, offsetof(GroupObject, ob))) {
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 8e256f05f71..edf902e0eb5 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -411,7 +411,7 @@ void free_hair(Object *UNUSED(ob), ParticleSystem *psys, int dynamics)
if (dynamics) {
BKE_ptcache_free_list(&psys->ptcaches);
psys->clmd->point_cache = psys->pointcache = NULL;
- psys->clmd->ptcaches.first = psys->clmd->ptcaches.last = NULL;
+ BLI_listbase_clear(&psys->clmd->ptcaches);
modifier_free((ModifierData *)psys->clmd);
@@ -712,8 +712,8 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[4][4], floa
psys->pathcache = NULL;
psys->childcache = NULL;
psys->totchild = psys->totcached = psys->totchildcache = 0;
- psys->pathcachebufs.first = psys->pathcachebufs.last = NULL;
- psys->childcachebufs.first = psys->childcachebufs.last = NULL;
+ BLI_listbase_clear(&psys->pathcachebufs);
+ BLI_listbase_clear(&psys->childcachebufs);
copy_m4_m4(data->winmat, winmat);
mul_m4_m4m4(data->viewmat, viewmat, ob->obmat);
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 6ae3e2e9d5e..71b91340721 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -2180,7 +2180,7 @@ void psys_make_temp_pointcache(Object *ob, ParticleSystem *psys)
{
PointCache *cache = psys->pointcache;
- if (cache->flag & PTCACHE_DISK_CACHE && cache->mem_cache.first == NULL) {
+ if (cache->flag & PTCACHE_DISK_CACHE && BLI_listbase_is_empty(&cache->mem_cache)) {
PTCacheID pid;
BKE_ptcache_id_from_particles(&pid, ob, psys);
cache->flag &= ~PTCACHE_DISK_CACHE;
@@ -3597,7 +3597,7 @@ static int collision_detect(ParticleData *pa, ParticleCollision *col, BVHTreeRay
ColliderCache *coll;
float ray_dir[3];
- if (colliders->first == NULL)
+ if (BLI_listbase_is_empty(colliders))
return 0;
sub_v3_v3v3(ray_dir, col->co2, col->co1);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 271160a54f0..df6534946fd 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -3045,12 +3045,9 @@ static PointCache *ptcache_copy(PointCache *cache, int copy_data)
ncache= MEM_dupallocN(cache);
- ncache->mem_cache.first = NULL;
- ncache->mem_cache.last = NULL;
+ BLI_listbase_clear(&ncache->mem_cache);
if (copy_data == FALSE) {
- ncache->mem_cache.first = NULL;
- ncache->mem_cache.last = NULL;
ncache->cached_frames = NULL;
/* flag is a mix of user settings and simulator/baking state */
@@ -3089,7 +3086,7 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old
{
PointCache *cache = ptcaches_old->first;
- ptcaches_new->first = ptcaches_new->last = NULL;
+ BLI_listbase_clear(ptcaches_new);
for (; cache; cache=cache->next)
BLI_addtail(ptcaches_new, ptcache_copy(cache, copy_data));
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index 1fd7dc14c23..3d0713f9514 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -97,7 +97,7 @@ void BKE_reports_clear(ReportList *reports)
report = report_next;
}
- reports->list.first = reports->list.last = NULL;
+ BLI_listbase_clear(&reports->list);
}
void BKE_report(ReportList *reports, ReportType type, const char *_message)
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 922b3860f7e..09bfdbb2d95 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -729,7 +729,7 @@ static void scene_unlink_space_node(SpaceNode *snode, Scene *sce)
path_next = path->next;
MEM_freeN(path);
}
- snode->treepath.first = snode->treepath.last = NULL;
+ BLI_listbase_clear(&snode->treepath);
snode->id = NULL;
snode->from = NULL;
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 5bfd5e67eb1..ab725ae04a9 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -171,11 +171,11 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
Panel *pa, *newpa, *patab;
newar->prev = newar->next = NULL;
- newar->handlers.first = newar->handlers.last = NULL;
- newar->uiblocks.first = newar->uiblocks.last = NULL;
- newar->panels_category.first = newar->panels_category.last = NULL;
- newar->panels_category_active.first = newar->panels_category_active.last = NULL;
- newar->ui_lists.first = newar->ui_lists.last = NULL;
+ BLI_listbase_clear(&newar->handlers);
+ BLI_listbase_clear(&newar->uiblocks);
+ BLI_listbase_clear(&newar->panels_category);
+ BLI_listbase_clear(&newar->panels_category_active);
+ BLI_listbase_clear(&newar->ui_lists);
newar->swinid = 0;
/* use optional regiondata callback */
@@ -191,7 +191,7 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
if (ar->v2d.tab_offset)
newar->v2d.tab_offset = MEM_dupallocN(ar->v2d.tab_offset);
- newar->panels.first = newar->panels.last = NULL;
+ BLI_listbase_clear(&newar->panels);
BLI_duplicatelist(&newar->panels, &ar->panels);
/* copy panel pointers */
@@ -218,7 +218,7 @@ static void region_copylist(SpaceType *st, ListBase *lb1, ListBase *lb2)
ARegion *ar;
/* to be sure */
- lb1->first = lb1->last = NULL;
+ BLI_listbase_clear(lb1);
for (ar = lb2->first; ar; ar = ar->next) {
ARegion *arnew = BKE_area_region_copy(st, ar);
@@ -232,7 +232,7 @@ void BKE_spacedata_copylist(ListBase *lb1, ListBase *lb2)
{
SpaceLink *sl;
- lb1->first = lb1->last = NULL; /* to be sure */
+ BLI_listbase_clear(lb1); /* to be sure */
for (sl = lb2->first; sl; sl = sl->next) {
SpaceType *st = BKE_spacetype_from_id(sl->spacetype);
diff --git a/source/blender/blenkernel/intern/seqcache.c b/source/blender/blenkernel/intern/seqcache.c
index a85e70d2afc..97062f728c5 100644
--- a/source/blender/blenkernel/intern/seqcache.c
+++ b/source/blender/blenkernel/intern/seqcache.c
@@ -257,7 +257,7 @@ void BKE_sequencer_preprocessed_cache_cleanup(void)
}
BLI_freelistN(&preprocess_cache->elems);
- preprocess_cache->elems.first = preprocess_cache->elems.last = NULL;
+ BLI_listbase_clear(&preprocess_cache->elems);
}
static void preprocessed_cache_destruct(void)
diff --git a/source/blender/blenkernel/intern/seqmodifier.c b/source/blender/blenkernel/intern/seqmodifier.c
index b3b5fc1e8d0..27d09eeaf8f 100644
--- a/source/blender/blenkernel/intern/seqmodifier.c
+++ b/source/blender/blenkernel/intern/seqmodifier.c
@@ -622,7 +622,7 @@ void BKE_sequence_modifier_clear(Sequence *seq)
BKE_sequence_modifier_free(smd);
}
- seq->modifiers.first = seq->modifiers.last = NULL;
+ BLI_listbase_clear(&seq->modifiers);
}
void BKE_sequence_modifier_free(SequenceModifierData *smd)
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 675c7dcea95..54cff24bb76 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -279,7 +279,7 @@ void BKE_sequencer_free_clipboard(void)
nseq = seq->next;
seq_free_clipboard_recursive(seq);
}
- seqbase_clipboard.first = seqbase_clipboard.last = NULL;
+ BLI_listbase_clear(&seqbase_clipboard);
}
/* -------------------------------------------------------------------- */
@@ -880,8 +880,8 @@ void BKE_sequencer_sort(Scene *scene)
if (ed == NULL)
return;
- seqbase.first = seqbase.last = NULL;
- effbase.first = effbase.last = NULL;
+ BLI_listbase_clear(&seqbase);
+ BLI_listbase_clear(&effbase);
while ((seq = BLI_pophead(ed->seqbasep))) {
@@ -2502,7 +2502,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, Sequence *seq
#ifdef DURIAN_CAMERA_SWITCH
/* stooping to new low's in hackyness :( */
oldmarkers = scene->markers;
- scene->markers.first = scene->markers.last = NULL;
+ BLI_listbase_clear(&scene->markers);
#else
(void)oldmarkers;
#endif
@@ -4381,7 +4381,7 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup
}
if (seqn->modifiers.first) {
- seqn->modifiers.first = seqn->modifiers.last = NULL;
+ BLI_listbase_clear(&seqn->modifiers);
BKE_sequence_modifier_list_copy(seqn, seq);
}
@@ -4389,7 +4389,7 @@ static Sequence *seq_dupli(Scene *scene, Scene *scene_to, Sequence *seq, int dup
if (seq->type == SEQ_TYPE_META) {
seqn->strip->stripdata = NULL;
- seqn->seqbase.first = seqn->seqbase.last = NULL;
+ BLI_listbase_clear(&seqn->seqbase);
/* WATCH OUT!!! - This metastrip is not recursively duplicated here - do this after!!! */
/* - seq_dupli_recursive(&seq->seqbase, &seqn->seqbase);*/
}
diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c
index bbd637a0a77..da5dd76681d 100644
--- a/source/blender/blenkernel/intern/sketch.c
+++ b/source/blender/blenkernel/intern/sketch.c
@@ -64,8 +64,7 @@ SK_Sketch *createSketch(void)
sketch->active_stroke = NULL;
sketch->gesture = NULL;
- sketch->strokes.first = NULL;
- sketch->strokes.last = NULL;
+ BLI_listbase_clear(&sketch->strokes);
return sketch;
}
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 8636614f7ed..6aaf2ee4df0 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -523,7 +523,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
/* Deprecated */
smd->domain->point_cache[1] = NULL;
- smd->domain->ptcaches[1].first = smd->domain->ptcaches[1].last = NULL;
+ BLI_listbase_clear(&smd->domain->ptcaches[1]);
/* set some standard values */
smd->domain->fluid = NULL;
smd->domain->fluid_mutex = BLI_rw_mutex_alloc();
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 829354ce662..e1396c022cb 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -188,7 +188,7 @@ Text *BKE_text_add(Main *bmain, const char *name)
if ((U.flag & USER_TXT_TABSTOSPACES_DISABLE) == 0)
ta->flags |= TXT_TABSTOSPACES;
- ta->lines.first = ta->lines.last = NULL;
+ BLI_listbase_clear(&ta->lines);
tmp = (TextLine *) MEM_mallocN(sizeof(TextLine), "textline");
tmp->line = (char *) MEM_mallocN(1, "textline_string");
@@ -293,7 +293,7 @@ int BKE_text_reload(Text *text)
BLI_freelistN(&text->lines);
- text->lines.first = text->lines.last = NULL;
+ BLI_listbase_clear(&text->lines);
text->curl = text->sell = NULL;
/* clear undo buffer */
@@ -382,7 +382,7 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const
ta = BKE_libblock_alloc(bmain, ID_TXT, BLI_path_basename(str));
ta->id.us = 1;
- ta->lines.first = ta->lines.last = NULL;
+ BLI_listbase_clear(&ta->lines);
ta->curl = ta->sell = NULL;
if ((U.flag & USER_TXT_TABSTOSPACES_DISABLE) == 0)
@@ -488,7 +488,7 @@ Text *BKE_text_copy(Text *ta)
tan->flags = ta->flags | TXT_ISDIRTY;
- tan->lines.first = tan->lines.last = NULL;
+ BLI_listbase_clear(&tan->lines);
tan->curl = tan->sell = NULL;
tan->nlines = ta->nlines;
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index fbca675e5ee..de20f4a8ac6 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -163,8 +163,8 @@ static void tracking_dopesheet_free(MovieTrackingDopesheet *dopesheet)
BLI_freelistN(&dopesheet->coverage_segments);
/* Ensure lists are clean. */
- dopesheet->channels.first = dopesheet->channels.last = NULL;
- dopesheet->coverage_segments.first = dopesheet->coverage_segments.last = NULL;
+ BLI_listbase_clear(&dopesheet->channels);
+ BLI_listbase_clear(&dopesheet->coverage_segments);
dopesheet->tot_channel = 0;
}
@@ -330,7 +330,7 @@ void BKE_tracking_clipboard_free(void)
track = next_track;
}
- tracking_clipboard.tracks.first = tracking_clipboard.tracks.last = NULL;
+ BLI_listbase_clear(&tracking_clipboard.tracks);
}
/* Copy selected tracks from specified object to the clipboard. */
@@ -357,7 +357,7 @@ void BKE_tracking_clipboard_copy_tracks(MovieTracking *tracking, MovieTrackingOb
/* Check whether there're any tracks in the clipboard. */
bool BKE_tracking_clipboard_has_tracks(void)
{
- return tracking_clipboard.tracks.first != NULL;
+ return (BLI_listbase_is_empty(&tracking_clipboard.tracks) == false);
}
/* Paste tracks from clipboard to specified object.