[Bf-blender-cvs] [fbf29086745] master: Outliner: Add "Selectable" object filter

Jaggz H noreply at git.blender.org
Tue Nov 3 06:10:03 CET 2020


Commit: fbf29086745f7e3a2ddb86eb11ed4433b4409946
Author: Jaggz H
Date:   Sat Oct 31 23:37:31 2020 -0600
Branches: master
https://developer.blender.org/rBfbf29086745f7e3a2ddb86eb11ed4433b4409946

Outliner: Add "Selectable" object filter

This addition to the filters allows the user to enable the
outliner tree to restrict the listing to only Selectable objects.

Differential Revision: https://developer.blender.org/D7310

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

M	source/blender/blenloader/intern/versioning_280.c
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/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 472400998b1..f568f9befe9 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3420,7 +3420,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
             case SPACE_OUTLINER: {
               SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
               space_outliner->filter &= ~(SO_FILTER_UNUSED_1 | SO_FILTER_UNUSED_5 |
-                                          SO_FILTER_UNUSED_12);
+                                          SO_FILTER_OB_STATE_SELECTABLE);
               space_outliner->storeflag &= ~(SO_TREESTORE_UNUSED_1);
               break;
             }
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 79376686342..232585fd7e3 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -2207,6 +2207,9 @@ static int outliner_exclude_filter_get(const SpaceOutliner *space_outliner)
     case SO_FILTER_OB_ACTIVE:
       exclude_filter |= SO_FILTER_OB_STATE_ACTIVE;
       break;
+    case SO_FILTER_OB_SELECTABLE:
+      exclude_filter |= SO_FILTER_OB_STATE_SELECTABLE;
+      break;
   }
 
   return exclude_filter;
@@ -2289,6 +2292,11 @@ static bool outliner_element_visible_get(ViewLayer *view_layer,
           return false;
         }
       }
+      else if (exclude_filter & SO_FILTER_OB_STATE_SELECTABLE) {
+        if ((base->flag & BASE_SELECTABLE) == 0) {
+          return false;
+        }
+      }
       else {
         BLI_assert(exclude_filter & SO_FILTER_OB_STATE_ACTIVE);
         if (base != BASACT(view_layer)) {
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 95cc0317a46..fe8ef421963 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -305,7 +305,7 @@ 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_SELECTABLE = (1 << 12), /* Not set via DNA. */
   SO_FILTER_OB_STATE_VISIBLE = (1 << 13),  /* Not set via DNA. */
   SO_FILTER_OB_STATE_HIDDEN = (1 << 14),   /* Not set via DNA. */
   SO_FILTER_OB_STATE_SELECTED = (1 << 15), /* Not set via DNA. */
@@ -321,7 +321,7 @@ typedef enum eSpaceOutliner_Filter {
 
 #define SO_FILTER_OB_STATE \
   (SO_FILTER_OB_STATE_VISIBLE | SO_FILTER_OB_STATE_HIDDEN | SO_FILTER_OB_STATE_SELECTED | \
-   SO_FILTER_OB_STATE_ACTIVE)
+   SO_FILTER_OB_STATE_ACTIVE | SO_FILTER_OB_STATE_SELECTABLE)
 
 #define SO_FILTER_ANY \
   (SO_FILTER_NO_OB_CONTENT | SO_FILTER_NO_CHILDREN | SO_FILTER_OB_TYPE | SO_FILTER_OB_STATE | \
@@ -334,6 +334,7 @@ typedef enum eSpaceOutliner_StateFilter {
   SO_FILTER_OB_HIDDEN = 2,
   SO_FILTER_OB_SELECTED = 3,
   SO_FILTER_OB_ACTIVE = 4,
+  SO_FILTER_OB_SELECTABLE = 5,
 } 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 203b8459ae6..605d5c97d72 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3050,6 +3050,7 @@ static void rna_def_space_outliner(BlenderRNA *brna)
       {SO_FILTER_OB_HIDDEN, "HIDDEN", 0, "Hidden", "Show hidden objects"},
       {SO_FILTER_OB_SELECTED, "SELECTED", 0, "Selected", "Show selected objects"},
       {SO_FILTER_OB_ACTIVE, "ACTIVE", 0, "Active", "Show only the active object"},
+      {SO_FILTER_OB_SELECTABLE, "SELECTABLE", 0, "Selectable", "Show only selectable objects"},
       {0, NULL, 0, NULL, NULL},
   };



More information about the Bf-blender-cvs mailing list