ジャンプ先: 概要. 戻り値. キーワード. 関連. フラグ. Python 例.
hudSlider([string], [allowOverlap=boolean], [block=int], [blockAlignment=string], [blockSize=string], [decimalPrecision=int], [dragCommand=script], [internalPadding=int], [label=string], [labelFontSize=string], [labelWidth=int], [maxValue=float], [minValue=float], [padding=int], [pressCommand=script], [releaseCommand=script], [section=int], [sliderIncrement=float], [sliderLength=int], [type=string], [value=float], [valueAlignment=string], [valueFontSize=string], [valueWidth=int], [visible=boolean])
注: オブジェクトの名前と引数を表す文字列は、カンマで区切る必要があります。これはシノプシスに示されていません。
hudSlider は、取り消し不可能、照会可能、および編集可能です。
このコマンドは、3D ビューポート上にある 2D の非アクティブ オーバーレイ プレーンに配置されるヘッドアップ ディスプレイ(HUD)のスライダ コントロールを作成します。このコマンドを使用して、ユーザ スクリプトで実際的な操作を指定できます。HUD スライダは一般的な HUD オブジェクトから派生するため、同様のワークフローを継承します。
このコマンドの機能は headsUpDisplay コマンドによく似ていますが、layoutVisibility、nextFreeBlock、lastOccupiedBlock、exists、remove などの headsUpDisplay レイアウト コントロールは利用できません。レイアウト コントロールを利用する場合は、headsUpDisplay コマンドを使用してください。これは、HUD スライダの作成と管理に特化したコマンドです。同様に、このコマンドで実行される操作はスライダになる HUD のみを対象としています。
作成時に必要なフラグは、section フラグと block フラグのみです。
headsUpDisplay コマンドと同様に、HUD スライダを作成すると、ID 番号が割り当てられます 必要に応じて、この ID 番号を使用して headsUpDisplay コマンド(-rid/removeID [int IDNumber])で HUD スライダを除去することができます。あるいは、HUD オブジェクトをそれらの位置(セクションとブロック)やそれぞれの固有名を使用して除去することもできます。
| int | ヘッドアップ ディスプレイ(HUD)の ID 番号 |
| string|int|int[2] | 対応する除去コマンドのヘッドアップ ディスプレイの名前、ID またはセクション、ブロック値。 |
照会モードでは、戻り値のタイプは照会されたフラグに基づきます。
hud, headsupdisplay, slider, hudslider
floatSlider, headsUpDisplay, intSlider
allowOverlap, block, blockAlignment, blockSize, decimalPrecision, dragCommand, internalPadding, label, labelFontSize, labelWidth, maxValue, minValue, padding, pressCommand, releaseCommand, section, sliderIncrement, sliderLength, type, value, valueAlignment, valueFontSize, valueWidth, visible
フラグはコマンドの作成モードで表示できます
|
フラグはコマンドの編集モードで表示できます
|
フラグはコマンドの照会モードで表示できます
|
フラグに複数の引数を指定し、タプルまたはリストとして渡すことができます。
|
import maya.cmds as cmds
# Define a procedure to execute on press/drag/release. This procedure
# will explicitly set any selected transforms to a given position along
# the X axis based on the value of a given HUD slider.
#
def translateXSlider( HUD ):
# Since undo is not turned off automatically, we must
# do it ourselves. The HUD will fire off many calls to this
# procedure during a drag so we don't want to flood the undo
# queue.
cmds.undoInfo( swf=False )
for object in cmds.ls( sl=True ):
if cmds.objectType( object, isType='transform' ):
translateX = object + '.tx'
value = cmds.hudSlider( HUD, q=True, v=True )
cmds.setAttr( translateX, value )
# Re-enable the undo queue.
#
cmds.undoInfo( swf=True)
# Now create our slider HUD
#
cmds.hudSlider( 'HUDTranslateXSlider',
section=2,
block=5,
visible=1,
label="TranslateX:",
value=0,
type="int",
minValue=-10,
maxValue=10,
labelWidth=80,
valueWidth=50,
sliderLength=100,
sliderIncrement=1,
pressCommand='translateXSlider( "HUDTranslateXSlider" )',
dragCommand='translateXSlider( "HUDTranslateXSlider" )',
releaseCommand='translateXSlider( "HUDTranslateXSlider" )')