/* ----------------------------------------------------------------------------- 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 ctrlspeed ctrlft ctrlfc ctrlfb] in let getEdCtrlTextLineValue ctrldestname -> destname in let getEdCtrlTextLineValue ctrlsourcename -> sourcename in let getEdCtrlFloatValue ctrlspeed -> speed in let getEdCtrlFloatValue ctrlft -> ft in let getEdCtrlFloatValue ctrlfc -> fc in let getEdCtrlFloatValue ctrlfb -> fb in ["destobject" destname]:: ["sourceobject" sourcename]:: ["speed" ftoa speed]:: ["T" ftoa ft]:: ["C" ftoa fc]:: ["B" ftoa fb]:: 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 cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; fun dynamicedit(winstr, inst, viewstr, applybtn)= let [420 160] -> [iw ih] in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "destobject") -> destname in let (getPluginInstanceParam inst "sourceobject") -> sourcename in //for compatibility let if (atoi (getPluginInstanceParam inst "iscamera")) == 1 then "Current camera" else sourcename -> sourcename in let atof (getPluginInstanceParam inst "speed") -> speed in let if speed == nil then 1.0 else speed -> speed 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 crEdCtrlLabel winstr 10 12 160 20 (loc "OS3DOBJECTGOTO_0006") nil -> labeltarget in let crEdCtrlTextLine winstr 180 10 140 20 sourcename nil EDWIN_RESIZE_MW -> ctrlsourcename in let crEdCtrlButton winstr 325 10 55 20 "..." nil -> pickbtn2 in let crEdCtrlButton winstr 385 10 35 20 "X" nil -> refreshsourcename in let crEdCtrlLabel winstr 10 37 160 20 (loc "OS3DOBJECTGOTO_0005") nil -> labelobj in let crEdCtrlTextLine winstr 180 35 140 20 destname nil EDWIN_RESIZE_MW -> ctrldestname in let crEdCtrlButton winstr 325 35 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 385 35 35 20 "X" nil -> refreshdestname in let crEdCtrlLabel winstr 10 62 160 20 (loc "OS3DOBJECTGOTO_0007") nil -> labelposy in let crEdCtrlFloat winstr 180 60 100 20 speed 0.01 2000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlspeed in let crEdCtrlLabel winstr 10 87 160 20 (loc "OS3DOBJECTGOTO_0008") nil -> labelft in let crEdCtrlFloat winstr 180 85 100 20 ft (-.1.0) 1.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlft in let crEdCtrlLabel winstr 10 112 160 20 (loc "OS3DOBJECTGOTO_0002") nil -> labelfc in let crEdCtrlFloat winstr 180 110 100 20 fc (-.1.0) 1.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlfc in let crEdCtrlLabel winstr 10 137 160 20 (loc "OS3DOBJECTGOTO_0001") nil -> labelfb in let crEdCtrlFloat winstr 180 135 100 20 fb (-.1.0) 1.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlfb in ( setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrldestname destname]; setEdCtrlButtonCb refreshdestname mkfun2 @cbRefreshBtn [ctrldestname]; setEdCtrlButtonCb pickbtn2 mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlsourcename sourcename]; setEdCtrlButtonCb refreshsourcename mkfun2 @cbRefreshBtn [ctrlsourcename]; setEdCtrlTextLineEnable ctrldestname 0; setEdCtrlTextLineEnable ctrlsourcename 0; [mkfun1 @cbCloseEdit [ctrldestname ctrlsourcename ctrlspeed ctrlft ctrlfc ctrlfb] nil]; ); );;