Setting an Object Filter for the outlinerEditor


Can anyone help me set up an Outliner with only sets please?

From the Outliner menu, it’s Show > Object > Sets (image attached)

I have read all of the Outliner PyMel reference, but I don’t see the parameters I can pass to the instantiation of the Outliner Window. For example, there are “setFilter” and “filter” flags, but I don’t know what to pass to them to get this Object filtering. There is “defaultSetFilter” but with that as the filter, I still see joints and geometry in my Outliner.

Thank you!


Create an itemFilter

Then pass that as argument, sometimes they can be done on the fly… ie.

menuItem -l “Materials” -c ( "outlinerEditor -e -dag 0 -filter (itemFilterRender -shaders true) " +$p );


Thank you for the response! This was helpful as I didn’t know I could create and pass a filter at instantiation of the Outliner Editor. I’m using Python for this script, so I wasn’t able to translate your code sample, unfortunately.

I have a couple follow-up questions:

  1. If I run the following code per the documentation plus pass a filter, it creates an Outliner Editor, but the filtering doesn’t seem to work (screenshot).
import pymel.core as pm

pm.frameLayout( labelVisible=False )
panel = pm.outlinerPanel()
outliner = pm.outlinerPanel(panel, query=True,outlinerEditor=True)
spotlight = pm.itemFilter(byType='spotLight')
pm.outlinerEditor( outliner, edit=True, mainListConnection='worldList', selectionConnection='modelList', showShapes=False, showAttributes=False, showConnected=False, showAnimCurvesOnly=False, autoExpand=False, showDagOnly=True, ignoreDagHierarchy=False, expandConnections=False, showNamespace=True, showCompounds=True, showNumericAttrsOnly=False, highlightActive=True, autoSelectNewObjects=False, doNotSelectNewObjects=False, transmitFilters=False, showSetMembers=True, setFilter=spotlight)

  1. Where can I find the list of the types acceptable to use with the filter? In the documentation all they mention is ‘transform’ and ‘spotlight.’ As mentioned in the original post, I want to filter the Outliner so it shows the same object sets that it would show if I applied Show > Objects > Sets from the Outliner’s menu.

Thank you!


Hi there…
First I stick with mel… so not sure of python syntax yet…
spotlight = pm.itemFilter(byType=‘spotLight’)

Why is the filter a property of the panel? -

~From the docs…
spotLights = cmds.itemFilter(byType=‘spotLight’)

This creates an itemFilter object on its own…

The docs are found under -Tecnical Documentation in the main help… Mel command reference, and there is a duplicate python version… it’s all there.

If u look up the outliner commands, there are examples there too.

def FilterOutliner():
  objectSetFilter = pm.itemFilter(byType='objectSet')
  panels = pm.getPanel(type="outlinerPanel")
  for panel in panels:
    print("Found panel: " + str(panel))
      outliner = pm.outlinerPanel(panel, query=True,outlinerEditor=True)
      print("In panel " + str(panel) + " found outliner editor " + str(outliner))
      print("Trying to set this outliner to use setFilter: " + str(objectSetFilter))
    except Exception as e:
      print e.message, e.args
      print("Error occurred during outliner filtering.")