diff options
author | Bastien Montagne <bastien@blender.org> | 2020-08-12 12:13:10 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-08-12 12:13:10 +0300 |
commit | 05cb4cf26ea728b6c83c410cd986784f9fbf878f (patch) | |
tree | 9bc2cea66ecfff270ff4192e812fa8a80984aaf8 /source/blender/editors/object | |
parent | 00a7113e613c51c07ea1630b12748fad1b9b57d0 (diff) | |
parent | d070d33aa3bf0cdc3f6656e46476b75b367cd482 (diff) |
Merge branch 'blender-v2.90-release' into master
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_gpencil_modifier.c | 18 | ||||
-rw-r--r-- | source/blender/editors/object/object_modifier.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_shader_fx.c | 15 |
3 files changed, 20 insertions, 15 deletions
diff --git a/source/blender/editors/object/object_gpencil_modifier.c b/source/blender/editors/object/object_gpencil_modifier.c index 019ab2c345b..cfa55c68a56 100644 --- a/source/blender/editors/object/object_gpencil_modifier.c +++ b/source/blender/editors/object/object_gpencil_modifier.c @@ -412,28 +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)) { - CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override"); - return (((GpencilModifierData *)ptr.data)->flag & - eGpencilModifierFlag_OverrideLibrary_Local) != 0; + if ((mod == NULL) || (mod->flag & eGpencilModifierFlag_OverrideLibrary_Local) == 0) { + CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override"); + return false; + } } - return 1; + return true; } static bool gpencil_edit_modifier_poll(bContext *C) diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 8d6d2e3e31d..749034acd85 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -1022,7 +1022,7 @@ bool edit_modifier_poll_generic(bContext *C, } if (ID_IS_OVERRIDE_LIBRARY(ob)) { - if ((mod != NULL) && (mod->flag & eModifierFlag_OverrideLibrary_Local) == 0) { + if ((mod == NULL) || (mod->flag & eModifierFlag_OverrideLibrary_Local) == 0) { CTX_wm_operator_poll_msg_set(C, "Cannot edit modifiers coming from library override"); return false; } diff --git a/source/blender/editors/object/object_shader_fx.c b/source/blender/editors/object/object_shader_fx.c index 977d4abd4d4..e2a30c4ce98 100644 --- a/source/blender/editors/object/object_shader_fx.c +++ b/source/blender/editors/object/object_shader_fx.c @@ -332,23 +332,26 @@ static bool edit_shaderfx_poll_generic(bContext *C, StructRNA *rna_type, int obt { PointerRNA ptr = CTX_data_pointer_get_type(C, "shaderfx", rna_type); Object *ob = (ptr.owner_id) ? (Object *)ptr.owner_id : ED_object_active_context(C); + 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)) { - CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from library override"); - return (((ShaderFxData *)ptr.data)->flag & eShaderFxFlag_OverrideLibrary_Local) != 0; + if ((fx == NULL) || (fx->flag & eShaderFxFlag_OverrideLibrary_Local) == 0) { + CTX_wm_operator_poll_msg_set(C, "Cannot edit shaderfxs coming from library override"); + return false; + } } - return 1; + return true; } static bool edit_shaderfx_poll(bContext *C) |