/* ----------------------------------------------------------------------------- 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 -> [ctrlobjname ctrltargetname ctrlfx ctrlfy ctrlfz] in let getEdCtrlTextLineValue ctrlobjname -> objname in let getEdCtrlTextLineValue ctrltargetname -> targetname in let getEdCtrlFloatValue ctrlfx -> ax in let getEdCtrlFloatValue ctrlfy -> ay in let getEdCtrlFloatValue ctrlfz -> az in ["object" objname]:: ["target" targetname]:: ["offsetx" ftoa ax]:: ["offsety" ftoa ay]:: ["offsetz" ftoa az]:: nil;; fun cbSelectObj(val, type, p)= let p -> [inst winstr viewstr ctrlobjname] 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 ctrlobjname val; ) else nil; 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 iTypeEntity|iTypeNode|iTypeBone|iTypeLight|iTypeCamera objname mkfun3 @cbSelectObj [inst winstr viewstr ctrlobjname] mkfun1 @cbCloseRes ctrlbtn 0; ); 0;; fun cbRefreshBtn(pickbtn, p)= let p -> [ctrlobjname] in setEdCtrlTextLineValue ctrlobjname ""; 0;; fun dynamicedit(winstr, inst, viewstr, applybtn)= let [420 130] -> [iw ih] in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "object") -> objname in let (getPluginInstanceParam inst "target") -> targetname in //for compatibility let if (atoi (getPluginInstanceParam inst "iscamera")) == 1 then "Current camera" else targetname -> targetname in let atof (getPluginInstanceParam inst "offsetx") -> ax in let atof (getPluginInstanceParam inst "offsety") -> ay in let atof (getPluginInstanceParam inst "offsetz") -> az in let if ax == nil then 0.0 else ax -> ax in let if ay == nil then 0.0 else ay -> ay in let if az == nil then 0.0 else az -> az in let crEdCtrlLabel winstr 10 12 160 20 (loc "OS3DPHYSICIMPULSE_0007") nil -> labelobj in let crEdCtrlTextLine winstr 180 10 140 20 objname nil EDWIN_RESIZE_MW -> ctrlobjname in let crEdCtrlButton winstr 325 10 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 385 10 35 20 "X" nil -> refreshobjname in let crEdCtrlLabel winstr 10 37 160 20 (loc "OS3DPHYSICIMPULSE_0003") nil -> labeltarget in let crEdCtrlTextLine winstr 180 35 140 20 targetname nil EDWIN_RESIZE_MW -> ctrltargetname in let crEdCtrlButton winstr 325 35 55 20 "..." nil -> pickbtn2 in let crEdCtrlButton winstr 385 35 35 20 "X" nil -> refreshtargetname in let crEdCtrlLabel winstr 10 62 160 20 (loc "OS3DPHYSICIMPULSE_0004") nil -> labelposx in let crEdCtrlFloat winstr 180 60 100 20 ax (-.100000.0) 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlfx in let crEdCtrlLabel winstr 10 87 160 20 (loc "OS3DPHYSICIMPULSE_0005") nil -> labelposy in let crEdCtrlFloat winstr 180 85 100 20 ay (-.100000.0) 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlfy in let crEdCtrlLabel winstr 10 112 160 20 (loc "OS3DPHYSICIMPULSE_0006") nil -> labelposz in let crEdCtrlFloat winstr 180 110 100 20 az (-.100000.0) 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlfz in ( setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname objname]; setEdCtrlButtonCb pickbtn2 mkfun2 @cbBtnPickObj [inst winstr viewstr ctrltargetname targetname]; setEdCtrlButtonCb refreshobjname mkfun2 @cbRefreshBtn [ctrlobjname]; setEdCtrlButtonCb refreshtargetname mkfun2 @cbRefreshBtn [ctrltargetname]; setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlTextLineEnable ctrltargetname 0; [mkfun1 @cbCloseEdit [ctrlobjname ctrltargetname ctrlfx ctrlfy ctrlfz] nil]; ); );;