/* ----------------------------------------------------------------------------- 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 ctrlobjnameson ctrlposx ctrlposy ctrlposz ctrlax ctrlay ctrlaz ctrlreset ctrlinit] in let getEdCtrlTextLineValue ctrlobjname -> objname in let getEdCtrlTextLineValue ctrlobjnameson -> objnameson in let getEdCtrlFloatValue ctrlposx -> posx in let getEdCtrlFloatValue ctrlposy -> posy in let getEdCtrlFloatValue ctrlposz -> posz in let getEdCtrlFloatValue ctrlax -> ax in let getEdCtrlFloatValue ctrlay -> ay in let getEdCtrlFloatValue ctrlaz -> az in let getEdCtrlCheckState ctrlreset -> reset in let getEdCtrlCheckState ctrlinit -> init in ["object" objname]:: ["objectson" objnameson]:: ["posx" ftoa posx]:: ["posy" ftoa posy]:: ["posz" ftoa posz]:: ["angx" ftoa ax]:: ["angy" ftoa ay]:: ["angz" ftoa az]:: ["reset" itoa reset]:: ["init" itoa init]:: 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 types] in ( setEdCtrlButtonEnable ctrlbtn 0; dlgSelectPluginInstanceResource inst winstr types 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 265] -> [iw ih] in ( setEdWindowSize winstr iw ih; let (getPluginInstanceParam inst "object") -> objname in //for compatibility let if (atoi (getPluginInstanceParam inst "iscamera")) == 1 then "Current camera" else objname -> objname in let (getPluginInstanceParam inst "objectson") -> objsonname in let atof (getPluginInstanceParam inst "posx") -> posx in let atof (getPluginInstanceParam inst "posy") -> posy in let atof (getPluginInstanceParam inst "posz") -> posz in let atof (getPluginInstanceParam inst "angx") -> ax in let atof (getPluginInstanceParam inst "angy") -> ay in let atof (getPluginInstanceParam inst "angz") -> az in let atoi (getPluginInstanceParam inst "reset") -> reset in let if reset == nil then 1 else reset -> reset in let atoi (getPluginInstanceParam inst "init") -> init in let if posx == nil then 0.0 else posx -> posx in let if posy == nil then 0.0 else posy -> posy in let if posz == nil then 0.0 else posz -> posz 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 "OS3DOBJECTLINK_0006") 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 "OS3DOBJECTLINK_0011") nil -> labelobjson in let crEdCtrlTextLine winstr 180 35 140 20 objsonname nil EDWIN_RESIZE_MW -> ctrlobjnameson in let crEdCtrlButton winstr 325 35 55 20 "..." nil -> pickbtnson in let crEdCtrlButton winstr 385 35 35 20 "X" nil -> refreshobjnameson in let crEdCtrlLabel winstr 10 62 160 20 (loc "OS3DOBJECTLINK_0008") nil -> labelposx in let crEdCtrlFloat winstr 180 60 100 20 posx (-.100000.0) 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlposx in let crEdCtrlLabel winstr 10 87 160 20 (loc "OS3DOBJECTLINK_0009") nil -> labelposy in let crEdCtrlFloat winstr 180 85 100 20 posy (-.100000.0) 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlposy in let crEdCtrlLabel winstr 10 112 160 20 (loc "OS3DOBJECTLINK_0010") nil -> labelposz in let crEdCtrlFloat winstr 180 110 100 20 posz (-.100000.0) 100000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlposz in let crEdCtrlLabel winstr 10 137 160 20 (loc "OS3DOBJECTLINK_0001") nil -> labelax in let crEdCtrlFloat winstr 180 135 100 20 ax (-.720.0) 720.0 1.0 2 nil EDWIN_RESIZE_MW -> ctrlax in let crEdCtrlLabel winstr 10 162 160 20 (loc "OS3DOBJECTLINK_0002") nil -> labelay in let crEdCtrlFloat winstr 180 160 100 20 ay (-.720.0) 720.0 1.0 2 nil EDWIN_RESIZE_MW -> ctrlay in let crEdCtrlLabel winstr 10 187 160 20 (loc "OS3DOBJECTLINK_0003") nil -> labelaz in let crEdCtrlFloat winstr 180 185 100 20 az (-.720.0) 720.0 1.0 2 nil EDWIN_RESIZE_MW -> ctrlaz in let crEdCtrlCheck winstr 10 210 280 20 (loc "OS3DOBJECTLINK_0012") EDWIN_RESIZE_MW -> ctrlreset in let crEdCtrlCheck winstr 10 235 280 20 (loc "OS3DOBJECTLINK_0007") EDWIN_RESIZE_MW -> ctrlinit in ( setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjname objname iTypeEntity|iTypeNode|iTypeLight|iTypeCamera|iTypeBone|iTypeParticle|iTypeGroup|iTypeCubeMap]; setEdCtrlButtonCb pickbtnson mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjnameson objsonname iTypeEntity|iTypeNode|iTypeLight|iTypeCamera|iTypeParticle|iTypeCubeMap|iTypeGroup]; setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlTextLineEnable ctrlobjnameson 0; setEdCtrlButtonCb refreshobjname mkfun2 @cbRefreshBtn [ctrlobjname]; setEdCtrlButtonCb refreshobjnameson mkfun2 @cbRefreshBtn [ctrlobjnameson]; setEdCtrlCheckState ctrlreset reset; setEdCtrlCheckState ctrlinit init; [mkfun1 @cbCloseEdit [ctrlobjname ctrlobjnameson ctrlposx ctrlposy ctrlposz ctrlax ctrlay ctrlaz ctrlreset ctrlinit] nil]; ); );;