スクリプト Material プラグインでは、既存の Material プラグインだけを拡張できます。
スクリプト Material プラグインを宣言するには、<superclass>
を material
として指定します。
スクリプト Material プラグインには、定義されたロールアウトが少なくとも 1 つ必要です。
スクリプト Material プラグインでは、パラメータ ブロック内のパラメータに関連する[マテリアル] (Material)ボタンと[マップ] (Map)ボタンでボタンの picked
イベント ハンドラは呼び出されません。代わりに、ボタンからパラメータブロックのパラメータへのリンクを設定し、このパラメータに対して set
ハンドラを使用する必要があります。
スクリプト:
-- this is a level 3 plug-in, the beginnings of a custom glass material. -- It extends Standard material and replaces its UI with a single -- rollout with 2 spinners and a color picker plugin material myGlass name:"Supa Glass" classID:#(695425,446581) extends:Standard replaceUI:true version:1 ( parameters main rollout:params ( trans type:#float default:27 ui:trans refrac type:#float default:1.5 ui:refrac col type:#color default:blue ui:col on trans set val do delegate.opacity = val on refrac set val do delegate.ior = val on col set val do delegate.diffuse_color = val ) rollout params "Glass Parameters" ( spinner trans "Transparency: " fieldwidth:45 offset:[-90,0] spinner refrac "Index of Refraction: " fieldwidth:45 offset:[-90,0] colorpicker col "Base color: " align:#center ) on create do ( -- setup initial material delegate.opacityFalloff = 75 ) )