/* ----------------------------------------------------------------------------- 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 ctrlforce ctrlatt] in let getEdCtrlTextLineValue ctrlobjname1 -> objname1 in let getEdCtrlTextLineValue ctrlobjname2 -> objname2 in let getEdCtrlFloatValue ctrlforce -> force in let getEdCtrlFloatValue ctrlatt -> distatt in ["object" objname1]:: ["object2" objname2]:: ["force" ftoa force]:: ["distatt" ftoa distatt]:: 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|iTypeLight|iTypeBone|iTypeCamera|iTypeParticle|iTypeCubeMap 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 115] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "object") -> objname1 in let (getPluginInstanceParam inst "object2") -> objname2 in let atof (getPluginInstanceParam inst "force") -> force in let if force == nil then 10.0 else force -> force in let atof (getPluginInstanceParam inst "distatt") -> distatt in let if distatt == nil then 0.1 else distatt -> distatt in let crEdCtrlLabel winstr 10 (ypos + 2) 160 20 (loc "OS3DPHYSICRAYIMP_0001") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 objname1 nil EDWIN_RESIZE_MW -> ctrlobjname1 in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn1 in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshobjname1 in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DPHYSICRAYIMP_0002") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 objname2 nil EDWIN_RESIZE_MW -> ctrlobjname2 in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn2 in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshobjname2 in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DPHYSICRAYIMP_0003") nil -> labelforce in let crEdCtrlFloat winstr 180 ypos 100 20 force (0.0) 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlforce in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DPHYSICRAYIMP_0004") nil -> labelatt in let crEdCtrlFloat winstr 180 ypos 100 20 distatt (0.0) 2.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlatt in ( setEdCtrlButtonCb pickbtn1 mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname1 objname1]; setEdCtrlTextLineEnable ctrlobjname1 0; setEdCtrlButtonCb refreshobjname1 mkfun2 @cbRefreshBtn [ctrlobjname1]; setEdCtrlButtonCb pickbtn2 mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname2 objname2]; setEdCtrlTextLineEnable ctrlobjname2 0; setEdCtrlButtonCb refreshobjname2 mkfun2 @cbRefreshBtn [ctrlobjname2]; [mkfun1 @cbCloseEdit [ctrlobjname1 ctrlobjname2 ctrlforce ctrlatt] nil]; ); );;