Commit: 0fdfff51d9d272a51cf290a4363fba013fb09923
Author: Joshua Leung
Date:   Tue Oct 31 17:33:59 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rB0fdfff51d9d272a51cf290a4363fba013fb09923

Fix: GP modifiers not updating when properties changed

Added back an explicit call to BKE_gpencil_batch_cache_dirty()
in the rna update callback for GPencil modifier properties.

However, instead of polluting the general rna_Modifier_update(),
this time we do this in a special wrapper/update callback for
dedicated GP modifier usage.

I'm unsure why the depsgraph isn't properly updating this case
- there's probably a missing relation between modifier properties
and GP ubereval (which calls the tagging), but where?!

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

M       source/blender/makesrna/intern/rna_modifier.c

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

diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index d6228124764..6016129da4a 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -517,6 +517,24 @@ static void rna_Modifier_dependency_update(Main *bmain, 
Scene *scene, PointerRNA
        DEG_relations_tag_update(bmain);
 }
 
+/* Hacky update callback for updating GPencil modifiers.
+ *
+ * For whatever reason, sometimes updating the modifier settings
+ * doesn't trigger a refresh. So, we'll just call one manually...
+ *
+ * FIXME: The depsgraph is probably missing a relation somewhere
+ * between Modifier properties and GP geometry ubereval... (aligorith)
+ */
+static void rna_Modifier_gpencil_update(Main *bmain, Scene *scene, PointerRNA 
*ptr)
+{
+       Object *ob = ptr->id.data;
+       if (ob && ob->data) {
+               BKE_gpencil_batch_cache_dirty(ob->data);
+       }
+       
+       rna_Modifier_update(bmain, scene, ptr);
+}
+
 /* Vertex Groups */
 
 #define RNA_MOD_VGROUP_NAME_SET(_type, _prop)                                  
             \
@@ -4863,76 +4881,76 @@ static void rna_def_modifier_gpencilnoise(BlenderRNA 
*brna)
        prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "layername");
        RNA_def_property_ui_text(prop, "Layer", "Layer name");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "vgname");
        RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for 
modulating the deform");
        RNA_def_property_string_funcs(prop, NULL, NULL, 
"rna_GpencilNoiseModifier_vgname_set");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "factor");
        RNA_def_property_range(prop, 0, 30.0);
        RNA_def_property_ui_text(prop, "Factor", "Amount of noise to apply");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "random", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_USE_RANDOM);
        RNA_def_property_ui_text(prop, "Random", "Use random values");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "affect_position", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_NOISE_MOD_LOCATION);
        RNA_def_property_ui_text(prop, "Affect Position", "The modifier affects 
the position of the point");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "affect_strength", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_NOISE_MOD_STRENGTH);
        RNA_def_property_ui_text(prop, "Affect Strength", "The modifier affects 
the color strength of the point");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "affect_thickness", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_NOISE_MOD_THICKNESS);
        RNA_def_property_ui_text(prop, "Affect Thickness", "The modifier 
affects the thickness of the point");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "full_stroke", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_FULL_STROKE);
        RNA_def_property_ui_text(prop, "Full Stroke", "The noise moves the 
stroke as a whole, not point by point");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "move_extreme", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_NOISE_MOVE_EXTREME);
        RNA_def_property_ui_text(prop, "Move Extremes", "The noise moves the 
stroke extreme points");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "pass_index");
        RNA_def_property_range(prop, 0, 100);
        RNA_def_property_ui_text(prop, "Pass", "Pass index");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "step");
        RNA_def_property_range(prop, 1, 100);
        RNA_def_property_ui_text(prop, "Step", "Number of frames before 
recalculate random values again");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "inverse_layers", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_NOISE_INVERSE_LAYER);
        RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "inverse_pass", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_NOISE_INVERSE_PASS);
        RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "inverse_vertex", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_NOISE_INVERSE_VGROUP);
        RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 }
 
 static void rna_def_modifier_gpencilsubdiv(BlenderRNA *brna)
@@ -4948,34 +4966,34 @@ static void rna_def_modifier_gpencilsubdiv(BlenderRNA 
*brna)
        prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "layername");
        RNA_def_property_ui_text(prop, "Layer", "Layer name");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "level", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "level");
        RNA_def_property_range(prop, 0, 5);
        RNA_def_property_ui_text(prop, "Level", "Number of subdivisions");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "simple", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SUBDIV_SIMPLE);
        RNA_def_property_ui_text(prop, "Simple", "The modifier only add control 
points");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "pass_index");
        RNA_def_property_range(prop, 0, 100);
        RNA_def_property_ui_text(prop, "Pass", "Pass index");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "inverse_layers", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_SUBDIV_INVERSE_LAYER);
        RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "inverse_pass", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_SUBDIV_INVERSE_PASS);
        RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 }
 
 static void rna_def_modifier_gpencilsimplify(BlenderRNA *brna)
@@ -4991,30 +5009,30 @@ static void rna_def_modifier_gpencilsimplify(BlenderRNA 
*brna)
        prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
        RNA_def_property_string_sdna(prop, NULL, "layername");
        RNA_def_property_ui_text(prop, "Layer", "Layer name");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "factor");
        RNA_def_property_range(prop, 0, 100.0);
        RNA_def_property_ui_range(prop, 0, 100.0, 1.0f, 3);
        RNA_def_property_ui_text(prop, "Factor", "Factor of Simplify");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "pass_index");
        RNA_def_property_range(prop, 0, 100);
        RNA_def_property_ui_text(prop, "Pass", "Pass index");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "inverse_layers", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", 
GP_SIMPLIFY_INVERSE_LAYER);
        RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
-       RNA_def_property_update(prop, 0, "rna_Modifier_update");
+       RNA_def_property_update(prop, 0, "rna_Modifier_gpencil_update");
 
        prop = RNA_def_property(srna, "inverse_pass", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SIMPLIFY_INVER

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to