Jump to content

Getting the current active network editor pane


static

Recommended Posts

Say I have a node, and on that node exists a button that cds to a different network. Usually this wouldn't be a problem, but I sometimes have more than one Network Editor pane open in my session. This can create complications, especially if for some reason, multiple panes are pointing to the same network (why, I don't know, but it happens). I just want to ensure that I'm jumping to the new network in the same network editor. With that being said, is there a way to get a node's paneTab object without relying on matching?

here's an example of what I don't want to do:

def getNetworkEditorPane(mynode):
    parent = mynode.parent()
    networkEditors = [x for x in hou.ui.paneTabs() if x.type() == hou.paneTabType.NetworkEditor]

    for net in networkEditors:
        if net.pwd() == parent:
            return net

    return None

Sorry in advance for any syntax errors, I just threw this together off the top of my head. It should make sense though.

Edited by static
Link to comment
Share on other sites

There isn't a specific way since as you know you can have 2 editors pointing to the same path and there is really no "active" pane when 2 are displayed. Depending on how you have those 2 editors set up you can do something though. If you have the 2 editors as tabs in the same pane so that you can only have one displayed at a time then it's more straightforward.

def getCurrentNetworkEditorPane():
    editors = [pane for pane in hou.ui.paneTabs() if isinstance(pane, hou.NetworkEditor) and pane.isCurrentTab()]
    return editors[-1]

This method searches for any editors that are the current (displayed) tabs. Since if they are both part of one pane then only one can be current.

However, if you have 2 editors that are both displayed in different panes at the same network path then there isn't really anything you can do but something like the above but add in another layer of filtering and try and choose the one that is in a specific pane over the other one.

  • Thanks 1
Link to comment
Share on other sites

However, if you have 2 editors that are both displayed in different panes at the same network path then there isn't really anything you can do but something like the above but add in another layer of filtering and try and choose the one that is in a specific pane over the other one.

Heh, unfortunately that is the case :P

The info is helpful though. I didn't think about hou.PaneTab.isCurrentTab(). That will be able to help me at least narrow it down to visible editors. Cheers.

Link to comment
Share on other sites

Actually, if I were able to determine the pane that my mouse was over (since houdini is context sensitive to panes), that would solve the problem. I don't think that functionality has been promoted for their python implementation though. Methinks an email to SESI is in order.

Link to comment
Share on other sites

  • 7 years later...
  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...