[Bf-blender-cvs] [6a632f11c85] master: GPencil: Add missing Layer buttons in Dopesheet header and remove unneeded options

Antonio Vazquez noreply at git.blender.org
Wed Mar 11 16:14:59 CET 2020


Commit: 6a632f11c85f161bb53207651841979577b4139a
Author: Antonio  Vazquez
Date:   Wed Mar 11 16:10:10 2020 +0100
Branches: master
https://developer.blender.org/rB6a632f11c85f161bb53207651841979577b4139a

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

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

M	release/scripts/startup/bl_ui/space_dopesheet.py
M	source/blender/editors/animation/anim_filter.c
M	source/blender/makesdna/DNA_action_types.h
M	source/blender/makesrna/intern/rna_action.c

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

diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py
index 8117445e4af..76ba4dfb78e 100644
--- a/release/scripts/startup/bl_ui/space_dopesheet.py
+++ b/release/scripts/startup/bl_ui/space_dopesheet.py
@@ -252,15 +252,25 @@ class DOPESHEET_HT_editor_buttons(Header):
 
         # Layer management
         if st.mode == 'GPENCIL':
-            row = layout.row(align=True)
-            row.operator("gpencil.layer_move", icon='TRIA_UP', text="").type = 'UP'
-            row.operator("gpencil.layer_move", icon='TRIA_DOWN', text="").type = 'DOWN'
+            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="")
 
-            layout.separator_spacer()
+            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.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()
 
@@ -270,15 +280,8 @@ class DOPESHEET_HT_editor_buttons(Header):
             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="")
+            row.prop(st.dopesheet, "show_only_selected", text="")
+            row.prop(st.dopesheet, "show_hidden", text="")
 
         layout.popover(
             panel="DOPESHEET_PT_filters",
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index dcf0377ffc0..4b0a4bcf46b 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -1790,81 +1790,63 @@ 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;
-
-    /* Active scene's GPencil block first - No parent item needed... */
-    if (scene->gpd) {
-      items += animdata_filter_gpencil_data(anim_data, ads, scene->gpd, filter_mode);
-    }
-
-    /* Objects in the scene */
-    for (base = view_layer->object_bases.first; base; base = base->next) {
-      /* Only consider this object if it has got some GP data (saving on all the other tests) */
-      if (base->object && (base->object->type == OB_GPENCIL)) {
-        Object *ob = base->object;
-
-        /* firstly, check if object can be included, by the following factors:
-         * - if only visible, must check for layer and also viewport visibility
-         *   --> while tools may demand only visible, user setting takes priority
-         *       as user option controls whether sets of channels get included while
-         *       tool-flag takes into account collapsed/open channels too
-         * - if only selected, must check if object is selected
-         * - 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)) {
-          /* Layer visibility - we check both object and base,
-           * since these may not be in sync yet. */
-          if ((base->flag & BASE_VISIBLE_DEPSGRAPH) == 0) {
-            continue;
-          }
-
-          /* outliner restrict-flag */
-          if (ob->restrictflag & OB_RESTRICT_VIEWPORT) {
-            continue;
-          }
+  Scene *scene = (Scene *)ads->source;
+  ViewLayer *view_layer = (ViewLayer *)ac->view_layer;
+  Base *base;
+
+  /* Active scene's GPencil block first - No parent item needed... */
+  if (scene->gpd) {
+    items += animdata_filter_gpencil_data(anim_data, ads, scene->gpd, filter_mode);
+  }
+
+  /* Objects in the scene */
+  for (base = view_layer->object_bases.first; base; base = base->next) {
+    /* Only consider this object if it has got some GP data (saving on all the other tests) */
+    if (base->object && (base->object->type == OB_GPENCIL)) {
+      Object *ob = base->object;
+
+      /* firstly, check if object can be included, by the following factors:
+       * - if only visible, must check for layer and also viewport visibility
+       *   --> while tools may demand only visible, user setting takes priority
+       *       as user option controls whether sets of channels get included while
+       *       tool-flag takes into account collapsed/open channels too
+       * - if only selected, must check if object is selected
+       * - 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)) {
+        /* Layer visibility - we check both object and base,
+         * since these may not be in sync yet. */
+        if ((base->flag & BASE_VISIBLE_DEPSGRAPH) == 0) {
+          continue;
         }
 
-        /* check selection and object type filters only for Object mode */
-        if (ob->mode == OB_MODE_OBJECT) {
-          if ((ads->filterflag & ADS_FILTER_ONLYSEL) && !((base->flag & BASE_SELECTED))) {
-            /* only selected should be shown */
-            continue;
-          }
-        }
-        /* check if object belongs to the filtering group if option to filter
-         * objects by the grouped status is on
-         * - used to ease the process of doing multiple-character choreographies
-         */
-        if (ads->filter_grp != NULL) {
-          if (BKE_collection_has_object_recursive(ads->filter_grp, ob) == 0) {
-            continue;
-          }
+        /* outliner restrict-flag */
+        if (ob->restrictflag & OB_RESTRICT_VIEWPORT) {
+          continue;
         }
-
-        /* finally, include this object's grease pencil data-block. */
-        /* XXX: Should we store these under expanders per item? */
-        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;
+      /* check selection and object type filters only for Object mode */
+      if (ob->mode == OB_MODE_OBJECT) {
+        if ((ads->filterflag & ADS_FILTER_ONLYSEL) && !((base->flag & BASE_SELECTED))) {
+          /* only selected should be shown */
+          continue;
+        }
+      }
+      /* check if object belongs to the filtering group if option to filter
+       * objects by the grouped status is on
+       * - used to ease the process of doing multiple-character choreographies
+       */
+      if (ads->filter_grp != NULL) {
+        if (BKE_collection_has_object_recursive(ads->filter_grp, ob) == 0) {
+          continue;
+        }
       }
 
-      /* add GP frames from this data-block. */
-      items += animdata_filter_gpencil_data(anim_data, ads, gpd, filter_mode);
+      /* finally, include this object's grease pencil data-block. */
+      /* XXX: Should we store these under expanders per item? */
+      items += animdata_filter_gpencil_data(anim_data, ads, ob->data, filter_mode);
     }
   }
 
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index 4b696e29a52..5b9340ab3d9 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -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 |
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 436e847b044..c85a94d9fc2 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -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_p

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list