How to use Python to control the visualization button

   517   1   0
User Avatar
Member
4 posts
Joined: July 2022
Offline
Does anyone know how to control the on - off state of the visualization button on the viewport toolbar using Python? I haven't found any method to control this switch. The functionality of using hou.viewportVisualizers seems to be able to control only a single one, but I want to be able to toggle the whole group, just like when I click the visualization button on the viewport toolbar with the mouse.

Attachments:
Quicker_20250308_191449.png (2.4 KB)

User Avatar
Member
4 posts
Joined: July 2022
Offline
vis = hou.viewportVisualizers.visualizers(hou.viewportVisualizerCategory.Scene)

list =

for each in vis:
vname =each.label()
list.append(vname)



#desktop = hou.ui.curDesktop()
#pane = desktop.paneTabOfType(hou.paneTabType.SceneViewer)
pane = hou.ui.curDesktop().paneTabUnderCursor()
view = pane.curViewport()


sel = hou.ui.selectFromList(list, message='Select attri')

for s in sel:
v = vis
v.setIsActive(not v.isActive(view),view)

This is what I'm currently using, and it can only be controlled by making selections.
Edited by c540843679 - March 8, 2025 08:09:28
  • Quick Links