/* ----------------------------------------------------------------------------- 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 ctrlposx ctrlposy ctrlposz ctrloffx ctrloffy ctrloffz ctrlrx ctrlry ctrlrz ctrlinit] in let getEdCtrlTextLineValue ctrlobjname -> objname in let getEdCtrlTextLineValue ctrltargetname -> targetname in let getEdCtrlFloatValue ctrlposx -> posx in let getEdCtrlFloatValue ctrlposy -> posy in let getEdCtrlFloatValue ctrlposz -> posz in let getEdCtrlFloatValue ctrloffx -> offx in let getEdCtrlFloatValue ctrloffy -> offy in let getEdCtrlFloatValue ctrloffz -> offz in let getEdCtrlCheckState ctrlrx -> xaxis in let getEdCtrlCheckState ctrlry -> yaxis in let getEdCtrlCheckState ctrlrz -> zaxis in let getEdCtrlCheckState ctrlinit -> init in ["object" objname]:: ["target" targetname]:: ["dirx" ftoa posx]:: ["diry" ftoa posy]:: ["dirz" ftoa posz]:: ["offx" ftoa offx]:: ["offy" ftoa offy]:: ["offz" ftoa offz]:: ["xaxis" itoa xaxis]:: ["yaxis" itoa yaxis]:: ["zaxis" itoa zaxis]:: ["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] in ( setEdCtrlButtonEnable ctrlbtn 0; dlgSelectPluginInstanceResource inst winstr iTypeGroup|iTypeEntity|iTypeNode|iTypeLight|iTypeCamera|iTypeParticle|iTypeBone|iTypeCubeMap|iTypeReflectionMap 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(ewinstr, inst, viewstr, applybtn)= let [420 460] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr 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 "dirx") -> posx in let atof (getPluginInstanceParam inst "diry") -> posy in let atof (getPluginInstanceParam inst "dirz") -> posz 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 -.1.0 else posz -> posz in let atof (getPluginInstanceParam inst "offx") -> offx in let atof (getPluginInstanceParam inst "offy") -> offy in let atof (getPluginInstanceParam inst "offz") -> offz in let if offx == nil then 0.0 else offx -> offx in let if offy == nil then 0.0 else offy -> offy in let if offz == nil then 0.0 else offz -> offz in let atoi (getPluginInstanceParam inst "xaxis") -> xaxis in let atoi (getPluginInstanceParam inst "yaxis") -> yaxis in let atoi (getPluginInstanceParam inst "zaxis") -> zaxis in let if xaxis == nil then 1 else xaxis -> xaxis in let if yaxis == nil then 1 else yaxis -> yaxis in let if zaxis == nil then 1 else zaxis -> zaxis in let atoi (getPluginInstanceParam inst "init") -> init in let crEdFrameWindow _channel ewinstr 0 0 iw 80 EDWIN_RESIZE_MW nil (loc "OS3DTARGET_0011") (loc "OS3DTARGET_0009") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 60 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (set ypos = 10) + 2 160 20 (loc "OS3DTARGET_0019") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 140 20 objname nil EDWIN_RESIZE_MW -> ctrlobjname in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshobjname in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DTARGET_0020") nil -> labeltarget in let crEdCtrlTextLine winstr 180 ypos 140 20 targetname nil EDWIN_RESIZE_MW -> ctrltargetname in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickbtn2 in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshtargetname in let crEdFrameWindow _channel ewinstr 0 0 iw 110 EDWIN_RESIZE_MW nil (loc "OS3DTARGET_0007") (loc "OS3DTARGET_0009") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 90 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (set ypos = 10) + 2 160 20 (loc "OS3DTARGET_0004") nil -> labelposx in let crEdCtrlFloat winstr 180 ypos 100 20 posx (-.1.0) 1.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlposx in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DTARGET_0005") nil -> labelposy in let crEdCtrlFloat winstr 180 ypos 100 20 posy (-.1.0) 1.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlposy in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DTARGET_0006") nil -> labelposz in let crEdCtrlFloat winstr 180 ypos 100 20 posz (-.1.0) 1.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlposz in let crEdFrameWindow _channel ewinstr 0 0 iw 110 EDWIN_RESIZE_MW nil (loc "OS3DTARGET_0015") (loc "OS3DTARGET_0009") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 90 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (set ypos = 10) + 2 160 20 (loc "OS3DTARGET_0012") nil -> labeloffx in let crEdCtrlFloat winstr 180 ypos 100 20 offx (-.180.0) 180.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrloffx in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DTARGET_0013") nil -> labeloffy in let crEdCtrlFloat winstr 180 ypos 100 20 offy (-.180.0) 180.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrloffy in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DTARGET_0014") nil -> labeloffz in let crEdCtrlFloat winstr 180 ypos 100 20 offz (-.180.0) 180.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrloffz in let crEdFrameWindow _channel ewinstr 0 0 iw 110 EDWIN_RESIZE_MW nil (loc "OS3DTARGET_0001") (loc "OS3DTARGET_0009") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 90 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlCheck winstr 10 (set ypos = 10) 280 20 (loc "OS3DTARGET_0016") EDWIN_RESIZE_MW -> ctrlrx in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DTARGET_0017") EDWIN_RESIZE_MW -> ctrlry in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DTARGET_0018") EDWIN_RESIZE_MW -> ctrlrz in let crEdFrameWindow _channel ewinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3DTARGET_0010") (loc "OS3DTARGET_0009") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlCheck winstr 10 (set ypos = 10) 280 20 (loc "OS3DTARGET_0008") EDWIN_RESIZE_MW -> ctrlinit 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; setEdCtrlCheckState ctrlrx xaxis; setEdCtrlCheckState ctrlry yaxis; setEdCtrlCheckState ctrlrz zaxis; setEdCtrlCheckState ctrlinit init; [mkfun1 @cbCloseEdit [ctrlobjname ctrltargetname ctrlposx ctrlposy ctrlposz ctrloffx ctrloffy ctrloffz ctrlrx ctrlry ctrlrz ctrlinit] nil]; ); );;