Cleanup: Use proper bool type and literals for operators poll functions.

This commit is contained in:
Bastien Montagne 2020-08-12 10:53:35 +02:00
parent 4e31b5b173
commit d070d33aa3
2 changed files with 11 additions and 11 deletions

View File

@ -412,30 +412,30 @@ void OBJECT_OT_gpencil_modifier_add(wmOperatorType *ot)
/********** generic functions for operators using mod names and data context *********************/
static int gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag)
static bool gpencil_edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type);
Object *ob = (ptr.owner_id) ? (Object *)ptr.owner_id : ED_object_active_context(C);
GpencilModifierData *mod = ptr.data; /* May be NULL. */
if (!ob || ID_IS_LINKED(ob)) {
return 0;
return false;
}
if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) {
return 0;
return false;
}
if (ptr.owner_id && ID_IS_LINKED(ptr.owner_id)) {
return 0;
return false;
}
if (ID_IS_OVERRIDE_LIBRARY(ob)) {
if ((mod == NULL) || (mod->flag & eGpencilModifierFlag_OverrideLibrary_Local) == 0) {
CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override");
return 0;
return false;
}
}
return 1;
return true;
}
static bool gpencil_edit_modifier_poll(bContext *C)

View File

@ -335,23 +335,23 @@ static bool edit_shaderfx_poll_generic(bContext *C, StructRNA *rna_type, int obt
ShaderFxData *fx = ptr.data; /* May be NULL. */
if (!ob || ID_IS_LINKED(ob)) {
return 0;
return false;
}
if (obtype_flag && ((1 << ob->type) & obtype_flag) == 0) {
return 0;
return false;
}
if (ptr.owner_id && ID_IS_LINKED(ptr.owner_id)) {
return 0;
return false;
}
if (ID_IS_OVERRIDE_LIBRARY(ob)) {
if ((fx == NULL) || (fx->flag & eShaderFxFlag_OverrideLibrary_Local) == 0) {
CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from library override");
return 0;
return false;
}
}
return 1;
return true;
}
static bool edit_shaderfx_poll(bContext *C)