Houdiniのホットキーに関する情報は、ホットキーを参照してください。
関数 ¶
ホットキー ¶
addCommand(hotkey_symbol, label, description, assignments)
→ bool
このメソッドは廃止されました。代わりにhou.hotkeys.installDefinitionsを使用してください。
設定可能な新しいホットキーコマンドをHoudiniに登録します。このホットキーコマンドが属するコンテキストは既に存在していなければなりません。hou.hotkeys.addContextを参照してください。
ホットキーシンボルは、例えば特定のツールがアクティブになった時に選択ジオメトリを削除するといったアクションを表現します。 ユーザは、ホットキーエディタからそのアクションに割り当てる実際のキーを変更することができます。 そのホットキーシンボルを登録してしまえば、後はhou.hotkeys.addAssignmentを使用することでプログラムからデフォルトキーを割り当てることができます。
demo
Pythonステートにdelete
アクションを追加するには、以下のようにします:
# "demo" Pythonステート用ホットキーコンテキストを追加します。 demo_context = "h.pane.gview.state.sop.demo" hou.hotkeys.addContext(demo_context, "demo Operation", "These keys apply to the demo operations") # この"demo"ステートにホットキーを追加します。 delete_symbol = demo_context + ".delete" hou.hotkeys.addCommand( delete_symbol, "Delete Selected", "Delete the selected geometry" ) commit_symbol = demo_context + ".commit" hou.hotkeys.addCommand( commit_symbol, "Commit Changes", "Save changes to parameters and start a new cache" ) cancel_symbol = demo_context + ".cancel" hou.hotkeys.addCommand( cancel_symbol, "Cancel Changes", "Discard any changes and return to an empty cache" )
hotkey_symbol
完全ドット付きホットキーシンボルを含んだ文字列。
label
このアクションに対して人が解読可能なタイトル。例えば、“Delete Selected”。
description
このアクションに対して人が解読可能な説明。一般的には、ここには、そのアクションのヘルプテキストから1~3文を加えます。
assignments
このコマンドのデフォルトの割り当てとして使用するショートカット文字列のオプションのリスト。
addContext(hotkey_symbol, label, long_description )
→ bool
このメソッドは廃止されました。代わりにhou.hotkeys.installDefinitionsを使用してください。
新しいホットキーコンテキストをHoudiniに登録します。 そのコンテキスト内のコンテキストまたはコマンドを作成する場合には、その前にこのコンテキストを作成してください。
現在のところ、これはホットキーをPythonステートに追加することくらいしか役に立ちません。
hotkey_symbol
コンテキストを表現した完全ドット付きホットキーシンボルを含んだ文字列。
現在のところ、hotkey_symbol
で使用できる値は以下の値のみです:
h.pane.gview.state.sop
label
このコンテキストに対して人が解読可能なタイトル。例えば、“Demo State Operation”。
description
このコンテキストに対して人が解読可能な説明。一般的には、ここには、そのコンテキストのヘルプテキストから1~3文を加えます。
removeHotkeySymbol(hotkey_symbol)
このメソッドは廃止されました。代わりにhou.hotkeys.uninstallDefinitionsを使用してください。
以前にaddCommandで作成した既存のホットキーを削除します。
hotkey_symbol
完全ドット付きホットキーシンボルを含んだ文字列。
現在のところ、これはPython SOPステートのホットキーを削除することくらいしか役に立ちません。
そのため、symbol
は以下の形式になります:
h.pane.gview.state.sop.‹state_name›.‹action_name›
hou.hotkeys.removeHotkeySymbol("h.pane.gview.state.sop.demo.delete")
installDefinitions(definitions)
Installs any command categories, commands, binding contexts and default bindings used by a plugin.
Though python states install their hotkey definitions through their
hou.ViewerStateTemplate and should not call this method, they
are still a good example of how to populate to populate a
hou.PluginHotkeyDefinitions object. For instance, for adding several
hotkey actions to the demo
python state, you would do something like this:
definitions = hou.PluginHotkeyDefinitions() # Add a command category the demo python state demo_category = "h.pane.gview.state.sop.demo" definitions.addCommandCategory(demo_category, "demo Operation", "These actions apply to the demo operation") # Add commands under the command category for the demo python state delete_symbol = demo_category + ".delete" definitions.addCommand( delete_symbol, "Delete Selected", "Delete the selected geometry" ) commit_symbol = demo_category + ".commit" definitions.addCommand( commit_symbol, "Commit Changes", "Save changes to parameters and start a new cache" ) cancel_symbol = demo_category + ".cancel" definitions.addCommand( cancel_symbol, "Cancel Changes", "Discard any changes and return to an empty cache" ) # Add a context for the demo python state to hold the state's key bindings demo_context = "h.pane.gview.state.sop.demo" definitions.addContext(demo_context, "demo Operation", "These keys apply to the demo operation") # Add any default key bindings for the commands to the context. definitions.addDefaultBinding(demo_context, delete_symbol, ("Del",)) definitions.addDefaultBinding(demo_context, commit_symbol, ()) definitions.addDefaultBinding(demo_context, cancel_symbol, ())
definitions
A populated hou.PluginHotkeyDefinitions object.
uninstallDefinitions(definitions)
Uninstalls any command categories, commands, binding contexts and default bindings used by a plugin.
definitions
A populated hou.PluginHotkeyDefinitions object that was previously used to install the definitions with hou.hotkeys.installDefinitions().
hotkeySymbol(context_label_path, command_label=None)
→ str
or None
この“逆引き”関数に人が解読可能なラベル(s)を渡すと、そのホットキーシンボルを取得することができます。 コンテキストラベルのみを渡した場合、この関数は、そのコンテキストの接頭辞シンボルを返します。 さらにコマンドラベルも渡した場合、この関数は、そのコマンドのホットキーシンボルを返します。
context_label_path
人が解読可能なコンテキストラベルの階層をスラッシュで区切った“パス”を含んだ文字列。
例えば、"/Houdini/Panes/Geometry Viewers"
。
command_label
人が解読可能なオプションのコマンドラベル。例えば、"Box Selection"
。
hou.hotkeys.hotkeySymbol("/Houdini/Panes/Geometry Viewers", "Box Selection") # "h.pane.gview.selectstylebox"
addCommandBinding(context, command)
→ bool
Adds a binding for command
in context
so that it appears in the hotkey
manager for key assignment if one does not already exist. Keys can then be
assigned to this binding via hou.hotkeys.addAssignment. It is not
necessary to do this prior to adding assignments, but if you want to create
an empty binding without any assigned keys, use this.
context
The hotkey context in which to create the binding.
command
The hotkey command to bind in the given context.
removeCommandBinding(context, command)
→ bool
Removes the binding for command
from context
. Note that in most cases
you probably want remove all key assignments from the binding, leaving the
binding itself in place. See hou.hotkeys.clearAssignments.
context
The hotkey context from which to remove the binding.
command
The hotkey command to unbind from the given context.
キーボードショートカットの割り当て ¶
addAssignment(context, hotkey_symbol, key)
→ bool
キー(またはキーの組み合わせ)を、指定されたコンテキスト内のホットキーシンボルに割り当てます。
hou.hotkeys.addAssignment("h.pane.gview.state.sop.demo", "h.pane.gview.state.sop.demo.delete", "alt+k") hou.hotkeys.addAssignment("h.pane.gview.state.sop.demo", "h.pane.gview.state.sop.demo.delete", "shift+del")
割り当てに成功すればTrue
、そのホットキーシンボルが不明またはキー文字列が無効ならFalse
を返します。
context
割り当ての追加先となるホットキーコンテキスト。
hotkey_symbol
ホットキーを割り当てたいアクションのシンボル文字列。
key
アクションに割り当てるキーを指定した文字列(またはキーの組み合わせ)。例えば、"shift+del"
。
This function also has a deprecated signature without the context argument. The deprecated signature should not be used unless use of the old hotkey system has been forced with an environment variable.
clearAssignments(context, hotkey_symbol)
→ bool
指定したコンテキスト内のホットキーシンボルに割り当てられているキーを削除します。
hou.hotkeys.clearAssignments("h.pane.gview.state.sop.demo", "h.pane.gview.state.sop.demo.delete")
context
The hotkey context in which to clear the asssignments.
hotkey_symbol
ホットキーを削除したいアクションのシンボル文字列。
This function also has a deprecated signature without the context argument. The deprecated signature should not be used unless use of the old hotkey system has been forced with an environment variable.
removeAssignment(context, hotkey_symbol, key)
→ bool
指定したコンテキスト内のホットキーシンボルからキー(またはキーの組み合わせ)を削除します。
hou.hotkeys.removeAssignment("h.pane.gview.state.sop.demo", "h.pane.gview.state.sop.demo.delete", "alt+k")
context
The target context name.
hotkey_symbol
ターゲットのホットキーシンボル名。
key
削除するキー文字列識別子。例えば、"shift+del"
。
This function also has a deprecated signature without the context argument. The deprecated signature should not be used unless use of the old hotkey system has been forced with an environment variable.
findConflicts(context, symbol, key)
→ tuple
of str
指定したkey
を使用している指定したcontext
(それ自体に渡したシンボルを含む)を基準に昇順/降順のコンテキストでシンボル文字列のシーケンスを返します。
これによって、既存の干渉または起こり得る干渉をチェックすることができます。
返される文字列は<context>?<symbol>の形式になっています。
This function also has a deprecated signature without the context argument. The deprecated signature should not be used unless use of the old hotkey system has been forced with an environment variable. Under the old hotkey system, the returned strings are simply the symbols.
干渉の例を挙げると、ハイレベルのアクション(例えば、h
コンテキスト内のh.copy
)のホットキーが⌃ Ctrl + Cで、ローレベルのアクション(例えば、h.panes.gview.state.sop.demo
コンテキスト内のh.panes.gview.state.sop.demo.duplicate
)のホットキーも⌃ Ctrl + Cだった場合、
そのローレベルの状態のときは、そのハイレベルのCopyキーは利用不可になります。その理由は、ハイレベルのキーはローレベルのキーで上書きされるからです。
# トップレベルのAdd KeyframeコマンドのKキーに対して起こり得る干渉を検索します。 symbols = hou.hotkeys.findConflicts("h", "h.add_key", "k") # これは、('h.pane.gview.state.sop.topobuild?h.pane.gview.state.sop.topobuild.bridge', 'h?h.add_key')を返します。 # つまり、Kキーが同じ階層内でh.add_keyとh.pane.gview.state.sop.topobuild.bridgeの両方に割り当てられていることを意味します。 # トップレベルのCopyコマンドのCtrl + Cに対して起こり得る干渉を検索します。 symbols = hou.hotkeys.findConflicts("h.copy", "ctrl+c") # (Macだとcmd+cを使用します) # これは、("h.copy",)を返します。つまり、干渉がありません(あなたがチェックしたシンボルは、その階層でそのキーを使用しているシンボルが1つしかありません)。
changeIndex()
→ int
ホットキーマネージャから単調に増分したインデックスを返します。 この数値は、ホットキーマネージャに変更がある度に1足されます。 あるモジュールがホットキーマネージャから何かしらの情報をキャッシュ化している場合、何か変更があればそのキャッシュを更新できるように、このchangeIndexをチェックしてください。
ホットキー情報 ¶
assignments(context, hotkey_symbol, resolve_refs=True)
→ tuple
of str
指定したコンテキスト内の指定したホットキーシンボルに割り当てられているショートカットのリストを返します。
context
ターゲットのコンテキストシンボル。
hotkey_symbol
ターゲットのホットキーシンボル名。
resolve_refs
An assignment can be a reference to another command binding. When this argument is False, the raw reference will be returned, and when True, the referenced assignments from that binding will be returned.
This function also has a deprecated signature without the context and resolve_refs arguments. The deprecated signature should not be used unless use of the old hotkey system has been forced with an environment variable.
hotkeyLabel(hotkey_symbol)
→ str
シンボル文字列の、人が解読可能なラベルを返します。
hotkey_symbol
ターゲットのホットキーシンボル名。
label = hou.hotkeys.hotkeyLabel("h.open") # "Open"
hotkeyDescription(hotkey_symbol)
→ str
指定したシンボル文字列の長い説明/ヘルプを返します。
desc = hou.hotkeys.hotkeyDescription("h.open") # "Open a file"
isKeyMatch(key, hotkey_symbol)
→ bool
指定したホットキーシンボルに対してkey
が合致すればTrue
を返します。key
がキーボードショートカット文字列の場合、ホットキーに割り当てられているキーボードショートカットのどれかに合致します。
key
がホットキーシンボルの場合、hotkey_symbol
の文字列に合致します。
key
キーボードシーケンス文字列またはホットキーシンボルのどれか。ここには通常、(例えばボタンがクリックされた時に)ホットキーが呼び出されたのか、または、単にキーシーケンスが押されたのかどうかを調べるイベント処理システムによって与えられるものを指定します。
hotkey_symbol
マッチングでチェックするホットキー。
isKeycodeMatch(key_code, hotkey_symbol)
→ bool
指定したホットキーシンボルに対してkeycode
が合致すればTrue
を返します。
key_code
キーボードイベントからのキーコード。
hotkey_symbol
マッチングでチェックするホットキー。
commandsInContext(context)
→ tuple
of dict
This method is deprecated under the new hotkey system. Use either hou.hotkeys.commandsInCategory or hou.hotkeys.commandBindingsInContext instead.
指定した親ホットキーコンテキストにおけるすべてのホットキーコマンドを返します。
各コマンドは、次のキーを持った辞書です: “symbol”, “label”, “help”。
context
コンテキストのホットキーシンボル。
contextsInContext(context)
→ tuple
of dict
指定した親ホットキーコンテキストにおけるすべてのホットキーコンテキストを返します。
各コマンドは、次のキーを持った辞書です: “symbol”, “label”, “help”。
context
このコンテキストのホットキーシンボル。
commandCategoriesInCategory(category)
→ tuple
of dict
Return all hotkey command categories under the given parent hotkey category.
Each category is a dict with the following keys: “symbol”, “label”, and “help”.
category
The symbol of the command category.
commandsInCategory(category)
→ tuple
of dict
Return all hotkey commands under the given parent category.
Each command is a dict with the following keys: “symbol”, “label”, and “help”.
category
The symbol of the command category.
commandBindingsInContext(context)
→ tuple
of dict
Return all commands bound in the given hotkey context.
Each command is a dict with the following keys: “symbol”, “label”, and “help”.
context
The hotkey symbol of the context.
Backup / Restore / Save ¶
revertToDefaults(context, hotkey_symbol, one_level_only)
キーマップから、指定したホットキーをデフォルトに戻します。
hotkey_symbol
リセットするホットキーコマンドシンボル。 If using the deprecated signature without the context argument, this can also be a hotkey context symbol, otherwise a value of None or an empty string to revert all the bindings in the context.
one_level_only
False
の時、このアイテムとその子アイテムすべてがデフォルトに設定されます。
True
の時、このコンテキストまたはコマンドのみがリセットされます。
コマンドに何も子コマンドがなければ、これはコンテキストにのみ効果があります。
This function also has a deprecated signature without the context argument. The deprecated signature should not be used unless use of the old hotkey system has been forced with an environment variable.
saveOverrides()
→ bool
ホットキーへの変更を現行キーマップのオーバーライドとして保存します。
この変更とは、例えばショートカットキーの割り当ての変更といったデフォルトからの変更のことを指します。
addHotkey
を使って新しくホットキーコマンドを追加すると、それが新しいデフォルトとして扱われるので、
そのホットキーコマンドを追加した後に何か変更を加えない限りは、その変更が保存されないので注意してください。
キーマップ ¶
saveAsKeymap(name, path=None)
→ bool
現在定義されているホットキーをキーマップとして保存します。
これは、読み込んだキーマップと定義されたオーバーライドすべてを1つの新しいキーマップに結合します。
保存に成功するとTrue
を返します。
name
新しいキーマップの名前。
path
新しいキーマップのオプションの保存パス。 Noneの場合、その新しいキーマップは、ユーザプリファレンスディレクトリ下にキーマップ名から派生したファイル名で保存されます。
loadKeymap(name, path=None)
→ bool
現在定義されているホットキーをキーマップとして読み込みます。
これは、読み込んだキーマップと定義されたオーバーライドすべてを1つの新しいキーマップに結合します。
読み込みに成功するとTrue
を返します。
name
読み込むキーマップの名前。
path
読み込むキーマップのオプションのパス。 Noneの場合、そのキーマップは検索パスで検索されます。
importKeymap(name, path=None)
→ bool
指定したキーマップをユーザプリファレンスディレクトリにコピーし、それを適切な名前で保存します。
インポートに成功するとTrue
を返します。
name
キーマップの新しい名前。
path
インポートするキーマップのパス。
keymaps()
→ tuple
or str
見つかったキーマップすべてのタプルのリストを返します。このタプルには、キーマップの名前とそのパスが入っています。
currentKeymap()
→ str
現在読み込まれているキーマップの名前を返します。
キー情報 ¶
availableKeycodes(context, hotkey_symbol, layout_keys, modifiers=0)
→ tuple
of int
指定したホットキーシンボルに関連した干渉状態のビットセットを使って、利用可能なショートカットキーコードすべてを返します。 そのキーコードが指定したコンテキスト内の他のホットキーに割り当てられていなければ、そのキーコードが利用可能であると判断されます。
context
利用可能かどうかをチェックするコンテキスト。
hotkey_symbol
ターゲットのホットキーシンボル名。
layout_keys
チェックする無修飾キーコードのリスト。 空っぽの場合、標準のUSキーボードの無修飾キーコードがチェックされます。
modifiers
適用するUI_KeyBindings修飾キービット。これらの修飾キービットを持ったキーコードのみが返されます。
This function also has a deprecated signature without the context argument. The deprecated signature should not be used unless use of the old hotkey system has been forced with an environment variable.
stringToKeycode(key, modifiers=0)
→ int
キー文字列をホットキーマネージャのキーコードに変換します。
modifiers
適用するUI_KeyBindings修飾キービット。
keycodeToString(keycode, modifiers=0)
→ str
ホットキーマネージャのキーコードをキー文字列に変換します。
modifiers
適用するUI_KeyBindings修飾キービット。
resolveAssignments(contexts, hotkey_symbols)
→ tuple
of tuple
of str
Return a tuple of strings that represent the hotkeys that will invoke each
action from a tuple of hotkey symbols when resolved against a specific
list of hotkey contexts. The key strings are of the form returned by the
hou.ui.hotkeys method, which is a combination of the symbol on the
key, and any modifier keys involved, such as "Ctrl+Shift+G"
.