diff options
author | Sebastian Parborg <darkdefende@gmail.com> | 2019-08-23 16:50:53 +0300 |
---|---|---|
committer | Sebastian Parborg <darkdefende@gmail.com> | 2019-08-23 16:54:11 +0300 |
commit | 6d64da1e67e319e826450cefc1f6541b0fbb57e9 (patch) | |
tree | 02381420ae1b177530a7dac75be1f867fc1d4b55 /source/blender/gpencil_modifiers | |
parent | 8eb22968724b3ac9f6ccb426b08cb865cbbcef94 (diff) |
Fix potential issues when loading files with missing libraries
This is a continuation of rB39f005eae8eed8b939579aff8c9a05a4f50e5e38
Now all the fields where we check for object type in RNA (like
rna_Curve_object_poll) will have a safe guard for when this isn't the
case. For example when loading files that has missing object libraries
and all missing objects are replaced with empties (placeholders).
Reviewed By: Brecht
Differential Revision: http://developer.blender.org/D5425
Diffstat (limited to 'source/blender/gpencil_modifiers')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c | 7 | ||||
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c index 4297cbb545c..acf9b5c3642 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c @@ -155,7 +155,12 @@ static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams)) { ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md; - return !mmd->object; + /* The object type check is only needed here in case we have a placeholder + * object assigned (because the library containing the armature is missing). + * + * In other cases it should be impossible to have a type missmatch. + */ + return !mmd->object || mmd->object->type != OB_ARMATURE; } static void updateDepsgraph(GpencilModifierData *md, const ModifierUpdateDepsgraphContext *ctx) diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c index d5295fc7306..765967d8346 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c @@ -169,7 +169,12 @@ static bool isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams)) { LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md; - return !mmd->object; + /* The object type check is only needed here in case we have a placeholder + * object assigned (because the library containing the lattice is missing). + * + * In other cases it should be impossible to have a type missmatch. + */ + return !mmd->object || mmd->object->type != OB_LATTICE; } static void updateDepsgraph(GpencilModifierData *md, const ModifierUpdateDepsgraphContext *ctx) |