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-26 23:59:03 +0300
committerHans Goudey <h.goudey@me.com>2021-01-26 23:59:03 +0300
commit1f81195fb998ce0a78fc322e5a1bed5eb2f5636f (patch)
tree7f86af444721fc231195bc1ac6a3f04102e794ad /source/blender/editors/space_api
parentc32c6a5f857675ad4cf3538f1b8a44419272af10 (diff)
Cleanup: Use LISTBASE_FOREACH macro
Diffstat (limited to 'source/blender/editors/space_api')
-rw-r--r--source/blender/editors/space_api/spacetypes.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index 10fa2c19919..d8e7e27a0ab 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -73,9 +73,6 @@
/* only call once on startup, storage is global in BKE kernel listbase */
void ED_spacetypes_init(void)
{
- const ListBase *spacetypes;
- SpaceType *type;
-
/* UI_UNIT_X is now a variable, is used in some spacetype inits? */
U.widget_unit = 20;
@@ -145,8 +142,8 @@ void ED_spacetypes_init(void)
ED_gizmotypes_snap_3d();
/* register types for operators and gizmos */
- spacetypes = BKE_spacetypes_list();
- for (type = spacetypes->first; type; type = type->next) {
+ const ListBase *spacetypes = BKE_spacetypes_list();
+ LISTBASE_FOREACH (const SpaceType *, type, spacetypes) {
/* init gizmo types first, operator-types need them */
if (type->gizmos) {
type->gizmos();
@@ -159,9 +156,6 @@ void ED_spacetypes_init(void)
void ED_spacemacros_init(void)
{
- const ListBase *spacetypes;
- SpaceType *type;
-
/* Macros's must go last since they reference other operators.
* We need to have them go after python operators too */
ED_operatormacros_armature();
@@ -181,8 +175,8 @@ void ED_spacemacros_init(void)
ED_operatormacros_gpencil();
/* register dropboxes (can use macros) */
- spacetypes = BKE_spacetypes_list();
- for (type = spacetypes->first; type; type = type->next) {
+ const ListBase *spacetypes = BKE_spacetypes_list();
+ LISTBASE_FOREACH (const SpaceType *, type, spacetypes) {
if (type->dropboxes) {
type->dropboxes();
}
@@ -194,10 +188,6 @@ void ED_spacemacros_init(void)
* using the keymap the actual areas/regions add the handlers */
void ED_spacetypes_keymap(wmKeyConfig *keyconf)
{
- const ListBase *spacetypes;
- SpaceType *stype;
- ARegionType *atype;
-
ED_keymap_screen(keyconf);
ED_keymap_anim(keyconf);
ED_keymap_animchannels(keyconf);
@@ -219,14 +209,14 @@ void ED_spacetypes_keymap(wmKeyConfig *keyconf)
ED_keymap_transform(keyconf);
- spacetypes = BKE_spacetypes_list();
- for (stype = spacetypes->first; stype; stype = stype->next) {
- if (stype->keymap) {
- stype->keymap(keyconf);
+ const ListBase *spacetypes = BKE_spacetypes_list();
+ LISTBASE_FOREACH (const SpaceType *, type, spacetypes) {
+ if (type->keymap) {
+ type->keymap(keyconf);
}
- for (atype = stype->regiontypes.first; atype; atype = atype->next) {
- if (atype->keymap) {
- atype->keymap(keyconf);
+ LISTBASE_FOREACH (ARegionType *, region_type, &type->regiontypes) {
+ if (region_type->keymap) {
+ region_type->keymap(keyconf);
}
}
}
@@ -261,9 +251,7 @@ void *ED_region_draw_cb_activate(ARegionType *art,
void ED_region_draw_cb_exit(ARegionType *art, void *handle)
{
- RegionDrawCB *rdc;
-
- for (rdc = art->drawcalls.first; rdc; rdc = rdc->next) {
+ LISTBASE_FOREACH (RegionDrawCB *, rdc, &art->drawcalls) {
if (rdc == (RegionDrawCB *)handle) {
BLI_remlink(&art->drawcalls, rdc);
MEM_freeN(rdc);
@@ -274,9 +262,7 @@ void ED_region_draw_cb_exit(ARegionType *art, void *handle)
void ED_region_draw_cb_draw(const bContext *C, ARegion *region, int type)
{
- RegionDrawCB *rdc;
-
- for (rdc = region->type->drawcalls.first; rdc; rdc = rdc->next) {
+ LISTBASE_FOREACH (RegionDrawCB *, rdc, &region->type->drawcalls) {
if (rdc->type == type) {
rdc->draw(C, region, rdc->customdata);