[Bf-blender-cvs] [ad5dc176a7f] greasepencil-object: New parameter to force Fill cache recalc

Antonioya noreply at git.blender.org
Thu Aug 23 10:34:06 CEST 2018


Commit: ad5dc176a7f7c8de26fd422d392618aec747d326
Author: Antonioya
Date:   Sun Aug 19 20:50:32 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBad5dc176a7f7c8de26fd422d392618aec747d326

New parameter to force Fill cache recalc

This is needed for extreme deformations

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
M	source/blender/makesdna/DNA_gpencil_modifier_types.h
M	source/blender/makesrna/intern/rna_gpencil_modifier.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 37552f00116..b7d1ec344f3 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -2040,6 +2040,7 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
         col = layout.column()
         col.label(text="Object:")
         col.prop(md, "object", text="")
+        col.prop(md, "force_recalc")
 
 
 classes = (
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
index 89c93eb894e..af75cdb2afe 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
@@ -215,8 +215,9 @@ static void gpencil_armature_bbone_defmats_cb(void *userdata, Link *iter, int in
 	}
 }
 
-static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstroke *gps)
+static void gpencil_armature_deform_verts(ArmatureGpencilModifierData *mmd, Object *target, bGPDstroke *gps)
 {
+	Object *armOb = mmd->object;
 	bGPDspoint *pt = NULL;
 	bPoseChanDeform *pdef_info_array;
 	bPoseChanDeform *pdef_info = NULL;
@@ -354,6 +355,11 @@ static void gpencil_armature_deform_verts(Object *armOb, Object *target, bGPDstr
 	}
 
 	MEM_freeN(pdef_info_array);
+
+	/* set recalc */
+	if (mmd->flag & GP_ARMATURE_RECALC_FILL) {
+		gps->flag |= GP_STROKE_RECALC_CACHES;
+	}
 }
 
 /* deform stroke */
@@ -366,7 +372,7 @@ static void deformStroke(
 		return;
 	}
 
-	gpencil_armature_deform_verts(mmd->object, ob, gps);
+	gpencil_armature_deform_verts(mmd, ob, gps);
 }
 
 static void bakeModifier(
diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h
index 6e723346402..b7ef2dcd89d 100644
--- a/source/blender/makesdna/DNA_gpencil_modifier_types.h
+++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h
@@ -417,6 +417,10 @@ typedef struct ArmatureGpencilModifierData {
 	char pad[4];
 } ArmatureGpencilModifierData;
 
+typedef enum eArmatureGpencil_Flag {
+	GP_ARMATURE_RECALC_FILL = (1 << 0),
+} eArmatureGpencil_Flag;
+
 #define MOD_MESHSEQ_READ_ALL \
 	(MOD_MESHSEQ_READ_VERT | MOD_MESHSEQ_READ_POLY | MOD_MESHSEQ_READ_UV | MOD_MESHSEQ_READ_COLOR)
 
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index b95493e0c45..383eb06c72e 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -1281,6 +1281,12 @@ static void rna_def_modifier_gpencilarmature(BlenderRNA *brna)
 	RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureGpencilModifier_object_set", NULL, "rna_Armature_object_poll");
 	RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
 	RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+	prop = RNA_def_property(srna, "force_recalc", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARMATURE_RECALC_FILL);
+	RNA_def_property_ui_text(prop, "Force Recalc",
+		"Force to recalc fill geometry for extreme deformations (slower FPS)");
+	RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
 }
 
 void RNA_def_greasepencil_modifier(BlenderRNA *brna)



More information about the Bf-blender-cvs mailing list