移動先: 概要 戻り値 キーワード. 関連項目. フラグ. Python 例.
hudSlider([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" )')