Using Python to create a Preview Window.

   2391   3   0
User Avatar
Member
7 posts
Joined:
Offline
The right-mouse “Preview Window” has some special properties that I'm finding difficult to replicate using a floatingPaneTab.

  1. I'm pretty certain that a floatingPaneTab SceneViewer will only ever display nodes with their display flag set.
  2. I can't find any way to script the “Hide Others” feature of the sceneViewer.

This could be a really great way to browse lightweight assets from an HDA.

Just having the ability to call up the existing Preview Window from python would be fantastic.

Anybody have workarounds?
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
hi,
every viewport has its own Display Options ('D' hotkey), you can customize the ‘Visible Objects’ parameter under the Optimize Tab in order to hide objects from the scene. You can modify it via python (or hscript?) as well.
Have a look at the python code used for the ‘Viewport Isolator’ node (only existing in the /obj context).

The gotcha with this is that you have to work at object level.
So, a dirty workaround could be that you create on the fly with python a new geometry node container (with obj merge inside that call your asset) and then for your desired viewport set visibility only for that object.


maybe there's a way simpler solution?
Edited by Andr - May 31, 2019 04:32:44
User Avatar
Member
7 posts
Joined:
Offline
Thanks for the info.

Yes– much more is possible at the object level.
But I want this functionality on the SOP node level–and don't really want to spawn nodes at obj level for a number of reasons.

The frustrating thing is that there's a nearly perfect solution right now in houdini. The right-mouse “Preview Window” is a nice stripped down viewport that displays the output of a single SOP node. I just cannot find a way to spawn one via python.

Also the UI “Hide Others” option is not part of the standard display options–and looking over SceneViewer and Viewport object methods–I'm not finding an equivalent (just to temporarily “clean up” the current (or spawned) viewport for asset browsing)…

My plan B is to just temporarily switch the output of my hda, and home on the new output. But it would be nice to force “hide others” at the same time…
User Avatar
Member
900 posts
Joined: Feb. 2016
Offline
henderthing
Thanks for the info.

Yes– much more is possible at the object level.
But I want this functionality on the SOP node level–and don't really want to spawn nodes at obj level for a number of reasons.

The frustrating thing is that there's a nearly perfect solution right now in houdini. The right-mouse “Preview Window” is a nice stripped down viewport that displays the output of a single SOP node. I just cannot find a way to spawn one via python.

Also the UI “Hide Others” option is not part of the standard display options–and looking over SceneViewer and Viewport object methods–I'm not finding an equivalent (just to temporarily “clean up” the current (or spawned) viewport for asset browsing)…

My plan B is to just temporarily switch the output of my hda, and home on the new output. But it would be nice to force “hide others” at the same time…

Many menu actions are not exposed to phyton unfortunately, I share your frustration.

Regarding the object level bit, if that's about not creating too much mess, rmb that you can always use event handlers in the scripts session of your hda to perform certain routines on specific events (like: on hda deleted, remove all garbage created at obj level)

cheers
  • Quick Links