ListBase API: add utility api funcs for clearing and checking empty

This commit is contained in:
Campbell Barton 2014-02-08 06:07:10 +11:00
parent 1c24d954f4
commit b3afbcab8f
146 changed files with 389 additions and 380 deletions

View File

@ -701,8 +701,7 @@ static void blf_font_fill(FontBLF *font)
font->flags = 0;
font->dpi = 0;
font->size = 0;
font->cache.first = NULL;
font->cache.last = NULL;
BLI_listbase_clear(&font->cache);
font->glyph_cache = NULL;
font->blur = 0;
font->max_tex_size = -1;

View File

@ -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;
}
}

View File

@ -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");

View File

@ -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])

View File

@ -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;

View File

@ -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);
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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])

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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 */

View File

@ -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 */

View File

@ -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:

View File

@ -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 */

View File

@ -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;
}

View File

@ -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])

View File

@ -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) {

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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))) {

View File

@ -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);

View File

@ -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);

View File

@ -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));

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -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);*/
}

View File

@ -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;
}

View File

@ -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();

View File

@ -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;

View File

@ -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.

View File

@ -77,6 +77,13 @@ void BLI_reverselist(struct ListBase *lb);
void BLI_rotatelist_first(struct ListBase *lb, void *vlink);
void BLI_rotatelist_last(struct ListBase *lb, void *vlink);
/**
* Utility functions to avoid first/last references inline all over.
*/
BLI_INLINE bool BLI_listbase_is_single(const struct ListBase *lb) { return (lb->first && lb->first == lb->last); }
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb) { return (lb->first == NULL); }
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb) { lb->first = lb->last = NULL; }
/* create a generic list node containing link to provided data */
struct LinkData *BLI_genericNodeN(void *data);

View File

@ -122,7 +122,7 @@ bArgs *BLI_argsInit(int argc, const char **argv)
bArgs *ba = MEM_callocN(sizeof(bArgs), "bArgs");
ba->passes = MEM_callocN(sizeof(int) * argc, "bArgs passes");
ba->items = BLI_ghash_new(keyhash, keycmp, "bArgs passes gh");
ba->docs.first = ba->docs.last = NULL;
BLI_listbase_clear(&ba->docs);
ba->argc = argc;
ba->argv = argv;

View File

@ -233,7 +233,7 @@ static void mempool_chunk_free_all(ListBase *chunks, const unsigned int flag)
mpchunk_next = mpchunk->next;
mempool_chunk_free(mpchunk, flag);
}
chunks->first = chunks->last = NULL;
BLI_listbase_clear(chunks);
}
BLI_mempool *BLI_mempool_create(unsigned int esize, unsigned int totelem,
@ -268,7 +268,7 @@ BLI_mempool *BLI_mempool_create(unsigned int esize, unsigned int totelem,
pool->flag = flag;
pool->pchunk = pchunk;
pool->csize = esize * pchunk;
pool->chunks.first = pool->chunks.last = NULL;
BLI_listbase_clear(&pool->chunks);
pool->free = NULL; /* mempool_chunk_add assigns */
pool->maxchunks = maxchunks;
#ifdef USE_TOTALLOC
@ -598,7 +598,7 @@ void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve)
#endif
chunks_temp = pool->chunks;
pool->chunks.first = pool->chunks.last = NULL;
BLI_listbase_clear(&pool->chunks);
while ((mpchunk = BLI_pophead(&chunks_temp))) {
lasttail = mempool_chunk_add(pool, mpchunk, lasttail);

View File

@ -754,9 +754,9 @@ void BLI_scanfill_end(ScanFillContext *sf_ctx)
BLI_memarena_free(sf_ctx->arena);
sf_ctx->arena = NULL;
sf_ctx->fillvertbase.first = sf_ctx->fillvertbase.last = NULL;
sf_ctx->filledgebase.first = sf_ctx->filledgebase.last = NULL;
sf_ctx->fillfacebase.first = sf_ctx->fillfacebase.last = NULL;
BLI_listbase_clear(&sf_ctx->fillvertbase);
BLI_listbase_clear(&sf_ctx->filledgebase);
BLI_listbase_clear(&sf_ctx->fillfacebase);
}
void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, MemArena *arena)
@ -764,9 +764,9 @@ void BLI_scanfill_end_arena(ScanFillContext *sf_ctx, MemArena *arena)
BLI_memarena_clear(arena);
BLI_assert(sf_ctx->arena == arena);
sf_ctx->fillvertbase.first = sf_ctx->fillvertbase.last = NULL;
sf_ctx->filledgebase.first = sf_ctx->filledgebase.last = NULL;
sf_ctx->fillfacebase.first = sf_ctx->fillfacebase.last = NULL;
BLI_listbase_clear(&sf_ctx->fillvertbase);
BLI_listbase_clear(&sf_ctx->filledgebase);
BLI_listbase_clear(&sf_ctx->fillfacebase);
}
unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const float nor_proj[3])
@ -994,7 +994,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const
}
}
}
if (sf_ctx->filledgebase.first == NULL) {
if (BLI_listbase_is_empty(&sf_ctx->filledgebase)) {
/* printf("All edges removed\n"); */
return 0;
}
@ -1112,8 +1112,8 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const
tempve.last = sf_ctx->fillvertbase.last;
temped.first = sf_ctx->filledgebase.first;
temped.last = sf_ctx->filledgebase.last;
sf_ctx->fillvertbase.first = sf_ctx->fillvertbase.last = NULL;
sf_ctx->filledgebase.first = sf_ctx->filledgebase.last = NULL;
BLI_listbase_clear(&sf_ctx->fillvertbase);
BLI_listbase_clear(&sf_ctx->filledgebase);
pf = pflist;
for (a = 0; a < poly; a++) {

View File

@ -156,7 +156,7 @@ TaskScheduler *BLI_task_scheduler_create(int num_threads)
* threads, so we keep track of the number of users. */
scheduler->do_exit = false;
scheduler->queue.first = scheduler->queue.last = NULL;
BLI_listbase_clear(&scheduler->queue);
BLI_mutex_init(&scheduler->queue_mutex);
BLI_condition_init(&scheduler->queue_cond);

View File

@ -184,7 +184,7 @@ void BLI_init_threads(ListBase *threadbase, void *(*do_thread)(void *), int tot)
int a;
if (threadbase != NULL && tot > 0) {
threadbase->first = threadbase->last = NULL;
BLI_listbase_clear(threadbase);
if (tot > RE_MAX_THREAD) tot = RE_MAX_THREAD;
else if (tot < 1) tot = 1;
@ -318,7 +318,7 @@ void BLI_end_threads(ListBase *threadbase)
/* only needed if there's actually some stuff to end
* this way we don't end up decrementing thread_levels on an empty threadbase
* */
if (threadbase && threadbase->first != NULL) {
if (threadbase && (BLI_listbase_is_empty(threadbase) == false)) {
for (tslot = threadbase->first; tslot; tslot = tslot->next) {
if (tslot->avail == 0) {
pthread_join(tslot->pthread, NULL);

View File

@ -326,7 +326,7 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, const char *filename, MemFil
/* Library structs themselves */
bfd->main->library = oldmain->library;
oldmain->library.first = oldmain->library.last = NULL;
BLI_listbase_clear(&oldmain->library);
/* add the Library mainlist to the new main */
BLI_remlink(&mainlist, oldmain);

View File

@ -489,7 +489,7 @@ void blo_split_main(ListBase *mainlist, Main *main)
mainlist->first = mainlist->last = main;
main->next = NULL;
if (main->library.first == NULL)
if (BLI_listbase_is_empty(&main->library))
return;
for (lib = main->library.first; lib; lib = lib->id.next) {
@ -1573,7 +1573,7 @@ static void link_list(FileData *fd, ListBase *lb) /* only direct data */
{
Link *ln, *prev;
if (lb->first == NULL) return;
if (BLI_listbase_is_empty(lb)) return;
lb->first = newdataadr(fd, lb->first);
ln = lb->first;
@ -1592,7 +1592,7 @@ static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */
Link *ln, *prev;
void *poin;
if (lb->first == NULL) return;
if (BLI_listbase_is_empty(lb)) return;
poin = newdataadr(fd, lb->first);
if (lb->first) {
oldnewmap_insert(fd->globmap, lb->first, poin, 0);
@ -3127,7 +3127,7 @@ static void direct_link_mball(FileData *fd, MetaBall *mb)
link_list(fd, &(mb->elems));
mb->disp.first = mb->disp.last = NULL;
BLI_listbase_clear(&mb->disp);
mb->editelems = NULL;
/* mb->edit_elems.first= mb->edit_elems.last= NULL;*/
mb->lastelem = NULL;
@ -3539,7 +3539,7 @@ static void direct_link_material(FileData *fd, Material *ma)
}
ma->preview = direct_link_preview_image(fd, ma->preview);
ma->gpumaterial.first = ma->gpumaterial.last = NULL;
BLI_listbase_clear(&ma->gpumaterial);
}
/* ************ READ PARTICLE SETTINGS ***************** */
@ -3585,7 +3585,7 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache)
}
}
else
cache->mem_cache.first = cache->mem_cache.last = NULL;
BLI_listbase_clear(&cache->mem_cache);
cache->flag &= ~PTCACHE_SIMULATION_VALID;
cache->simframe = 0;
@ -3656,7 +3656,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
if (part->dupliweights.first && part->dup_group) {
int index_ok = 0;
/* check for old files without indices (all indexes 0) */
if (part->dupliweights.first == part->dupliweights.last) {
if (BLI_listbase_is_single(&part->dupliweights)) {
/* special case for only one object in the group */
index_ok = 1;
}
@ -3684,7 +3684,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
}
}
else {
part->dupliweights.first = part->dupliweights.last = NULL;
BLI_listbase_clear(&part->dupliweights);
}
if (part->boids) {
@ -3847,8 +3847,8 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
psys->free_edit = NULL;
psys->pathcache = NULL;
psys->childcache = NULL;
psys->pathcachebufs.first = psys->pathcachebufs.last = NULL;
psys->childcachebufs.first = psys->childcachebufs.last = NULL;
BLI_listbase_clear(&psys->pathcachebufs);
BLI_listbase_clear(&psys->childcachebufs);
psys->frand = NULL;
psys->pdd = NULL;
psys->renderdata = NULL;
@ -4540,8 +4540,8 @@ static void direct_link_pose(FileData *fd, bPose *pose)
if (pchan->mpath)
direct_link_motionpath(fd, pchan->mpath);
pchan->iktree.first = pchan->iktree.last = NULL;
pchan->siktree.first = pchan->siktree.last = NULL;
BLI_listbase_clear(&pchan->iktree);
BLI_listbase_clear(&pchan->siktree);
/* in case this value changes in future, clamp else we get undefined behavior */
CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX);
@ -4643,8 +4643,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
}
BKE_ptcache_free(cache);
}
smd->domain->ptcaches[1].first = NULL;
smd->domain->ptcaches[1].last = NULL;
BLI_listbase_clear(&smd->domain->ptcaches[1]);
smd->domain->point_cache[1] = NULL;
}
}
@ -5036,7 +5035,7 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->bb = NULL;
ob->derivedDeform = NULL;
ob->derivedFinal = NULL;
ob->gpulamp.first= ob->gpulamp.last = NULL;
BLI_listbase_clear(&ob->gpulamp);
link_list(fd, &ob->pc_ids);
/* Runtime curve data */
@ -5519,11 +5518,11 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
win->curswin = NULL;
win->tweak = NULL;
win->queue.first = win->queue.last = NULL;
win->handlers.first = win->handlers.last = NULL;
win->modalhandlers.first = win->modalhandlers.last = NULL;
win->subwindows.first = win->subwindows.last = NULL;
win->gesture.first = win->gesture.last = NULL;
BLI_listbase_clear(&win->queue);
BLI_listbase_clear(&win->handlers);
BLI_listbase_clear(&win->modalhandlers);
BLI_listbase_clear(&win->subwindows);
BLI_listbase_clear(&win->gesture);
win->drawdata = NULL;
win->drawmethod = -1;
@ -5535,19 +5534,19 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
win->modalcursor = 0;
}
wm->timers.first = wm->timers.last = NULL;
wm->operators.first = wm->operators.last = NULL;
wm->paintcursors.first = wm->paintcursors.last = NULL;
wm->queue.first = wm->queue.last = NULL;
BLI_listbase_clear(&wm->timers);
BLI_listbase_clear(&wm->operators);
BLI_listbase_clear(&wm->paintcursors);
BLI_listbase_clear(&wm->queue);
BKE_reports_init(&wm->reports, RPT_STORE);
wm->keyconfigs.first = wm->keyconfigs.last = NULL;
BLI_listbase_clear(&wm->keyconfigs);
wm->defaultconf = NULL;
wm->addonconf = NULL;
wm->userconf = NULL;
wm->jobs.first = wm->jobs.last = NULL;
wm->drags.first = wm->drags.last = NULL;
BLI_listbase_clear(&wm->jobs);
BLI_listbase_clear(&wm->drags);
wm->windrawable = NULL;
wm->winactive = NULL;
@ -6189,9 +6188,9 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
ar->v2d.tab_num = 0;
ar->v2d.tab_cur = 0;
ar->v2d.sms = NULL;
ar->panels_category.first = ar->panels_category.last = NULL;
ar->handlers.first = ar->handlers.last = NULL;
ar->uiblocks.first = ar->uiblocks.last = NULL;
BLI_listbase_clear(&ar->panels_category);
BLI_listbase_clear(&ar->handlers);
BLI_listbase_clear(&ar->uiblocks);
ar->headerstr = NULL;
ar->swinid = 0;
ar->type = NULL;
@ -6266,7 +6265,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
link_list(fd, &(sa->spacedata));
link_list(fd, &(sa->regionbase));
sa->handlers.first = sa->handlers.last = NULL;
BLI_listbase_clear(&sa->handlers);
sa->type = NULL; /* spacetype callbacks */
sa->region_active_win = -1;
@ -6323,9 +6322,9 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
direct_link_gpencil(fd, v3d->gpd);
}
v3d->localvd = newdataadr(fd, v3d->localvd);
v3d->afterdraw_transp.first = v3d->afterdraw_transp.last = NULL;
v3d->afterdraw_xray.first = v3d->afterdraw_xray.last = NULL;
v3d->afterdraw_xraytransp.first = v3d->afterdraw_xraytransp.last = NULL;
BLI_listbase_clear(&v3d->afterdraw_transp);
BLI_listbase_clear(&v3d->afterdraw_xray);
BLI_listbase_clear(&v3d->afterdraw_xraytransp);
v3d->properties_storage = NULL;
v3d->defmaterial = NULL;
@ -6339,7 +6338,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
SpaceIpo *sipo = (SpaceIpo *)sl;
sipo->ads = newdataadr(fd, sipo->ads);
sipo->ghostCurves.first = sipo->ghostCurves.last = NULL;
BLI_listbase_clear(&sipo->ghostCurves);
}
else if (sl->spacetype == SPACE_NLA) {
SpaceNla *snla = (SpaceNla *)sl;
@ -6407,7 +6406,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
link_list(fd, &snode->treepath);
snode->edittree = NULL;
snode->linkdrag.first = snode->linkdrag.last = NULL;
BLI_listbase_clear(&snode->linkdrag);
}
else if (sl->spacetype == SPACE_TEXT) {
SpaceText *st= (SpaceText *)sl;
@ -6418,7 +6417,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
}
else if (sl->spacetype == SPACE_TIME) {
SpaceTime *stime = (SpaceTime *)sl;
stime->caches.first = stime->caches.last = NULL;
BLI_listbase_clear(&stime->caches);
}
else if (sl->spacetype == SPACE_LOGIC) {
SpaceLogic *slogic = (SpaceLogic *)sl;
@ -6508,7 +6507,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc)
}
}
sa->actionzones.first = sa->actionzones.last = NULL;
BLI_listbase_clear(&sa->actionzones);
sa->v1 = newdataadr(fd, sa->v1);
sa->v2 = newdataadr(fd, sa->v2);
@ -6764,8 +6763,8 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
clip->tracking.stabilization.rot_track = newdataadr(fd, clip->tracking.stabilization.rot_track);
clip->tracking.dopesheet.ok = 0;
clip->tracking.dopesheet.channels.first = clip->tracking.dopesheet.channels.last = NULL;
clip->tracking.dopesheet.coverage_segments.first = clip->tracking.dopesheet.coverage_segments.last = NULL;
BLI_listbase_clear(&clip->tracking.dopesheet.channels);
BLI_listbase_clear(&clip->tracking.dopesheet.coverage_segments);
link_list(fd, &tracking->objects);

View File

@ -934,7 +934,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *main)
//BKE_ptcache_ids_from_object(&pidlist, ob);
//for (pid = pidlist.first; pid; pid = pid->next) {
// if (pid->ptcaches->first == NULL)
// if (BLI_listbase_is_empty(pid->ptcaches))
// pid->ptcaches->first = pid->ptcaches->last = pid->cache;
//}

View File

@ -248,7 +248,7 @@ static void do_versions_nodetree_multi_file_output_format_2_62_1(Scene *sce, bNo
/* ugly, need to remove the old inputs list to avoid bad pointer checks when adding new sockets.
* sock->storage is expected to contain path info in ntreeCompositOutputFileAddSocket.
*/
node->inputs.first = node->inputs.last = NULL;
BLI_listbase_clear(&node->inputs);
node->storage = nimf;
@ -921,7 +921,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *main)
if (!tracking->settings.object_distance)
tracking->settings.object_distance = 1.0f;
if (tracking->objects.first == NULL)
if (BLI_listbase_is_empty(&tracking->objects))
BKE_tracking_object_add(tracking, "Camera");
while (tracking_object) {

View File

@ -2210,8 +2210,9 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
sce->r.yparts = 4;
/* adds default layer */
if (sce->r.layers.first == NULL)
if (BLI_listbase_is_empty(&sce->r.layers)) {
BKE_scene_add_render_layer(sce, NULL);
}
else {
SceneRenderLayer *srl;
/* new layer flag for sky, was default for solid */

View File

@ -252,7 +252,7 @@ static bool bm_loop_path_build_step(BLI_mempool *vs_pool, ListBase *lb, const in
/* lb is now full of free'd items, overwrite */
*lb = lb_tmp;
return (lb->first != NULL);
return (BLI_listbase_is_empty(lb) == false);
}
bool BM_mesh_edgeloops_find_path(BMesh *bm, ListBase *r_eloops,

View File

@ -874,7 +874,6 @@ void _bm_select_history_store_after(BMesh *bm, BMEditSelection *ese_ref, BMHeade
void BM_select_history_clear(BMesh *bm)
{
BLI_freelistN(&bm->selected);
bm->selected.first = bm->selected.last = NULL;
}

View File

@ -1498,7 +1498,7 @@ void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg)
bool BMO_error_occurred(BMesh *bm)
{
return bm->errorstack.first != NULL;
return (BLI_listbase_is_empty(&bm->errorstack) == false);
}
/* returns error code or 0 if no error */

View File

@ -116,7 +116,7 @@ void BMW_init(BMWalker *walker, BMesh *bm, int type,
}
walker->worklist = BLI_mempool_create(walker->structsize, 100, 100, BLI_MEMPOOL_SYSMALLOC);
walker->states.first = walker->states.last = NULL;
BLI_listbase_clear(&walker->states);
}
/**

View File

@ -386,8 +386,7 @@ void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op)
/* setup context */
{
pc.state_lb.first = NULL;
pc.state_lb.last = NULL;
BLI_listbase_clear(&pc.state_lb);
pc.link_pool = BLI_mempool_create(sizeof(PathLink), 1, 512, BLI_MEMPOOL_SYSMALLOC);
}
@ -486,7 +485,7 @@ void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op)
}
}
if (pc.state_lb.first == NULL) {
if (BLI_listbase_is_empty(&pc.state_lb)) {
found_all = false;
}

View File

@ -168,7 +168,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce,
node.setNodeSid(node_sid);
#if 0
if (bone->childbase.first == NULL || BLI_countlist(&(bone->childbase)) >= 2) {
if (BLI_listbase_is_empty(&bone->childbase) || BLI_countlist(&(bone->childbase)) >= 2) {
add_blender_leaf_bone( bone, ob_arm, node);
}
else {

View File

@ -189,7 +189,7 @@ void SceneExporter::writeNodes(Object *ob, Scene *sce)
colladaNode.end();
}
if (ob->constraints.first != NULL ) {
if (BLI_listbase_is_empty(&ob->constraints) == false) {
bConstraint *con = (bConstraint *) ob->constraints.first;
while (con) {
std::string con_name(id_name(con));

View File

@ -80,7 +80,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, short datatype, int f
/* try to build list of filtered items */
ANIM_animdata_filter(ac, &anim_data, filter, data, datatype);
if (anim_data.first == NULL)
if (BLI_listbase_is_empty(&anim_data))
return;
/* only clear the 'active' flag for the channels of the same type */
@ -550,7 +550,7 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f
/* if group has no more channels, remove it too,
* otherwise can have many dangling groups [#33541]
*/
if (agrp->channels.first == NULL) {
if (BLI_listbase_is_empty(&agrp->channels)) {
BLI_freelinkN(&act->groups, agrp);
}
}
@ -565,7 +565,7 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f
* channel list that are empty, and linger around long after the data they
* are for has disappeared (and probably won't come back).
*/
if ((act->curves.first == NULL) && (adt->flag & ADT_NLA_EDIT_ON) == 0) {
if (BLI_listbase_is_empty(&act->curves) && (adt->flag & ADT_NLA_EDIT_ON) == 0) {
id_us_min(&act->id);
adt->action = NULL;
}
@ -844,7 +844,7 @@ static void rearrange_animchannel_flatten_islands(ListBase *islands, ListBase *s
tReorderChannelIsland *island, *isn = NULL;
/* make sure srcList is empty now */
BLI_assert(srcList->first == NULL);
BLI_assert(BLI_listbase_is_empty(srcList));
/* go through merging islands */
for (island = islands->first; island; island = isn) {
@ -866,7 +866,7 @@ static bool rearrange_animchannel_islands(ListBase *list, AnimChanRearrangeFp re
short done = FALSE;
/* don't waste effort on an empty list */
if (list->first == NULL)
if (BLI_listbase_is_empty(list))
return 0;
/* group channels into islands */
@ -1221,7 +1221,7 @@ static void animchannels_group_channels(bAnimContext *ac, bAnimListElem *adt_ref
/* remove F-Curve from group, then group too if it is now empty */
action_groups_remove_channel(act, fcu);
if ((grp) && (grp->channels.first == NULL)) {
if ((grp) && BLI_listbase_is_empty(&grp->channels)) {
BLI_freelinkN(&act->groups, grp);
}
@ -1326,7 +1326,7 @@ static int animchannels_ungroup_exec(bContext *C, wmOperator *UNUSED(op))
BLI_addtail(&act->curves, fcu);
/* delete group if it is now empty */
if (agrp->channels.first == NULL) {
if (BLI_listbase_is_empty(&agrp->channels)) {
BLI_freelinkN(&act->groups, agrp);
}
}

View File

@ -1175,7 +1175,7 @@ static size_t animfilter_act_group(bAnimContext *ac, ListBase *anim_data, bDopeS
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
@ -1429,7 +1429,7 @@ static size_t animdata_filter_gpencil(ListBase *anim_data, void *UNUSED(data), i
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
}
@ -1496,7 +1496,7 @@ static size_t animdata_filter_mask(ListBase *anim_data, void *UNUSED(data), int
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
}
@ -1532,7 +1532,7 @@ static size_t animdata_filter_ds_nodetree_group(bAnimContext *ac, ListBase *anim
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
@ -1614,7 +1614,7 @@ static size_t animdata_filter_ds_linestyle(bAnimContext *ac, ListBase *anim_data
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
}
@ -1659,7 +1659,7 @@ static size_t animdata_filter_ds_texture(bAnimContext *ac, ListBase *anim_data,
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
@ -1757,7 +1757,7 @@ static size_t animdata_filter_ds_material(bAnimContext *ac, ListBase *anim_data,
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
@ -1877,7 +1877,7 @@ static size_t animdata_filter_ds_modifiers(bAnimContext *ac, ListBase *anim_data
if (afm.items) {
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &afm.tmp_data);
BLI_assert((afm.tmp_data.first == afm.tmp_data.last) && (afm.tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&afm.tmp_data));
items += afm.items;
}
@ -1920,7 +1920,7 @@ static size_t animdata_filter_ds_particles(bAnimContext *ac, ListBase *anim_data
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
}
@ -2068,7 +2068,7 @@ static size_t animdata_filter_ds_obdata(bAnimContext *ac, ListBase *anim_data, b
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
@ -2102,7 +2102,7 @@ static size_t animdata_filter_ds_keyanim(bAnimContext *ac, ListBase *anim_data,
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
@ -2158,7 +2158,7 @@ static size_t animdata_filter_ds_obanim(bAnimContext *ac, ListBase *anim_data, b
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
@ -2228,7 +2228,7 @@ static size_t animdata_filter_dopesheet_ob(bAnimContext *ac, ListBase *anim_data
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
@ -2270,7 +2270,7 @@ static size_t animdata_filter_ds_world(bAnimContext *ac, ListBase *anim_data, bD
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
@ -2324,7 +2324,7 @@ static size_t animdata_filter_ds_scene(bAnimContext *ac, ListBase *anim_data, bD
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
@ -2381,7 +2381,7 @@ static size_t animdata_filter_dopesheet_scene(bAnimContext *ac, ListBase *anim_d
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert((tmp_data.first == tmp_data.last) && (tmp_data.first == NULL));
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}

View File

@ -505,7 +505,7 @@ void free_anim_copybuf(void)
}
/* restore initial state */
animcopybuf.first = animcopybuf.last = NULL;
BLI_listbase_clear(&animcopybuf);
animcopy_firstframe = 999999999.0f;
animcopy_lastframe = -999999999.0f;
}
@ -774,19 +774,19 @@ short paste_animedit_keys(bAnimContext *ac, ListBase *anim_data,
const Scene *scene = (ac->scene);
const short from_single = (animcopybuf.first == animcopybuf.last);
const short to_simple = (anim_data->first == anim_data->last);
const bool from_single = BLI_listbase_is_single(&animcopybuf);
const bool to_simple = BLI_listbase_is_single(anim_data);
float offset = 0.0f;
int pass;
/* check if buffer is empty */
if (animcopybuf.first == NULL) {
if (BLI_listbase_is_empty(&animcopybuf)) {
BKE_report(ac->reports, RPT_ERROR, "No animation data in buffer to paste");
return -1;
}
if (anim_data->first == NULL) {
if (BLI_listbase_is_empty(anim_data)) {
BKE_report(ac->reports, RPT_ERROR, "No selected F-Curves to paste into");
return -1;
}

View File

@ -183,7 +183,7 @@ FCurve *verify_fcurve(bAction *act, const char group[], PointerRNA *ptr,
fcu = MEM_callocN(sizeof(FCurve), "FCurve");
fcu->flag = (FCURVE_VISIBLE | FCURVE_SELECTED);
if (act->curves.first == NULL)
if (BLI_listbase_is_empty(&act->curves))
fcu->flag |= FCURVE_ACTIVE; /* first one added active */
/* store path - make copy, and store that */

View File

@ -892,7 +892,7 @@ short ANIM_validate_keyingset(bContext *C, ListBase *dsources, KeyingSet *ks)
/* if we don't have any paths now, then this still qualifies as invalid context */
// FIXME: we need some error conditions (to be retrieved from the iterator why this failed!)
if (ks->paths.first == NULL)
if (BLI_listbase_is_empty(&ks->paths))
return MODIFYKEY_INVALID_CONTEXT;
}
else {

View File

@ -808,7 +808,7 @@ static int armature_merge_exec(bContext *C, wmOperator *op)
/* get chains (ends on chains) */
chains_find_tips(arm->edbo, &chains);
if (chains.first == NULL) return OPERATOR_CANCELLED;
if (BLI_listbase_is_empty(&chains)) return OPERATOR_CANCELLED;
/* each 'chain' is the last bone in the chain (with no children) */
for (chain = chains.first; chain; chain = nchain) {
@ -916,7 +916,7 @@ static int armature_switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
/* get chains of bones (ends on chains) */
chains_find_tips(arm->edbo, &chains);
if (chains.first == NULL) return OPERATOR_CANCELLED;
if (BLI_listbase_is_empty(&chains)) return OPERATOR_CANCELLED;
/* ensure that mirror bones will also be operated on */
armature_tag_select_mirrored(arm);

View File

@ -655,8 +655,7 @@ static void ED_armature_ebone_listbase_free(ListBase *lb)
MEM_freeN(ebone);
}
lb->first = NULL;
lb->last = NULL;
BLI_listbase_clear(lb);
}
static void ED_armature_ebone_listbase_copy(ListBase *lb_dst, ListBase *lb_src)
@ -664,7 +663,7 @@ static void ED_armature_ebone_listbase_copy(ListBase *lb_dst, ListBase *lb_src)
EditBone *ebone_src;
EditBone *ebone_dst;
BLI_assert(lb_dst->first == NULL);
BLI_assert(BLI_listbase_is_empty(lb_dst));
for (ebone_src = lb_src->first; ebone_src; ebone_src = ebone_src->next) {
ebone_dst = MEM_dupallocN(ebone_src);

View File

@ -944,7 +944,7 @@ static void RIG_joinArcs(RigGraph *rg, RigNode *node, RigArc *joined_arc1, RigAr
joined_arc1->tail = joined_arc2->tail;
joined_arc2->edges.first = joined_arc2->edges.last = NULL;
BLI_listbase_clear(&joined_arc2->edges);
BLI_removeArc((BGraph *)rg, (BArc *)joined_arc2);
@ -2593,7 +2593,7 @@ void BIF_retargetArc(bContext *C, ReebArc *earc, RigGraph *template_rigg)
template_rigg = armatureSelectedToGraph(C, ob, ob->data);
}
if (template_rigg->arcs.first == NULL) {
if (BLI_listbase_is_empty(&template_rigg->arcs)) {
// XXX
// error("No Template and no deforming bones selected");
return;

View File

@ -979,7 +979,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
float mvalf[2];
BLI_freelistN(&sketch->depth_peels);
sketch->depth_peels.first = sketch->depth_peels.last = NULL;
BLI_listbase_clear(&sketch->depth_peels);
mvalf[0] = dd->mval[0];
mvalf[1] = dd->mval[1];
@ -1915,8 +1915,8 @@ void sk_applyConvertGesture(bContext *C, SK_Gesture *UNUSED(gest), SK_Sketch *sk
static void sk_initGesture(bContext *C, SK_Gesture *gest, SK_Sketch *sketch)
{
gest->intersections.first = gest->intersections.last = NULL;
gest->self_intersections.first = gest->self_intersections.last = NULL;
BLI_listbase_clear(&gest->intersections);
BLI_listbase_clear(&gest->self_intersections);
gest->segments = sk_createStroke();
gest->stk = sketch->gesture;
@ -2093,8 +2093,7 @@ static void sk_drawSketch(Scene *scene, View3D *UNUSED(v3d), SK_Sketch *sketch,
}
#if 0
if (sketch->depth_peels.first != NULL)
{
if (BLI_listbase_is_empty(&sketch->depth_peels) == false) {
float colors[8][3] = {
{1, 0, 0},
{0, 1, 0},

View File

@ -399,7 +399,7 @@ static int group_sort_exec(bContext *C, wmOperator *UNUSED(op))
qsort(agrp_array, agrp_count, sizeof(tSortActionGroup), compare_agroup);
/* create sorted bone group list from sorted array */
pose->agroups.first = pose->agroups.last = NULL;
BLI_listbase_clear(&pose->agroups);
for (i = 0; i < agrp_count; i++) {
BLI_addtail(&pose->agroups, agrp_array[i].agrp);
}

View File

@ -1069,7 +1069,7 @@ static void poselib_preview_get_next(tPoseLib_PreviewData *pld, int step)
}
/* check if any matches */
if (pld->searchp.first == NULL) {
if (BLI_listbase_is_empty(&pld->searchp)) {
pld->marker = NULL;
return;
}

View File

@ -129,7 +129,7 @@ void poseAnim_mapping_get(bContext *C, ListBase *pfLinks, Object *ob, bAction *a
/* if no PoseChannels were found, try a second pass, doing visible ones instead
* i.e. if nothing selected, do whole pose
*/
if (pfLinks->first == NULL) {
if (BLI_listbase_is_empty(pfLinks)) {
CTX_DATA_BEGIN (C, bPoseChannel *, pchan, visible_pose_bones)
{
fcurves_to_pchan_links_get(pfLinks, ob, act, pchan);

View File

@ -1380,7 +1380,7 @@ static int separate_exec(bContext *C, wmOperator *op)
/* 1. duplicate geometry and check for valid selection for separate */
adduplicateflagNurb(oldob, &newnurb, SELECT, true);
if (newnurb.first == NULL) {
if (BLI_listbase_is_empty(&newnurb)) {
WM_cursor_wait(0);
BKE_report(op->reports, RPT_ERROR, "Cannot separate current selection");
return OPERATOR_CANCELLED;
@ -1444,7 +1444,7 @@ static int curve_split_exec(bContext *C, wmOperator *op)
adduplicateflagNurb(obedit, &newnurb, SELECT, true);
if (newnurb.first != NULL) {
if (BLI_listbase_is_empty(&newnurb) == false) {
curve_delete_segments(obedit, true);
BLI_movelisttolist(editnurb, &newnurb);
@ -2245,7 +2245,7 @@ static void adduplicateflagNurb(Object *obedit, ListBase *newnurb,
nu = nu->prev;
}
if (newnurb->first != NULL) {
if (BLI_listbase_is_empty(newnurb) == false) {
cu->actnu = cu->actvert = CU_ACT_NONE;
for (nu = newnurb->first; nu; nu = nu->next) {
@ -5915,7 +5915,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
adduplicateflagNurb(obedit, &newnurb, SELECT, false);
if (newnurb.first != NULL) {
if (BLI_listbase_is_empty(&newnurb) == false) {
BLI_movelisttolist(object_editcurve_get(obedit), &newnurb);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
}
@ -6511,7 +6511,7 @@ int join_curve_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
tempbase.first = tempbase.last = NULL;
BLI_listbase_clear(&tempbase);
/* trasnform all selected curves inverse in obact */
invert_m4_m4(imat, ob->obmat);

View File

@ -275,7 +275,7 @@ void free_gpcopybuf()
{
free_gpencil_layers(&gpcopybuf);
gpcopybuf.first = gpcopybuf.last = NULL;
BLI_listbase_clear(&gpcopybuf);
gpcopy_firstframe = 999999999;
}
@ -311,7 +311,7 @@ void copy_gpdata()
gpls = (bGPDlayer *)ale->data;
gpln = MEM_callocN(sizeof(bGPDlayer), "GPCopyPasteLayer");
gpln->frames.first = gpln->frames.last = NULL;
BLI_listbase_clear(&gpln->frames);
BLI_strncpy(gpln->info, gpls->info, sizeof(gpln->info));
BLI_addtail(&gpcopybuf, gpln);
@ -449,7 +449,7 @@ void paste_gpdata(Scene *scene)
}
/* if no strokes (i.e. new frame) added, free gpf */
if (gpf->strokes.first == NULL)
if (BLI_listbase_is_empty(&gpf->strokes))
gpencil_layer_delframe(gpld, gpf);
}

View File

@ -1422,7 +1422,7 @@ static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bG
return;
/* only convert if there are any strokes on this layer's frame to convert */
if (gpf->strokes.first == NULL)
if (BLI_listbase_is_empty(&gpf->strokes))
return;
/* initialize camera framing */

View File

@ -63,7 +63,7 @@ static bGPundonode *cur_node = NULL;
int ED_gpencil_session_active(void)
{
return undo_nodes.first != NULL;
return (BLI_listbase_is_empty(&undo_nodes) == false);
}
int ED_undo_gpencil_step(bContext *C, int step, const char *name)
@ -100,7 +100,7 @@ int ED_undo_gpencil_step(bContext *C, int step, const char *name)
free_gpencil_layers(&gpd->layers);
/* copy layers */
gpd->layers.first = gpd->layers.last = NULL;
BLI_listbase_clear(&gpd->layers);
for (gpl = new_gpd->layers.first; gpl; gpl = gpl->next) {
/* make a copy of source layer and its data */

View File

@ -252,7 +252,7 @@ void ui_bounds_block(uiBlock *block)
uiBut *bt;
int xof;
if (block->buttons.first == NULL) {
if (BLI_listbase_is_empty(&block->buttons)) {
if (block->panel) {
block->rect.xmin = 0.0; block->rect.xmax = block->panel->sizex;
block->rect.ymin = 0.0; block->rect.ymax = block->panel->sizey;
@ -3535,7 +3535,7 @@ void uiBlockFlipOrder(uiBlock *block)
}
/* also flip order in block itself, for example for arrowkey */
lb.first = lb.last = NULL;
BLI_listbase_clear(&lb);
but = block->buttons.first;
while (but) {
next = but->next;

View File

@ -542,7 +542,7 @@ static void ui_apply_but_funcs_after(bContext *C)
/* copy to avoid recursive calls */
funcs = UIAfterFuncs;
UIAfterFuncs.first = UIAfterFuncs.last = NULL;
BLI_listbase_clear(&UIAfterFuncs);
for (afterf = funcs.first; afterf; afterf = after.next) {
after = *afterf; /* copy to avoid memleak on exit() */
@ -7906,8 +7906,9 @@ static int ui_handler_region(bContext *C, const wmEvent *event, void *UNUSED(use
ar = CTX_wm_region(C);
retval = WM_UI_HANDLER_CONTINUE;
if (ar == NULL) return retval;
if (ar->uiblocks.first == NULL) return retval;
if (ar == NULL || BLI_listbase_is_empty(&ar->uiblocks)) {
return retval;
}
/* either handle events for already activated button or try to activate */
but = ui_but_find_activated(ar);

View File

@ -709,7 +709,7 @@ static void init_iconfile_list(struct ListBase *list)
int totfile, i, index = 1;
const char *icondir;
list->first = list->last = NULL;
BLI_listbase_clear(list);
icondir = BLI_get_folder(BLENDER_DATAFILES, "icons");
if (icondir == NULL)

View File

@ -2703,7 +2703,7 @@ static void ui_item_estimate(uiItem *item)
for (subitem = litem->items.first; subitem; subitem = subitem->next)
ui_item_estimate(subitem);
if (litem->items.first == NULL)
if (BLI_listbase_is_empty(&litem->items))
return;
if (litem->scale[0] != 0.0f || litem->scale[1] != 0.0f)
@ -2793,7 +2793,7 @@ static void ui_item_layout(uiItem *item)
if (item->type != ITEM_BUTTON) {
uiLayout *litem = (uiLayout *)item;
if (litem->items.first == NULL)
if (BLI_listbase_is_empty(&litem->items))
return;
if (litem->align)

View File

@ -1030,7 +1030,7 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op))
/* not essential but confuses users when there are keys with no data!
* assume if they delete all data from the layer they also dont care about keys */
if (masklay->splines.first == NULL) {
if (BLI_listbase_is_empty(&masklay->splines)) {
BKE_mask_layer_free_shapes(masklay);
}
}

View File

@ -262,7 +262,7 @@ static ListBase *knife_empty_list(KnifeTool_OpData *kcd)
ListBase *lst;
lst = BLI_memarena_alloc(kcd->arena, sizeof(ListBase));
lst->first = lst->last = NULL;
BLI_listbase_clear(lst);
return lst;
}

View File

@ -2774,7 +2774,7 @@ static int edbm_select_ungrouped_poll(bContext *C)
if ((em->selectmode & SCE_SELECT_VERTEX) == 0) {
CTX_wm_operator_poll_msg_set(C, "Must be in vertex selection mode");
}
else if (obedit->defbase.first == NULL || cd_dvert_offset == -1) {
else if (BLI_listbase_is_empty(&obedit->defbase) || cd_dvert_offset == -1) {
CTX_wm_operator_poll_msg_set(C, "No weights/vertex groups on object");
}
else {

View File

@ -131,7 +131,7 @@ static int mball_select_all_exec(bContext *C, wmOperator *op)
MetaElem *ml;
int action = RNA_enum_get(op->ptr, "action");
if (mb->editelems->first == NULL)
if (BLI_listbase_is_empty(mb->editelems))
return OPERATOR_CANCELLED;
if (action == SEL_TOGGLE) {
@ -702,7 +702,6 @@ static void *editMball_to_undoMball(void *lbe, void *UNUSED(obe))
/* allocate memory for undo ListBase */
lb = MEM_callocN(sizeof(ListBase), "listbase undo");
lb->first = lb->last = NULL;
/* copy contents of current ListBase to the undo ListBase */
ml = editelems->first;

View File

@ -1299,7 +1299,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
ob->adt = NULL;
ob->parent = NULL;
ob->constraints.first = ob->constraints.last = NULL;
BLI_listbase_clear(&ob->constraints);
ob->curve_cache = NULL;
ob->transflag &= ~OB_DUPLI;
ob->lay = base->lay;

View File

@ -1497,7 +1497,8 @@ static EnumPropertyItem *object_mode_set_itemsf(bContext *C, PointerRNA *UNUSED(
ob = CTX_data_active_object(C);
if (ob) {
const bool use_mode_particle_edit = (ob->particlesystem.first != NULL) || (ob->soft != NULL) ||
const bool use_mode_particle_edit = (BLI_listbase_is_empty(&ob->particlesystem) == false) ||
(ob->soft != NULL) ||
(modifiers_findByType(ob, eModifierType_Cloth) != NULL);
while (input->identifier) {
if ((input->value == OB_MODE_EDIT && OB_TYPE_SUPPORT_EDITMODE(ob->type)) ||

View File

@ -523,7 +523,7 @@ static int lattice_select_ungrouped_exec(bContext *C, wmOperator *op)
BPoint *bp;
int a, tot;
if (obedit->defbase.first == NULL || lt->dvert == NULL) {
if (BLI_listbase_is_empty(&obedit->defbase) || lt->dvert == NULL) {
BKE_report(op->reports, RPT_ERROR, "No weights/vertex groups on object");
return OPERATOR_CANCELLED;
}

View File

@ -313,7 +313,7 @@ static bool object_modifier_remove(Main *bmain, Object *ob, ModifierData *md,
}
if (ELEM(md->type, eModifierType_Softbody, eModifierType_Cloth) &&
ob->particlesystem.first == NULL)
BLI_listbase_is_empty(&ob->particlesystem))
{
ob->mode &= ~OB_MODE_PARTICLE_EDIT;
}

View File

@ -467,7 +467,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
changed = object_select_all_by_dup_group(C, ob);
}
else if (nr == OBJECT_SELECT_LINKED_PARTICLE) {
if (ob->particlesystem.first == NULL)
if (BLI_listbase_is_empty(&ob->particlesystem))
return OPERATOR_CANCELLED;
changed = object_select_all_by_particle(C, ob);

View File

@ -2814,7 +2814,7 @@ static void vgroup_delete_object_mode(Object *ob, bDeformGroup *dg)
ob->actdef = 1;
/* remove all dverts */
if (ob->defbase.first == NULL) {
if (BLI_listbase_is_empty(&ob->defbase)) {
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
@ -2963,7 +2963,7 @@ static void vgroup_delete_edit_mode(Object *ob, bDeformGroup *dg)
ob->actdef = 1;
/* remove all dverts */
if (ob->defbase.first == NULL) {
if (BLI_listbase_is_empty(&ob->defbase)) {
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
@ -4057,7 +4057,7 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op)
{
if (ob_act != ob_src) {
if (ob_src->defbase.first == NULL) {
if (BLI_listbase_is_empty(&ob_src->defbase)) {
BKE_reportf(op->reports, RPT_WARNING,
"Skipping object '%s' it has no vertex groups", ob_src->id.name + 2);
continue;
@ -4133,7 +4133,7 @@ static int vertex_group_transfer_weight_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
if (op->reports->list.first == NULL) {
if (BLI_listbase_is_empty(&op->reports->list)) {
BKE_report(op->reports, RPT_WARNING, "Failed, no other selected objects with vertex groups found");
}

View File

@ -227,7 +227,7 @@ static PTCacheEdit *pe_get_current(Scene *scene, Object *ob, int create)
BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
/* in the case of only one editable thing, set pset->edittype accordingly */
if (pidlist.first && pidlist.first == pidlist.last) {
if (BLI_listbase_is_single(&pidlist)) {
pid = pidlist.first;
switch (pid->type) {
case PTCACHE_TYPE_PARTICLES:
@ -4266,7 +4266,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
if (cache && cache->flag & PTCACHE_DISK_CACHE)
return;
if (psys == NULL && (cache && cache->mem_cache.first == NULL))
if (psys == NULL && (cache && BLI_listbase_is_empty(&cache->mem_cache)))
return;
edit = (psys) ? psys->edit : cache->edit;
@ -4285,7 +4285,7 @@ static void PE_create_particle_edit(Scene *scene, Object *ob, PointCache *cache,
psys->free_edit= PE_free_ptcache_edit;
edit->pathcache = NULL;
edit->pathcachebufs.first = edit->pathcachebufs.last = NULL;
BLI_listbase_clear(&edit->pathcachebufs);
pa = psys->particles;
LOOP_POINTS {

View File

@ -1447,7 +1447,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
break;
/* old spacedata... happened during work on 2.50, remove */
if (sl && sl->regionbase.first == NULL) {
if (sl && BLI_listbase_is_empty(&sl->regionbase)) {
st->free(sl);
BLI_freelinkN(&sa->spacedata, sl);
if (slold == sl) {
@ -1460,7 +1460,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
/* swap regions */
slold->regionbase = sa->regionbase;
sa->regionbase = sl->regionbase;
sl->regionbase.first = sl->regionbase.last = NULL;
BLI_listbase_clear(&sl->regionbase);
/* put in front of list */
BLI_remlink(&sa->spacedata, sl);
@ -1476,7 +1476,7 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
if (slold)
slold->regionbase = sa->regionbase;
sa->regionbase = sl->regionbase;
sl->regionbase.first = sl->regionbase.last = NULL;
BLI_listbase_clear(&sl->regionbase);
}
}

View File

@ -500,7 +500,7 @@ static void screen_copy(bScreen *to, bScreen *from)
BLI_duplicatelist(&to->vertbase, &from->vertbase);
BLI_duplicatelist(&to->edgebase, &from->edgebase);
BLI_duplicatelist(&to->areabase, &from->areabase);
to->regionbase.first = to->regionbase.last = NULL;
BLI_listbase_clear(&to->regionbase);
s2 = to->vertbase.first;
for (s1 = from->vertbase.first; s1; s1 = s1->next, s2 = s2->next) {
@ -520,10 +520,10 @@ static void screen_copy(bScreen *to, bScreen *from)
sa->v3 = sa->v3->newv;
sa->v4 = sa->v4->newv;
sa->spacedata.first = sa->spacedata.last = NULL;
sa->regionbase.first = sa->regionbase.last = NULL;
sa->actionzones.first = sa->actionzones.last = NULL;
sa->handlers.first = sa->handlers.last = NULL;
BLI_listbase_clear(&sa->spacedata);
BLI_listbase_clear(&sa->regionbase);
BLI_listbase_clear(&sa->actionzones);
BLI_listbase_clear(&sa->handlers);
area_copy_data(sa, saf, 0);
}

View File

@ -191,7 +191,7 @@ static int undo_stack_step(bContext *C, UndoStack *stack, int step, const char *
}
}
else if (step == -1) {
if ((stack->current != NULL && stack->current->next == NULL) || stack->elems.first == NULL) {
if ((stack->current != NULL && stack->current->next == NULL) || BLI_listbase_is_empty(&stack->elems)) {
/* pass */
}
else {

View File

@ -41,6 +41,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BLI_listbase.h"
#include "BLI_rect.h"
#include "BLF_translation.h"
@ -523,7 +524,7 @@ static int vert_select_ungrouped_exec(bContext *C, wmOperator *op)
Object *ob = CTX_data_active_object(C);
Mesh *me = ob->data;
if ((ob->defbase.first == NULL) || (me->dvert == NULL)) {
if (BLI_listbase_is_empty(&ob->defbase) || (me->dvert == NULL)) {
BKE_report(op->reports, RPT_ERROR, "No weights/vertex groups on object");
return OPERATOR_CANCELLED;
}

View File

@ -2183,7 +2183,7 @@ static bool wpaint_ensure_data(bContext *C, wmOperator *op)
}
}
}
if (ob->defbase.first == NULL) {
if (BLI_listbase_is_empty(&ob->defbase)) {
ED_vgroup_add(ob);
}

View File

@ -34,6 +34,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_listbase.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
@ -175,7 +176,7 @@ static void vpaint_proj_dm_map_cosnos_update(struct VertProjHandle *vp_handle,
DerivedMesh *dm;
/* quick sanity check - we shouldn't have to run this if there are no modifiers */
BLI_assert(ob->modifiers.first != NULL);
BLI_assert(BLI_listbase_is_empty(&ob->modifiers) == false);
dm = mesh_get_derived_final(scene, ob, CD_MASK_BAREMESH | CD_MASK_ORIGINDEX);

View File

@ -319,7 +319,7 @@ static void buttons_texture_users_from_context(ListBase *users, const bContext *
ma = give_current_material(ob, ob->actcol);
/* fill users */
users->first = users->last = NULL;
BLI_listbase_clear(users);
if (ma && !limited_mode)
buttons_texture_users_find_nodetree(users, &ma->id, ma->nodetree, "Material");

View File

@ -122,8 +122,8 @@ static SpaceLink *console_duplicate(SpaceLink *sl)
/* clear or remove stuff from old */
/* TODO - duplicate?, then we also need to duplicate the py namespace */
sconsolen->scrollback.first = sconsolen->scrollback.last = NULL;
sconsolen->history.first = sconsolen->history.last = NULL;
BLI_listbase_clear(&sconsolen->scrollback);
BLI_listbase_clear(&sconsolen->history);
return (SpaceLink *)sconsolen;
}
@ -216,7 +216,7 @@ static void console_main_area_draw(const bContext *C, ARegion *ar)
View2D *v2d = &ar->v2d;
View2DScrollers *scrollers;
if (sc->scrollback.first == NULL)
if (BLI_listbase_is_empty(&sc->scrollback))
WM_operator_name_call((bContext *)C, "CONSOLE_OT_banner", WM_OP_EXEC_DEFAULT, NULL);
/* clear and setup matrix */

View File

@ -801,7 +801,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
/* No curve to modify/visualise the result?
* => We still want to show the 1-1 default...
*/
if ((fcu->totvert == 0) && (fcu->modifiers.first == NULL)) {
if ((fcu->totvert == 0) && BLI_listbase_is_empty(&fcu->modifiers)) {
float t;
/* draw with thin dotted lines in style of what curve would have been */

Some files were not shown because too many files have changed in this diff Show More