Collection Visibility

Some background info, I personally use

3d view
F2: toggle Wireframe > Solid shading for objects:
F3: Toggle X-ray > Solid shading
F4: Toggle Solid shading > Rendered

Prelim keymap for testing
F11: Toggle Bounds/ Textured
F12: Toggle Wire/ Textured

I would then use the same logic F1 = course > F4 = detailed
F1: Bounds
F2: Wire
F4: Textured


By the way, it won’t change modes if I select the collection, hit the hotkey and decided I want to change modes.

By default Blender uses toggles for Wireframe/ solid, so I think I’ve gotten used to those. Both F1 and F2 would be toggles in my config between Bounds/ Textured and Wire/ Textured.

The only thing I would expect is that if I hit the F11/ F12 toggle is that all objects would go to the same mode.

For the rest, I only have to manually place the keymaps for the shortcuts, so you don’t really need to worry about that.

So I think, contrary to what I first said before I tested it, that because I toggle the state with a hotkey, I expect the button to determine the state of all the objects/ collections. Sorry for the confusing initial response. :sweat_smile:
And it would be most consistent the way Blender does visibility toggles (the F2,3,4 story).

The objects start with:
Cube = bounds
Monkey = wire
Sphere = textured

So in this one, you can see the collections change both directions, which is not what I would expect.

You can see it happen here too (now with pop-up panel to see what I am doing).

By the way, when using toggles, the redo last panel won’t make sense, change it back to the other mode and it will not switch to the other mode, because it is a toggle. So I would suggest not using the redo last for the toggles.

E: Overall, I really like the experience! Just a matter of making sure the toggles work consistently. :grinning:

Wire toggle
If selection/ collection contains non-wire, switch those objects/ collections to wire.
Else, switch to Textured.

Bounds toggle
If selection/ collection contains non-bounds, switch those objects/ collections to bounds.
Else, switch to Textured.

E2: Decided to move the toggles to number keys, 1 & 2 toggle object bounds and wire respectively, 3 & 4 toggle collection bounds and wire respectively. This solves the F2 conflict as well.

1 Like

Try this one:

old (8.2 KB)

for keymaps in outliner:
object.collection_wire_toggle - switch all objects in collections by active to wire/textured
object.collection_bounds_toggle - the same but to bounds/textured

if it’s ok, then another 2 operators for only selections

the same object.collection_wire_toggle and object.collection_bounds_toggle need to add to 3D View keymap, if you want to work it in 3dView also.

1 Like

It works like a charm, perfect this way!

The only thing I cannot do is change the mode by selecting just the collection in the outliner, see:

oh, I see, it support only with selecting objects right now.
I’ll check for collection selected.

Added: Cant figure it out how to make it toggle if only collection/s is selected…

1 Like

Can you select one of the items within the collection first before performing the display mode changes? And maybe deselect when done? Perhaps by reading the collection name from the current selection?
E: for nested collections that may prove more difficult.

If not, then so be it :upside_down_face:
I already like it as is, especially with object + collection support :slight_smile:

I can get collections name but I can’t make them active and highlighted in outliner (when I select all collection objects switch them and after I need to select collections again for toggle), also I need to check if it only objects selected or only collections.
Maybe someone with a more skills will help me in the future.
But for now only objects can toggle. (10.3 KB)

And one more thing about collection, it have no display_type parameter for checking first state to toggle.

1 Like

No problem, I like it!
Thank you for your effort on this! :+1: :+1:

Since it depends on the active object there can be occasions where If I select objects, they do not toggle, but don’t feel obliged to fix this, I can easily get around this.

Active object dependency

This only applies to the object modes.

1 Like

Blender have very annoying behaviors with active object, it can be active but not selected (highlighted) and this can cause problems…

1 Like

I think I fixed it. Try this:
no need to replace keymaps (10.7 KB)

But Note! Active will be considered an object with active origin, even if it not highlighted.
And it will become highlighted when using the toggle operator.

1 Like

Great! I prefer this new behaviour, thnx!

Would it be possible to add an option to make the script run in edit mode too? now when I try to set collections in edit mode I have this error:

Python: Traceback (most recent call last):
  File "C:\Users\radi0n\AppData\Roaming\Blender Foundation\Blender\3.1\scripts\addons\", line 79, in execute
    ops.object.select_grouped(extend=True, type='COLLECTION')                        
  File "C:\Blender\Blender3.1\3.1\scripts\modules\bpy\", line 132, in __call__
    ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.object.select_grouped.poll() failed, context is incorrect

location: <unknown location>:-1

Also the "Show as …: Wire, bounds ect … all inactive collection option would be useful.

I use Blender 3.1


Could you make an collapse/ expand selected collections operator? Machin3tools has collapse/ expand all folders, but I am still missing a more finer grained control. If possible, it would fit your addon nicely, I think.

as I understood it’s not possible to collapse/expand selected collection with python. Only manually.

collapse/ expand all folders built in operator Num+/-

That was to be expected, thanks for letting me know.

Very cool add-on… must have!

In Edit Modo I get this error, but no the less it does work…

I have no much time for more elegant solution,
but try this quick update (11.6 KB)


Still getting that error.

Can you re download previous script again?
I haven’t that issue.

1 Like