Page MenuHome

Outliner filter system - objects
ClosedPublic

Authored by Dalai Felinto (dfelinto) on Jan 9 2018, 11:01 PM.

Details

Summary

This is an initial implementation of a filtering system in the outliner.
We start by allowing users to filter out objects (shortcut O).

Right now we support it in Active View Layer and Collections only.

We try to preserve the scrolling position before/after filtering as much as
possible. We do it by using the top-most collection as the focus element.

Todo: Break-down object filter in object type as per @Sergey Sharybin (sergey) 's suggestion.

Diff Detail

Repository
rB Blender

Event Timeline

Demo of the persistent-scrolling implementation:

@Sergey Sharybin (sergey) I will poke you for real review once I get the granular object type filter, so don't bother for now.

Julian Eisel (Severin) requested changes to this revision.EditedJan 10 2018, 5:01 PM

I know you plan to do further changes to this, but just quickly went over code and noticed some rough edges that I don't want to end up in master/blender2.8 ;)

source/blender/editors/space_outliner/outliner_tree.c
1756–1788

This whole lookup seems redundant, the TreeStoreElem representing an entity (object, collection, whatever) shouldn't change over redraws. So you'd just have to store the TreeStoreElem of the collection you want to keep on screen, and use outliner_find_tree_element to find its current TreeElement wrapper.

1819–1820

I'd rather have the caller handle redrawing (Doxygen function comment can note that). This function is only called through outliner_build_tree right now, which again is only called in draw_outliner. Hence, we tag for redraw while we prepare a redraw. Shouldn't cause issues in practice, still better to avoid.

1841

For each iteration of this while loop, this does an recursive lookup starting from the first element in the tree root. Lots of redundant operations there.
Instead of doing this coordinate-based, add a helper function that does a recursive listbase look-up starting from the current item, e.g. outliner_find_next_tree_element_of_type(te, TSE_LAYER_COLLECTION). TreeElement contains a parent pointer which you'll need I guess.

Also I think this function should early exit if the view isn't of type SO_ACT_LAYER or SO_COLLECTIONS?

2083–2084

Since you touch most of this block already, please give this a more useful name like te_next :)

2119

Why is this + 2 needed? (Better explain in code comment). Also, no need to cast NULL, you have a SpaceOops pointer is passed as argument.

2139

What does the scrolling position have to do with the filtering itself? What I mean is, scrolling shouldn't be handled in a function called outliner_filter_tree, either separately or the function should be called outliner_filter_tree_and_adjust_view.

This revision now requires changes to proceed.Jan 10 2018, 5:01 PM

I'd love to see this, too.
I've even had my clumsy go at it some time ago and posting as reference (because there was some discussion/critique on UI that might be helpful?)
T43787: Outliner: Show/Hide By Type (part of even more clumsy tries here: T43282: OutlinerLove: a couple of goodies for the outliner)

Dalai Felinto (dfelinto) marked 3 inline comments as done.
  • From review: Use TreeStoreElem directly
  • From review: Move scrolling position outside of filter
  • From review: Do not tag for redraw while rebuilding tree
  • From review: ten -> te_next
  • Small change: no need for valid, check tselem != NULL
  • From review: More elegant approach to find object type
  • Different approach to TreeElement lookup
  • Fix wrong ARegion passed around

All points raised by @Julian Eisel (Severin) are tackled now.

Yay for filtering! Love it especially how it keeps the scrolling position and the UI doesn't jump around, this is something we should try to achieve everywhere in Blender.

As I understand, this is currently implemented for the Active View Layer and Collections views only. We should try to arrange these filtering options in the same nesting/dropdown layout they'd be when in other Outliner views. Only the filtering options that make sense for that view would show up (e.g. Collections view would list Objects, but not Sequence Strips or Scenes).

  • Filter...
    • Objects
      • All
      • Lamp
      • Mesh
      • etc.
    • Groups
    • etc.
  • Object Filtering System

Update patch with object type filtering.

I would still like to figure out a way to handle:

  • Collection filter
  • State filter (active, visible, selected)

Also, be aware that children filtering is working, however we need to change how we draw children in the outliner (may as well be tackled by a separated patch). We should be able to tell these two scenarios apart:

  1. Object A is in Collection 1, and its children B is not in collection 2
  2. Object A and its children Object B are in Collection 1.

This was one of the core motivations for the outliner filtering by the way.

Demo of the current state: https://youtu.be/9Vz8UTLD0Q8

Also, after this patch gets merged (or before?) I need to integrate it with the other modes, and get rid of the unnecessary ones (Scene, Visible, Selected, Same Type, ...)

  • Filter object state

This is looking better and better, 2.8 Outliner is finally going to become what it should have always been, great work!

User suggestions

1 - Not sure if this fits into this this task, but as far as I know it is currently not possible to forcibly make a bunch of random items selectable, visible, or renderable from the Outliner.
I mean if a random selection of objects has a mix of different current renderability, selectability or visibility states, the only option in the context menu is Toggle #### said property, which obviously well toggles the current state.
This makes it so there is no easy way to match the state on all selected items if the current desired property state is not the same.

Is it possible to make it so that when clicking an item it makes all selected items match the active one state instead? I think this is closer to the expected result and matches behavior on other applications.
If not, alternatively add/replace context menu entries to something like Make Selectable, Make Visible, or Make Renderable?

2 - Would also be great if we could a "selection fill" option for the outliner.item_activate operator, as in the file manager file.select operator currently. You know, the regular Shift-Select item 1 to item 7 in the list and items 2,3,4,5 and 6 get selected too. Maybe also something akin to "Walk Select" file.select_walk for Keyboard arrow navigation.

Thanks for the great progress, keep up the excellent work!

  • From review: use filter icon to set filter on/off, not only UI
  • From review: icons
  • Code cleanup
  • Barebones for collection filter (DNA/RNA/UI)
  • Collection filtering
  • Leave edit menu exclusively in RMB
  • Outliner: Get rid of search icons
  • Outliner: Remove uneeded outlineviz options.
  • Outliner: Fix name search
  • Merge remote-tracking branch 'origin/blender2.8' into tmp-outliner-object-filter

@Sergey Sharybin (sergey) @Julian Eisel (Severin) patch is ready to roll, can I?

@Sergey Sharybin (sergey) planning to merge this first thing in the morning if you are fine with it. Poke to @Julian Eisel (Severin) as well.

Bonus, planning to add this afterwards: P593

This revision was not accepted when it landed; it landed in state Needs Review.Jan 19 2018, 3:21 PM
This revision was automatically updated to reflect the committed changes.