[Bf-blender-cvs] [a88cdce5dba] greasepencil-object: Fixes to various GP Modifiers

Joshua Leung noreply at git.blender.org
Sat Nov 4 05:48:40 CET 2017


Commit: a88cdce5dbab7a3e85b7a9e17ba226f82ceb5dd2
Author: Joshua Leung
Date:   Sat Nov 4 04:04:41 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rBa88cdce5dbab7a3e85b7a9e17ba226f82ceb5dd2

Fixes to various GP Modifiers

* Array modifier can be shown in editmode
  (TODO: When "Make Objects" is enabled, this breaks)

* Color (hue/sat) modifier was still using G.main
  -> Updated to use palette slots instead

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

M	source/blender/modifiers/intern/MOD_gpencilarray.c
M	source/blender/modifiers/intern/MOD_gpencilcolor.c
M	source/blender/modifiers/intern/MOD_gpencilnoise.c

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

diff --git a/source/blender/modifiers/intern/MOD_gpencilarray.c b/source/blender/modifiers/intern/MOD_gpencilarray.c
index d067996707a..72a7cc18a27 100644
--- a/source/blender/modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/modifiers/intern/MOD_gpencilarray.c
@@ -386,7 +386,7 @@ ModifierTypeInfo modifierType_GpencilArray = {
 	/* structName */        "GpencilArrayModifierData",
 	/* structSize */        sizeof(GpencilArrayModifierData),
 	/* type */              eModifierTypeType_Gpencil,
-	/* flags */             eModifierTypeFlag_GpencilMod,
+	/* flags */             eModifierTypeFlag_GpencilMod | eModifierTypeFlag_SupportsEditmode,
 
 	/* copyData */          copyData,
 	/* deformVerts */       NULL,
diff --git a/source/blender/modifiers/intern/MOD_gpencilcolor.c b/source/blender/modifiers/intern/MOD_gpencilcolor.c
index f065e364787..888576ac2e9 100644
--- a/source/blender/modifiers/intern/MOD_gpencilcolor.c
+++ b/source/blender/modifiers/intern/MOD_gpencilcolor.c
@@ -42,6 +42,7 @@
 #include "BKE_global.h"
 #include "BKE_context.h"
 #include "BKE_gpencil.h"
+#include "BKE_main.h"
 #include "BKE_paint.h"
 
 #include "DEG_depsgraph.h"
@@ -91,13 +92,13 @@ static void deformStroke(ModifierData *md, const EvaluationContext *UNUSED(eval_
 	add_v3_v3(hsv, factor);
 	CLAMP3(hsv, 0.0f, 1.0f);
 	hsv_to_rgb_v(hsv, palcolor->fill);
-
 }
 
-static void bakeModifierGP(const bContext *UNUSED(C), const EvaluationContext *eval_ctx,
+static void bakeModifierGP(const bContext *C, const EvaluationContext *eval_ctx,
                            ModifierData *md, Object *ob)
 {
 	GpencilColorModifierData *mmd = (GpencilColorModifierData *)md;
+	Main *bmain = CTX_data_main(C);
 	bGPdata *gpd = ob->data;
 	Palette *newpalette = NULL;
 	
@@ -119,7 +120,8 @@ static void bakeModifierGP(const bContext *UNUSED(C), const EvaluationContext *e
 				if (newpalcolor == NULL) {
 					if (mmd->flag & GP_COLOR_CREATE_COLORS) {
 						if (!newpalette) {
-							newpalette = BKE_palette_add(G.main, "Palette");
+							bGPDpaletteref *palslot = BKE_gpencil_paletteslot_addnew(bmain, gpd, "Tinted Colors");
+							newpalette = palslot->palette;
 						}
 						newpalcolor = BKE_palette_color_copy(newpalette, gps->palcolor);
 						BLI_strncpy(gps->colorname, newpalcolor->info, sizeof(gps->colorname));
diff --git a/source/blender/modifiers/intern/MOD_gpencilnoise.c b/source/blender/modifiers/intern/MOD_gpencilnoise.c
index e56cd3ee78c..674e6cf2dbe 100644
--- a/source/blender/modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/modifiers/intern/MOD_gpencilnoise.c
@@ -97,7 +97,7 @@ static void deformStroke(ModifierData *md, const EvaluationContext *UNUSED(eval_
 
 	if (!is_stroke_affected_by_modifier(
 	        mmd->layername, mmd->pass_index, 3, gpl, gps,
-	         mmd->flag & GP_NOISE_INVERSE_LAYER, mmd->flag & GP_NOISE_INVERSE_PASS))
+	        mmd->flag & GP_NOISE_INVERSE_LAYER, mmd->flag & GP_NOISE_INVERSE_PASS))
 	{
 		return;
 	}



More information about the Bf-blender-cvs mailing list