/* ----------------------------------------------------------------------------- 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 -> [posstr ctrlobjname ctrlxmargin ctrlymargin ctrlxoffset ctrlyoffset ctrlbg ctrlnodes ctrlobjects ctrlcameras ctrllights ctrlbones ctrlgroups theltselector ctrlshow] in let getEdCtrlTextLineValue ctrlobjname -> objname in let ftoi getEdCtrlFloatValue ctrlxmargin -> xmargin in let ftoi getEdCtrlFloatValue ctrlymargin -> ymargin in let ftoi getEdCtrlFloatValue ctrlxoffset -> levelxoffset in let ftoi getEdCtrlFloatValue ctrlyoffset -> levelyoffset in let getEdCtrlCheckState ctrlbg -> background in let getEdCtrlCheckState ctrlnodes -> nodes in let getEdCtrlCheckState ctrlobjects -> objects in let getEdCtrlCheckState ctrlcameras -> cameras in let getEdCtrlCheckState ctrllights -> lights in let getEdCtrlCheckState ctrlbones -> bones in let getEdCtrlCheckState ctrlgroups -> groups in let getThemeEltSelectorSave theltselector -> thdefsave in let getEdCtrlCheckState ctrlshow -> show in let getInterfaceSaveData posstr -> possave in ["objname" objname]:: ["xmargin" itoa xmargin]:: ["ymargin" itoa ymargin]:: ["levelxoffset" itoa levelxoffset]:: ["levelyoffset" itoa levelyoffset]:: ["background" itoa background]:: ["nodes" itoa nodes]:: ["objects" itoa objects]:: ["cameras" itoa cameras]:: ["lights" itoa lights]:: ["bones" itoa bones]:: ["groups" itoa groups]:: ["show" itoa show]:: (lcat possave thdefsave);; fun cbSelectObj(val, type, p)= let p -> [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 nil objname mkfun3 @cbSelectObj [viewstr ctrlobjname] mkfun1 @cbCloseRes ctrlbtn 0; ); 0;; fun cbRefreshBtn(pickbtn, ctrlobjname)= setEdCtrlTextLineValue ctrlobjname ""; 0;; fun dynamicedit(ewinstr, inst, viewstr, applybtn)= let [455 250] -> [iw ih] in let 10 -> ypos in ( setEdWindowSize ewinstr iw ih; let getPluginInstanceParam inst "objname" -> objname in let if (objname == nil) then "" else objname -> objname in let atoi (getPluginInstanceParam inst "xmargin") -> xmargin in let if (xmargin == nil) then 5 else xmargin -> xmargin in let atoi (getPluginInstanceParam inst "ymargin") -> ymargin in let if (ymargin == nil) then 5 else ymargin -> ymargin in let atoi (getPluginInstanceParam inst "levelxoffset") -> levelxoffset in let if (levelxoffset == nil) then 10 else levelxoffset -> levelxoffset in let atoi (getPluginInstanceParam inst "levelyoffset") -> levelyoffset in let if (levelyoffset == nil) then 0 else levelyoffset -> levelyoffset in let atoi (getPluginInstanceParam inst "background") -> background in let if (background == nil) then 0 else background -> background in let atoi (getPluginInstanceParam inst "nodes") -> nodes in let if (nodes == nil) then 1 else nodes -> nodes in let atoi (getPluginInstanceParam inst "objects") -> objects in let if (objects == nil) then 1 else objects -> objects in let atoi (getPluginInstanceParam inst "cameras") -> cameras in let if (cameras == nil) then 0 else cameras -> cameras in let atoi (getPluginInstanceParam inst "lights") -> lights in let if (lights == nil) then 0 else lights -> lights in let atoi (getPluginInstanceParam inst "bones") -> bones in let if (bones == nil) then 0 else bones -> bones in let atoi (getPluginInstanceParam inst "groups") -> groups in let if (groups == nil) then 0 else groups -> groups in let atoi (getPluginInstanceParam inst "show") -> show in let if (show == nil) then 1 else show -> show in let crPositionInterface inst viewstr ewinstr nil (iPOS_INTERFACE_2D_NO_BACKGROUND_NO_KEEPRATIO | iPOS_INTERFACE_MAT | iPOS_INTERFACE_3D | iPOS_INTERFACE_VR) iw ih -> posstr in let crEdFrameWindow _channel ewinstr 0 0 iw 185 EDWIN_RESIZE_MW nil (loc "OS3DSCENETREE_0002") (loc "OS3DSCENETREE_0005") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 160 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3DSCENETREE_0015") nil -> labelobj in let crEdCtrlTextLine winstr 180 ypos 175 20 objname nil EDWIN_RESIZE_MW -> ctrlobjname in let crEdCtrlButton winstr 360 ypos 55 20 "..." nil -> pickbtn in let crEdCtrlButton winstr 420 ypos 35 20 "X" nil -> refreshobjname in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 280 20 (loc "OS3DSCENETREE_0004") EDWIN_RESIZE_MW -> ctrlbg in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DSCENETREE_0007") nil -> labelxmargin in let crEdCtrlFloat winstr 180 ypos 75 20 (itof xmargin) 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlxmargin in let crEdCtrlFloat winstr 260 ypos 75 20 (itof ymargin) 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlymargin in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DSCENETREE_0008") nil -> labeloffset in let crEdCtrlFloat winstr 180 ypos 75 20 (itof levelxoffset) 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlxoffset in let crEdCtrlFloat winstr 260 ypos 75 20 (itof levelyoffset) 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlyoffset in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3DSCENETREE_0003") nil -> labelxmargin in let crEdCtrlCheck winstr 180 ypos 80 20 (loc "OS3DSCENETREE_0009") EDWIN_RESIZE_MW -> ctrlnodes in let crEdCtrlCheck winstr 270 ypos 80 20 (loc "OS3DSCENETREE_0010") EDWIN_RESIZE_MW -> ctrlobjects in let crEdCtrlCheck winstr 360 ypos 80 20 (loc "OS3DSCENETREE_0011") EDWIN_RESIZE_MW -> ctrlcameras in let crEdCtrlCheck winstr 180 (set ypos = ypos + 25) 80 20 (loc "OS3DSCENETREE_0012") EDWIN_RESIZE_MW -> ctrllights in let crEdCtrlCheck winstr 270 ypos 80 20 (loc "OS3DSCENETREE_0013") EDWIN_RESIZE_MW -> ctrlbones in let crEdCtrlCheck winstr 360 ypos 80 20 (loc "OS3DSCENETREE_0014") EDWIN_RESIZE_MW -> ctrlgroups in let crThemeEltSelector inst ewinstr nil "list"::nil iw ih -> theltselector in let crEdFrameWindow _channel ewinstr 0 0 iw 60 EDWIN_RESIZE_MW nil (loc "OS3DSCENETREE_0006") (loc "OS3DSCENETREE_0005") -> 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 "OS3DSCENETREE_0001") EDWIN_RESIZE_MW -> ctrlshow in ( setEdCtrlTextLineEnable ctrlobjname 0; setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickObj [inst ewinstr viewstr ctrlobjname objname]; setEdCtrlButtonCb refreshobjname mkfun2 @cbRefreshBtn ctrlobjname; setEdCtrlCheckState ctrlbg background; setEdCtrlCheckState ctrlnodes nodes; setEdCtrlCheckState ctrlobjects objects; setEdCtrlCheckState ctrlcameras cameras; setEdCtrlCheckState ctrllights lights; setEdCtrlCheckState ctrlbones bones; setEdCtrlCheckState ctrlgroups groups; setEdCtrlCheckState ctrlshow show; [mkfun1 @cbCloseEdit [posstr ctrlobjname ctrlxmargin ctrlymargin ctrlxoffset ctrlyoffset ctrlbg ctrlnodes ctrlobjects ctrlcameras ctrllights ctrlbones ctrlgroups theltselector ctrlshow] nil]; ); );;