/* ----------------------------------------------------------------------------- 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 -> [ctrldestname ctrlsourcename ctrlfps ctrlspeed ctrlrspeed ctrlrbrotate ctrlft ctrlfc ctrlfb ctrldx ctrldy ctrldz] in let getEdCtrlTextLineValue ctrldestname -> destname in let getEdCtrlTextLineValue ctrlsourcename -> sourcename in let getEdCtrlFloatValue ctrlfps -> fps in let getEdCtrlFloatValue ctrlspeed -> speed in let getEdCtrlFloatValue ctrlrspeed -> rspeed in let getEdCtrlCheckState ctrlrbrotate -> brotate in let getEdCtrlFloatValue ctrlft -> ft in let getEdCtrlFloatValue ctrlfc -> fc in let getEdCtrlFloatValue ctrlfb -> fb in let getEdCtrlFloatValue ctrldx -> xdir in let getEdCtrlFloatValue ctrldy -> ydir in let getEdCtrlFloatValue ctrldz -> zdir in ["destobject" destname]:: ["sourceobject" sourcename]:: ["fps" ftoa fps]:: ["speed" ftoa speed]:: ["rspeed" ftoa rspeed]:: ["brotate" itoa !brotate]:: ["T" ftoa ft]:: ["C" ftoa fc]:: ["B" ftoa fb]:: ["xdir" ftoa xdir]:: ["ydir" ftoa ydir]:: ["zdir" ftoa zdir]:: 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|iTypeLight|iTypeCamera|iTypeParticle|iTypeBone|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 360] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let (getPluginInstanceParam inst "destobject") -> destname in let (getPluginInstanceParam inst "sourceobject") -> sourcename in let atof (getPluginInstanceParam inst "speed") -> speed in let atof (getPluginInstanceParam inst "rspeed") -> rspeed in let atof (getPluginInstanceParam inst "fps") -> fps in let atoi (getPluginInstanceParam inst "brotate") -> brotate in let if brotate == nil then 0 else brotate -> brotate in let if fps == nil then 60.0 else fps -> fps in let if speed == nil then 1.0 else speed -> speed in let if rspeed == nil then speed else rspeed -> rspeed in let atof (getPluginInstanceParam inst "T") -> ft in let atof (getPluginInstanceParam inst "C") -> fc in let atof (getPluginInstanceParam inst "B") -> fb in let if ft == nil then 0.0 else ft -> ft in let if fc == nil then 0.0 else fc -> fc in let if fb == nil then 0.0 else fb -> fb in let atof (getPluginInstanceParam inst "xdir") -> xdir in let atof (getPluginInstanceParam inst "ydir") -> ydir in let atof (getPluginInstanceParam inst "zdir") -> zdir in let if xdir == nil then 0.0 else xdir -> xdir in let if ydir == nil then 0.0 else ydir -> ydir in let if zdir == nil then (-.1.0) else zdir -> zdir in let crEdFrameWindow _channel ewinstr 0 0 iw 80 EDWIN_RESIZE_MW nil (loc "OS3DOBJECTMOVETO_0013") (loc "OS3DOBJECTMOVETO_0011") -> 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 "OS3DOBJECTMOVETO_0015") 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 crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECTMOVETO_0009") nil -> labeltarget in let crEdCtrlTextLine winstr 180 ypos 140 20 destname nil EDWIN_RESIZE_MW -> ctrldestname in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshdestname in let crEdFrameWindow _channel ewinstr 0 0 iw 320 EDWIN_RESIZE_MW nil (loc "OS3DOBJECTMOVETO_0012") (loc "OS3DOBJECTMOVETO_0011") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 300 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DOBJECTMOVETO_0010") nil -> labelfps in let crEdCtrlFloat winstr 180 ypos 100 20 fps 1.0 200.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlfps in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECTMOVETO_0017") nil -> labelspeed in let crEdCtrlFloat winstr 180 ypos 100 20 speed 0.01 2000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlspeed in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECTMOVETO_0014") nil -> labelrspeed in let crEdCtrlFloat winstr 180 ypos 100 20 rspeed 0.01 2000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlrspeed in let crEdCtrlCheck winstr 285 ypos (iw - 295) 20 (loc "OS3DOBJECTMOVETO_0001") EDWIN_RESIZE_MW -> ctrlrbrotate in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECTMOVETO_0016") nil -> labelft in let crEdCtrlFloat winstr 180 ypos 100 20 ft (-.1.0) 1.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlft in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECTMOVETO_0003") nil -> labelfc in let crEdCtrlFloat winstr 180 ypos 100 20 fc (-.1.0) 1.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlfc in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECTMOVETO_0002") nil -> labelfb in let crEdCtrlFloat winstr 180 ypos 100 20 fb (-.1.0) 1.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlfb in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECTMOVETO_0006") nil -> labeld in let crEdCtrlFloat winstr 180 ypos 100 20 xdir (-.1.0) 1.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrldx in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECTMOVETO_0007") nil -> labelfc in let crEdCtrlFloat winstr 180 ypos 100 20 ydir (-.1.0) 1.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrldy in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOBJECTMOVETO_0008") nil -> labelfb in let crEdCtrlFloat winstr 180 ypos 100 20 zdir (-.1.0) 1.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrldz in ( setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrldestname destname]; setEdCtrlButtonCb pickbtn2 mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlsourcename sourcename]; setEdCtrlButtonCb refreshdestname mkfun2 @cbRefreshBtn [ctrldestname]; setEdCtrlButtonCb refreshsourcename mkfun2 @cbRefreshBtn [ctrlsourcename]; setEdCtrlTextLineEnable ctrldestname 0; setEdCtrlTextLineEnable ctrlsourcename 0; setEdCtrlCheckState ctrlrbrotate !brotate; setEdCtrlCheckCbState ctrlrbrotate mkfun3 @cbCheckRotate ctrlrspeed; if brotate then nil else setEdCtrlFloatEnable ctrlrspeed 0; [mkfun1 @cbCloseEdit [ctrldestname ctrlsourcename ctrlfps ctrlspeed ctrlrspeed ctrlrbrotate ctrlft ctrlfc ctrlfb ctrldx ctrldy ctrldz] nil]; ); );;