/* lightsedit.pkg : editeur du plugin lights - sept 99 - Sylvain Huet */ /* rev June 00 - by Vincent BEAUDENON */ typeof plugin = S;; typeof class = S;; typeof ed = PluginEditor;; typeof comboType = ObjBox;; typeof aText = ObjText;; typeof bText = ObjText;; typeof p1Text = ObjText;; typeof p2Text = ObjText;; typeof p3Text = ObjText;; typeof Description = ObjText;; typeof TypeSave = S;; typeof Init = ObjCheck;; fun testinst(l, c) = if l==nil then 0 else let l->[a n] in if !strcmp a.classInst c then 1 else testinst n c ;; proto save=fun [ [Inst r1] ] [[S r1] [S r1] [[S r1]r1] [[S r1]r1]];; fun AddType(s, a) = set comboType = _ADDcombo comboType 10 s ;; fun AddTypes() = apply_on_list "Ambient"::"Para"::"Omni"::"Spot"::nil @AddType nil ;; fun Describe()= let _GETcombo comboType -> [_ s] in if 0==strcmpi s "Ambient" then ( _ENtext bText 0; _ENtext p1Text 0; set TypeSave = "LIGHT_AMBIENT";"'a' is added to every polygon" ) else if 0==strcmpi s "Para" then ( _ENtext bText 1; _ENtext p1Text 0; set TypeSave="LIGHT_PARA";"a value between 'a-b' and 'a+b' is added" ) else ( _ENtext bText 1; _ENtext p1Text 1; set TypeSave = if strcmpi s "Omni" then "LIGHT_SPOT" else "LIGHT_OMNI";"a value between 'a' and 'a+b' is added\nand light decrease after 'p1' centimeters" ) ;; fun comboReflex(a, b, c, d) = _SETtext Description Describe ;; fun toType(s)= if !strcmp s "LIGHT_AMBIENT" then 0 else if !strcmp s "LIGHT_PARA" then 1 else if !strcmp s "LIGHT_OMNI" then 2 else 3 ;; fun openedit(win, param) = let strextr param -> l in let _GETwindowSizePosition win -> [w h x y] in let getInfo l "type" -> type in let getInfo l "a" -> a in let getInfo l "b" -> b in let getInfo l "p1" -> p1 in let getInfo l "p2" -> p2 in let getInfo l "p3" -> p3 in let _SETtext _CRtext _channel win 5 5 100 20 ET_BORDER|ET_ALIGN_RIGHT "Type:" "Type:" -> T1 in let _SETtext _CRtext _channel win 5 35 100 20 ET_BORDER|ET_ALIGN_RIGHT "a:" "a:" -> T2 in let _SETtext _CRtext _channel win 5 65 100 20 ET_BORDER|ET_ALIGN_RIGHT "b:" "b:" -> T3 in let _SETtext _CRtext _channel win 5 95 100 20 ET_BORDER|ET_ALIGN_RIGHT "p1:" "p1:" -> T4 in let _SETtext _CRtext _channel win 5 125 100 20 ET_BORDER|ET_ALIGN_RIGHT "p2:" "p2:" -> T5 in let _SETtext _CRtext _channel win 5 155 100 20 ET_BORDER|ET_ALIGN_RIGHT "p3:" "p3:" -> T6 in let _SETtext _CRtext _channel win 5 185 100 20 ET_BORDER|ET_ALIGN_RIGHT "Initial state :" "Initial state :" -> T7 in ( set ed = startPluginEditor _channel win 0 0 w h WN_CHILDINSIDE|WN_NOBORDER class; set comboType = _CRcombo _channel ed.PluginEditorEditWin 115 5 100 100 CB_NOEDIT "Ambient";AddTypes; set aText = _SETtext _CReditText _channel ed.PluginEditorEditWin 115 35 100 20 ET_DOWN|ET_NUMBER "" if a==nil then "10" else a; set bText = _SETtext _CReditText _channel ed.PluginEditorEditWin 115 65 100 20 ET_DOWN|ET_NUMBER "" if b==nil then "20" else b; set p1Text = _SETtext _CReditText _channel ed.PluginEditorEditWin 115 95 100 20 ET_DOWN|ET_NUMBER "" if p1==nil then "1500" else p1; set p2Text = _SETtext _CReditText _channel ed.PluginEditorEditWin 115 125 100 20 ET_DOWN|ET_NUMBER "" p2; set p3Text = _SETtext _CReditText _channel ed.PluginEditorEditWin 115 155 100 20 ET_DOWN|ET_NUMBER "" p3; set comboType = _SELcombo comboType toType type; set Description = _SETtext _CRtext _channel ed.PluginEditorEditWin 175+50 5 w-185 40 0 "" Describe; set Init = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 115 185 w-20 20 0 "" if !strcmpi getInfo l "init" "on" then 1 else 0; set comboType = _CBcombo comboType @comboReflex nil; _ENtext p2Text 0; _ENtext p3Text 0; 0 ) ;; fun closeedit() = strbuild ("type"::TypeSave::nil):: ("a"::(_GETtext aText)::nil):: ("b"::(_GETtext bText)::nil):: ("p1"::(_GETtext p1Text)::nil):: ("p2"::(_GETtext p2Text)::nil):: ("p3"::(_GETtext p3Text)::nil):: ("init"::(let _GETcheck Init -> x in if x then "on" else "off")::nil):: nil ;; /* strcat "InitURL " _GETtext InitURL;; */ fun savesuppdmi(l) = if l==nil then nil else let l->[a n] in /*("actionC"::(strcat a.nameInst ".setParam")::nil)::*/("action"::(strcat a.nameInst ".switch")::nil)::savesuppdmi n ;; fun save(l)= [ nil /* registerF */ nil /* register */ ("plugin"::plugin::nil)::nil /* supplemental Dat */ savesuppdmi l /* supplemental Dmi */ ] ;; fun IniPlug(file) = set plugin=file; set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @save nil @openedit @closeedit ;;