diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-01-24 13:12:01 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-01-24 13:22:35 +0300 |
commit | 9112cceb5ee9846a0e223ab7f2c632acae7f8a4d (patch) | |
tree | a0e484f9f588fe46ce830971f03e63da53cb8fac | |
parent | 3e20ac8df3b147624028ba1c32f66a81dd1b9b1c (diff) |
BKE's modifier_isEnabled: add check on NULL Scene pointer.
We do not always have that one available, and even without the
isDisabled callback this func is helpful.
Note that this is a bot stupid, only modifier actually needing a valid
Scene pointer here is subsurf... :|
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 1e7c3104d17..d7a24f90dbe 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -434,6 +434,11 @@ bool modifiers_isParticleEnabled(Object *ob) return (md && md->mode & (eModifierMode_Realtime | eModifierMode_Render)); } +/** + * Check whether is enabled. + * + * \param scene Current scene, may be NULL, in which case isDisabled callback of the modifier is never called. + */ bool modifier_isEnabled(struct Scene *scene, ModifierData *md, int required_mode) { const ModifierTypeInfo *mti = modifierType_getInfo(md->type); @@ -441,7 +446,7 @@ bool modifier_isEnabled(struct Scene *scene, ModifierData *md, int required_mode md->scene = scene; if ((md->mode & required_mode) != required_mode) return false; - if (mti->isDisabled && mti->isDisabled(md, required_mode == eModifierMode_Render)) return false; + if (scene != NULL && mti->isDisabled && mti->isDisabled(md, required_mode == eModifierMode_Render)) return false; if (md->mode & eModifierMode_DisableTemporary) return false; if ((required_mode & eModifierMode_Editmode) && !(mti->flags & eModifierTypeFlag_SupportsEditmode)) return false; |