Jump to content
static

Getting the current active network editor pane

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

A stub exists for hou.ui.paneTabUnderMouse(), but it's not implemented. RFE submitted. :)

Share this post


Link to post
Share on other sites
Posted (edited)

HI,

hou.ui.paneTabUnderMouse()

Has it got in H16 ?

 

THX

Edited by gemini

Share this post


Link to post
Share on other sites
On 4/17/2018 at 3:39 PM, gemini said:

HI,

hou.ui.paneTabUnderMouse()

Has it got in H16 ?

In 16.5 this is implemented.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×