/* REV: Arkeon */ /* Last update: 07.04.02 */ typeof plugin = S;; typeof class = S;; typeof ed = PluginEditor;; typeof type_e = ObjBox;; typeof ambient_e = ObjButton;; typeof diffuse_e = ObjButton;; typeof specular_e = ObjButton;; typeof angle_e = ObjText;; typeof const_e = ObjText;; typeof quadr_e = ObjText;; typeof a_e = ObjText;; typeof b_e = ObjText;; typeof c_e = ObjText;; typeof SavedType = S;; typeof Init = ObjCheck;; typeof ambient_bmp = ObjBitmap;; typeof diffuse_bmp = ObjBitmap;; typeof specular_bmp = ObjBitmap;; var ambient = 0;; var diffuse = 0;; var specular = 0;; var angle = 0;; var const = 0;; var quadr = 0;; var a = 0;; var b = 0;; var c = 0;; fun swapRGB (color)= let color&0xff -> c1 in let (color>>8)&0xff -> c2 in let (color>>16)&0xff -> c3 in (c1<<16)+(c2<<8)+c3;; proto save=fun [ [Inst r1] ] [[S r1] [S r1] [[S r1]r1] [[S r1]r1]];; fun AddType(str, a) = _ADDcombo type_e (_GETcomboCount type_e) str;; fun AddTypes() = apply_on_list "Ambient"::"Para"::"Omni"::"Spot"::nil @AddType nil;; fun comboReflex(a, b, c, d) = let _GETcombo type_e -> [_ str] in set SavedType = if !strcmpi str "Ambient" then "LIGHT_AMBIENT" else if !strcmpi str "Para" then "LIGHT_PARA" else if !strcmpi str "Omni" then "LIGHT_OMNI" else "LIGHT_SPOT";; fun toType (str)= if !strcmp str "LIGHT_AMBIENT" then 0 else if !strcmp str "LIGHT_PARA" then 1 else if !strcmp str "LIGHT_OMNI" then 2 else 3 ;; fun endcolor (new_color, button)= if new_color == nil then nil else if button == ambient_e then { _FILLbitmap ambient_bmp new_color; _PAINTbutton ambient_e; set ambient = new_color; } else if button == diffuse_e then { _FILLbitmap diffuse_bmp new_color; _PAINTbutton diffuse_e; set diffuse = new_color; } else if button == specular_e then { _FILLbitmap specular_bmp new_color; _PAINTbutton specular_e; set specular = new_color; } else nil;; fun chgColor (button, val)= _CRcolorMap _channel ed.PluginEditorEditWin 0 0 "" mkfun2 @endcolor button if button == ambient_e then ambient else if button == diffuse_e then diffuse else if button == specular_e then specular else 0 ; 0;; fun openedit(win, param) = let strextr param -> l in let _GETwindowSizePosition win -> [w h x y] in { set ed = startPluginEditor _channel win 0 0 w h WN_CHILDINSIDE|WN_NOBORDER class; set ambient = let getInfo l "ambient" -> tmp in if tmp == nil then 0 else swapRGB htoi tmp; set diffuse = let getInfo l "diffuse" -> tmp in if tmp == nil then 0 else swapRGB htoi tmp; set specular = let getInfo l "specular" -> tmp in if tmp == nil then 0 else swapRGB htoi tmp; set angle = let getInfo l "angle" -> tmp in if tmp == nil then 0 else atoi tmp; set const = let getInfo l "const" -> tmp in if tmp == nil then 0 else atoi tmp; set quadr = let getInfo l "quadr" -> tmp in if tmp == nil then 0 else atoi tmp; set a = let getInfo l "a" -> tmp in if tmp == nil then 0 else atoi tmp; set b = let getInfo l "b" -> tmp in if tmp == nil then 0 else atoi tmp; set c = let getInfo l "c" -> tmp in if tmp == nil then 0 else atoi tmp; _CRtext _channel ed.PluginEditorEditWin 5 5 50 20 ET_ALIGN_RIGHT "Type:"; set type_e = _CBcombo _CRcombo _channel ed.PluginEditorEditWin 60 5 155 100 CB_NOEDIT "LIGHT_AMBIENT" @comboReflex nil; AddTypes; set SavedType = let getInfo l "type" -> tmp in if tmp == nil then "LIGHT_AMBIENT" else tmp; _SELcombo type_e toType SavedType; set ambient_bmp = _FILLbitmap _CRbitmap _channel 60 40 ambient; _CRtext _channel ed.PluginEditorEditWin 5 35 60 20 ET_ALIGN_CENTER "ambient"; set ambient_e = _CBbutton _CRbuttonBitmap _channel ed.PluginEditorEditWin ambient_bmp 5 60 60 40 0 @chgColor ambient; set diffuse_bmp = _FILLbitmap _CRbitmap _channel 60 40 diffuse; _CRtext _channel ed.PluginEditorEditWin 75 35 60 20 ET_ALIGN_CENTER "diffuse"; set diffuse_e = _CBbutton _CRbuttonBitmap _channel ed.PluginEditorEditWin diffuse_bmp 75 60 60 40 0 @chgColor diffuse; set specular_bmp = _FILLbitmap _CRbitmap _channel 60 40 specular; _CRtext _channel ed.PluginEditorEditWin 145 35 60 20 ET_ALIGN_CENTER "specular"; set specular_e = _CBbutton _CRbuttonBitmap _channel ed.PluginEditorEditWin specular_bmp 145 60 60 40 0 @chgColor specular; _CRtext _channel ed.PluginEditorEditWin 5 125 50 20 ET_ALIGN_RIGHT "angle"; set angle_e = _CReditLine _channel ed.PluginEditorEditWin 60 125 100 20 ET_NUMBER|ET_DOWN itoa angle; _CRtext _channel ed.PluginEditorEditWin 5 155 50 20 ET_ALIGN_RIGHT "const"; set const_e = _CReditLine _channel ed.PluginEditorEditWin 60 155 100 20 ET_NUMBER|ET_DOWN itoa const; _CRtext _channel ed.PluginEditorEditWin 5 185 50 20 ET_ALIGN_RIGHT "quadr"; set quadr_e = _CReditLine _channel ed.PluginEditorEditWin 60 185 100 20 ET_NUMBER|ET_DOWN itoa quadr; _CRtext _channel ed.PluginEditorEditWin 180 125 50 20 ET_ALIGN_RIGHT "Soft A"; set a_e = _CReditLine _channel ed.PluginEditorEditWin 240 125 100 20 ET_NUMBER|ET_DOWN itoa a; _CRtext _channel ed.PluginEditorEditWin 180 155 50 20 ET_ALIGN_RIGHT "Soft B"; set b_e = _CReditLine _channel ed.PluginEditorEditWin 240 155 100 20 ET_NUMBER|ET_DOWN itoa b; _CRtext _channel ed.PluginEditorEditWin 180 185 50 20 ET_ALIGN_RIGHT "Soft C"; set c_e = _CReditLine _channel ed.PluginEditorEditWin 240 185 100 20 ET_NUMBER|ET_DOWN itoa c; set Init = _SETcheck _CRcheck _channel ed.PluginEditorEditWin 5 215 w-20 20 0 "Init on" if !strcmpi getInfo l "init" "on" then 1 else 0; }; 0;; fun closeedit() = strbuild ("type"::SavedType::nil):: ("ambient"::(itoh swapRGB ambient)::nil):: ("diffuse"::(itoh swapRGB diffuse)::nil):: ("specular"::(itoh swapRGB specular)::nil):: ("angle"::(_GETtext angle_e)::nil):: ("const"::(_GETtext const_e)::nil):: ("quadr"::(_GETtext quadr_e)::nil):: ("a"::(_GETtext a_e)::nil):: ("b"::(_GETtext b_e)::nil):: ("c"::(_GETtext c_e)::nil):: ("init"::(let _GETcheck Init -> x in if x then "on" else "off")::nil):: nil ;; fun savesuppdmi(l) = if l==nil then nil else let l->[a n] in ("actionC"::(strcat a.nameInst ".onC")::nil):: ("actionC"::(strcat a.nameInst ".offC")::nil):: ("action"::(strcat a.nameInst ".switch")::nil):: ("action"::(strcat a.nameInst ".on")::nil):: ("action"::(strcat a.nameInst ".off")::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;;