[Bf-blender-cvs] [c4668b72e07] master: Cleanup: use BLI_listbase_is_single instead of counting

Campbell Barton noreply at git.blender.org
Tue Oct 20 05:58:14 CEST 2020


Commit: c4668b72e073a66ac09aa02622b7d25f1339fcdb
Author: Campbell Barton
Date:   Tue Oct 20 14:16:47 2020 +1100
Branches: master
https://developer.blender.org/rBc4668b72e073a66ac09aa02622b7d25f1339fcdb

Cleanup: use BLI_listbase_is_single instead of counting

===================================================================

M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/interface/interface_panel.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index fa7fe27635a..d54bdf552eb 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -4284,7 +4284,7 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
 
-  if ((mode == GP_SEPARATE_LAYER) && (BLI_listbase_count(&gpd_src->layers) == 1)) {
+  if ((mode == GP_SEPARATE_LAYER) && (BLI_listbase_is_single(&gpd_src->layers))) {
     BKE_report(op->reports, RPT_ERROR, "Cannot separate an object with one layer only");
     return OPERATOR_CANCELLED;
   }
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 991531b4f0d..2a95a34e5e7 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -780,7 +780,7 @@ void UI_panel_header_buttons_end(Panel *panel)
   /* Repurpose the first "header" button group if it is empty, in case the first button added to
    * the panel doesn't add a new group (if the button is created directly rather than through an
    * interface layout call). */
-  if (BLI_listbase_count(&block->button_groups) == 1 &&
+  if (BLI_listbase_is_single(&block->button_groups) &&
       BLI_listbase_is_empty(&button_group->buttons)) {
     button_group->flag &= ~UI_BUTTON_GROUP_PANEL_HEADER;
   }



More information about the Bf-blender-cvs mailing list