What object property does bpy.ops.object.hide_view_set() actually toggle?


#1

bpy.ops.object.hide_view_set() is the equivalent of pressing ‘H’ or the eye icon in the outliner to toggle the temporary viewport visiblity of an object.

It is unclear what this operator does under the hood, and there doesn’t seem to be a way to retrieve / unhide object through python when they have been hidden using this operator. The API hasn’t been useful.

For the record, it’s not the object.hide_viewport or any of the object.hide_*** member properties found on the object itself. These control the other restriction properties.

Thanks.


#2

I have no idea about the functionality under the hood but according to the documentation bpy.ops.object.hide_view_clear(select=False) should unhide the object.
Maybe that’s useful for you.


#3

It toggles a per view layer hiding option, which is not available in the API as a property. Some way to directly access this property should be added still.


How to set visibility on view layers via python?
#4

Thanks. Yeah, that would be the unhide all operator. Looking at the C code, it seems to iterate over bases on the view layer and clear the hidden flag. Sadly it doesn’t allow selective unhiding.

Thank you. That confirms my suspicion. The main goal of mine was to have an addon keep a list of hidden objects which could be arbitrarily unhidden as a sort of ‘unhide history’. This would be nice to have access to down the line.

The current workaround is to rebind ‘H’ to toggle the already available hide_viewport property, although it doesn’t help if users check the eye icon in the outliner. But it’s nice to know regardless.


#5

Is there any progess to do same as hide_view () and hide_view_clear() as bpy.data.object property or function?


#6

There is no progress yet.


#7

Thanks to confirm. I wanted to find the way for add on developer.
The add on need to un-hide meshes (which user temporally) with armature modifier to convert rig then return it as user do.

If user only use “Disable object” (monitor icon of outoliner), we can change it by python, but I think there are many case user simply use “Hide” (short cut H, or eye icon in outliner), so hope to controll it by python as same as 2.7.