[Bf-blender-cvs] [db76de147e9] master: Cleanup: SpaceGraph ED code: use boolean litterals when needed.

Bastien Montagne noreply at git.blender.org
Fri Sep 25 10:25:26 CEST 2020


Commit: db76de147e9ab74ba1355198c1c28bc924a990ce
Author: Bastien Montagne
Date:   Fri Sep 25 10:20:33 2020 +0200
Branches: master
https://developer.blender.org/rBdb76de147e9ab74ba1355198c1c28bc924a990ce

Cleanup: SpaceGraph ED code: use boolean litterals when needed.

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

M	source/blender/editors/space_graph/graph_buttons.c
M	source/blender/editors/space_graph/graph_edit.c
M	source/blender/editors/space_graph/graph_ops.c
M	source/blender/editors/space_graph/graph_utils.c

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

diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c
index 0c2280f0c7e..45c43a5853d 100644
--- a/source/blender/editors/space_graph/graph_buttons.c
+++ b/source/blender/editors/space_graph/graph_buttons.c
@@ -735,7 +735,7 @@ static bool graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt))
   SpaceGraph *sipo = CTX_wm_space_graph(C);
 
   if (sipo->mode != SIPO_MODE_DRIVERS) {
-    return 0;
+    return false;
   }
 
   return graph_panel_context(C, NULL, NULL);
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 90fe95c6818..6467ba65975 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -2731,7 +2731,7 @@ static bool graphkeys_framejump_poll(bContext *C)
 {
   /* prevent changes during render */
   if (G.is_rendering) {
-    return 0;
+    return false;
   }
 
   return graphop_visible_keyframes_poll(C);
@@ -3620,7 +3620,7 @@ static bool graph_driver_delete_invalid_poll(bContext *C)
 
   /* firstly, check if in Graph Editor */
   if ((area == NULL) || (area->spacetype != SPACE_GRAPH)) {
-    return 0;
+    return false;
   }
 
   /* try to init Anim-Context stuff ourselves and check */
diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c
index de25a2d990d..22c185e36e5 100644
--- a/source/blender/editors/space_graph/graph_ops.c
+++ b/source/blender/editors/space_graph/graph_ops.c
@@ -66,7 +66,7 @@ static bool graphview_cursor_poll(bContext *C)
 {
   /* prevent changes during render */
   if (G.is_rendering) {
-    return 0;
+    return false;
   }
 
   return ED_operator_graphedit_active(C);
diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c
index 807b0603ea3..ffac9f1c722 100644
--- a/source/blender/editors/space_graph/graph_utils.c
+++ b/source/blender/editors/space_graph/graph_utils.c
@@ -138,17 +138,17 @@ bool graphop_visible_keyframes_poll(bContext *C)
   ScrArea *area = CTX_wm_area(C);
   size_t items;
   int filter;
-  short found = 0;
+  bool found = false;
 
   /* firstly, check if in Graph Editor */
   // TODO: also check for region?
   if ((area == NULL) || (area->spacetype != SPACE_GRAPH)) {
-    return 0;
+    return found;
   }
 
   /* try to init Anim-Context stuff ourselves and check */
   if (ANIM_animdata_get_context(C, &ac) == 0) {
-    return 0;
+    return found;
   }
 
   /* loop over the visible (selection doesn't matter) F-Curves, and see if they're suitable
@@ -157,7 +157,7 @@ bool graphop_visible_keyframes_poll(bContext *C)
   filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE);
   items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
   if (items == 0) {
-    return 0;
+    return found;
   }
 
   for (ale = anim_data.first; ale; ale = ale->next) {
@@ -172,7 +172,7 @@ bool graphop_visible_keyframes_poll(bContext *C)
       continue;
     }
     if (BKE_fcurve_are_keyframes_usable(fcu)) {
-      found = 1;
+      found = true;
       break;
     }
   }
@@ -191,17 +191,17 @@ bool graphop_editable_keyframes_poll(bContext *C)
   ScrArea *area = CTX_wm_area(C);
   size_t items;
   int filter;
-  short found = 0;
+  bool found = false;
 
   /* firstly, check if in Graph Editor */
   // TODO: also check for region?
   if ((area == NULL) || (area->spacetype != SPACE_GRAPH)) {
-    return 0;
+    return found;
   }
 
   /* try to init Anim-Context stuff ourselves and check */
   if (ANIM_animdata_get_context(C, &ac) == 0) {
-    return 0;
+    return found;
   }
 
   /* loop over the editable F-Curves, and see if they're suitable
@@ -210,7 +210,7 @@ bool graphop_editable_keyframes_poll(bContext *C)
   filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
   items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
   if (items == 0) {
-    return 0;
+    return found;
   }
 
   for (ale = anim_data.first; ale; ale = ale->next) {
@@ -227,7 +227,7 @@ bool graphop_editable_keyframes_poll(bContext *C)
       continue;
     }
     if (BKE_fcurve_is_keyframable(fcu)) {
-      found = 1;
+      found = true;
       break;
     }
   }
@@ -243,23 +243,23 @@ bool graphop_active_fcurve_poll(bContext *C)
   bAnimContext ac;
   bAnimListElem *ale;
   ScrArea *area = CTX_wm_area(C);
-  bool has_fcurve = 0;
+  bool has_fcurve = false;
 
   /* firstly, check if in Graph Editor */
   // TODO: also check for region?
   if ((area == NULL) || (area->spacetype != SPACE_GRAPH)) {
-    return 0;
+    return has_fcurve;
   }
 
   /* try to init Anim-Context stuff ourselves and check */
   if (ANIM_animdata_get_context(C, &ac) == 0) {
-    return 0;
+    return has_fcurve;
   }
 
   /* try to get the Active F-Curve */
   ale = get_active_fcurve_channel(&ac);
   if (ale == NULL) {
-    return 0;
+    return has_fcurve;
   }
 
   /* Do we have a suitable F-Curves?
@@ -301,12 +301,12 @@ bool graphop_selected_fcurve_poll(bContext *C)
   /* firstly, check if in Graph Editor */
   // TODO: also check for region?
   if ((area == NULL) || (area->spacetype != SPACE_GRAPH)) {
-    return 0;
+    return false;
   }
 
   /* try to init Anim-Context stuff ourselves and check */
   if (ANIM_animdata_get_context(C, &ac) == 0) {
-    return 0;
+    return false;
   }
 
   /* Get the editable + selected F-Curves, and as long as we got some, we can return.
@@ -315,12 +315,12 @@ bool graphop_selected_fcurve_poll(bContext *C)
   filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT);
   items = ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
   if (items == 0) {
-    return 0;
+    return false;
   }
 
   /* cleanup and return findings */
   ANIM_animdata_freelist(&anim_data);
-  return 1;
+  return true;
 }
 
 /* ************************************************************** */



More information about the Bf-blender-cvs mailing list