diff options
Diffstat (limited to 'source/blender/blenkernel/intern/modifier.c')
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index abf4fc82300..6ace8f87994 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -244,15 +244,12 @@ bool BKE_modifier_is_preview(ModifierData *md) ModifierData *BKE_modifiers_findby_type(Object *ob, ModifierType type) { - ModifierData *md = ob->modifiers.first; - - for (; md; md = md->next) { + LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { if (md->type == type) { - break; + return md; } } - - return md; + return NULL; } ModifierData *BKE_modifiers_findby_name(Object *ob, const char *name) @@ -262,24 +259,17 @@ ModifierData *BKE_modifiers_findby_name(Object *ob, const char *name) void BKE_modifiers_clear_errors(Object *ob) { - ModifierData *md = ob->modifiers.first; - /* int qRedraw = 0; */ - - for (; md; md = md->next) { + LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { if (md->error) { MEM_freeN(md->error); md->error = NULL; - - /* qRedraw = 1; */ } } } void BKE_modifiers_foreach_ID_link(Object *ob, IDWalkFunc walk, void *userData) { - ModifierData *md = ob->modifiers.first; - - for (; md; md = md->next) { + LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); if (mti->foreachIDLink) { @@ -290,9 +280,7 @@ void BKE_modifiers_foreach_ID_link(Object *ob, IDWalkFunc walk, void *userData) void BKE_modifiers_foreach_tex_link(Object *ob, TexWalkFunc walk, void *userData) { - ModifierData *md = ob->modifiers.first; - - for (; md; md = md->next) { + LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); if (mti->foreachTexLink) { @@ -437,7 +425,6 @@ int BKE_modifiers_get_cage_index(struct Scene *scene, ModifierData *md = (is_virtual) ? BKE_modifiers_get_virtual_modifierlist(ob, &virtualModifierData) : ob->modifiers.first; - int i, cageIndex = -1; if (r_lastPossibleCageIndex) { /* ensure the value is initialized */ @@ -445,7 +432,8 @@ int BKE_modifiers_get_cage_index(struct Scene *scene, } /* Find the last modifier acting on the cage. */ - for (i = 0; md; i++, md = md->next) { + int cageIndex = -1; + for (int i = 0; md; i++, md = md->next) { const ModifierTypeInfo *mti = BKE_modifier_get_info(md->type); bool supports_mapping; |