get current viewport name

   6354   4   1
User Avatar
Member
678 posts
Joined: July 2005
Offline
Hi

I would like to get the current viewport name
is there any hscript or python function that do the job?
I looked in the help but could not find anything

regards
User Avatar
Member
1906 posts
Joined: Nov. 2006
Online
There are 2 similar ways of doing thing using python.

If you are trying to do it from a shelf context you can take advantage of the
'activepane' key in kwargs.

import toolutils
# This should return a hou.SceneViewer object if you have a viewport showing.
activepane = toolutils.activePane(kwargs)
name = activepane.name()


You can also do import toolutils
viewer = toolutils.sceneViewer()
name = viewer.name()


If you don't see something in the help, chances are there is an example of something happening in the scripts located in $HH/scripts/python/
toolutils.py in particular can be very useful for seeing examples of certain
things and how the tools are implemented.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
509 posts
Joined: July 2005
Offline
heya,

I'm working on a simple script here that would be a shelf tool.
I'm trying to figure out what type of node I'm supposed to grab from, let's say, the $HOUDINI_TEMP_DIR copied buffer.

I tried different approaches, all of which sort of failed eventually and now I'm into this one, getting the active pane and go from there.

problem is that if I create a shelf tool with the following code:

import toolutils

activepane = toolutils.activePane(kwargs)
name = activepane.name()

print name


If I have the script window opened I always get

<hou.Pane 5>

when if I close it (and have no floating panes) I get

panetab1



… no matter where my mouse has clicked last.. what am I doing wrong?
how can I get the network pane of the last mouse click?

(or what could be another approach)

Thanks!
JcN
VisualCortexLab Ltd :: www.visualcortexlab.com
User Avatar
Member
509 posts
Joined: July 2005
Offline

toolutils.sceneViewer().pwd()

seems to give me a result closer to what I'd need …




but I'm still open to suggestions

thankie!
JcN
VisualCortexLab Ltd :: www.visualcortexlab.com
User Avatar
Member
509 posts
Joined: July 2005
Offline
sum][one

toolutils.sceneViewer().pwd()

seems to give me a result closer to what I'd need …




but I'm still open to suggestions

thankie!

scrap that. it does give me some output, but somehow is not related to what's in the network I'm using .. changing context of such pane doesn't change the output of that code..

i'm stuck again
JcN
VisualCortexLab Ltd :: www.visualcortexlab.com
  • Quick Links