/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see https://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 https://www.gnu.org/copyleft/lesser.txt ----------------------------------------------------------------------------- */ fun cbCloseEdit(p)= let p -> [ctrlsourcename ctrlsons ctrlaradius ctrlaheight ctrlmaxslope ctrlmaxclimb ctrlcellsize ctrlcellheight ctrltilesize /*ctrlminregion ctrlmergeregion*/] in let getEdCtrlTextLineValue ctrlsourcename -> sourcename in let getEdCtrlCheckState ctrlsons -> sons in let getEdCtrlFloatValue ctrlaradius -> aradius in let getEdCtrlFloatValue ctrlaheight -> aheight in let getEdCtrlFloatValue ctrlmaxslope -> maxslope in let getEdCtrlFloatValue ctrlmaxclimb -> maxclimb in let getEdCtrlFloatValue ctrlcellsize -> cellsize in let getEdCtrlFloatValue ctrlcellheight -> cellheight in let ftoi (getEdCtrlFloatValue ctrltilesize) -> tilesize in /* let getEdCtrlFloatValue ctrlminregion -> minregion in let getEdCtrlFloatValue ctrlmergeregion -> mergeregion in */ ["sourceobject" sourcename]:: ["sons" itoa sons]:: ["aradius" ftoa aradius]:: ["aheight" ftoa aheight]:: ["maxslope" ftoa maxslope]:: ["maxclimb" ftoa maxclimb]:: ["cellsize" ftoa cellsize]:: ["cellheight" ftoa cellheight]:: ["tilesize" itoa tilesize]:: /* ["minregion" ftoa minregion]:: ["mergeregion" ftoa mergeregion]:: */ nil;; fun cbSelectObj(val, type, p)= let p -> [inst winstr viewstr ctrldestname] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in if (obj != nil) || (!strcmpi "Current camera" val) || (!strcmpi "Current camera shell" val) then ( setEdCtrlTextLineValue ctrldestname val; ) else nil; 0;; fun cbCloseRes(ctrlbtn)= setEdCtrlButtonEnable ctrlbtn 1; 0;; fun cbBtnPickObj(ctrlbtn, p)= let p -> [inst winstr viewstr ctrldestname objname] in ( setEdCtrlButtonEnable ctrlbtn 0; dlgSelectPluginInstanceResource inst winstr iTypeGroup|iTypeEntity|iTypeNode|iTypeCubeMap objname mkfun3 @cbSelectObj [inst winstr viewstr ctrldestname] mkfun1 @cbCloseRes ctrlbtn 0; ); 0;; fun cbCheckRotate(ctrl, state, ctrlrspeed)= setEdCtrlFloatEnable ctrlrspeed !state; 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [420 290] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "sourceobject") -> sourcename in let atoi (getPluginInstanceParam inst "sons") -> sons in let if (sons == nil) then 0 else sons -> sons in let atof (getPluginInstanceParam inst "aradius") -> aradius in let if (aradius == nil) then 0.25 else aradius -> aradius in let atof (getPluginInstanceParam inst "aheight") -> aheight in let if (aheight == nil) then 1.75 else aheight -> aheight in let atof (getPluginInstanceParam inst "maxslope") -> maxslope in let if (maxslope == nil) then 30.0 else maxslope -> maxslope in let atof (getPluginInstanceParam inst "maxclimb") -> maxclimb in let if (maxclimb == nil) then 0.25 else maxclimb -> maxclimb in let atof (getPluginInstanceParam inst "cellsize") -> cellsize in let if (cellsize == nil) then 0.1 else cellsize -> cellsize in let atof (getPluginInstanceParam inst "cellheight") -> cellheight in let if (cellheight == nil) then 0.1 else cellheight -> cellheight in let atof (getPluginInstanceParam inst "tilesize") -> tilesize in let if (tilesize == nil) then 16.0 else tilesize -> tilesize in /* let atof (getPluginInstanceParam inst "minregion") -> minregion in let if (minregion == nil) then 20.0 else minregion -> minregion in let atof (getPluginInstanceParam inst "mergeregion") -> mergeregion in let if (mergeregion == nil) then 15.0 else mergeregion -> mergeregion in*/ let atof (getPluginInstanceParam inst "speed") -> speed in let if (speed == nil) then 1.0 else speed -> speed in let crEdFrameWindow _channel ewinstr 0 0 iw 80 EDWIN_RESIZE_MW nil (loc "OS3DNAVIGATIONMESH_0002") (loc "OS3DNAVIGATIONMESH_0001") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 60 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DNAVIGATIONMESH_0003") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 sourcename nil EDWIN_RESIZE_MW -> ctrlsourcename in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn2 in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshsourcename in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DNAVIGATIONMESH_0004") EDWIN_RESIZE_MW -> ctrlsons in let crEdFrameWindow _channel ewinstr 0 0 iw 210 EDWIN_RESIZE_MW nil (loc "OS3DNAVIGATIONMESH_0012") (loc "OS3DNAVIGATIONMESH_0001") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 190 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DNAVIGATIONMESH_0005") nil -> lbl in let crEdCtrlFloat winstr 180 ypos 100 20 aradius 0.01 100.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlaradius in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DNAVIGATIONMESH_0006") nil -> lbl in let crEdCtrlFloat winstr 180 ypos 100 20 aheight 0.01 100.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlaheight in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DNAVIGATIONMESH_0007") nil -> lbl in let crEdCtrlFloat winstr 180 ypos 100 20 maxslope 1.0 90.0 1.0 2 nil EDWIN_RESIZE_MW -> ctrlmaxslope in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DNAVIGATIONMESH_0008") nil -> lbl in let crEdCtrlFloat winstr 180 ypos 100 20 maxclimb 0.0 100.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlmaxclimb in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DNAVIGATIONMESH_0009") nil -> lbl in let crEdCtrlFloat winstr 180 ypos 100 20 cellsize 0.1 1000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlcellsize in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DNAVIGATIONMESH_0010") nil -> lbl in let crEdCtrlFloat winstr 180 ypos 100 20 cellheight 0.1 1000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlcellheight in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DNAVIGATIONMESH_0011") nil -> lbl in let crEdCtrlFloat winstr 180 ypos 100 20 tilesize 8.0 128.0 8.0 0 nil EDWIN_RESIZE_MW -> ctrltilesize in /* let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DNAVIGATIONMESH_0013") nil -> lbl in let crEdCtrlFloat winstr 180 ypos 100 20 minregion 1.0 1000.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlminregion in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DNAVIGATIONMESH_0014") nil -> lbl in let crEdCtrlFloat winstr 180 ypos 100 20 mergeregion 1.0 1000.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlmergeregion in */ ( setEdCtrlButtonCb pickbtn2 mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlsourcename sourcename]; setEdCtrlButtonCb refreshsourcename mkfun2 @cbRefreshBtn [ctrlsourcename]; setEdCtrlTextLineEnable ctrlsourcename 0; setEdCtrlCheckState ctrlsons sons; [mkfun1 @cbCloseEdit [ctrlsourcename ctrlsons ctrlaradius ctrlaheight ctrlmaxslope ctrlmaxclimb ctrlcellsize ctrlcellheight ctrltilesize /*ctrlminregion ctrlmergeregion*/] nil]; ); );;