diff options
author | Hans Goudey <h.goudey@me.com> | 2020-08-20 16:34:09 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-08-20 16:34:09 +0300 |
commit | f9697543e43b74074727a89f9dc1bc9717536c46 (patch) | |
tree | d3d3b4c90b497f4fe3ae950f8122caaad044ab60 /source/blender/editors/screen/screen_context.c | |
parent | 52f40bcff21b285b7eaa21aaa9c6c7b9d6fa8669 (diff) |
Revert "Cleanup: Use LISTBASE_FOREACH in editors screen directory"
This reverts commit 52f40bcff21b285b7eaa21aaa9c6c7b9d6fa8669.
Apologies for the noise. I caught a problem with this that I hadn't before. I will
commit later after thorough testing.
Diffstat (limited to 'source/blender/editors/screen/screen_context.c')
-rw-r--r-- | source/blender/editors/screen/screen_context.c | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 3c70bf1bfd8..c17a34f97b9 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -204,7 +204,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult } if (CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) { bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL; - EditBone *flipbone = NULL; + EditBone *ebone, *flipbone = NULL; const bool editable_bones = CTX_data_equals(member, "editable_bones"); if (arm && arm->edbo) { @@ -216,7 +216,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult arm = ob->data; /* Attention: X-Axis Mirroring is also handled here... */ - LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) { + for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { /* first and foremost, bone must be visible and selected */ if (EBONE_VISIBLE(arm, ebone)) { /* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled @@ -262,7 +262,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult if (CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) { bArmature *arm = (obedit && obedit->type == OB_ARMATURE) ? obedit->data : NULL; - EditBone *flipbone = NULL; + EditBone *ebone, *flipbone = NULL; const bool selected_editable_bones = CTX_data_equals(member, "selected_editable_bones"); if (arm && arm->edbo) { @@ -274,7 +274,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult arm = ob->data; /* Attention: X-Axis Mirroring is also handled here... */ - LISTBASE_FOREACH (EditBone *, ebone, arm->edbo) { + for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { /* first and foremost, bone must be visible and selected */ if (EBONE_VISIBLE(arm, ebone) && (ebone->flag & BONE_SELECTED)) { /* Get 'x-axis mirror equivalent' bone if the X-Axis Mirroring option is enabled @@ -479,7 +479,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult if (CTX_data_equals(member, "sequences")) { Editing *ed = BKE_sequencer_editing_get(scene, false); if (ed) { - LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) { + Sequence *seq; + for (seq = ed->seqbasep->first; seq; seq = seq->next) { CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq); } CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION); @@ -490,7 +491,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult if (CTX_data_equals(member, "selected_sequences")) { Editing *ed = BKE_sequencer_editing_get(scene, false); if (ed) { - LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) { + Sequence *seq; + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT) { CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq); } @@ -503,7 +505,8 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult if (CTX_data_equals(member, "selected_editable_sequences")) { Editing *ed = BKE_sequencer_editing_get(scene, false); if (ed) { - LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) { + Sequence *seq; + for (seq = ed->seqbasep->first; seq; seq = seq->next) { if (seq->flag & SELECT && !(seq->flag & SEQ_LOCK)) { CTX_data_list_add(result, &scene->id, &RNA_Sequence, seq); } @@ -517,14 +520,16 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult bAnimContext ac; if (ANIM_animdata_get_context(C, &ac) != 0) { ListBase anim_data = {NULL, NULL}; + bAnimListElem *ale; ANIM_animdata_filter(&ac, &anim_data, ANIMFILTER_DATA_VISIBLE, ac.data, ac.datatype); - LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) { + for (ale = anim_data.first; ale; ale = ale->next) { if (ale->datatype != ALE_NLASTRIP) { continue; } NlaTrack *nlt = (NlaTrack *)ale->data; - LISTBASE_FOREACH (NlaStrip *, strip, &nlt->strips) { + NlaStrip *strip; + for (strip = nlt->strips.first; strip; strip = strip->next) { if (strip->flag & NLASTRIP_FLAG_SELECT) { CTX_data_list_add(result, &scene->id, &RNA_NlaStrip, strip); } @@ -632,7 +637,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult bGPdata *gpd = ED_gpencil_data_get_active_direct(area, obact); if (gpd) { - LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + bGPDlayer *gpl; + + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { if ((gpl->flag & GP_LAYER_HIDE) == 0) { CTX_data_list_add(result, &gpd->id, &RNA_GPencilLayer, gpl); } @@ -646,7 +653,9 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult bGPdata *gpd = ED_gpencil_data_get_active_direct(area, obact); if (gpd) { - LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + bGPDlayer *gpl; + + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { if (BKE_gpencil_layer_is_editable(gpl)) { CTX_data_list_add(result, &gpd->id, &RNA_GPencilLayer, gpl); } @@ -661,9 +670,12 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd); if (gpd) { - LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + bGPDlayer *gpl; + + for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { if (BKE_gpencil_layer_is_editable(gpl) && (gpl->actframe)) { bGPDframe *gpf; + bGPDstroke *gps; bGPDframe *init_gpf = gpl->actframe; if (is_multiedit) { init_gpf = gpl->frames.first; @@ -671,7 +683,7 @@ int ed_screen_context(const bContext *C, const char *member, bContextDataResult for (gpf = init_gpf; gpf; gpf = gpf->next) { if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { - LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { + for (gps = gpf->strokes.first; gps; gps = gps->next) { if (ED_gpencil_stroke_can_use_direct(area, gps)) { /* check if the color is editable */ if (ED_gpencil_stroke_color_use(obact, gpl, gps) == false) { |