/* ----------------------------------------------------------------------------- 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 -> [ctrlobjl [ctrlloffposx ctrlloffposy ctrlloffposz ctrlloffangx ctrlloffangy ctrlloffangz ctrllraystate] ctrlobjr [ctrlroffposx ctrlroffposy ctrlroffposz ctrlroffangx ctrlroffangy ctrlroffangz ctrlrraystate] ctrlignorephys ctrlshowray ctrlraysrcl ctrlraysrcr ctrlautoclick ctrlautoclickdist ctrlscaleratio ctrlinitialpos ctrlhandtracking ctrlpassthrough ctrlinit ctrlteleport ctrlteleportcontroller] in let getEdCtrlTextLineValue ctrlobjl -> objlname in let getEdCtrlFloatValue ctrlloffposx -> loffposx in let getEdCtrlFloatValue ctrlloffposy -> loffposy in let getEdCtrlFloatValue ctrlloffposz -> loffposz in let getEdCtrlFloatValue ctrlloffangx -> loffangx in let getEdCtrlFloatValue ctrlloffangy -> loffangy in let getEdCtrlFloatValue ctrlloffangz -> loffangz in let getEdCtrlCheckState ctrllraystate -> lraystate in let getEdCtrlTextLineValue ctrlobjr -> objrname in let getEdCtrlFloatValue ctrlroffposx -> roffposx in let getEdCtrlFloatValue ctrlroffposy -> roffposy in let getEdCtrlFloatValue ctrlroffposz -> roffposz in let getEdCtrlFloatValue ctrlroffangx -> roffangx in let getEdCtrlFloatValue ctrlroffangy -> roffangy in let getEdCtrlFloatValue ctrlroffangz -> roffangz in let getEdCtrlCheckState ctrlrraystate -> rraystate in let getEdCtrlCheckState ctrlignorephys -> ignorecontrphys in let getSelectedEdCtrlSelectPos ctrlshowray -> showray in let getEdCtrlTextLineValue ctrlraysrcl -> raysrcl in let getEdCtrlTextLineValue ctrlraysrcr -> raysrcr in let getEdCtrlCheckState ctrlautoclick -> autoclick in let getEdCtrlFloatValue ctrlautoclickdist -> autoclickdist in let getEdCtrlFloatValue ctrlscaleratio -> scaleratio in let getEdCtrlCheckState ctrlinitialpos -> initialpos in let getEdCtrlCheckState ctrlhandtracking -> handtracking in let getEdCtrlCheckState ctrlpassthrough -> passthrough in let getEdCtrlCheckState ctrlinit -> init in let getSelectedEdCtrlSelectPos ctrlteleport -> teleport in let getSelectedEdCtrlSelectPos ctrlteleportcontroller -> teleportcontroller in ["leftController" objlname]:: ["loffposx" ftoa loffposx]:: ["loffposy" ftoa loffposy]:: ["loffposz" ftoa loffposz]:: ["loffangx" ftoa loffangx]:: ["loffangy" ftoa loffangy]:: ["loffangz" ftoa loffangz]:: ["lraystate" itoa lraystate]:: ["rightController" objrname]:: ["roffposx" ftoa roffposx]:: ["roffposy" ftoa roffposy]:: ["roffposz" ftoa roffposz]:: ["roffangx" ftoa roffangx]:: ["roffangy" ftoa roffangy]:: ["roffangz" ftoa roffangz]:: ["rraystate" itoa rraystate]:: ["ignorecontrphys" itoa ignorecontrphys]:: ["useinitialposition" itoa initialpos]:: ["handtracking" itoa handtracking]:: ["passthrough" itoa passthrough]:: ["init" itoa init]:: ["showray" itoa showray]:: ["raysrcl" raysrcl]:: ["raysrcr" raysrcr]:: ["autoclick" itoa autoclick]:: ["autoclickdist" ftoa autoclickdist]:: ["teleportmode" itoa teleport]:: ["teleportcontroller" itoa teleportcontroller]:: ["scaleratio" ftoa scaleratio]:: nil;; fun cbCloseRes(ctrlbtn)= setEdCtrlButtonEnable ctrlbtn 1; 0;; 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 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 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 [455 490] -> [iw ih] in let 10 -> ypos in ( let getPluginInstanceParam inst "leftController" -> objlname in let atof (getPluginInstanceParam inst "loffposx") -> loffposx in let if loffposx == nil then 0.0 else loffposx -> loffposx in let atof (getPluginInstanceParam inst "loffposy") -> loffposy in let if loffposy == nil then 0.0 else loffposy -> loffposy in let atof (getPluginInstanceParam inst "loffposz") -> loffposz in let if loffposz == nil then 0.0 else loffposz -> loffposz in let atof (getPluginInstanceParam inst "loffangx") -> loffangx in let if loffangx == nil then 0.0 else loffangx -> loffangx in let atof (getPluginInstanceParam inst "loffangy") -> loffangy in let if loffangy == nil then 0.0 else loffangy -> loffangy in let atof (getPluginInstanceParam inst "loffangz") -> loffangz in let if loffangz == nil then 0.0 else loffangz -> loffangz in let atoi (getPluginInstanceParam inst "lraystate") -> lraystate in let if (lraystate == nil) then 1 else lraystate -> lraystate in let getPluginInstanceParam inst "rightController" -> objrname in let atof (getPluginInstanceParam inst "roffposx") -> roffposx in let if roffposx == nil then 0.0 else roffposx -> roffposx in let atof (getPluginInstanceParam inst "roffposy") -> roffposy in let if roffposy == nil then 0.0 else roffposy -> roffposy in let atof (getPluginInstanceParam inst "roffposz") -> roffposz in let if roffposz == nil then 0.0 else roffposz -> roffposz in let atof (getPluginInstanceParam inst "roffangx") -> roffangx in let if roffangx == nil then 0.0 else roffangx -> roffangx in let atof (getPluginInstanceParam inst "roffangy") -> roffangy in let if roffangy == nil then 0.0 else roffangy -> roffangy in let atof (getPluginInstanceParam inst "roffangz") -> roffangz in let if roffangz == nil then 0.0 else roffangz -> roffangz in let atoi (getPluginInstanceParam inst "rraystate") -> rraystate in let if (rraystate == nil) then 1 else rraystate -> rraystate in let atoi (getPluginInstanceParam inst "showray") -> showray in let if (showray == nil) then 1 else showray -> showray in let getPluginInstanceParam inst "raysrcl" -> raysrcl in let getPluginInstanceParam inst "raysrcr" -> raysrcr in let atoi (getPluginInstanceParam inst "autoclick") -> autoclick in let if (autoclick == nil) then 0 else autoclick -> autoclick in let atof (getPluginInstanceParam inst "autoclickdist") -> autoclickdist in let if (autoclickdist == nil) then 0.05 else autoclickdist -> autoclickdist in let atof (getPluginInstanceParam inst "scaleratio") -> scaleratio in let if (scaleratio == nil) then 1.0 else scaleratio -> scaleratio in let atoi (getPluginInstanceParam inst "teleportmode") -> teleportmode in let if (teleportmode == nil) then 0 else teleportmode -> teleportmode in let atoi (getPluginInstanceParam inst "teleportcontroller") -> teleportcontroller in let if (teleportcontroller == nil) then 0 else teleportcontroller -> teleportcontroller in let atoi (getPluginInstanceParam inst "ignorecontrphys") -> ignorecontrphys in let if (ignorecontrphys == nil) then 1 else ignorecontrphys -> ignorecontrphys in let atoi (getPluginInstanceParam inst "useinitialposition") -> initialpos in let if (initialpos == nil) then 0 else initialpos -> initialpos in let atoi (getPluginInstanceParam inst "handtracking") -> handtracking in let if (handtracking == nil) then 1 else handtracking -> handtracking in let atoi (getPluginInstanceParam inst "passthrough") -> passthrough in let if (passthrough == nil) then 0 else passthrough -> passthrough in let atoi(getPluginInstanceParam inst "init") -> init in let if init == nil then 1 else init -> init in let if (autoclick || ((raysrcl != nil) && (strcmp raysrcl "")) || ((raysrcr != nil) && (strcmp raysrcr ""))) then 1 else 0 -> haverayopt in ( if !haverayopt then nil else set ih = ih + 130; setEdWindowSize ewinstr iw ih; let crEdFrameWindow _channel ewinstr 0 0 iw 265 EDWIN_RESIZE_MW nil (loc "OS3DOPENXR_0001") (loc "OS3DOPENXR_0002") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 245 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DOPENXR_0003") nil -> labelleft in let crEdCtrlTextLine winstr 180 ypos 140 20 objlname nil EDWIN_RESIZE_MW -> ctrlobjl in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> picklbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshobjlname in let crEdCtrlLabel winstr 25 ((set ypos = ypos + 25) + 2) 145 20 (loc "OS3DOPENXR_0041") nil -> labelloffp in let crEdCtrlLabel winstr 180 (ypos + 2) 10 20 "X" nil -> labelloffpx in let crEdCtrlFloat winstr 193 ypos 60 20 loffposx (-.100000.0) 100000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlloffposx in let crEdCtrlLabel winstr 263 (ypos + 2) 10 20 "Y" nil -> labelloffpy in let crEdCtrlFloat winstr 276 ypos 60 20 loffposy (-.100000.0) 100000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlloffposy in let crEdCtrlLabel winstr 346 (ypos + 2) 10 20 "Z" nil -> labelloffpz in let crEdCtrlFloat winstr 359 ypos 60 20 loffposz (-.100000.0) 100000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlloffposz in let crEdCtrlLabel winstr 25 ((set ypos = ypos + 25) + 2) 145 20 (loc "OS3DOPENXR_0042") nil -> labelloffo in let crEdCtrlLabel winstr 180 (ypos + 2) 10 20 "X" nil -> labelloffox in let crEdCtrlFloat winstr 193 ypos 60 20 loffangx (-.180.0) 180.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlloffangx in let crEdCtrlLabel winstr 263 (ypos + 2) 10 20 "Y" nil -> labelloffoy in let crEdCtrlFloat winstr 276 ypos 60 20 loffangy (-.180.0) 180.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlloffangy in let crEdCtrlLabel winstr 346 (ypos + 2) 10 20 "Z" nil -> labelloffoz in let crEdCtrlFloat winstr 359 ypos 60 20 loffangz (-.180.0) 180.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlloffangz in let crEdCtrlCheck winstr 25 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DOPENXR_0057") EDWIN_RESIZE_MW -> ctrllraystate in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 35) + 2) 160 20 (loc "OS3DOPENXR_0004") nil -> labelright in let crEdCtrlTextLine winstr 180 ypos 140 20 objrname nil EDWIN_RESIZE_MW -> ctrlobjr in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickrbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshobjrname in let crEdCtrlLabel winstr 25 ((set ypos = ypos + 25) + 2) 145 20 (loc "OS3DOPENXR_0041") nil -> labelroffp in let crEdCtrlLabel winstr 180 (ypos + 2) 10 20 "X" nil -> labelroffpx in let crEdCtrlFloat winstr 193 ypos 60 20 roffposx (-.100000.0) 100000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlroffposx in let crEdCtrlLabel winstr 263 (ypos + 2) 10 20 "Y" nil -> labelroffpy in let crEdCtrlFloat winstr 276 ypos 60 20 roffposy (-.100000.0) 100000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlroffposy in let crEdCtrlLabel winstr 346 (ypos + 2) 10 20 "Z" nil -> labelroffpz in let crEdCtrlFloat winstr 359 ypos 60 20 roffposz (-.100000.0) 100000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlroffposz in let crEdCtrlLabel winstr 25 ((set ypos = ypos + 25) + 2) 145 20 (loc "OS3DOPENXR_0042") nil -> labelroffo in let crEdCtrlLabel winstr 180 (ypos + 2) 10 20 "X" nil -> labelroffox in let crEdCtrlFloat winstr 193 ypos 60 20 roffangx (-.180.0) 180.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlroffangx in let crEdCtrlLabel winstr 263 (ypos + 2) 10 20 "Y" nil -> labelroffoy in let crEdCtrlFloat winstr 276 ypos 60 20 roffangy (-.180.0) 180.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlroffangy in let crEdCtrlLabel winstr 346 (ypos + 2) 10 20 "Z" nil -> labelroffoz in let crEdCtrlFloat winstr 359 ypos 60 20 roffangz (-.180.0) 180.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlroffangz in let crEdCtrlCheck winstr 25 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DOPENXR_0057") EDWIN_RESIZE_MW -> ctrlrraystate in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DOPENXR_0032") EDWIN_RESIZE_MW -> ctrlignorephys in let crEdFrameWindowEx _channel ewinstr 0 0 iw 155 EDWIN_RESIZE_MW nil (loc "OS3DOPENXR_0049") (loc "OS3DOPENXR_0002") !haverayopt -> winfrm in let crEdWindow _channel winfrm 0 18 iw 145 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 170 20 (loc "OS3DOPENXR_0031") nil -> labelray in let crEdCtrlSelect winstr 180 ypos (iw - 180) 120 EDWIN_RESIZE_MW -> ctrlshowray in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DOPENXR_0050") EDWIN_RESIZE_MW -> ctrlautoclick in let crEdCtrlLabel winstr 15 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOPENXR_0051") nil -> labeldist in let crEdCtrlFloat winstr 185 ypos 100 20 autoclickdist 0.001 100.0 0.01 3 nil EDWIN_RESIZE_MW -> ctrlautoclickdist in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOPENXR_0052") nil -> labelleft in let crEdCtrlTextLine winstr 180 ypos 140 20 raysrcl nil EDWIN_RESIZE_MW -> ctrlraysrcl in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickraysrclbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshraysrclname in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOPENXR_0053") nil -> labelright in let crEdCtrlTextLine winstr 180 ypos 140 20 raysrcr nil EDWIN_RESIZE_MW -> ctrlraysrcr in let crEdCtrlButton winstr 325 ypos 55 20 "..." nil -> pickraysrcrbtn in let crEdCtrlButton winstr 385 ypos 35 20 "X" nil -> refreshraysrcrname in let crEdFrameWindow _channel ewinstr 0 0 iw 200 EDWIN_RESIZE_MW nil (loc "OS3DOPENXR_0029") (loc "OS3DOPENXR_0002") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 180 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (set ypos = 10) + 2 160 20 (loc "OS3DOPENXR_0033") nil -> labelteleport in let crEdCtrlSelect winstr 180 ypos 200 120 EDWIN_RESIZE_MW -> ctrlteleport in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3DOPENXR_0034") nil -> labelteleportctrl in let crEdCtrlSelect winstr 180 ypos 200 120 EDWIN_RESIZE_MW -> ctrlteleportcontroller in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DOPENXR_0058") nil -> labelscaleratio in let crEdCtrlFloat winstr 180 ypos 100 20 scaleratio 0.25 2.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlscaleratio in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DOPENXR_0061") EDWIN_RESIZE_MW -> ctrlinitialpos in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DOPENXR_0059") EDWIN_RESIZE_MW -> ctrlhandtracking in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DOPENXR_0060") EDWIN_RESIZE_MW -> ctrlpassthrough in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3DOPENXR_0030") EDWIN_RESIZE_MW -> ctrlinit in ( fillEdCtrlSelect ctrlshowray (loc "OS3DOPENXR_0054")::(loc "OS3DOPENXR_0055")::(loc "OS3DOPENXR_0056")::nil; selectEdCtrlSelectByPos ctrlshowray showray; setEdCtrlCheckState ctrllraystate lraystate; setEdCtrlCheckState ctrlrraystate rraystate; setEdCtrlCheckState ctrlautoclick autoclick; setEdCtrlCheckState ctrlignorephys ignorecontrphys; fillEdCtrlSelect ctrlteleport (loc "OS3DOPENXR_0035")::(loc "OS3DOPENXR_0036")::(loc "OS3DOPENXR_0037")::nil; selectEdCtrlSelectByPos ctrlteleport teleportmode; fillEdCtrlSelect ctrlteleportcontroller (loc "OS3DOPENXR_0038")::(loc "OS3DOPENXR_0039")::(loc "OS3DOPENXR_0040")::nil; selectEdCtrlSelectByPos ctrlteleportcontroller teleportcontroller; setEdCtrlButtonCb picklbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjl objlname]; setEdCtrlTextLineEnable ctrlobjl 0; setEdCtrlButtonCb refreshobjlname mkfun2 @cbRefreshBtn [ctrlobjl]; setEdCtrlButtonCb pickrbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlobjr objrname]; setEdCtrlTextLineEnable ctrlobjr 0; setEdCtrlButtonCb refreshobjrname mkfun2 @cbRefreshBtn [ctrlobjr]; setEdCtrlButtonCb pickraysrclbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlraysrcl raysrcl]; setEdCtrlTextLineEnable ctrlraysrcl 0; setEdCtrlButtonCb refreshraysrclname mkfun2 @cbRefreshBtn [ctrlraysrcl]; setEdCtrlButtonCb pickraysrcrbtn mkfun2 @cbBtnPickObj [inst winstr viewstr ctrlraysrcr raysrcr]; setEdCtrlTextLineEnable ctrlraysrcr 0; setEdCtrlButtonCb refreshraysrcrname mkfun2 @cbRefreshBtn [ctrlraysrcr]; setEdCtrlCheckState ctrlinitialpos initialpos; setEdCtrlCheckState ctrlhandtracking handtracking; setEdCtrlCheckState ctrlpassthrough passthrough; setEdCtrlCheckState ctrlinit init; [mkfun1 @cbCloseEdit [ctrlobjl [ctrlloffposx ctrlloffposy ctrlloffposz ctrlloffangx ctrlloffangy ctrlloffangz ctrllraystate] ctrlobjr [ctrlroffposx ctrlroffposy ctrlroffposz ctrlroffangx ctrlroffangy ctrlroffangz ctrlrraystate] ctrlignorephys ctrlshowray ctrlraysrcl ctrlraysrcr ctrlautoclick ctrlautoclickdist ctrlscaleratio ctrlinitialpos ctrlhandtracking ctrlpassthrough ctrlinit ctrlteleport ctrlteleportcontroller] nil]; ); ); );;