ジャンプ先: 概要. 戻り値. フラグ. Python 例.

概要

menuSet( [object] , [addMenu=string], [allMenuSets=boolean], [currentMenuSet=string], [exists=string], [hotBoxVisible=boolean], [insertMenu=[string, uint]], [label=string], [menuArray=string[]], [moveMenu=[string, uint]], [moveMenuSet=[string, uint]], [numberOfMenuSets=boolean], [numberOfMenus=boolean], [permanent=boolean], [removeMenu=string], [removeMenuSet=string])

注: オブジェクトの名前と引数を表す文字列は、カンマで区切る必要があります。これはシノプシスに示されていません。

menuSet は、取り消し可能、照会可能、および編集可能です。

メイン メニュー バーに表示するメニューを論理的に順序付けするメニュー セットを作成します。このメニュー セットは動的に編集や順序変更を行うことができます。

戻り値

string結果のメニュー セットの名前。(残りのメニュー セットがない場合は、空の文字列)

照会モードでは、戻り値のタイプは照会されたフラグに基づきます。

フラグ

addMenu, allMenuSets, currentMenuSet, exists, hotBoxVisible, insertMenu, label, menuArray, moveMenu, moveMenuSet, numberOfMenuSets, numberOfMenus, permanent, removeMenu, removeMenuSet
ロング ネーム(ショート ネーム) 引数タイプ プロパティ
addMenu(am) string create
メニューを現在のメニュー セットの最後にアペンドします。
allMenuSets(ams) boolean query
使用中のすべてのメニュー セットのオブジェクト名の配列を返します。照会すると、このフラグは文字配列を返します。
currentMenuSet(cms) string createquery
すべての操作(アペンド、挿入、除去など)の作用対象となる、現在アクティブなメニュー セットです。照会すると、このフラグは string を返します。
exists(ex) string query
指定したメニュー セットが存在するかどうかを返します。この照会フラグは文字列の引数(つまり、menuSet -q -exists animationMenuSet;)をサポートします。

照会モードでは、このフラグに値が必要になります。

hotBoxVisible(hbv) boolean createqueryedit
このメニュー セットをメイン メニュー バーだけでなくホットボックスにも表示するかどうかを指定します。
insertMenu(im) [string, uint] create
メニューを現在のメニュー セットの指定したインデックス内に挿入します。
label(l) string createquery
現在のメニュー セットのラベルです。照会すると、このフラグは string を返します。
menuArray(ma) string[] createquery
現在のメニュー セットのメニュー名(文字列)の配列です。照会すると、このフラグは文字配列を返します。
moveMenu(mm) [string, uint] create
指定したメニューを現在のメニュー セットから新しい位置に移動します。
moveMenuSet(mms) [string, uint] create
指定したメニュー セットを別のインデックスに移動します。
numberOfMenuSets(nms) boolean query
メニュー セットの合計数です。照会すると、このフラグは整数を返します。
numberOfMenus(nm) boolean query
現在のメニュー セットのメニュー数です。照会すると、このフラグは整数を返します。
permanent(p) boolean createqueryedit
このメニュー セットを移動できるかどうかを指定します。
removeMenu(rm) string create
指定したメニューを現在のメニュー セットから除去します。
removeMenuSet(rms) string create
指定したメニュー セット オブジェクトをすべてのメニュー セットのリストから除去します。

フラグはコマンドの作成モードで表示できます フラグはコマンドの編集モードで表示できます
フラグはコマンドの照会モードで表示できます フラグに複数の引数を指定し、タプルまたはリストとして渡すことができます。

Python 例

import maya.cmds as cmds

# creating a new menu set;
cmds.menuSet( 'newMenuSetObjName', label='newMenuSet Label' )

# using commands on a current menu set
# first find the menu set if you don't know the name of it
animMS = maya.mel.eval('findMenuSetFromLabel("Animation")')

# menu sets can be queried like normal commands
animMenus = cmds.menuSet(animMS, query=True, menuArray=True)

# but editing the set requires either setting the current menu set...
# (notice that the menu set comamnds following specify no specific menu set)
cmds.menuSet( currentMenuSet=animMS )
cmds.menuSet( removeMenu=animMenus[0] )
# : (other commands which pertain to the animation menu set)

# .. or temporarily setting the menu set to work on (does not affect current menu set)
# (notice that every command following specifies the specific set to apply operations to)
polyMS = maya.mel.eval('findMenuSetFromLabel("Polygons")')
polyMenus = cmds.menuSet(polyMS, query=True, menuArray=True)
cmds.menuSet( polyMS, removeMenu=polyMenus[0], insertMenu=(polyMenus[1], 0) )

# .. where the following commands still affect the animation menu set
animMenus = cmds.menuSet(query=True, menuArray=True)

# if you need to find a specific menu...
deformMenu = maya.mel.eval( ('findMenuFromMenuSet(\"' + animMS + '\", "Deform")') )

# moving a menu from one spot to another
# (ie. moving the Deform Menu to the front of the list)
cmds.menuSet( moveMenu=(deformMenu, 0) )