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:
authorHans Goudey <h.goudey@me.com>2021-01-08 06:24:46 +0300
committerHans Goudey <h.goudey@me.com>2021-01-08 06:24:46 +0300
commit09ea339a6c247a2de3ca97cdfdc8c7f7b85e7665 (patch)
tree11e2bbaa3965eed737dce6aa94ed4ebe9658465a /source/blender/editors/object
parent15bb8f9f936ee5ff50d6c6951d03bc1cd051f466 (diff)
Cleanup: Use LISTBASE_FOREACH macro
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_edit.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 3eb77df96b3..c6a70f9b866 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -504,7 +504,7 @@ static bool mesh_needs_keyindex(Main *bmain, const Mesh *me)
return false; /* will be added */
}
- for (const Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+ LISTBASE_FOREACH (const Object *, ob, &bmain->objects) {
if ((ob->parent) && (ob->parent->data == me) && ELEM(ob->partype, PARVERT1, PARVERT3)) {
return true;
}
@@ -650,12 +650,10 @@ bool ED_object_editmode_exit_ex(Main *bmain, Scene *scene, Object *obedit, int f
/* freedata only 0 now on file saves and render */
if (freedata) {
- ListBase pidlist;
- PTCacheID *pid;
-
/* flag object caches as outdated */
+ ListBase pidlist;
BKE_ptcache_ids_from_object(&pidlist, obedit, scene, 0);
- for (pid = pidlist.first; pid; pid = pid->next) {
+ LISTBASE_FOREACH (PTCacheID *, pid, &pidlist) {
/* particles don't need reset on geometry change */
if (pid->type != PTCACHE_TYPE_PARTICLES) {
pid->cache->flag |= PTCACHE_OUTDATED;
@@ -1398,7 +1396,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
CTX_data_selected_editable_objects(C, &ctx_objects);
}
- for (CollectionPointerLink *ctx_ob = ctx_objects.first; ctx_ob; ctx_ob = ctx_ob->next) {
+ LISTBASE_FOREACH (CollectionPointerLink *, ctx_ob, &ctx_objects) {
Object *ob = ctx_ob->ptr.data;
ID *data = ob->data;
if (data != NULL) {
@@ -1406,7 +1404,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
}
}
- for (CollectionPointerLink *ctx_ob = ctx_objects.first; ctx_ob; ctx_ob = ctx_ob->next) {
+ LISTBASE_FOREACH (CollectionPointerLink *, ctx_ob, &ctx_objects) {
/* Always un-tag all object data-blocks irrespective of our ability to operate on them. */
Object *ob = ctx_ob->ptr.data;
ID *data = ob->data;
@@ -1817,11 +1815,9 @@ struct MoveToCollectionData {
static int move_to_collection_menus_create(wmOperator *op, MoveToCollectionData *menu)
{
int index = menu->index;
- for (CollectionChild *child = menu->collection->children.first; child != NULL;
- child = child->next) {
+ LISTBASE_FOREACH (CollectionChild *, child, &menu->collection->children) {
Collection *collection = child->collection;
- MoveToCollectionData *submenu = MEM_callocN(sizeof(MoveToCollectionData),
- "MoveToCollectionData submenu - expected memleak");
+ MoveToCollectionData *submenu = MEM_callocN(sizeof(MoveToCollectionData), __func__);
BLI_addtail(&menu->submenus, submenu);
submenu->collection = collection;
submenu->index = ++index;
@@ -1833,8 +1829,7 @@ static int move_to_collection_menus_create(wmOperator *op, MoveToCollectionData
static void move_to_collection_menus_free_recursive(MoveToCollectionData *menu)
{
- for (MoveToCollectionData *submenu = menu->submenus.first; submenu != NULL;
- submenu = submenu->next) {
+ LISTBASE_FOREACH (MoveToCollectionData *, submenu, &menu->submenus) {
move_to_collection_menus_free_recursive(submenu);
}
BLI_freelistN(&menu->submenus);
@@ -1873,8 +1868,7 @@ static void move_to_collection_menu_create(bContext *C, uiLayout *layout, void *
UI_icon_color_from_collection(menu->collection);
uiItemIntO(layout, name, icon, menu->ot->idname, "collection_index", menu->index);
- for (MoveToCollectionData *submenu = menu->submenus.first; submenu != NULL;
- submenu = submenu->next) {
+ LISTBASE_FOREACH (MoveToCollectionData *, submenu, &menu->submenus) {
move_to_collection_menus_items(layout, submenu);
}
}