addPluginRollouts() は、スクリプト プラグインの作成ツール内で使用されます。これはシーンにインスタンスを作成せずに、作成ツール内でその他のオブジェクトを作成するようなレベル 1 プラグインでの使用に特に適しています。このメソッドを使用すると、一般に作成ツールで作成されるオブジェクトの 1 つである[作成](Create)パネル内で指定したオブジェクトのロールアウトをインストールして、パラメータを作成中に直接調整できます。
形式は次のとおりです。
addPluginRollouts <obj>
次の例では、「マウス ツール句」で説明されている 3 つのライト マウス ツールを永続的で編集可能なクラスに設定します。これは、 2 つの新しいクラスを定義します。ヘルパー クラスの lightMaster は、ライト システムのマスター オブジェクトとして使用されます。ライト クラスの threeLights は、初期システムをレイアウトするために作成します。また、 lightMaster を作成し、そのパラメータがライトをポイントするように設定します。 lightMaster ロールアウトにより、後で[モディファイヤ](Modifier)パネルでの編集が可能になり、ライトをパラメータ ブロックに保存することにより、シーンの保存およびロードにおいて設定が永続的になります。
スクリプト: |
plugin helper lightMaster name:"Light Master" classID:#(12345,54321) extends:Dummy replaceUI:true invisible:true ( parameters main rollout:params ( key type:#node subAnim:true fill type:#node subAnim:true back type:#node subAnim:true height type:#worldUnits default:0 ui:height spread type:#worldUnits default:0 ui:spread angle type:#angle default:90 ui:angle -- check value of key since lights don't exist at initial creation on height set val do if key != undefined then coordsys key.target ( key.pos.z = val back.pos.z = val * 1.5 fill.pos.z = val * 0.5 ) on spread set val do if key != undefined then coordsys key.target ( -- compute normal vector pointing at key in the target's XY plane -- (kuv) and reposition everything based on that and the current -- spread and angle values local kuv = normalize ([key.pos.x, key.pos.y, 0]) key.pos = [kuv.x * spread, kuv.y * spread, height] back.pos = [kuv.x * -spread, kuv.y * -spread, height * 1.5] -- position fill by placing it under the key and then rotating in -- about the target fill.pos = [kuv.x * spread, kuv.y * spread, height * 0.5] about key.target rotate fill angle z_axis ) on angle set val do if key != undefined then coordsys key.target ( fill.pos = [key.pos.x, key.pos.y, height * 0.5] about key.target rotate fill angle z_axis ) ) rollout params "Light Parameters" ( spinner height "Height" type:#worldUnits range:[-1e32, 1e32, 0] spinner spread "Spread" type:#worldUnits range:[0, 1e32, 0] spinner angle "Angle" range:[-180, 180, 30] on params open do flagForeGround #(key, back, fill) true on params close do if key != undefined and back != undefined and fill != undefined then flagForeGround #(key, back, fill) false ) ) |
スクリプト: |
plugin light searchlights name:"Three Lights" ( local master tool create ( on mousePoint click do ( if click == 1 then -- create key, back & fill lights at mousedown ( coordsys grid ( master = lightMaster pos:gridPoint master.dummy.boxsize = [10,10,10] in master ( local targObj=targetobject pos:gridPoint master.key = targetspot pos:gridPoint name:"key" \ target:targObj master.back = targetspot pos:gridPoint name:"back" \ target:targObj master.fill = targetspot pos:gridPoint name:"fill" \ target:targObj ) ) addPluginRollouts master ) if click == 3 then ( select master master = undefined #stop ) ) on mouseMove click do ( if click == 2 then -- drag out & round on x-y plane ( -- place the key on the grid then set the spread and the -- 'on set spread' handler will -- move the lights to the correct heights master.key.pos = worldPoint master.spread = distance master.key master.key.target ) else if click == 3 then -- drag up to elevate lights master.height = gridDist.z ) on mouseAbort click do ( if master != undefined then ( if master.fill != undefined then delete master.fill if master.back != undefined then delete master.back if master.key != undefined then delete master.key delete master ) ) ) ) |