Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2019-12-04 16:13:21 +0300
committerAntonio Vazquez <blendergit@gmail.com>2019-12-04 16:17:08 +0300
commit98ff6cfa575bbe9680e5a0abf176a9d748ecc2b8 (patch)
tree28a74160f60a2bf8972783744334a4511ab92e82 /source/blender/editors/animation
parent541d0fdba61a9c99612f7532207d5ce704f10b43 (diff)
GPencil: Add Opacity y Onion switch to Dopesheet
Add new icons and panels Grease Pencil Dopesheet to manage layers without having the properties panel visible. Also, the icons are in the same order in Dopesheet, Layers and Material list to keep consistency. As the number of columns for icons is limited to 3 and we also need use a factor, I have impleted the change using slider area. Also, the slider option is enabled by default for 2D Template. See T72026 for more info. Reviewed By: mendio, pepeland, billreynish Differential Revision: https://developer.blender.org/D6328
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c70
1 files changed, 67 insertions, 3 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 8951677b32f..a2b9913ba14 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -4222,7 +4222,8 @@ void ANIM_channel_draw(
* - Slider should start before the toggles (if they're visible)
* to keep a clean line down the side.
*/
- if ((draw_sliders) && ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE, ANIMTYPE_SHAPEKEY)) {
+ if ((draw_sliders) &&
+ ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE, ANIMTYPE_SHAPEKEY, ANIMTYPE_GPLAYER)) {
/* adjust offset */
offset += SLIDER_WIDTH;
}
@@ -4992,7 +4993,8 @@ void ANIM_channel_draw_widgets(const bContext *C,
* - Slider should start before the toggles (if they're visible)
* to keep a clean line down the side.
*/
- if ((draw_sliders) && ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE, ANIMTYPE_SHAPEKEY)) {
+ if ((draw_sliders) &&
+ ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE, ANIMTYPE_SHAPEKEY, ANIMTYPE_GPLAYER)) {
/* adjust offset */
/* TODO: make slider width dynamic,
* so that they can be easier to use when the view is wide enough. */
@@ -5053,8 +5055,70 @@ void ANIM_channel_draw_widgets(const bContext *C,
rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
free_path = 1;
}
+ /* Special for Grease Pencil Layer. */
+ else if (ale->type == ANIMTYPE_GPLAYER) {
+ /* Add some offset to make it more pleasing to the eye. */
+ offset += SLIDER_WIDTH / 2.1f;
- /* only if RNA-Path found */
+ char *gp_rna_path = NULL;
+ bGPDlayer *gpl = (bGPDlayer *)ale->data;
+ const short width = SLIDER_WIDTH / 5;
+
+ /* Create the RNA pointers. */
+ RNA_pointer_create(ale->id, &RNA_GPencilLayer, ale->data, &ptr);
+ RNA_id_pointer_create(ale->id, &id_ptr);
+ int icon;
+
+ /* Mask Layer. */
+ UI_block_emboss_set(block, UI_EMBOSS_NONE);
+ prop = RNA_struct_find_property(&ptr, "mask_layer");
+ gp_rna_path = RNA_path_from_ID_to_property(&ptr, prop);
+ if (RNA_path_resolve_property(&id_ptr, gp_rna_path, &ptr, &prop)) {
+ icon = (gpl->flag & GP_LAYER_USE_MASK) ? ICON_MOD_MASK : ICON_LAYER_ACTIVE;
+ uiDefAutoButR(
+ block, &ptr, prop, array_index, "", icon, offset, ymid, width, channel_height);
+ }
+ MEM_freeN(gp_rna_path);
+
+ /* Layer opacity. */
+ UI_block_emboss_set(block, UI_EMBOSS);
+ prop = RNA_struct_find_property(&ptr, "opacity");
+ gp_rna_path = RNA_path_from_ID_to_property(&ptr, prop);
+ if (RNA_path_resolve_property(&id_ptr, gp_rna_path, &ptr, &prop)) {
+ uiDefAutoButR(block,
+ &ptr,
+ prop,
+ array_index,
+ "",
+ ICON_NONE,
+ offset + width,
+ ymid,
+ width * 3,
+ channel_height);
+ }
+ MEM_freeN(gp_rna_path);
+
+ /* Layer onion skinning switch. */
+ UI_block_emboss_set(block, UI_EMBOSS_NONE);
+ prop = RNA_struct_find_property(&ptr, "use_onion_skinning");
+ gp_rna_path = RNA_path_from_ID_to_property(&ptr, prop);
+ if (RNA_path_resolve_property(&id_ptr, gp_rna_path, &ptr, &prop)) {
+ icon = (gpl->onion_flag & GP_LAYER_ONIONSKIN) ? ICON_ONIONSKIN_ON : ICON_ONIONSKIN_OFF;
+ uiDefAutoButR(block,
+ &ptr,
+ prop,
+ array_index,
+ "",
+ icon,
+ offset + (width * 4),
+ ymid,
+ width,
+ channel_height);
+ }
+ MEM_freeN(gp_rna_path);
+ }
+
+ /* Only if RNA-Path found. */
if (rna_path) {
/* get RNA pointer, and resolve the path */
RNA_id_pointer_create(ale->id, &id_ptr);