Cleanup: macro's w/ an _END need a matching _BEGIN

Convention from 2.7x, since some looping macros don't need an '_END',
it avoids confusion to keep this.
This commit is contained in:
2018-03-01 19:00:54 +11:00
parent 1fc5eb305a
commit 7aed2de798
27 changed files with 50 additions and 50 deletions

View File

@@ -83,7 +83,7 @@ void BKE_scene_objects_iterator_begin(struct BLI_Iterator *iter, void *data_in);
void BKE_scene_objects_iterator_next(struct BLI_Iterator *iter);
void BKE_scene_objects_iterator_end(struct BLI_Iterator *iter);
#define FOREACH_SCENE_COLLECTION(_id, _instance) \
#define FOREACH_SCENE_COLLECTION_BEGIN(_id, _instance) \
ITER_BEGIN(BKE_scene_collections_iterator_begin, \
BKE_scene_collections_iterator_next, \
BKE_scene_collections_iterator_end, \
@@ -92,7 +92,7 @@ void BKE_scene_objects_iterator_end(struct BLI_Iterator *iter);
#define FOREACH_SCENE_COLLECTION_END \
ITER_END
#define FOREACH_SCENE_OBJECT(scene, _instance) \
#define FOREACH_SCENE_OBJECT_BEGIN(scene, _instance) \
ITER_BEGIN(BKE_scene_objects_iterator_begin, \
BKE_scene_objects_iterator_next, \
BKE_scene_objects_iterator_end, \

View File

@@ -199,7 +199,7 @@ void BKE_visible_bases_iterator_begin(BLI_Iterator *iter, void *data_in);
void BKE_visible_bases_iterator_next(BLI_Iterator *iter);
void BKE_visible_bases_iterator_end(BLI_Iterator *iter);
#define FOREACH_SELECTED_OBJECT(view_layer, _instance) \
#define FOREACH_SELECTED_OBJECT_BEGIN(view_layer, _instance) \
ITER_BEGIN(BKE_selected_objects_iterator_begin, \
BKE_selected_objects_iterator_next, \
BKE_selected_objects_iterator_end, \
@@ -208,7 +208,7 @@ void BKE_visible_bases_iterator_end(BLI_Iterator *iter);
#define FOREACH_SELECTED_OBJECT_END \
ITER_END
#define FOREACH_VISIBLE_OBJECT(view_layer, _instance) \
#define FOREACH_VISIBLE_OBJECT_BEGIN(view_layer, _instance) \
ITER_BEGIN(BKE_visible_objects_iterator_begin, \
BKE_visible_objects_iterator_next, \
BKE_visible_objects_iterator_end, \
@@ -217,7 +217,7 @@ void BKE_visible_bases_iterator_end(BLI_Iterator *iter);
#define FOREACH_VISIBLE_OBJECT_END \
ITER_END
#define FOREACH_SELECTED_BASE(view_layer, _instance) \
#define FOREACH_SELECTED_BASE_BEGIN(view_layer, _instance) \
ITER_BEGIN(BKE_selected_bases_iterator_begin, \
BKE_selected_bases_iterator_next, \
BKE_selected_bases_iterator_end, \
@@ -226,7 +226,7 @@ void BKE_visible_bases_iterator_end(BLI_Iterator *iter);
#define FOREACH_SELECTED_BASE_END \
ITER_END
#define FOREACH_VISIBLE_BASE(view_layer, _instance) \
#define FOREACH_VISIBLE_BASE_BEGIN(view_layer, _instance) \
ITER_BEGIN(BKE_visible_bases_iterator_begin, \
BKE_visible_bases_iterator_next, \
BKE_visible_bases_iterator_end, \
@@ -236,7 +236,7 @@ void BKE_visible_bases_iterator_end(BLI_Iterator *iter);
ITER_END
#define FOREACH_OBJECT(view_layer, _instance) \
#define FOREACH_OBJECT_BEGIN(view_layer, _instance) \
{ \
Object *_instance; \
Base *_base; \
@@ -247,7 +247,7 @@ void BKE_visible_bases_iterator_end(BLI_Iterator *iter);
} \
}
#define FOREACH_OBJECT_FLAG(scene, view_layer, flag, _instance) \
#define FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, _instance) \
{ \
IteratorBeginCb func_begin; \
IteratorCb func_next, func_end; \
@@ -284,7 +284,7 @@ typedef struct ObjectsRenderableIteratorData {
} iter;
} ObjectsRenderableIteratorData;
#define FOREACH_OBJECT_RENDERABLE(scene_, _instance) \
#define FOREACH_OBJECT_RENDERABLE_BEGIN(scene_, _instance) \
ObjectsRenderableIteratorData data_ = { \
.scene = (scene_), \
}; \

View File

@@ -218,7 +218,7 @@ bool BKE_collection_remove(ID *owner_id, SceneCollection *sc)
ListBase collection_objects;
BLI_duplicatelist(&collection_objects, &sc->objects);
FOREACH_SCENE_COLLECTION(owner_id, scene_collection_iter)
FOREACH_SCENE_COLLECTION_BEGIN(owner_id, scene_collection_iter)
{
if (scene_collection_iter == sc) {
continue;
@@ -405,7 +405,7 @@ bool BKE_collection_object_add(const ID *owner_id, SceneCollection *sc, Object *
*/
void BKE_collection_object_add_from(Scene *scene, Object *ob_src, Object *ob_dst)
{
FOREACH_SCENE_COLLECTION(scene, sc)
FOREACH_SCENE_COLLECTION_BEGIN(scene, sc)
{
if (BLI_findptr(&sc->objects, ob_src, offsetof(LinkData, data))) {
collection_object_add(&scene->id, sc, ob_dst);
@@ -480,7 +480,7 @@ bool BKE_collections_object_remove(Main *bmain, ID *owner_id, Object *ob, const
BLI_assert(GS(owner_id->name) == ID_GR);
}
FOREACH_SCENE_COLLECTION(owner_id, sc)
FOREACH_SCENE_COLLECTION_BEGIN(owner_id, sc)
{
removed |= BKE_collection_object_remove(bmain, owner_id, sc, ob, free_us);
}
@@ -552,7 +552,7 @@ Group *BKE_collection_group_create(Main *bmain, Scene *scene, LayerCollection *l
sc_dst = BKE_collection_add(&group->id, NULL, COLLECTION_TYPE_GROUP_INTERNAL, sc_src->name);
BKE_collection_copy_data(sc_dst, sc_src, 0);
FOREACH_SCENE_COLLECTION(&group->id, sc_group)
FOREACH_SCENE_COLLECTION_BEGIN(&group->id, sc_group)
{
sc_group->type = COLLECTION_TYPE_GROUP_INTERNAL;
}

View File

@@ -440,7 +440,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
CALLBACK_INVOKE(scene->gpd, IDWALK_CB_USER);
FOREACH_SCENE_COLLECTION(scene, sc)
FOREACH_SCENE_COLLECTION_BEGIN(scene, sc)
{
for (LinkData *link = sc->objects.first; link; link = link->next) {
CALLBACK_INVOKE_ID(link->data, IDWALK_CB_USER);

View File

@@ -313,7 +313,7 @@ static void libblock_remap_data_preprocess(IDRemap *r_id_remap_data)
/* In case we are unlinking... */
if (!r_id_remap_data->old_id) {
/* ... everything from scene. */
FOREACH_SCENE_OBJECT(sce, ob_iter)
FOREACH_SCENE_OBJECT_BEGIN(sce, ob_iter)
{
libblock_remap_data_preprocess_scene_object_unlink(
r_id_remap_data, sce, ob_iter, skip_indirect, is_indirect);
@@ -391,7 +391,7 @@ static void libblock_remap_data_postprocess_group_scene_unlink(Main *UNUSED(bmai
{
/* Note that here we assume no object has no base (i.e. all objects are assumed instanced
* in one scene...). */
FOREACH_SCENE_OBJECT(sce, ob)
FOREACH_SCENE_OBJECT_BEGIN(sce, ob)
{
if (ob->flag & OB_FROMGROUP) {
Group *grp = BKE_group_object_find(NULL, ob);

View File

@@ -2956,7 +2956,7 @@ static void psys_update_path_cache(ParticleSimulationData *sim, float cfra, cons
/* particle instance modifier with "path" option need cached paths even if particle system doesn't */
FOREACH_SCENE_OBJECT(sim->scene, ob)
FOREACH_SCENE_OBJECT_BEGIN(sim->scene, ob)
{
ModifierData *md = modifiers_findByType(ob, eModifierType_ParticleInstance);
if (md) {

View File

@@ -67,7 +67,7 @@ EffectsExporter::EffectsExporter(COLLADASW::StreamWriter *sw, const ExportSettin
bool EffectsExporter::hasEffects(Scene *sce)
{
FOREACH_SCENE_OBJECT(sce, ob)
FOREACH_SCENE_OBJECT_BEGIN(sce, ob)
{
int a;
for (a = 0; a < ob->totcol; a++) {

View File

@@ -124,7 +124,7 @@ void DEG_iterator_objects_end(struct BLI_Iterator *iter);
* Although they are available they have no overrides (collection_properties)
* and will crash if you try to access it.
*/
#define DEG_OBJECT_ITER(graph_, instance_, mode_, flag_) \
#define DEG_OBJECT_ITER_BEGIN(graph_, instance_, mode_, flag_) \
{ \
DEGObjectIterData data_ = { \
.graph = (graph_), \
@@ -145,7 +145,7 @@ void DEG_iterator_objects_end(struct BLI_Iterator *iter);
* Depsgraph objects iterator for draw manager and final render
*/
#define DEG_OBJECT_ITER_FOR_RENDER_ENGINE(graph_, instance_, mode_) \
DEG_OBJECT_ITER(graph_, instance_, mode_, \
DEG_OBJECT_ITER_BEGIN(graph_, instance_, mode_, \
DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | \
DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | \
DEG_ITER_OBJECT_FLAG_VISIBLE | \

View File

@@ -1464,7 +1464,7 @@ void DRW_draw_select_loop(
drw_engines_cache_populate(obact);
}
else {
DEG_OBJECT_ITER(depsgraph, ob, DRW_iterator_mode_get(),
DEG_OBJECT_ITER_BEGIN(depsgraph, ob, DRW_iterator_mode_get(),
DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
DEG_ITER_OBJECT_FLAG_VISIBLE |
DEG_ITER_OBJECT_FLAG_DUPLI)

View File

@@ -158,7 +158,7 @@ void BIF_makeListTemplates(const bContext *C)
TEMPLATES_HASH = BLI_ghash_int_new("makeListTemplates gh");
TEMPLATES_CURRENT = 0;
FOREACH_OBJECT(view_layer, ob)
FOREACH_OBJECT_BEGIN(view_layer, ob)
{
if (ob != obedit && ob->type == OB_ARMATURE) {
index++;

View File

@@ -351,7 +351,7 @@ static void id_search_cb_objects_from_scene(const bContext *C, void *arg_templat
BKE_main_id_flag_listbase(lb, LIB_TAG_DOIT, false);
FOREACH_SCENE_OBJECT(scene, ob_iter)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob_iter)
{
ob_iter->id.tag |= LIB_TAG_DOIT;
}

View File

@@ -1719,7 +1719,7 @@ static int convert_exec(bContext *C, wmOperator *op)
/* don't forget multiple users! */
{
FOREACH_SCENE_OBJECT(scene, ob)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
{
ob->flag &= ~OB_DONE;
@@ -2009,7 +2009,7 @@ static int convert_exec(bContext *C, wmOperator *op)
if (!keep_original) {
if (mballConverted) {
FOREACH_SCENE_OBJECT(scene, ob_mball)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob_mball)
{
if (ob_mball->type == OB_MBALL) {
if (ob_mball->flag & OB_DONE) {

View File

@@ -1747,7 +1747,7 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
* button can be functional.*/
void ED_object_single_user(Main *bmain, Scene *scene, Object *ob)
{
FOREACH_SCENE_OBJECT(scene, ob_iter)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob_iter)
{
ob_iter->flag &= ~OB_DONE;
}
@@ -1791,7 +1791,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer
ID *id;
int a;
FOREACH_OBJECT_FLAG(scene, view_layer, flag, ob)
FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, ob)
{
if (!ID_IS_LINKED(ob)) {
id = ob->data;
@@ -1849,7 +1849,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer
printf("ERROR %s: can't copy %s\n", __func__, id->name);
BLI_assert(!"This should never happen.");
/* We need to end the FOREACH_OBJECT_FLAG iterator to prevent memory leak. */
/* We need to end the FOREACH_OBJECT_FLAG_BEGIN iterator to prevent memory leak. */
BKE_scene_objects_iterator_end(&iter_macro);
return;
}
@@ -1876,7 +1876,7 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer
static void single_object_action_users(Scene *scene, ViewLayer *view_layer, const int flag)
{
FOREACH_OBJECT_FLAG(scene, view_layer, flag, ob)
FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, ob)
if (!ID_IS_LINKED(ob)) {
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
BKE_animdata_copy_id_action(&ob->id, false);
@@ -1890,7 +1890,7 @@ static void single_mat_users(Main *bmain, Scene *scene, ViewLayer *view_layer, c
Tex *tex;
int a, b;
FOREACH_OBJECT_FLAG(scene, view_layer, flag, ob)
FOREACH_OBJECT_FLAG_BEGIN(scene, view_layer, flag, ob)
if (!ID_IS_LINKED(ob)) {
for (a = 1; a <= ob->totcol; a++) {
ma = give_current_material(ob, a);
@@ -2045,7 +2045,7 @@ void ED_object_single_users(Main *bmain, Scene *scene, const bool full, const bo
{
IDP_RelinkProperty(scene->id.properties);
FOREACH_SCENE_OBJECT(scene, ob)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
{
if (!ID_IS_LINKED(ob)) {
IDP_RelinkProperty(ob->id.properties);

View File

@@ -159,7 +159,7 @@ void ED_object_base_activate(bContext *C, Base *base)
if (workspace->object_mode & OB_MODE_ALL_MODE_DATA) {
EvaluationContext eval_ctx;
CTX_data_eval_ctx(C, &eval_ctx);
FOREACH_OBJECT(view_layer, ob) {
FOREACH_OBJECT_BEGIN(view_layer, ob) {
if (ob != obact) {
ED_object_mode_generic_exit(&eval_ctx, workspace, scene, ob);
}

View File

@@ -3360,7 +3360,7 @@ static int vertex_group_copy_to_linked_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob_active = ED_object_context(C);
int retval = OPERATOR_CANCELLED;
FOREACH_SCENE_OBJECT(scene, ob_iter)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob_iter)
{
if (ob_iter->type == ob_active->type) {
if (ob_iter != ob_active && ob_iter->data == ob_active->data) {

View File

@@ -260,7 +260,7 @@ static int ptcache_free_bake_all_exec(bContext *C, wmOperator *UNUSED(op))
PTCacheID *pid;
ListBase pidlist;
FOREACH_SCENE_OBJECT(scene, ob)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
{
BKE_ptcache_ids_from_object(&pidlist, ob, scene, MAX_DUPLI_RECUR);

View File

@@ -103,7 +103,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "visible_objects")) {
FOREACH_VISIBLE_OBJECT(view_layer, ob)
FOREACH_VISIBLE_OBJECT_BEGIN(view_layer, ob)
{
CTX_data_id_list_add(result, &ob->id);
}
@@ -121,7 +121,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "selected_objects")) {
FOREACH_SELECTED_OBJECT(view_layer, ob)
FOREACH_SELECTED_OBJECT_BEGIN(view_layer, ob)
{
CTX_data_id_list_add(result, &ob->id);
}
@@ -130,7 +130,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if (CTX_data_equals(member, "selected_editable_objects")) {
FOREACH_SELECTED_OBJECT(view_layer, ob)
FOREACH_SELECTED_OBJECT_BEGIN(view_layer, ob)
{
if (0 == BKE_object_is_libdata(ob)) {
CTX_data_id_list_add(result, &ob->id);
@@ -142,7 +142,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
}
else if (CTX_data_equals(member, "editable_objects")) {
/* Visible + Editable, but not necessarily selected */
FOREACH_VISIBLE_OBJECT(view_layer, ob)
FOREACH_VISIBLE_OBJECT_BEGIN(view_layer, ob)
{
if (0 == BKE_object_is_libdata(ob)) {
CTX_data_id_list_add(result, &ob->id);
@@ -153,7 +153,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult
return 1;
}
else if ( CTX_data_equals(member, "visible_bases")) {
FOREACH_VISIBLE_BASE(view_layer, base)
FOREACH_VISIBLE_BASE_BEGIN(view_layer, base)
{
CTX_data_list_add(result, &scene->id, &RNA_ObjectBase, base);
}

View File

@@ -71,7 +71,7 @@ static Object *get_camera_with_movieclip(Scene *scene, MovieClip *clip)
return camera;
}
FOREACH_SCENE_OBJECT(scene, ob)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
{
if (ob->type == OB_CAMERA) {
if (BKE_object_movieclip_get(scene, ob, false) == clip) {

View File

@@ -2380,7 +2380,7 @@ void outliner_build_tree(
}
else if (soops->outlinevis == SO_COLLECTIONS) {
if ((soops->filter & SO_FILTER_ENABLE) && (soops->filter & SO_FILTER_NO_COLLECTION)) {
FOREACH_SCENE_OBJECT(scene, ob)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
{
outliner_add_element(soops, eval_ctx, &soops->tree, ob, NULL, 0, 0);
}

View File

@@ -2045,7 +2045,7 @@ static int do_object_pose_box_select(bContext *C, ViewContext *vc, rcti *rect, b
qsort(vbuffer, hits, sizeof(uint[4]), opengl_select_buffer_cmp);
/*
* Even though 'DRW_draw_select_loop' uses 'DEG_OBJECT_ITER',
* Even though 'DRW_draw_select_loop' uses 'DEG_OBJECT_ITER_BEGIN',
* we can be sure the order remains the same between both.
*/
for (base = vc->view_layer->object_bases.first; base && hits; base = base->next) {

View File

@@ -217,7 +217,7 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer()
}
// Make sure we don't have any bases which might reference freed objects.
FOREACH_SCENE_COLLECTION(freestyle_scene, sc)
FOREACH_SCENE_COLLECTION_BEGIN(freestyle_scene, sc)
{
BLI_freelistN(&sc->objects);
}

View File

@@ -911,7 +911,7 @@ static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, Po
static void rna_ViewLayer_update_tagged(ViewLayer *UNUSED(view_layer), bContext *C)
{
Depsgraph *graph = CTX_data_depsgraph(C);
DEG_OBJECT_ITER(graph, ob, DEG_ITER_OBJECT_MODE_VIEWPORT,
DEG_OBJECT_ITER_BEGIN(graph, ob, DEG_ITER_OBJECT_MODE_VIEWPORT,
DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
DEG_ITER_OBJECT_FLAG_LINKED_INDIRECTLY |

View File

@@ -609,7 +609,7 @@ static void rna_EffectorWeight_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
if (id && GS(id->name) == ID_SCE) {
Scene *scene = (Scene *)id;
FOREACH_SCENE_OBJECT(scene, ob)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
{
BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
}

View File

@@ -1469,7 +1469,7 @@ static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr)
static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Scene *scene = (Scene *)ptr->id.data;
FOREACH_SCENE_OBJECT(scene, ob)
FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
{
BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
}
@@ -1545,7 +1545,7 @@ static void rna_Scene_use_simplify_update(Main *UNUSED(bmain), Scene *UNUSED(sce
Scene *sce_iter;
Base *base;
FOREACH_SCENE_OBJECT(sce, ob)
FOREACH_SCENE_OBJECT_BEGIN(sce, ob)
{
object_simplify_update(ob);
}

View File

@@ -108,7 +108,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
if (fluidmd && fluidmd->fss) {
if (fluidmd->fss->type == OB_FLUIDSIM_DOMAIN) {
FOREACH_SCENE_OBJECT(ctx->scene, ob1)
FOREACH_SCENE_OBJECT_BEGIN(ctx->scene, ob1)
{
if (ob1 != ctx->object) {
FluidsimModifierData *fluidmdtmp =

View File

@@ -250,7 +250,7 @@ static void env_set_imats(Render *re)
{
float mat[4][4];
FOREACH_SCENE_OBJECT(re->scene, ob)
FOREACH_SCENE_OBJECT_BEGIN(re->scene, ob)
{
mul_m4_m4m4(mat, re->viewmat, ob->obmat);
invert_m4_m4(ob->imat, mat);

View File

@@ -1981,7 +1981,7 @@ bool RE_allow_render_generic_object(Object *ob)
#ifdef DEPSGRAPH_WORKAROUND_HACK
static void tag_dependend_objects_for_render(Scene *scene, int UNUSED(renderlay))
{
FOREACH_OBJECT_RENDERABLE(scene, object)
FOREACH_OBJECT_RENDERABLE_BEGIN(scene, object)
{
if (object->type == OB_MESH) {
if (RE_allow_render_generic_object(object)) {