[Bf-blender-cvs] [38a66b5f1ac] lanpr-under-gp: LineArt: Fix isDisabled function
Antonio Vazquez
noreply at git.blender.org
Wed Jul 15 23:35:30 CEST 2020
Commit: 38a66b5f1ac52e553e3a9ec9f847136d910a133a
Author: Antonio Vazquez
Date: Wed Jul 15 23:35:24 2020 +0200
Branches: lanpr-under-gp
https://developer.blender.org/rB38a66b5f1ac52e553e3a9ec9f847136d910a133a
LineArt: Fix isDisabled function
* The layer is not a pointer, but a name.
* Don't execute if it's disabled.
===================================================================
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 ff51d986b18..3a932ee9405 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -99,6 +99,24 @@ static void generate_strokes_actual(
lmd->opacity);
}
+static bool isModifierDisabled(GpencilModifierData *md)
+{
+ LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
+
+ if ((lmd->target_layer[0] == '\0') || (lmd->target_material == NULL)) {
+ 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 generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Object *ob)
{
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
@@ -110,6 +128,11 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
return;
}
+ /* Check all parameters required are filled. */
+ if (isModifierDisabled(md)) {
+ return;
+ }
+
if (ED_lineart_modifier_sync_flag_check(LRT_SYNC_IDLE)) {
/* Update triggered when nothing's happening, means DG update, so we request a refresh on line
* art cache, meanwhile waiting for result. Update will trigger agian */
@@ -168,6 +191,11 @@ static void bakeModifier(Main *UNUSED(bmain),
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
Scene *scene = DEG_get_evaluated_scene(depsgraph);
+ /* Check all parameters required are filled. */
+ if (isModifierDisabled(md)) {
+ return;
+ }
+
bGPDlayer *gpl = BKE_gpencil_layer_get_by_name(gpd, lmd->target_layer, 1);
if (gpl == NULL) {
return;
@@ -192,23 +220,9 @@ static void bakeModifier(Main *UNUSED(bmain),
generate_strokes_actual(md, depsgraph, ob, gpl, gpf);
}
-static bool *isDisabled(GpencilModifierData *md, int UNUSED(userRenderParams))
+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;
+ return isModifierDisabled(md);
}
static void updateDepsgraph(GpencilModifierData *md,
More information about the Bf-blender-cvs
mailing list