Set H hotkey to toggle Object.hide_viewport instead of ObjectBase.hide_viewport

Hi folks ! I am trying to set the H hotkey to toggle the monitor icon instead of the eye icon, since this is what I use most often. By default H is bound to object.hide_view_set, I tried changing it to something like object.hide_viewport but no dice. Any idea ?

Cheers,

Hadrien

According to the context help the name should assemble something like disable in viewport… but it seems there is only outliner.collection_exclude_set which does disable collections only…

Almost funny… with Python Tooltips enabled it shows for:

  • hide : ObjectBase.hide_viewport
  • disable : Object.hide_viewport

…but that also doesn’t help… because in the keymap you could not use Object or ObjectBase… but…

Directly adding a shortcut while hovering over for example the hide button (in outliner) of the standard cube does add a short cut (only to the cube) showing:

Window: Context Toggle: wm.context_toggle: Context Attributes: object.hide_viewport

…but you have to disable the original H shortcut (for the Outliner (which is called outliner.hide there ?!) or the Object Mode ( → so it works in the 3D view) ) to make this work… (but only for the cube…)

Weird… this only works for the standard cube… but i don’t see any reference to thsi object at all in the Keymap settings…

Hi @Hadriscus ,

this can be done via wm_context so put wm.context_toggle in the identifier field and then object.hide_viewport in the context field.

You wanted toggle, right? Otherwise you have to use wm.context_set_boolean

@Okidoki: Sorry just saw that you also mentioned this further down. But it should work. At least it works here. Maybe you put the shortcut into the wrong category.

1 Like

You must be a magician… :mage: as i mentioned above this worked only for the cube with no further reference… but now (after your spell :magic_wand: )… adding this via the context menu (getting exact what you said…) also works for other objects… or i wasn’t looking good enough :crazy_face:

1 Like

Hahaha ok cool. :grin: :+1:

Is it possible to set it like default hide? I mean i also want set the H, shift H, and alt H as well.

When i try to set it manually, there’s no option to hide unselected or unhide all.

Hmm… for the view ther is not option like in for the object → chooseable (selected or unselected)…

ObjectVsView

yeah, that’s what i also see, i can only set it to hide and unhide the active object, but not unhide all.

Well in princple yes, but the monitor icon isnt exactly hiding or unhiding, blender calls it enabling and disabling in viewport and while there are a lot of comfort functions for the classic hiding there, I dont think that the neccessary operators for that are also implemented for their enabled state.

thanks for the reply, i guess I’ll stick to collection manager addons for this feature then although i only used it for replacing the default hide behaviour.

1 Like

Thanks a lot @Debuk. The toggling behaviour works fine too. Like @ADRs said it would be nice to have other visibility shortcuts work as well (shift+H and alt+H), but I understand they just don’t exist as operators. @Okidoki thanks for investigating this with me !

1 Like

Maybe you could use collection manager add-ons that shipped with Blender like i do, they can replace all the H button to disable in the viewport, just disable the QCD then deactivated the manager pop-up menu shortcut if you won’t use it.

3 Likes

Thanks @ADRs ! I tried it and this particular checkbox seems to do exactly what I was looking for :
colmanhid

Really appreciate the advice !

3 Likes