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:
Diffstat (limited to 'source/blender/editors/interface/interface_templates.c')
-rw-r--r--source/blender/editors/interface/interface_templates.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index cdfe6120eee..0de1d64dcfe 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -395,11 +395,10 @@ static void id_search_cb(const bContext *C,
{
TemplateID *template_ui = (TemplateID *)arg_template;
ListBase *lb = template_ui->idlb;
- ID *id;
int flag = RNA_property_flag(template_ui->prop);
/* ID listbase */
- for (id = lb->first; id; id = id->next) {
+ LISTBASE_FOREACH (ID *, id, lb) {
if (!id_search_add(C, template_ui, flag, str, items, id)) {
break;
}
@@ -416,11 +415,10 @@ static void id_search_cb_tagged(const bContext *C,
{
TemplateID *template_ui = (TemplateID *)arg_template;
ListBase *lb = template_ui->idlb;
- ID *id;
int flag = RNA_property_flag(template_ui->prop);
/* ID listbase */
- for (id = lb->first; id; id = id->next) {
+ LISTBASE_FOREACH (ID *, id, lb) {
if (id->tag & LIB_TAG_DOIT) {
if (!id_search_add(C, template_ui, flag, str, items, id)) {
break;
@@ -2420,9 +2418,8 @@ static eAutoPropButsReturn template_operator_property_buts_draw_single(
/* Only do this if we're not refreshing an existing UI. */
if (block->oldblock == NULL) {
const bool is_popup = (block->flag & UI_BLOCK_KEEP_OPEN) != 0;
- uiBut *but;
- for (but = block->buttons.first; but; but = but->next) {
+ LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
/* no undo for buttons for operator redo panels */
UI_but_flag_disable(but, UI_BUT_UNDO);
@@ -5415,7 +5412,6 @@ void uiTemplatePalette(uiLayout *layout,
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
PointerRNA cptr;
Palette *palette;
- PaletteColor *color;
uiBlock *block;
uiLayout *col;
uiBut *but = NULL;
@@ -5437,8 +5433,6 @@ void uiTemplatePalette(uiLayout *layout,
palette = cptr.data;
- color = palette->colors.first;
-
col = uiLayoutColumn(layout, true);
uiLayoutRow(col, true);
uiDefIconButO(block,
@@ -5461,7 +5455,7 @@ void uiTemplatePalette(uiLayout *layout,
UI_UNIT_X,
UI_UNIT_Y,
NULL);
- if (color) {
+ if (palette->colors.first != NULL) {
but = uiDefIconButO(block,
UI_BTYPE_BUT,
"PALETTE_OT_color_move",
@@ -5496,7 +5490,7 @@ void uiTemplatePalette(uiLayout *layout,
col = uiLayoutColumn(layout, true);
uiLayoutRow(col, true);
- for (; color; color = color->next) {
+ LISTBASE_FOREACH (PaletteColor *, color, &palette->colors) {
PointerRNA color_ptr;
if (row_cols >= cols_per_row) {
@@ -6650,9 +6644,8 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
UI_block_func_handle_set(block, do_running_jobs, NULL);
- Scene *scene;
/* another scene can be rendering too, for example via compositor */
- for (scene = bmain->scenes.first; scene; scene = scene->id.next) {
+ LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
if (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY)) {
handle_event = B_STOPOTHER;
icon = ICON_NONE;
@@ -7366,10 +7359,8 @@ void uiTemplateCacheFile(uiLayout *layout,
int uiTemplateRecentFiles(uiLayout *layout, int rows)
{
- const RecentFile *recent;
int i;
-
- for (recent = G.recent_files.first, i = 0; (i < rows) && (recent); recent = recent->next, i++) {
+ LISTBASE_FOREACH_INDEX (RecentFile *, recent, &G.recent_files, i) {
const char *filename = BLI_path_basename(recent->filepath);
PointerRNA ptr;
uiItemFullO(layout,
@@ -7382,6 +7373,10 @@ int uiTemplateRecentFiles(uiLayout *layout, int rows)
&ptr);
RNA_string_set(&ptr, "filepath", recent->filepath);
RNA_boolean_set(&ptr, "display_file_selector", false);
+
+ if (i > rows) {
+ break;
+ }
}
return i;