GPencil: Add missing Layer buttons in Dopesheet header and remove unneeded options

Update Dopesheet header to include missing buttons, remove Scene Active only buttton and also removed duplicated search box.

The removed options come from old 2.7x version and they are not required now.

Reviewed By: mendio, pepeland

Differential Revision: https://developer.blender.org/D7107
This commit is contained in:
Antonio Vazquez 2020-03-11 16:10:10 +01:00 committed by Antonio Vazquez
parent b198cef89f
commit 6a632f11c8
4 changed files with 68 additions and 96 deletions

@ -252,15 +252,25 @@ class DOPESHEET_HT_editor_buttons(Header):
# Layer management
if st.mode == 'GPENCIL':
ob = context.active_object
selected = st.dopesheet.show_only_selected
enable_but = selected and ob is not None and ob.type == 'GPENCIL'
row = layout.row(align=True)
row.enabled = enable_but
row.operator("gpencil.layer_add", icon='ADD', text="")
row.operator("gpencil.layer_remove", icon='REMOVE', text="")
row.menu("GPENCIL_MT_layer_context_menu", icon='DOWNARROW_HLT', text="")
row = layout.row(align=True)
row.enabled = enable_but
row.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP'
row.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN'
row = layout.row(align=True)
row.operator("gpencil.layer_add", icon='ADD', text="")
row.operator("gpencil.layer_remove", icon='REMOVE', text="")
layout.separator_spacer()
row.enabled = enable_but
row.operator("gpencil.layer_isolate", icon='RESTRICT_VIEW_ON', text="").affect_visibility = True
row.operator("gpencil.layer_isolate", icon='LOCKED', text="").affect_visibility = False
layout.separator_spacer()
@ -269,17 +279,10 @@ class DOPESHEET_HT_editor_buttons(Header):
elif st.mode == 'ACTION':
dopesheet_filter(layout, context)
elif st.mode == 'GPENCIL':
row = layout.row(align=True)
row.prop(st.dopesheet, "show_gpencil_3d_only", text="Active Only")
if st.dopesheet.show_gpencil_3d_only:
row = layout.row(align=True)
row.prop(st.dopesheet, "show_only_selected", text="")
row.prop(st.dopesheet, "show_hidden", text="")
row = layout.row(align=True)
row.prop(st.dopesheet, "filter_text", text="")
layout.popover(
panel="DOPESHEET_PT_filters",
text="",

@ -1790,7 +1790,6 @@ static size_t animdata_filter_gpencil(bAnimContext *ac,
bDopeSheet *ads = ac->ads;
size_t items = 0;
if (ads->filterflag & ADS_FILTER_GP_3DONLY) {
Scene *scene = (Scene *)ads->source;
ViewLayer *view_layer = (ViewLayer *)ac->view_layer;
Base *base;
@ -1815,8 +1814,7 @@ static size_t animdata_filter_gpencil(bAnimContext *ac,
* - there must be animation data to edit (this is done recursively as we
* try to add the channels)
*/
if ((filter_mode & ANIMFILTER_DATA_VISIBLE) &&
!(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) {
if ((filter_mode & ANIMFILTER_DATA_VISIBLE) && !(ads->filterflag & ADS_FILTER_INCL_HIDDEN)) {
/* Layer visibility - we check both object and base,
* since these may not be in sync yet. */
if ((base->flag & BASE_VISIBLE_DEPSGRAPH) == 0) {
@ -1851,22 +1849,6 @@ static size_t animdata_filter_gpencil(bAnimContext *ac,
items += animdata_filter_gpencil_data(anim_data, ads, ob->data, filter_mode);
}
}
}
else {
bGPdata *gpd;
/* Grab all Grease Pencil data-blocks directly from main,
* but only those that seem to be useful somewhere */
for (gpd = ac->bmain->gpencils.first; gpd; gpd = gpd->id.next) {
/* only show if gpd is used by something... */
if (ID_REAL_USERS(gpd) < 1) {
continue;
}
/* add GP frames from this data-block. */
items += animdata_filter_gpencil_data(anim_data, ads, gpd, filter_mode);
}
}
/* return the number of items added to the list */
return items;

@ -764,10 +764,6 @@ typedef enum eDopeSheet_FilterFlag {
/** show only F-Curves which are disabled/have errors - for debugging drivers */
ADS_FILTER_ONLY_ERRORS = (1 << 28),
/* GPencil Mode */
/** GP Mode - Only show datablocks used in the scene */
ADS_FILTER_GP_3DONLY = (1 << 29),
#if 0
/** combination filters (some only used at runtime) */
ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM | ADS_FILTER_NOMAT | ADS_FILTER_NOLAM |

@ -583,15 +583,6 @@ static void rna_def_dopesheet(BlenderRNA *brna)
prop, "Display Movie Clips", "Include visualization of movie clip related animation data");
RNA_def_property_ui_icon(prop, ICON_TRACKER, 0);
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
/* GPencil Mode Settings */
prop = RNA_def_property(srna, "show_gpencil_3d_only", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_GP_3DONLY);
RNA_def_property_ui_text(prop,
"Active Scene Only",
"Only show Grease Pencil data-blocks used as part of the active scene");
RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0);
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
static void rna_def_action_group(BlenderRNA *brna)