[Bf-blender-cvs] [eb92ac05d6f] master: Outliner: invisible object filter

Nathan Craddock noreply at git.blender.org
Fri Aug 16 20:31:44 CEST 2019


Commit: eb92ac05d6f850ccdbc0ed636763669f5d1e765e
Author: Nathan Craddock
Date:   Thu Aug 8 18:09:08 2019 -0600
Branches: master
https://developer.blender.org/rBeb92ac05d6f850ccdbc0ed636763669f5d1e765e

Outliner: invisible object filter

Adds an invisible object filter in the outliner to show hidden
objects. This is useful to quickly locate hidden items in a large outliner
tree and easily toggle visibilty back on. Invisible refers to an object
being hidden, or viewport visibility restricted.

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

M	source/blender/editors/space_outliner/outliner_tree.c
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index cc062467dbe..7107b5539c8 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -2008,6 +2008,9 @@ static int outliner_exclude_filter_get(SpaceOutliner *soops)
     case SO_FILTER_OB_VISIBLE:
       exclude_filter |= SO_FILTER_OB_STATE_VISIBLE;
       break;
+    case SO_FILTER_OB_INVISIBLE:
+      exclude_filter |= SO_FILTER_OB_STATE_INVISIBLE;
+      break;
     case SO_FILTER_OB_SELECTED:
       exclude_filter |= SO_FILTER_OB_STATE_SELECTED;
       break;
@@ -2086,6 +2089,11 @@ static bool outliner_element_visible_get(ViewLayer *view_layer,
           return false;
         }
       }
+      else if (exclude_filter & SO_FILTER_OB_STATE_INVISIBLE) {
+        if ((base->flag & BASE_VISIBLE) != 0) {
+          return false;
+        }
+      }
       else if (exclude_filter & SO_FILTER_OB_STATE_SELECTED) {
         if ((base->flag & BASE_SELECTED) == 0) {
           return false;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 707b312e967..67f058c298b 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -287,13 +287,14 @@ typedef enum eSpaceOutliner_Filter {
   SO_FILTER_NO_OB_CAMERA = (1 << 10),
   SO_FILTER_NO_OB_OTHERS = (1 << 11),
 
-  SO_FILTER_UNUSED_12 = (1 << 12),         /* cleared */
-  SO_FILTER_OB_STATE_VISIBLE = (1 << 13),  /* Not set via DNA. */
-  SO_FILTER_OB_STATE_SELECTED = (1 << 14), /* Not set via DNA. */
-  SO_FILTER_OB_STATE_ACTIVE = (1 << 15),   /* Not set via DNA. */
-  SO_FILTER_NO_COLLECTION = (1 << 16),
-
-  SO_FILTER_ID_TYPE = (1 << 17),
+  SO_FILTER_UNUSED_12 = (1 << 12),          /* cleared */
+  SO_FILTER_OB_STATE_VISIBLE = (1 << 13),   /* Not set via DNA. */
+  SO_FILTER_OB_STATE_INVISIBLE = (1 << 14), /* Not set via DNA. */
+  SO_FILTER_OB_STATE_SELECTED = (1 << 15),  /* Not set via DNA. */
+  SO_FILTER_OB_STATE_ACTIVE = (1 << 16),    /* Not set via DNA. */
+  SO_FILTER_NO_COLLECTION = (1 << 17),
+
+  SO_FILTER_ID_TYPE = (1 << 18),
 } eSpaceOutliner_Filter;
 
 #define SO_FILTER_OB_TYPE \
@@ -301,7 +302,8 @@ typedef enum eSpaceOutliner_Filter {
    SO_FILTER_NO_OB_LAMP | SO_FILTER_NO_OB_CAMERA | SO_FILTER_NO_OB_OTHERS)
 
 #define SO_FILTER_OB_STATE \
-  (SO_FILTER_OB_STATE_VISIBLE | SO_FILTER_OB_STATE_SELECTED | SO_FILTER_OB_STATE_ACTIVE)
+  (SO_FILTER_OB_STATE_VISIBLE | SO_FILTER_OB_STATE_INVISIBLE | SO_FILTER_OB_STATE_SELECTED | \
+   SO_FILTER_OB_STATE_ACTIVE)
 
 #define SO_FILTER_ANY \
   (SO_FILTER_NO_OB_CONTENT | SO_FILTER_NO_CHILDREN | SO_FILTER_OB_TYPE | SO_FILTER_OB_STATE | \
@@ -311,8 +313,9 @@ typedef enum eSpaceOutliner_Filter {
 typedef enum eSpaceOutliner_StateFilter {
   SO_FILTER_OB_ALL = 0,
   SO_FILTER_OB_VISIBLE = 1,
-  SO_FILTER_OB_SELECTED = 2,
-  SO_FILTER_OB_ACTIVE = 3,
+  SO_FILTER_OB_INVISIBLE = 2,
+  SO_FILTER_OB_SELECTED = 3,
+  SO_FILTER_OB_ACTIVE = 4,
 } eSpaceOutliner_StateFilter;
 
 /* SpaceOutliner.show_restrict_flags */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 87472081f79..ef4406db84d 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2777,6 +2777,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
   static const EnumPropertyItem filter_state_items[] = {
       {SO_FILTER_OB_ALL, "ALL", 0, "All", "Show all objects in the view layer"},
       {SO_FILTER_OB_VISIBLE, "VISIBLE", 0, "Visible", "Show visible objects"},
+      {SO_FILTER_OB_INVISIBLE, "INVISIBLE", 0, "Invisible", "Show invisible objects"},
       {SO_FILTER_OB_SELECTED, "SELECTED", 0, "Selected", "Show selected objects"},
       {SO_FILTER_OB_ACTIVE, "ACTIVE", 0, "Active", "Show only the active object"},
       {0, NULL, 0, NULL, NULL},



More information about the Bf-blender-cvs mailing list