diff options
Diffstat (limited to 'source/blender/blenkernel/intern/mball.c')
-rw-r--r-- | source/blender/blenkernel/intern/mball.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 79e70ad2741..4294d279c36 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -430,9 +430,8 @@ Object *BKE_mball_basis_find(Scene *scene, Object *basis) BLI_split_name_num(basisname, &basisnr, basis->id.name + 2, '.'); - for (ViewLayer *view_layer = scene->view_layers.first; view_layer; - view_layer = view_layer->next) { - for (Base *base = view_layer->object_bases.first; base; base = base->next) { + LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) { + LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { Object *ob = base->object; if ((ob->type == OB_MBALL) && !(base->flag & BASE_FROM_DUPLI)) { if (ob != bob) { @@ -463,7 +462,7 @@ bool BKE_mball_minmax_ex( INIT_MINMAX(min, max); - for (const MetaElem *ml = mb->elems.first; ml; ml = ml->next) { + LISTBASE_FOREACH (const MetaElem *, ml, &mb->elems) { if ((ml->flag & flag) == flag) { const float scale_mb = (ml->rad * 0.5f) * scale; int i; @@ -493,7 +492,7 @@ bool BKE_mball_minmax(const MetaBall *mb, float min[3], float max[3]) { INIT_MINMAX(min, max); - for (const MetaElem *ml = mb->elems.first; ml; ml = ml->next) { + LISTBASE_FOREACH (const MetaElem *, ml, &mb->elems) { minmax_v3v3_v3(min, max, &ml->x); } @@ -506,7 +505,7 @@ bool BKE_mball_center_median(const MetaBall *mb, float r_cent[3]) zero_v3(r_cent); - for (const MetaElem *ml = mb->elems.first; ml; ml = ml->next) { + LISTBASE_FOREACH (const MetaElem *, ml, &mb->elems) { add_v3_v3(r_cent, &ml->x); total++; } @@ -538,7 +537,7 @@ void BKE_mball_transform(MetaBall *mb, const float mat[4][4], const bool do_prop mat4_to_quat(quat, mat); - for (MetaElem *ml = mb->elems.first; ml; ml = ml->next) { + LISTBASE_FOREACH (MetaElem *, ml, &mb->elems) { mul_m4_v3(mat, &ml->x); mul_qt_qtqt(ml->quat, quat, ml->quat); @@ -558,7 +557,7 @@ void BKE_mball_transform(MetaBall *mb, const float mat[4][4], const bool do_prop void BKE_mball_translate(MetaBall *mb, const float offset[3]) { - for (MetaElem *ml = mb->elems.first; ml; ml = ml->next) { + LISTBASE_FOREACH (MetaElem *, ml, &mb->elems) { add_v3_v3(&ml->x, offset); } } @@ -567,7 +566,7 @@ void BKE_mball_translate(MetaBall *mb, const float offset[3]) int BKE_mball_select_count(const MetaBall *mb) { int sel = 0; - for (const MetaElem *ml = mb->editelems->first; ml; ml = ml->next) { + LISTBASE_FOREACH (const MetaElem *, ml, mb->editelems) { if (ml->flag & SELECT) { sel++; } @@ -589,7 +588,7 @@ int BKE_mball_select_count_multi(Base **bases, int bases_len) bool BKE_mball_select_all(MetaBall *mb) { bool changed = false; - for (MetaElem *ml = mb->editelems->first; ml; ml = ml->next) { + LISTBASE_FOREACH (MetaElem *, ml, mb->editelems) { if ((ml->flag & SELECT) == 0) { ml->flag |= SELECT; changed = true; @@ -612,7 +611,7 @@ bool BKE_mball_select_all_multi_ex(Base **bases, int bases_len) bool BKE_mball_deselect_all(MetaBall *mb) { bool changed = false; - for (MetaElem *ml = mb->editelems->first; ml; ml = ml->next) { + LISTBASE_FOREACH (MetaElem *, ml, mb->editelems) { if ((ml->flag & SELECT) != 0) { ml->flag &= ~SELECT; changed = true; @@ -636,7 +635,7 @@ bool BKE_mball_deselect_all_multi_ex(Base **bases, int bases_len) bool BKE_mball_select_swap(MetaBall *mb) { bool changed = false; - for (MetaElem *ml = mb->editelems->first; ml; ml = ml->next) { + LISTBASE_FOREACH (MetaElem *, ml, mb->editelems) { ml->flag ^= SELECT; changed = true; } |