移動先: 概要 戻り値 フラグ. Python 例.
draggerContext(
[name]
, [anchorPoint=[float, float, float]], [button=int], [currentStep=int], [cursor=string], [dragCommand=script], [dragPoint=[float, float, float]], [drawString=string], [exists=boolean], [finalize=script], [history=boolean], [holdCommand=script], [image1=string], [image2=string], [image3=string], [initialize=script], [modifier=string], [name=string], [plane=[float, float, float]], [prePressCommand=script], [pressCommand=script], [projection=string], [releaseCommand=script], [snapping=boolean], [space=string], [stepsCount=int], [undoMode=string])
注意: オブジェクト名や引数を表す文字列はカンマで区切ります。これは概要には示されていません。
draggerContext は 「元に戻す」が可能、「照会」が可能、「編集」が可能 です。
draggerContext を使用すると、マウスかマウスと同等のドラッグ デバイスの動作を MEL でプログラミングできます。
戻り値の型は照会モードでは照会フラグが基になります。
anchorPoint, button, currentStep, cursor, dragCommand, dragPoint, drawString, exists, finalize, history, holdCommand, image1, image2, image3, initialize, modifier, name, plane, prePressCommand, pressCommand, projection, releaseCommand, snapping, space, stepsCount, undoMode
ロング ネーム(ショート ネーム) |
引数型 |
プロパティ |
exists(ex)
|
boolean
|
|
|
指定したオブジェクトが存在するかどうかによって、true または false を返します。他のフラグは無視されます。
|
|
image1(i1)
|
string
|
 
|
|
image2(i2)
|
string
|
 
|
|
image3(i3)
|
string
|
 
|
|
コンテキストは、コンテキストに関連付けられている
ツールを表すアイコンを 3 つまでサポートします。
|
|
history(ch)
|
boolean
|
|
|
ツール コマンドの場合、対象となるツールの
コンストラクション ヒストリをオンにします。
|
|
name(n)
|
string
|
|
|
これがツール コマンドの場合、ツールに適切に名前を付けます。
|
|
initialize(inz)
|
script
|
 
|
|
finalize(fnz)
|
script
|
 
|
|
prePressCommand(ppc)
|
script
|
 
|
|
マウス ドラッガを押した場合に呼び出されるコマンドです。以前は、コンテキストの初期化に使用できるように、pressCommand という名前になっていました。
|
|
pressCommand(pc)
|
script
|
 
|
|
マウス ドラッガを押した場合に呼び出されるコマンドです。
|
|
dragCommand(dc)
|
script
|
 
|
|
マウス ドラッガをドラッグした場合に呼び出されるコマンド。
|
|
releaseCommand(rc)
|
script
|
 
|
|
マウス ドラッガを放した場合に呼び出されるコマンド。
|
|
holdCommand(hc)
|
script
|
 
|
|
マウス ドラッガを押したままの状態にした場合に呼び出されるコマンド。
|
|
anchorPoint(ap)
|
[float, float, float]
|
|
|
ドラッガが最初に押された場所を表すアンカー ポイント(double 配列)。
|
|
dragPoint(dp)
|
[float, float, float]
|
|
|
ドラッグ中のドラッガの現在位置を表すドラッグ ポイント(double 配列)。
|
|
projection(pr)
|
string
|
 
|
|
ドラッグ ポイントの現在の投影が設定されます。有効なタイプは以下のとおりです。
viewPlane |
(ビュー プレーンに投影) |
objectViewPlane |
((ビュー プレーンと平行な)オブジェクト プレーンに投影) |
objectPlane |
(オブジェクトの位置と法線(デフォルト)0,1,0 で定義した指定プレーンに投影) |
plane |
(原点と法線(デフォルト)0,1,0 で定義した指定プレーンに投影) |
sketchPlane |
(スケッチ プレーンに投影) |
xAxis |
(X 軸上の最近接ポイントに投影) |
yAxis |
(Y 軸上の最近接ポイントに投影) |
zAxis |
(Z 軸上の最近接ポイントに投影) |
boundingSphere |
(オブジェクト球体の境界上の最近接ポイントに投影) |
boundingBox
|
(オブジェクト バウンディング ボックス上の最近接ポイントに投影) |
|
|
plane(pl)
|
[float, float, float]
|

|
|
投影プレーンの法線を指定します(詳細については、-projection フラグを参照)。
|
|
space(sp)
|
string
|
 
|
|
座標が報告される現在の空間が設定されます。タイプは以下のとおりです。
world
|
ワールド空間(グローバル) |
object
|
オブジェクト空間(ローカル) |
screen |
スクリーンのスペース |
|
|
modifier(mo)
|
string
|
|
|
現在のモディファイア タイプ、「ctrl」、「alt」、または「none」です。
|
|
button(bu)
|
int
|
|
|
カレント マウス ボタン(1、2、3)を返します。
|
|
cursor(cur)
|
string
|
 
|
|
コンテキストがアクティブな間に表示されるカーソル。有効な値は、「default」、「hand」、「crossHair」、「dolly」、「track」、「tumble」です。
|
|
drawString(ds)
|
string
|

|
|
undoMode(um)
|
string
|
 
|
|
コンテキスト動作の元に戻す待ち行列モード。
許容可能な値は、
- 「all」- デフォルト動作で、ドラッガ コンテキスト動作時に発生するすべてのアクションが個々の元に戻すチャンクとして記録されます。
- 「step」- それぞれのプレスとリリースの間に行われたすべてのアクションが、単一の元に戻すチャンクに結合されます。
- 「sequence」- 最初のプレスと最後のリリースの間に行われたすべてのアクションが、単一の元に戻すチャンクに結合されます。これは、単一ステップ ドラッガ コンテキストの「 ステップ」とまったく同じように機能します。
|
|
stepsCount(sc)
|
int
|
 
|
|
ドラッガ コンテキストのステップ数(プレス - ドラッグ - リリース シーケンス)。
undoMode フラグと組み合わせると、複数のステップが単一の元に戻すアクションとして記録される可能性があります。
|
|
snapping(snp)
|
boolean
|
 
|
|
ドラッガ コンテキストのスナップを有効化/無効化します。
|
|
currentStep(cs)
|
int
|
|
|
ドラッガ コンテキストの現在のステップ(プレス - ドラッグ - リリース シーケンス)。
最初のプレス イベントの実行前に照会すると、0 が返されます。
|
|
: コマンドの作成モードで使用可能なフラグ
|
: コマンドの編集モードで使用可能なフラグ
|
: コマンドの照会モードで使用可能なフラグ
|
: タプルまたはリストとして渡された複数の引数を持てるフラグ
|
import maya.cmds as cmds
# Procedure called on press
def SampleContextPress():
pressPosition = cmds.draggerContext( 'sampleContext', query=True, anchorPoint=True)
print ("Press: " + str(pressPosition))
# Procedure called on drag
def SampleContextDrag():
dragPosition = cmds.draggerContext( 'sampleContext', query=True, dragPoint=True)
button = cmds.draggerContext( 'sampleContext', query=True, button=True)
modifier = cmds.draggerContext( 'sampleContext', query=True, modifier=True)
print ("Drag: " + str(dragPosition) + " Button is " + str(button) + " Modifier is " + modifier + "\n")
message = str(dragPosition[0]) + ", " + str(dragPosition[1])
cmds.draggerContext( 'sampleContext', edit=True, drawString=message)
# Define draggerContext with press and drag procedures
cmds.draggerContext( 'sampleContext', pressCommand='SampleContextPress()', dragCommand='SampleContextDrag()', cursor='hand' );
# Set the tool to the sample context created
# Results can be observed by dragging mouse around main window
cmds.setToolTo('sampleContext')