Commit: 501489c55ef51256b0300b13c03f8d4d82d90043
Author: YimingWu
Date:   Wed Jul 15 23:21:23 2020 +0800
Branches: lanpr-under-gp
https://developer.blender.org/rB501489c55ef51256b0300b13c03f8d4d82d90043

LineArt: Disable modifier when source/target isn't properly set

===================================================================

M       source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c

===================================================================

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c 
b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 0b150079a04..ff51d986b18 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -192,6 +192,25 @@ static void bakeModifier(Main *UNUSED(bmain),
   generate_strokes_actual(md, depsgraph, ob, gpl, gpf);
 }
 
+static bool *isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
+{
+  LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
+
+  if (!lmd->target_layer || !lmd->target_material) {
+    return true;
+  }
+
+  if (lmd->source_type == LRT_SOURCE_OBJECT && !lmd->source_object) {
+    return true;
+  }
+
+  if (lmd->source_type == LRT_SOURCE_COLLECTION && !lmd->source_collection) {
+    return true;
+  }
+
+  return false;
+}
+
 static void updateDepsgraph(GpencilModifierData *md,
                             const ModifierUpdateDepsgraphContext *ctx,
                             const int mode)
@@ -329,7 +348,7 @@ GpencilModifierTypeInfo modifierType_Gpencil_Lineart = {
 
     /* initData */ initData,
     /* freeData */ freeData,
-    /* isDisabled */ NULL,
+    /* isDisabled */ isDisabled,
     /* updateDepsgraph */ updateDepsgraph,
     /* dependsOnTime */ NULL,
     /* foreachObjectLink */ foreachObjectLink,

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to