| Inheritance |
|
このクラスには、コンポジットシェルフツール、COPのステートとハンドルに対応するのに必要なメソッドが備わっています。
現在のところ、UIで利用可能なほとんどの機能をプログラムで制御することができません。
それが目的であれば、cop2toolutilsモジュール内の関数の方が役に立ちます。
メソッド ¶
currentState()
→ str
ビュー内で現在使用されているツールの名前を返します。 これは、内部の公開されていない名前ですが、通常ではノードの名前に該当します。setCurrentStateを使用することで別のツールに変更することができます。
enterViewState(wait_for_exit=False)
ビューツールに切り替えます。
setCurrentState(state, wait_for_exit=False)
ビュー内の現在アクティブなツールを設定します。stateは、内部の公開されていない名前を含んだ文字列です。currentState()を参照してください。
runStateCommand(name, args=None)
Executes a command implemented by the active python state. A state command can be invoked by specifying a name identifier along with arguments.
An exception is thrown if the state is not a Python state type or the state is not running.
name
The command name identifier.
args
The command arguments. args can be any Python type, including built-in types, containers, sets, or dictionaries. A dictionary is commonly used to pass arguments to a
command, as it simplifies the command’s implementation and allows output values to be returned by the command. args defaults to None is omitted.
An implementation example of a COP state command.
import hou import viewerstate.utils as su class State(object): def __init__(self, state_name, viewer): self.state_name = state_name self.scene_viewer = viewer def onCommand( self, kwargs ): name = kwargs['command'] args = kwargs['command_args'] if name == "myCOPCommand"': self.log(f"{name}({args})") def createViewerStateTemplate(): """ Mandatory entry point to create and return the viewer state template to register. """ state_typename = "mycopstate" state_label = "My COP State" state_cat = hou.copNodeTypeCategory() template = hou.ViewerStateTemplate(state_typename, state_label, state_cat) template.bindFactory(State) template.bindIcon("MISC_python") return template
Here’s how to invoke the command.
import viewerstate.utils as ut v = ut.findCompositorViewer() v.runStateCommand("myCOPCommand", {"arg0":0, "arg1":[1,2,3]})
curViewport()
→ hou.Viewport2D
Returns this viewer’s current viewport. The current viewport is the one containing the mouse cursor.
showHandle(name, value)
Shows or hides a display handle linked to the current tool state. This API is typically used with Python states and can be
called from any python state callbacks. Avoid calling showHandle from the python state constructor, because this leads to a runtime error.
See also hou.Handle.show.
name
The name of the handle as specified with hou.ViewerStateTemplate.bindHandle or the name or a built-in Houdini handle.
value
Bool value, True to show the handle, False to hide it.
bindViewerHandle(handle_type, name, settings=None, cache_previous_parms=False, handle_parms=None)
Binds a dynamic viewer handle to the current viewer state similarly to hou.ViewerStateTemplate.bindHandle. Unlike bindHandle though, this method creates and
initializes the handle in a dynamic fashion so there is no need to register in advance the handle with the viewer state. You can call bindViewerHandle
from almost anywhere in Houdini (from the viewer state handlers, from a python script, etc…), but it can only be called while the viewer state is running.
To remove the viewer handles added with bindViewerHandle, use hou.SceneViewer.unbindViewerHandle. Houdini will take care of removing automatically all viewer
handles added with bindViewerHandle when the state exits.
This method works only with python states, an exception is raised if the state is not a python state.
handle_type
ハンドルタイプの名前の文字列。 選択できるハンドルタイプのリストは、ステートのハンドルタイプを参照してください。
name
ハンドルの識別に使用する文字列。各バインドの名前は、 このステート内 では必ず固有にしてください。2回以上同じ名前のバインドを試すと例外が発生します。
settings
ハンドル固有の設定を含んだ文字列。複数の設定は、スペースで区切って指定してください。
cache_previous_parms
Trueの場合、そのハンドルが以前の値の記録を維持します。これは、例えばユーザがハンドルをドラッグした速さを調べるためにユーザがハンドルを動かした時の差分を計算するコードを記述する場合に便利です。
handle_parms
有効にしたいパラメータが指定されたハンドルパラメータ名の配列。
この配列に含まれているパラメータのみがPythonステートコールバックで利用可能になります。
handle_parmsが空っぽ(デフォルト)の時は、すべてのハンドルパラメータが有効になります。
bindViewerHandleStatic(handle_type, name, bindings, settings=None)
Binds a static viewer handle to the current viewer state similarly to hou.ViewerStateTemplate.bindHandleStatic. Unlike bindHandleStatic though, this method creates and
initializes the handle in a dynamic fashion so there is no need to register in advance the handle with the viewer state. You can call bindViewerHandleStatic
from almost anywhere in Houdini (from the viewer state handlers, from a python script, etc…), but it can only be called while the viewer state is running.
To remove the viewer handles added with bindViewerHandleStatic, use hou.SceneViewer.unbindViewerHandle. Houdini will take care of removing automatically all viewer
handles added with bindViewerHandleStatic when the state exits.
This method works only with python states, an exception is raised if the state is not a python state.
handle_type
ハンドルタイプの名前の文字列。
name
ハンドルの識別に使用する固有の文字列。各バインドの名前は、 このステート内 では必ず固有にしてください。2回以上同じ名前のバインドを試すと例外が発生します。
bindings
("node_parm_name", "handle_parm_name")タプルのリスト。これは、ハンドルの一部をノードの個々のパラメータにバインドします。
settings
ハンドル固有の設定を含んだ文字列。複数の設定は、スペースで区切って指定してください。
unbindViewerHandle(name)
Removes a viewer handle from the current python state. unbindViewerHandle can only unbind the viewer handles that were dynamically added with hou.SceneViewer.bindViewerHandle or
hou.SceneViewer.bindViewerHandleStatic. An exception is raised if the viewer handle to unbind is a state registered viewer handle.
This method works only with python states, an exception is raised if the state is not a python state.
name
The viewer handle name to unbind. This is the name used when binding the handle with bindViewerHandle or bindViewerHandleStatic.
hudInfo(show=-1, state=None, template=None, values=None, panel=hou.hudPanel.ToolInfo, terminate=False, update_hotkey_bindings=False)
Not implemented.
clearPromptMessage()
Not implemented.
setPromptMessage(msg, msg_type = None)
Not implemented.
selectDrawableGeometry(drawable_selection, selection_modifier=None)
Not implemented.
beginStateUndo(label)
Not implemented.
endStateUndo()
Not implemented.
カラー補正 ¶
これらの関数は、ビューアのOpenColorIO設定を設定または照会します(OpenColorIO対応を参照)。
usingOCIO()
→ bool
ビューアのカラー補正にOpenColorIOが使用されているかどうかを照会します。
setUsingOCIO(enable)
ビューアのカラー補正でOpenColorIOを有効または無効にします。
setOCIODisplayView(display="", view="")
OpenColorIOの表示名、ビュー名、または両方を設定します。 表示とビューはどちらもビューアの出力カラー空間を定義し、任意の数のカラー変換(Looks)が線形ビューポート画像に対して実行されます。
getOCIODisplay()
→ str
カラー補正で使用されている現在のOpenColorIO表示を返します。
getOCIOView()
→ str
カラー補正で使用されている現在のOpenColorIOビューを返します。
Methods from hou.PaneTab ¶
name()
→ str
このタブの名前を返します。
setName(name)
このペインタブの名前を設定します。ペインタブの名前にはスペースを含めることができます。
この名前は、そのタブの内部名で、インターフェースで表示される名前とは異なることに注意してください。
type()
→ hou.paneTabType列挙値
このタブのタイプ(つまり、scene viewer, parameter editor, network editorなど)を返します。
setType(type)
→ hou.PaneTab
指定したタイプの新しいペインタブを作成し、このタブをその新しいタブに置換し、その新しいペインタブを返します。 このタブの参照が無効になるので、それ以降は、返されたペインタブを使用してください。
close()
ペインタブを閉じます。
pane()
→ hou.Pane or None
このペインタブを含んだデスクトップ内のペインを返します。 通常のフローティングパネルには1個以上のペインを含むので、通常のフローティングパネル内のペインタブは、常にペイン内にあります。
とはいえ、いくつかのフローティングパネルでは、特定のペインタブタイプだけを含むように、それ以外の内容が取り除かれており、 複数のペインタブを追加したり、ペインを分割するといったユーザインターフェースを表示しません。 このメソッドは、そのような余計なものが取り除かれたパネルに対してはNoneを返します。
floatingPanel()
→ hou.FloatingPanel or None
このペインタブが含まれたフローティングパネルを返します。このペインタブがフローティングパネル内になければNoneを返します。
isCurrentTab()
→ bool
このタブが、それが含まれているペイン内で選択されたタブかどうか返します。
setIsCurrentTab()
このタブを、それが含まれているペイン内で選択されたタブとして設定します。
isFloating()
→ bool
このペインタブがフローティングパネル内にあるかどうか返します。
このメソッドはほぼ以下のように実装されています:
def isFloating(self): return self.pane() is None or self.pane().floatingPanel() is not None
clone()
→ hou.PaneTab
ペインタブから複製されたフローティングパネルを作成し、そのクローンペインタブを返します。 その新しいペインタブは、新しいフローティングパネル内にあります。
linkGroup()
→ hou.paneLinkType列挙値
このペインタブが属するリンクグループを返します。
hou.PaneTab.isPinも参照してください。
setLinkGroup(group)
このペインタブのリンクグループメンバーシップを設定します。
isPin()
→ bool
このペインタブがピン留めされているかどうか返します。このメソッドは、(self.linkGroup() == hou.paneLinkType.Pinned)と等価です。
hou.PaneTab.linkGroupも参照してください。
setPin(pin)
pinがTrueなら、リンクグループメンバーシップをhou.paneLinkType.Pinnedに設定します。
それ以外の場合、それをhou.paneLinkType.FollowSelectionに設定します。
このメソッドは、以下のようにhou.PaneTab.setLinkGroupを使用して実装することができます:
def setPin(self, pin): if pin: self.setLinkGroup(hou.paneLinkType.Pinned) else: self.setLinkGroup(hou.paneLinkType.FollowSelection)
hou.PaneTab.setLinkGroupも参照してください。
size()
→ tuple
of int
ペインタブの幅と高さを含んだ2タプルを返します。
この幅と高さは、その中身の領域、(もしあれば)ネットワークナビゲーションコントロールの領域、境界を含みます。
この幅と高さは、ペインタブのタブ領域を含みません。
contentSize()
→ tuple
of int
ペインタブの中身の領域の幅と高さを含んだ2タプルを返します。
この幅と高さは、(もしあれば)ネットワークナビゲーションコントロールの領域、ペインタブの境界、ペインタブの領域を含みません。
hasNetworkControls()
→ bool
このペインタブタイプがネットワークコントロールに対応していればTrueを返します。
isShowingNetworkControls()
→ bool
このペインタブがネットワークコントロールバーを表示しているかどうかを返します。 ペインタブがネットワークコントロールを持っていない場合はFalseを返します。 hou.PaneTab.hasNetworkControlsも参照してください。
setShowNetworkControls(pin)
ネットワークコントロールバーを表示/非表示します。 ペインタブがネットワークコントロールを持っていない場合は何の効果もありません。 hou.PaneTab.hasNetworkControlsも参照してください。
このメソッドは廃止されました。代わりにshowNetworkControlsを使用してください。
showNetworkControls(pin)
ネットワークコントロールバーを表示/非表示します。 ペインタブにネットワークコントロールがない場合は何の効果もありません。 hou.PaneTab.hasNetworkControlsも参照してください。
displayRadialMenu(menu)
指定したRadialメニューをペインタブ内で起動します。
qtParentWindow()
→ QWidget
このペインタブを含んだウィンドウを表現したPySide6.QtWidgets.QWidgetインスタンスを返します。
qtScreenGeometry()
→ QRect
このペインタブのジオメトリをPySide6.QtCore.QRectオブジェクトとして返します。
返されるQRectオブジェクトのxとyのプロパティは、スクリーン座標におけるこのペインタブの左上コーナーを指します。
Methods from hou.PathBasedPaneTab ¶
cd(path)
currentNode()
→ Node
pwd()
→ Node
setCurrentNode(node, pick_node = True)
setPwd(node)