Commit: 01758341125772acefcd47a38ea8fa46cf3c28e5
Author: Joshua Leung
Date:   Fri Dec 11 18:13:36 2015 +1300
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rB01758341125772acefcd47a38ea8fa46cf3c28e5

Fix: Keep onion skinning toggles in sync

When toggling the per-layer onionskinning settings, the datablock-level
toggle (shown on the header) should also be updated. This only really
applies when there is/was a single layer with onionskinning.

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

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

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

diff --git a/source/blender/makesrna/intern/rna_gpencil.c 
b/source/blender/makesrna/intern/rna_gpencil.c
index a31c27f..6367b8a 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -65,6 +65,31 @@ static void rna_GPencil_editmode_update(Main *UNUSED(bmain), 
Scene *scene, Point
        WM_main_add_notifier(NC_SCENE | ND_MODE, NULL);
 }
 
+static void rna_GPencil_onion_skinning_update(Main *bmain, Scene *scene, 
PointerRNA *ptr)
+{
+       bGPdata *gpd = (bGPdata *)ptr->id.data;
+       bGPDlayer *gpl;
+       bool enabled = false;
+       
+       /* Ensure that the datablock's onionskinning toggle flag
+        * stays in sync with the status of the actual layers
+        */
+       for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+               if (gpl->flag & GP_LAYER_ONIONSKIN) {
+                       enabled = true;
+               }
+       }
+       
+       if (enabled)
+               gpd->flag |= GP_DATA_SHOW_ONIONSKINS;
+       else
+               gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS;
+       
+       
+       /* Now do standard updates... */
+       rna_GPencil_update(bmain, scene, ptr);
+}
+
 static char *rna_GPencilLayer_path(PointerRNA *ptr)
 {
        bGPDlayer *gpl = (bGPDlayer *)ptr->data;
@@ -735,7 +760,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna)
        prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ONIONSKIN);
        RNA_def_property_ui_text(prop, "Onion Skinning", "Ghost frames on 
either side of frame");
-       RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_update");
+       RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, 
"rna_GPencil_onion_skinning_update");
        
        prop = RNA_def_property(srna, "ghost_before_range", PROP_INT, 
PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "gstep");

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

Reply via email to