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

This commit is contained in:
Bastien Montagne 2020-09-25 10:20:33 +02:00
parent 59afbf0c04
commit db76de147e
4 changed files with 22 additions and 22 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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;
}
/* ************************************************************** */