/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2012 I-maginer This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, or go to http://www.gnu.org/copyleft/lesser.txt ----------------------------------------------------------------------------- */ fun cbCloseEdit(p)= let p -> [ctrlrefname ctrlobjname ctrlsons ctrleffectmode ctrleffectspeed ctrlcollectmode ctrlpname ctrlrandomcount ctrlrandomsize ctrlrandomvec ctrlrandomang ctrlhide ctrlinit] in let getEdCtrlTextLineValue ctrlrefname -> refname in let getEdCtrlTextLineValue ctrlobjname -> objname in let getEdCtrlCheckState ctrlsons -> sons in let getSelectedEdCtrlSelectPos ctrleffectmode -> effectmode in let getEdCtrlFloatValue ctrleffectspeed -> effectspeed in let getSelectedEdCtrlSelectPos ctrlcollectmode -> collectmode in let getEdCtrlTextLineValue ctrlpname -> player in let ftoi getEdCtrlFloatValue ctrlrandomcount -> randomcount in let getEdCtrlFloatValue ctrlrandomsize -> randomsize in let getSelectedEdCtrlSelectPos ctrlrandomvec -> randomvec in let getSelectedEdCtrlSelectPos ctrlrandomang -> randomang in let getEdCtrlCheckState ctrlhide -> hide in let getEdCtrlCheckState ctrlinit -> init in ["ref" refname]:: ["object" objname]:: ["sons" itoa sons]:: ["effectmode" itoa effectmode]:: ["effectspeed" ftoa effectspeed]:: ["collectmode" itoa collectmode]:: ["player" player]:: ["randomcnt" itoa randomcount]:: ["randomsize" ftoa randomsize]:: ["randomvectype" itoa randomvec]:: ["randomangtype" itoa randomang]:: ["hide" itoa hide]:: ["init" itoa init]:: nil;; fun cbSelectObj(val, type, p)= let p -> [inst winstr viewstr ctrlobjname] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetObjectByName sessionstr val -> obj in if obj == nil then nil else ( setEdCtrlTextLineValue ctrlobjname val; ); 0;; fun cbCloseRes(ctrlbtn)= setEdCtrlButtonEnable ctrlbtn 1; 0;; fun cbBtnPickObj(ctrlbtn, p)= let p -> [inst winstr viewstr ctrlobjname objname] in ( setEdCtrlButtonEnable ctrlbtn 0; dlgSelectPluginInstanceResource inst winstr iTypeGroup|iTypeEntity|iTypeNode|iTypeLight|iTypeBone|iTypeCamera|iTypeParticle|iTypeCubeMap objname mkfun3 @cbSelectObj [inst winstr viewstr ctrlobjname] mkfun1 @cbCloseRes ctrlbtn 0; ); 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; fun cbDlgGetFile(pfile, p)= let p -> [inst ctrlbtn winstr ctrlpath] in ( if pfile == nil then nil else let _PtoScol pfile -> file in if file == nil then ( _DLGMessageBox _channel winstr.EDW_win (loc "OS3DITEMS_0002") (loc "OS3DITEMS_0008") 0; 0; ) else ( setEdCtrlTextLineValue ctrlpath file; 0; ); setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbBtnPickFile(ctrlbtn, p)= let p -> [inst winstr ctrlpath] in let getEdCtrlTextLineValue ctrlpath -> path in let getPathFile path "" -> [fpath fname] in ( setEdCtrlButtonEnable ctrlbtn 0; let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [750 450] -> [iw ih] in let crEdOpenFileDialog _channel winstr nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih "" ["OpenSpace3D Project" "xos"::nil]::["All" "*.*"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR|EDFILE_DIALOG_SHOW_INFOS nil path -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogInfoCb dlgfstr @cbGetOS3dProjectInfos; setEdOpenFileDialogCb dlgfstr mkfun2 @cbDlgGetFile [inst ctrlbtn winstr ctrlpath]; 0; ); ); 0;; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [420 445] -> [iw ih] in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "ref") -> refname in let (getPluginInstanceParam inst "object") -> objname in let atoi (getPluginInstanceParam inst "sons") -> sons in let if sons == nil then 0 else sons -> sons in let atof (getPluginInstanceParam inst "randomcnt") -> randomcnt in let if randomcnt == nil then 1.0 else randomcnt -> randomcnt in let atof (getPluginInstanceParam inst "randomsize") -> randomsize in let if randomsize == nil then 5.0 else randomsize -> randomsize in let atoi (getPluginInstanceParam inst "randomvectype") -> randomvectype in let if randomvectype == nil then 0 else randomvectype -> randomvectype in let atoi (getPluginInstanceParam inst "randomangtype") -> randomangtype in let if randomangtype == nil then 0 else randomangtype -> randomangtype in let atoi (getPluginInstanceParam inst "effectmode") -> effectmode in let if effectmode == nil then 0 else effectmode -> effectmode in let atof (getPluginInstanceParam inst "effectspeed") -> effectspeed in let if effectspeed == nil then 1.0 else effectspeed -> effectspeed in let atoi (getPluginInstanceParam inst "collectmode") -> collectmode in let if collectmode == nil then 0 else collectmode -> collectmode in let (getPluginInstanceParam inst "player") -> pobjname in let atoi (getPluginInstanceParam inst "hide") -> hide in let if hide == nil then 0 else hide -> hide in let atoi (getPluginInstanceParam inst "init") -> init in let if init == nil then 0 else init -> init in let 10 -> ypos in let crEdFrameWindow _channel ewinstr 0 0 iw 105 EDWIN_RESIZE_MW nil (loc "OS3DITEMS_0002") (loc "OS3DITEMS_0001") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 85 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (ypos + 2) 160 20 (loc "OS3DITEMS_0003") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 refname nil EDWIN_RESIZE_MW -> ctrlrefname in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickrefbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshref in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DITEMS_0004") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 objname nil EDWIN_RESIZE_MW -> ctrlobjname in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickobjbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshobjname in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DITEMS_0005") EDWIN_RESIZE_MW -> ctrlsons in let crEdFrameWindow _channel ewinstr 0 0 iw 130 EDWIN_RESIZE_MW nil (loc "OS3DITEMS_0006") (loc "OS3DITEMS_0001") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 110 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (set ypos = 10) + 2 160 20 (loc "OS3DITEMS_0007") nil -> label in let crEdCtrlSelect winstr 180 ypos 200 120 EDWIN_RESIZE_MW -> ctrleffectmode in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DITEMS_0008") nil -> label in let crEdCtrlFloat winstr 180 ypos 100 20 effectspeed 0.1 1000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrleffectspeed in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DITEMS_0009") nil -> label in let crEdCtrlSelect winstr 180 ypos 200 120 EDWIN_RESIZE_MW -> ctrlcollectmode in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DITEMS_0010") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 pobjname nil EDWIN_RESIZE_MW -> ctrlpname in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickpbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refresp in let crEdFrameWindow _channel ewinstr 0 0 iw 130 EDWIN_RESIZE_MW nil (loc "OS3DITEMS_0011") (loc "OS3DITEMS_0001") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 110 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (set ypos = 10) 210 20 (loc "OS3DITEMS_0012") nil -> label in let crEdCtrlFloat winstr 220 ypos 100 20 randomcnt 1.0 1000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlrandomcount in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) 210 20 (loc "OS3DITEMS_0013") nil -> label in let crEdCtrlFloat winstr 220 ypos 100 20 randomsize 0.1 10000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlrandomsize in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 210 20 (loc "OS3DITEMS_0014") nil -> label in let crEdCtrlSelect winstr 220 ypos 200 120 EDWIN_RESIZE_MW -> ctrlrandomvec in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 210 20 (loc "OS3DITEMS_0015") nil -> label in let crEdCtrlSelect winstr 220 ypos 200 120 EDWIN_RESIZE_MW -> ctrlrandomang in let crEdFrameWindow _channel ewinstr 0 0 iw 80 EDWIN_RESIZE_MW nil (loc "OS3DITEMS_0016") (loc "OS3DITEMS_0001") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 60 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlCheck winstr 10 (set ypos = 10) 280 20 (loc "OS3DITEMS_0017") EDWIN_RESIZE_MW -> ctrlhide in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DITEMS_0018") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlCheckState ctrlsons sons; setEdCtrlCheckState ctrlhide hide; setEdCtrlCheckState ctrlinit init; setEdCtrlButtonCb pickrefbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlrefname refname]; setEdCtrlTextLineEnable ctrlrefname 0; setEdCtrlButtonCb refreshref mkfun2 @cbRefreshBtn [ctrlrefname]; setEdCtrlButtonCb pickobjbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname objname]; setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlButtonCb refreshobjname mkfun2 @cbRefreshBtn [ctrlobjname]; setEdCtrlButtonCb pickpbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlpname pobjname]; setEdCtrlTextLineEnable ctrlpname 0; setEdCtrlButtonCb refresp mkfun2 @cbRefreshBtn [ctrlpname]; fillEdCtrlSelect ctrleffectmode "None"::"Rotate XYZ"::"Rotate X"::"Rotate Y"::"Rotate Z"::"Rotate XZ"::"Rotate YZ"::"Rotate XY"::"Squash XYZ"::"Squash X"::"Squash Y"::"Squash Z"::"Squash XZ"::"Squash YZ"::"Squash XY"::nil; selectEdCtrlSelectByPos ctrleffectmode effectmode; fillEdCtrlSelect ctrlcollectmode "None"::"Player distance"::"Mouse click"::nil; selectEdCtrlSelectByPos ctrlcollectmode collectmode; fillEdCtrlSelect ctrlrandomvec "Cube"::"Square XZ"::"Square YZ"::"Square XY"::"Sphere"::"Circle XZ"::"Circle YZ"::"Circle XY"::nil; selectEdCtrlSelectByPos ctrlrandomvec randomvectype; fillEdCtrlSelect ctrlrandomang "None"::"XYZ"::"X"::"Y"::"Z"::"XZ"::"YZ"::"XY"::nil; selectEdCtrlSelectByPos ctrlrandomang randomangtype; [mkfun1 @cbCloseEdit [ctrlrefname ctrlobjname ctrlsons ctrleffectmode ctrleffectspeed ctrlcollectmode ctrlpname ctrlrandomcount ctrlrandomsize ctrlrandomvec ctrlrandomang ctrlhide ctrlinit] nil]; ); );;