magneto Posted December 21, 2012 Share Posted December 21, 2012 Hi, I want to know if the current context in the network editor is SOP, or VEX, or DOPs, etc. I could get the type from hou.selectedNodes, but a selection has to exist and this seems a little indirect. Is this the only way, or is there some other way to get the current context in Houdini? Thanks Quote Link to comment Share on other sites More sharing options...
graham Posted December 21, 2012 Share Posted December 21, 2012 You can get it by asking the pane tab for it's current location, then getting the child type category for that. For example, panetab15 is a network editor tab at /obj. >>> hou.ui.findPaneTab('panetab15') <hou.NetworkEditor panetab15> >>>hou.ui.findPaneTab('panetab15').pwd() <hou.Node at /obj> >>> hou.ui.findPaneTab('panetab15').pwd().childTypeCategory() <hou.NodeTypeCategory for Object> # Now inside a geo object (/obj/geo1) >>> hou.ui.findPaneTab('panetab15').pwd() <hou.ObjNode of type geo at /obj/geo1> >>> hou.ui.findPaneTab('panetab15').pwd().childTypeCategory() <hou.NodeTypeCategory for Sop> 2 Quote Link to comment Share on other sites More sharing options...
magneto Posted December 21, 2012 Author Share Posted December 21, 2012 Thanks alot Graham, this will work great Last question: Do you know if there is a way to query the mouse position? I want to drop a new node where the cursor is over the network editor so this is the final bit I have to figure out. Thanks again. Quote Link to comment Share on other sites More sharing options...
graham Posted December 21, 2012 Share Posted December 21, 2012 You can use hou.NetworkEditor.selectPosition() There's some usage examples in $HH/python2.6libs/toolutils.py 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted December 21, 2012 Author Share Posted December 21, 2012 Thanks alot Graham, you rock Quote Link to comment Share on other sites More sharing options...
magneto Posted December 21, 2012 Author Share Posted December 21, 2012 (edited) Hi Graham, I looked at the pane.selectPosition and it returns a position like you said, after you click somewhere in the network editor. Would there be a way to force or cancel this mode so I don't have to click? Because otherwise it attaches the node to my pointer, but I just want to passively query the position. That's why I thought maybe there is a way to force dropping the node to get the current position. I will keep digging. Thanks again I found out that it's possible by using ctypes which is what I ended up doing for people who want to know Edited December 22, 2012 by magneto Quote Link to comment Share on other sites More sharing options...
goldleaf Posted July 9, 2015 Share Posted July 9, 2015 I found out that it's possible by using ctypes which is what I ended up doing for people who want to know Hey Ryan, are you able to share an example of how you did this? Thanks! Quote Link to comment Share on other sites More sharing options...
magneto Posted July 11, 2015 Author Share Posted July 11, 2015 Hey Ryan, are you able to share an example of how you did this? Thanks! Hey man, I stopped using ctypes long ago and now do it this way: pane = kwargs['pane'] contextname = pane.pwd().childTypeCategory().name() 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.