[Bf-blender-cvs] [df289455c7f] greasepencil-object: GP Modifiers: Replace defunct "Duplication" modifier with "Build" modifier

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


Commit: df289455c7f1ae6b816b49a47a09a8d558729eba
Author: Joshua Leung
Date:   Sat Nov 4 04:10:15 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rBdf289455c7f1ae6b816b49a47a09a8d558729eba

GP Modifiers: Replace defunct "Duplication" modifier with "Build" modifier

It doesn't actually do anything now, and most of its properties are
undefined as well, but we don't want to break any existing files now
(as renumbering the other modifiers would cause issues)

Note: BKE_gpencil_reset_modifiers() has been removed. If the array modifier
needs this, we will have to find another solution to this.

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/blenkernel/BKE_gpencil.h
M	source/blender/blenkernel/intern/gpencil_modifier.c
M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/makesdna/DNA_modifier_types.h
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/CMakeLists.txt
M	source/blender/modifiers/MOD_modifiertypes.h
R073	source/blender/modifiers/intern/MOD_gpencildupli.c	source/blender/modifiers/intern/MOD_gpencilbuild.c
M	source/blender/modifiers/intern/MOD_util.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 222c1542270..e582e90ad22 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1752,44 +1752,12 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         row.prop(md, "pass_index", text="Pass")
         row.prop(md, "inverse_pass", text="", icon="ARROW_LEFTRIGHT")
 
-    def GP_DUPLI(self, layout, ob, md):
+    def GP_BUILD(self, layout, ob, md):
         gpd = ob.data
-        layout.prop(md, "count")
-
-        split = layout.split()
-        col = split.column()
-        col.label("Offset:")
-        col.prop(md, "constant_offset_displace", text="")
-
-        col = split.column()
-        col.label("Layer:")
-        row = col.row(align=True)
-        row.prop_search(md, "layer", gpd, "layers", text="", icon='GREASEPENCIL')
-        row.prop(md, "inverse_layers", text="", icon="ARROW_LEFTRIGHT")
-        row = col.row(align=True)
-        row.prop(md, "pass_index", text="Pass")
-        row.prop(md, "inverse_pass", text="", icon="ARROW_LEFTRIGHT")
-
-        row = layout.row()
-        split = row.split()
-        col = split.column()
-        col.label("Rotation:")
-        col.prop(md, "rotation", text="")
-        col.separator()
-        row = col.row(align=True)
-        row.prop(md, "random_rot", text="", icon="TIME", toggle=True)
-        row.prop(md, "rot_factor", text="")
-
-        col = split.column()
-        col.label("Scale:")
-        col.prop(md, "scale", text="")
-        col.separator()
-        row = col.row(align=True)
-        row.prop(md, "random_scale", text="", icon="TIME", toggle=True)
-        row.prop(md, "scale_factor", text="")
+        layout.label(icon='ERROR', text="Not Implemented")
 
     def GP_LATTICE(self, layout, ob, md):
-        gpd = ob.grease_pencil
+        gpd = ob.data
         split = layout.split()
 
         col = split.column()
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index 1d0da120ccb..164a42658f3 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -187,7 +187,6 @@ bool BKE_gpencil_vgroup_remove_point_weight(struct bGPDspoint *pt, int index);
 void BKE_gpencil_stroke_weights_duplicate(struct bGPDstroke *gps_src, struct bGPDstroke *gps_dst);
 
 /* modifiers */
-void BKE_gpencil_reset_modifiers(struct Object *ob);
 bool BKE_gpencil_has_geometry_modifiers(struct Object *ob);
 void BKE_gpencil_stroke_modifiers(struct Object *ob, struct bGPDlayer *gpl, struct bGPDframe *gpf, struct bGPDstroke *gps);
 void BKE_gpencil_geometry_modifiers(struct Object *ob, struct bGPDlayer *gpl, struct bGPDframe *gpf);
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 61170d88a6f..fbf86d6d571 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -348,22 +348,6 @@ void BKE_gpencil_simplify_modifier(int UNUSED(id), GpencilSimplifyModifierData *
 	MEM_SAFE_FREE(points2d);
 }
 
-/* reset modifiers */
-void BKE_gpencil_reset_modifiers(Object *ob)
-{
-	ModifierData *md;
-	GpencilDupliModifierData *arr;
-
-	for (md = ob->modifiers.first; md; md = md->next) {
-		switch (md->type) {
-			case eModifierType_GpencilDupli:
-				arr = (GpencilDupliModifierData *) md;
-				arr->rnd[0] = 1;
-				break;
-		}
-	}
-}
-
 /* verify if exist geometry modifiers */
 bool BKE_gpencil_has_geometry_modifiers(Object *ob)
 {
@@ -371,7 +355,7 @@ bool BKE_gpencil_has_geometry_modifiers(Object *ob)
 	for (md = ob->modifiers.first; md; md = md->next) {
 		const ModifierTypeInfo *mti = modifierType_getInfo(md->type);
 		
-		if (mti->generateStrokes) {
+		if (mti && mti->generateStrokes) {
 			return true;
 		}
 	}
@@ -396,7 +380,7 @@ void BKE_gpencil_stroke_modifiers(Object *ob, bGPDlayer *gpl, bGPDframe *UNUSED(
 				continue;
 			}
 			
-			if (mti->deformStroke) {
+			if (mti && mti->deformStroke) {
 				EvaluationContext eval_ctx = {0}; /* XXX */
 				mti->deformStroke(md, &eval_ctx, ob, gpl, gps);
 			}
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 0faeb4bd2b5..9fb276c50a9 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -671,11 +671,6 @@ static void gpencil_draw_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_dat
 	ED_gpencil_parent_location(ob, gpd, gpl, viewmatrix);
 	copy_m4_m4(derived_gpf->viewmatrix, viewmatrix);
 
-	/* initialization steps */
-	if ((cache->is_dirty) && (ob->modifiers.first) && (!is_multiedit)) {
-		BKE_gpencil_reset_modifiers(ob);
-	}
-
 	/* apply geometry modifiers */
 	if ((cache->is_dirty) && (ob->modifiers.first) && (!is_multiedit)) {
 		if (!GP_SIMPLIFY_MODIF(ts, playing)) {
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 05f85d3bfbf..f7d76dbe7d5 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1060,7 +1060,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
 					case eModifierType_GpencilThick:
 					case eModifierType_GpencilTint:
 					case eModifierType_GpencilArray:
-					case eModifierType_GpencilDupli:
+					case eModifierType_GpencilBuild:
 					case eModifierType_GpencilOpacity:
 					case eModifierType_GpencilColor:
 					case eModifierType_GpencilLattice:
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index d8bd9aa4ccc..054e9c2cea7 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -92,7 +92,7 @@ typedef enum ModifierType {
 	eModifierType_GpencilThick      = 56,
 	eModifierType_GpencilTint       = 57,
 	eModifierType_GpencilArray      = 58,
-	eModifierType_GpencilDupli      = 59,
+	eModifierType_GpencilBuild      = 59,
 	eModifierType_GpencilOpacity    = 60,
 	eModifierType_GpencilColor      = 61,
 	eModifierType_GpencilLattice    = 62,
@@ -1767,26 +1767,18 @@ typedef enum eGpencilArray_Flag {
 	GP_ARRAY_MAKE_OBJECTS = (1 << 4),
 } eGpencilArray_Flag;
 
-typedef struct GpencilDupliModifierData {
+typedef struct GpencilBuildModifierData {
 	ModifierData modifier;
-	char layername[64];          /* layer name */
-	int pass_index;               /* custom index for passes */
-	int flag;                    /* several flags */
-	float rnd_size;              /* random size factor */
-	float rnd_rot;               /* random size factor */
-	float offset[3];             /* Location increments */
-	float rot[3];                /* Rotation changes */
-	float scale[3];              /* Scale changes */
-	int count;                   /* number of elements in array */
-	float rnd[20];               /* (first element is the index) random values */
-} GpencilDupliModifierData;
-
-typedef enum eGpencilDupli_Flag {
-	GP_DUPLI_RANDOM_SIZE    = (1 << 0),
-	GP_DUPLI_RANDOM_ROT     = (1 << 1),
-	GP_DUPLI_INVERSE_LAYER  = (1 << 2),
-	GP_DUPLI_INVERSE_PASS   = (1 << 3),
-} eGpencilDupli_Flag;
+	float start, length;
+	int flag;
+	int seed;             /* (int) random seed */
+} GpencilBuildModifierData;
+
+typedef enum eGpencilBuild_Flag {
+	GP_BUILD_FLAG_RANDOMIZE = (1 << 0),  /* order of vertices is randomized */
+	GP_BUILD_FLAG_REVERSE   = (1 << 1),  /* frame range is reversed, resulting in a deconstruction effect */
+} eGpencilBuild_Flag;
+
 
 typedef struct GpencilLatticeModifierData {
 	ModifierData modifier;
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 1ea688643c3..e7c7df35aae 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -122,9 +122,9 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = {
 	{eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""},
 	{0, "", 0, N_("Grease Pencil"), "" },
 	{eModifierType_GpencilArray, "GP_ARRAY", ICON_MOD_ARRAY, "Array", "Create grid of duplicate instances" },
-	{eModifierType_GpencilDupli, "GP_DUPLI", ICON_GROUP_VERTEX, "Duplication", "Create duplication of strokes" },
+	{eModifierType_GpencilBuild, "GP_BUILD", ICON_MOD_BUILD, "Build", "Create duplication of strokes" },
 	{eModifierType_GpencilNoise, "GP_NOISE", ICON_RNDCURVE, "Noise", "Add noise to strokes" },
-	{eModifierType_GpencilSubdiv, "GP_SUBDIV", ICON_MOD_SUBSURF, "Subdivide", "Subdivide stroke adding more control points to strokes" },
+	{eModifierType_GpencilSubdiv, "GP_SUBDIV", ICON_MOD_SUBSURF, "Subdivide", "Subdivide stroke adding more control points" },
 	{eModifierType_GpencilSimplify, "GP_SIMPLIFY", ICON_MOD_DECIM, "Simplify", "Simplify stroke reducing number of points" },
 	{eModifierType_GpencilLattice, "GP_LATTICE", ICON_MOD_LATTICE, "Lattice", "Change stroke using lattice to deform" },
 	{eModifierType_GpencilThick, "GP_THICK", ICON_MAN_ROT, "Thickness", "Change stroke thickness" },
@@ -451,8 +451,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
 			return &RNA_GpencilColorModifier;
 		case eModifierType_GpencilArray:
 			return &RNA_GpencilArrayModifier;
-		case eModifierType_GpencilDupli:
-			return &RNA_GpencilDupliModifier;
+		case eModifierType_GpencilBuild:
+			return &RNA_GpencilBuildModifier;
 		case eModifierType_GpencilOpacity:
 			return &RNA_GpencilOpacityModifier;
 		case eModifierType_GpencilLattice:
@@ -5349,83 +5349,17 @@ static void rna_def_modifier_gpencilarray(BlenderRNA *brna)
 	RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 }
 
-static void rna_def_modifier_gpencildupli(BlenderRNA *brna)
+static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
 {
 	StructRNA *srna;
 	PropertyRNA *prop;
 
-	srna = RNA_def_struct(brna, "GpencilDupliModifier", "Modifier");
-	RNA_def_struct_ui_text(srna, "Duplication Modifier", "Create array o

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list