/* ----------------------------------------------------------------------------- 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 -> [ctrlobjname1 ctrlobjname2 ctrlelasticity ctrlstaticfriction ctrlkineticfriction ctrlsoftness ctrlthickness ctrlcollidable] in let getSelectedEdCtrlSelect ctrlobjname1 -> objname1 in let getSelectedEdCtrlSelect ctrlobjname2 -> objname2 in let getEdCtrlFloatValue ctrlelasticity -> elasticity in let getEdCtrlFloatValue ctrlstaticfriction -> staticfriction in let getEdCtrlFloatValue ctrlkineticfriction -> kineticfriction in let getEdCtrlFloatValue ctrlsoftness -> softness in let getEdCtrlFloatValue ctrlthickness -> thickness in let getEdCtrlCheckState ctrlcollidable -> collidable in ["mat1" objname1]:: ["mat2" objname2]:: ["elasticity" ftoa elasticity]:: ["staticfriction" ftoa staticfriction]:: ["kineticfriction" ftoa kineticfriction]:: ["softness" ftoa softness]:: ["thickness" ftoa thickness]:: ["collidable" itoa collidable]:: 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 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 iTypeEntity|iTypeNode|iTypeLight|iTypeCamera objname mkfun3 @cbSelectObj [inst winstr viewstr ctrlobjname] mkfun1 @cbCloseRes ctrlbtn 0; ); 0;; fun dynamicedit(winstr, inst, viewstr, applybtn)= let [400 210] -> [iw ih] in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "mat1") -> objname1 in let if objname1 == nil then "default" else objname1 -> objname1 in let (getPluginInstanceParam inst "mat2") -> objname2 in let if objname2 == nil then "default" else objname2 -> objname2 in let atof (getPluginInstanceParam inst "elasticity") -> elasticity in let atof (getPluginInstanceParam inst "staticfriction") -> staticfriction in let atof (getPluginInstanceParam inst "kineticfriction") -> kineticfriction in let atof (getPluginInstanceParam inst "softness") -> softness in let atof (getPluginInstanceParam inst "thickness") -> thickness in let atoi (getPluginInstanceParam inst "continious") -> continious in let atoi (getPluginInstanceParam inst "collidable") -> collidable in let if elasticity == nil then 0.4 else elasticity -> elasticity in let if staticfriction == nil then 0.9 else staticfriction -> staticfriction in let if kineticfriction == nil then 0.5 else kineticfriction -> kineticfriction in let if softness == nil then 0.1 else softness -> softness in let if thickness == nil then 0.0 else thickness -> thickness in let if collidable == nil then 1 else collidable -> collidable in let crEdCtrlLabel winstr 10 12 160 20 (loc "OS3DPHYSICCONTACT_0003") nil -> labelobj in let crEdCtrlSelect winstr 180 10 140 120 CB_AHSCROLL -> ctrlobjname1 in //let crEdCtrlTextLine winstr 180 10 140 20 objname1 nil EDWIN_RESIZE_MW -> ctrlobjname1 in //let crEdCtrlButton winstr 325 10 55 20 "..." nil -> pickbtn in let crEdCtrlLabel winstr 10 37 160 20 (loc "OS3DPHYSICCONTACT_0005") nil -> labeltarget in let crEdCtrlSelect winstr 180 35 140 120 CB_AHSCROLL -> ctrlobjname2 in //let crEdCtrlTextLine winstr 180 35 140 20 objname2 nil EDWIN_RESIZE_MW -> ctrlobjname2 in //let crEdCtrlButton winstr 325 35 55 20 "..." nil -> pickbtn2 in let crEdCtrlLabel winstr 10 62 160 20 (loc "OS3DPHYSICCONTACT_0002") nil -> labelelasticity in let crEdCtrlFloat winstr 180 60 100 20 elasticity 0.0 10.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlelasticity in let crEdCtrlLabel winstr 10 87 160 20 (loc "OS3DPHYSICCONTACT_0006") nil -> labelsoftness in let crEdCtrlFloat winstr 180 85 100 20 softness 0.0 10.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlsoftness in let crEdCtrlLabel winstr 10 112 160 20 (loc "OS3DPHYSICCONTACT_0008") nil -> labelthickness in let crEdCtrlFloat winstr 180 110 100 20 thickness 0.0 10000.0 0.001 4 nil EDWIN_RESIZE_MW -> ctrlthickness in let crEdCtrlLabel winstr 10 137 160 20 (loc "OS3DPHYSICCONTACT_0007") nil -> labelstfriction in let crEdCtrlFloat winstr 180 135 100 20 staticfriction 0.01 2.0 0.01 2 nil EDWIN_RESIZE_MW -> ctrlstaticfriction in let crEdCtrlLabel winstr 10 162 160 20 (loc "OS3DPHYSICCONTACT_0004") nil -> labelkfriction in let crEdCtrlFloat winstr 180 160 100 20 kineticfriction 0.01 2.0 0.01 2 nil EDWIN_RESIZE_MW -> ctrlkineticfriction in let crEdCtrlCheck winstr 10 185 280 20 (loc "OS3DPHYSICCONTACT_0001") EDWIN_RESIZE_MW -> ctrlcollidable in ( fillEdCtrlSelect ctrlobjname1 lPhysicMaterial; selectEdCtrlSelect ctrlobjname1 objname1; fillEdCtrlSelect ctrlobjname2 lPhysicMaterial; selectEdCtrlSelect ctrlobjname2 objname2; //setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname1 objname1]; //setEdCtrlButtonCb pickbtn2 mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname2 objname2]; //setEdCtrlTextLineEnable ctrlobjname1 0; //setEdCtrlTextLineEnable ctrlobjname2 0; setEdCtrlCheckState ctrlcollidable collidable; [mkfun1 @cbCloseEdit [ctrlobjname1 ctrlobjname2 ctrlelasticity ctrlstaticfriction ctrlkineticfriction ctrlsoftness ctrlthickness ctrlcollidable] nil]; ); );;