Commit: 1559771cb6c3ff190e43a817ded70f2921415d2d
Author: Joshua Leung
Date: Sat Nov 4 17:06:20 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rB1559771cb6c3ff190e43a817ded70f2921415d2d
Pre-emptive fixes for crashes occurring when GP strokes have no palette/color
info assigned
===================================================================
M source/blender/modifiers/intern/MOD_gpencilcolor.c
M source/blender/modifiers/intern/MOD_gpenciltint.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_gpencilcolor.c
b/source/blender/modifiers/intern/MOD_gpencilcolor.c
index 888576ac2e9..40166efaed4 100644
--- a/source/blender/modifiers/intern/MOD_gpencilcolor.c
+++ b/source/blender/modifiers/intern/MOD_gpencilcolor.c
@@ -78,6 +78,11 @@ static void deformStroke(ModifierData *md, const
EvaluationContext *UNUSED(eval_
{
return;
}
+
+ if (ELEM(NULL, gps->palette, gps->palcolor)) {
+ /* sometimes palette/color info is missing */
+ return;
+ }
palcolor = gps->palcolor;
copy_v3_v3(factor, mmd->hsv);
@@ -108,6 +113,10 @@ static void bakeModifierGP(const bContext *C, const
EvaluationContext *eval_ctx,
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (bGPDstroke *gps = gpf->strokes.first; gps; gps =
gps->next) {
+ /* skip stroke if it doesn't have color info */
+ if (ELEM(NULL, gps->palette, gps->palcolor))
+ continue;
+
/* look for palette */
gh_color = (GHash *)BLI_ghash_lookup(gh_layer,
gps->palette->id.name);
if (gh_color == NULL) {
diff --git a/source/blender/modifiers/intern/MOD_gpenciltint.c
b/source/blender/modifiers/intern/MOD_gpenciltint.c
index 8a28b36c688..0e9deb3b769 100644
--- a/source/blender/modifiers/intern/MOD_gpenciltint.c
+++ b/source/blender/modifiers/intern/MOD_gpenciltint.c
@@ -114,6 +114,10 @@ static void bakeModifierGP(const bContext *C, const
EvaluationContext *eval_ctx,
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
for (bGPDstroke *gps = gpf->strokes.first; gps; gps =
gps->next) {
+ /* skip stroke if it doesn't have color info */
+ if (ELEM(NULL, gps->palette, gps->palcolor))
+ continue;
+
/* look for palette */
gh_color = (GHash *)BLI_ghash_lookup(gh_layer,
gps->palette->id.name);
if (gh_color == NULL) {
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs