setKnotSelection メソッドを使用してノットの選択を設定すると、常に基本オブジェクト(スタックの一番下にある EditableSpline)に影響を与えることになります。このメソッドを使用して、特定の Edit_Spline モディファイヤのサブオブジェクトの頂点選択を直接設定することはできません。選択内容が既存のすべての Edit_Spline モディファイヤを通ってスタックまでフローするので、これらすべてのサブオブジェクトの選択を変更してしまうからです。
次のスクリプト例では、SplineShape の終端部で 1 つの頂点を選択し、リンクした X フォーム モディファイヤを使用してこれをオブジェクトにリンクする必要があります。次に、SplineShape のもう一方の終端にある頂点を、2 つ目のリンクした X フォームを使用して別のオブジェクトにリンクします。この結果、どちらかのオブジェクトを移動すると、2 つのオブジェクト間のスプラインが伸縮します。この動きは「ロープ」に似ています。
両端の頂点選択を設定しようとすると、2 つ目の選択がスタック全体を通ってフローし、最初の選択を上書きしてしまうので失敗します。この結果、両方のリンクした X フォーム モディファイヤが同じ頂点に影響を与えてしまうことになります。
これを回避するには、2 つのことを実行する必要があります。まず、モディファイヤをお互いの最上部に追加するのではなく、上から下まで適用させ、次に、SplineSelect モディファイヤを「選択ブロッカー」として使用して、2 つ目のサブオブジェクト選択が最初の選択を上書きしないようにします。
スクリプト:
resetMaxFile #noPrompt theSphere1= sphere() theSphere1.pos = [-100,0,0] theSphere2= sphere() theSphere2.pos = [100,0,0] theShape = splineShape() addnewSpline theShape addKnot theShape 1 #corner #line [-100,0,0] addKnot theShape 1 #corner #line [100,0,0] updateShape theShape max modify mode --switch to modify panel select theShape --select the spline es1 = edit_spline name:"First ES" --create 1st Edit_Spline addmodifier theShape es1 --add to the TOP of the stack subobjectLevel = 1 --vertex level... setKnotSelection theShape 1 #(1) --select first vertex in BASE OBJECT LX1 = Linked_XForm name:"First XForm" --Add Linked XForm modPanel.addModToSelection LX1 --Add to the sub-selection LX1.Control = theSphere1--Set control sselect = splineselect name:"Blocker" --Add a SplineSelect to stop the flow addmodifier theShape sselect before:2 --Add it BEFORE the first Edit_Spline! --Note: Since modifiers are always counted from top to bottom, --having 2 modifiers on top will place the new modifier before them --when using "before:2" es2 = edit_spline name:"Second ES" --Create second Edit_Spline addmodifier theShape es2 before:3 --Add it BEFORE the SlineSelect "Blocker" modPanel.setCurrentObject es2 --Set the Modifier stack to it subobjectLevel = 1 --vertex SO level setKnotSelection theShape 1 #(2) --select second vertex --Note that at this point, the selection will flow up until it --hits the SplineSelect modifier which is set to Object Level and does --not let the selection pass beyond that point. This preserves --the selection of vertex 1 in the top Edit_Spline and sets the --selection in the bottom one to vertex 2. LX2 = Linked_XForm name:"Second XForm" --create new Linked XForm modPanel.addModToSelection LX2 --Add on top of the current selection LX2.Control = theSphere2 --set second control