ジャンプ先: 概要. 戻り値. キーワード. Python 例.
hitTest(stringintint)
注: オブジェクトの名前と引数を表す文字列は、カンマで区切る必要があります。これはシノプシスに示されていません。
hitTest は、取り消し不可能、照会不可能、および編集不可能です。
hitTest コマンドは、指定したコントロール内のポイントをヒット テストし、ポイントの下にある項目のリストを返します。ポイントは左上隅を原点(0,0)とし、ピクセルで指定されます。この位置は、ドロップ コールバックの座標と互換性があります。返される項目のタイプは、特定のコントロールに依存します。現在、ヒット テストはすべてのコントロールによってサポートされていません。| string[] | ヒット ポイントの下の項目 |
import maya.cmds as cmds # Let's say that you have the name of a model editor that was # created elsewhere. # editor = "MyModelEditor" # Here's your drop callback: # def myModelEditorDropCallback( dragControl, dropControl, msgs, x, y, type ): # Inside the callback we can hit-test the (x,y) drop-point # against the control. This will return a list of DAG objects # underneath the drop-point. # objects = cmds.hitTest( dropControl, x, y ) if len( objects ): # The hit-test returned something. You can now do something # with these objects. pass # # Attach a drop callback to this model editor. # try: control = cmds.editor( editor ,query=True, control=True ) if cmds.control( control, exists=True ): cmds.control( control, edit=True, dropCallback=myModelEditorDropCallback ) except RuntimeError: pass