[Bf-blender-cvs] [397f78f] GPencil_Editing_Stage3: GPencil: Usability Tweaks to "Onion Skins" toggle on header
Joshua Leung
noreply at git.blender.org
Thu Dec 3 14:29:28 CET 2015
Commit: 397f78f4be315f2dfcf4968c701f20c50098782b
Author: Joshua Leung
Date: Fri Dec 4 02:28:57 2015 +1300
Branches: GPencil_Editing_Stage3
https://developer.blender.org/rB397f78f4be315f2dfcf4968c701f20c50098782b
GPencil: Usability Tweaks to "Onion Skins" toggle on header
* The state of this toggle now reflects whether onion skinning is enabled on
any layer, instead of just the active layer. This is handy if there's more than
one GP datablock being shown in the scene, and you need to track down whether it's
the current GP datablock that has a layer with this enabled
* Disabling the toggle now turns off onion skinning on ALL layers at the same time.
This makes it much faster to turn off onion skinning if you've got it enabled
on several layers and would now like to disable it (e.g. for a "clean" pass over
the anim)
* Toggling this button still enables onion skinning for just the active layer,
since that's the one you're most likely to want to see these for (i.e. the character
outlines are on this layer, but some of the background elements are animated, and you
don't really want to see those ghosted)
===================================================================
M release/scripts/startup/bl_ui/space_view3d.py
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesrna/intern/rna_gpencil.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 6c19f63..a79e6d7 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -124,9 +124,7 @@ class VIEW3D_HT_header(Header):
row.operator("gpencil.copy", text="", icon='COPYDOWN')
row.operator("gpencil.paste", text="", icon='PASTEDOWN')
- if context.active_gpencil_layer:
- gpl = context.active_gpencil_layer
- layout.prop(gpl, "use_onion_skinning", text="Onion Skins", icon='PARTICLE_PATH') # XXX: icon
+ layout.prop(context.gpencil_data, "use_onion_skinning", text="Onion Skins", icon='PARTICLE_PATH') # XXX: icon
class VIEW3D_MT_editor_menus(Menu):
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index beffbc4..053581f 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -200,7 +200,10 @@ typedef enum eGPdata_Flag {
GP_DATA_DEPTH_STROKE_ENDPOINTS = (1 << 7),
/* Stroke Editing Mode - Toggle to enable alternative keymap for easier editing of stroke points */
- GP_DATA_STROKE_EDITMODE = (1 << 8)
+ GP_DATA_STROKE_EDITMODE = (1 << 8),
+
+ /* Convenience/cache flag to make it easier to quickly toggle onion skinning on/off */
+ GP_DATA_SHOW_ONIONSKINS = (1 << 9)
} eGPdata_Flag;
#endif /* __DNA_GPENCIL_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index d037873..9174e9d 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -211,6 +211,30 @@ static void rna_GPencilLayer_info_set(PointerRNA *ptr, const char *value)
BLI_uniquename(&gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
}
+static void rna_GPencil_use_onion_skinning_set(PointerRNA *ptr, const int value)
+{
+ bGPdata *gpd = ptr->id.data;
+ bGPDlayer *gpl;
+
+ /* set new value */
+ if (value) {
+ /* enable on active layer (it's the one that's most likely to be of interest right now) */
+ gpl = gpencil_layer_getactive(gpd);
+ if (gpl) {
+ gpl->flag |= GP_LAYER_ONIONSKIN;
+ }
+
+ gpd->flag |= GP_DATA_SHOW_ONIONSKINS;
+ }
+ else {
+ /* disable on all layers - allowa quickly turning them all off, without having to check */
+ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ gpl->flag &= ~GP_LAYER_ONIONSKIN;
+ }
+
+ gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS;
+ }
+}
static bGPDstroke *rna_GPencil_stroke_point_find_stroke(const bGPdata *gpd, const bGPDspoint *pt, bGPDlayer **r_gpl, bGPDframe **r_gpf)
{
@@ -899,6 +923,13 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Stroke Edit Mode", "Edit Grease Pencil strokes instead of viewport data");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update");
+ prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_SHOW_ONIONSKINS);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencil_use_onion_skinning_set");
+ RNA_def_property_ui_text(prop, "Onion Skins",
+ "Show ghosts of the frames before and after the current frame, toggle to enable on active layer or disable all");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
/* API Functions */
func = RNA_def_function(srna, "clear", "rna_GPencil_clear");
RNA_def_function_ui_description(func, "Remove all the grease pencil data");
More information about the Bf-blender-cvs
mailing list