ジャンプ先: 概要. 戻り値. フラグ. Python 例.
scriptCtx(
string
, [allComponents=boolean], [allObjects=boolean], [animBreakdown=boolean], [animCurve=boolean], [animInTangent=boolean], [animKeyframe=boolean], [animOutTangent=boolean], [baseClassName=string], [camera=boolean], [cluster=boolean], [collisionModel=boolean], [controlVertex=boolean], [cumulativeLists=boolean], [curve=boolean], [curveKnot=boolean], [curveOnSurface=boolean], [curveParameterPoint=boolean], [dimension=boolean], [dynamicConstraint=boolean], [edge=boolean], [editPoint=boolean], [emitter=boolean], [enableRootSelection=boolean], [escToQuit=boolean], [exists=boolean], [exitUponCompletion=boolean], [expandSelectionList=boolean], [facet=boolean], [field=boolean], [finalCommandScript=script], [fluid=boolean], [follicle=boolean], [forceAddSelect=boolean], [hairSystem=boolean], [handle=boolean], [history=boolean], [hull=boolean], [ignoreInvalidItems=boolean], [ikEndEffector=boolean], [ikHandle=boolean], [image1=string], [image2=string], [image3=string], [imagePlane=boolean], [implicitGeometry=boolean], [isoparm=boolean], [joint=boolean], [jointPivot=boolean], [lastAutoComplete=boolean], [lattice=boolean], [latticePoint=boolean], [light=boolean], [localRotationAxis=boolean], [locator=boolean], [locatorUV=boolean], [locatorXYZ=boolean], [nCloth=boolean], [nParticle=boolean], [nParticleShape=boolean], [nRigid=boolean], [name=string], [nonlinear=boolean], [nurbsCurve=boolean], [nurbsSurface=boolean], [objectComponent=boolean], [orientationLocator=boolean], [particle=boolean], [particleShape=boolean], [plane=boolean], [polymesh=boolean], [polymeshEdge=boolean], [polymeshFace=boolean], [polymeshFreeEdge=boolean], [polymeshUV=boolean], [polymeshVertex=boolean], [polymeshVtxFace=boolean], [rigidBody=boolean], [rigidConstraint=boolean], [rotatePivot=boolean], [scalePivot=boolean], [sculpt=boolean], [selectHandle=boolean], [setAllowExcessCount=boolean], [setAutoComplete=boolean], [setAutoToggleSelection=boolean], [setDoneSelectionPrompt=string], [setNoSelectionHeadsUp=string], [setNoSelectionPrompt=string], [setSelectionCount=int], [setSelectionHeadsUp=string], [setSelectionPrompt=string], [showManipulators=boolean], [spring=boolean], [springComponent=boolean], [stroke=boolean], [subdiv=boolean], [subdivMeshEdge=boolean], [subdivMeshFace=boolean], [subdivMeshPoint=boolean], [subdivMeshUV=boolean], [surfaceEdge=boolean], [surfaceFace=boolean], [surfaceKnot=boolean], [surfaceParameterPoint=boolean], [surfaceRange=boolean], [surfaceUV=boolean], [texture=boolean], [title=string], [toolCursorType=string], [toolFinish=script], [toolStart=script], [totalSelectionSets=int], [vertex=boolean])
注: オブジェクトの名前と引数を表す文字列は、カンマで区切る必要があります。これはシノプシスに示されていません。
scriptCtx は、取り消し可能、照会可能、および編集可能です。
このコマンドを使用すると、ユーザはセレクション ツールに基づいて独自のツールを作成することができます。多数のセレクション リストを収集する、選択項目の動作やセレクション マスクは完全にカスタマイズできるなどが可能です。 このコマンドは、実行前に処理されます。キーワード「$Selection#」(# は 1 以上の数字)には、セレクション セットを指定します。コンテキストには、$Selection# キーワードの代わりに置き換えられる複数のセレクション セットを MEL 文字配列の形式で指定することができます。セットごとに固有の項目をセットに指定する場合は、各セットで指定する必要があります。下記の例を参照してください。 さらに、作成するセレクションのタイプを指定するために、「selectType」コマンドのセレクション タイプ フラグをここで使用することができます。| string | コンテキスト名 |
照会モードでは、戻り値のタイプは照会されたフラグに基づきます。
| ロング ネーム(ショート ネーム) | 引数タイプ | プロパティ | ||
|---|---|---|---|---|
allComponents(alc)
|
boolean
|
|
||
|
||||
allObjects(alo)
|
boolean
|
|
||
|
||||
animBreakdown(abd)
|
boolean
|
|
||
|
||||
animCurve(ac)
|
boolean
|
|
||
|
||||
animInTangent(ait)
|
boolean
|
|
||
|
||||
animKeyframe(ak)
|
boolean
|
|
||
|
||||
animOutTangent(aot)
|
boolean
|
|
||
|
||||
baseClassName(bcn)
|
string
|
|
||
|
||||
camera(ca)
|
boolean
|
|
||
|
||||
cluster(cl)
|
boolean
|
|
||
|
||||
collisionModel(clm)
|
boolean
|
|
||
|
||||
controlVertex(cv)
|
boolean
|
|
||
|
||||
cumulativeLists(cls)
|
boolean
|
|
||
|
||||
curve(c)
|
boolean
|
|
||
|
||||
curveKnot(ck)
|
boolean
|
|
||
|
||||
curveOnSurface(cos)
|
boolean
|
|
||
|
||||
curveParameterPoint(cpp)
|
boolean
|
|
||
|
||||
dimension(dim)
|
boolean
|
|
||
|
||||
dynamicConstraint(dc)
|
boolean
|
|
||
|
||||
edge(eg)
|
boolean
|
|
||
|
||||
editPoint(ep)
|
boolean
|
|
||
|
||||
emitter(em)
|
boolean
|
|
||
|
||||
enableRootSelection(ers)
|
boolean
|
|
||
|
||||
escToQuit(esc)
|
boolean
|
|
||
|
||||
exists(ex)
|
boolean
|
|
||
|
||||
exitUponCompletion(euc)
|
boolean
|
|
||
|
||||
expandSelectionList(esl)
|
boolean
|
|
||
|
||||
facet(fc)
|
boolean
|
|
||
|
||||
field(fi)
|
boolean
|
|
||
|
||||
finalCommandScript(fcs)
|
script
|
|
||
|
||||
fluid(fl)
|
boolean
|
|
||
|
||||
follicle(fo)
|
boolean
|
|
||
|
||||
forceAddSelect(fas)
|
boolean
|
|
||
|
||||
hairSystem(hs)
|
boolean
|
|
||
|
||||
handle(ha)
|
boolean
|
|
||
|
||||
history(ch)
|
boolean
|
|
||
|
||||
hull(hl)
|
boolean
|
|
||
|
||||
ignoreInvalidItems(iii)
|
boolean
|
|
||
|
||||
ikEndEffector(iee)
|
boolean
|
|
||
|
||||
ikHandle(ikh)
|
boolean
|
|
||
|
||||
image1(i1)
|
string
|
|
||
|
||||
image2(i2)
|
string
|
|
||
|
||||
image3(i3)
|
string
|
|
||
|
||||
imagePlane(ip)
|
boolean
|
|
||
|
||||
implicitGeometry(ig)
|
boolean
|
|
||
|
||||
isoparm(iso)
|
boolean
|
|
||
|
||||
joint(j)
|
boolean
|
|
||
|
||||
jointPivot(jp)
|
boolean
|
|
||
|
||||
lastAutoComplete(lac)
|
boolean
|
|
||
|
||||
lattice(la)
|
boolean
|
|
||
|
||||
latticePoint(lp)
|
boolean
|
|
||
|
||||
light(lt)
|
boolean
|
|
||
|
||||
localRotationAxis(ra)
|
boolean
|
|
||
|
||||
locator(lc)
|
boolean
|
|
||
|
||||
locatorUV(luv)
|
boolean
|
|
||
|
||||
locatorXYZ(xyz)
|
boolean
|
|
||
|
||||
nCloth(ncl)
|
boolean
|
|
||
|
||||
nParticle(npr)
|
boolean
|
|
||
|
||||
nParticleShape(nps)
|
boolean
|
|
||
|
||||
nRigid(nr)
|
boolean
|
|
||
|
||||
name(n)
|
string
|
|
||
|
||||
nonlinear(nl)
|
boolean
|
|
||
|
||||
nurbsCurve(nc)
|
boolean
|
|
||
|
||||
nurbsSurface(ns)
|
boolean
|
|
||
|
||||
objectComponent(ocm)
|
boolean
|
|
||
|
||||
orientationLocator(ol)
|
boolean
|
|
||
|
||||
particle(pr)
|
boolean
|
|
||
|
||||
particleShape(ps)
|
boolean
|
|
||
|
||||
plane(pl)
|
boolean
|
|
||
|
||||
polymesh(p)
|
boolean
|
|
||
|
||||
polymeshEdge(pe)
|
boolean
|
|
||
|
||||
polymeshFace(pf)
|
boolean
|
|
||
|
||||
polymeshFreeEdge(pfe)
|
boolean
|
|
||
|
||||
polymeshUV(puv)
|
boolean
|
|
||
|
||||
polymeshVertex(pv)
|
boolean
|
|
||
|
||||
polymeshVtxFace(pvf)
|
boolean
|
|
||
|
||||
rigidBody(rb)
|
boolean
|
|
||
|
||||
rigidConstraint(rc)
|
boolean
|
|
||
|
||||
rotatePivot(rp)
|
boolean
|
|
||
|
||||
scalePivot(sp)
|
boolean
|
|
||
|
||||
sculpt(sc)
|
boolean
|
|
||
|
||||
selectHandle(sh)
|
boolean
|
|
||
|
||||
setAllowExcessCount(sae)
|
boolean
|
|
||
|
||||
setAutoComplete(sac)
|
boolean
|
|
||
|
||||
setAutoToggleSelection(sat)
|
boolean
|
|
||
|
||||
setDoneSelectionPrompt(dsp)
|
string
|
|
||
|
||||
setNoSelectionHeadsUp(snh)
|
string
|
|
||
|
||||
setNoSelectionPrompt(snp)
|
string
|
|
||
|
||||
setSelectionCount(ssc)
|
int
|
|
||
|
||||
setSelectionHeadsUp(ssh)
|
string
|
|
||
|
||||
setSelectionPrompt(ssp)
|
string
|
|
||
|
||||
showManipulators(sm)
|
boolean
|
|
||
|
||||
spring(spr)
|
boolean
|
|
||
|
||||
springComponent(spc)
|
boolean
|
|
||
|
||||
stroke(str)
|
boolean
|
|
||
|
||||
subdiv(sd)
|
boolean
|
|
||
|
||||
subdivMeshEdge(sme)
|
boolean
|
|
||
|
||||
subdivMeshFace(smf)
|
boolean
|
|
||
|
||||
subdivMeshPoint(smp)
|
boolean
|
|
||
|
||||
subdivMeshUV(smu)
|
boolean
|
|
||
|
||||
surfaceEdge(se)
|
boolean
|
|
||
|
||||
surfaceFace(sf)
|
boolean
|
|
||
|
||||
surfaceKnot(sk)
|
boolean
|
|
||
|
||||
surfaceParameterPoint(spp)
|
boolean
|
|
||
|
||||
surfaceRange(sr)
|
boolean
|
|
||
|
||||
surfaceUV(suv)
|
boolean
|
|
||
|
||||
texture(tx)
|
boolean
|
|
||
|
||||
title(t)
|
string
|
|
||
|
||||
toolCursorType(tct)
|
string
|
|
||
|
||||
toolFinish(tf)
|
script
|
|
||
|
||||
toolStart(ts)
|
script
|
|
||
|
||||
totalSelectionSets(tss)
|
int
|
|
||
|
||||
vertex(v)
|
boolean
|
|
||
|
||||
import maya.cmds as cmds # Simple example of "attach curve" tool created using scriptCtx. This tool # prompts the user to select two curves to attach. As soon as two curves # are selected, the attach is performed. It uses the selection type # flag 'curveParameterPoint' from "selectType" command to specify the # selection mask for this tool. cmds.scriptCtx( title='Attach Curve', totalSelectionSets=1, fcs="select -r $Selection1; performAttachCrv 0 \"\"", cumulativeLists=True, expandSelectionList=True, setNoSelectionPrompt='Select two curves close to the attachment points', setSelectionPrompt='Select a second curve close to the attachment point', setDoneSelectionPrompt='Never used because setAutoComplete is set', setAutoToggleSelection=True, setSelectionCount=2, setAutoComplete=True, curveParameterPoint=True ) # And a more complex example of fillet blend tool (two sets of any number # of "surface curves"). Notice how the selection lists are passed as # arguments to the callback function, performBlendGiven. cmds.scriptCtx( i1='birail3Gen.xpm', title='"Birail 3+ Tool', toolCursorType='edit', totalSelectionSets=2, cumulativeLists=True, expandSelectionList=True, fcs='select -r $Selection2; performBirail 0 3 \"birailThreePlusProfileContext\" ', setAutoToggleSelection=[True,True], setAutoComplete=[False, False], setSelectionCount=[0,2], nurbsCurve=[True,True], isoparm=[True,True], curveOnSurface=[True,True], surfaceEdge=[True,True], polymeshEdge=[True,True], setNoSelectionPrompt=['Select any number of profiles','Select two rails'], setSelectionPrompt=['Select additional profiles or hit ENTER', 'Select the second rail'], setDoneSelectionPrompt=['Profiles selected. Hit ENTER to start rail selection.', 'Rails selected. Hit ENTER to compute birail. '] ) # Here's Birail 3+ where you select any number of curves, then 2 rails: cmds.scriptCtx( i1='birail3Gen.xpm', title='"Birail 3+ Tool', toolCursorType='edit', totalSelectionSets=2, cumulativeLists=True, expandSelectionList=True, fcs='select -r $Selection2; performBirail 0 3 \"birailThreePlusProfileContext\" ', setAutoToggleSelection=[True,True], setAutoComplete=[False, False], setSelectionCount=[0,2], nurbsCurve=[True,True], isoparm=[True,True], curveOnSurface=[True,True], surfaceEdge=[True,True], polymeshEdge=[True,True], setNoSelectionPrompt=['Select any number of profiles','Select two rails'], setSelectionPrompt=['Select additional profiles or hit ENTER', 'Select the second rail'], setDoneSelectionPrompt=['Profiles selected. Hit ENTER to start rail selection.', 'Rails selected. Hit ENTER to compute birail. '] ) # userBirailContextCallback has "true" as the first argument, which suggests # that $Selection2 contains all of $Selection1 items (as -cumulativeLists # true is specified in the tool creation.)