移動先: 概要 戻り値 関連項目. フラグ. Python 例.

概要

assignInputDevice([clutch=string], [continuous=boolean], [device=string], [immediate=boolean], [multiple=boolean])

注意: オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。

assignInputDevice は 「元に戻す」が可能、「照会」が可能、「編集」が不可能 です。

このコマンドは、コマンド文字列(すなわち MEL スクリプト)を入力デバイスに関連付けます。デバイスが移動するかデバイスのボタンが押されると、あたかもコマンドをウィンドウに入力したかのようにコマンド文字列が実行されます。コマンド文字列がボタンの名前またはデバイスの軸を含む場合、これらのボタン/軸のカレント値が代入されます。ボタンの値は boolean、軸の値は double として通知されます。

このコマンドは、デバイスのボタンをコマンドに関連付けるのに大変便利です。連続的な動きをキャプチャするデバイスを使うには、ディペンデンシー グラフに直接デバイスをアタッチするのがより効果的です。

戻り値

string

戻り値の型は照会モードでは照会フラグが基になります。

関連項目

attachDeviceAttr, detachDeviceAttr, devicePanel, getInputDeviceRange, getModifiers, listDeviceAttachments, listInputDeviceAxes, listInputDeviceButtons, listInputDevices, recordAttr, setAttrMapping, setInputDeviceMapping, unassignInputDevice

フラグ

clutch, continuous, device, immediate, multiple
ロング ネーム(ショート ネーム) 引数型 プロパティ
device(d) string
コマンド文字列を割り当てるデバイスを指定します。
clutch(c) string
クラッチ ボタンを指定します。コマンド文字列を実行するためには、このボタンが押されている必要があります。 クラッチが指定されていない場合、デバイスの状態が変化する度にコマンド文字列が実行されます。
multiple(m) boolean
このフラグが設定されている場合、このデバイスに関連付けられている他のコマンド文字列は削除できません。 デフォルトでは、新規コマンド文字列がデバイスにアタッチされるときは、他のコマンド文字列はすべて削除されます。
continuous(ct) boolean
このフラグが設定されている場合、コマンド文字列は連続的に実行されます(デバイスの状態が変化するごとに一度)。デフォルトでは、クラッチ ボタンが指定されている場合、コマンド文字列はボタンが押されたときに一度だけ実行されます。
immediate(im) boolean
待ち行列を使わずに即座にコマンドを実行します。

: コマンドの作成モードで使用可能なフラグ : コマンドの編集モードで使用可能なフラグ
: コマンドの照会モードで使用可能なフラグ : タプルまたはリストとして渡された複数の引数を持てるフラグ

Python 例

import maya.cmds as cmds

cmds.assignInputDevice( 'setKeyframe', d='spaceball', c='Button1' )

# This command will assign button1 on the spaceball with
# the setKeyframe command.  This is very much like using
# the spaceball buttons as hotkeys.

cmds.assignInputDevice( '"currentTime -e Axis0"', d='midi', ct=True, m=True )

# This command will execute the command to set the time
# to the value of the first midi slider.  As the slider
# moves this command will be executed.  So the slider
# will control time.