[Bf-blender-cvs] [03fc491048f] blender2.8: Outliner: move filter options to popover.

Brecht Van Lommel noreply at git.blender.org
Wed May 9 15:21:29 CEST 2018


Commit: 03fc491048f9efef67033a91d5a37ee0d9d7ec79
Author: Brecht Van Lommel
Date:   Wed May 9 13:40:34 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB03fc491048f9efef67033a91d5a37ee0d9d7ec79

Outliner: move filter options to popover.

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

M	release/scripts/startup/bl_ui/space_outliner.py
M	source/blender/editors/space_outliner/outliner_collections.c
M	source/blender/editors/space_outliner/outliner_edit.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/release/scripts/startup/bl_ui/space_outliner.py b/release/scripts/startup/bl_ui/space_outliner.py
index 4289ec9d50a..6441f70b4d8 100644
--- a/release/scripts/startup/bl_ui/space_outliner.py
+++ b/release/scripts/startup/bl_ui/space_outliner.py
@@ -18,7 +18,7 @@
 
 # <pep8 compliant>
 import bpy
-from bpy.types import Header, Menu
+from bpy.types import Header, Menu, Panel
 
 
 class OUTLINER_HT_header(Header):
@@ -65,46 +65,13 @@ class OUTLINER_HT_header(Header):
             row.prop(space, "use_filter_complete", text="")
             row.prop(space, "use_filter_case_sensitive", text="")
 
+        row = layout.row()
         if support_filters:
-            row.separator()
-
-            row.prop(space, "use_filters", text="")
-            if space.use_filters:
-                row.separator()
-                row.prop(space, "use_filter_collection", text="")
-                row.prop(space, "use_filter_object", text="")
-                sub = row.row(align=True)
-                sub.active = space.use_filter_object
-                sub.prop(space, "use_filter_object_content", text="")
-                sub.prop(space, "use_filter_children", text="")
-
-                sub.separator()
-                sub.prop(space, "use_filter_object_type", text="")
-
-                if space.use_filter_object_type:
-                    if bpy.data.meshes:
-                        sub.prop(space, "use_filter_object_mesh", text="")
-                    if bpy.data.armatures:
-                        sub.prop(space, "use_filter_object_armature", text="")
-                    if bpy.data.lamps:
-                        sub.prop(space, "use_filter_object_lamp", text="")
-                    if bpy.data.cameras:
-                        sub.prop(space, "use_filter_object_camera", text="")
-
-                    sub.prop(space, "use_filter_object_empty", text="")
-
-                    if bpy.data.curves or \
-                       bpy.data.metaballs or \
-                       bpy.data.lightprobes or \
-                       bpy.data.lattices or \
-                       bpy.data.fonts or bpy.data.speakers:
-                        sub.prop(space, "use_filter_object_others", text="")
-
-                sub.separator()
-                sub.prop(space, "use_filter_object_state", text="")
-
-                if space.use_filter_object_state:
-                    sub.prop(space, "filter_state", text="", expand=True)
+            row.popover(space_type='OUTLINER',
+                        region_type='HEADER',
+                        panel_type="OUTLINER_PT_filter",
+                        text="",
+                        icon='FILTER')
 
 
 class OUTLINER_MT_editor_menus(Menu):
@@ -247,6 +214,50 @@ class OUTLINER_MT_context_object(Menu):
         layout.operator("outliner.object_operation", text="Rename").type='RENAME'
 
 
+class OUTLINER_PT_filter(Panel):
+    bl_space_type = 'OUTLINER'
+    bl_region_type = 'HEADER'
+    bl_label = "Filter"
+
+    def draw(self, context):
+        layout = self.layout
+
+        space = context.space_data
+
+        col = layout.column()
+        col.prop(space, "filter_state", text="")
+        sub = col.column(align=True)
+        sub.active = space.filter_state != 'NONE'
+        sub.prop(space, "use_filter_object_content", text="Object Contents")
+        sub.prop(space, "use_filter_children", text="Object Children")
+
+        layout.separator()
+
+        col = layout.column_flow(align=True)
+        col.active = space.filter_state != 'NONE'
+
+        if bpy.data.meshes:
+            col.prop(space, "use_filter_object_mesh", text="Meshes")
+        if bpy.data.armatures:
+            col.prop(space, "use_filter_object_armature", text="Armatures")
+        if bpy.data.lamps:
+            col.prop(space, "use_filter_object_lamp", text="Lamps")
+        if bpy.data.cameras:
+            col.prop(space, "use_filter_object_camera", text="Cameras")
+
+        col.prop(space, "use_filter_object_empty", text="Empties")
+
+        if bpy.data.curves or \
+           bpy.data.metaballs or \
+           bpy.data.lightprobes or \
+           bpy.data.lattices or \
+           bpy.data.fonts or bpy.data.speakers:
+            col.prop(space, "use_filter_object_others", text="Others")
+
+        layout.separator()
+        layout.prop(space, "use_filter_collection", text="Collections")
+
+
 classes = (
     OUTLINER_HT_header,
     OUTLINER_MT_editor_menus,
@@ -259,6 +270,7 @@ classes = (
     OUTLINER_MT_context_object_delete,
     OUTLINER_MT_context_object_select,
     OUTLINER_MT_context_object_collection,
+    OUTLINER_PT_filter,
 )
 
 if __name__ == "__main__":  # only for live edit.
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index fd2b463f91b..1cfe5b16fe1 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -95,10 +95,7 @@ static int outliner_objects_collection_poll(bContext *C)
 	}
 
 	/* Groups don't support filtering. */
-	if ((so->outlinevis != SO_GROUPS) &&
-	    ((so->filter & (SO_FILTER_ENABLE | SO_FILTER_NO_COLLECTION)) ==
-	    (SO_FILTER_ENABLE | SO_FILTER_NO_COLLECTION)))
-	{
+	if ((so->outlinevis != SO_GROUPS) && (so->filter & SO_FILTER_NO_COLLECTION)) {
 		return 0;
 	}
 
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 2447a7e4a60..9207ee5ae15 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -2089,8 +2089,7 @@ static int outliner_parenting_poll(bContext *C)
 		}
 
 		if (soops->outlinevis == SO_COLLECTIONS) {
-			return ((soops->filter & SO_FILTER_ENABLE) &&
-			        (soops->filter & SO_FILTER_NO_COLLECTION));
+			return (soops->filter & SO_FILTER_NO_COLLECTION);
 		}
 	}
 
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 2a5151a16ad..d1195621138 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1833,9 +1833,7 @@ static void outliner_store_scrolling_position(SpaceOops *soops, ARegion *ar, Out
 
 static int outliner_exclude_filter_get(SpaceOops *soops)
 {
-	int exclude_filter = soops->filter & ~(SO_FILTER_OB_STATE_VISIBLE |
-	                                       SO_FILTER_OB_STATE_SELECTED |
-	                                       SO_FILTER_OB_STATE_ACTIVE);
+	int exclude_filter = soops->filter & ~SO_FILTER_OB_STATE;
 
 	if (soops->filter & SO_FILTER_SEARCH) {
 		if (soops->search_string[0] == 0) {
@@ -1848,26 +1846,19 @@ static int outliner_exclude_filter_get(SpaceOops *soops)
 		return (exclude_filter & SO_FILTER_SEARCH);
 	}
 
-	if ((exclude_filter & SO_FILTER_NO_OB_ALL) == 0) {
-		exclude_filter &= ~SO_FILTER_OB_TYPE;
-	}
-
-	if (exclude_filter & SO_FILTER_OB_STATE) {
-		switch (soops->filter_state) {
-			case SO_FILTER_OB_VISIBLE:
-				exclude_filter |= SO_FILTER_OB_STATE_VISIBLE;
-				break;
-			case SO_FILTER_OB_SELECTED:
-				exclude_filter |= SO_FILTER_OB_STATE_SELECTED;
-				break;
-			case SO_FILTER_OB_ACTIVE:
-				exclude_filter |= SO_FILTER_OB_STATE_ACTIVE;
-				break;
-		}
-	}
-
-	if ((exclude_filter & SO_FILTER_ANY) == 0) {
-		exclude_filter &= ~(SO_FILTER_OB_STATE);
+	switch (soops->filter_state) {
+		case SO_FILTER_OB_NONE:
+			exclude_filter |= SO_FILTER_OB_TYPE;
+			break;
+		case SO_FILTER_OB_VISIBLE:
+			exclude_filter |= SO_FILTER_OB_STATE_VISIBLE;
+			break;
+		case SO_FILTER_OB_SELECTED:
+			exclude_filter |= SO_FILTER_OB_STATE_SELECTED;
+			break;
+		case SO_FILTER_OB_ACTIVE:
+			exclude_filter |= SO_FILTER_OB_STATE_ACTIVE;
+			break;
 	}
 
 	return exclude_filter;
@@ -1875,13 +1866,13 @@ static int outliner_exclude_filter_get(SpaceOops *soops)
 
 static bool outliner_element_visible_get(ViewLayer *view_layer, TreeElement *te, const int exclude_filter)
 {
-	if ((exclude_filter & SO_FILTER_ENABLE) == 0) {
+	if ((exclude_filter & SO_FILTER_ANY) == 0) {
 		return true;
 	}
 
 	TreeStoreElem *tselem = TREESTORE(te);
 	if ((tselem->type == 0) && (te->idcode == ID_OB)) {
-		if ((exclude_filter & SO_FILTER_NO_OBJECT)) {
+		if ((exclude_filter & SO_FILTER_OB_TYPE) == SO_FILTER_OB_TYPE) {
 			return false;
 		}
 
@@ -2202,7 +2193,7 @@ void outliner_build_tree(Main *mainvar, Scene *scene, ViewLayer *view_layer, Spa
 		tenlay->directdata = view_layer;
 		TREESTORE(tenlay)->flag &= ~TSE_CLOSED;
 
-		if ((soops->filter & SO_FILTER_ENABLE) && (soops->filter & SO_FILTER_NO_COLLECTION)) {
+		if (soops->filter & SO_FILTER_NO_COLLECTION) {
 			for (Base *base = view_layer->object_bases.first; base; base = base->next) {
 				TreeElement *te_object = outliner_add_element(soops, &tenlay->subtree, base->object, NULL, 0, 0);
 				te_object->directdata = base;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 795cd0ee974..292120d1f6e 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -279,12 +279,12 @@ typedef enum eSpaceOutliner_Flag {
 /* SpaceOops->filter */
 typedef enum eSpaceOutliner_Filter {
 	SO_FILTER_SEARCH           = (1 << 0),
-	SO_FILTER_ENABLE           = (1 << 1),
-	SO_FILTER_NO_OBJECT        = (1 << 2),
+	/* SO_FILTER_ENABLE           = (1 << 1), */ /* Deprecated */
+	/* SO_FILTER_NO_OBJECT        = (1 << 2), */ /* Deprecated */
 	SO_FILTER_NO_OB_CONTENT    = (1 << 3), /* Not only mesh, but modifiers, constraints, ... */
 	SO_FILTER_NO_CHILDREN      = (1 << 4),
 
-	SO_FILTER_OB_TYPE          = (1 << 5),
+	/* SO_FILTER_OB_TYPE          = (1 << 5), */ /* Deprecated */
 	SO_FILTER_NO_OB_MESH       = (1 << 6),
 	SO_FILTER_NO_OB_ARMATURE   = (1 << 7),
 	SO_FILTER_NO_OB_EMPTY      = (1 << 8),
@@ -292,22 +292,25 @@ typedef enum eSpaceOutliner_Filter {
 	SO_FILTER_NO_OB_CAMERA     = (1 << 10),
 	SO_FILTER_NO_OB_OTHERS     = (1 << 11),
 
-	SO_FILTER_OB_STATE          = (1 << 12),
+	/* SO_FILTER_OB_STATE          = (1 << 12), */ /* Deprecated */
 	SO_FILTER_OB_STATE_VISIBLE  = (1 <<

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list