Take a screenshot of the Network Editor

   2592   3   3
User Avatar
Member
66 posts
Joined: March 2017
Offline
Hi guys,

I'm trying to find a way to take a screenshot of the selected nodes of the networkEditor. Did anyone managed to do the same already ?

So far, I got everything I needed, the coordinates in screen space of the bounding rect I need to capture (based on the selected nodes), but it's expressed in local space of the networkEditor.

The next (and last) step for me would be to “just” get the position of the networkEditor in screen space, but this is something that is not available in the Python API.

I tried to go through the Qt Widgets in an attempt to find the one that describes the networkEditor, but without any success.

Please let me know if you had ideas on how to solve this…

Thanks a lot,

Julien
VFX Supervisor @ MPC London
User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
Hi, Julien,

if you are on Windows, you should be able to find screen coordinates of client windows using the win32gui module. It's been some time that I used Python for C++ jobs (sorry, couldn't resist ), but it should work somewhat along this line of thought:

  • get your window handle (probably Houdini's main window handle, you can look that up from the project name and Houdini version) using win32gui.FindWindow(…)
  • get main window's screen estate from win32gui.GetWindowRect(handle)
  • get client windows (all “sub-windows” in Houdini's UI), iterate over them until you find the network editor
  • inside the window screen estate get relative/offset positions for the client window using “ClientToScreen”, I think it's win32gui.ClientToScreen(clienthandle,(x,y))
)

If that's too academic, I'll have a peek at some old code and try to come up with a rudimentary “listing”!

Marc

EDIT: Sorry, this forum's editor screwed up my text, deleting and rearranging what I typed …
Edited by malbrecht - Aug. 10, 2020 02:25:46
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
User Avatar
Member
66 posts
Joined: March 2017
Offline
Thanks Marc!

Unfortunately, I had to make it work in Linux. But I found a little trick :

networkEditor.setCursorPosition(hou.Vector2(0,0))
origin = QCursor.pos()

Basically putting the cursor at the origin of the networkEditor and retrieving the cursor position in Qt.
I had to do all sorts of conversions to get back on my feet, but it works

Cheers,

Julien
Edited by julien-b - Aug. 10, 2020 04:29:44
VFX Supervisor @ MPC London
User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
That's COOL! Slick idea :-)

Marc
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
  • Quick Links