/* ----------------------------------------------------------------------------- This source file is part of OpenSpace3D For the latest info, see http://www.openspace3d.com Copyright (c) 2014 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 ----------------------------------------------------------------------------- */ /************************************************** OpenSpace3D Editor Version: 0.1a Author: Bastien BOURINEAU / I-maginer First update: 02.04.2009 **************************************************/ /* ********************************************************************************************* / TODO - Node animation editor / ********************************************************************************************* */ var sUpdateUrl = "https://www.openspace3d.com/os3dupdate.php";; proto loadOsGroup = fun [V3Dview Group XMLmark XMLmark SO3_OBJECT EdTreeItem I I] I;; proto cbRewriteProgramFileAndLoad = fun [MessageBox [S XMLmark [[I S] r1] fun [S] I] I V3Dview] I;; proto cbRewriteMaterialFileAndLoad = fun [MessageBox [S XMLmark [[I S] r1] fun [S] I] I V3Dview] I;; proto playEditor = fun [V3Dview I] I;; proto cbView3dClick = fun [V3Dview I I I] I;; proto cbView3dUnClick = fun [V3Dview I I I] I;; proto cbTbBtnProjectSetting = fun [EdToolBar CompRollOver I I V3Dview] I;; proto cbTbBtnDelMaterial = fun [EdToolBar CompRollOver I I] I;; proto cbSceneTreeTabFocused = fun [EdTab EdControl] I;; proto cbMaterialsTabFocused = fun [EdTab EdControl] I;; proto cbResourcesTabFocused = fun [EdTab EdControl] I;; proto cbMeshesTabFocused = fun [EdTab EdControl] I;; proto setSceneTreeFilterState = fun [I] I;; proto initScene = fun [V3Dview V3Dsession] I;; proto cbWinMainSize = fun [EdWindow I I] I;; proto cbImportXos = fun [[S [V3Dview XMLmark S EdTreeItem]]] I;; var bEnableHistoryState = 1;; typeof CAMViewport = V3Dviewport;; var fCAMViewportW = 320.0;; var fCAMViewportH = 200.0;; struct TplMenu=[ TPLM_sName : S, TPLM_sPath : S, TPLM_sDesc : S, TPLM_iType : I, TPLM_father : TplMenu, TPLM_lSons : [TplMenu r1] ] mkTplMenu;; typeof TPLDmenu = [TplMenu r1];; typeof TPLPmenu = [TplMenu r1];; /* Common interfaces */ fun cbBtnCancel(ctrlbtn, winstr)= dsEdWindow winstr; 0;; fun enableDefaultLight(state)= V3DuseDefaultLight s3dMainSession state; V3DshowObjectHelper v3dMain s3dMainSession (V3DgetDefaultLight s3dMainSession) iTypeLight state; set bLastDefaultLightState = state; 0;; /* Config variables */ fun getConfigParamDef(type, pname, val)= let XMLgetMarkByValue xmlConfigFile "config" -> configmark in let XMLgetMarkByValueFromMarkSons configmark type -> typemark in let XMLgetMarkByValueFromMarkSons typemark pname -> pmark in let XMLgetParam pmark "value" -> nval in if (nval == nil) then val else nval;; fun getConfigParam(type, pname)= let XMLgetMarkByValue xmlConfigFile "config" -> configmark in let XMLgetMarkByValueFromMarkSons configmark type -> typemark in let XMLgetMarkByValueFromMarkSons typemark pname -> pmark in XMLgetParam pmark "value";; fun setConfigParam(type, pname, val)= let XMLgetMarkByValue xmlConfigFile "config" -> configmark in let if configmark == nil then XMLaddMark xmlConfigFile "config" nil ["author" "OpenSpace3D editor configuration file"]::nil nil else configmark -> configmark in let XMLgetMarkByValueFromMarkSons configmark type -> typemark in let if typemark == nil then XMLaddMark xmlConfigFile type configmark nil nil else typemark -> typemark in let XMLgetMarkByValueFromMarkSons typemark pname -> pmark in let if pmark == nil then XMLaddMark xmlConfigFile pname typemark nil nil else pmark -> pmark in XMLsetParam pmark "value" val; 0;; fun addLastProject(prj)= let strToListSep (getConfigParam "OS3Duser" "lastproject") ";" -> lprjs in let remove_string_from_list lprjs prj -> lprjs in setConfigParam "OS3Duser" "lastproject" (strcatnSepLimits prj::lprjs ";" 10); 0;; fun getLastProject()= strToListSep (getConfigParam "OS3Duser" "lastproject") ";";; fun getProjectTypeById(id)= if (id == 1) then "dynamicTemplate" else if (id == 2) then "plugitTemplate" else "standard";; fun getProjectTypeName(name)= if (!strcmp name "dynamicTemplate") then (loc "OS3D_0836") else if (!strcmp name "plugitTemplate") then (loc "OS3D_0837") else (loc "OS3D_0835");; fun getProjectTypeNameById(id)= if (id == 1) then (loc "OS3D_0836") else if (id == 2) then (loc "OS3D_0837") else (loc "OS3D_0835");; fun getProjectTypeByName(name)= if (!strcmp name "dynamicTemplate") then 1 else if (!strcmp name "plugitTemplate") then 2 else 0;; fun getOS3dProjectInfosFromFile(file)= let getFileExt file -> ext in if (strcmpi ext "xos") then nil else ( let XMLload file -> xmlstr in let XMLgetMarkByValue xmlstr "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in if (srcsettingmark == nil) then nil else let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectName") -> pname in let if (pname == nil) || (!strcmp strtrim pname "") then getFileNameWithoutExt file else pname -> pname in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectDescription") -> desc in [pname desc]; );; fun getOS3dProjectNameFromFile(file)= let getFileExt file -> ext in if (strcmpi ext "xos") then nil else ( let XMLload file -> xmlstr in let XMLgetMarkByValue xmlstr "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in if (srcsettingmark == nil) then nil else let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectName") -> pname in let if (pname == nil) || (!strcmp strtrim pname "") then getFileNameWithoutExt file else pname -> pname in pname; );; fun cbGetOS3dProjectInfos(pfile)= let _PtoScol pfile -> file in let getFileExt file -> ext in if (strcmpi ext "xos") then nil else ( let XMLload file -> xmlstr in let XMLgetMarkByValue xmlstr "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in if (srcsettingmark == nil) then "" else ( let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectName") -> projname in let if (projname == nil) || (!strcmp strtrim projname "") then getFileNameWithoutExt file else projname -> pname in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectVersion") -> projver in let getProjectTypeName (XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectType")) -> ptype in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectWebsite") -> projwebsite in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectDescription") -> projdesc in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectLicense") -> projlicense in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "authorName") -> authorname in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "authorCompany") -> authorcompany in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "authorEmail") -> authorEmail in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "language") -> lang in let _getmodifdate pfile -> [y m d _ h mn _ _] in let strcatn (itoa d)::"/"::(itoa m)::"/"::(itoa y)::" - "::(itoa h)::":"::(itoa mn)::nil -> fdate in strcatn "Project: "::projname::"\nVersion: "::projver::"\nWebsite: "::projwebsite::"\nProject type: "::ptype::"\nLicense: "::projlicense::"\nDescription: "::projdesc::"\n\nAuthor: "::authorname::"\nCompany: "::authorcompany::"\nEmail: "::authorEmail::"\n"::"Language: "::lang::"\n"::"Last change date: "::fdate::nil; ); );; fun cbGetOS3dProjectTypeDynTemplate2(file)= let getFileExt file -> ext in if (strcmpi ext "xos") then nil else ( let XMLload file -> xmlstr in let XMLgetMarkByValue xmlstr "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in if (srcsettingmark == nil) then 0 else ( let getProjectTypeByName XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectType") -> ptype in if (ptype == 1) then 1 else 0; ); );; fun cbGetOS3dProjectTypePlugitTemplate2(file)= let getFileExt file -> ext in if (strcmpi ext "xos") then nil else ( let XMLload file -> xmlstr in let XMLgetMarkByValue xmlstr "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in if (srcsettingmark == nil) then 0 else ( let getProjectTypeByName XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectType") -> ptype in if (ptype == 2) then 1 else 0; ); );; fun cbGetOS3dProjectTypeTemplate2(file)= let getFileExt file -> ext in if (strcmpi ext "xos") then nil else ( let XMLload file -> xmlstr in let XMLgetMarkByValue xmlstr "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in if (srcsettingmark == nil) then 0 else ( let getProjectTypeByName XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectType") -> ptype in if (ptype >= 1) then 1 else 0; ); );; fun getOs3dTemplatesCategories(basepath)= let _listofsubdir basepath -> ldir in let sizelist (strToListSep basepath "/") -> idir in let nil -> lcat in ( while (ldir != nil) do ( let hd ldir -> dpath in let if (!strcmp (substr dpath 0 1) "/") then substr dpath 1 (strlen dpath) - 1 else dpath -> dpath in let capitalizeFirstLetter (getlastPathDir dpath) -> dir in let getFilesFromDirFilterRecursive dpath "xos"::nil @cbGetOS3dProjectTypeTemplate2 -> lfiles in if (lfiles == nil) then nil else set lcat = dir::lcat; set ldir = tl ldir; ); revertlist lcat; );; fun cbGetOS3dProjectTypeDynTemplate(pfile)= let _PtoScol pfile -> file in cbGetOS3dProjectTypeDynTemplate2 file;; fun cbGetOS3dProjectTypePlugitTemplate(pfile)= let _PtoScol pfile -> file in cbGetOS3dProjectTypePlugitTemplate2 file;; fun cbImportDynTplMenu(mitem, file)= let V3DgetSessionView c3dXsession -> viewstr in cbImportXos [file [viewstr nil nil nil]];; fun resetTemplateMenus()= set TPLDmenu = nil; set TPLPmenu = nil; 0;; fun cbShowTplDescription(mitem, p)= let p -> [name infos] in setInfoMessageLong strcatn name::" - "::infos::nil; 0;; fun fillOs3dTemplateMenuFromCache(mnu, lp, cbfun)= if (lp == nil) then nil else ( let hd lp -> tplmstr in if (tplmstr.TPLM_iType == 0) then ( let _APPpopup _channel mnu tplmstr.TPLM_sName -> smnu in fillOs3dTemplateMenuFromCache smnu tplmstr.TPLM_lSons cbfun; 0; ) else ( _CBmenuHighlight _CBmenu _APPitem _channel mnu ME_ENABLED tplmstr.TPLM_sName cbfun tplmstr.TPLM_sPath @cbShowTplDescription [tplmstr.TPLM_sName tplmstr.TPLM_sDesc]; 0; ); fillOs3dTemplateMenuFromCache mnu tl lp cbfun; 0; );; fun fillOs3dDynTemplateMenu(mnu, basepath)= if (TPLDmenu != nil) then ( fillOs3dTemplateMenuFromCache mnu TPLDmenu @cbImportDynTplMenu; 0; ) else ( //cache templates let quicksort _listofsubdir basepath @suppDoublon -> ldir in let (sizelist (strToListSep basepath "/")) + 1 -> idir in let nil -> lmnu in ( while (ldir != nil) do ( let hd ldir -> dpath in let if (!strcmp (substr dpath 0 1) "/") then substr dpath 1 (strlen dpath) - 1 else dpath -> dpath in let capitalizeFirstLetter (getlastPathDir dpath) -> dir in let strcat "tpl_category_filter_" dir -> pname in let atoi (getConfigParamDef "OS3Duser" pname "1") -> state in if (!state) then nil else ( let quicksort (getFilesFromDirFilterRecursive dpath "xos"::nil @cbGetOS3dProjectTypeDynTemplate2) @suppDoublon -> lfiles in let nil -> dmenu in let nil -> dtplmstr in let strreplace dir "_" " " -> dir in if (lfiles == nil) then nil else ( set TPLDmenu = (set dtplmstr = mkTplMenu [dir nil nil 0 nil nil])::TPLDmenu; set lmnu = [dpath [(set dmenu = (_APPpopup _channel mnu dir)) dtplmstr]]::lmnu; while (lfiles != nil) do ( let hd lfiles -> path in let getFileDirectory path -> fdir in let getOS3dProjectInfosFromFile path -> [name infos] in let capitalizeFirstLetter name -> cname in let strreplace cname "_" " " -> cname in let switchstr lmnu fdir -> [catmnu tplmstr] in ( if (catmnu != nil) then nil else ( set catmnu = dmenu; set tplmstr = dtplmstr; let strToListSep fdir "/" -> ldd in let sizelist ldd -> size in let idir -> i in while (i < size) do ( let strcatnSepLimits ldd "/" i+1 -> mdir in ( let switchstr lmnu mdir -> [dmnu dtpl] in if (dmnu != nil) then ( set catmnu = dmnu; set tplmstr = dtpl; 0; ) else ( let capitalizeFirstLetter (getlastPathDir mdir) -> ndir in let strreplace ndir "_" " " -> ndir in let mkTplMenu [ndir nil nil 0 tplmstr nil] -> tplnstr in ( set tplmstr.TPLM_lSons = lcat tplmstr.TPLM_lSons tplnstr::nil; set tplmstr = tplnstr; set lmnu = [mdir [(set catmnu = (_APPpopup _channel catmnu ndir)) tplnstr]]::lmnu; ); 0; ); ); set i = i + 1; ); ); let mkTplMenu [cname path infos 1 tplmstr nil] -> tplnstr in set tplmstr.TPLM_lSons = lcat tplmstr.TPLM_lSons tplnstr::nil; _CBmenuHighlight _CBmenu _APPitem _channel catmnu ME_ENABLED cname @cbImportDynTplMenu path @cbShowTplDescription [cname infos]; set lfiles = tl lfiles; ); ); ); ); set ldir = tl ldir; ); ); set TPLDmenu = revertlist TPLDmenu; 0; ); 0;; fun fillOs3dPlugTemplateMenu(mnu, basepath, cbmenu)= if (TPLPmenu != nil) then ( fillOs3dTemplateMenuFromCache mnu TPLPmenu cbmenu; 0; ) else ( //cache templates let quicksort _listofsubdir basepath @suppDoublon -> ldir in let (sizelist (strToListSep basepath "/")) + 1 -> idir in let nil -> lmnu in ( while (ldir != nil) do ( let hd ldir -> dpath in let if (!strcmp (substr dpath 0 1) "/") then substr dpath 1 (strlen dpath) - 1 else dpath -> dpath in let capitalizeFirstLetter (getlastPathDir dpath) -> dir in let strcat "tpl_category_filter_" dir -> pname in let atoi (getConfigParamDef "OS3Duser" pname "1") -> state in if (!state) then nil else ( let quicksort (getFilesFromDirFilterRecursive dpath "xos"::nil @cbGetOS3dProjectTypePlugitTemplate2) @suppDoublon -> lfiles in let nil -> dmenu in let nil -> dtplmstr in let strreplace dir "_" " " -> dir in if (lfiles == nil) then nil else ( set TPLPmenu = (set dtplmstr = mkTplMenu [dir nil nil 0 nil nil])::TPLPmenu; set lmnu = [dpath [(set dmenu = (_APPpopup _channel mnu dir)) dtplmstr]]::lmnu; while (lfiles != nil) do ( let hd lfiles -> path in let getFileDirectory path -> fdir in let getOS3dProjectInfosFromFile path -> [name infos] in let capitalizeFirstLetter name -> cname in let strreplace cname "_" " " -> cname in let switchstr lmnu fdir -> [catmnu tplmstr] in ( if (catmnu != nil) then nil else ( set catmnu = dmenu; set tplmstr = dtplmstr; let strToListSep fdir "/" -> ldd in let sizelist ldd -> size in let idir -> i in while (i < size) do ( let strcatnSepLimits ldd "/" i+1 -> mdir in ( let switchstr lmnu mdir -> [dmnu dtpl] in if (dmnu != nil) then ( set catmnu = dmnu; set tplmstr = dtpl; 0; ) else ( let capitalizeFirstLetter (getlastPathDir mdir) -> ndir in let strreplace ndir "_" " " -> ndir in let mkTplMenu [ndir nil nil 0 tplmstr nil] -> tplnstr in ( set tplmstr.TPLM_lSons = lcat tplmstr.TPLM_lSons tplnstr::nil; set tplmstr = tplnstr; set lmnu = [mdir [(set catmnu = (_APPpopup _channel catmnu ndir)) tplnstr]]::lmnu; ); 0; ); ); set i = i + 1; ); ); let mkTplMenu [cname path infos 1 tplmstr nil] -> tplnstr in set tplmstr.TPLM_lSons = lcat tplmstr.TPLM_lSons tplnstr::nil; _CBmenuHighlight _CBmenu _APPitem _channel catmnu ME_ENABLED cname cbmenu path @cbShowTplDescription [cname infos]; set lfiles = tl lfiles; ); ); ); ); set ldir = tl ldir; ); ); set TPLPmenu = revertlist TPLPmenu; 0; ); 0;; /* Viewport for camera preview */ fun showCameraViewport(viewstr, camera, state)= if (CAMViewport == nil) then nil else ( V3DdelViewport viewstr CAMViewport; set CAMViewport = nil; ); if (!state) then nil else ( let V3DgetDefaultViewport viewstr -> viewportstr in let SO3ViewportGetPixelPositionSize viewportstr.V3D_viewport -> [_ _ vw vh] in let fCAMViewportW /. (itof vw) -> pw in let fCAMViewportH /. (itof vh) -> ph in set CAMViewport = V3DaddViewport viewstr (1.0 -. pw) (1.0 -. ph) pw ph viewportstr.V3D_iBgColor; V3DsetViewport viewstr CAMViewport camera; SO3ViewportSetOverlayEnable CAMViewport.V3D_viewport 0; SO3ViewportSetSkyEnable CAMViewport.V3D_viewport 0; //hide helpers SO3ViewportSetVisibilityMask CAMViewport.V3D_viewport 0x0000000; SO3ViewportSetVisibilityMaskIndexEnable CAMViewport.V3D_viewport 3 1; ); 0;; /* ********************************************************************************************* / Os scene manager / ********************************************************************************************* */ fun getGraphIcon(type, visible)= if (!visible) then sTreeBitmapHidden else if (type == iTypeScene) then sTreeBitmapScene else if (type == iTypeGroup) then sTreeBitmapGroup else if (type == iTypeNode) then sTreeBitmapNode else if (type == iTypeLight) then sTreeBitmapLight else if (type == iTypeCamera) then sTreeBitmapCamera else if (type == iTypeEntity) then sTreeBitmapEntity else if ((type == iTypeSkyBox) || (type == iTypeSkyDome) || (type == iTypeSkyPlane)) then sTreeBitmapSky else if ((type == iTypeAnim) || (type == iTypeCinematics)) then sTreeBitmapAnim else if (type == iTypeCompositor) then sTreeBitmapCompositor else if (type == iTypeBone) then sTreeBitmapBone else if (type == iTypeParticle) then sTreeBitmapParticle else if (type == iTypeCubeMap) then sTreeBitmapCubeMap else if (type == iTypeReflectionMap) then sTreeBitmapReflectionMap else sTreeBitmapNode;; fun updateSceneTreeBitmap(treeitem, type, visible)= let getGraphIcon type visible -> tbitmap in setEdCtrlTreeItemBitmap ctrlSceneTree treeitem tbitmap; 0;; fun getGraphByValue(val)= let if (!strcmp val "Ogre/SceneRoot") || (val == nil) then "Scene" else val -> val in switchstri lSceneGraph val;; fun getNewSceneIndex(id)= if id == nil then set iCurSceneIdx = iCurSceneIdx + 1 else ( set iCurSceneIdx = (if id > iCurSceneIdx then id else iCurSceneIdx); id; );; fun getGraphItemsByType(ftype)= let nil -> nl in ( let sizelist lSceneGraph -> size in let 0 -> i in while i < size do ( let nth_list lSceneGraph i -> elt in let elt -> [val [treenode type alias markstr path destgroup initstate staticgeometry]] in if ftype != type then nil else set nl = elt::nl; set i = i + 1; ); nl; );; fun setGraphItemInitState(val, state)= let getGraphByValue val -> params in mutate params <- [_ _ _ _ _ _ state _]; 0;; fun setGraphItemStaticGeometryState(val, state)= let getGraphByValue val -> params in mutate params <- [_ _ _ _ _ _ _ state]; 0;; fun setGraphItemAlias(val, alias)= let getGraphByValue val -> params in mutate params <- [_ _ alias _ _ _ _ _]; 0;; fun addGraphItem(name, val, type, alias, markstr, path, destgroup, treefather, initstate, staticgeometry)= let XMLgetBoolParam markstr "hidden" -> hidden in let getGraphIcon type !hidden -> tbitmap in let addEdCtrlTreeItem ctrlSceneTree treefather if (alias == nil) || (!strcmp alias "") then name else strcatn alias::" ("::name::")"::nil val type tbitmap -> treenode in ( if (treenode != nil) then nil else addLogMessage (loc "OS3D_0435"); set lSceneGraph = [val [treenode type alias markstr path destgroup initstate staticgeometry]]::lSceneGraph; treenode; );; fun delGraphItem(name)= if name == nil then nil else set lSceneGraph = G2DremoveEdSidFromList lSceneGraph name;; // test if the scene has been modified | new or not fun isSceneModified()= setInfoMessage (loc "OS3D_0087"); let (lModifiedMaterialList != nil) || (lMaterialScriptsList != nil) || (XMLdiff xmlEditSceneFile if sCurrentScenePath == nil then xmlBaseScene else (XMLload sCurrentScenePath)) -> ret in ( setInfoMessage if ret then (loc "OS3D_0356") else (loc "OS3D_0269"); ret; );; fun isParentHidden(shell)= let 1 -> fstate in ( let SO3ObjectGetName SO3ObjectGetParent shell -> fname in while ((fname != nil) && fstate) do ( let getGraphByValue fname -> [etreeitem etype ealias emark _ egroupmark initstate staticgeometry] in let SO3SceneGetObject (V3DgetSession c3dXsession) fname -> node in ( if (emark == nil) then ( set fname = nil; ) else ( if !(XMLgetBoolParam emark "hidden") then nil else set fstate = 0; set fname = if (emark == nil) then nil else SO3ObjectGetName SO3ObjectGetParent node; ); ); ); !fstate; );; fun showNodeVisibilityChildren(shell, skip)= if skip then nil else SO3ObjectSetVisible shell 1 0; let SO3ObjectGetChildren shell -> lchild in while (lchild != nil) do ( let hd lchild -> child in let SO3ObjectGetName child -> cname in let getGraphByValue cname -> [etreeitem etype ealias emark _ egroupmark initstate staticgeometry] in let XMLgetBoolParam emark "hidden" -> hidden in let if (etype == iTypeLight) then XMLgetBoolParam emark "enable" else 1 -> enable in if (hidden /*&& ((etype == iTypeNode) || (etype == iTypeGroup))*/) then nil else showNodeVisibilityChildren child (hidden || !enable); set lchild = tl lchild; ); 0;; fun applyNodeVisibility(shell, type, state)= // check if parent is visible if (state) then ( if (isParentHidden shell) then nil else showNodeVisibilityChildren shell 0; 0; ) else ( SO3ObjectSetVisible shell 0 1; 0; ); 0;; fun unhideNodes(l)= while (l != nil) do ( let hd l -> child in let SO3ObjectGetName child -> cname in let getGraphByValue cname -> [treeitem type alias markstr _ groupmark _ _] in if (markstr == nil) then nil else ( if ((XMLgetParam markstr "hidden") == nil) then nil else ( XMLsetParam markstr "hidden" (XMLgetBoolString 0); SO3ObjectSetVisible child 1 0; updateSceneTreeBitmap treeitem type 1; ); unhideNodes (SO3ObjectGetChildren child); ); set l = tl l; ); 0;; fun unhideAll(viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in let SO3ObjectGetSceneRoot (V3DgetSession sessionstr) -> rootnode in unhideNodes rootnode::nil; 0;; fun getAllMaterialScheme(viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in let nil -> lscheme in ( let sizelist lGroups -> size in let 0 -> i in while i < size do ( let nth_list lGroups i -> [_ grp] in let SO3SceneParseSchemeFromGroup (V3DgetSession sessionstr) grp.GRP_sName -> lsch in set lscheme = lcat lscheme lsch; set i = i + 1; ); quicksort lscheme @suppDoublon; );; fun storeResourceFile(groupstr, file)= let getFileResourceType file -> type in if type == SO3_RESOURCE_MATERIAL then set groupstr.GRP_lMaterialResources = addUniqueStri groupstr.GRP_lMaterialResources file else if type == SO3_RESOURCE_GPUPROGRAM then set groupstr.GRP_lProgramResources = addUniqueStri groupstr.GRP_lProgramResources file else if type == SO3_RESOURCE_HIGHLEVELGPUPROGRAM then set groupstr.GRP_lShaderResources = addUniqueStri groupstr.GRP_lShaderResources file else if type == SO3_RESOURCE_TEXTURE then set groupstr.GRP_lTextureResources = addUniqueStri groupstr.GRP_lTextureResources file else if type == SO3_RESOURCE_COMPOSITOR then set groupstr.GRP_lCompositorResources = addUniqueStri groupstr.GRP_lCompositorResources file else if type == SO3_RESOURCE_PARTICLE_SYSTEM then set groupstr.GRP_lParticleResources = addUniqueStri groupstr.GRP_lParticleResources file else if type == SO3_RESOURCE_SKELETON then set groupstr.GRP_lSkeletonResources = addUniqueStri groupstr.GRP_lSkeletonResources file else if type == SO3_RESOURCE_MESH then set groupstr.GRP_lMeshResources = addUniqueStri groupstr.GRP_lMeshResources file else set groupstr.GRP_lOtherResources = addUniqueStri groupstr.GRP_lOtherResources file; 0;; fun storeResourceFile2(groupstr, file)= let getFileResourceType file -> type in if type == SO3_RESOURCE_MATERIAL then set groupstr.GRP_lMaterialResources = file::groupstr.GRP_lMaterialResources else if type == SO3_RESOURCE_GPUPROGRAM then set groupstr.GRP_lProgramResources = file::groupstr.GRP_lProgramResources else if type == SO3_RESOURCE_HIGHLEVELGPUPROGRAM then set groupstr.GRP_lShaderResources = file::groupstr.GRP_lShaderResources else if type == SO3_RESOURCE_TEXTURE then set groupstr.GRP_lTextureResources = file::groupstr.GRP_lTextureResources else if type == SO3_RESOURCE_COMPOSITOR then set groupstr.GRP_lCompositorResources = file::groupstr.GRP_lCompositorResources else if type == SO3_RESOURCE_PARTICLE_SYSTEM then set groupstr.GRP_lParticleResources = file::groupstr.GRP_lParticleResources else if type == SO3_RESOURCE_SKELETON then set groupstr.GRP_lSkeletonResources = file::groupstr.GRP_lSkeletonResources else if type == SO3_RESOURCE_MESH then set groupstr.GRP_lMeshResources = file::groupstr.GRP_lMeshResources else set groupstr.GRP_lOtherResources = file::groupstr.GRP_lOtherResources; 0;; fun cleanDuplicatedResourcesFiles(groupstr)= set groupstr.GRP_lMaterialResources = quicksort groupstr.GRP_lMaterialResources @suppDoublon; set groupstr.GRP_lProgramResources = quicksort groupstr.GRP_lProgramResources @suppDoublon; set groupstr.GRP_lShaderResources = quicksort groupstr.GRP_lShaderResources @suppDoublon; set groupstr.GRP_lTextureResources = quicksort groupstr.GRP_lTextureResources @suppDoublon; set groupstr.GRP_lCompositorResources = quicksort groupstr.GRP_lCompositorResources @suppDoublon; set groupstr.GRP_lParticleResources = quicksort groupstr.GRP_lParticleResources @suppDoublon; set groupstr.GRP_lSkeletonResources = quicksort groupstr.GRP_lSkeletonResources @suppDoublon; set groupstr.GRP_lMeshResources = quicksort groupstr.GRP_lMeshResources @suppDoublon; set groupstr.GRP_lOtherResources = quicksort groupstr.GRP_lOtherResources @suppDoublon; 0;; fun newOsSceneFile(viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in let XMLcreate nil nil -> xmlfilestr in let XMLaddMark xmlfilestr "project" nil ["formatVersion" getVersionName]::["author" "OpenSpace3D Objects group based on OgreMax Scene Exporter (www.ogremax.com)"]::nil nil -> projstr in let XMLaddMark xmlfilestr "scene" projstr ["px" "3"]::["py" "1"]::nil nil -> scenestr in let XMLaddMark xmlfilestr "resources" scenestr nil nil -> resourcemark in let XMLaddMark xmlfilestr "environment" scenestr nil nil -> envstr in let mkGroup ["Scene" nil currentProject nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] -> groupstr in ( shadowsInitScene xmlfilestr envstr sessionstr; renderingInitScene xmlfilestr envstr viewstr; physicsInitScene xmlfilestr envstr sessionstr; XMLaddMark xmlfilestr "plugins" scenestr nil nil; XMLaddMark xmlfilestr "graph" scenestr nil nil; set groupstr.GRP_xmlMark = scenestr; set groupstr.GRP_iWaitForLoad = 0; set lGroups = [scenestr groupstr]::lGroups; crEdCtrlModuleEditorBox mainInterf.MINT_meGroups "Scene" "Scene" nil nil 3 1 nil 0; set currentProject.PRJ_group = groupstr; set currentProject.PRJ_vuiGroup = VUIcreateContainerGroup nil; xmlfilestr; );; fun newOsSceneGroup(viewstr, xmlfilestr, fathermark, name, id, alias, father, scale, pos, ang, hidden, treefather, plx, ply)= let V3DgetDefaultSession viewstr -> sessionstr in let getNewSceneIndex id -> id in let XMLaddMark xmlfilestr "group" fathermark ["id" (itoa id)]::["name" name]::["alias" alias]::["hidden" (XMLgetBoolString hidden)]::["px" (itoa plx)]::["py" (itoa ply)]::nil nil -> groupmark in let if scale == nil then [1.0 1.0 1.0] else scale -> scale in let if pos == nil then [0.0 0.0 0.0] else pos -> pos in let if ang == nil then [0.0 0.0 0.0 1.0] else ang -> ang in let V3DaddShell sessionstr name (itoa id) father pos ang -> shell in let scale -> [sx sy sz] in let pos -> [px py pz] in let ang -> [ax ay az aw] in let mkGroup [(strcatn (itoa id)::"."::name::nil) nil currentProject shell nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] -> groupstr in let addGraphItem strcatn name::" #"::(itoa id)::nil (strcatn (itoa id)::"."::name::nil) iTypeGroup alias groupmark nil fathermark treefather 0 0 -> treenode in ( V3DshowObjectHelper viewstr sessionstr shell iTypeNode 1; set groupstr.GRP_xmlMark = groupmark; set groupstr.GRP_iWaitForLoad = 0; SO3ObjectSetFlags shell iNodeFlagScene|iNodeFlagGroup; SO3GroupCreate (V3DgetSession sessionstr) (strcatn (itoa id)::"."::name::nil); SO3ObjectSetScale shell scale; XMLaddMark xmlfilestr "scale" groupmark ["x" (XMLgetShortFloatToString sx)]::["y" (XMLgetShortFloatToString sy)]::["z" (XMLgetShortFloatToString sz)]::nil nil; XMLaddMark xmlfilestr "position" groupmark ["x" (XMLgetShortFloatToString px)]::["y" (XMLgetShortFloatToString py)]::["z" (XMLgetShortFloatToString pz)]::nil nil; XMLaddMark xmlfilestr "rotation" groupmark ["qx" (XMLgetShortFloatToString ax)]::["qy" (XMLgetShortFloatToString ay)]::["qz" (XMLgetShortFloatToString az)]::["qw" (XMLgetShortFloatToString aw)]::nil nil; XMLaddMark xmlfilestr "resources" groupmark nil nil; XMLaddMark xmlfilestr "plugins" groupmark ["filterLinks" (XMLgetBoolString 0)]::["curvedLinks" (XMLgetBoolString 1)]::["sortMenus" (XMLgetBoolString 1)]::nil nil; XMLaddMark xmlfilestr "graph" groupmark nil nil; let XMLaddMark xmlfilestr "cinematics" groupmark nil nil -> cinematicsstr in addGraphItem (loc "OS3D_0090") (strcatn (itoa id)::"."::name::"."::(loc "OS3D_0090")::nil) iTypeCinematics nil cinematicsstr nil groupmark treenode 1 0; set lGroups = [groupmark groupstr]::lGroups; setEdCtrlModuleEditorBoxTooltip mainInterf.MINT_meGroups (crEdCtrlModuleEditorBox mainInterf.MINT_meGroups (strcatn (itoa id)::"."::name::nil) (if (alias == nil) || (!strcmp alias "") then (strcatn (itoa id)::"."::name::nil) else alias) nil nil plx ply nil 0) (strcatn (itoa id)::"."::name::nil); [groupstr shell treenode]; );; fun deleteOsGroup(viewstr, markstr)= let switch lGroups markstr -> groupstr in let mainInterf.MINT_winPlugins -> [plugswinstr [tbstr tabbarstr minmaxchk1]] in ( dsEdTab tabbarstr groupstr.GRP_tabPlugins; // remove group plugITs instances deleteOsInstances groupstr; dsEdCtrlModuleEditorBox mainInterf.MINT_meGroups (getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups groupstr.GRP_sName); paintEdCtrlModuleEditor mainInterf.MINT_meGroups; set lGroups = V3DremoveIdxFromList lGroups markstr; ); 0;; fun addOsResourceDir(ldir)= if (ldir == nil) then nil else ( set lResourcesPath = quicksort (lcat lResourcesPath ldir) @suppDoublon; fillEdCtrlList ctrlResourcesDirList lResourcesPath; ); 0;; fun addOsSceneResource(xmlfilestr, groupmark, groupstr, path, type)= let strlowercase path -> path in let if groupmark == nil then (XMLgetMarkByValue xmlfilestr "scene") else groupmark -> groupmark in let XMLgetMarkByValueFromMarkSons groupmark "resources" -> resourcemark in let (strlowercase path) -> searchn in if (isStringInList groupstr.GRP_lLoadedResourcesFiles searchn) then nil else ( set groupstr.GRP_lLoadedResourcesFiles = searchn::groupstr.GRP_lLoadedResourcesFiles; XMLaddMark xmlfilestr "resource" resourcemark ["type" (getResourceNameByType type)]::["path" path]::nil nil; ); 0;; fun setViewWireMode(viewstr, mode)= set bShowWireMode = mode; let (V3DgetDefaultViewport viewstr) -> viewportstr in ( V3DsetViewportPolygonMode viewportstr if bShowWireMode then SO3_POLY_WIREFRAME else SO3_POLY_SOLID; if (mode) then ( set bLastSsaoMode = SO3ViewportGetSSAOEnabled viewportstr.V3D_viewport; set bLastHdrMode = SO3ViewportGetHDREnabled viewportstr.V3D_viewport; SO3ViewportSetSSAOEnabled viewportstr.V3D_viewport 0; SO3ViewportSetShadowEnabled viewportstr.V3D_viewport 0; SO3ViewportSetHDREnabled viewportstr.V3D_viewport 0; 0; ) else ( SO3ViewportSetSSAOEnabled viewportstr.V3D_viewport bLastSsaoMode; SO3ViewportSetShadowEnabled viewportstr.V3D_viewport 1; SO3ViewportSetHDREnabled viewportstr.V3D_viewport bLastHdrMode; 0; ); ); 0;; /* ********************************************************************************************* / History / ********************************************************************************************* */ fun resetObjHistory()= set lObjUndoHistory = nil; set lObjRedoHistory = nil; 0;; fun getObjHistoryState(name, markstr, obj, type)= if ((name == nil) || (markstr == nil)) then nil else let nil -> pos in let nil -> quat in let nil -> scale in ( if (type > 3) then nil else ( let XMLgetMarkByValueFromMarkSons markstr "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in set pos = [xpos ypos zpos]; let XMLgetMarkByValueFromMarkSons markstr "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in set quat = [xang yang zang wang]; let XMLgetMarkByValueFromMarkSons markstr "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in set scale = [xscale yscale zscale]; ); let XMLgetParam markstr "alias" -> alias in mkPRSHistoryState[type name markstr markstr.XMLfather obj (SO3ObjectGetParent obj) pos quat scale alias]; );; fun updateToolbarHistoryBtn()= let mainInterf.MINT_winView -> [_ [tbstr _ _ _ _ _ _ _ btnundo btnredo _ _ _ _ _ _ _ _ _ _]] in ( let hd lObjUndoHistory -> nstate in let if nstate.OBJHS_iType == 0 then (loc "OS3D_0438") else if nstate.OBJHS_iType == 1 then (loc "OS3D_0442") else if nstate.OBJHS_iType == 2 then (loc "OS3D_0439") else if nstate.OBJHS_iType == 3 then (loc "OS3D_0440") else if nstate.OBJHS_iType == 4 then (loc "OS3D_0441") else if nstate.OBJHS_iType == 5 then (loc "OS3D_0437") else (loc "OS3D_0436") -> bubble in setEdToolBarButtonToolTip tbstr btnundo bubble; let hd lObjRedoHistory -> nstate in let if nstate.OBJHS_iType == 0 then (loc "OS3D_0321") else if nstate.OBJHS_iType == 1 then (loc "OS3D_0325") else if nstate.OBJHS_iType == 2 then (loc "OS3D_0322") else if nstate.OBJHS_iType == 3 then (loc "OS3D_0323") else if nstate.OBJHS_iType == 4 then (loc "OS3D_0324") else if nstate.OBJHS_iType == 5 then (loc "OS3D_0320") else (loc "OS3D_0319") -> bubble in setEdToolBarButtonToolTip tbstr btnredo bubble; setEdToolBarButtonEnable tbstr btnundo if lObjUndoHistory == nil then 0 else 1; setEdToolBarButtonEnable tbstr btnredo if lObjRedoHistory == nil then 0 else 1; ); 0;; // ObjHistoryState fun addObjHistoryState(name, markstr, obj, type)= if ((!bEnableHistoryState) || (markstr == nil)) then nil else ( let getObjHistoryState name markstr obj type -> nstate in if (nstate == nil) then nil else set lObjUndoHistory = nstate::lObjUndoHistory; set lObjRedoHistory = nil; updateToolbarHistoryBtn; ); 0;; fun applyObjHistoryState(viewstr, state)= set bEnableHistoryState = 0; let SO3ObjectGetName state.OBJHS_obj -> objname in let getGraphByValue state.OBJHS_sName -> [item1 type _ _ _ _ _ _] in if (state.OBJHS_iType <= 3) then ( let XMLgetMarkByValueFromMarkSons state.OBJHS_markstr "position" -> nodeposstr in let state.OBJHS_vPos -> [x y z] in ( XMLsetParam nodeposstr "x" XMLgetShortFloatToString x; XMLsetParam nodeposstr "y" XMLgetShortFloatToString y; XMLsetParam nodeposstr "z" XMLgetShortFloatToString z; ); let XMLgetMarkByValueFromMarkSons state.OBJHS_markstr "rotation" -> noderotstr in let state.OBJHS_vQuat -> [x y z w] in ( XMLsetParam noderotstr "qx" XMLgetShortFloatToString x; XMLsetParam noderotstr "qy" XMLgetShortFloatToString y; XMLsetParam noderotstr "qz" XMLgetShortFloatToString z; XMLsetParam noderotstr "qw" XMLgetShortFloatToString w; ); let XMLgetMarkByValueFromMarkSons state.OBJHS_markstr "scale" -> nodescalestr in let state.OBJHS_vScale -> [x y z] in ( XMLsetParam nodescalestr "x" XMLgetShortFloatToString x; XMLsetParam nodescalestr "y" XMLgetShortFloatToString y; XMLsetParam nodescalestr "z" XMLgetShortFloatToString z; ); SO3ObjectLink state.OBJHS_obj state.OBJHS_parent; SO3ObjectSetPosition state.OBJHS_obj state.OBJHS_vPos; SO3ObjectSetOrientation state.OBJHS_obj state.OBJHS_vQuat; SO3ObjectSetScale state.OBJHS_obj state.OBJHS_vScale; let winCoordsSetup -> [wobj wobjstr owinstr mode ctrlpx ctrlpy ctrlpz ctrlpgx ctrlpgy ctrlpgz _ x y] in if (wobj != state.OBJHS_obj) then nil else ( let [0.0 0.0 0.0] -> vec in let [0.0 0.0 0.0] -> gvec in ( if (mode == 1) then ( set vec = SO3ObjectGetPosition state.OBJHS_obj; set gvec = SO3ObjectGetGlobalPosition state.OBJHS_obj; ) else if (mode == 2) then ( let SO3ObjectGetOrientation state.OBJHS_obj -> quat in let SO3MathsQuatToEulerYXZ quat -> [dx dy dz] in set vec = [SO3MathsRadianToDegree dx SO3MathsRadianToDegree dy SO3MathsRadianToDegree dz]; let SO3ObjectGetGlobalOrientation state.OBJHS_obj -> gquat in let SO3MathsQuatToEulerYXZ gquat -> [dgx dgy dgz] in set gvec = [SO3MathsRadianToDegree dgx SO3MathsRadianToDegree dgy SO3MathsRadianToDegree dgz]; ) else if (mode == 3) then ( set vec = SO3ObjectGetScale state.OBJHS_obj; set gvec = SO3ObjectGetGlobalScale state.OBJHS_obj; ) else nil; let vec -> [x y z] in ( setEdCtrlFloatValueWithoutCallback ctrlpx x; setEdCtrlFloatValueWithoutCallback ctrlpy y; setEdCtrlFloatValueWithoutCallback ctrlpz z; ); let gvec -> [x y z] in ( setEdCtrlFloatValueWithoutCallback ctrlpgx x; setEdCtrlFloatValueWithoutCallback ctrlpgy y; setEdCtrlFloatValueWithoutCallback ctrlpgz z; ); ); ); if (state.OBJHS_markstr.XMLfather == state.OBJHS_parentstr) then nil else let getGraphByValue SO3ObjectGetName state.OBJHS_parent -> [item2 _ _ _ _ _ _ _] in ( moveEdCtrlTreeItem ctrlSceneTree item1 item2; XMLmoveMark xmlEditSceneFile state.OBJHS_markstr state.OBJHS_parentstr; selEdCtrlTreeItemByValue ctrlSceneTree state.OBJHS_sName; ); ) else if (state.OBJHS_iType == 4) then ( selEdCtrlTreeItemByValue ctrlSceneTree state.OBJHS_sName; ) else if (state.OBJHS_iType == 5) then ( let XMLgetParam state.OBJHS_markstr "name" -> objname in let XMLgetParam state.OBJHS_markstr "id" -> id in let if (state.OBJHS_sAlias == nil) || (!strcmp "" (strtrim state.OBJHS_sAlias)) then (strcatn lcat objname::nil (if id == nil then nil else " #"::id::nil)) else if type == iTypeCompositor then strcatn state.OBJHS_sAlias::" ("::"Compositor \""::objname::"\")"::nil else if type == iTypeSkyBox then strcatn state.OBJHS_sAlias::" (SkyBox)"::nil else if type == iTypeSkyDome then strcatn state.OBJHS_sAlias::" (SkyDome)"::nil else if type == iTypeSkyPlane then strcatn state.OBJHS_sAlias::" (SkyPlane)"::nil else if type == iTypeAnim then ( let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr state.OBJHS_sName -> animstr in let SO3AnimationGetType animstr.V3D_anim -> atype in let if (atype == SO3_SCENENODE_ANIM) then "node" else if (atype == SO3_SKELETAL_ANIM) then "skeletal" else if (atype == SO3_VERTEX_ANIM) then "morph" else if (atype == SO3_POSE_ANIM) then "pose" else nil -> ratype in if (ratype != nil) then strcatn state.OBJHS_sAlias::" ("::(strcatn lcat objname::nil (if id == nil then nil else " #"::id::nil))::" - "::ratype::")"::nil else strcatn state.OBJHS_sAlias::" ("::(strcatn lcat objname::nil (if id == nil then nil else " #"::id::nil))::")"::nil; ) else strcatn state.OBJHS_sAlias::" ("::(strcatn lcat objname::nil (if id == nil then nil else " #"::id::nil))::")"::nil -> nalias in ( XMLsetParam state.OBJHS_markstr "alias" state.OBJHS_sAlias; setGraphItemAlias state.OBJHS_sName state.OBJHS_sAlias; setEdCtrlTreeLabel ctrlSceneTree item1 nalias; if (type != iTypeGroup) then nil else let getGroupByName state.OBJHS_sName -> groupstr in let mainInterf.MINT_winPlugins -> [plugswinstr [tbstr tabbarstr minmaxchk1]] in let if (state.OBJHS_sAlias == nil) || (!strcmp "" (strtrim state.OBJHS_sAlias)) then (strcatn lcat objname::nil (if id == nil then nil else " #"::id::nil)) else state.OBJHS_sAlias -> groupname in ( setEdCtrlModuleEditorBoxLabel mainInterf.MINT_meGroups (getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups state.OBJHS_sName) groupname; renameEdTab tabbarstr groupstr.GRP_tabPlugins groupname; ); ); ) else nil; set bEnableHistoryState = 1; 0;; fun restoreLastObjHistoryState(viewstr)= let hd lObjUndoHistory -> state in if (state == nil) then nil else ( let if state.OBJHS_iType == 4 then let getGraphByValue sSelected -> [_ _ _ markstr _ _ _ _] in getObjHistoryState sSelected markstr nil 4 else getObjHistoryState state.OBJHS_sName state.OBJHS_markstr state.OBJHS_obj state.OBJHS_iType -> nstate in if (nstate == nil) then nil else set lObjRedoHistory = nstate::lObjRedoHistory; applyObjHistoryState viewstr state; // remove last state set lObjUndoHistory = tl lObjUndoHistory; updateToolbarHistoryBtn; ); 0;; fun restorePreviousObjHistoryState(viewstr)= let hd lObjRedoHistory -> state in if (state == nil) then nil else ( let if state.OBJHS_iType == 4 then let getGraphByValue sSelected -> [_ _ _ markstr _ _ _ _] in getObjHistoryState sSelected markstr nil 4 else getObjHistoryState state.OBJHS_sName state.OBJHS_markstr state.OBJHS_obj state.OBJHS_iType -> nstate in if (nstate == nil) then nil else set lObjUndoHistory = nstate::lObjUndoHistory; applyObjHistoryState viewstr state; // remove last state set lObjRedoHistory = tl lObjRedoHistory; updateToolbarHistoryBtn; ); 0;; /* ********************************************************************************************* / Os scene Loader / ********************************************************************************************* */ fun getOsGroupResources(groupstr, groupmark)= let XMLgetMarkByValueFromMarkSons groupmark "resources" -> resourcesmark in let XMLgetMarksByValueFromMarkSons resourcesmark "resource" -> lresourcemarks in ( let sizelist lresourcemarks -> size in let 0 -> i in while i < size do ( let nth_list lresourcemarks i -> resourcemark in let XMLgetParam resourcemark "type" -> type in let XMLgetParam resourcemark "path" -> path in let getPathFile path "" -> [dir _] in ( if (dir == nil) || (!strcmp "" (strtrim dir)) then nil else addOsResourceDir dir::nil; set groupstr.GRP_lAvailableResourcesFiles = path::groupstr.GRP_lAvailableResourcesFiles; ); set i = i + 1; ); set groupstr.GRP_lAvailableResourcesFiles = quicksort groupstr.GRP_lAvailableResourcesFiles @suppDoublon; ); 0;; fun loadCinematics(viewstr, groupstr, srcgroupmark, import)= let getGraphByValue (strcatn groupstr.GRP_sName::"."::(loc "OS3D_0090")::nil) -> [treecinematics _ _ cinematicsstr _ _ _ _] in let V3DgetDefaultSession viewstr -> sessionstr in let XMLgetMarkByValueFromMarkSons srcgroupmark "cinematics" -> cinematicsxml in let XMLgetMarksByValueFromMarkSons cinematicsxml "animation" -> lanimmarks in let nil -> lanims in ( //Load all anims before keys to be sure to find the key anim let sizelist lanimmarks -> size in let 0 -> i in while i < size do ( let nth_list lanimmarks i -> animmark in let XMLgetParam animmark "id" -> id in let if import then nil else XMLgetParam animmark "id" -> id in let itoa getNewSceneIndex (atoi id) -> id in let XMLgetParam animmark "name" -> animname in let XMLgetParam animmark "alias" -> alias in let XMLgetBoolParam animmark "enable" -> animstate in let XMLgetBoolParam animmark "loop" -> animloop in let atof XMLgetParam animmark "speed" -> animspeed in let atof XMLgetParam animmark "weight" -> animweight in let XMLgetBoolParam animmark "skipFrame" -> skipFrame in let if (XMLgetParam animmark "skipFrame") == nil then 1 else skipFrame -> skipFrame in let if (animspeed == nil) then fDefaultAnimationSpeed else animspeed -> animspeed in let strcatn id::"."::animname::nil -> curanimname in let V3DaddSequenceAnimation sessionstr (atoi id) animname curanimname animspeed animweight 0 animloop -> animstr in let XMLaddMark xmlEditSceneFile "animation" cinematicsstr ["id" id]::["name" animname]::["type" "cinematic"]::["alias" alias]::["enable" (XMLgetBoolString animstate)]::["loop" (XMLgetBoolString animloop)]::["speed" (XMLgetShortFloatToString animspeed)]::["weight" (XMLgetShortFloatToString animweight)]::["skipFrame" (XMLgetBoolString skipFrame)]::nil nil -> newanimmark in let addGraphItem strcatn animname::" #"::id::nil (strcatn id::"."::animname::nil) iTypeAnim alias newanimmark nil groupstr.GRP_xmlMark treecinematics animstate 0 -> treeanim in ( if (!import) then nil else set lTmpFunctionsImport = [(strcatn (XMLgetParam animmark "id")::"."::animname::nil) (strcatn id::"."::animname::nil)]::lTmpFunctionsImport; V3DanimationSetDefaultSkipFrame animstr skipFrame; set lanims = [animstr animmark newanimmark]::lanims; ); set i = i + 1; ); let sizelist lanims -> size in let 0 -> i in while i < size do ( let nth_list lanims i -> [animstr animmark newanimmark] in let XMLgetMarksByValueFromMarkSons animmark "track" -> ltrackmarks in let sizelist ltrackmarks -> jsize in let 0 -> j in while j < jsize do ( let V3DaddSequenceAnimationTrack animstr -> trackidx in let XMLaddMark xmlEditSceneFile "track" newanimmark nil nil -> newtrackstr in let nth_list ltrackmarks j -> trackmark in let XMLgetMarksByValueFromMarkSons trackmark "keyframe" -> lkeymarks in let sizelist lkeymarks -> ksize in let 0 -> k in while k < ksize do ( let nth_list lkeymarks k -> keymark in let XMLgetParam keymark "animId" -> keyanimid in let XMLgetParam keymark "animName" -> keyanim in let atof XMLgetParam keymark "length" -> length in let atof XMLgetParam keymark "transition" -> transition in let atof XMLgetParam keymark "decal" -> decal in let strcatn keyanimid::"."::keyanim::nil -> curkeyanimname in let if import then switchstri lTmpFunctionsImport curkeyanimname else curkeyanimname -> curkeyanimname in let if import then let cutDotName curkeyanimname -> [nid _] in nid else keyanimid -> keyanimid in let V3DgetAnimationByName sessionstr curkeyanimname -> keyanimstr in //let if length == nil then SO3AnimationGetLength keyanimstr.V3D_anim else length -> length in ( if (keyanimstr == nil) then nil else { XMLaddMark xmlEditSceneFile "keyframe" newtrackstr ["animId" keyanimid]::["animName" keyanim]::["length" (XMLgetShortFloatToString length)]::["transition" (XMLgetShortFloatToString transition)]::["decal" (XMLgetShortFloatToString decal)]::nil nil; V3DaddSequenceAnimationKey animstr trackidx keyanimstr length transition decal; } ); set k = k + 1; ); set j = j + 1; ); set i = i + 1; ); ); 0;; fun loadEnvironment(viewstr, groupmark)= let getGroupName currentProject nil -> resgroup in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetDefaultViewport viewstr -> defaultviewportstr in let XMLgetMarkByValueFromMarkSons groupmark "environment" -> envxml in if envxml == nil then nil else ( let XMLgetMarkByValueFromMarkSons envxml "materialScheme" -> matschemestr in let XMLgetParam matschemestr "name" -> schemename in let XMLgetMarkByValueFromMarkSons envxml "skyBox" -> skyboxstr in let XMLgetBoolParam skyboxstr "enable" -> skyboxenable in let XMLgetParam skyboxstr "material" -> skyboxmat in let XMLgetParam skyboxstr "alias" -> skyboxalias in let atof XMLgetParam skyboxstr "distance" -> skyboxdistance in let XMLgetBoolParam skyboxstr "drawFirst" -> skyboxdrawfirst in let XMLgetMarkByValueFromMarkSons skyboxstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> skyboxqx in let atof XMLgetParam skyboxrotstr "qy" -> skyboxqy in let atof XMLgetParam skyboxrotstr "qz" -> skyboxqz in let atof XMLgetParam skyboxrotstr "qw" -> skyboxqw in let XMLgetMarkByValueFromMarkSons envxml "skyDome" -> skydomestr in let XMLgetBoolParam skydomestr "enable" -> skydomeenable in let XMLgetParam skydomestr "material" -> skydomemat in let XMLgetParam skydomestr "alias" -> skydomealias in let atof XMLgetParam skydomestr "distance" -> skydomedistance in let atof XMLgetParam skydomestr "tiling" -> skydometiling in let atof XMLgetParam skydomestr "curvature" -> skydomecurve in let atoi XMLgetParam skydomestr "xSegments" -> skydomexseg in let atoi XMLgetParam skydomestr "ySegments" -> skydomeyseg in let XMLgetBoolParam skydomestr "drawFirst" -> skydomedrawfirst in let XMLgetMarkByValueFromMarkSons skydomestr "rotation" -> skydomerotstr in let atof XMLgetParam skydomerotstr "qx" -> skydomeqx in let atof XMLgetParam skydomerotstr "qy" -> skydomeqy in let atof XMLgetParam skydomerotstr "qz" -> skydomeqz in let atof XMLgetParam skydomerotstr "qw" -> skydomeqw in let XMLgetMarkByValueFromMarkSons envxml "skyPlane" -> skyplanstr in let XMLgetBoolParam skyplanstr "enable" -> skyplanenable in let XMLgetParam skyplanstr "material" -> skyplanmat in let XMLgetParam skyplanstr "alias" -> skyplanalias in let atof XMLgetParam skyplanstr "planeX" -> skyplanx in let atof XMLgetParam skyplanstr "planeY" -> skyplany in let atof XMLgetParam skyplanstr "planeZ" -> skyplanz in let atof XMLgetParam skyplanstr "planeD" -> skypland in let atof XMLgetParam skyplanstr "scale" -> skyplanscale in let atof XMLgetParam skyplanstr "bow" -> skyplanbow in let atof XMLgetParam skyplanstr "tiling" -> skyplantiling in let atoi XMLgetParam skyplanstr "xSegments" -> skyplanxseg in let atoi XMLgetParam skyplanstr "ySegments" -> skyplanyseg in let XMLgetBoolParam skyplanstr "drawFirst" -> skyplandrawfirst in let XMLgetMarkByValueFromMarkSons envxml "fog" -> fogstr in let XMLgetParam fogstr "mode" -> sfogmode in let atof XMLgetParam fogstr "linearStart" -> foglinearStart in let atof XMLgetParam fogstr "linearEnd" -> foglinearEnd in let atof XMLgetParam fogstr "density" -> fogdensity in let XMLgetMarkByValueFromMarkSons fogstr "colourDiffuse" -> fogambstr in let make_rgba (ftoi ((atof XMLgetParam fogambstr "r") *. 255.0)) (ftoi ((atof XMLgetParam fogambstr "g") *. 255.0)) (ftoi ((atof XMLgetParam fogambstr "b") *. 255.0)) 255 -> fogcolor in let XMLgetMarkByValueFromMarkSons fogstr "colourDiffuse" -> fogambstr in let make_rgba (ftoi ((atof XMLgetParam fogambstr "r") *. 255.0)) (ftoi ((atof XMLgetParam fogambstr "g") *. 255.0)) (ftoi ((atof XMLgetParam fogambstr "b") *. 255.0)) 255 -> fogcolor in let XMLgetMarkByValue xmlEditSceneFile "scene" -> scenestr in let XMLgetMarkByValueFromMarkSons scenestr "environment" -> targetenvironmentstr in ( if (fogstr == nil) then nil else let XMLgetMarkByValueFromMarkSons targetenvironmentstr "fog" -> targetfogstr in let if targetfogstr != nil then targetfogstr else XMLaddMark xmlEditSceneFile "fog" targetenvironmentstr nil nil -> targetfogstr in let XMLgetMarkByValueFromMarkSons targetfogstr "colourDiffuse" -> targetfogcolorstr in let if targetfogcolorstr != nil then targetfogcolorstr else XMLaddMark xmlEditSceneFile "colourDiffuse" targetfogstr nil nil -> targetfogcolorstr in ( XMLsetParam targetfogstr "mode" sfogmode; XMLsetParam targetfogstr "linearStart" XMLgetShortFloatToString foglinearStart; XMLsetParam targetfogstr "linearEnd" XMLgetShortFloatToString foglinearEnd; XMLsetParam targetfogstr "density" XMLgetShortFloatToString fogdensity; XMLsetParam targetfogcolorstr "r" (XMLgetParam fogambstr "r"); XMLsetParam targetfogcolorstr "g" (XMLgetParam fogambstr "g"); XMLsetParam targetfogcolorstr "b" (XMLgetParam fogambstr "b"); V3DsetSceneFog sessionstr (getOgreFogType sfogmode) fogcolor fogdensity foglinearStart foglinearEnd; ); if (skyboxstr == nil) then nil else let (SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup skyboxmat) -> skymat in let XMLgetMarkByValueFromMarkSons targetenvironmentstr "skyBox" -> targetskyboxstr in ( if targetskyboxstr != nil then nil else addGraphItem "SkyBox" "SkyBox" iTypeSkyBox skyboxalias (XMLcopyMark xmlEditSceneFile skyboxstr targetenvironmentstr) nil groupmark (getEdCtrlTreeRootItem ctrlSceneTree) 1 0; SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat skyboxdistance [skyboxqx skyboxqy skyboxqz skyboxqw] resgroup skyboxenable skyboxdrawfirst; ); if (skydomestr == nil) then nil else let (SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup skydomemat) -> skymat in let XMLgetMarkByValueFromMarkSons targetenvironmentstr "SkyDome" -> targetskydomestr in ( if targetskydomestr != nil then nil else addGraphItem "SkyDome" "SkyDome" iTypeSkyDome skydomealias (XMLcopyMark xmlEditSceneFile skyboxstr targetenvironmentstr) nil groupmark (getEdCtrlTreeRootItem ctrlSceneTree) 1 0; SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat skydomedistance [skydomeqx skydomeqy skydomeqz skydomeqw] (if skydomecurve == nil then 0.0 else skydomecurve) skydometiling skydomexseg skydomeyseg (-1) resgroup skydomeenable skydomedrawfirst; ); if (skyplanstr == nil) then nil else let (SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup skyplanmat) -> skymat in let XMLgetMarkByValueFromMarkSons targetenvironmentstr "SkyPlane" -> targetskyplanstr in ( if targetskyplanstr != nil then nil else addGraphItem "SkyPlane" "SkyPlane" iTypeSkyPlane skyplanalias (XMLcopyMark xmlEditSceneFile skyplanstr targetenvironmentstr) nil groupmark (getEdCtrlTreeRootItem ctrlSceneTree) 1 0; SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat skypland [skyplanx skyplany skyplanz] skyplanscale skyplantiling (if skyplanbow == nil then 0.0 else skyplanbow) skyplanxseg skyplanyseg resgroup skyplanenable skyplandrawfirst; ); let XMLgetMarksByValueFromMarkSons envxml "compositor" -> lcompmark in if lcompmark == nil then nil else let sizelist lcompmark -> size in let 0 -> i in while i < size do ( let nth_list lcompmark i -> compmark in let XMLgetParam compmark "name" -> compname in let XMLgetParam compmark "alias" -> alias in let XMLgetBoolParam compmark "enable" -> compstate in ( //if !compstate then nil else // SO3ViewportAddCompositor (V3DgetSession sessionstr) compname defaultviewportstr.V3D_viewport; addGraphItem strcatn "Compositor \""::compname::"\""::nil compname iTypeCompositor alias (XMLcopyMark xmlEditSceneFile compmark targetenvironmentstr) nil groupmark (getEdCtrlTreeRootItem ctrlSceneTree) compstate 0; ); set i = i + 1; ); if schemename == nil then nil else SO3ViewportSetMaterialScheme defaultviewportstr.V3D_viewport schemename; renderingLoadEnv envxml targetenvironmentstr viewstr; //shadows shadowsLoadEnv envxml targetenvironmentstr sessionstr; //environment environmentLoadEnv envxml targetenvironmentstr sessionstr; //physics physicsLoadEnv envxml targetenvironmentstr sessionstr; //default camera let XMLgetMarkByValueFromMarkSons envxml "defaultCamera" -> defcamerastr in let XMLgetBoolParam defcamerastr "orthographic" -> cameraortho in let atof XMLgetParam defcamerastr "windowScale" -> windowscale in let atof XMLgetParam defcamerastr "fov" -> camerafov in let if camerafov == nil then 57.29 else camerafov -> camerafov in let atof XMLgetParam defcamerastr "focalLength" -> camerafocallength in let if camerafocallength == nil then 1.0 else camerafocallength -> camerafocallength in let atof XMLgetParam defcamerastr "dist" -> cameradist in let if cameradist == nil then let SO3ObjectGetPosition (V3DgetDefaultCamera sessionstr) -> [_ _ d] in d else cameradist -> cameradist in let XMLgetMarkByValueFromMarkSons defcamerastr "clipping" -> camclippingstr in let atof XMLgetParam camclippingstr "near" -> camclipnear in let if camclipnear == nil then 0.1 else camclipnear -> camclipnear in let atof XMLgetParam camclippingstr "far" -> camclipfar in let if camclipfar == nil then 1000.0 else camclipfar -> camclipfar in let XMLgetMarkByValueFromMarkSons defcamerastr "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let if xpos == nil then 0.0 else xpos -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let if ypos == nil then 0.0 else ypos -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let if zpos == nil then 0.0 else zpos -> zpos in let XMLgetMarkByValueFromMarkSons defcamerastr "rotation" -> noderotstr in let atof XMLgetParam noderotstr "x" -> xang in let atof XMLgetParam noderotstr "y" -> yang in let atof XMLgetParam noderotstr "z" -> zang in let XMLaddMark xmlEditSceneFile "defaultCamera" targetenvironmentstr ["orthographic" (XMLgetBoolString cameraortho)]::["windowScale" XMLgetShortFloatToString windowscale]::["fov" XMLgetShortFloatToString camerafov]::["focalLength" XMLgetShortFloatToString camerafocallength]::["dist" XMLgetShortFloatToString cameradist]::nil nil -> targetdefcamerastr in ( XMLaddMark xmlEditSceneFile "clipping" targetdefcamerastr ["near" XMLgetShortFloatToString camclipnear]::["far" XMLgetShortFloatToString camclipfar]::nil nil; XMLaddMark xmlEditSceneFile "position" targetdefcamerastr ["x" XMLgetShortFloatToString xpos]::["y" XMLgetShortFloatToString ypos]::["z" XMLgetShortFloatToString zpos]::nil nil; XMLaddMark xmlEditSceneFile "rotation" targetdefcamerastr ["x" XMLgetShortFloatToString xang]::["y" XMLgetShortFloatToString yang]::["z" XMLgetShortFloatToString zang]::nil nil; let SO3MathsDegreeToRadian camerafov -> fov in V3DsetCamera (V3DgetDefaultCamera sessionstr) camerafocallength fov camclipnear camclipfar; SO3ObjectSetPosition (V3DgetDefaultCamera sessionstr) [0.0 0.0 cameradist]; V3DsetShellNavPos sessionstr [xpos ypos zpos]; if (noderotstr == nil) then nil else V3DsetShellNavAng sessionstr SO3MathsEulerXYZToQuat [(SO3MathsDegreeToRadian xang) (SO3MathsDegreeToRadian yang) (SO3MathsDegreeToRadian zang)]; V3DsetOrthographicMode (V3DgetDefaultCamera sessionstr) cameraortho; V3DsetOrthographicScale (V3DgetDefaultCamera sessionstr) windowscale; ); //default light let XMLgetMarkByValueFromMarkSons envxml "defaultLight" -> deflightstr in let XMLgetBoolParam deflightstr "enable" -> deflightenable in let if (deflightstr == nil) then 1 else deflightenable -> deflightenable in let XMLaddMark xmlEditSceneFile "defaultLight" targetenvironmentstr ["enable" (XMLgetBoolString deflightenable)]::nil nil -> targetdeflightstr in ( enableDefaultLight deflightenable; ); ); ); 0;; fun playSceneGraph(viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetDefaultViewport viewstr -> defaultviewportstr in ( let sizelist lSceneGraph -> lsgsize in let 0 -> lsgi in while lsgi < lsgsize do ( let nth_list lSceneGraph lsgi -> [ename [etreeitem etype ealias emark _ egroupmark initstate staticgeometry]] in if (!strcmp "default_light" ename) || (!strcmp "default_camera" ename) then nil else let V3DgetObjectByName sessionstr ename -> node in ( if ((etype == iTypeLight) && !initstate) then nil else SO3ObjectSetVisible node 1 0; // SCENE if etype == iTypeScene then ( let XMLgetMarkByValueFromMarkSons emark "environment" -> envxml in ( environmentPlaySceneGraph envxml defaultviewportstr sessionstr; renderingPlaySceneGraph envxml defaultviewportstr; if (!bShowWireMode) then nil else SO3ViewportSetShadowEnabled defaultviewportstr.V3D_viewport 0; ); 0; ) // PARTICLE else if etype == iTypeParticle then ( SO3ParticleSystemSetEnable node initstate; 0; ) // ANIMS else if etype == iTypeAnim then ( let V3DgetAnimationByName sessionstr ename -> animstr in ( V3DsetAnimationState animstr initstate; V3DinitializeAnimation animstr 1; ); 0; ) // NODE else if etype == iTypeNode then ( let SO3SceneNodeGetBody node -> body in ( V3DphysFreezeBody body initstate; SO3ObjectSetAsStaticGeometry node staticgeometry; ); 0; ) else if etype == iTypeGroup then ( 0; ) // MESH else if etype == iTypeEntity then ( let SO3SceneNodeGetBody node -> body in ( V3DphysFreezeBody body initstate; SO3ObjectSetAsStaticGeometry node staticgeometry; ); 0; ) // COMPOSITOR else if etype == iTypeCompositor then ( let XMLgetParam emark "name" -> compname in let XMLgetParam emark "scheme" -> compschemename in ( V3DregisterCompositor defaultviewportstr compname compschemename; if initstate then SO3ViewportAddCompositor defaultviewportstr.V3D_viewport compname compschemename else SO3ViewportRemoveCompositor defaultviewportstr.V3D_viewport compname; ); 0; ) // CUBEMAP else if etype == iTypeCubeMap then ( SO3DynamicCubeMapSetEnable node initstate; 0; ) // REFLECTIONMAP else if etype == iTypeReflectionMap then ( SO3DynamicReflectionMapSetEnable node initstate; 0; ) else nil; ); set lsgi = lsgi + 1; ); ); 0;; fun refreshSceneGraph(viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetDefaultViewport viewstr -> defaultviewportstr in let SO3SceneGetObject (V3DgetSession sessionstr) "default_camera" -> defaultcam in ( V3DphysResetPhysic sessionstr; // Reset env environmentRefreshSceneGraph sessionstr defaultviewportstr; enableDefaultLight bLastDefaultLightState; // restore default camera V3DsetDefaultCamera sessionstr defaultcam; V3DchangeCameraViewport sessionstr (V3DgetDefaultViewport viewstr) defaultcam; V3DenableNavigate sessionstr 1; let sizelist lSceneGraph -> lsgsize in let 0 -> lsgi in while lsgi < lsgsize do ( let nth_list lSceneGraph lsgi -> [ename [etreeitem etype ealias emark _ egroupmark initstate staticgeometry]] in let XMLgetParam emark.XMLfather "id" -> fid in let XMLgetParam emark.XMLfather "name" -> fname in let if (fid == nil) || (fname == nil) then nil else V3DgetObjectByName sessionstr strcatn fid::"."::fname::nil -> father in let getGroupName currentProject egroupmark -> resgroup in if (!strcmp "default_light" ename) || (!strcmp "default_camera" ename) then nil else ( // SCENE if etype == iTypeScene then ( let XMLgetMarkByValueFromMarkSons emark "environment" -> envxml in if envxml == nil then nil else ( let XMLgetMarkByValueFromMarkSons envxml "materialScheme" -> matschemestr in let XMLgetParam matschemestr "name" -> schemename in let XMLgetMarkByValueFromMarkSons envxml "fog" -> fogstr in let XMLgetParam fogstr "mode" -> sfogmode in let atof XMLgetParam fogstr "linearStart" -> foglinearStart in let atof XMLgetParam fogstr "linearEnd" -> foglinearEnd in let atof XMLgetParam fogstr "density" -> fogdensity in let XMLgetMarkByValueFromMarkSons fogstr "colourDiffuse" -> fogambstr in let make_rgba (ftoi ((atof XMLgetParam fogambstr "r") *. 255.0)) (ftoi ((atof XMLgetParam fogambstr "g") *. 255.0)) (ftoi ((atof XMLgetParam fogambstr "b") *. 255.0)) 255 -> fogcolor in ( if (fogstr == nil) then nil else V3DsetSceneFog sessionstr (getOgreFogType sfogmode) fogcolor fogdensity foglinearStart foglinearEnd; if schemename == nil then nil else SO3ViewportSetMaterialScheme defaultviewportstr.V3D_viewport schemename; //physics physicsRefreshSceneGraph envxml sessionstr; //rendering renderingRefreshSceneGraph envxml viewstr; //shadows shadowsRefreshSceneGraph envxml defaultviewportstr sessionstr; ); ); 0; ) // SHELL else if etype == iTypeNode || etype == iTypeGroup || etype == iTypeBone then ( let V3DgetObjectByName sessionstr ename -> shell in let XMLgetBoolParam emark "hidden" -> nodehidden in let XMLgetBoolParam emark "staticGeometry" -> nodestaticgeometry in let XMLgetMarkByValueFromMarkSons emark "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons emark "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons emark "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in ( if father == nil || etype == iTypeBone then nil else SO3ObjectLink shell father; SO3ObjectSetPosition shell [xpos ypos zpos]; SO3ObjectSetOrientation shell [xang yang zang wang]; SO3ObjectSetScale shell [xscale yscale zscale]; SO3ObjectSetAsStaticGeometry shell 0; //manage sons and check parent state in scene graph applyNodeVisibility shell iTypeNode !nodehidden; // physics physicsRefreshNodeGraph emark shell sessionstr; ); 0; ) // ENTITY else if etype == iTypeEntity then ( let V3DgetObjectByName sessionstr ename -> mesh in let XMLgetBoolParam emark "indexMaterials" -> indexmat in let XMLgetBoolParam emark "castShadows" -> meshcastshadow in let XMLgetBoolParam emark "hidden" -> meshhidden in let XMLgetBoolParam emark "staticGeometry" -> meshstaticgeometry in let XMLgetBoolParam emark "receiveShadows" -> meshreceiveshadow in let atof (XMLgetParam emark "renderingDistance") -> renderdistance in let atoi (XMLgetParam emark "renderQueue") -> queue in let htoi XMLgetParam emark "visibilityFlags" -> meshvisibilityflags in let XMLgetMarkByValueFromMarkSons emark "subentities" -> subentitiesstr in let XMLgetMarksByValueFromMarkSons subentitiesstr "subentity" -> lentitystr in let XMLgetMarkByValueFromMarkSons emark "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons emark "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons emark "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in ( if father == nil then nil else SO3ObjectLink mesh father; let sizelist lentitystr -> size in let 0 -> i in while i < size do ( let nth_list lentitystr i -> elem in let atoi XMLgetParam elem "index" -> subidx in let XMLgetParam elem "materialName" -> submatname in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup submatname -> submat in SO3EntitySetMaterial mesh submat subidx; set i = i + 1; ); SO3ObjectSetPosition mesh [xpos ypos zpos]; SO3ObjectSetOrientation mesh [xang yang zang wang]; SO3ObjectSetScale mesh [xscale yscale zscale]; SO3ObjectSetRenderingDistance mesh renderdistance; SO3ObjectSetRenderQueue mesh queue; SO3EntitySetVisibilityFlags mesh meshvisibilityflags; // physics physicsRefreshNodeGraph emark mesh sessionstr; SO3ObjectSetCastShadows mesh meshcastshadow; SO3ObjectSetAsStaticGeometry mesh 0; //manage parents in scene graph applyNodeVisibility mesh etype !meshhidden; ); 0; ) // LIGHT else if etype == iTypeLight then ( let V3DgetObjectByName sessionstr ename -> light in let getOgreMaxLightType (XMLgetParam emark "type") -> lighttype in let XMLgetBoolParam emark "hidden" -> hidden in let XMLgetBoolParam emark "castShadows" -> lightcastshadow in let XMLgetBoolParam emark "volumetric" -> lightvolumetric in let atof XMLgetParam emark "power" -> lightpower in let XMLgetParam emark "enable" -> slightenable in let if slightenable == nil then 1 else (XMLgetBoolParam emark "enable") -> lightenable in let XMLgetMarkByValueFromMarkSons emark "colourDiffuse" -> lightdiffusestr in let make_rgba (ftoi ((atof XMLgetParam lightdiffusestr "r") *. 255.0)) (ftoi ((atof XMLgetParam lightdiffusestr "g") *. 255.0)) (ftoi ((atof XMLgetParam lightdiffusestr "b") *. 255.0)) 255 -> lightdiffusecolor in let XMLgetMarkByValueFromMarkSons emark "colourSpecular" -> lightspecularstr in let make_rgba (ftoi ((atof XMLgetParam lightspecularstr "r") *. 255.0)) (ftoi ((atof XMLgetParam lightspecularstr "g") *. 255.0)) (ftoi ((atof XMLgetParam lightspecularstr "b") *. 255.0)) 255 -> lightspecularcolor in let XMLgetMarkByValueFromMarkSons emark "lightAttenuation" -> lightattenuationstr in let atof XMLgetParam lightattenuationstr "range" -> lightrange in let XMLgetMarkByValueFromMarkSons emark "lightRange" -> lightrangestr in let atof XMLgetParam lightrangestr "inner" -> lightinner in let atof XMLgetParam lightrangestr "outer" -> lightouter in let XMLgetMarkByValueFromMarkSons emark "lightSourceSize" -> lightsourcesizestr in let atof XMLgetParam lightsourcesizestr "w" -> lightw in let atof XMLgetParam lightsourcesizestr "h" -> lighth in let XMLgetMarkByValueFromMarkSons emark "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons emark "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons emark "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in ( SO3LightSetVisible light (lightenable && !hidden); if father == nil then nil else SO3ObjectLink light father; SO3ObjectSetPosition light [xpos ypos zpos]; SO3ObjectSetOrientation light [xang yang zang wang]; SO3ObjectSetScale light [xscale yscale zscale]; SO3LightSetType light lighttype; SO3LightSetPowerScale light lightpower; SO3LightSetDiffuseColor light lightdiffusecolor; SO3LightSetSpecularColor light lightspecularcolor; SO3LightSetAttenuationAuto light lightrange; SO3ObjectSetCastShadows light lightcastshadow; SO3LightSetVolumetric light lightvolumetric; if (lightrangestr == nil) then nil else ( SO3LightSetSpotInnerAngle light lightinner; SO3LightSetSpotOuterAngle light lightouter; ); if (lightsourcesizestr == nil) then nil else SO3LightSetSourceSize light [lightw lighth]; if (!hidden) then ( if (isParentHidden light) then nil else showNodeVisibilityChildren light !lightenable; 0; ) else ( SO3ObjectSetVisible light 0 1; 0; ); ); 0; ) // CAMERA else if etype == iTypeCamera then ( let V3DgetObjectByName sessionstr ename -> camera in let atof XMLgetParam emark "fov" -> camerafov in let atof XMLgetParam emark "focalLength" -> camerafocallength in let if camerafocallength == nil then 1.0 else camerafocallength -> camerafocallength in let XMLgetBoolParam emark "hidden" -> hidden in let XMLgetMarkByValueFromMarkSons emark "clipping" -> camclippingstr in let atof XMLgetParam camclippingstr "near" -> camclipnear in let atof XMLgetParam camclippingstr "far" -> camclipfar in let XMLgetMarkByValueFromMarkSons emark "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons emark "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons emark "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in ( if father == nil then nil else SO3ObjectLink camera father; SO3ObjectSetPosition camera [xpos ypos zpos]; SO3ObjectSetOrientation camera [xang yang zang wang]; SO3ObjectSetScale camera [xscale yscale zscale]; V3DsetCamera camera camerafocallength camerafov camclipnear camclipfar; applyNodeVisibility camera etype !hidden; ); 0; ) // PARTICLE else if etype == iTypeParticle then ( let V3DgetObjectByName sessionstr ename -> partsystem in let XMLgetParam emark "template" -> parttpl in let atof XMLgetParam emark "speed" -> partspeed in let if partspeed == nil then 1.0 else partspeed -> partspeed in let XMLgetBoolParam emark "enable" -> partenable in let atof (XMLgetParam emark "renderingDistance") -> renderdistance in let XMLgetBoolParam emark "hidden" -> hidden in let XMLgetMarkByValueFromMarkSons emark "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons emark "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons emark "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in ( if father == nil then nil else SO3ObjectLink partsystem father; SO3ObjectSetPosition partsystem [xpos ypos zpos]; SO3ObjectSetOrientation partsystem [xang yang zang wang]; SO3ObjectSetScale partsystem [xscale yscale zscale]; SO3ParticleSystemSetSpeedFactor partsystem partspeed; SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; SO3ObjectSetRenderingDistance partsystem renderdistance; applyNodeVisibility partsystem etype !hidden; ); 0; ) // CUBEMAP else if etype == iTypeCubeMap then ( let V3DgetObjectByName sessionstr ename -> cubemap in let XMLgetParam emark "material" -> matname in let atoi XMLgetParam emark "technique" -> mattech in let if mattech == nil then 0 else mattech -> mattech in let atoi XMLgetParam emark "pass" -> matpass in let if matpass == nil then 0 else matpass -> matpass in let atoi XMLgetParam emark "texunit" -> mattex in let if mattex == nil then 0 else mattex -> mattex in let atoi XMLgetParam emark "texsize" -> texsize in let if texsize == nil then 256 else texsize -> texsize in let XMLgetBoolParam emark "enable" -> enable in let atof XMLgetParam emark "renderingDistance" -> renderdistance in let XMLgetBoolParam emark "autoUpdate" -> autoupdate in let XMLgetBoolParam emark "hidden" -> hidden in let XMLgetMarkByValueFromMarkSons emark "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons emark "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons emark "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in ( if father == nil then nil else SO3ObjectLink cubemap father; SO3DynamicCubeMapSetEnable cubemap 0; SO3DynamicCubeMapSetAutoUpdate cubemap autoupdate; SO3DynamicCubeMapSetTextureSize cubemap texsize; SO3ObjectSetPosition cubemap [xpos ypos zpos]; SO3ObjectSetOrientation cubemap [xang yang zang wang]; SO3ObjectSetScale cubemap [xscale yscale zscale]; applyNodeVisibility cubemap etype !hidden; //SO3ObjectSetRenderingDistance cubemap renderdistance; ) ) // REFLECTIONMAP else if etype == iTypeReflectionMap then ( let V3DgetObjectByName sessionstr ename -> reflectionmap in let XMLgetParam emark "material" -> matname in let atoi XMLgetParam emark "technique" -> mattech in let if mattech == nil then 0 else mattech -> mattech in let atoi XMLgetParam emark "pass" -> matpass in let if matpass == nil then 0 else matpass -> matpass in let atoi XMLgetParam emark "texunit" -> mattex in let if mattex == nil then 0 else mattex -> mattex in let atoi XMLgetParam emark "texsize" -> texsize in let if texsize == nil then 256 else texsize -> texsize in let XMLgetBoolParam emark "enable" -> enable in let atof XMLgetParam emark "renderingDistance" -> renderdistance in let XMLgetBoolParam emark "revertClipPlane" -> revertclip in let XMLgetBoolParam emark "hidden" -> hidden in let XMLgetMarkByValueFromMarkSons emark "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons emark "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons emark "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in ( if father == nil then nil else SO3ObjectLink reflectionmap father; SO3DynamicReflectionMapSetEnable reflectionmap 0; SO3DynamicReflectionMapSetRevertClipPlane reflectionmap revertclip; SO3DynamicReflectionMapSetTextureSize reflectionmap texsize; SO3ObjectSetPosition reflectionmap [xpos ypos zpos]; SO3ObjectSetOrientation reflectionmap [xang yang zang wang]; SO3ObjectSetScale reflectionmap [xscale yscale zscale]; applyNodeVisibility reflectionmap etype !hidden; //SO3ObjectSetRenderingDistance reflectionmap renderdistance; ) ) // ANIMS else if etype == iTypeAnim then ( let V3DgetAnimationByName sessionstr ename -> animstr in let XMLgetParam emark "name" -> animname in let XMLgetParam emark "type" -> animtype in let XMLgetBoolParam emark "enable" -> animstate in let XMLgetBoolParam emark "loop" -> animloop in let getOgreAnimationInterpolationType (XMLgetParam emark "interpolationMode") -> animintmode in let getOgreAnimationRotInterpolationType (XMLgetParam emark "rotationInterpolationMode") -> animintrotmode in let atof XMLgetParam emark "length" -> animlength in let atof XMLgetParam emark "speed" -> animspeed in let atof XMLgetParam emark "weight" -> animweight in let XMLgetBoolParam emark "skipFrame" -> skipFrame in let if (XMLgetParam emark "skipFrame") == nil then 1 else skipFrame -> skipFrame in let if animweight == nil then 1.0 else animweight -> animweight in let if (animspeed == nil) then fDefaultAnimationSpeed else animspeed -> animspeed in ( V3DresetAnimation animstr; V3DsetAnimationWeight animstr animweight; V3DsetAnimationLoop animstr animloop; V3DsetAnimationSpeed animstr animspeed; V3DanimationSetDefaultSkipFrame animstr skipFrame; if (!strcmp animtype "morph") || (!strcmp animtype "pose") || (!strcmp animtype "skeletal") then nil else ( V3DsetAnimationInterpolationMode animstr animintmode; V3DsetAnimationRotInterpolationMode animstr animintrotmode; ); ); 0; ) // SKYBOX else if etype == iTypeSkyBox then ( let XMLgetBoolParam emark "enable" -> skyboxenable in let XMLgetParam emark "material" -> skyboxmat in let atof XMLgetParam emark "distance" -> skyboxdistance in let XMLgetBoolParam emark "drawFirst" -> skyboxdrawfirst in let XMLgetMarkByValueFromMarkSons emark "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> skyboxqx in let atof XMLgetParam skyboxrotstr "qy" -> skyboxqy in let atof XMLgetParam skyboxrotstr "qz" -> skyboxqz in let atof XMLgetParam skyboxrotstr "qw" -> skyboxqw in ( let (SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup skyboxmat) -> skymat in SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat skyboxdistance [skyboxqx skyboxqy skyboxqz skyboxqw] resgroup skyboxenable skyboxdrawfirst; ); 0; ) // SKYDOME else if etype == iTypeSkyDome then ( let XMLgetBoolParam emark "enable" -> skydomeenable in let XMLgetParam emark "material" -> skydomemat in let atof XMLgetParam emark "distance" -> skydomedistance in let atof XMLgetParam emark "tiling" -> skydometiling in let atof XMLgetParam emark "curvature" -> skydomecurve in let atoi XMLgetParam emark "xSegments" -> skydomexseg in let atoi XMLgetParam emark "ySegments" -> skydomeyseg in let XMLgetBoolParam emark "drawFirst" -> skydomedrawfirst in let XMLgetMarkByValueFromMarkSons emark "rotation" -> skydomerotstr in let atof XMLgetParam skydomerotstr "qx" -> skydomeqx in let atof XMLgetParam skydomerotstr "qy" -> skydomeqy in let atof XMLgetParam skydomerotstr "qz" -> skydomeqz in let atof XMLgetParam skydomerotstr "qw" -> skydomeqw in ( let (SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup skydomemat) -> skymat in SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat skydomedistance [skydomeqx skydomeqy skydomeqz skydomeqw] (if skydomecurve == nil then 0.0 else skydomecurve) skydometiling skydomexseg skydomeyseg (-1) resgroup skydomeenable skydomedrawfirst; ); 0; ) // SKYPLANE else if etype == iTypeSkyPlane then ( let XMLgetBoolParam emark "enable" -> skyplanenable in let XMLgetParam emark "material" -> skyplanmat in let atof XMLgetParam emark "planeX" -> skyplanx in let atof XMLgetParam emark "planeY" -> skyplany in let atof XMLgetParam emark "planeZ" -> skyplanz in let atof XMLgetParam emark "planeD" -> skypland in let atof XMLgetParam emark "scale" -> skyplanscale in let atof XMLgetParam emark "bow" -> skyplanbow in let atof XMLgetParam emark "tiling" -> skyplantiling in let atoi XMLgetParam emark "xSegments" -> skyplanxseg in let atoi XMLgetParam emark "ySegments" -> skyplanyseg in let XMLgetBoolParam emark "drawFirst" -> skyplandrawfirst in ( let (SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup skyplanmat) -> skymat in SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat skypland [skyplanx skyplany skyplanz] skyplanscale skyplantiling (if skyplanbow == nil then 0.0 else skyplanbow) skyplanxseg skyplanyseg resgroup skyplanenable skyplandrawfirst; ); 0; ) // COMPOSITOR else if etype == iTypeCompositor then ( let XMLgetParam emark "name" -> compname in ( V3DunRegisterCompositor defaultviewportstr compname; SO3ViewportRemoveCompositor defaultviewportstr.V3D_viewport compname; ); 0; ) else nil; ); set lsgi = lsgi + 1; ); ); 0;; fun loadBonesChilds(sessionstr, bone, xmlfather, treenode, groupmark)= let SO3ObjectGetName bone -> bonename in let cutDotName bonename -> [id name] in let SO3ObjectGetPosition bone -> [rbxp rbyp rbzp] in let SO3ObjectGetOrientation bone -> [rbxq rbyq rbzq rbwq] in let SO3ObjectGetScale bone -> [rbxs rbys rbzs] in let XMLaddMark xmlEditSceneFile "bone" xmlfather ["id" id]::["name" name]::nil nil -> bonexmlstr in let addGraphItem strcatn name::" #"::id::nil bonename iTypeBone nil bonexmlstr nil groupmark treenode 0 0 -> treebone in let SO3ObjectGetChildren bone -> lchild in ( SO3ObjectSetFlags bone iNodeFlagScene; XMLaddMark xmlEditSceneFile "scale" bonexmlstr ["x" (XMLgetShortFloatToString rbxs)]::["y" (XMLgetShortFloatToString rbys)]::["z" (XMLgetShortFloatToString rbzs)]::nil nil; XMLaddMark xmlEditSceneFile "position" bonexmlstr ["x" (XMLgetShortFloatToString rbxp)]::["y" (XMLgetShortFloatToString rbyp)]::["z" (XMLgetShortFloatToString rbzp)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" bonexmlstr ["qx" (XMLgetShortFloatToString rbxq)]::["qy" (XMLgetShortFloatToString rbyq)]::["qz" (XMLgetShortFloatToString rbzq)]::["qw" (XMLgetShortFloatToString rbwq)]::nil nil; while lchild != nil do ( loadBonesChilds sessionstr (hd lchild) bonexmlstr treebone groupmark; set lchild = tl lchild; ); ); 0;; fun loadBonesChildsFromXos(sessionstr, bone, xmlfather, treenode, groupstr, meshstr, import)= let SO3ObjectGetName bone -> bonename in let cutDotName bonename -> [id name] in let SO3ObjectGetPosition bone -> [rbxp rbyp rbzp] in let SO3ObjectGetOrientation bone -> [rbxq rbyq rbzq rbwq] in let SO3ObjectGetScale bone -> [rbxs rbys rbzs] in let XMLgetMarkByValueAndParamValueFromMarkSons meshstr "bone" "name" name -> srcbonexml in let XMLgetParam srcbonexml "alias" -> alias in let XMLaddMark xmlEditSceneFile "bone" xmlfather ["id" id]::["name" name]::["alias" alias]::nil nil -> bonexmlstr in let addGraphItem strcatn name::" #"::id::nil bonename iTypeBone alias bonexmlstr nil groupstr.GRP_xmlMark treenode 0 0 -> treebone in let SO3ObjectGetChildren bone -> lchild in let XMLgetMarkByValueFromMarkSons srcbonexml "position" -> nodeposstr in let if nodeposstr == nil then rbxp else atof XMLgetParam nodeposstr "x" -> rbxp in let if nodeposstr == nil then rbyp else atof XMLgetParam nodeposstr "y" -> rbyp in let if nodeposstr == nil then rbzp else atof XMLgetParam nodeposstr "z" -> rbzp in let XMLgetMarkByValueFromMarkSons srcbonexml "rotation" -> noderotstr in let if noderotstr == nil then rbxq else atof XMLgetParam noderotstr "qx" -> rbxq in let if noderotstr == nil then rbyq else atof XMLgetParam noderotstr "qy" -> rbyq in let if noderotstr == nil then rbzq else atof XMLgetParam noderotstr "qz" -> rbzq in let if noderotstr == nil then rbwq else atof XMLgetParam noderotstr "qw" -> rbwq in let XMLgetMarkByValueFromMarkSons srcbonexml "scale" -> nodescalestr in let if nodescalestr == nil then rbxs else atof XMLgetParam nodescalestr "x" -> rbxs in let if nodescalestr == nil then rbys else atof XMLgetParam nodescalestr "y" -> rbys in let if nodescalestr == nil then rbzs else atof XMLgetParam nodescalestr "z" -> rbzs in ( SO3ObjectSetPosition bone [rbxp rbyp rbzp]; SO3ObjectSetOrientation bone [rbxq rbyq rbzq rbwq]; SO3ObjectSetScale bone [rbxs rbys rbzs]; SO3ObjectSetFlags bone iNodeFlagScene; XMLaddMark xmlEditSceneFile "scale" bonexmlstr ["x" (XMLgetShortFloatToString rbxs)]::["y" (XMLgetShortFloatToString rbys)]::["z" (XMLgetShortFloatToString rbzs)]::nil nil; XMLaddMark xmlEditSceneFile "position" bonexmlstr ["x" (XMLgetShortFloatToString rbxp)]::["y" (XMLgetShortFloatToString rbyp)]::["z" (XMLgetShortFloatToString rbzp)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" bonexmlstr ["qx" (XMLgetShortFloatToString rbxq)]::["qy" (XMLgetShortFloatToString rbyq)]::["qz" (XMLgetShortFloatToString rbzq)]::["qw" (XMLgetShortFloatToString rbwq)]::nil nil; //physics physicsLoadOsNode srcbonexml bonexmlstr bone sessionstr; if !import then nil else set lTmpFunctionsImport = [(strcatn (XMLgetParam srcbonexml "id")::"."::name::nil) (strcatn id::"."::name::nil)]::lTmpFunctionsImport; while lchild != nil do ( loadBonesChildsFromXos sessionstr (hd lchild) bonexmlstr treebone groupstr srcbonexml import; set lchild = tl lchild; ); ); 0;; fun refreshGraphMeshAnimations(viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in let getGraphItemsByType iTypeEntity -> lentity in while (lentity != nil) do ( let hd lentity -> [val [treenode type alias markstr path destgroup initstate staticgeometry]] in //add new morph and skeleton let SO3SceneGetObject (V3DgetSession sessionstr) val -> mesh in let SO3ObjectGetAnimations mesh -> lmorph in let XMLgetMarkByValueFromMarkSons markstr "animations" -> targetanimsmark in while (lmorph != nil) do ( let hd lmorph -> anim in let SO3AnimationGetType anim -> atype in if ((atype == SO3_SCENENODE_ANIM) || (atype == SO3_SEQUENCE_ANIM)) then nil else let SO3AnimationGetName anim -> animname in if (XMLgetMarkByValueAndParamValueFromMark targetanimsmark "animation" "name" animname) != nil then nil else ( let if (atype == SO3_SCENENODE_ANIM) then "node" else if (atype == SO3_SKELETAL_ANIM) then "skeletal" else if (atype == SO3_VERTEX_ANIM) then "morph" else if (atype == SO3_POSE_ANIM) then "pose" else nil -> ratype in let itoa getNewSceneIndex nil -> animid in let if targetanimsmark == nil then XMLaddMark xmlEditSceneFile "animations" markstr nil nil else targetanimsmark -> targetanimsmark in let XMLaddMark xmlEditSceneFile "animation" targetanimsmark ["id" animid]::["name" animname]::["type" ratype]::["enable" (XMLgetBoolString 0)]::["loop" (XMLgetBoolString 0)]::["speed" (XMLgetShortFloatToString fDefaultAnimationSpeed)]::["weight" (XMLgetShortFloatToString 1.0)]::["skipFrame" (XMLgetBoolString 1)]::nil nil -> newanimmark in let addGraphItem strcatn animname::" #"::animid::" ("::ratype::")"::nil (strcatn animid::"."::animname::nil) iTypeAnim nil newanimmark nil destgroup treenode 0 0 -> treenode in ( V3DaddMorphAnimation sessionstr anim mesh (atoi animid) animname (strcatn animid::"."::animname::nil) fDefaultAnimationSpeed 1.0 0 0; ); ); set lmorph = tl lmorph; ); set lentity = tl lentity; ); 0;; fun loadOsGraph(groupstr, viewstr, srcnodemark, destfathermark, destgroup, father, treefather, import)= let getGroupName currentProject destgroup -> resgroup in let V3DgetDefaultSession viewstr -> sessionstr in let if import == 2 then set import = 1 else 0 -> fselect in ( // SHELL let XMLgetMarksByValueFromMarkSons srcnodemark "shell" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> nodexml in let if import then nil else XMLgetParam nodexml "id" -> id in let XMLgetParam nodexml "name" -> nodename in let XMLgetParam nodexml "alias" -> alias in let XMLgetBoolParam nodexml "hidden" -> nodehidden in let if nodehidden == nil then 0 else nodehidden -> nodehidden in let XMLgetBoolParam nodexml "staticGeometry" -> nodestaticgeometry in let if nodestaticgeometry == nil then 0 else nodestaticgeometry -> nodestaticgeometry in let XMLgetMarkByValueFromMarkSons nodexml "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons nodexml "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons nodexml "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in //keep for compatibility let XMLgetMarkByValueFromMarkSons nodexml "body" -> bodystr in let XMLgetBoolParam bodystr "enable" -> bodyenable in let itoa getNewSceneIndex (atoi id) -> id in let SO3SceneNodeCreate (V3DgetSession sessionstr) (strcatn id::"."::nodename::nil) -> shell in ( if shell == nil then ( addLogMessage strcatn (loc "OS3D_0150")::nodename::(loc "OS3D_0481")::nil; 0; ) else let if destfathermark == nil then nil else XMLaddMark xmlEditSceneFile "shell" destfathermark ["id" id]::["name" nodename]::["alias" alias]::["hidden" (XMLgetBoolString nodehidden)]::["staticGeometry" (XMLgetBoolString nodestaticgeometry)]::nil nil -> shellxmlstr in let addGraphItem strcatn nodename::" #"::id::nil (strcatn id::"."::nodename::nil) iTypeNode alias (if shellxmlstr == nil then nodexml else shellxmlstr) nil destgroup treefather bodyenable nodestaticgeometry -> treenode in ( if !import then nil else set lTmpFunctionsImport = [(strcatn (XMLgetParam nodexml "id")::"."::nodename::nil) (strcatn id::"."::nodename::nil)]::lTmpFunctionsImport; if father == nil then nil else SO3ObjectLink shell father; SO3ObjectSetFlags shell iNodeFlagScene; SO3ObjectSetPosition shell [xpos ypos zpos]; SO3ObjectSetOrientation shell [xang yang zang wang]; SO3ObjectSetScale shell [xscale yscale zscale]; if shellxmlstr == nil then nil else ( XMLaddMark xmlEditSceneFile "scale" shellxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" shellxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" shellxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; ); V3DshowObjectHelper viewstr sessionstr shell iTypeNode 1; if !fselect then nil else selEdCtrlTreeItem ctrlSceneTree treenode; //load physics first only when not static otherwise body update order is bad //if (nodestaticgeometry) then nil else physicsLoadOsNode nodexml shellxmlstr shell sessionstr; loadOsGraph groupstr viewstr nodexml shellxmlstr destgroup shell treenode import; //load physics after when static otherwise position are bad //if (!nodestaticgeometry) then nil else //physicsLoadOsNode nodexml shellxmlstr shell sessionstr; //do it after load //applyNodeVisibility shell iTypeNode !nodehidden; if (!nodehidden) then nil else SO3ObjectSetVisible shell 0 1; ); ); set lnodexml = tl lnodexml; ); // ENTITY let XMLgetMarksByValueFromMarkSons srcnodemark "mesh" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> meshstr in let if import then nil else XMLgetParam meshstr "id" -> id in let XMLgetParam meshstr "name" -> meshname in let XMLgetParam meshstr "alias" -> alias in let strlowercase XMLgetParam meshstr "path" -> meshres in let strlowercase XMLgetParam meshstr "skeletonlink" -> sklpath in let XMLgetBoolParam meshstr "indexMaterials" -> indexmat in let XMLgetBoolParam meshstr "castShadows" -> meshcastshadow in let XMLgetBoolParam meshstr "hidden" -> meshhidden in let XMLgetBoolParam meshstr "staticGeometry" -> meshstaticgeometry in let XMLgetBoolParam meshstr "receiveShadows" -> meshreceiveshadow in let atof XMLgetParam meshstr "renderingDistance" -> meshrenderdistance in let atoi XMLgetParam meshstr "renderQueue" -> meshqueue in let atoi XMLgetParam meshstr "nbLODlevel" -> nblodlevel in let if nblodlevel == nil then 0 else nblodlevel -> nblodlevel in let if meshqueue == nil then 50 else meshqueue -> meshqueue in let htoi XMLgetParam meshstr "visibilityFlags" -> meshvisibilityflags in let if meshvisibilityflags == nil then 0xFFFFFFFF else meshvisibilityflags -> meshvisibilityflags in let XMLgetMarkByValueFromMarkSons meshstr "subentities" -> subentitiesstr in let XMLgetMarkByValueFromMarkSons meshstr "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons meshstr "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons meshstr "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in //keep for compatibility let XMLgetMarkByValueFromMarkSons meshstr "body" -> bodystr in let XMLgetBoolParam bodystr "enable" -> bodyenable in let strlowercase OGMATfindResourcePath meshres lResourcesPath -> meshpath in let itoa getNewSceneIndex (atoi id) -> id in let if meshpath != nil then SO3SceneLoadEntity (V3DgetSession sessionstr) resgroup (strcatn id::"."::meshname::nil) _checkpack meshpath else nil -> mesh in ( if mesh == nil then ( addLogMessage strcatn (loc "OS3D_0149")::meshname::(strcat (loc "OS3D_0475") " ")::meshres::(loc "OS3D_0015")::nil; 0; ) else let if destfathermark == nil then nil else XMLaddMark xmlEditSceneFile "mesh" destfathermark ["id" id]::["name" meshname]::["alias" alias]::["path" meshpath]::["castShadows" (XMLgetBoolString meshcastshadow)]::["receiveShadows" (XMLgetBoolString meshreceiveshadow)]::["renderingDistance" (XMLgetShortFloatToString meshrenderdistance)]::["renderQueue" (itoa meshqueue)]::["nbLODlevel" (itoa nblodlevel)]::["indexMaterials" (XMLgetBoolString indexmat)]::["hidden" (XMLgetBoolString meshhidden)]::["staticGeometry" (XMLgetBoolString meshstaticgeometry)]::["visibilityFlags" itoh meshvisibilityflags]::(if sklpath == nil then nil else ["skeletonlink" sklpath])::nil nil -> meshxmlstr in let if destfathermark == nil then nil else XMLaddMark xmlEditSceneFile "subentities" meshxmlstr nil nil -> meshxmlsubstr in let addGraphItem (strcatn meshname::" #"::id::nil) (strcatn id::"."::meshname::nil) iTypeEntity alias (if meshxmlstr == nil then meshstr else meshxmlstr) meshpath destgroup treefather bodyenable meshstaticgeometry -> treenode in ( SO3ObjectSetFlags mesh iNodeFlagScene; SO3ObjectSetPosition mesh [xpos ypos zpos]; SO3ObjectSetOrientation mesh [xang yang zang wang]; SO3ObjectSetScale mesh [xscale yscale zscale]; SO3ObjectSetRenderingDistance mesh meshrenderdistance; SO3ObjectSetRenderQueue mesh meshqueue; if (nblodlevel == 0) then nil else SO3EntityGenerateLOD mesh nblodlevel; SO3EntitySetVisibilityFlags mesh meshvisibilityflags; if father == nil then nil else SO3ObjectLink mesh father; if (_checkpack sklpath) == nil then nil else ( V3DaddResource sessionstr sklpath resgroup SO3_RESOURCE_SKELETON; SO3EntityAttachSkeleton mesh _checkpack sklpath; addOsSceneResource xmlEditSceneFile destgroup groupstr sklpath SO3_RESOURCE_SKELETON; let SO3GetRootBonesFromMesh mesh -> rootbones in let sizelist rootbones -> nbrootbones in let 0 -> j in while j < nbrootbones do ( loadBonesChildsFromXos sessionstr (nth_list rootbones j) meshxmlstr treenode groupstr meshstr import; set j = j + 1; ); ); if !import then nil else set lTmpFunctionsImport = [(strcatn (XMLgetParam meshstr "id")::"."::meshname::nil) (strcatn id::"."::meshname::nil)]::lTmpFunctionsImport; let SO3EntityNumOfSubEntities mesh -> nbsub in let SO3EntityMaterialList mesh -> ldefmat in let XMLgetMarksByValueFromMarkSons subentitiesstr "subentity" -> lsubmarks in let 0 -> j in while j < nbsub do ( let nth_list lsubmarks j -> elem in //let XMLgetMarkByValueAndParamValueFromMark subentitiesstr "subentity" "index" (itoa j) -> elem in let SO3MaterialGetName (nth_list ldefmat j) -> defmat in let if ((elem != nil) && ((atoi(XMLgetParam elem "index")) == j)) then XMLgetParam elem "materialName" else defmat -> submatname in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup submatname -> submat in ( XMLaddMark xmlEditSceneFile "subentity" meshxmlsubstr ["index" (itoa j)]::["materialName" submatname]::["defaultMaterial" defmat]::nil nil; SO3EntitySetMaterial mesh submat j; ); set j = j + 1; ); if meshxmlstr == nil then nil else ( XMLaddMark xmlEditSceneFile "scale" meshxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" meshxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" meshxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; ); //V3DaddResource sessionstr meshpath resgroup SO3_RESOURCE_MESH; addOsSceneResource xmlEditSceneFile destgroup groupstr meshpath SO3_RESOURCE_MESH; SO3ObjectSetCastShadows mesh meshcastshadow; if !fselect then nil else selEdCtrlTreeItem ctrlSceneTree treenode; //load physics first only when not static otherwise body update order is bad //if (meshstaticgeometry) then nil else physicsLoadOsNode meshstr meshxmlstr mesh sessionstr; loadOsGraph groupstr viewstr meshstr meshxmlstr destgroup mesh treenode import; //load physics first only when not static otherwise body update order is bad //if (!meshstaticgeometry) then nil else //physicsLoadOsNode meshstr meshxmlstr mesh sessionstr; //do it after load //applyNodeVisibility mesh iTypeEntity !meshhidden; if (!meshhidden) then nil else SO3ObjectSetVisible mesh 0 1; ); ); set lnodexml = tl lnodexml; ); // LIGHT let XMLgetMarksByValueFromMarkSons srcnodemark "light" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> lightstr in let getOgreMaxLightType (XMLgetParam lightstr "type") -> lighttype in let if import then nil else XMLgetParam lightstr "id" -> id in let XMLgetParam lightstr "name" -> lightname in let XMLgetParam lightstr "alias" -> alias in let XMLgetBoolParam lightstr "hidden" -> hidden in let if hidden == nil then 0 else hidden -> hidden in let XMLgetBoolParam lightstr "castShadows" -> lightcastshadow in let XMLgetBoolParam lightstr "volumetric" -> lightvolumetric in let atof XMLgetParam lightstr "power" -> lightpower in let if (lightpower == nil) then 1.0 else lightpower -> lightpower in let XMLgetParam lightstr "enable" -> slightenable in let if slightenable == nil then 1 else (XMLgetBoolParam lightstr "enable") -> lightenable in let XMLgetMarkByValueFromMarkSons lightstr "colourDiffuse" -> lightdiffusestr in let make_rgba (ftoi ((atof XMLgetParam lightdiffusestr "r") *. 255.0)) (ftoi ((atof XMLgetParam lightdiffusestr "g") *. 255.0)) (ftoi ((atof XMLgetParam lightdiffusestr "b") *. 255.0)) 255 -> lightdiffusecolor in let XMLgetMarkByValueFromMarkSons lightstr "colourSpecular" -> lightspecularstr in let make_rgba (ftoi ((atof XMLgetParam lightspecularstr "r") *. 255.0)) (ftoi ((atof XMLgetParam lightspecularstr "g") *. 255.0)) (ftoi ((atof XMLgetParam lightspecularstr "b") *. 255.0)) 255 -> lightspecularcolor in let XMLgetMarkByValueFromMarkSons lightstr "lightAttenuation" -> lightattenuationstr in let atof XMLgetParam lightattenuationstr "range" -> lightrange in let XMLgetMarkByValueFromMarkSons lightstr "lightRange" -> lightrangestr in let atof XMLgetParam lightrangestr "inner" -> lightinner in let atof XMLgetParam lightrangestr "outer" -> lightouter in let XMLgetMarkByValueFromMarkSons lightstr "lightSourceSize" -> lightsourcesizestr in let atof XMLgetParam lightsourcesizestr "w" -> lightw in let atof XMLgetParam lightsourcesizestr "h" -> lighth in let XMLgetMarkByValueFromMarkSons lightstr "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons lightstr "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons lightstr "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in let itoa getNewSceneIndex (atoi id) -> id in let SO3LightCreate (V3DgetSession sessionstr) (strcatn id::"."::lightname::nil) -> light in ( if light == nil then ( addLogMessage strcatn (loc "OS3D_0148")::lightname::(loc "OS3D_0480")::nil; 0; ) else let if destfathermark == nil then nil else XMLaddMark xmlEditSceneFile "light" destfathermark ["id" id]::["name" lightname]::["type" (getOgreMaxLightByType lighttype)]::["alias" alias]::["castShadows" (XMLgetBoolString lightcastshadow)]::["volumetric" (XMLgetBoolString lightvolumetric)]::["power" (XMLgetShortFloatToString lightpower)]::["enable" XMLgetBoolString lightenable]::["hidden" XMLgetBoolString hidden]::nil nil -> lightxmlstr in let addGraphItem strcatn lightname::" #"::id::nil (strcatn id::"."::lightname::nil) iTypeLight alias (if lightxmlstr == nil then lightstr else lightxmlstr) nil destgroup treefather lightenable 0 -> treenode in ( if !import then nil else set lTmpFunctionsImport = [(strcatn (XMLgetParam lightstr "id")::"."::lightname::nil) (strcatn id::"."::lightname::nil)]::lTmpFunctionsImport; if father == nil then nil else SO3ObjectLink light father; SO3ObjectSetFlags light iNodeFlagScene; SO3ObjectSetPosition light [xpos ypos zpos]; SO3ObjectSetOrientation light [xang yang zang wang]; SO3ObjectSetScale light [xscale yscale zscale]; if lightxmlstr == nil then nil else ( XMLaddMark xmlEditSceneFile "scale" lightxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" lightxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" lightxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; XMLaddMark xmlEditSceneFile "colourDiffuse" lightxmlstr ["r" (XMLgetParam lightdiffusestr "r")]::["g" (XMLgetParam lightdiffusestr "g")]::["b" (XMLgetParam lightdiffusestr "b")]::nil nil; XMLaddMark xmlEditSceneFile "colourSpecular" lightxmlstr ["r" (XMLgetParam lightspecularstr "r")]::["g" (XMLgetParam lightspecularstr "g")]::["b" (XMLgetParam lightspecularstr "b")]::nil nil; XMLaddMark xmlEditSceneFile "lightAttenuation" lightxmlstr ["range" (XMLgetShortFloatToString lightrange)]::nil nil; ); SO3LightSetType light lighttype; SO3LightSetPowerScale light lightpower; SO3LightSetDiffuseColor light lightdiffusecolor; SO3LightSetSpecularColor light lightspecularcolor; SO3LightSetAttenuationAuto light lightrange; SO3ObjectSetCastShadows light lightcastshadow; SO3LightSetVolumetric light lightvolumetric; SO3LightSetVisible light lightenable; V3DshowObjectHelper viewstr sessionstr light iTypeLight 1; if (lightrangestr == nil) then nil else ( if (lightxmlstr == nil) then nil else XMLaddMark xmlEditSceneFile "lightRange" lightxmlstr ["inner" (XMLgetShortFloatToString lightinner)]::["outer" (XMLgetShortFloatToString lightouter)]::nil nil; SO3LightSetSpotInnerAngle light lightinner; SO3LightSetSpotOuterAngle light lightouter; ); if (lightsourcesizestr == nil) then nil else ( if (lightxmlstr == nil) then nil else XMLaddMark xmlEditSceneFile "lightSourceSize" lightxmlstr ["w" (XMLgetShortFloatToString lightw)]::["h" (XMLgetShortFloatToString lighth)]::nil nil; SO3LightSetSourceSize light [lightw lighth]; ); if !fselect then nil else selEdCtrlTreeItem ctrlSceneTree treenode; loadOsGraph groupstr viewstr lightstr lightxmlstr destgroup light treenode import; if (!hidden) then nil else SO3ObjectSetVisible light 0 1; ); ); set lnodexml = tl lnodexml; ); // CAMERA let XMLgetMarksByValueFromMarkSons srcnodemark "camera" -> lnodexml in while (lnodexml != nil) do ( let hd lnodexml -> camerastr in let if import then nil else XMLgetParam camerastr "id" -> id in let XMLgetParam camerastr "name" -> cameraname in let XMLgetParam camerastr "alias" -> alias in let XMLgetBoolParam camerastr "hidden" -> hidden in let if hidden == nil then 0 else hidden -> hidden in let atof XMLgetParam camerastr "fov" -> camerafov in let atof XMLgetParam camerastr "focalLength" -> camerafocallength in let if camerafocallength == nil then 1.0 else camerafocallength -> camerafocallength in let XMLgetMarkByValueFromMarkSons camerastr "clipping" -> camclippingstr in let atof XMLgetParam camclippingstr "near" -> camclipnear in let atof XMLgetParam camclippingstr "far" -> camclipfar in let XMLgetMarkByValueFromMarkSons camerastr "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons camerastr "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons camerastr "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in let itoa getNewSceneIndex (atoi id) -> id in let V3DaddCamera sessionstr (strcatn id::"."::cameraname::nil) -> camera in ( if camera == nil then ( addLogMessage strcatn (loc "OS3D_0147")::cameraname::(loc "OS3D_0478")::nil; 0; ) else let if destfathermark == nil then nil else XMLaddMark xmlEditSceneFile "camera" destfathermark ["id" id]::["name" cameraname]::["alias" alias]::["fov" (XMLgetShortFloatToString camerafov)]::["focalLength" (XMLgetShortFloatToString camerafocallength)]::["hidden" XMLgetBoolString hidden]::nil nil -> camxmlstr in let addGraphItem strcatn cameraname::" #"::id::nil (strcatn id::"."::cameraname::nil) iTypeCamera alias (if camxmlstr == nil then camerastr else camxmlstr) nil destgroup treefather 0 0 -> treenode in ( if !import then nil else set lTmpFunctionsImport = [(strcatn (XMLgetParam camerastr "id")::"."::cameraname::nil) (strcatn id::"."::cameraname::nil)]::lTmpFunctionsImport; if father == nil then nil else SO3ObjectLink camera father; SO3ObjectSetFlags camera iNodeFlagScene; SO3ObjectSetPosition camera [xpos ypos zpos]; SO3ObjectSetOrientation camera [xang yang zang wang]; SO3ObjectSetScale camera [xscale yscale zscale]; if destfathermark == nil then nil else ( XMLaddMark xmlEditSceneFile "scale" camxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" camxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" camxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; XMLaddMark xmlEditSceneFile "clipping" camxmlstr ["near" (XMLgetShortFloatToString camclipnear)]::["far" (XMLgetShortFloatToString camclipfar)]::nil nil; ); V3DsetCamera camera camerafocallength camerafov camclipnear camclipfar; V3DshowObjectHelper viewstr sessionstr camera iTypeCamera 1; if !fselect then nil else selEdCtrlTreeItem ctrlSceneTree treenode; loadOsGraph groupstr viewstr camerastr camxmlstr destgroup camera treenode import; if (!hidden) then nil else SO3ObjectSetVisible camera 0 1; ); ); set lnodexml = tl lnodexml; ); // PARTICLE let XMLgetMarksByValueFromMarkSons srcnodemark "particle" -> lpartxml in while (lpartxml != nil) do ( let hd lpartxml -> partstr in let if import then nil else XMLgetParam partstr "id" -> id in let XMLgetParam partstr "name" -> partname in let XMLgetParam partstr "alias" -> alias in let XMLgetBoolParam partstr "hidden" -> hidden in let if hidden == nil then 0 else hidden -> hidden in let XMLgetParam partstr "template" -> parttpl in let atof XMLgetParam partstr "speed" -> partspeed in let if partspeed == nil then 1.0 else partspeed -> partspeed in let atof (XMLgetParam partstr "renderingDistance") -> partrenderdistance in let if partrenderdistance == nil then 0.0 else partrenderdistance -> partrenderdistance in let XMLgetBoolParam partstr "enable" -> partenable in let XMLgetMarkByValueFromMarkSons partstr "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons partstr "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in // manage the case the xos has bad scale parameter on particle let XMLgetMarkByValueFromMarkSons partstr "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let if xscale == nil || xscale == 0.0 then 1.0 else xscale -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let if yscale == nil || yscale == 0.0 then 1.0 else yscale -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in let if zscale == nil || zscale == 0.0 then 1.0 else zscale -> zscale in let itoa getNewSceneIndex (atoi id) -> id in let V3DaddParticleSystem sessionstr (strcatn id::"."::partname::nil) parttpl -> partsystem in ( if partsystem == nil then ( addLogMessage strcatn (loc "OS3D_0151")::partname::(loc "OS3D_0482")::nil; 0; ) else let if destfathermark == nil then nil else XMLaddMark xmlEditSceneFile "particle" destfathermark ["id" id]::["name" partname]::["alias" alias]::["template" parttpl]::["speed" (XMLgetShortFloatToString partspeed)]::["renderingDistance" (XMLgetShortFloatToString partrenderdistance)]::["enable" (XMLgetBoolString partenable)]::["hidden" XMLgetBoolString hidden]::nil nil -> partxmlstr in let addGraphItem strcatn partname::" #"::id::nil (strcatn id::"."::partname::nil) iTypeParticle alias (if partxmlstr == nil then partstr else partxmlstr) nil destgroup treefather partenable 0 -> treenode in ( if !import then nil else set lTmpFunctionsImport = [(strcatn (XMLgetParam partstr "id")::"."::partname::nil) (strcatn id::"."::partname::nil)]::lTmpFunctionsImport; if father == nil then nil else SO3ObjectLink partsystem father; SO3ObjectSetFlags partsystem iNodeFlagScene; SO3ObjectSetPosition partsystem [xpos ypos zpos]; SO3ObjectSetOrientation partsystem [xang yang zang wang]; SO3ObjectSetScale partsystem [xscale yscale zscale]; if destfathermark == nil then nil else ( XMLaddMark xmlEditSceneFile "scale" partxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" partxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" partxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; ); SO3ParticleSystemSetSpeedFactor partsystem partspeed; SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; SO3ObjectSetRenderingDistance partsystem partrenderdistance; V3DshowObjectHelper viewstr sessionstr partsystem iTypeParticle 1; if !fselect then nil else selEdCtrlTreeItem ctrlSceneTree treenode; loadOsGraph groupstr viewstr partstr partxmlstr destgroup partsystem treenode import; if (!hidden) then nil else SO3ObjectSetVisible partsystem 0 1; ); ); set lpartxml = tl lpartxml; ); // CUBEMAP let XMLgetMarksByValueFromMarkSons srcnodemark "cubemap" -> lcubemapxml in while (lcubemapxml != nil) do ( let hd lcubemapxml -> cubemapstr in let if import then nil else XMLgetParam cubemapstr "id" -> id in let XMLgetParam cubemapstr "name" -> cubemapname in let XMLgetParam cubemapstr "alias" -> alias in let XMLgetBoolParam cubemapstr "hidden" -> hidden in let if hidden == nil then 0 else hidden -> hidden in let XMLgetParam cubemapstr "material" -> matname in let atoi XMLgetParam cubemapstr "technique" -> mattech in let if mattech == nil then 0 else mattech -> mattech in let atoi XMLgetParam cubemapstr "pass" -> matpass in let if matpass == nil then 0 else matpass -> matpass in let atoi XMLgetParam cubemapstr "texunit" -> mattex in let if mattex == nil then 0 else mattex -> mattex in let atoi XMLgetParam cubemapstr "texsize" -> texsize in let if texsize == nil then 256 else texsize -> texsize in let XMLgetBoolParam cubemapstr "enable" -> cubemapenable in let atof XMLgetParam cubemapstr "renderingDistance" -> renderdistance in let XMLgetBoolParam cubemapstr "autoUpdate" -> autoupdate in let XMLgetMarkByValueFromMarkSons cubemapstr "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons cubemapstr "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons cubemapstr "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in let itoa getNewSceneIndex (atoi id) -> id in let SO3DynamicCubeMapCreate (V3DgetSession sessionstr) (strcatn id::"."::cubemapname::nil) -> cubemap in ( if cubemap == nil then ( addLogMessage strcatn (loc "OS3D_0144")::cubemapname::(loc "OS3D_0483")::nil; 0; ) else let if destfathermark == nil then nil else XMLaddMark xmlEditSceneFile "cubemap" destfathermark ["id" id]::["name" cubemapname]::["alias" alias]::["material" matname]::["technique" (itoa mattech)]::["pass" (itoa matpass)]::["texunit" (itoa mattex)]::["texsize" (itoa texsize)]::["renderingDistance" (XMLgetShortFloatToString renderdistance)]::["enable" (XMLgetBoolString cubemapenable)]::["autoUpdate" (XMLgetBoolString autoupdate)]::["hidden" XMLgetBoolString hidden]::nil nil -> cubemapxmlstr in let addGraphItem strcatn cubemapname::" #"::id::nil (strcatn id::"."::cubemapname::nil) iTypeCubeMap alias (if cubemapxmlstr == nil then cubemapstr else cubemapxmlstr) nil destgroup treefather cubemapenable 0 -> treenode in ( if !import then nil else set lTmpFunctionsImport = [(strcatn (XMLgetParam cubemapstr "id")::"."::cubemapname::nil) (strcatn id::"."::cubemapname::nil)]::lTmpFunctionsImport; if father == nil then nil else SO3ObjectLink cubemap father; SO3ObjectSetPosition cubemap [xpos ypos zpos]; SO3ObjectSetOrientation cubemap [xang yang zang wang]; SO3ObjectSetScale cubemap [xscale yscale zscale]; SO3DynamicCubeMapSetEnable cubemap 0; SO3DynamicCubeMapSetAutoUpdate cubemap autoupdate; SO3DynamicCubeMapSetTextureSize cubemap texsize; let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> material in SO3DynamicCubeMapSetTargetMaterial cubemap material mattech matpass mattex; if destfathermark == nil then nil else ( XMLaddMark xmlEditSceneFile "scale" cubemapxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" cubemapxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" cubemapxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; ); //SO3ObjectSetRenderingDistance cubemap renderdistance; V3DshowObjectHelper viewstr sessionstr cubemap iTypeCubeMap 1; if !fselect then nil else selEdCtrlTreeItem ctrlSceneTree treenode; loadOsGraph groupstr viewstr cubemapstr cubemapxmlstr destgroup cubemap treenode import; if (!hidden) then nil else SO3ObjectSetVisible cubemap 0 1; ); ); set lcubemapxml = tl lcubemapxml; ); // REFLECTIONMAP let XMLgetMarksByValueFromMarkSons srcnodemark "reflectionmap" -> lreflectionmapxml in while (lreflectionmapxml != nil) do ( let hd lreflectionmapxml -> reflectionmapstr in let if import then nil else XMLgetParam reflectionmapstr "id" -> id in let XMLgetParam reflectionmapstr "name" -> reflectionmapname in let XMLgetParam reflectionmapstr "alias" -> alias in let XMLgetBoolParam reflectionmapstr "hidden" -> hidden in let if hidden == nil then 0 else hidden -> hidden in let XMLgetParam reflectionmapstr "material" -> matname in let atoi XMLgetParam reflectionmapstr "technique" -> mattech in let if mattech == nil then 0 else mattech -> mattech in let atoi XMLgetParam reflectionmapstr "pass" -> matpass in let if matpass == nil then 0 else matpass -> matpass in let atoi XMLgetParam reflectionmapstr "texunit" -> mattex in let if mattex == nil then 0 else mattex -> mattex in let atoi XMLgetParam reflectionmapstr "texsize" -> texsize in let if texsize == nil then 256 else texsize -> texsize in let XMLgetBoolParam reflectionmapstr "enable" -> reflectionmapenable in let atof XMLgetParam reflectionmapstr "renderingDistance" -> renderdistance in let XMLgetBoolParam reflectionmapstr "revertClipPlane" -> revertclip in let XMLgetMarkByValueFromMarkSons reflectionmapstr "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons reflectionmapstr "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons reflectionmapstr "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in let itoa getNewSceneIndex (atoi id) -> id in let V3DgetDefaultViewport viewstr -> viewport in let SO3DynamicReflectionMapCreate (V3DgetSession sessionstr) viewport.V3D_viewport (strcatn id::"."::reflectionmapname::nil) -> reflectionmap in ( if reflectionmap == nil then ( addLogMessage strcatn (loc "OS3D_0145")::reflectionmapname::(loc "OS3D_0483")::nil; 0; ) else let if destfathermark == nil then nil else XMLaddMark xmlEditSceneFile "reflectionmap" destfathermark ["id" id]::["name" reflectionmapname]::["alias" alias]::["material" matname]::["technique" (itoa mattech)]::["pass" (itoa matpass)]::["texunit" (itoa mattex)]::["texsize" (itoa texsize)]::["renderingDistance" (XMLgetShortFloatToString renderdistance)]::["enable" (XMLgetBoolString reflectionmapenable)]::["revertClipPlane" (XMLgetBoolString revertclip)]::["hidden" XMLgetBoolString hidden]::nil nil -> reflectionmapxmlstr in let addGraphItem strcatn reflectionmapname::" #"::id::nil (strcatn id::"."::reflectionmapname::nil) iTypeReflectionMap alias (if reflectionmapxmlstr == nil then reflectionmapstr else reflectionmapxmlstr) nil destgroup treefather reflectionmapenable 0 -> treenode in ( if !import then nil else set lTmpFunctionsImport = [(strcatn (XMLgetParam reflectionmapstr "id")::"."::reflectionmapname::nil) (strcatn id::"."::reflectionmapname::nil)]::lTmpFunctionsImport; if father == nil then nil else SO3ObjectLink reflectionmap father; SO3ObjectSetPosition reflectionmap [xpos ypos zpos]; SO3ObjectSetOrientation reflectionmap [xang yang zang wang]; SO3ObjectSetScale reflectionmap [xscale yscale zscale]; SO3DynamicReflectionMapSetEnable reflectionmap 0; SO3DynamicReflectionMapSetRevertClipPlane reflectionmap revertclip; SO3DynamicReflectionMapSetTextureSize reflectionmap texsize; let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> material in SO3DynamicReflectionMapSetTargetMaterial reflectionmap material mattech matpass mattex; if destfathermark == nil then nil else ( XMLaddMark xmlEditSceneFile "scale" reflectionmapxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" reflectionmapxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" reflectionmapxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; ); //SO3ObjectSetRenderingDistance reflectionmap renderdistance; V3DshowObjectHelper viewstr sessionstr reflectionmap iTypeReflectionMap 1; if !fselect then nil else selEdCtrlTreeItem ctrlSceneTree treenode; loadOsGraph groupstr viewstr reflectionmapstr reflectionmapxmlstr destgroup reflectionmap treenode import; if (!hidden) then nil else SO3ObjectSetVisible reflectionmap 0 1; ); ); set lreflectionmapxml = tl lreflectionmapxml; ); // ANIMS let XMLgetMarksByValueFromMarkSons srcnodemark "animations" -> lnodeanimsmark in while (lnodeanimsmark != nil) do // hack in case the XOS have several animations mark for the node ( let hd lnodeanimsmark -> animsmark in let XMLgetMarksByValueFromMarkSons animsmark "animation" -> lanimmarks in let XMLgetMarkByValueFromMarkSons destfathermark "animations" -> targetanimsmark in let if targetanimsmark != nil then targetanimsmark else XMLaddMark xmlEditSceneFile "animations" destfathermark nil nil -> targetanimsmark in while (lanimmarks != nil) do ( let hd lanimmarks -> animmark in let if import then nil else XMLgetParam animmark "id" -> id in let XMLgetParam animmark "name" -> animname in let XMLgetParam animmark "alias" -> alias in let XMLgetParam animmark "type" -> animtype in let XMLgetBoolParam animmark "enable" -> animstate in let XMLgetBoolParam animmark "loop" -> animloop in let getOgreAnimationInterpolationType (XMLgetParam animmark "interpolationMode") -> animintmode in let getOgreAnimationRotInterpolationType (XMLgetParam animmark "rotationInterpolationMode") -> animintrotmode in let atof XMLgetParam animmark "length" -> animlength in let atof XMLgetParam animmark "speed" -> animspeed in let atof XMLgetParam animmark "weight" -> animweight in let XMLgetBoolParam animmark "skipFrame" -> skipFrame in let if (XMLgetParam animmark "skipFrame") == nil then 1 else skipFrame -> skipFrame in let if animweight == nil then 1.0 else animweight -> animweight in let if (animspeed == nil) then fDefaultAnimationSpeed else animspeed -> animspeed in let if import then animname else (strcatn id::"."::animname::nil) -> curanimname in let itoa getNewSceneIndex (atoi id) -> id in let if (!strcmp animtype "morph") || (!strcmp animtype "pose") || (!strcmp animtype "skeletal") then let SO3ObjectGetAnimation father animname -> morphanim in V3DaddMorphAnimation sessionstr morphanim father (atoi id) animname (strcatn id::"."::animname::nil) animspeed animweight animstate animloop else V3DaddAnimation sessionstr father (atoi id) animname (strcatn id::"."::animname::nil) animlength animspeed animweight animstate animloop animintmode animintrotmode -> animstr in let SO3AnimationGetType animstr.V3D_anim -> atype in let if (atype == SO3_SCENENODE_ANIM) then "node" else if (atype == SO3_SKELETAL_ANIM) then "skeletal" else if (atype == SO3_VERTEX_ANIM) then "morph" else if (atype == SO3_POSE_ANIM) then "pose" else nil -> ratype in ( if animstr == nil then ( addLogMessage strcatn (loc "OS3D_0146")::animname::(loc "OS3D_0477")::nil; 0; ) else let if destfathermark == nil then nil else if (!strcmp animtype "morph") || (!strcmp animtype "pose") || (!strcmp animtype "skeletal") then XMLaddMark xmlEditSceneFile "animation" targetanimsmark ["id" id]::["name" animname]::["type" animtype]::["alias" alias]::["enable" (XMLgetBoolString animstate)]::["loop" (XMLgetBoolString animloop)]::["speed" (XMLgetShortFloatToString animspeed)]::["weight" (XMLgetShortFloatToString animweight)]::["skipFrame" (XMLgetBoolString skipFrame)]::nil nil else XMLaddMark xmlEditSceneFile "animation" targetanimsmark ["id" id]::["name" animname]::["type" animtype]::["alias" alias]::["enable" (XMLgetBoolString animstate)]::["loop" (XMLgetBoolString animloop)]::["interpolationMode" (getOgreAnimationInterpolationByType animintmode)]::["rotationInterpolationMode" (getOgreAnimationRotInterpolationByType animintrotmode)]::["length" (XMLgetShortFloatToString animlength)]::["speed" (XMLgetShortFloatToString animspeed)]::["weight" (XMLgetShortFloatToString animweight)]::["skipFrame" (XMLgetBoolString skipFrame)]::nil nil -> newanimmark in let addGraphItem strcatn animname::" #"::id::" ("::ratype::")"::nil (strcatn id::"."::animname::nil) iTypeAnim alias (if newanimmark == nil then animmark else newanimmark) nil destgroup treefather animstate 0 -> treenode in ( V3DanimationSetDefaultSkipFrame animstr skipFrame; if (!import) then nil else set lTmpFunctionsImport = [(strcatn (XMLgetParam animmark "id")::"."::animname::nil) (strcatn id::"."::animname::nil)]::lTmpFunctionsImport; if (!strcmp animtype "morph") || (!strcmp animtype "pose") || (!strcmp animtype "skeletal") then nil else let XMLgetMarksByValueFromMarkSons animmark "keyframe" -> lkeymarks in while (lkeymarks != nil) do ( let hd lkeymarks -> keymark in let atof (XMLgetParam keymark "time") -> keytime in let XMLgetMarkByValueFromMarkSons keymark "translation" -> keytransmark in let if (keytransmark == nil) then XMLgetMarkByValueFromMarkSons keymark "position" else keytransmark -> keytransmark in let atof XMLgetParam keytransmark "x" -> xpos in let atof XMLgetParam keytransmark "y" -> ypos in let atof XMLgetParam keytransmark "z" -> zpos in let XMLgetMarkByValueFromMarkSons keymark "rotation" -> keyrotmark in let atof XMLgetParam keyrotmark "qx" -> xang in let atof XMLgetParam keyrotmark "qy" -> yang in let atof XMLgetParam keyrotmark "qz" -> zang in let atof XMLgetParam keyrotmark "qw" -> wang in let XMLgetMarkByValueFromMarkSons keymark "scale" -> keyscalemark in let atof XMLgetParam keyscalemark "x" -> xscale in let atof XMLgetParam keyscalemark "y" -> yscale in let atof XMLgetParam keyscalemark "z" -> zscale in let if newanimmark == nil then nil else XMLaddMark xmlEditSceneFile "keyframe" newanimmark ["time" (XMLgetShortFloatToString keytime)]::nil nil -> newkeymark in ( V3DaddAnimationKey animstr [xpos ypos zpos] [xang yang zang wang] [xscale yscale zscale] keytime; if newkeymark == nil then nil else ( XMLaddMark xmlEditSceneFile "translation" newkeymark ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" newkeymark ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; XMLaddMark xmlEditSceneFile "scale" newkeymark ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; ); ); set lkeymarks = tl lkeymarks; ); 0; ); ); set lanimmarks = tl lanimmarks; ); set lnodeanimsmark = tl lnodeanimsmark; ); ); 0;; /* ********************************************************************************************* / Ogre scene Loader / ********************************************************************************************* */ fun loadOgreMaxNodes(viewstr, groupstr, srcnodemark, destfathermark, destgroup, father, treefather, units, root, lresdir)= let getGroupName currentProject destgroup -> resgroup in let V3DgetDefaultSession viewstr -> sessionstr in let XMLgetMarksByValueFromMarkSons srcnodemark "node" -> lnodexml in while (lnodexml != nil) do ( let itoa getNewSceneIndex nil -> id in // NODE let hd lnodexml -> nodexml in let XMLgetParam nodexml "name" -> nodename in let XMLgetMarkByValueFromMarkSons nodexml "position" -> nodeposstr in let if root then (atof XMLgetParam nodeposstr "x") /. units else (atof XMLgetParam nodeposstr "x") -> xpos in let if root then (atof XMLgetParam nodeposstr "y") /. units else (atof XMLgetParam nodeposstr "y") -> ypos in let if root then (atof XMLgetParam nodeposstr "z") /. units else (atof XMLgetParam nodeposstr "z") -> zpos in let XMLgetMarkByValueFromMarkSons nodexml "rotation" -> noderotstr in let if noderotstr == nil then XMLgetMarkByValueFromMarkSons nodexml "quaternion" else noderotstr -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let if xang == nil then (atof XMLgetParam noderotstr "x") else xang -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let if yang == nil then (atof XMLgetParam noderotstr "y") else yang -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let if zang == nil then (atof XMLgetParam noderotstr "z") else zang -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let if wang == nil then (atof XMLgetParam noderotstr "w") else wang -> wang in let XMLgetMarkByValueFromMarkSons nodexml "scale" -> nodescalestr in let if root then (atof XMLgetParam nodescalestr "x") /. units else (atof XMLgetParam nodescalestr "x") -> xscale in let if root then (atof XMLgetParam nodescalestr "y") /. units else (atof XMLgetParam nodescalestr "y") -> yscale in let if root then (atof XMLgetParam nodescalestr "z") /. units else (atof XMLgetParam nodescalestr "z") -> zscale in // ENTITY let XMLgetMarkByValueFromMarkSons nodexml "entity" -> entitystr in let strlowercase XMLgetParam entitystr "meshFile" -> mesh in let XMLgetBoolParam entitystr "castShadows" -> meshcastshadow in let XMLgetBoolParam entitystr "receiveShadows" -> meshreceiveshadow in let XMLgetParam entitystr "name" -> meshname in let atof (XMLgetParam entitystr "renderingDistance") -> meshrenderdistance in let XMLgetMarkByValueFromMarkSons entitystr "subentities" -> subentitiesstr in let XMLgetMarksByValueFromMarkSons subentitiesstr "subentity" -> lentitystr in // LIGHT let XMLgetMarkByValueFromMarkSons nodexml "light" -> lightstr in let getOgreMaxLightType (XMLgetParam lightstr "type") -> lighttype in let XMLgetParam lightstr "name" -> lightname in let XMLgetBoolParam lightstr "castShadows" -> lightcastshadow in let XMLgetBoolParam lightstr "volumetric" -> lightvolumetric in let atof XMLgetParam lightstr "power" -> lightpower in let if (lightpower == nil) then 1.0 else lightpower -> lightpower in let XMLgetMarkByValueFromMarkSons lightstr "colourDiffuse" -> lightdiffusestr in let make_rgba (ftoi ((atof XMLgetParam lightdiffusestr "r") *. 255.0)) (ftoi ((atof XMLgetParam lightdiffusestr "g") *. 255.0)) (ftoi ((atof XMLgetParam lightdiffusestr "b") *. 255.0)) 255 -> lightdiffusecolor in let XMLgetMarkByValueFromMarkSons lightstr "colourSpecular" -> lightspecularstr in let make_rgba (ftoi ((atof XMLgetParam lightspecularstr "r") *. 255.0)) (ftoi ((atof XMLgetParam lightspecularstr "g") *. 255.0)) (ftoi ((atof XMLgetParam lightspecularstr "b") *. 255.0)) 255 -> lightspecularcolor in let XMLgetMarkByValueFromMarkSons lightstr "lightAttenuation" -> lightattenuationstr in let if ((XMLgetParam lightattenuationstr "range") == nil) then 100.0 /. units else (atof XMLgetParam lightattenuationstr "range") /. units -> lightrange in let atof XMLgetParam lightattenuationstr "constant" -> lightconst in let atof XMLgetParam lightattenuationstr "linear" -> lightlinear in let atof if (XMLgetParam lightattenuationstr "quadric") == nil then (XMLgetParam lightattenuationstr "quadratic") else (XMLgetParam lightattenuationstr "quadric") -> lightquadratic in let XMLgetMarkByValueFromMarkSons lightstr "lightRange" -> lightrangestr in let (atof XMLgetParam lightrangestr "inner") -> lightinner in let (atof XMLgetParam lightrangestr "outer") -> lightouter in let XMLgetMarkByValueFromMarkSons lightstr "lightSourceSize" -> lightsourcesizestr in let atof XMLgetParam lightsourcesizestr "w" -> lightw in let atof XMLgetParam lightsourcesizestr "h" -> lighth in // CAMERA let XMLgetMarkByValueFromMarkSons nodexml "camera" -> camerastr in let XMLgetParam camerastr "name" -> cameraname in let atof XMLgetParam camerastr "fov" -> camerafov in let XMLgetMarkByValueFromMarkSons camerastr "clipping" -> camclippingstr in let (atof if (XMLgetParam camclippingstr "near") == nil then (XMLgetParam camclippingstr "nearPlaneDist") else (XMLgetParam camclippingstr "near")) /. units -> camclipnear in let (atof if (XMLgetParam camclippingstr "far") == nil then (XMLgetParam camclippingstr "farPlaneDist") else (XMLgetParam camclippingstr "far")) /. units -> camclipfar in let XMLgetMarkByValue xmlEditSceneFile "scene" -> scenestr in let XMLgetMarkByValueFromMarkSons scenestr "graph" -> targetgraphstr in ( let OGMATfindResourcePath mesh lresdir -> meshpath in ( if((mesh == nil) || (meshpath != nil)) then nil else addLogMessage strcatn (loc "OS3D_0154")::mesh::(loc "OS3D_0479")::nil; let if meshpath != nil then SO3SceneLoadEntity (V3DgetSession sessionstr) resgroup (strcatn id::"."::meshname::nil) _checkpack meshpath else nil -> mesh in let if lightstr != nil then SO3LightCreate (V3DgetSession sessionstr) (strcatn id::"."::lightname::nil) else nil -> light in let if camerastr != nil then V3DaddCamera sessionstr (strcatn id::"."::cameraname::nil) else nil -> camera in let if mesh == nil && light == nil && camera == nil then SO3SceneNodeCreate (V3DgetSession sessionstr) (strcatn id::"."::nodename::nil) else nil -> shell in let if shell != nil then shell else if light != nil then light else if mesh != nil then mesh else if camera != nil then camera else nil -> nnode in ( if father == nil then nil else SO3ObjectLink nnode father; SO3ObjectSetFlags nnode iNodeFlagScene; SO3ObjectSetPosition nnode [xpos ypos zpos]; SO3ObjectSetOrientation nnode [xang yang zang wang]; SO3ObjectSetScale nnode [xscale yscale zscale]; if shell != nil then let XMLaddMark xmlEditSceneFile "shell" destfathermark ["id" id]::["name" nodename]::nil nil -> shellxmlstr in let addGraphItem strcatn nodename::" #"::id::nil (strcatn id::"."::nodename::nil) iTypeNode nil shellxmlstr nil destgroup treefather 0 0 -> treenode in ( XMLaddMark xmlEditSceneFile "scale" shellxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" shellxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" shellxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; V3DshowObjectHelper viewstr sessionstr shell iTypeNode 1; // ANIMS let XMLgetMarkByValueFromMarkSons nodexml "animations" -> animsmark in let XMLgetMarksByValueFromMarkSons animsmark "animation" -> lanimmarks in let XMLgetMarkByValueFromMarkSons shellxmlstr "animations" -> targetanimsmark in let if targetanimsmark != nil then targetanimsmark else XMLaddMark xmlEditSceneFile "animations" shellxmlstr nil nil -> targetanimsmark in while (lanimmarks != nil) do ( let hd lanimmarks -> animmark in let XMLgetParam animmark "name" -> animname in let XMLgetParam animmark "type" -> animtype in let XMLgetBoolParam animmark "enable" -> animstate in let XMLgetBoolParam animmark "loop" -> animloop in let getOgreAnimationInterpolationType (XMLgetParam animmark "interpolationMode") -> animintmode in let getOgreAnimationRotInterpolationType (XMLgetParam animmark "rotationInterpolationMode") -> animintrotmode in let atof XMLgetParam animmark "length" -> animlength in let atof XMLgetParam animmark "weight" -> animweight in let if animweight == nil then 1.0 else animweight -> animweight in let (itoa getNewSceneIndex nil) -> id in let V3DaddAnimation sessionstr nnode (atoi id) animname (strcatn id::"."::animname::nil) animlength fDefaultAnimationSpeed animweight animstate animloop animintmode animintrotmode -> animstr in ( if animstr == nil then ( addLogMessage strcatn (loc "OS3D_0146")::animname::(loc "OS3D_0477")::nil; 0; ) else let XMLaddMark xmlEditSceneFile "animation" targetanimsmark ["id" id]::["name" animname]::["type" "node"]::["enable" (XMLgetBoolString animstate)]::["loop" (XMLgetBoolString animloop)]::["interpolationMode" (getOgreAnimationInterpolationByType animintmode)]::["rotationInterpolationMode" (getOgreAnimationRotInterpolationByType animintrotmode)]::["length" (XMLgetShortFloatToString animlength)]::["speed" (XMLgetShortFloatToString fDefaultAnimationSpeed)]::["weight" (XMLgetShortFloatToString animweight)]::["skipFrame" (XMLgetBoolString 1)]::nil nil -> newanimmark in let SO3AnimationGetType animstr.V3D_anim -> atype in let if (atype == SO3_SCENENODE_ANIM) then "node" else if (atype == SO3_SKELETAL_ANIM) then "skeletal" else if (atype == SO3_VERTEX_ANIM) then "morph" else if (atype == SO3_POSE_ANIM) then "pose" else nil -> ratype in let addGraphItem strcatn animname::" #"::id::" ("::ratype::")"::nil (strcatn id::"."::animname::nil) iTypeAnim nil newanimmark nil destgroup treenode animstate 0 -> treenode in ( let XMLgetMarksByValueFromMarkSons animmark "keyframe" -> lkeymarks in while (lkeymarks != nil) do ( let hd lkeymarks -> keymark in let atof (XMLgetParam keymark "time") -> keytime in let XMLgetMarkByValueFromMarkSons keymark "translation" -> keytransmark in let if (keytransmark == nil) then XMLgetMarkByValueFromMarkSons keymark "position" else keytransmark -> keytransmark in let (if root then (atof XMLgetParam keytransmark "x") /. units else (atof XMLgetParam keytransmark "x")) -> xapos in let (if root then (atof XMLgetParam keytransmark "y") /. units else (atof XMLgetParam keytransmark "y")) -> yapos in let (if root then (atof XMLgetParam keytransmark "z") /. units else (atof XMLgetParam keytransmark "z")) -> zapos in let XMLgetMarkByValueFromMarkSons keymark "rotation" -> keyrotmark in let atof XMLgetParam keyrotmark "qx" -> xaang in let atof XMLgetParam keyrotmark "qy" -> yaang in let atof XMLgetParam keyrotmark "qz" -> zaang in let atof XMLgetParam keyrotmark "qw" -> waang in let XMLgetMarkByValueFromMarkSons keymark "scale" -> keyscalemark in let (atof XMLgetParam keyscalemark "x") -> xascale in let (atof XMLgetParam keyscalemark "y") -> yascale in let (atof XMLgetParam keyscalemark "z") -> zascale in let XMLaddMark xmlEditSceneFile "keyframe" newanimmark ["time" (XMLgetShortFloatToString keytime)]::nil nil -> newkeymark in ( V3DaddAnimationKey animstr [xapos yapos zapos] [xaang yaang zaang waang] [xascale yascale zascale] keytime; XMLaddMark xmlEditSceneFile "translation" newkeymark ["x" (XMLgetShortFloatToString xapos)]::["y" (XMLgetShortFloatToString yapos)]::["z" (XMLgetShortFloatToString zapos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" newkeymark ["qx" (XMLgetShortFloatToString xaang)]::["qy" (XMLgetShortFloatToString yaang)]::["qz" (XMLgetShortFloatToString zaang)]::["qw" (XMLgetShortFloatToString waang)]::nil nil; XMLaddMark xmlEditSceneFile "scale" newkeymark ["x" (XMLgetShortFloatToString xascale)]::["y" (XMLgetShortFloatToString yascale)]::["z" (XMLgetShortFloatToString zascale)]::nil nil; ); set lkeymarks = tl lkeymarks; ); 0; ); ); set lanimmarks = tl lanimmarks; ); loadOgreMaxNodes viewstr groupstr nodexml shellxmlstr destgroup nnode treenode units 0 lresdir; ) else if mesh != nil then let strcat (getFilePathWithoutExt meshpath) ".skeleton" -> sklpath in let OGMATfindResourcePath sklpath lresdir -> sklpath in let XMLaddMark xmlEditSceneFile "mesh" destfathermark ["id" id]::["name" meshname]::["path" meshpath]::["castShadows" (XMLgetBoolString meshcastshadow)]::["receiveShadows" (XMLgetBoolString meshreceiveshadow)]::["indexMaterials" (XMLgetBoolString 0)]::["renderingDistance" (XMLgetShortFloatToString meshrenderdistance)]::["renderQueue" "50"]::["nbLODlevel" "0"]::["visibilityFlags" "0xFFFFFFFF"]::(if sklpath == nil then nil else ["skeletonlink" sklpath])::nil nil -> meshxmlstr in let XMLaddMark xmlEditSceneFile "subentities" meshxmlstr nil nil -> meshxmlsubstr in let addGraphItem (strcatn meshname::" #"::id::nil) (strcatn id::"."::meshname::nil) iTypeEntity nil meshxmlstr meshpath destgroup treefather 0 0 -> treenode in ( if (_checkpack sklpath) == nil then nil else ( V3DaddResource sessionstr sklpath resgroup SO3_RESOURCE_SKELETON; SO3EntityAttachSkeleton mesh _checkpack sklpath; addOsSceneResource xmlEditSceneFile destgroup groupstr sklpath SO3_RESOURCE_SKELETON; let SO3GetRootBonesFromMesh mesh -> rootbones in while (rootbones != nil) do ( loadBonesChilds sessionstr (hd rootbones) meshxmlstr treenode destgroup; set rootbones = tl rootbones; ); ); while (lentitystr != nil) do ( let hd lentitystr -> elem in let atoi XMLgetParam elem "index" -> subidx in let XMLgetParam elem "materialName" -> submatname in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup submatname -> submat in ( XMLaddMark xmlEditSceneFile "subentity" meshxmlsubstr ["index" (itoa subidx)]::["materialName" submatname]::["defaultMaterial" submatname]::nil nil; SO3EntitySetMaterial mesh submat subidx; ); set lentitystr = tl lentitystr; ); // morph anims let SO3ObjectGetVertexAnimations mesh -> lmorph in let 0 -> imorph in while (lmorph != nil) do ( let hd lmorph -> anim in let SO3AnimationGetType anim -> atype in let if imorph == 0 then 1 else 0 -> defstate in let itoa getNewSceneIndex nil -> animid in let SO3AnimationGetName anim -> animname in let XMLgetMarkByValueFromMarkSons meshxmlstr "animations" -> animsmark in let if animsmark != nil then animsmark else XMLaddMark xmlEditSceneFile "animations" meshxmlstr nil nil -> targetanimsmark in let if (atype == SO3_SCENENODE_ANIM) then "node" else if (atype == SO3_SKELETAL_ANIM) then "skeletal" else if (atype == SO3_VERTEX_ANIM) then "morph" else if (atype == SO3_POSE_ANIM) then "pose" else nil -> ratype in let XMLaddMark xmlEditSceneFile "animation" targetanimsmark ["id" animid]::["name" animname]::["type" ratype]::["enable" (XMLgetBoolString defstate)]::["loop" (XMLgetBoolString defstate)]::["speed" (XMLgetShortFloatToString fDefaultAnimationSpeed)]::["weight" (XMLgetShortFloatToString 1.0)]::["skipFrame" (XMLgetBoolString 1)]::nil nil -> newanimmark in let addGraphItem strcatn animname::" #"::animid::" ("::ratype::")"::nil (strcatn animid::"."::animname::nil) iTypeAnim nil newanimmark nil destgroup treenode defstate 0 -> treenode in ( V3DaddMorphAnimation sessionstr anim mesh (atoi animid) animname (strcatn animid::"."::animname::nil) fDefaultAnimationSpeed 1.0 defstate defstate; ); set imorph = imorph + 1; set lmorph = tl lmorph; ); XMLaddMark xmlEditSceneFile "scale" meshxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" meshxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" meshxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; //V3DaddResource sessionstr meshpath resgroup SO3_RESOURCE_MESH; addOsSceneResource xmlEditSceneFile destgroup groupstr meshpath SO3_RESOURCE_MESH; SO3ObjectSetCastShadows mesh meshcastshadow; SO3ObjectSetRenderingDistance mesh meshrenderdistance; SO3EntitySetVisibilityFlags mesh 0xFFFFFFFF; // ANIMS let XMLgetMarkByValueFromMarkSons nodexml "animations" -> animsmark in let XMLgetMarksByValueFromMarkSons animsmark "animation" -> lanimmarks in let XMLgetMarkByValueFromMarkSons meshxmlstr "animations" -> targetanimsmark in let if targetanimsmark != nil then targetanimsmark else XMLaddMark xmlEditSceneFile "animations" meshxmlstr nil nil -> targetanimsmark in while (lanimmarks != nil) do ( let hd lanimmarks -> animmark in let XMLgetParam animmark "name" -> animname in let XMLgetBoolParam animmark "enable" -> animstate in let XMLgetBoolParam animmark "loop" -> animloop in let getOgreAnimationInterpolationType (XMLgetParam animmark "interpolationMode") -> animintmode in let getOgreAnimationRotInterpolationType (XMLgetParam animmark "rotationInterpolationMode") -> animintrotmode in let atof XMLgetParam animmark "length" -> animlength in let atof XMLgetParam animmark "weight" -> animweight in let if animweight == nil then 1.0 else animweight -> animweight in let (itoa getNewSceneIndex nil) -> id in let V3DaddAnimation sessionstr nnode (atoi id) animname (strcatn id::"."::animname::nil) animlength fDefaultAnimationSpeed animweight animstate animloop animintmode animintrotmode -> animstr in ( if animstr == nil then ( addLogMessage strcatn (loc "OS3D_0146")::animname::(loc "OS3D_0477")::nil; 0; ) else let XMLaddMark xmlEditSceneFile "animation" targetanimsmark ["id" id]::["name" animname]::["type" "node"]::["enable" (XMLgetBoolString animstate)]::["loop" (XMLgetBoolString animloop)]::["interpolationMode" (getOgreAnimationInterpolationByType animintmode)]::["rotationInterpolationMode" (getOgreAnimationRotInterpolationByType animintrotmode)]::["length" (XMLgetShortFloatToString animlength)]::["speed" (XMLgetShortFloatToString fDefaultAnimationSpeed)]::["weight" (XMLgetShortFloatToString animweight)]::["skipFrame" (XMLgetBoolString 1)]::nil nil -> newanimmark in let addGraphItem strcatn animname::" #"::id::" ("::"node"::")"::nil (strcatn id::"."::animname::nil) iTypeAnim nil newanimmark nil destgroup treenode animstate 0 -> treenode in ( let XMLgetMarksByValueFromMarkSons animmark "keyframe" -> lkeymarks in while (lkeymarks != nil) do ( let hd lkeymarks -> keymark in let atof (XMLgetParam keymark "time") -> keytime in let XMLgetMarkByValueFromMarkSons keymark "translation" -> keytransmark in let if (keytransmark == nil) then XMLgetMarkByValueFromMarkSons keymark "position" else keytransmark -> keytransmark in let (if root then (atof XMLgetParam keytransmark "x") /. units else (atof XMLgetParam keytransmark "x")) -> xapos in let (if root then (atof XMLgetParam keytransmark "y") /. units else (atof XMLgetParam keytransmark "y")) -> yapos in let (if root then (atof XMLgetParam keytransmark "z") /. units else (atof XMLgetParam keytransmark "z")) -> zapos in let XMLgetMarkByValueFromMarkSons keymark "rotation" -> keyrotmark in let atof XMLgetParam keyrotmark "qx" -> xaang in let atof XMLgetParam keyrotmark "qy" -> yaang in let atof XMLgetParam keyrotmark "qz" -> zaang in let atof XMLgetParam keyrotmark "qw" -> waang in let XMLgetMarkByValueFromMarkSons keymark "scale" -> keyscalemark in let (atof XMLgetParam keyscalemark "x") -> xascale in let (atof XMLgetParam keyscalemark "y") -> yascale in let (atof XMLgetParam keyscalemark "z") -> zascale in let XMLaddMark xmlEditSceneFile "keyframe" newanimmark ["time" (XMLgetShortFloatToString keytime)]::nil nil -> newkeymark in ( V3DaddAnimationKey animstr [xapos yapos zapos] [xaang yaang zaang waang] [xascale yascale zascale] keytime; XMLaddMark xmlEditSceneFile "translation" newkeymark ["x" (XMLgetShortFloatToString xapos)]::["y" (XMLgetShortFloatToString yapos)]::["z" (XMLgetShortFloatToString zapos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" newkeymark ["qx" (XMLgetShortFloatToString xaang)]::["qy" (XMLgetShortFloatToString yaang)]::["qz" (XMLgetShortFloatToString zaang)]::["qw" (XMLgetShortFloatToString waang)]::nil nil; XMLaddMark xmlEditSceneFile "scale" newkeymark ["x" (XMLgetShortFloatToString xascale)]::["y" (XMLgetShortFloatToString yascale)]::["z" (XMLgetShortFloatToString zascale)]::nil nil; ); set lkeymarks = tl lkeymarks; ); 0; ); ); set lanimmarks = tl lanimmarks; ); loadOgreMaxNodes viewstr groupstr nodexml meshxmlstr destgroup nnode treenode units 0 lresdir; ) else if camera != nil then let XMLaddMark xmlEditSceneFile "camera" destfathermark ["id" id]::["name" cameraname]::["fov" (XMLgetShortFloatToString camerafov)]::nil nil -> camxmlstr in let addGraphItem strcatn cameraname::" #"::id::nil (strcatn id::"."::cameraname::nil) iTypeCamera nil camxmlstr nil destgroup treefather 0 0 -> treenode in ( XMLaddMark xmlEditSceneFile "scale" camxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" camxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" camxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; XMLaddMark xmlEditSceneFile "clipping" camxmlstr ["near" (XMLgetShortFloatToString camclipnear)]::["far" (XMLgetShortFloatToString camclipfar)]::nil nil; V3DsetCamera camera nil camerafov camclipnear camclipfar; V3DshowObjectHelper viewstr sessionstr camera iTypeCamera 1; // ANIMS let XMLgetMarkByValueFromMarkSons nodexml "animations" -> animsmark in let XMLgetMarksByValueFromMarkSons animsmark "animation" -> lanimmarks in let XMLgetMarkByValueFromMarkSons camxmlstr "animations" -> targetanimsmark in let if targetanimsmark != nil then targetanimsmark else XMLaddMark xmlEditSceneFile "animations" camxmlstr nil nil -> targetanimsmark in while (lanimmarks != nil) do ( let hd lanimmarks -> animmark in let XMLgetParam animmark "name" -> animname in let XMLgetBoolParam animmark "enable" -> animstate in let XMLgetBoolParam animmark "loop" -> animloop in let getOgreAnimationInterpolationType (XMLgetParam animmark "interpolationMode") -> animintmode in let getOgreAnimationRotInterpolationType (XMLgetParam animmark "rotationInterpolationMode") -> animintrotmode in let atof XMLgetParam animmark "length" -> animlength in let atof XMLgetParam animmark "weight" -> animweight in let if animweight == nil then 1.0 else animweight -> animweight in let (itoa getNewSceneIndex nil) -> id in let V3DaddAnimation sessionstr nnode (atoi id) animname (strcatn id::"."::animname::nil) animlength fDefaultAnimationSpeed animweight animstate animloop animintmode animintrotmode -> animstr in ( if animstr == nil then ( addLogMessage strcatn (loc "OS3D_0146")::animname::(loc "OS3D_0477")::nil; 0; ) else let XMLaddMark xmlEditSceneFile "animation" targetanimsmark ["id" id]::["name" animname]::["type" "node"]::["enable" (XMLgetBoolString animstate)]::["loop" (XMLgetBoolString animloop)]::["interpolationMode" (getOgreAnimationInterpolationByType animintmode)]::["rotationInterpolationMode" (getOgreAnimationRotInterpolationByType animintrotmode)]::["length" (XMLgetShortFloatToString animlength)]::["speed" (XMLgetShortFloatToString fDefaultAnimationSpeed)]::["weight" (XMLgetShortFloatToString animweight)]::["skipFrame" (XMLgetBoolString 1)]::nil nil -> newanimmark in let addGraphItem strcatn animname::" #"::id::" ("::"node"::")"::nil (strcatn id::"."::animname::nil) iTypeAnim nil newanimmark nil destgroup treenode animstate 0 -> treenode in ( let XMLgetMarksByValueFromMarkSons animmark "keyframe" -> lkeymarks in while (lkeymarks != nil) do ( let hd lkeymarks -> keymark in let atof (XMLgetParam keymark "time") -> keytime in let XMLgetMarkByValueFromMarkSons keymark "translation" -> keytransmark in let if (keytransmark == nil) then XMLgetMarkByValueFromMarkSons keymark "position" else keytransmark -> keytransmark in let (if root then (atof XMLgetParam keytransmark "x") /. units else (atof XMLgetParam keytransmark "x")) -> xapos in let (if root then (atof XMLgetParam keytransmark "y") /. units else (atof XMLgetParam keytransmark "y")) -> yapos in let (if root then (atof XMLgetParam keytransmark "z") /. units else (atof XMLgetParam keytransmark "z")) -> zapos in let XMLgetMarkByValueFromMarkSons keymark "rotation" -> keyrotmark in let atof XMLgetParam keyrotmark "qx" -> xaang in let atof XMLgetParam keyrotmark "qy" -> yaang in let atof XMLgetParam keyrotmark "qz" -> zaang in let atof XMLgetParam keyrotmark "qw" -> waang in let XMLgetMarkByValueFromMarkSons keymark "scale" -> keyscalemark in let (atof XMLgetParam keyscalemark "x") -> xascale in let (atof XMLgetParam keyscalemark "y") -> yascale in let (atof XMLgetParam keyscalemark "z") -> zascale in let XMLaddMark xmlEditSceneFile "keyframe" newanimmark ["time" (XMLgetShortFloatToString keytime)]::nil nil -> newkeymark in ( V3DaddAnimationKey animstr [xapos yapos zapos] [xaang yaang zaang waang] [xascale yascale zascale] keytime; XMLaddMark xmlEditSceneFile "translation" newkeymark ["x" (XMLgetShortFloatToString xapos)]::["y" (XMLgetShortFloatToString yapos)]::["z" (XMLgetShortFloatToString zapos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" newkeymark ["qx" (XMLgetShortFloatToString xaang)]::["qy" (XMLgetShortFloatToString yaang)]::["qz" (XMLgetShortFloatToString zaang)]::["qw" (XMLgetShortFloatToString waang)]::nil nil; XMLaddMark xmlEditSceneFile "scale" newkeymark ["x" (XMLgetShortFloatToString xascale)]::["y" (XMLgetShortFloatToString yascale)]::["z" (XMLgetShortFloatToString zascale)]::nil nil; ); set lkeymarks = tl lkeymarks; ); 0; ); ); set lanimmarks = tl lanimmarks; ); loadOgreMaxNodes viewstr groupstr nodexml camxmlstr destgroup nnode treenode units 0 lresdir; ) else if light != nil then let XMLaddMark xmlEditSceneFile "light" destfathermark ["id" id]::["name" lightname]::["type" (getOgreMaxLightByType lighttype)]::["castShadows" (XMLgetBoolString lightcastshadow)]::["volumetric" (XMLgetBoolString lightvolumetric)]::["power" (XMLgetShortFloatToString lightpower)]::["enable" (XMLgetBoolString 1)]::nil nil -> lightxmlstr in let addGraphItem strcatn lightname::" #"::id::nil (strcatn id::"."::lightname::nil) iTypeLight nil lightxmlstr nil destgroup treefather 1 0 -> treenode in ( XMLaddMark xmlEditSceneFile "scale" lightxmlstr ["x" (XMLgetShortFloatToString xscale)]::["y" (XMLgetShortFloatToString yscale)]::["z" (XMLgetShortFloatToString zscale)]::nil nil; XMLaddMark xmlEditSceneFile "position" lightxmlstr ["x" (XMLgetShortFloatToString xpos)]::["y" (XMLgetShortFloatToString ypos)]::["z" (XMLgetShortFloatToString zpos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" lightxmlstr ["qx" (XMLgetShortFloatToString xang)]::["qy" (XMLgetShortFloatToString yang)]::["qz" (XMLgetShortFloatToString zang)]::["qw" (XMLgetShortFloatToString wang)]::nil nil; XMLaddMark xmlEditSceneFile "colourDiffuse" lightxmlstr ["r" (XMLgetParam lightdiffusestr "r")]::["g" (XMLgetParam lightdiffusestr "g")]::["b" (XMLgetParam lightdiffusestr "b")]::nil nil; XMLaddMark xmlEditSceneFile "colourSpecular" lightxmlstr ["r" (XMLgetParam lightspecularstr "r")]::["g" (XMLgetParam lightspecularstr "g")]::["b" (XMLgetParam lightspecularstr "b")]::nil nil; XMLaddMark xmlEditSceneFile "lightAttenuation" lightxmlstr ["range" (XMLgetShortFloatToString lightrange)]::nil nil; SO3LightSetType light lighttype; SO3LightSetPowerScale light lightpower; SO3LightSetDiffuseColor light lightdiffusecolor; SO3LightSetSpecularColor light lightspecularcolor; SO3LightSetAttenuationAuto light lightrange; SO3ObjectSetCastShadows light lightcastshadow; SO3LightSetVolumetric light lightvolumetric; V3DshowObjectHelper viewstr sessionstr light iTypeLight 1; if (lightrangestr == nil) then nil else ( XMLaddMark xmlEditSceneFile "lightRange" lightxmlstr ["inner" (XMLgetShortFloatToString lightinner)]::["outer" (XMLgetShortFloatToString lightouter)]::nil nil; SO3LightSetSpotInnerAngle light lightinner; SO3LightSetSpotOuterAngle light lightouter; ); if (lightsourcesizestr == nil) then nil else ( XMLaddMark xmlEditSceneFile "lightSourceSize" lightxmlstr ["w" (XMLgetShortFloatToString lightw)]::["h" (XMLgetShortFloatToString lighth)]::nil nil; SO3LightSetSourceSize light [lightw lighth]; ); // ANIMS let XMLgetMarkByValueFromMarkSons lightstr "animations" -> animsmark in let XMLgetMarksByValueFromMarkSons animsmark "animation" -> lanimmarks in let XMLgetMarkByValueFromMarkSons lightxmlstr "animations" -> targetanimsmark in let if targetanimsmark != nil then targetanimsmark else XMLaddMark xmlEditSceneFile "animations" lightxmlstr nil nil -> targetanimsmark in while (lanimmarks != nil) do ( let hd lanimmarks -> animmark in let XMLgetParam animmark "name" -> animname in let XMLgetBoolParam animmark "enable" -> animstate in let XMLgetBoolParam animmark "loop" -> animloop in let getOgreAnimationInterpolationType (XMLgetParam animmark "interpolationMode") -> animintmode in let getOgreAnimationRotInterpolationType (XMLgetParam animmark "rotationInterpolationMode") -> animintrotmode in let atof XMLgetParam animmark "length" -> animlength in let atof XMLgetParam animmark "weight" -> animweight in let if animweight == nil then 1.0 else animweight -> animweight in let (itoa getNewSceneIndex nil) -> id in let V3DaddAnimation sessionstr nnode (atoi id) animname (strcatn id::"."::animname::nil) animlength fDefaultAnimationSpeed animweight animstate animloop animintmode animintrotmode -> animstr in ( if animstr == nil then ( addLogMessage strcatn (loc "OS3D_0146")::animname::(loc "OS3D_0477")::nil; 0; ) else let XMLaddMark xmlEditSceneFile "animation" targetanimsmark ["id" id]::["name" animname]::["type" "node"]::["enable" (XMLgetBoolString animstate)]::["loop" (XMLgetBoolString animloop)]::["interpolationMode" (getOgreAnimationInterpolationByType animintmode)]::["rotationInterpolationMode" (getOgreAnimationRotInterpolationByType animintrotmode)]::["length" (XMLgetShortFloatToString animlength)]::["speed" (XMLgetShortFloatToString fDefaultAnimationSpeed)]::["weight" (XMLgetShortFloatToString animweight)]::["skipFrame" (XMLgetBoolString 1)]::nil nil -> newanimmark in let addGraphItem strcatn animname::" #"::id::" ("::"node"::")"::nil (strcatn id::"."::animname::nil) iTypeAnim nil newanimmark nil destgroup treenode animstate 0 -> treenode in ( let XMLgetMarksByValueFromMarkSons animmark "keyframe" -> lkeymarks in while (lkeymarks != nil) do ( let hd lkeymarks -> keymark in let atof (XMLgetParam keymark "time") -> keytime in let XMLgetMarkByValueFromMarkSons keymark "translation" -> keytransmark in let if (keytransmark == nil) then XMLgetMarkByValueFromMarkSons keymark "position" else keytransmark -> keytransmark in let (if root then (atof XMLgetParam keytransmark "x") /. units else (atof XMLgetParam keytransmark "x")) -> xapos in let (if root then (atof XMLgetParam keytransmark "y") /. units else (atof XMLgetParam keytransmark "y")) -> yapos in let (if root then (atof XMLgetParam keytransmark "z") /. units else (atof XMLgetParam keytransmark "z")) -> zapos in let XMLgetMarkByValueFromMarkSons keymark "rotation" -> keyrotmark in let atof XMLgetParam keyrotmark "qx" -> xaang in let atof XMLgetParam keyrotmark "qy" -> yaang in let atof XMLgetParam keyrotmark "qz" -> zaang in let atof XMLgetParam keyrotmark "qw" -> waang in let XMLgetMarkByValueFromMarkSons keymark "scale" -> keyscalemark in let (atof XMLgetParam keyscalemark "x") -> xascale in let (atof XMLgetParam keyscalemark "y") -> yascale in let (atof XMLgetParam keyscalemark "z") -> zascale in let XMLaddMark xmlEditSceneFile "keyframe" newanimmark ["time" (XMLgetShortFloatToString keytime)]::nil nil -> newkeymark in ( V3DaddAnimationKey animstr [xapos yapos zapos] [xaang yaang zaang waang] [xascale yascale zascale] keytime; XMLaddMark xmlEditSceneFile "translation" newkeymark ["x" (XMLgetShortFloatToString xapos)]::["y" (XMLgetShortFloatToString yapos)]::["z" (XMLgetShortFloatToString zapos)]::nil nil; XMLaddMark xmlEditSceneFile "rotation" newkeymark ["qx" (XMLgetShortFloatToString xaang)]::["qy" (XMLgetShortFloatToString yaang)]::["qz" (XMLgetShortFloatToString zaang)]::["qw" (XMLgetShortFloatToString waang)]::nil nil; XMLaddMark xmlEditSceneFile "scale" newkeymark ["x" (XMLgetShortFloatToString xascale)]::["y" (XMLgetShortFloatToString yascale)]::["z" (XMLgetShortFloatToString zascale)]::nil nil; ); set lkeymarks = tl lkeymarks; ); 0; ); ); set lanimmarks = tl lanimmarks; ); loadOgreMaxNodes viewstr groupstr nodexml lightxmlstr destgroup nnode treenode units 0 lresdir; ) else nil; ); ); ); set lnodexml = tl lnodexml; ); 0;; fun addResourceFile(viewstr, groupmark, file, cbfun)= let (V3DgetDefaultSession viewstr) -> sessionstr in let switch lGroups groupmark -> groupstr in let getGroupName currentProject groupmark -> resgroup in let getFileExt file -> ext in let getFileResourceType file -> type in let getPathFile file "" -> [dir _] in ( addOsResourceDir dir::nil; if type == SO3_RESOURCE_MATERIAL then ( let OGMATgetResources file -> [isok lres lbad] in if isok then ( let sizelist lres -> tsize in let 0 -> ti in while ti < tsize do ( let nth_list lres ti -> [mode elem] in addResourceFile viewstr groupmark elem cbfun; set ti = ti + 1; ); if (isMaterialScriptModified file) then nil else V3DaddResource sessionstr file resgroup SO3_RESOURCE_MATERIAL; addOsSceneResource xmlEditSceneFile groupmark groupstr file SO3_RESOURCE_MATERIAL; exec cbfun with [file]; 0; ) else ( _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0342") strcatn (strcat (loc "OS3D_0421") " ")::file::(loc "OS3D_0484")::nil 1 mkfun4 @cbRewriteMaterialFileAndLoad viewstr [file groupmark lres cbfun]; 0; ); 0; ) else if type == SO3_RESOURCE_GPUPROGRAM then ( let OGMATgetResources file -> [isok lres lbad] in if isok then ( let sizelist lres -> tsize in let 0 -> ti in while ti < tsize do ( let nth_list lres ti -> [mode elem] in addResourceFile viewstr groupmark elem cbfun; set ti = ti + 1; ); V3DaddResource sessionstr file resgroup SO3_RESOURCE_GPUPROGRAM; addOsSceneResource xmlEditSceneFile groupmark groupstr file SO3_RESOURCE_GPUPROGRAM; exec cbfun with [file]; 0; ) else ( _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0342") strcatn (strcat (loc "OS3D_0421") " ")::file::(loc "OS3D_0484")::nil 1 mkfun4 @cbRewriteProgramFileAndLoad viewstr [file groupmark lres cbfun]; 0; ); ) else if (type != -1) then ( V3DaddResource sessionstr file resgroup type; addOsSceneResource xmlEditSceneFile groupmark groupstr file type; exec cbfun with [file]; 0; ) else ( addOsSceneResource xmlEditSceneFile groupmark groupstr file type; exec cbfun with [file]; 0; ); ); 0;; fun cbRewriteMaterialFile(msg, p, ret)= let p -> [file groupstr plres] in ( if !ret then ( while (plres != nil) do ( let hd plres -> [mode elem] in ( storeResourceFile2 groupstr elem; addOsSceneResource xmlEditSceneFile groupstr.GRP_xmlMark groupstr elem (getFileResourceType elem); ); set plres = tl plres; ); 0; ) else ( OGMATsetResourcesPath file lResourcesPath; addLogMessage strcatn file::" "::(loc "OS3D_0006")::nil; let OGMATgetResources file -> [isok lres lbad] in ( let sizelist lres -> tsize in let 0 -> ti in while ti < tsize do ( let nth_list lres ti -> [mode elem] in ( storeResourceFile2 groupstr elem; addOsSceneResource xmlEditSceneFile groupstr.GRP_xmlMark groupstr elem (getFileResourceType elem); ); set ti = ti + 1; ); if lbad == nil then nil else ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") strcatn (strcat (loc "OS3D_0405") " ")::file::" "::(loc "OS3D_0014")::nil 0; addLogMessageMultiOnline strcatn (strcat (loc "OS3D_0340") " ")::file::" "::(loc "OS3D_0013")::" "::nil lbad; ); 0; ); ); storeResourceFile2 groupstr file; set groupstr.GRP_iWaitForLoad = groupstr.GRP_iWaitForLoad - 1; ); 0;; fun cbRewriteMaterialFileAndLoad(msg, p, ret, viewstr)= let p -> [file groupmark plres cbfun] in let getGroupName currentProject groupmark -> resgroup in let switch lGroups groupmark -> groupstr in let V3DgetDefaultSession viewstr -> sessionstr in ( if !ret then ( let sizelist plres -> tsize in let 0 -> ti in while ti < tsize do ( let nth_list plres ti -> [mode elem] in ( addLogMessage elem; addResourceFile viewstr groupmark elem cbfun; ); set ti = ti + 1; ); 0; ) else ( OGMATsetResourcesPath file lResourcesPath; addLogMessage strcatn file::" "::(loc "OS3D_0006")::nil; let OGMATgetResources file -> [isok lres lbad] in ( let sizelist lres -> tsize in let 0 -> ti in while ti < tsize do ( let nth_list lres ti -> [mode elem] in addResourceFile viewstr groupmark elem cbfun; set ti = ti + 1; ); if lbad == nil then ( addResourceFile viewstr groupmark file cbfun; 0; ) else ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") strcatn (strcat (loc "OS3D_0405") " ")::file::" "::(loc "OS3D_0014")::nil 0; addLogMessageMultiOnline strcatn (strcat (loc "OS3D_0340") " ")::file::" "::(loc "OS3D_0013")::" "::nil lbad; ); 0; ); ); if (isMaterialScriptModified file) then nil else V3DaddResource sessionstr file resgroup SO3_RESOURCE_MATERIAL; addOsSceneResource xmlEditSceneFile groupmark groupstr file SO3_RESOURCE_MATERIAL; exec cbfun with [file]; ); 0;; fun cbRewriteProgramFile(msg, p, ret)= let p -> [file groupstr plres] in ( if !ret then ( while (plres != nil) do ( let hd plres -> [mode elem] in ( storeResourceFile2 groupstr elem; addOsSceneResource xmlEditSceneFile groupstr.GRP_xmlMark groupstr elem (getFileResourceType elem); ); set plres = tl plres; ); 0; ) else ( OGMATsetResourcesPath file lResourcesPath; addLogMessage strcatn file::" "::(loc "OS3D_0006")::nil; let OGMATgetResources file -> [isok lres lbad] in ( let sizelist lres -> tsize in let 0 -> ti in while ti < tsize do ( let nth_list lres ti -> [mode elem] in ( storeResourceFile2 groupstr elem; addOsSceneResource xmlEditSceneFile groupstr.GRP_xmlMark groupstr elem SO3_RESOURCE_HIGHLEVELGPUPROGRAM; ); set ti = ti + 1; ); 0; if lbad == nil then nil else ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") strcatn (strcat (loc "OS3D_0405") " ")::file::" "::(loc "OS3D_0014")::nil 0; addLogMessageMultiOnline strcatn (strcat (loc "OS3D_0340") " ")::file::" "::(loc "OS3D_0013")::" "::" "::nil lbad; ); ); ); storeResourceFile2 groupstr file; cleanDuplicatedResourcesFiles groupstr; set groupstr.GRP_iWaitForLoad = groupstr.GRP_iWaitForLoad - 1; ); 0;; fun cbRewriteProgramFileAndLoad(msg, p, ret, viewstr)= let p -> [file groupmark plres cbfun] in let getGroupName currentProject groupmark -> resgroup in let switch lGroups groupmark -> groupstr in let V3DgetDefaultSession viewstr -> sessionstr in ( if !ret then ( let sizelist plres -> tsize in let 0 -> ti in while ti < tsize do ( let nth_list plres ti -> [mode elem] in addResourceFile viewstr groupmark elem cbfun; set ti = ti + 1; ); 0; ) else ( OGMATsetResourcesPath file lResourcesPath; addLogMessage strcatn file::" "::(loc "OS3D_0006")::nil; let OGMATgetResources file -> [isok lres lbad] in ( let sizelist lres -> tsize in let 0 -> ti in while ti < tsize do ( let nth_list lres ti -> [mode elem] in addResourceFile viewstr groupmark elem cbfun; set ti = ti + 1; ); if lbad == nil then ( addResourceFile viewstr groupmark file cbfun; 0; ) else ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") strcatn (strcat (loc "OS3D_0405") " ")::file::" "::(loc "OS3D_0014")::nil 0; addLogMessageMultiOnline strcatn (strcat (loc "OS3D_0340") " ")::file::" "::(loc "OS3D_0013")::" "::nil lbad; 0; ); 0; ); ); V3DaddResource sessionstr file resgroup SO3_RESOURCE_GPUPROGRAM; addOsSceneResource xmlEditSceneFile groupmark groupstr file SO3_RESOURCE_GPUPROGRAM; exec cbfun with [file]; ); 0;; fun getResourcesPath(groupstr, groupmark)= let XMLgetMarkByValueFromMarkSons groupmark "resourceLocations" -> resourcesxml in let XMLgetMarksByValueFromMarkSons resourcesxml "resourceLocation" -> lresourcexml in let nil -> lpaths in let nil -> lfiles in ( let sizelist lresourcexml -> size in let 0 -> i in while i < size do ( let nth_list lresourcexml i -> resourcexml in let XMLgetParam resourcexml "type" -> type in let XMLgetParam resourcexml "name" -> path in let XMLgetBoolParam resourcexml "recursive" -> recursive in if (strcmpi type "FileSystem") || (path == nil) || (!strcmp "" (strtrim path)) then nil else ( let if recursive then path::(getDirListFromPath path) else path::nil -> fpath in set lpaths = lcat lpaths fpath; ); set i = i + 1; ); let sizelist lpaths -> size in let 0 -> i in while i < size do ( let nth_list lpaths i -> path in let _listoffiles path -> files in let sizelist files -> size2 in let 0 -> i2 in ( while i2 < size2 do ( let nth_list files i2 -> file in set lfiles = lcat lfiles file::nil; set i2 = i2 + 1; ); ); set i = i + 1; ); addOsResourceDir lpaths; set groupstr.GRP_lAvailableResourcesFiles = quicksort (lcat groupstr.GRP_lAvailableResourcesFiles lfiles) @suppDoublon; ); 0;; fun getResourcesScriptFilesFromGroup(groupstr)= let groupstr.GRP_lAvailableResourcesFiles -> l in while (l != nil) do ( let hd l -> file in let getFileExt file -> ext in if (!strcmpi ext "material") || (!strcmpi ext "particle") || (!strcmpi ext "pu") then ( let OGMATgetResources file -> [isok lres lbad] in if isok then ( storeResourceFile2 groupstr file; while (lres != nil) do ( let hd lres -> [mode elem] in storeResourceFile groupstr elem; set lres = tl lres; ); 0; ) else ( set groupstr.GRP_iWaitForLoad = groupstr.GRP_iWaitForLoad + 1; _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0342") strcatn (strcat (loc "OS3D_0421") " ")::file::(loc "OS3D_0484")::nil 1 @cbRewriteMaterialFile [file groupstr lres]; addLogMessage strcatn (strcat (loc "OS3D_0404") " ")::file::nil; 0; ); 0; ) else if (!strcmpi ext "program") then ( let OGMATgetResources file -> [isok lres lbad] in if isok then ( storeResourceFile2 groupstr file; while (lres != nil) do ( let hd lres -> [mode elem] in storeResourceFile groupstr elem; set lres = tl lres; ); 0; ) else ( set groupstr.GRP_iWaitForLoad = groupstr.GRP_iWaitForLoad + 1; _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0342") strcatn (strcat (loc "OS3D_0421") " ")::file::(loc "OS3D_0484")::nil 1 @cbRewriteProgramFile [file groupstr lres]; addLogMessage strcatn (strcat (loc "OS3D_0404") " ")::file::nil; 0; ); ) else ( storeResourceFile2 groupstr file; 0; ); set l = tl l; ); cleanDuplicatedResourcesFiles groupstr; 0;; fun getResourcesScriptFiles(groupstr, lscript)= set groupstr.GRP_lAvailableResourcesFiles = lcat groupstr.GRP_lAvailableResourcesFiles lscript; while (lscript != nil) do ( let hd lscript -> file in let getFileExt file -> ext in if (!strcmpi ext "material") || (!strcmpi ext "particle") || (!strcmpi ext "pu") then ( let OGMATgetResources file -> [isok lres lbad] in if isok then ( storeResourceFile2 groupstr file; while (lres != nil) do ( let hd lres -> [mode elem] in ( storeResourceFile2 groupstr elem; addOsSceneResource xmlEditSceneFile groupstr.GRP_xmlMark groupstr elem (getFileResourceType elem); ); set lres = tl lres; ); 0; ) else ( set groupstr.GRP_iWaitForLoad = groupstr.GRP_iWaitForLoad + 1; _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0342") strcatn (strcat (loc "OS3D_0421") " ")::file::(loc "OS3D_0484")::nil 1 @cbRewriteMaterialFile [file groupstr lres]; addLogMessage strcatn (strcat (loc "OS3D_0404") " ")::file::nil; 0; ); 0; ) else if (!strcmpi ext "program") then ( let OGMATgetResources file -> [isok lres lbad] in if isok then ( storeResourceFile2 groupstr file; while (lres != nil) do ( let hd lres -> [mode elem] in ( storeResourceFile2 groupstr elem; addOsSceneResource xmlEditSceneFile groupstr.GRP_xmlMark groupstr elem (getFileResourceType elem); ); set lres = tl lres; ); 0; ) else ( set groupstr.GRP_iWaitForLoad = groupstr.GRP_iWaitForLoad + 1; _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0342") strcatn (strcat (loc "OS3D_0421") " ")::file::(loc "OS3D_0484")::nil 1 @cbRewriteProgramFile [file groupstr lres]; addLogMessage strcatn (strcat (loc "OS3D_0404") " ")::file::nil; 0; ); ) else ( storeResourceFile2 groupstr file; 0; ); set lscript = tl lscript; ); cleanDuplicatedResourcesFiles groupstr; 0;; fun loadGroupResources(groupstr, viewstr, destgroupmark)= let V3DgetDefaultSession viewstr -> sessionstr in let getGroupName currentProject destgroupmark -> resgroup in ( let sizelist groupstr.GRP_lTextureResources -> size in let 0 -> i in while i < size do ( let nth_list groupstr.GRP_lTextureResources i -> elem in ( V3DaddResource sessionstr elem resgroup SO3_RESOURCE_TEXTURE; addOsSceneResource xmlEditSceneFile destgroupmark groupstr elem SO3_RESOURCE_TEXTURE; ); set i = i + 1; ); let sizelist groupstr.GRP_lShaderResources -> size in let 0 -> i in while i < size do ( let nth_list groupstr.GRP_lShaderResources i -> elem in ( V3DaddResource sessionstr elem resgroup SO3_RESOURCE_HIGHLEVELGPUPROGRAM; addOsSceneResource xmlEditSceneFile destgroupmark groupstr elem SO3_RESOURCE_HIGHLEVELGPUPROGRAM; ); set i = i + 1; ); let sizelist groupstr.GRP_lProgramResources -> size in let 0 -> i in while i < size do ( let nth_list groupstr.GRP_lProgramResources i -> elem in ( V3DaddResource sessionstr elem resgroup SO3_RESOURCE_GPUPROGRAM; addOsSceneResource xmlEditSceneFile destgroupmark groupstr elem SO3_RESOURCE_GPUPROGRAM; ); set i = i + 1; ); let sizelist groupstr.GRP_lMaterialResources -> size in let 0 -> i in while i < size do ( let nth_list groupstr.GRP_lMaterialResources i -> elem in ( if (isMaterialScriptModified elem) then nil else V3DaddResource sessionstr elem resgroup SO3_RESOURCE_MATERIAL; addOsSceneResource xmlEditSceneFile destgroupmark groupstr elem SO3_RESOURCE_MATERIAL; ); set i = i + 1; ); let sizelist groupstr.GRP_lCompositorResources -> size in let 0 -> i in while i < size do ( let nth_list groupstr.GRP_lCompositorResources i -> elem in ( V3DaddResource sessionstr elem resgroup SO3_RESOURCE_COMPOSITOR; addOsSceneResource xmlEditSceneFile destgroupmark groupstr elem SO3_RESOURCE_COMPOSITOR; ); set i = i + 1; ); let sizelist groupstr.GRP_lParticleResources -> size in let 0 -> i in while i < size do ( let nth_list groupstr.GRP_lParticleResources i -> elem in ( V3DaddResource sessionstr elem resgroup SO3_RESOURCE_PARTICLE_SYSTEM; addOsSceneResource xmlEditSceneFile destgroupmark groupstr elem SO3_RESOURCE_PARTICLE_SYSTEM; ); set i = i + 1; ); let sizelist groupstr.GRP_lSkeletonResources -> size in let 0 -> i in while i < size do ( let nth_list groupstr.GRP_lSkeletonResources i -> elem in ( V3DaddResource sessionstr elem resgroup SO3_RESOURCE_SKELETON; addOsSceneResource xmlEditSceneFile destgroupmark groupstr elem SO3_RESOURCE_SKELETON; ); set i = i + 1; ); let sizelist groupstr.GRP_lMeshResources -> size in let 0 -> i in while i < size do ( let nth_list groupstr.GRP_lMeshResources i -> elem in ( //V3DaddResource sessionstr elem resgroup SO3_RESOURCE_MESH; addOsSceneResource xmlEditSceneFile destgroupmark groupstr elem SO3_RESOURCE_MESH; ); set i = i + 1; ); let sizelist groupstr.GRP_lOtherResources -> size in let 0 -> i in while i < size do ( let nth_list groupstr.GRP_lOtherResources i -> elem in ( addOsSceneResource xmlEditSceneFile destgroupmark groupstr elem (-1); ); set i = i + 1; ); // Meshs are added dynamicaly ); 0;; fun cbDlgLoadEnvironment(dlg, p, rep)= let p -> [viewstr groupmark] in if !rep then nil else loadEnvironment viewstr groupmark; 0;; fun cbIsOgreMaxSceneReadyToImport(trm, p)= let p -> [viewstr groupstr srcgroupmark destgroupmark newgroupshell treenode lresdir] in if groupstr.GRP_iWaitForLoad > 0 then nil else ( _deltimer trm; //let _tickcount -> tick in //( //TODO load only new resources loadGroupResources groupstr viewstr destgroupmark; // addLogMessage strcatn (strcat (loc "OS3D_0469") " ")::(itoa (_tickcount - tick))::"ms"::nil::nil; //); let XMLgetMarkByValueFromMarkSons srcgroupmark "environment" -> envxml in if envxml == nil then nil else _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0191") (loc "OS3D_0044") 2 @cbDlgLoadEnvironment [viewstr srcgroupmark]; //let _tickcount -> tick in let XMLgetMarkByValueFromMarkSons srcgroupmark "nodes" -> srcnodesmark in let XMLgetMarkByValueFromMarkSons destgroupmark "graph" -> destgraphmark in let atof XMLgetParam srcgroupmark "unitsPerMeter" -> units in let if units == nil then (1.0 *. (itof iGlobalUnit)) else (units /. (itof iGlobalUnit)) -> units in //let addLogMessage strcatn (strcat (loc "OS3D_0471") " ")::(itoa (_tickcount - tick))::"ms"::nil -> _ in //let _tickcount -> tick in ( loadOgreMaxNodes viewstr groupstr srcnodesmark destgraphmark destgroupmark newgroupshell treenode units 1 lresdir; //addLogMessage strcatn (strcat (loc "OS3D_0470") " ")::(itoa (_tickcount - tick))::"ms"::nil; ); if (!(isParentHidden newgroupshell)) then nil else SO3ObjectSetVisible newgroupshell 0 1; addLogMessage (loc "OS3D_0357"); ); 0;; fun importOgreMaxScene(viewstr, file, lresdir, lscripts, destgroupmark, father, treefather, groupname, mode)= addLogMessage strcatn (strcat (loc "OS3D_0201") " ")::file::nil; addOsResourceDir lresdir; //let _tickcount -> tick in let XMLload file -> xmlscenestr in //let addLogMessage strcatn (strcat (loc "OS3D_0467") " ")::(itoa (_tickcount - tick))::"ms"::nil -> _ in let XMLgetMarkByValue xmlscenestr "scene" -> srcgroupmark in let if !mode then newOsSceneGroup viewstr xmlEditSceneFile destgroupmark groupname nil nil father nil nil nil 0 treefather 3 1 else [(switch lGroups destgroupmark) father treefather] -> [groupstr newgroupshell treenode] in ( //let _tickcount -> tick in //( getResourcesScriptFiles groupstr lscripts; // addLogMessage strcatn (strcat (loc "OS3D_0468") " ")::(itoa (_tickcount - tick))::"ms"::nil; //); if groupstr.GRP_iWaitForLoad > 0 then ( _rfltimer _starttimer _channel 1000 @cbIsOgreMaxSceneReadyToImport [viewstr groupstr srcgroupmark groupstr.GRP_xmlMark newgroupshell treenode lresdir]; 0; ) else ( //let _tickcount -> tick in //( loadGroupResources groupstr viewstr groupstr.GRP_xmlMark; // addLogMessage strcatn (strcat (loc "OS3D_0469") " ")::(itoa (_tickcount - tick))::"ms"::nil; //); let XMLgetMarkByValueFromMarkSons srcgroupmark "environment" -> envxml in if envxml == nil then nil else _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0191") (loc "OS3D_0044") 2 @cbDlgLoadEnvironment [viewstr srcgroupmark]; //let _tickcount -> tick in let XMLgetMarkByValueFromMarkSons srcgroupmark "nodes" -> srcnodesmark in let XMLgetMarkByValueFromMarkSons groupstr.GRP_xmlMark "graph" -> destgraphmark in let atof XMLgetParam srcgroupmark "unitsPerMeter" -> units in let if units == nil then (1.0 *. (itof iGlobalUnit)) else (units /. (itof iGlobalUnit)) -> units in //let addLogMessage strcatn (strcat (loc "OS3D_0471") " ")::(itoa (_tickcount - tick))::"ms"::nil -> _ in //let _tickcount -> tick in ( loadOgreMaxNodes viewstr groupstr srcnodesmark destgraphmark groupstr.GRP_xmlMark newgroupshell treenode units 1 lresdir; //addLogMessage strcatn (strcat (loc "OS3D_0470") " ")::(itoa (_tickcount - tick))::"ms"::nil; ); let XMLgetBoolParam groupstr.GRP_xmlMark "hidden" -> hidden in if (!hidden && !(isParentHidden newgroupshell)) then nil else SO3ObjectSetVisible newgroupshell 0 1; addLogMessage (loc "OS3D_0357"); 0; ); //refresh groups tab paintEdCtrlModuleEditor mainInterf.MINT_meGroups; selEdCtrlTreeItem ctrlSceneTree treenode; cbMaterialsTabFocused nil ctrlMaterialList; cbResourcesTabFocused nil ctrlResourcesList; cbMeshesTabFocused nil ctrlMeshList; cbSceneTreeTabFocused nil ctrlSceneTree; XMLclose xmlscenestr; ); 0;; fun cbIsOsGroupReady(trm, p)= let p -> [viewstr groupstr srcgroupmark destgroupmark father treefather import first] in if groupstr.GRP_iWaitForLoad > 0 then nil else ( _deltimer trm; loadGroupResources groupstr viewstr destgroupmark; let XMLgetMarkByValueFromMarkSons srcgroupmark "environment" -> envxml in if envxml != nil && import then ( _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0191") (loc "OS3D_0044") 2 @cbDlgLoadEnvironment [viewstr srcgroupmark]; 0; ) else ( loadEnvironment viewstr srcgroupmark; 0; ); let XMLgetMarkByValueFromMarkSons srcgroupmark "graph" -> srcnodesmark in let XMLgetMarkByValueFromMarkSons destgroupmark "graph" -> destgraphmark in loadOsGraph groupstr viewstr srcnodesmark destgraphmark destgroupmark father treefather import; let XMLgetMarksByValueFromMarkSons srcgroupmark "group" -> lsrcgroups in let sizelist lsrcgroups -> size in let 0 -> i in while i < size do ( let nth_list lsrcgroups i -> nextgroupmark in let if import then nil else XMLgetParam nextgroupmark "id" -> id in let atoi XMLgetParam nextgroupmark "px" -> plx in let atoi XMLgetParam nextgroupmark "py" -> ply in let XMLgetParam nextgroupmark "name" -> nodename in let XMLgetParam nextgroupmark "alias" -> alias in let XMLgetBoolParam nextgroupmark "hidden" -> hidden in let XMLgetMarkByValueFromMarkSons nextgroupmark "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let if nodeposstr == nil then [0.0 0.0 0.0] else [xpos ypos zpos] -> pos in let XMLgetMarkByValueFromMarkSons nextgroupmark "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let if noderotstr == nil then [0.0 0.0 0.0 1.0] else [xang yang zang wang] -> ang in let XMLgetMarkByValueFromMarkSons nextgroupmark "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in let if nodescalestr == nil then [1.0 1.0 1.0] else [xscale yscale zscale] -> scale in let newOsSceneGroup viewstr xmlEditSceneFile destgroupmark nodename (atoi id) alias father scale pos ang hidden treefather plx ply -> [groupstr newgroupshell treenode] in ( if !import then nil else set lTmpLinksImport = [strcatn (XMLgetParam nextgroupmark "id")::"."::nodename::nil groupstr.GRP_sName]::lTmpLinksImport; loadOsGroup viewstr groupstr nextgroupmark groupstr.GRP_xmlMark newgroupshell treenode import 0; if (!hidden && !(isParentHidden newgroupshell)) then nil else SO3ObjectSetVisible newgroupshell 0 1; ); set i = i + 1; ); // done after sons groups loaded to get all links (for rewrite on import) let XMLgetMarkByValueFromMarkSons srcgroupmark "PLUGINS" -> pluginsmark in let XMLgetMarksByValueFromMarkSons pluginsmark "PLUGIN" -> lpluginmarks in let XMLgetMarkByValueFromMarkSons destgroupmark "PLUGINS" -> destpluginsmark in if pluginsmark == nil then nil else ( XMLsetParam destpluginsmark "filterLinks" XMLgetBoolString (XMLgetBoolValue XMLgetParam pluginsmark "filterLinks" 0); XMLsetParam destpluginsmark "curvedLinks" XMLgetBoolString (XMLgetBoolValue XMLgetParam pluginsmark "curvedLinks" 1); XMLsetParam destpluginsmark "sortMenus" XMLgetBoolString (XMLgetBoolValue XMLgetParam pluginsmark "sortMenus" 1); let sizelist lpluginmarks -> size in let 0 -> i in while i < size do ( let nth_list lpluginmarks i -> plugmark in XMLcopyMark xmlEditSceneFile plugmark destpluginsmark; set i = i + 1; ); ); // update obj/groups idx in plugins params and links if !import then ( loadOsPlugins groupstr; 0; ) else if import && first then ( let sizelist lTmpLinksImport -> size in let 0 -> i in while i < size do ( let nth_list lTmpLinksImport i -> [olgrpname newgrpname] in let getGraphByValue newgrpname -> tgraph in let tgraph -> [treeitem type alias markstr path groupmark initstate staticgeometry] in let switch lGroups markstr -> ngroupstr in ( updatePluginInstancesOnImport ngroupstr; loadOsPlugins ngroupstr; ); set i = i + 1; ); ) else nil; set iWaitUntilLoad = iWaitUntilLoad - 1; //addLogMessage (loc "OS3D_0182"); ); 0;; fun loadOsGroup(viewstr, groupstr, srcgroupmark, destgroupmark, father, treefather, import, first)= set iWaitUntilLoad = iWaitUntilLoad + 1; getOsGroupResources groupstr srcgroupmark; // load ressources script getResourcesScriptFilesFromGroup groupstr; if (groupstr.GRP_iWaitForLoad > 0) then ( _rfltimer _starttimer _channel 1000 @cbIsOsGroupReady [viewstr groupstr srcgroupmark destgroupmark father treefather import first]; 0; ) else ( loadGroupResources groupstr viewstr destgroupmark; let XMLgetMarkByValueFromMarkSons srcgroupmark "environment" -> envxml in if envxml != nil && import then ( _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0191") (loc "OS3D_0044") 2 @cbDlgLoadEnvironment [viewstr srcgroupmark]; 0; ) else ( loadEnvironment viewstr srcgroupmark; 0; ); let XMLgetMarkByValueFromMarkSons srcgroupmark "graph" -> srcnodesmark in let XMLgetMarkByValueFromMarkSons destgroupmark "graph" -> destgraphmark in loadOsGraph groupstr viewstr srcnodesmark destgraphmark destgroupmark father treefather import; let XMLgetMarksByValueFromMarkSons srcgroupmark "group" -> lsrcgroups in let sizelist lsrcgroups -> size in let 0 -> i in while i < size do ( let nth_list lsrcgroups i -> nextgroupmark in let atoi (XMLgetParam nextgroupmark "id") -> oid in let if import then nil else oid -> id in let XMLgetParam nextgroupmark "name" -> nodename in let XMLgetParam nextgroupmark "alias" -> alias in let atoi XMLgetParam nextgroupmark "px" -> plx in let atoi XMLgetParam nextgroupmark "py" -> ply in let XMLgetBoolParam nextgroupmark "hidden" -> hidden in let XMLgetMarkByValueFromMarkSons nextgroupmark "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let if nodeposstr == nil then [0.0 0.0 0.0] else [xpos ypos zpos] -> pos in let XMLgetMarkByValueFromMarkSons nextgroupmark "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let if noderotstr == nil then [0.0 0.0 0.0 1.0] else [xang yang zang wang] -> ang in let XMLgetMarkByValueFromMarkSons nextgroupmark "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in let if nodescalestr == nil then [1.0 1.0 1.0] else [xscale yscale zscale] -> scale in let newOsSceneGroup viewstr xmlEditSceneFile destgroupmark nodename id alias father scale pos ang hidden treefather plx ply -> [groupstr newgroupshell treenode] in ( if !import then nil else ( set lTmpFunctionsImport = [(strcatn (itoa oid)::"."::nodename::nil) (strcatn (XMLgetParam groupstr.GRP_xmlMark "id")::"."::nodename::nil)]::lTmpFunctionsImport; set lTmpLinksImport = [strcatn (XMLgetParam nextgroupmark "id")::"."::nodename::nil groupstr.GRP_sName]::lTmpLinksImport; ); loadOsGroup viewstr groupstr nextgroupmark groupstr.GRP_xmlMark newgroupshell treenode import 0; if (!hidden && !(isParentHidden newgroupshell)) then nil else SO3ObjectSetVisible newgroupshell 0 1; if (import != 2 || !first) then nil else ( selEdCtrlTreeItem ctrlSceneTree treenode; ); ); set i = i + 1; ); loadCinematics viewstr groupstr srcgroupmark import; // done after sons groups loaded to get all links (for rewrite on import) let XMLgetMarkByValueFromMarkSons srcgroupmark "PLUGINS" -> pluginsmark in let XMLgetMarksByValueFromMarkSons pluginsmark "PLUGIN" -> lpluginmarks in let XMLgetMarkByValueFromMarkSons destgroupmark "PLUGINS" -> destpluginsmark in if pluginsmark == nil then nil else ( XMLsetParam destpluginsmark "filterLinks" XMLgetBoolString (XMLgetBoolValue XMLgetParam pluginsmark "filterLinks" 0); XMLsetParam destpluginsmark "curvedLinks" XMLgetBoolString (XMLgetBoolValue XMLgetParam pluginsmark "curvedLinks" 1); XMLsetParam destpluginsmark "sortMenus" XMLgetBoolString (XMLgetBoolValue XMLgetParam pluginsmark "sortMenus" 1); let sizelist lpluginmarks -> size in let 0 -> i in while i < size do ( let nth_list lpluginmarks i -> plugmark in let XMLgetParam plugmark "source" -> plugsource in let XMLgetParam plugmark "name" -> plugname in let strcatn sPLUGINSPATH::"/"::plugsource::nil -> pluginfile in let getPluginByFile pluginfile -> plugstr in let substr pluginfile ((strlen sPLUGINSPATH) + 1) 1024 -> plugfile in let XMLcopyMark xmlEditSceneFile plugmark destpluginsmark -> xmlcp in ( XMLsetParam xmlcp "source" plugfile; XMLsetParam xmlcp "name" if (plugstr.PLUG_sName == nil) then plugname else plugstr.PLUG_sName; ); set i = i + 1; ); ); // update obj/groups idx in plugins params and links if !import then ( loadOsPlugins groupstr; 0; ) else if import && first then ( let sizelist lTmpLinksImport -> size in let 0 -> i in while i < size do ( let nth_list lTmpLinksImport i -> [olgrpname newgrpname] in let getGraphByValue newgrpname -> tgraph in let tgraph -> [treeitem type alias markstr path groupmark initstate staticgeometry] in let switch lGroups markstr -> ngroupstr in ( updatePluginInstancesOnImport ngroupstr; loadOsPlugins ngroupstr; ); set i = i + 1; ); ) else nil; set iWaitUntilLoad = iWaitUntilLoad - 1; //addLogMessage strcat (strcat (loc "OS3D_0181") " ") groupstr.GRP_sName; 0; ); 0;; fun sceneLoaded(file)= // repaint groups tab paintEdCtrlModuleEditor mainInterf.MINT_meGroups; cbMaterialsTabFocused nil ctrlMaterialList; cbResourcesTabFocused nil ctrlResourcesList; cbMeshesTabFocused nil ctrlMeshList; cbSceneTreeTabFocused nil ctrlSceneTree; addLogMessage strcatn (loc "OS3D_0674")::" "::(itoa (sizelist DMSdmi) - 1)::nil; addLogMessage strcatn (loc "OS3D_0675")::" "::(itoa (sizelist mainInterf.MINT_lLinks))::nil; addLogMessage strcatn file::" "::(loc "OS3D_0008")::nil; 0;; fun cbIsSceneLoaded(trm, file)= if (iWaitUntilLoad > 0) then nil else ( _deltimer trm; sceneLoaded file; ); 0;; fun delProjectSetting(key)= let XMLgetMarkByValue xmlEditSceneFile "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in let if (srcsettingmark == nil) then XMLaddMark xmlEditSceneFile "setting" srcprjmark nil nil else srcsettingmark -> srcsettingmark in let XMLgetMarkByValueFromMarkSons srcsettingmark key -> keymark in if (keymark == nil) then nil else ( XMLdelMark xmlEditSceneFile keymark; 0; ); 0;; fun setProjectSetting(key, value)= let XMLgetMarkByValue xmlEditSceneFile "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in let if (srcsettingmark == nil) then XMLaddMark xmlEditSceneFile "setting" srcprjmark nil nil else srcsettingmark -> srcsettingmark in let XMLgetMarkByValueFromMarkSons srcsettingmark key -> keymark in if (keymark == nil) then ( XMLaddMark xmlEditSceneFile key srcsettingmark nil value; 0; ) else ( XMLsetData keymark value; 0; ); 0;; fun getProjectSetting(key)= let XMLgetMarkByValue xmlEditSceneFile "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark key) -> data in if ((data == nil) || (!strcmp "" (strtrim data))) then nil else data;; fun getProjectSettingDef(key, def)= let getProjectSetting key -> val in if ((val == nil) || (!strcmp (strtrim val) "")) then def else val;; fun getProjectVersion()= let getProjectSettingDef "projectVersion" "1.0" -> val in let strlen val -> len in ( while (len > 0 && !strcmp "0" substr val (len - 1) 1) do ( set len = len - 1; ); if (!strcmp "." substr val (len - 1) 1) then set len = len + 1; substr val 0 len; );; fun getProjectName()= let XMLgetMarkByValue xmlEditSceneFile "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "projectName") -> projname in if projname != nil then projname else getFileNameWithoutExt sCurrentScenePath;; fun loadProjectSetting(xmlfilestr)= let XMLgetMarkByValue xmlfilestr "project" -> srcprjmark in let XMLgetMarkByValueFromMarkSons srcprjmark "setting" -> srcsettingmark in let XMLgetData (XMLgetMarkByValueFromMarkSons srcsettingmark "author") -> author in let XMLgetMarkByValue xmlEditSceneFile "project" -> destprjmark in ( // copy current setting to new xml XMLcopyMark xmlEditSceneFile srcsettingmark destprjmark; let getProjectName -> prjname in ( setProjectSetting "projectName" getProjectName; set currentProject.PRJ_sName = prjname; ); ); 0;; fun cbMaterialListDbClick(ctrlstr, pos, elem, lval, type, p)= if (bAppPlay) then nil else let p -> [sessionstr groupmark] in let switch lGroups groupmark -> groupstr in let SO3SceneGetMaterial (V3DgetSession sessionstr) groupstr.GRP_sName elem -> mat in openMaterialEditor groupstr mat; 0;; fun cbmaterialListKeyUp(ctrlstr, pos, name, lval, type, key)= if key != 339 then nil else //Suppr cbTbBtnDelMaterial nil nil nil nil; 0;; fun cbMaterialsTabFocused(tabstr, list)= setSceneTreeFilterState 0; resetEdCtrlList list; let V3DgetDefaultSession v3dMain -> sessionstr in let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in let if ttype == iTypeGroup || ttype == iTypeScene then markstr else groupmark -> groupmark in let SO3SceneParseMaterialsFromGroup (V3DgetSession sessionstr) (getGroupName currentProject groupmark) -> lmats in let nil -> matnames in ( while (lmats != nil) do ( let SO3MaterialGetName (hd lmats) -> mat in //Ignore default mat if (!strcmp mat "BaseWhite") then nil else set matnames = mat::matnames; set lmats = tl lmats; ); fillEdCtrlList list quicksort matnames @suppDoublon; selectEdCtrlListByPos list 0; setEdWindowFocus list.EDC_father; setEdCtrlListCbDbClick list mkfun6 @cbMaterialListDbClick [sessionstr groupmark]; setEdCtrlListCbKeyUp list @cbmaterialListKeyUp; ); 0;; fun cbTbBtnEditMaterial(tbstr, cmproll, btn, mask)= if (bAppPlay) then nil else let V3DgetDefaultSession v3dMain -> sessionstr in let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in let if ttype == iTypeGroup || ttype == iTypeScene then markstr else groupmark -> groupmark in let switch lGroups groupmark -> groupstr in let getSelectedEdCtrlList ctrlMaterialList -> [elem _ _] in let SO3SceneGetMaterial (V3DgetSession sessionstr) groupstr.GRP_sName elem -> mat in if (mat == nil) then nil else openMaterialEditor groupstr mat; 0;; fun cbMatResourceFileAdded(file, p)= //refresh materia list let p -> [sessionstr name groupstr ofile] in ( //do that after loading addModifiedMaterial (SO3MaterialCreate (V3DgetSession sessionstr) name groupstr.GRP_sName) ofile groupstr; //refresh list cbMaterialsTabFocused nil ctrlMaterialList; selectEdCtrlList ctrlMaterialList name; ); 0;; fun cbBtnNewMaterial(ctrlbtn, d, p)= let p -> [groupstr ctrltext np] in let np -> [winstr ctrlpath ofile] in let V3DgetDefaultSession v3dMain -> sessionstr in let getEdCtrlTextLineValue ctrltext -> name in if (name == nil) || (!strcmp "" (strtrim name)) then nil else ( if (ofile == nil) then ( _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0155") (loc "OS3D_0628") 0; 0; ) else if ((SO3SceneGetMaterial (V3DgetSession sessionstr) groupstr.GRP_sName name) != nil) then ( _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0155") (loc "OS3D_0627") 0; 0; ) else ( //destroy window first, otherwise there is a conflict with modal popups dsEdWindow winstr; //add material to resouces group let _PtoScol ofile -> fpath in ( addResourceFile v3dMain groupstr.GRP_xmlMark fpath mkfun2 @cbMatResourceFileAdded [sessionstr name groupstr ofile]; set sLastDirectory = getFileDirectory fpath; ); 0; ); ); 0;; fun cbDlgGetMaterialScriptPath(dlg, p, wfile)= let p -> [ctrlbtn np] in let np -> [winstr ctrlpath ofile] in ( if wfile == nil then nil else let _PtoScol (_WtoP wfile) -> file in if file == nil then ( _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0155") (loc "OS3D_0472") 0; 0; ) else ( let getFileExt file -> ext in let if !strcmpi "material" ext then file else strcat file ".material" -> file in ( let _WtoP (_getmodifypack file) -> pfile in mutate np <- [_ _ pfile]; let getPathFile file "" -> [fpath fname] in setEdCtrlTextLineValue ctrlpath fname; ); 0; ); setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbDlgGetMaterialScriptCustom(wfile, p)= cbDlgGetMaterialScriptPath nil p wfile; 0;; fun cbBtnPickMaterialFile(ctrlbtn, p)= let p -> [winstr ctrlpath file] in let getEdCtrlTextLineValue ctrlpath -> path in let getPathFile path "" -> [fpath fname] in ( setEdCtrlButtonEnable ctrlbtn 0; let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [650 450] -> [iw ih] in let crEdSaveAsFileDialog _channel mainInterf.MINT_winMain nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (loc "saveAs") ["Material script" "material"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil fpath fname -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdSaveFileDialogCb dlgfstr mkfun2 @cbDlgGetMaterialScriptCustom [ctrlbtn p]; 0; ); //_DLGrflsave _DLGSaveFileEx _channel winstr.EDW_win fpath fname "Material script\0*.material;\0All\0*.*\0\0" DLGSAVE_HIDEREADONLY @cbDlgGetMaterialScriptPath [ctrlbtn p]; ); 0;; fun cbTbBtnAddMaterial(tbstr, cmproll, btn, mask)= if (bAppPlay) then nil else let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in let if ttype == iTypeGroup || ttype == iTypeScene then markstr else groupmark -> groupmark in let switch lGroups groupmark -> groupstr in let [300 115] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let 10 -> ypos in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0625")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 ypos + 2 110 20 (loc "OS3D_0257") nil -> label in let itoa (mod rand 1000) -> idx in let crEdCtrlTextLine winstr 130 ypos (iw - 140) 20 strcat "mat_" idx nil EDWIN_RESIZE_MW -> ctrltext in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 110 20 (loc "OS3D_0626") nil -> labelpath in let crEdCtrlTextLine winstr 130 ypos 95 20 "" nil EDWIN_RESIZE_MW -> ctrlpath in let crEdCtrlButton winstr 235 ypos 55 20 "..." nil -> pickfilebtn in let [winstr ctrlpath nil] -> pfile in ( setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineEnable ctrlpath 0; setEdCtrlButtonCb pickfilebtn mkfun2 @cbBtnPickMaterialFile pfile; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbBtnNewMaterial [groupstr ctrltext pfile]; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 mkfun3 @cbBtnNewMaterial [groupstr ctrltext pfile] nil; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel winstr; ); 0;; fun cbDlgmaterialRemove(msg, p, ret)= if !ret then nil else let p -> [elem mat groupstr] in ( removeModifiedMaterial mat; let winMaterialEditor -> [ewinstr emat matsession _] in if (emat != mat) then nil else materialDestroyEditor; let SO3MaterialGetScriptPath mat -> path in set lMaterialScriptsList = addUniqueStri lMaterialScriptsList (_PtoScol path); SO3MaterialDestroy mat; //refresh list cbMaterialsTabFocused nil ctrlMaterialList; ); 0;; fun cbTbBtnDelMaterial(tbstr, cmproll, btn, mask)= if (bAppPlay) then nil else let V3DgetDefaultSession v3dMain -> sessionstr in let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in let if ttype == iTypeGroup || ttype == iTypeScene then markstr else groupmark -> groupmark in let switch lGroups groupmark -> groupstr in let getSelectedEdCtrlList ctrlMaterialList -> [elem _ _] in let SO3SceneGetMaterial (V3DgetSession sessionstr) groupstr.GRP_sName elem -> mat in if (elem == nil) then nil else _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0629") 1 @cbDlgmaterialRemove [elem mat groupstr]; 0;; fun assignMaterialToObj(mat)= let V3DgetDefaultSession v3dMain -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) sSelected -> obj in let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in let if (mat != nil) then mat else let switch lGroups groupmark -> groupstr in let getSelectedEdCtrlList ctrlMaterialList -> [matname _ _] in SO3SceneGetMaterial (V3DgetSession sessionstr) groupstr.GRP_sName matname -> mat in let SO3MaterialGetName mat -> matname in if ((mat == nil) || (ttype != iTypeEntity)) then nil else ( let XMLgetMarkByValueFromMarkSons markstr "subentities" -> subentitiesstr in let XMLgetMarksByValueFromMarkSons subentitiesstr "subentity" -> lentitystr in let 0 -> i in while (lentitystr != nil) do ( let hd lentitystr -> subentitystr in XMLsetParam subentitystr "materialName" matname; SO3EntitySetMaterial obj mat i; set lentitystr = tl lentitystr; set i = i + 1; ); ); 0;; fun cbTbBtnAssignMaterial(tbstr, cmproll, btn, mask)= if (bAppPlay) then nil else assignMaterialToObj nil; 0;; fun cbResourcesTabFocused(tabstr, list)= setSceneTreeFilterState 0; resetEdCtrlList list; let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in let if ttype == iTypeGroup || ttype == iTypeScene then markstr else groupmark -> groupmark in let XMLgetMarkByValueFromMarkSons groupmark "resources" -> resourcesmark in let XMLgetMarksByValueFromMarkSons resourcesmark "resource" -> lresourcemarks in ( let sizelist lresourcemarks -> size in let 0 -> i in while i < size do ( let nth_list lresourcemarks i -> resourcemark in let XMLgetParam resourcemark "type" -> type in let XMLgetParam resourcemark "path" -> path in addEdCtrlList list (strlowercase path) nil nil; set i = i + 1; ); ); 0;; fun cbMeshesTabFocused(tabstr, list)= setSceneTreeFilterState 0; resetEdCtrlList list; let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in let if ttype == iTypeGroup || ttype == iTypeScene then markstr else groupmark -> groupmark in let XMLgetMarkByValueFromMarkSons groupmark "resources" -> resourcesmark in let XMLgetMarksByValueFromMarkSons resourcesmark "resource" -> lresourcemarks in ( let sizelist lresourcemarks -> size in let 0 -> i in while i < size do ( let nth_list lresourcemarks i -> resourcemark in let XMLgetParam resourcemark "type" -> type in let XMLgetParam resourcemark "path" -> path in if (getResourceTypeByName type) != SO3_RESOURCE_MESH then nil else addEdCtrlList list (strlowercase path) nil nil; set i = i + 1; ); ); 0;; fun cleanUpOrphanLinks(xmlfile, lgroups)= while (lgroups != nil) do ( cleanUpOrphanLinksFromPlugins xmlfile hd lgroups; set lgroups = tl lgroups; ); 0;; fun loadOs3DScene(viewstr, file)= if (!strcmp (strtrim file) "") || (file == nil) then nil else ( set iWaitUntilLoad = 0; set sCurrentScenePath = file; addLogMessage strcatn (strcat (loc "OS3D_0228") " ")::file::nil; let getPathFile file "" -> [dir _] in if (dir == nil) || (!strcmp "" (strtrim dir)) then nil else addOsResourceDir dir::nil; let XMLload file -> xmlscenestr in let XMLgetMarkByValue xmlscenestr "scene" -> srcgroupmark in // scene not found but we look for an exported group let if srcgroupmark == nil then let XMLgetMarkByValue xmlscenestr "group" -> grpstr in let strcatn (XMLgetParam grpstr "id")::"."::(XMLgetParam grpstr "name")::nil -> grpname in ( // replace self links group by scene let XMLgetMarksByValue xmlscenestr "link" -> llinks in while (llinks != nil) do ( let hd llinks -> linkstr in let XMLgetParam linkstr "group" -> glink in ( if (strcmpi glink grpname) then nil else XMLsetParam linkstr "group" "Scene"; ); set llinks = tl llinks; ); grpstr; ) else srcgroupmark -> srcgroupmark in let XMLgetMarkByValue xmlEditSceneFile "scene" -> destgroupmark in let switch lGroups destgroupmark -> groupstr in let atoi XMLgetParam srcgroupmark "px" -> plx in let atoi XMLgetParam srcgroupmark "py" -> ply in ( XMLsetParam destgroupmark "px" (itoa plx); XMLsetParam destgroupmark "py" (itoa ply); // load project setting loadProjectSetting xmlscenestr; VUIsetGlobalScaleFactor (V3DgetDefaultSession viewstr) atof (getProjectSettingDef "uiScaleFactor" "1.0"); let getProjectSettingDef "themeName" "default" -> themename in if (themename == nil) then nil else VUIsetTheme VUIgetThemePath themename; let XMLgetBoolValue getProjectSetting "filterLinks" 0 -> filterlinks in let XMLgetBoolValue getProjectSetting "curvedLinks" 1 -> curvedlinks in let XMLgetBoolValue getProjectSetting "sortMenus" 1 -> sortmenus in ( setEdCtrlModuleEditorLinkFilter mainInterf.MINT_meGroups filterlinks; setEdCtrlModuleEditorLinkStyle mainInterf.MINT_meGroups curvedlinks; setEdCtrlModuleEditorSortMenus mainInterf.MINT_meGroups sortmenus; ); setEdCtrlModuleEditorBoxPos mainInterf.MINT_meGroups (getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups "Scene") plx ply; loadOsGroup viewstr groupstr srcgroupmark destgroupmark nil (getEdCtrlTreeRootItem ctrlSceneTree) 0 1; refreshGraphMeshAnimations viewstr; let XMLgetMarksByValueFromMark destgroupmark "group" -> lgroups in cleanUpOrphanLinks xmlEditSceneFile destgroupmark::lgroups; //TODO update resources (meshes and skeleton animations) XMLclose xmlscenestr; ); setEdWindowName mainInterf.MINT_winMain strcatn (strcat (loc "OS3D_0286") " ")::getVersionName::" > "::sCurrentScenePath::nil; if (iWaitUntilLoad > 0) then ( _rfltimer _starttimer _channel 1000 @cbIsSceneLoaded file; 0; ) else ( sceneLoaded file; 0; ); addLastProject sCurrentScenePath; cbMaterialsTabFocused nil ctrlMaterialList; cbResourcesTabFocused nil ctrlResourcesList; cbMeshesTabFocused nil ctrlMeshList; cbSceneTreeTabFocused nil ctrlSceneTree; let mainInterf.MINT_tbMain -> [cmpnew cmpopen cmpimport cmprsave cmprsaveas cmpsetting cmpthemeeditor cmpexport cmpplayer _ _ _ ] in ( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpnew OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpopen OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpimport OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsave OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsaveas OBJ_ENABLE|OBJ_VISIBLE 1; //if (sCurrentScenePath == nil) then nil else //( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpplayer OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpexport OBJ_ENABLE|OBJ_VISIBLE 1; //); ); ); 0;; fun cbDlgBeforeLoadPak(dlg, p, state)= if (!state) then nil else ( let p -> [viewstr file] in let mkUnpakOS3DProject file nil 1 -> nfile in ( initScene viewstr (V3DgetDefaultSession viewstr); loadOs3DScene viewstr nfile; ); ); 0;; fun loadPkOS(viewstr, file)= _DLGrflmessage _DLGMessageBox _channel winImportScene.EDW_win (loc "OS3D_0452") (loc "OS3D_0670") 2 @cbDlgBeforeLoadPak [viewstr file]; 0;; fun importOs3DScene(viewstr, file, destgroupmark, father, treefather)= if (!strcmp (strtrim file) "") || (file == nil) then nil else ( set iWaitUntilLoad = 0; set lTmpFunctionsImport = nil; addLogMessage strcatn (strcat (loc "OS3D_0202") " ")::file::nil; let getPathFile file "" -> [dir _] in if (dir == nil) || (!strcmp "" (strtrim dir)) then nil else addOsResourceDir dir::nil; let XMLload file -> xmlscenestr in let XMLgetMarkByValue xmlscenestr "scene" -> srcgroupmark in let if srcgroupmark == nil then XMLgetMarkByValue xmlscenestr "group" else srcgroupmark -> srcgroupmark in if srcgroupmark == nil then ( addLogMessage strcatn (strcat (loc "OS3D_0152") " ")::file::nil; _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") strcatn (strcat (loc "OS3D_0152") " ")::file::nil 0; 0; ) else ( let (XMLgetParam srcgroupmark "name") -> sname in let if (sname == nil) || (!strcmp "" strtrim sname) then (getFileNameWithoutExt file) else sname -> sname in let newOsSceneGroup viewstr xmlEditSceneFile destgroupmark sname nil nil father nil nil nil 0 treefather 3 1 -> [groupstr newgroupshell treenode] in ( let (XMLgetParam srcgroupmark "id") -> sid in let if sid == nil then "Scene" else strcatn sid::"."::sname::nil -> oldmarkname in set lTmpLinksImport = [oldmarkname groupstr.GRP_sName]::nil; loadOsGroup viewstr groupstr srcgroupmark groupstr.GRP_xmlMark newgroupshell treenode 1 1; if (!(isParentHidden newgroupshell)) then nil else SO3ObjectSetVisible newgroupshell 0 1; if (iWaitUntilLoad > 0) then ( _rfltimer _starttimer _channel 1000 @cbIsSceneLoaded file; 0; ) else ( sceneLoaded file; 0; ); selEdCtrlTreeItem ctrlSceneTree treenode; cbMaterialsTabFocused nil ctrlMaterialList; cbResourcesTabFocused nil ctrlResourcesList; cbMeshesTabFocused nil ctrlMeshList; cbSceneTreeTabFocused nil ctrlSceneTree; XMLclose xmlscenestr; ); 0; ); ); 0;; /* ********************************************************************************************* / Clone / ********************************************************************************************* */ fun cloneNode(viewstr, val, type, markstr, groupmark, item)= let switch lGroups groupmark -> groupstr in let V3DgetDefaultSession viewstr -> sessionstr in let getEdCtrlTreeFatherItem ctrlSceneTree item -> treefather in let SO3ObjectGetParent (SO3SceneGetObject (V3DgetSession sessionstr) val) -> father in let XMLcreate nil nil -> nxmlstr in if type == iTypeGroup then ( set lTmpLinksImport = nil; let XMLaddMark nxmlstr "group" nil nil nil -> nodestr in let XMLcopyMark nxmlstr markstr nodestr -> nmark in ( loadOsGroup viewstr groupstr nodestr groupstr.GRP_xmlMark father treefather 2 1; ); //refresh plugITs area for groups paintEdCtrlModuleEditor mainInterf.MINT_meGroups; ) else ( let XMLaddMark nxmlstr "node" nil nil nil -> nodestr in let XMLcopyMark nxmlstr markstr nodestr -> nmark in loadOsGraph groupstr viewstr nodestr markstr.XMLfather groupmark father treefather 2; ); // reset undo / redo resetObjHistory; 0;; /* ********************************************************************************************* / Axis / ********************************************************************************************* */ fun cbAxisMove(sessionstr, axisstr, axis, x, y, btn, coef, p)= let axisstr.V3D_axisFather -> obj in let p -> [tgraph viewstr] in let tgraph -> [treeitem type alias markstr path groupmark initstate staticgeometry] in let if (axisstr.V3D_iAxisRef == 0) then SO3_LOCAL_TS else if (axisstr.V3D_iAxisRef == 1) then SO3_WORLD_TS else SO3_LOCAL_TS -> rep in ( // reinit anim to avoid anim reset bad pose let winAnimSetup -> [animstr _ tbstr chkplaypause trm] in if (obj != animstr.V3D_meshAnim) || (!(V3DgetAnimationEnable animstr)) then nil else ( if trm == nil then nil else _deltimer trm; V3DresetAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); /* // reinit particle to use the same way than particles let winParticleSetup -> [partsystem _ tbstr chkplaypause] in if (obj != partsystem) || !(SO3ParticleSystemGetEnable partsystem) then nil else ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; setEdToolBarCheckState tbstr chkplaypause 0; ); */ if (btn & 1) && (iViewerEditMode == 1) then ( let if axis == V3DAXIS_X then [coef 0.0 0.0] else if axis == V3DAXIS_Y then [0.0 coef 0.0] else if axis == V3DAXIS_Z then [0.0 0.0 coef] else nil -> trans in //adjust trans direction to avoid scale error let if (rep == SO3_LOCAL_TS) then SO3MathsQuatGetDirection (SO3ObjectGetGlobalOrientation obj) trans else trans -> trans in SO3ObjectTranslate obj trans SO3_WORLD_TS; let XMLgetMarkByValueFromMarkSons markstr "position" -> objpositionstr in let SO3ObjectGetPosition obj -> [opx opy opz] in ( XMLsetParam objpositionstr "x" XMLgetShortFloatToString opx; XMLsetParam objpositionstr "y" XMLgetShortFloatToString opy; XMLsetParam objpositionstr "z" XMLgetShortFloatToString opz; let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in if obj != wobj || mode != 1 then nil else let SO3ObjectGetGlobalPosition obj -> [ogpx ogpy ogpz] in ( setEdCtrlFloatValueWithoutCallback ctrlx opx; setEdCtrlFloatValueWithoutCallback ctrly opy; setEdCtrlFloatValueWithoutCallback ctrlz opz; setEdCtrlFloatValueWithoutCallback ctrlgx ogpx; setEdCtrlFloatValueWithoutCallback ctrlgy ogpy; setEdCtrlFloatValueWithoutCallback ctrlgz ogpz; ); ); 0; ) else if (btn & 1) && (iViewerEditMode == 2) then ( if axis == V3DAXIS_X then SO3ObjectRotatePitch obj (SO3MathsDegreeToRadian (itof y + x)) rep else if axis == V3DAXIS_Y then SO3ObjectRotateYaw obj (SO3MathsDegreeToRadian (itof y + x)) rep else if axis == V3DAXIS_Z then SO3ObjectRotateRoll obj (SO3MathsDegreeToRadian (itof y + x)) rep else nil; let XMLgetMarkByValueFromMarkSons markstr "rotation" -> objorientationstr in let SO3ObjectGetOrientation obj -> [qx qy qz qw] in ( XMLsetParam objorientationstr "qx" XMLgetShortFloatToString qx; XMLsetParam objorientationstr "qy" XMLgetShortFloatToString qy; XMLsetParam objorientationstr "qz" XMLgetShortFloatToString qz; XMLsetParam objorientationstr "qw" XMLgetShortFloatToString qw; let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in if obj != wobj || mode != 2 then nil else let SO3MathsQuatToEulerYXZ [qx qy qz qw] -> [ex ey ez] in let SO3ObjectGetGlobalOrientation obj -> gquat in let SO3MathsQuatToEulerYXZ gquat -> [egx egy egz] in let SO3MathsRadianToDegree egx -> egx in let SO3MathsRadianToDegree egy -> egy in let SO3MathsRadianToDegree egz -> egz in let SO3MathsRadianToDegree ex -> ex in let SO3MathsRadianToDegree ey -> ey in let SO3MathsRadianToDegree ez -> ez in ( setEdCtrlFloatValueWithoutCallback ctrlx ex; setEdCtrlFloatValueWithoutCallback ctrly ey; setEdCtrlFloatValueWithoutCallback ctrlz ez; setEdCtrlFloatValueWithoutCallback ctrlgx egx; setEdCtrlFloatValueWithoutCallback ctrlgy egy; setEdCtrlFloatValueWithoutCallback ctrlgz egz; ); ); 0; ) else if (btn & 1) && (iViewerEditMode == 3) then ( if (type == iTypeCamera) then nil else ( let SO3ObjectGetGlobalOrientation obj -> gquat in let SO3ObjectGetGlobalScale obj -> cscale in let if (axisstr.V3D_iAxisRef == 0) || ((_keybdstate &4) || (axis == V3DAXIS_H)) then cscale else SO3MathsQuatGetDirection gquat cscale -> [csx csy csz] in let axisstr.V3D_tAxisClickPRS -> [_ _ [bsc bsy bsz]] in let [(coef *. (bsc *. (itof iGlobalUnit))) (coef *. (bsy *. (itof iGlobalUnit))) (coef *. (bsz *. (itof iGlobalUnit)))] -> [coefx coefy coefz] in let if ((_keybdstate &4) || (axis == V3DAXIS_H)) then //alt [(csx +. coefx) (csy +. coefy) (csz +. coefz)] else if axis == V3DAXIS_X then [(csx +. coefx) csy csz] else if axis == V3DAXIS_Y then [csx (csy +. coefy) csz] else if axis == V3DAXIS_Z then [csx csy (csz +. coefz)] else nil -> [nsx nsy nsz] in let if (axisstr.V3D_iAxisRef == 0) || ((_keybdstate &4) || (axis == V3DAXIS_H)) then [nsx nsy nsz] else SO3MathsQuatGetDirection (quatInverse gquat) [nsx nsy nsz] -> [nsx nsy nsz] in let [(if (nsx <=. 0.000001) then 0.00001 else nsx) (if (nsy <=. 0.00001) then 0.00001 else nsy) (if (nsz <=. 0.00001) then 0.00001 else nsz)] -> scale in SO3ObjectSetGlobalScale obj scale; ); let XMLgetMarkByValueFromMarkSons markstr "scale" -> objscalestr in let SO3ObjectGetScale obj -> [sx sy sz] in ( XMLsetParam objscalestr "x" XMLgetShortFloatToString sx; XMLsetParam objscalestr "y" XMLgetShortFloatToString sy; XMLsetParam objscalestr "z" XMLgetShortFloatToString sz; let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in if obj != wobj || mode != 3 then nil else let SO3ObjectGetGlobalScale obj -> [sgx sgy sgz] in ( setEdCtrlFloatValueWithoutCallback ctrlx sx; setEdCtrlFloatValueWithoutCallback ctrly sy; setEdCtrlFloatValueWithoutCallback ctrlz sz; setEdCtrlFloatValueWithoutCallback ctrlgx sgx; setEdCtrlFloatValueWithoutCallback ctrlgy sgy; setEdCtrlFloatValueWithoutCallback ctrlgz sgz; ); ); 0; ) else nil; ); 0;; fun cbAxisUnClick(sessionstr, obj, axis, x, y, btn, p)= // update body on scale let p -> [tgraph viewstr initparams] in let tgraph -> [treeitem type alias markstr path groupmark initstate staticgeometry] in ( if (btn & 1) then ( updateSonsPhysicsBody sessionstr markstr obj; 0; ) else if (btn & 2) then ( //restore previous position orientation scale let initparams -> [[px py pz] [qx qy qz qw] [sx sy sz]] in let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in ( let XMLgetMarkByValueFromMarkSons markstr "position" -> objpositionstr in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> objorientationstr in let XMLgetMarkByValueFromMarkSons markstr "scale" -> objscalestr in ( XMLsetParam objpositionstr "x" XMLgetShortFloatToString px; XMLsetParam objpositionstr "y" XMLgetShortFloatToString py; XMLsetParam objpositionstr "z" XMLgetShortFloatToString pz; XMLsetParam objorientationstr "qx" XMLgetShortFloatToString qx; XMLsetParam objorientationstr "qy" XMLgetShortFloatToString qy; XMLsetParam objorientationstr "qz" XMLgetShortFloatToString qz; XMLsetParam objorientationstr "qw" XMLgetShortFloatToString qw; XMLsetParam objscalestr "x" XMLgetShortFloatToString sx; XMLsetParam objscalestr "y" XMLgetShortFloatToString sy; XMLsetParam objscalestr "z" XMLgetShortFloatToString sz; ); SO3ObjectSetPosition obj [px py pz]; SO3ObjectSetOrientation obj [qx qy qz qw]; SO3ObjectSetScale obj [sx sy sz]; if obj != wobj || mode != 1 then nil else let SO3ObjectGetGlobalPosition obj -> [ogpx ogpy ogpz] in ( setEdCtrlFloatValueWithoutCallback ctrlx px; setEdCtrlFloatValueWithoutCallback ctrly py; setEdCtrlFloatValueWithoutCallback ctrlz pz; setEdCtrlFloatValueWithoutCallback ctrlgx ogpx; setEdCtrlFloatValueWithoutCallback ctrlgy ogpy; setEdCtrlFloatValueWithoutCallback ctrlgz ogpz; ); if obj != wobj || mode != 2 then nil else let SO3MathsQuatToEulerYXZ [qx qy qz qw] -> [ex ey ez] in let SO3ObjectGetGlobalOrientation obj -> gquat in let SO3MathsQuatToEulerYXZ gquat -> [egx egy egz] in let SO3MathsRadianToDegree egx -> egx in let SO3MathsRadianToDegree egy -> egy in let SO3MathsRadianToDegree egz -> egz in let SO3MathsRadianToDegree ex -> ex in let SO3MathsRadianToDegree ey -> ey in let SO3MathsRadianToDegree ez -> ez in ( setEdCtrlFloatValueWithoutCallback ctrlx ex; setEdCtrlFloatValueWithoutCallback ctrly ey; setEdCtrlFloatValueWithoutCallback ctrlz ez; setEdCtrlFloatValueWithoutCallback ctrlgx egx; setEdCtrlFloatValueWithoutCallback ctrlgy egy; setEdCtrlFloatValueWithoutCallback ctrlgz egz; ); if obj != wobj || mode != 3 then nil else let SO3ObjectGetGlobalScale obj -> [sgx sgy sgz] in ( setEdCtrlFloatValueWithoutCallback ctrlx sx; setEdCtrlFloatValueWithoutCallback ctrly sy; setEdCtrlFloatValueWithoutCallback ctrlz sz; setEdCtrlFloatValueWithoutCallback ctrlgx sgx; setEdCtrlFloatValueWithoutCallback ctrlgy sgy; setEdCtrlFloatValueWithoutCallback ctrlgz sgz; ); 0; ); ) else nil; V3DsetCbClick viewstr @cbView3dClick; V3DsetCbUnClick viewstr @cbView3dUnClick; ); 0;; fun cbAxisClick(axisstr, sessionstr, obj, axis, x, y, btn, viewstr)= let SO3ObjectGetName obj -> sname in let getGraphByValue sname -> tgraph in let [SO3ObjectGetPosition obj SO3ObjectGetOrientation obj SO3ObjectGetScale obj] -> initparams in if tgraph == nil then nil else let tgraph -> [treeitem type alias markstr path groupmark initstate staticgeometry] in ( //TODO manage clone ? addObjHistoryState sname markstr obj iViewerEditMode; if ((btn == 1) && (_keybdstate &1) && iViewerEditMode) then //shift ( if type == iTypeScene then nil else ( cloneNode viewstr sname type markstr groupmark treeitem; let getEdCtrlTreeSelectedItem ctrlSceneTree -> item in let getEdCtrlTreeValueByItem ctrlSceneTree item -> [nval _] in let getGraphByValue nval -> ntgraph in ( set axisstr = V3DchangeSelectedAxis sessionstr nval axis; V3DsetCbAxisMove axisstr mkfun8 @cbAxisMove [ntgraph viewstr]; V3DsetCbAxisUnClick axisstr mkfun7 @cbAxisUnClick [ntgraph viewstr initparams]; 0; ); ); ) else ( V3DsetCbAxisMove axisstr mkfun8 @cbAxisMove [tgraph viewstr]; V3DsetCbAxisUnClick axisstr mkfun7 @cbAxisUnClick [tgraph viewstr initparams]; 0; ); V3DsetCbClick viewstr nil; V3DsetCbUnClick viewstr nil; ); 0;; /** initScene [V3Dview V3Dsession] I * init default scene parameters * * parameters are : * - view 3d structure * - session 3d structure * * return 0 **/ fun initScene(viewstr, sessionstr)= showCameraViewport viewstr nil 0; renderingDestroySetting viewstr; dsEdWindow settingWindow; set settingWindow = nil; resetObjHistory; shadowsResetScene sessionstr; //reset modefied materials set lModifiedMaterialList = nil; set lMaterialScriptsList = nil; set sIsolatedNode = nil; set bPhysicOnPlay = 0; set sCurrentScenePath = nil; //let mainInterf.MINT_winLogs -> [_ _ ctrltext] in // setEdCtrlTextValue ctrltext ""; addLogMessage (loc "OS3D_0208"); set iCurSceneIdx = 0; clearModLinks this; destroyAllPluginInstances; // destroy links param windows let sizelist mainInterf.MINT_lLinksConfig -> size in let 0 -> i in while i < size do ( let nth_list mainInterf.MINT_lLinksConfig i -> [_ [winstr _ _]] in dsEdWindow winstr; set i = i + 1; ); set mainInterf.MINT_lLinksConfig = nil; // destroy instance param windows let mainInterf.MINT_lInstanceConfig -> leditorwin in while (leditorwin != nil) do ( let hd leditorwin -> [_ winstr] in dsEdWindow winstr; set leditorwin = tl leditorwin; ); set mainInterf.MINT_lInstanceConfig = nil; // reset groups list and tabs let mainInterf.MINT_winPlugins -> [plugswinstr [tbstr tabbarstr minmaxchk1]] in let sizelist lGroups -> size in let 0 -> i in while i < size do ( let nth_list lGroups i -> [_ groupstr] in dsEdTab tabbarstr groupstr.GRP_tabPlugins; set i = i + 1; ); set lGroups = nil; set mainInterf.MINT_lLinks = nil; resetEdCtrlModuleEditor mainInterf.MINT_meGroups; let mainInterf.MINT_winView -> [_ [tbstr _ chkplay chkselect chkmove chkrotate chkscale chkcoords btnundo btnredo chknav chkgrid chkhelpers chkinfos btnfit chkwiremode btntop btnfront btnleft btnpers]] in let mainInterf.MINT_winInfos -> [_ _ _ [tbmatstr btnmated btnmatadd btnmatdel btnmatassing]] in ( if !iNavigationMode then nil else ( set tLastNavPos = avNavStr.AV_pos; stopAvNavMode viewstr; ); setEdToolBarCheckEnable tbstr chkselect 1; setEdToolBarCheckEnable tbstr chkmove 1; setEdToolBarCheckEnable tbstr chkrotate 1; setEdToolBarCheckEnable tbstr chkscale 1; setEdToolBarCheckEnable tbstr chkcoords 1; setEdToolBarCheckEnable tbstr chknav 1; setEdToolBarCheckEnable tbstr chkgrid 1; setEdToolBarCheckEnable tbstr chkhelpers 1; setEdToolBarCheckEnable tbstr chkwiremode 1; setEdToolBarCheckState tbstr chkplay 0; //setEdToolBarCheckState tbstr chknav 0; //setEdToolBarCheckState tbstr chkgrid 1; //setEdToolBarCheckState tbstr chkhelpers 1; //setEdToolBarCheckState tbstr chkinfos 0; updateToolbarHistoryBtn; setEdToolBarButtonEnable tbstr btntop 1; setEdToolBarButtonEnable tbstr btnfront 1; setEdToolBarButtonEnable tbstr btnleft 1; setEdToolBarButtonEnable tbstr btnpers 1; setEdToolBarButtonEnable tbmatstr btnmated 1; setEdToolBarButtonEnable tbmatstr btnmatadd 1; setEdToolBarButtonEnable tbmatstr btnmatdel 1; setEdToolBarButtonEnable tbmatstr btnmatassing 1; set bAppPlay = 0; //set bShowWireMode = 0; //set iNavigationMode = 0; //set bShowGrid = 1; //set bShowHelpers = 1; //set bShowInfos = 0; //V3DenableScreenInfos viewstr bShowInfos; ); shadowsDestroySetting; physicsDestroySetting; environmentDestroySetting; materialDestroyEditor; let winLightSetup -> [_ winstr] in dsEdWindow winstr; set winLightSetup = nil; dsEdWindow winFogSetup; set winFogSetup = nil; let winFilterTree -> [winstr _] in dsEdWindow winstr; set winFilterTree = nil; dsEdWindow winMatSchemeSetup; set winMatSchemeSetup = nil; let winCameraSetup -> [_ winstr] in dsEdWindow winstr; set winCameraSetup = nil; let winCoordsSetup -> [_ _ winstr _ _ _ _ _ _ _ _ _ _] in dsEdWindow winstr; set winCoordsSetup = nil; let winAnimSetup -> [_ winstr _ _ _] in dsEdWindow winstr; set winAnimSetup = nil; let winParticleSetup -> [_ winstr _ _] in dsEdWindow winstr; set winParticleSetup = nil; let winCubeMapSetup -> [_ winstr _ _] in dsEdWindow winstr; set winCubeMapSetup = nil; let winReflectionMapSetup -> [_ winstr _ _] in dsEdWindow winstr; set winReflectionMapSetup = nil; let winCompositorSetup -> [_ winstr] in dsEdWindow winstr; set winCompositorSetup = nil; let winNodeSetup -> [_ winstr] in dsEdWindow winstr; set winNodeSetup = nil; let winEntitySetup -> [_ winstr] in dsEdWindow winstr; set winEntitySetup = nil; let winEntityInfo -> [_ winstr _] in dsEdWindow winstr; set winEntityInfo = nil; dsEdWindow winExportSetup; set winExportSetup = nil; let winSkySetup -> [sname winstr] in dsEdWindow winstr; set winSkySetup = nil; dsEdWindow winImportScene; set winImportScene = nil; let winMeshMaterialSetup -> [_ swinstr] in dsEdWindow swinstr; set winMeshMaterialSetup = nil; resetEdCtrlTree ctrlSceneTree; resetEdCtrlList ctrlResourcesDirList; resetEdCtrlList ctrlMaterialList; resetEdCtrlList ctrlResourcesList; resetEdCtrlList ctrlMeshList; set lSceneGraph = nil; set lResourcesPath = nil; V3DresetSession sessionstr; V3DenableScreenInfos viewstr bShowInfos; V3DshowSceneGrid sessionstr bShowGrid; // reset resources groups let SO3GroupList (V3DgetSession sessionstr) -> l in let sizelist l -> size in let 0 -> i in while i < size do ( let nth_list l i -> resgroup in if (!strcmp resgroup sV3DResourcesGroup) then nil else SO3GroupDelete (V3DgetSession sessionstr) resgroup; set i = i + 1; ); SO3CbLogs _channel @cbOgreLogs nil SO3_LL_LOW; XMLclose xmlEditSceneFile; VUIreset sessionstr; set xmlEditSceneFile = newOsSceneFile viewstr; let V3DgetDefaultViewport viewstr -> viewportstr in let XMLgetMarkByValue xmlEditSceneFile "scene" -> scenestr in ( renderingResetScene sessionstr viewportstr; SO3ViewportSetMaterialScheme viewportstr.V3D_viewport ""; SO3GroupCreate (V3DgetSession sessionstr) "Scene"; let addGraphItem "Scene" "Scene" iTypeScene nil scenestr nil scenestr nil 0 0 -> treeroot in ( let XMLaddMark xmlEditSceneFile "cinematics" scenestr nil nil -> cinematicsstr in addGraphItem (loc "OS3D_0090") (strcatn "Scene"::"."::(loc "OS3D_0090")::nil) iTypeCinematics nil cinematicsstr nil scenestr treeroot 1 0; addGraphItem "default_camera" "default_camera" iTypeCamera nil nil nil scenestr treeroot 1 0; addGraphItem "default_light" "default_light" iTypeLight nil nil nil scenestr treeroot 1 0; ); enableDefaultLight 1; setEdCtrlTreeExpandAll ctrlSceneTree 1; V3DenableView viewstr 1; V3DenableKeyboard viewstr 1; V3DenableMouse viewstr 1; V3DenableNavigate sessionstr 1; //V3DsetFont viewstr "Arial" 16 FF_WEIGHT 0x00ffff; V3DviewSetFocus viewstr; V3DsetCamera (V3DgetDefaultCamera sessionstr) nil 1.0 0.1 1000.0; V3DshowObjectHelper viewstr sessionstr (V3DgetDefaultCamera sessionstr) iTypeCamera 1; let if tLastNavPos == nil then [(SO3ObjectGetPosition sessionstr.V3D_shellNavigate) [0.0 0.0 0.0 1.0] [0.0 0.0 0.0 1.0]] else tLastNavPos -> [spos squat cquat] in if !iNavigationMode then nil else startAvNavMode viewstr spos squat cquat 1.5 1.60; set xmlBaseScene = XMLcopy xmlEditSceneFile; setEdWindowName mainInterf.MINT_winMain strcatn (strcat (loc "OS3D_0286") " ")::getVersionName::nil; setViewWireMode viewstr bShowWireMode; V3DenableHelpers (V3DgetDefaultViewport viewstr) sessionstr bShowHelpers; paintEdCtrlModuleEditor mainInterf.MINT_meGroups; ); 0;; /** cbDlgAddResources [[S r1] u0] I * callback on dlg add resources * * private * * return 0 **/ fun cbDlgAddResources(lp, p)= let p -> [viewstr markstr val item] in let sizelist lp -> size in let 0 -> i in while i < size do ( let _PtoScol (nth_list lp i) -> file in if (file == nil) then nil else ( addResourceFile viewstr markstr file nil; set sLastDirectory = getFileDirectory file; ); set i = i + 1; ); 0;; /** cbDlgAddResourceDir [MessageBox V3Dview S] I * callback on dlg add resources dir * * private * * return 0 **/ fun cbDlgAddResourceDir(dlg, viewstr, path)= if (path == nil) || (!strcmp "" (strtrim path)) then nil else ( addOsResourceDir path::nil; set sLastDirectory = path; ); 0;; /** cbEnablePlugitLog [EdToolBar CompCheck I I I EdWindow] I * callback on Enable / Disable button * * private * * return 0 **/ fun cbEnablePlugitLog(tbstr, check, btn, mask, state, winstr)= set bPlugItLog = !bPlugItLog; if state then set DMSdebug = @cbDmsLogs else set DMSdebug = nil; 0;; /** cbClearLog [EdToolBar CompRollOver I I EdWindow] I * callback clear logs button * * private * * return 0 **/ fun cbClearLog(tbstr, cbtn, btn, mask, winstr)= clearLogsMessages; 0;; fun cbDestroyFloatingWindow(winstr, p)= let p -> [childstr x y w h rflags tbstr minmaxchk] in ( setEdWindowParent childstr childstr.EDW_prevFather; setEdWindowPosSize childstr x y w h; setEdWindowResizeFlags winstr rflags; let mainInterf.MINT_winInfos -> [winfostr _ _ _] in let mainInterf.MINT_winView -> [wviewstr _] in let mainInterf.MINT_winPlugins -> [pviewstr _] in let mainInterf.MINT_winLogs -> [winlogs _ _] in let mainInterf.MINT_winHBorder -> hborder in let mainInterf.MINT_winHBorder2 -> h2border in let mainInterf.MINT_winVBorder -> vborder in let if (winfostr.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> binfo in let if (pviewstr.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> bpview in let if (winlogs.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> blogs in let _GETwindowPositionSize mainInterf.MINT_winMain.EDW_win -> [_ _ mw mh] in ( let if (childstr == winfostr) then [x y w h] else if (!binfo) then [0 0 0 0] else _GETwindowPositionSize winfostr.EDW_win -> [_ iy iw ih] in let if (childstr == pviewstr) then [x y w h] else if (!bpview) then [0 0 0 0] else _GETwindowPositionSize pviewstr.EDW_win -> [_ py _ ph] in let if (childstr == winlogs) then [x y w h] else if (!blogs) then [0 0 0 0] else _GETwindowPositionSize winlogs.EDW_win -> [_ ly _ lh] in let _GETwindowPositionSize wviewstr.EDW_win -> [vx vy vw vh] in let _GETwindowPositionSize vborder.EDW_win -> [_ wy ww wh] in let _GETwindowPositionSize hborder.EDW_win -> [_ _ _ hh] in let _GETwindowPositionSize h2border.EDW_win -> [_ _ _ h2h] in let if (!binfo) then (-ww) else iw -> xpos in let if (!blogs && !bpview) then vy + vh else if (!blogs) then mh - ph - hh else if (!bpview) then mh - lh - h2h else py - hh -> ypos in let if (!blogs) then mh else if (!bpview) then (mh - lh - h2h) else (ypos + hh + (if (childstr == winlogs) then abs(lh - ph) else ph)) -> y2pos in let if (binfo && (xpos <= 120)) then 120 else if (binfo && ((mw-xpos-ww) <= 350)) then mw-350 else xpos -> xpos in let if (bpview && (y2pos <= (py + 28))) then (py + 28) else if (blogs && (y2pos >= (mh - 28 - h2h))) then (mh - 28 - h2h) else y2pos -> y2pos in let if ypos <= (36+28) then (36+28) else if (bpview && (ypos >= (y2pos - hh - 28))) then (y2pos - hh - 28) else ypos -> ypos in ( setEdWindowPosSize hborder 0 ypos mw hh; setEdWindowPosSize vborder xpos wy ww ypos-wy; if (!binfo) then nil else setEdWindowPosSize winfostr 0 iy xpos ypos-iy; setEdWindowPosSize wviewstr xpos+ww vy mw-xpos-ww ypos-vy; if (!bpview) then nil else setEdWindowPosSize pviewstr 0 ypos+hh mw y2pos-(ypos+hh); setEdWindowPosSize h2border 0 y2pos mw h2h; if (!blogs) then nil else setEdWindowPosSize winlogs 0 y2pos+h2h mw mh-y2pos-h2h; ); ); //let _GETwindowPositionSize mainInterf.MINT_winMain.EDW_win -> [hx ypos hw hh] in // cbWinMainSize mainInterf.MINT_winMain hw hh; setEdToolBarCheckState tbstr minmaxchk 0; ); 0;; /** cbMinMaxWin [EdToolBar CompCheck I I I EdWindow] I * callback on min / max button * * private * * return 0 **/ fun cbMinMaxWin(tbstr, check, btn, mask, state, winstr)= if (state) then ( let getEdWindowPosSize winstr -> [ox oy iw ih] in let getEdWindowScreenPos winstr -> [x y] in let getEdWindowResizeFlags winstr -> rflags in let mainInterf.MINT_winInfos -> [_ [tbstr minmaxchk] _ _] in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_SIZEBOX nil "") sWinDlgIcon -> dwinstr in ( setEdWindowParent winstr dwinstr; setEdWindowPosSize winstr 0 0 iw ih; setEdWindowResizeFlags winstr EDWIN_RESIZE_MW|EDWIN_RESIZE_MH; setEdwindowCbDestroy dwinstr mkfun2 @cbDestroyFloatingWindow [winstr ox oy iw ih rflags tbstr minmaxchk]; let _GETwindowPositionSize mainInterf.MINT_winMain.EDW_win -> [_ _ hw hh] in cbWinMainSize mainInterf.MINT_winMain hw hh; ); 0; ) else ( dsEdWindow winstr.EDW_father; 0; ); //maximizeOrMinimizeEdWindow winstr 0 1; //if state then nil else //let mainInterf.MINT_winInfos -> [winfostr _ _ _] in //let mainInterf.MINT_winView -> [wviewstr _] in //let mainInterf.MINT_winPlugins -> [pviewstr _] in //let mainInterf.MINT_winLogs -> [winlogs _ _] in //let mainInterf.MINT_winHBorder -> hborder in //let mainInterf.MINT_winHBorder2 -> h2border in //let mainInterf.MINT_winVBorder -> vborder in //let _GETwindowPositionSize mainInterf.MINT_winMain.EDW_win -> [_ _ mw mh] in //( // let _GETwindowPositionSize winfostr.EDW_win -> [ix iy iw ih] in // let _GETwindowPositionSize wviewstr.EDW_win -> [vx vy vw vh] in // let _GETwindowPositionSize pviewstr.EDW_win -> [px py pw ph] in // let _GETwindowPositionSize winlogs.EDW_win -> [lx ly lw lh] in // let _GETwindowPositionSize hborder.EDW_win -> [hx ypos hw hh] in // let _GETwindowPositionSize vborder.EDW_win -> [xpos wy ww wh] in // let _GETwindowPositionSize h2border.EDW_win -> [h2x y2pos h2w h2h] in // let if xpos <= 120 then 120 else if (mw-xpos-ww) <= 350 then mw-350 else xpos -> xpos in // let if ypos <= (36+28) then (36+28) else if ypos >= (y2pos - hh - 28) then (y2pos - hh - 28) else ypos -> ypos in // let if y2pos <= (py + 28) then (py + 28) else if y2pos >= (mh - 28 - h2h) then (mh - 28 - h2h) else y2pos -> y2pos in // ( // setEdWindowPosSize hborder hx ypos hw hh; // setEdWindowPosSize vborder xpos wy ww ypos-wy; // setEdWindowPosSize winfostr ix iy ix+xpos ypos-iy; // setEdWindowPosSize wviewstr xpos+ww vy mw-xpos-ww ypos-vy; // setEdWindowPosSize pviewstr px ypos+hh pw y2pos-(ypos+hh); // // setEdWindowPosSize h2border h2x y2pos h2w h2h; // setEdWindowPosSize winlogs lx y2pos+h2h lw mh-y2pos-h2h; // ); //); 0;; /** cbMinMaxWinLogs [EdToolBar CompCheck I I I EdWindow] I * callback on min / max button * * private * * return 0 **/ fun cbMinMaxWinLogs(tbstr, check, btn, mask, state, winstr)= //maximizeOrMinimizeEdWindow winstr 0 1; if (state) then ( let getEdWindowPosSize winstr -> [ox oy iw ih] in let getEdWindowScreenPos winstr -> [x y] in let getEdWindowResizeFlags winstr -> rflags in let mainInterf.MINT_winLogs -> [_ [tbstr minmaxchk _] _] in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_SIZEBOX nil "") sWinDlgIcon -> dwinstr in ( setEdWindowParent winstr dwinstr; setEdWindowPosSize winstr 0 0 iw ih; setEdWindowResizeFlags winstr EDWIN_RESIZE_MW|EDWIN_RESIZE_MH; setEdwindowCbDestroy dwinstr mkfun2 @cbDestroyFloatingWindow [winstr ox oy iw ih rflags tbstr minmaxchk]; let _GETwindowPositionSize mainInterf.MINT_winMain.EDW_win -> [_ _ hw hh] in cbWinMainSize mainInterf.MINT_winMain hw hh; ); 0; ) else ( dsEdWindow winstr.EDW_father; 0; ); 0;; /** cbMinMaxViewWin [EdToolBar CompCheck I I I EdWindow] I * callback on min / max button * * private * * return 0 **/ fun cbMinMaxViewWin(tbstr, check, btn, mask, state, winstr)= maximizeOrMinimizeEdWindow winstr 0 1; 0;; /** cbMinMaxWinPlugs [EdToolBar CompCheck I I I EdWindow] I * callback on min / max button * * private * * return 0 **/ fun cbMinMaxWinPlugs(tbstr, check, btn, mask, state, winstr)= //maximizeOrMinimizeEdWindow winstr 0 1; if (state) then ( let getEdWindowPosSize winstr -> [ox oy iw ih] in let getEdWindowScreenPos winstr -> [x y] in let getEdWindowResizeFlags winstr -> rflags in let mainInterf.MINT_winPlugins -> [_ [tbstr _ minmaxchk]] in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_SIZEBOX nil "") sWinDlgIcon -> dwinstr in ( setEdWindowParent winstr dwinstr; setEdWindowPosSize winstr 0 0 iw ih; setEdWindowResizeFlags winstr EDWIN_RESIZE_MW|EDWIN_RESIZE_MH; setEdwindowCbDestroy dwinstr mkfun2 @cbDestroyFloatingWindow [winstr ox oy iw ih rflags tbstr minmaxchk]; let _GETwindowPositionSize mainInterf.MINT_winMain.EDW_win -> [_ _ hw hh] in cbWinMainSize mainInterf.MINT_winMain hw hh; ); 0; ) else ( dsEdWindow winstr.EDW_father; 0; ); 0;; fun cbNewOnSave(viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in initScene viewstr sessionstr; 0;; fun cbSaveBeforeNew(dlg, viewstr, state)= if (state == 2) then nil else // Cancel if (state == 1) then // OK ( saveSceneFile mkfun1 @cbNewOnSave viewstr; 0; ) else ( let V3DgetDefaultSession viewstr -> sessionstr in initScene viewstr sessionstr; /*let mainInterf.MINT_tbMain -> [ _ _ _ cmprsave _ _ cmpsetting cmpexport cmpplayer _ _ _ ] in ( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpplayer OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpexport OBJ_DISABLE|OBJ_VISIBLE 1; );*/ 0; ); 0;; /** cbTbBtnReset [EdToolBar CompRollOver I I V3Dview] I * callback on reset button * * private * * return 0 **/ fun cbTbBtnReset(tbstr, croll, btn, mask, viewstr)= if (isSceneModified) then ( _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0122") 3 @cbSaveBeforeNew viewstr; 0; ) else ( let V3DgetDefaultSession viewstr -> sessionstr in initScene viewstr sessionstr; /* let mainInterf.MINT_tbMain -> [ _ _ _ cmprsave _ _ cmpsetting cmpexport cmpplayer _ _ _ ] in ( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpplayer OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpexport OBJ_DISABLE|OBJ_VISIBLE 1; ); */ 0; ); 0;; /** cbDlgOpenOs3dScene [MessageBox V3Dview P] I * callback on dlg open * * private * * return 0 **/ fun cbDlgOpenOs3dScene(dlg, viewstr, pfile)= if pfile == nil then nil else ( let getFileExt _GetFileNameFromP pfile -> ext in if (!strcmpi "pkos" ext) then ( loadPkOS viewstr pfile; ) else if ((_PtoScol pfile) == nil) then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0472") 0; addLogMessage (loc "OS3D_0161"); 0; ) else if (!strcmpi ext "XOS") then ( initScene viewstr (V3DgetDefaultSession viewstr); loadOs3DScene viewstr (_PtoScol pfile); ) else nil; set sLastDirectory = getFileDirectory (_PtoScol pfile); ); let mainInterf.MINT_tbMain -> [cmpnew cmpopen cmpimport cmprsave cmprsaveas cmpsetting cmpthemeeditor cmpexport cmpplayer _ _ _ ] in ( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpnew OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpopen OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpimport OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsave OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsaveas OBJ_ENABLE|OBJ_VISIBLE 1; //if (sCurrentScenePath == nil) then nil else //( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpplayer OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpexport OBJ_ENABLE|OBJ_VISIBLE 1; //); ); 0;; fun cbDlgOpenOs3dSceneCustom(pfile, viewstr)= cbDlgOpenOs3dScene nil viewstr pfile; 0;; /* ********************************************************************************************* / Import mesh / ********************************************************************************************* */ fun cbImportListKeyDown(ctrlstr, pos, name, lval, type, key, code)= 0;; fun cbImportListKeyUp(ctrlstr, pos, name, lval, type, key)= if key != 339 then nil else //Suppr delEdCtrlList ctrlstr name; 0;; fun cbImportRemoveInList(ctrlstr, ctrllist)= let getSelectedEdCtrlList ctrllist -> [name lval type] in delEdCtrlList ctrllist name; 0;; fun cbDlgImportAddScript(lpfile, ctrllist)= if lpfile == nil then nil else let 0 -> error in ( let sizelist lpfile -> size in let 0 -> i in while i < size && !error do ( let nth_list lpfile i -> pfile in let _PtoScol pfile -> file in if file == nil then ( set error = 1; 0; ) else ( let getEdCtrlListElem ctrllist file -> exist in if (exist != nil) then nil else addEdCtrlList ctrllist (strlowercase file) nil nil; set sLastDirectory = getFileDirectory file; 0; ); set i = i + 1; ); if !error then nil else _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0472") 0; ); 0;; fun cbDlgImportAddResourceDir(dlg, ctrllist, path)= let getEdCtrlListElem ctrllist path -> exist in if (path == nil) || (!strcmp "" (strtrim path)) || (exist != nil) then nil else ( addEdCtrlList ctrllist (strlowercase path) nil nil; set sLastDirectory = path; ); 0;; fun cbImportAddResourceDir(ctrlstr, ctrllist)= _DLGrflopenDir (_DLGOpenDir _channel winImportScene.EDW_win nil (loc "OS3D_0032")) @cbDlgImportAddResourceDir ctrllist; 0;; /** cbDestroyImportMeshWin [EdWindow] I * callback on destroy import mesh window * * private * * return 0 **/ fun cbDestroyImportMeshWin(winstr)= set winImportMesh = nil; 0;; fun cbOgreMeshLoaded(mesh, p)= let p -> [sessionstr groupstr meshpath destmark father treefather meshname id] in let strlowercase strcat (getFilePathWithoutExt meshpath) ".skeleton" -> sklpath in let OGMATfindResourcePath sklpath lResourcesPath -> sklpath in let XMLaddMark xmlEditSceneFile "mesh" destmark ["id" id]::["name" meshname]::["path" meshpath]::["castShadows" "true"]::["volumetric" "false"]::["receiveShadows" "true"]::["renderingDistance" "0"]::["renderQueue" "50"]::["indexMaterials" (XMLgetBoolString 0)]::["visibilityFlags" "0xFFFFFFFF"]::(if sklpath == nil then nil else ["skeletonlink" sklpath])::nil nil -> meshxmlstr in let XMLaddMark xmlEditSceneFile "subentities" meshxmlstr nil nil -> meshxmlsubstr in let addGraphItem (strcatn meshname::" #"::id::nil) (strcatn id::"."::meshname::nil) iTypeEntity nil meshxmlstr meshpath groupstr.GRP_xmlMark treefather 0 0 -> treenode in ( selEdCtrlTreeItem ctrlSceneTree treenode; if (_checkpack sklpath) == nil then nil else ( V3DaddResource sessionstr sklpath groupstr.GRP_sName SO3_RESOURCE_SKELETON; SO3EntityAttachSkeleton mesh _checkpack sklpath; addOsSceneResource xmlEditSceneFile groupstr.GRP_xmlMark groupstr sklpath SO3_RESOURCE_SKELETON; let SO3GetRootBonesFromMesh mesh -> rootbones in let sizelist rootbones -> nbrootbones in let 0 -> i in while i < nbrootbones do ( let (nth_list rootbones i) -> rbone in ( SO3ObjectSetFlags rbone iNodeFlagScene; loadBonesChilds sessionstr rbone meshxmlstr treenode groupstr.GRP_xmlMark; ); set i = i + 1; ); ); let SO3EntityNumOfSubEntities mesh -> nbentities in let 0 -> i in while i < nbentities do ( let SO3MaterialGetName (SO3EntityGetMaterialByIndex mesh i) -> submatname in XMLaddMark xmlEditSceneFile "subentity" meshxmlsubstr ["index" (itoa i)]::["materialName" submatname]::["defaultMaterial" submatname]::nil nil; set i = i + 1; ); // morph anims let SO3ObjectGetVertexAnimations mesh -> lmorph in if lmorph == nil then nil else ( let 0 -> imorph in while (lmorph != nil) do ( let hd lmorph -> anim in let SO3AnimationGetType anim -> atype in let if (atype == SO3_SCENENODE_ANIM) then "node" else if (atype == SO3_SKELETAL_ANIM) then "skeletal" else if (atype == SO3_VERTEX_ANIM) then "morph" else if (atype == SO3_POSE_ANIM) then "pose" else nil -> ratype in let if imorph == 0 then 1 else 0 -> defstate in let itoa getNewSceneIndex nil -> animid in let SO3AnimationGetName anim -> animname in let XMLgetMarkByValueFromMarkSons meshxmlstr "animations" -> animsmark in let if animsmark != nil then animsmark else XMLaddMark xmlEditSceneFile "animations" meshxmlstr nil nil -> targetanimsmark in let XMLaddMark xmlEditSceneFile "animation" targetanimsmark ["id" animid]::["name" animname]::["type" ratype]::["enable" (XMLgetBoolString defstate)]::["loop" (XMLgetBoolString defstate)]::["speed" (XMLgetShortFloatToString fDefaultAnimationSpeed)]::["weight" (XMLgetShortFloatToString 1.0)]::["skipFrame" (XMLgetBoolString 1)]::nil nil -> newanimmark in let addGraphItem strcatn animname::" #"::animid::" ("::ratype::")"::nil (strcatn animid::"."::animname::nil) iTypeAnim nil newanimmark nil groupstr.GRP_xmlMark treenode defstate 0 -> treenode in ( V3DaddMorphAnimation sessionstr anim mesh (atoi animid) animname (strcatn animid::"."::animname::nil) fDefaultAnimationSpeed 1.0 defstate defstate; ); set imorph = imorph + 1; set lmorph = tl lmorph; ); ); XMLaddMark xmlEditSceneFile "scale" meshxmlstr ["x" "1"]::["y" "1"]::["z" "1"]::nil nil; XMLaddMark xmlEditSceneFile "position" meshxmlstr ["x" "0"]::["y" "0"]::["z" "0"]::nil nil; XMLaddMark xmlEditSceneFile "rotation" meshxmlstr ["qx" "0"]::["qy" "0"]::["qz" "0"]::["qw" "1"]::nil nil; //V3DaddResource sessionstr meshpath groupstr.GRP_sName SO3_RESOURCE_MESH; addOsSceneResource xmlEditSceneFile groupstr.GRP_xmlMark groupstr meshpath SO3_RESOURCE_MESH; SO3ObjectSetCastShadows mesh 1; SO3EntitySetVisibilityFlags mesh 0xFFFFFFFF; if (!(isParentHidden mesh)) then nil else SO3ObjectSetVisible mesh 0 1; ); 0;; fun loadOgreMesh(viewstr, groupstr, meshpath, destmark, father, treefather)= let V3DgetDefaultSession viewstr -> sessionstr in let getFileNameWithoutExt meshpath -> meshname in let itoa getNewSceneIndex nil -> id in let SO3SceneLoadEntityInBackground (V3DgetSession sessionstr) groupstr.GRP_sName (strcatn id::"."::meshname::nil) _checkpack meshpath @cbOgreMeshLoaded [sessionstr groupstr meshpath destmark father treefather meshname id] -> mesh in ( if mesh == nil then nil else ( if father == nil then nil else SO3ObjectLink mesh father; SO3ObjectSetFlags mesh iNodeFlagScene; SO3ObjectSetPosition mesh [0.0 0.0 0.0]; SO3ObjectSetOrientation mesh [0.0 0.0 0.0 1.0]; SO3ObjectSetScale mesh [1.0 1.0 1.0]; mesh; ); );; fun cbIsOgreMeshReadyToImport(trm, p)= let p -> [viewstr groupstr destmark father file treefather] in if groupstr.GRP_iWaitForLoad > 0 then nil else ( _deltimer trm; loadGroupResources groupstr viewstr groupstr.GRP_xmlMark; let loadOgreMesh viewstr groupstr file destmark father treefather -> mesh in if mesh != nil then addLogMessage (loc "OS3D_0248") else addLogMessage (loc "OS3D_0153"); cbMaterialsTabFocused nil ctrlMaterialList; cbResourcesTabFocused nil ctrlResourcesList; cbMeshesTabFocused nil ctrlMeshList; cbSceneTreeTabFocused nil ctrlSceneTree; ); 0;; fun importOgreMesh(viewstr, file, lresdir, lscripts, destmark, father, treefather)= addLogMessage strcatn (strcat (loc "OS3D_0200") " ")::file::nil; addOsResourceDir lresdir; let getEdCtrlTreeValueByItem ctrlSceneTree treefather -> [fval _] in let getGraphByValue fval -> [_ type _ markstr _ groupmark _ _] in let if type != iTypeGroup && type != iTypeScene then switch lGroups groupmark else switch lGroups markstr -> groupstr in ( getResourcesScriptFiles groupstr lscripts; if groupstr.GRP_iWaitForLoad > 0 then ( _rfltimer _starttimer _channel 1000 @cbIsOgreMeshReadyToImport [viewstr groupstr destmark father file treefather]; 0; ) else ( cbIsOgreMeshReadyToImport nil [viewstr groupstr destmark father file treefather]; 0; ); ); 0;; fun cbImportMeshEnd(ctrlstr, p)= let p -> [[stpwinstr ctrlnext lfile ctrllist lresdir] [viewstr destmark val type treefather]] in let getEdCtrlListElems ctrllist -> lscripts in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let if (treefather == nil) then (getEdCtrlTreeRootItem ctrlSceneTree) else treefather -> treefather in let if destmark != nil then destmark else XMLgetMarkByValue xmlEditSceneFile "scene" -> destmark in let if (type == iTypeGroup || type == iTypeScene) then XMLgetMarkByValueFromMarkSons destmark "graph" else destmark -> destmark in ( dsEdWindow winImportMesh; set winImportMesh = nil; while (lfile != nil) do ( let hd lfile -> file in importOgreMesh viewstr file lresdir lscripts destmark father treefather; set lfile = tl lfile; ); resetObjHistory; ); 0;; fun cbImportAddMeshScript(ctrlstr, ctrllist)= let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [750 450] -> [iw ih] in let crEdOpenFileDialogMulti _channel winImportMesh nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (loc "OS3D_0285") ["Ogre scripts" "material"::"program"::"compositior"::"skeleton"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil sLastDirectory -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogCbMulti dlgfstr mkfun2 @cbDlgImportAddScript ctrllist; ); 0;; fun cbImportMeshStep5(ctrlstr, p)= let p -> [[stpwinstr ctrlnext lfile ctrllist] [viewstr destmark val type treefather] [iw ih]] in let getEdCtrlListElems ctrllist -> lresdir in ( dsEdWindow stpwinstr; dsEdCtrlButton ctrlnext; let crEdWindow _channel winImportMesh 10 10 (iw - 20) (ih - 45) WN_CHILDINSIDE nil nil "" -> stpwinstr in let crEdCtrlText stpwinstr 10 12 (iw - 40) 60 strcatn (strcat (loc "OS3D_0366") " ")::(hd lfile)::""::nil ET_BORDER nil -> labeltype in let crEdCtrlList stpwinstr 10 80 (iw - 40) 120 nil EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrllist in let crEdCtrlButton stpwinstr 20 210 140 20 (loc "OS3D_0035") EDWIN_RESIZE_MW -> ctrladd in let crEdCtrlButton stpwinstr (iw - 180) 210 140 20 (loc "OS3D_0332") EDWIN_RESIZE_MW -> ctrlremove in let crEdCtrlButton winImportMesh (iw - 100) (ih - 30) 90 20 (loc "OS3D_0199") EDWIN_RESIZE_MW -> ctrlend in ( let sizelist lresdir -> size in let 0 -> i in while i < size do ( let nth_list lresdir i -> dir in let getFilesFromDir dir "material"::"program"::"compositor"::"particle"::"pu"::nil -> lfiles in let sizelist lfiles -> size2 in let 0 -> i2 in while i2 < size2 do ( let nth_list lfiles i2 -> script in let getEdCtrlListElem ctrllist script -> exist in if (exist != nil) then nil else addEdCtrlList ctrllist (strlowercase script) nil nil; set i2 = i2 + 1; ); set i = i + 1; ); setEdCtrlButtonCb ctrladd mkfun2 @cbImportAddMeshScript ctrllist; setEdCtrlButtonCb ctrlremove mkfun2 @cbImportRemoveInList ctrllist; setEdCtrlButtonCb ctrlend mkfun2 @cbImportMeshEnd [[stpwinstr ctrlend lfile ctrllist lresdir] [viewstr destmark val type treefather]]; setEdCtrlListCbKeyUp ctrllist @cbImportListKeyUp; setEdCtrlListCbKeyDown ctrllist @cbImportListKeyDown; ); ); 0;; fun getImportMeshResourceDir(file, ctrllist)= let getPathFile file "" -> [dir _] in addEdCtrlList ctrllist dir nil nil; 0;; fun cbImportMeshStep4(p)= let p -> [[ctrlnext lfile] [viewstr destmark val type treefather] [iw ih]] in let crEdWindow _channel winImportMesh 10 10 (iw - 20) (ih - 45) WN_CHILDINSIDE nil nil "" -> stpwinstr in let crEdCtrlText stpwinstr 10 12 (iw - 40) 60 strcatn (strcat (loc "OS3D_0367") " ")::(hd lfile)::" "::(loc "OS3D_0001")::nil ET_BORDER nil -> labeltype in let crEdCtrlList stpwinstr 10 80 (iw - 40) 120 nil EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrllist in let crEdCtrlButton stpwinstr 20 210 140 20 (loc "OS3D_0022") EDWIN_RESIZE_MW -> ctrladd in let crEdCtrlButton stpwinstr (iw - 180) 210 140 20 (loc "OS3D_0330") EDWIN_RESIZE_MW -> ctrlremove in ( getImportMeshResourceDir (hd lfile) ctrllist; setEdCtrlButtonCb ctrladd mkfun2 @cbImportAddResourceDir ctrllist; setEdCtrlButtonCb ctrlremove mkfun2 @cbImportRemoveInList ctrllist; setEdCtrlButtonCb ctrlnext mkfun2 @cbImportMeshStep5 [[stpwinstr ctrlnext lfile ctrllist] [viewstr destmark val type treefather] [iw ih]]; setEdCtrlListCbKeyUp ctrllist @cbImportListKeyUp; setEdCtrlListCbKeyDown ctrllist @cbImportListKeyDown; ); 0;; fun cbImportMeshStep3(lpfile, p)= let p -> [[stpwinstr ctrlnext] [viewstr destmark val type treefather] [iw ih]] in ( if lpfile == nil then nil else let nil -> lfile in ( while (lpfile != nil) do ( let hd lpfile -> pfile in let getFileExt _GetFileNameFromP pfile -> ext in let strlowercase (_PtoScol pfile) -> file in if (strcmpi "mesh" ext) && (strcmpi "xml" ext) then nil else ( set lfile = file::lfile; ); set lpfile = tl lpfile; ); if (lfile == nil) then ( _DLGMessageBox _channel winImportMesh.EDW_win (loc "OS3D_0155") (loc "OS3D_0472") 0; 0; ) else ( dsEdWindow stpwinstr; cbImportMeshStep4 [[ctrlnext lfile] [viewstr destmark val type treefather] [iw ih]]; set sLastDirectory = getFileDirectory (hd lfile); 0; ); ); setEdCtrlButtonEnable ctrlnext 1 ); 0;; fun cbImportMeshStep2(ctrlstr, p)= let p -> [[stpwinstr ctrlnext] [viewstr destmark val type treefather] [iw ih]] in ( setEdCtrlButtonEnable ctrlnext 0; let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [750 450] -> [iw ih] in let crEdOpenFileDialogMulti _channel winImportScene nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (strcat (strcat (loc "OS3D_0193") " ") val) ["Ogre mesh" "mesh"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil sLastDirectory -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogCbMulti dlgfstr mkfun2 @cbImportMeshStep3 p; 0; ); ); 0;; fun importMeshWizard(viewstr, destmark, val, type, treefather, lfile)= if winImportMesh == nil then nil else ( dsEdWindow winImportMesh; set winImportMesh = nil; ); let [400 350] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0193") " ") val) sWinDlgIcon -> winstr in let crEdWindow _channel winstr 10 10 (iw - 20) (ih - 45) WN_CHILDINSIDE nil nil "" -> stpwinstr in let crEdCtrlText stpwinstr 10 12 (iw - 40) 60 (loc "OS3D_0247") ET_BORDER nil -> labeltype in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0268") EDWIN_RESIZE_MW -> ctrlnext in ( set winImportMesh = winstr; if lfile == nil then ( setEdCtrlButtonCb ctrlnext mkfun2 @cbImportMeshStep2 [[stpwinstr ctrlnext] [viewstr destmark val type treefather] [iw ih]]; 0; ) else ( dsEdWindow stpwinstr; cbImportMeshStep4 [[ctrlnext lfile] [viewstr destmark val type treefather] [iw ih]]; 0; ); setEdwindowCbDestroy winstr @cbDestroyImportMeshWin; ); 0;; /* ********************************************************************************************* / Import scene / ********************************************************************************************* */ fun cbImportEnd(ctrlstr, p)= let p -> [[lfile lresdir lscripts ctrlscenegrp ctrlcurgrp ctrlnewgrp ctrlgrpname] [viewstr destgroupmark val treefather]] in let if (getEdCtrlRadioState ctrlscenegrp) then 1 else if (getEdCtrlRadioState ctrlnewgrp) then 0 else 2 -> mode in let V3DgetDefaultSession viewstr -> sessionstr in let if mode == 1 then nil else SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let if (treefather == nil) || (mode == 1) then (getEdCtrlTreeRootItem ctrlSceneTree) else treefather -> treefather in let if (destgroupmark == nil) || (mode == 1) then (XMLgetMarkByValue xmlEditSceneFile "scene") else destgroupmark -> destgroupmark in let getEdCtrlTextLineValue ctrlgrpname -> groupname in ( dsEdWindow winImportScene; set winImportScene = nil; while (lfile != nil) do ( let hd lfile -> file in importOgreMaxScene viewstr file lresdir lscripts destgroupmark father treefather groupname mode; set lfile = tl lfile; ); resetObjHistory; ); 0;; fun cbCtrlImportNewGroup(ctrlstr, state, ctrlgrpname)= setEdCtrlTextLineEnable ctrlgrpname state; 0;; fun cbCtrlImportCurGroup(ctrlstr, state, ctrlcurgrp)= setEdCtrlTextLineEnable ctrlcurgrp !state; 0;; fun cbCtrlImportSceneGroup(ctrlstr, state, ctrlscenegrp)= setEdCtrlTextLineEnable ctrlscenegrp !state; 0;; fun cbImportStep6(ctrlstr, p)= let p -> [[stpwinstr ctrlnext lfile ctrllist lresdir] [viewstr destgroupmark val treefather] [iw ih]] in let getEdCtrlListElems ctrllist -> lscripts in ( dsEdWindow stpwinstr; dsEdCtrlButton ctrlnext; let getGroupName currentProject destgroupmark -> curgrpname in let crEdWindow _channel winImportScene 10 10 (iw - 20) (ih - 45) WN_CHILDINSIDE nil nil "" -> stpwinstr in let crEdCtrlText stpwinstr 10 12 (iw - 40) 60 (loc "OS3D_0192") ET_BORDER nil -> labeltype in let crEdCtrlRadio stpwinstr 20 80 (iw - 50) 20 (loc "OS3D_0204") EDWIN_RESIZE_MW -> ctrlscenegrp in let if (!strcmp curgrpname "Scene") then nil else crEdCtrlRadio stpwinstr 20 105 (iw - 50) 20 strcatn (loc "OS3D_0203")::curgrpname::(loc "OS3D_0476")::nil EDWIN_RESIZE_MW -> ctrlcurgrp in let crEdCtrlRadio stpwinstr 20 (if (!strcmp curgrpname "Scene") then 105 else 130) (iw - 50) 20 (loc "OS3D_0068") EDWIN_RESIZE_MW -> ctrlnewgrp in let crEdCtrlLabel stpwinstr 35 (if (!strcmp curgrpname "Scene") then 130 else 155) 120 20 (loc "OS3D_0183") nil -> labelgroup in let crEdCtrlTextLine stpwinstr 160 (if (!strcmp curgrpname "Scene") then 130 else 155) 120 20 (getFileNameWithoutExt (hd lfile)) ET_BORDER|ET_AVSCROLL|ET_VSCROLL|ET_TABFOCUS EDWIN_RESIZE_MW|EDWIN_RESIZE_LH -> ctrlgrpname in let crEdCtrlButton winImportScene (iw - 100) (ih - 30) 90 20 (loc "OS3D_0199") EDWIN_RESIZE_MW -> ctrlend in ( setEdCtrlRadioCbState ctrlnewgrp mkfun3 @cbCtrlImportNewGroup ctrlgrpname; setEdCtrlRadioCbState ctrlcurgrp mkfun3 @cbCtrlImportCurGroup ctrlgrpname; setEdCtrlRadioCbState ctrlscenegrp mkfun3 @cbCtrlImportSceneGroup ctrlgrpname; setEdCtrlTextLineEnable ctrlgrpname 0; if (destgroupmark != nil) && (strcmp curgrpname "Scene") then setEdCtrlRadioState ctrlcurgrp 1 else setEdCtrlRadioState ctrlscenegrp 1; setEdCtrlButtonCb ctrlend mkfun2 @cbImportEnd [[lfile lresdir lscripts ctrlscenegrp ctrlcurgrp ctrlnewgrp ctrlgrpname] [viewstr destgroupmark val treefather]]; ); ); 0;; fun cbImportAddScript(ctrlstr, ctrllist)= let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [750 450] -> [iw ih] in let crEdOpenFileDialogMulti _channel winImportScene nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (loc "OS3D_0285") ["Ogre scripts" "material"::"program"::"compositior"::"skeleton"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil sLastDirectory -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogCbMulti dlgfstr mkfun2 @cbDlgImportAddScript ctrllist; ); 0;; fun cbImportStep5(ctrlstr, p)= let p -> [[stpwinstr ctrlnext lfile ctrllist] [viewstr destgroupmark val treefather] [iw ih]] in let getEdCtrlListElems ctrllist -> lresdir in ( dsEdWindow stpwinstr; let crEdWindow _channel winImportScene 10 10 (iw - 20) (ih - 45) WN_CHILDINSIDE nil nil "" -> stpwinstr in let crEdCtrlText stpwinstr 10 12 (iw - 40) 60 strcatn (strcat (loc "OS3D_0366") " ")::(hd lfile)::""::nil ET_BORDER nil -> labeltype in let crEdCtrlList stpwinstr 10 80 (iw - 40) 120 nil EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrllist in let crEdCtrlButton stpwinstr 20 210 140 20 (loc "OS3D_0035") EDWIN_RESIZE_MW -> ctrladd in let crEdCtrlButton stpwinstr (iw - 180) 210 140 20 (loc "OS3D_0332") EDWIN_RESIZE_MW -> ctrlremove in ( let sizelist lresdir -> size in let 0 -> i in while i < size do ( let nth_list lresdir i -> dir in let getFilesFromDir dir "material"::"program"::"compositor"::"particle"::"pu"::nil -> lfiles in let sizelist lfiles -> size2 in let 0 -> i2 in while i2 < size2 do ( let nth_list lfiles i2 -> script in let getEdCtrlListElem ctrllist script -> exist in if (exist != nil) then nil else addEdCtrlList ctrllist (strlowercase script) nil nil; set i2 = i2 + 1; ); set i = i + 1; ); setEdCtrlListCbKeyUp ctrllist @cbImportListKeyUp; setEdCtrlListCbKeyDown ctrllist @cbImportListKeyDown; setEdCtrlButtonCb ctrladd mkfun2 @cbImportAddScript ctrllist; setEdCtrlButtonCb ctrlremove mkfun2 @cbImportRemoveInList ctrllist; setEdCtrlButtonCb ctrlnext mkfun2 @cbImportStep6 [[stpwinstr ctrlnext lfile ctrllist lresdir] [viewstr destgroupmark val treefather] [iw ih]]; ); ); 0;; fun getImportSceneResourceDir(lfile, ctrllist)= while (lfile != nil) do ( let hd lfile -> file in let XMLload file -> xmlscenestr in let XMLgetMarkByValue xmlscenestr "scene" -> srcgroupmark in let XMLgetMarkByValueFromMarkSons srcgroupmark "resourceLocations" -> resourcesxml in let XMLgetMarksByValueFromMarkSons resourcesxml "resourceLocation" -> lresourcexml in ( let getPathFile file "" -> [dir _] in ( addEdCtrlList ctrllist dir nil nil; let _listofsubdir dir -> lsdir in let sizelist lsdir -> size in let 0 -> i in while i < size do ( let nth_list lsdir i -> sdir in let getEdCtrlListElem ctrllist sdir -> exist in if (exist != nil) || ((_listoffiles sdir) == nil) then nil else addEdCtrlList ctrllist sdir nil nil; set i = i + 1; ); let sizelist lresourcexml -> size in let 0 -> i in while i < size do ( let nth_list lresourcexml i -> resourcexml in let XMLgetParam resourcexml "type" -> type in let XMLgetParam resourcexml "name" -> path in let XMLgetBoolParam resourcexml "recursive" -> recursive in if (strcmpi type "FileSystem") || (path == nil) || (!strcmp "" (strtrim path)) || (!strcmp ".." (substr path 0 2)) || ((_listoffiles path) == nil) then nil else ( let if recursive then path::(getDirListFromPath path) else path::nil -> fpath in let sizelist fpath -> size2 in let 0 -> i2 in while i2 < size2 do ( let nth_list fpath i2 -> elt in let getEdCtrlListElem ctrllist elt -> exist in if (elt == nil) || (!strcmp "" (strtrim elt)) || (exist != nil) then nil else addEdCtrlList ctrllist (strlowercase path) nil nil; set i2 = i2 + 1; ); ); set i = i + 1; ); ); XMLclose xmlscenestr; ); set lfile = tl lfile; ); 0;; fun cbImportStep4(p)= let p -> [[ctrlnext lfile] [viewstr destgroupmark val treefather] [iw ih]] in let crEdWindow _channel winImportScene 10 10 (iw - 20) (ih - 45) WN_CHILDINSIDE nil nil "" -> stpwinstr in let crEdCtrlText stpwinstr 10 12 (iw - 40) 60 strcatn (strcat (loc "OS3D_0367") " ")::(hd lfile)::" "::(loc "OS3D_0001")::nil ET_BORDER nil -> labeltype in let crEdCtrlList stpwinstr 10 80 (iw - 40) 120 nil EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrllist in let crEdCtrlButton stpwinstr 20 210 140 20 (loc "OS3D_0022") EDWIN_RESIZE_MW -> ctrladd in let crEdCtrlButton stpwinstr (iw - 180) 210 140 20 (loc "OS3D_0330") EDWIN_RESIZE_MW -> ctrlremove in ( getImportSceneResourceDir lfile ctrllist; setEdCtrlButtonCb ctrladd mkfun2 @cbImportAddResourceDir ctrllist; setEdCtrlButtonCb ctrlremove mkfun2 @cbImportRemoveInList ctrllist; setEdCtrlButtonCb ctrlnext mkfun2 @cbImportStep5 [[stpwinstr ctrlnext lfile ctrllist] [viewstr destgroupmark val treefather] [iw ih]]; setEdCtrlListCbKeyUp ctrllist @cbImportListKeyUp; setEdCtrlListCbKeyDown ctrllist @cbImportListKeyDown; ); 0;; fun cbImportXos(p)= let p -> [file [viewstr destgroupmark val treefather]] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let if treefather == nil then (getEdCtrlTreeRootItem ctrlSceneTree) else treefather -> treefather in let if destgroupmark == nil then (XMLgetMarkByValue xmlEditSceneFile "scene") else destgroupmark -> destgroupmark in ( dsEdWindow winImportScene; set winImportScene = nil; importOs3DScene viewstr file destgroupmark father treefather; ); 0;; fun cbDlgBeforeImportPak(dlg, p, state)= if (!state) then nil else ( let p -> [file [stpwinstr viewstr destgroupmark val treefather]] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let if treefather == nil then (getEdCtrlTreeRootItem ctrlSceneTree) else treefather -> treefather in let if destgroupmark == nil then (XMLgetMarkByValue xmlEditSceneFile "scene") else destgroupmark -> destgroupmark in ( dsEdWindow stpwinstr; dsEdWindow winImportScene; set winImportScene = nil; let mkUnpakOS3DProject file nil 1 -> nfile in importOs3DScene viewstr nfile destgroupmark father treefather; ); ); 0;; fun cbImportPkos(p)= _DLGrflmessage _DLGMessageBox _channel winImportScene.EDW_win (loc "OS3D_0452") (loc "OS3D_0670") 2 @cbDlgBeforeImportPak p; 0;; fun cbImportStepConverter(ctrlstr, p)= let p -> [[stpwinstr ctrlnext lpfile ctrlfolder ctrlsplit ctrlsmooth ctrloptim ctrloptimgraph ctrloptimtex ctrllod ctrlrotatex ctrlscale] [viewstr destgroupmark val treefather] [iw ih]] in let getEdCtrlTextLineValue ctrlfolder -> relpath in let getEdCtrlCheckState ctrlsplit -> split in let getEdCtrlCheckState ctrlsmooth -> smooth in let getEdCtrlCheckState ctrloptim -> optim in let getEdCtrlCheckState ctrloptimgraph -> optimgraph in let getSelectedEdCtrlSelectPos ctrloptimtex -> optimtex in let getEdCtrlCheckState ctrllod -> lod in let getEdCtrlCheckState ctrlrotatex -> rotatex in let getEdCtrlFloatValue ctrlscale -> scale in let 0 -> impflags in ( setConfigParam "OS3Duser" "importer_split" itoa split; setConfigParam "OS3Duser" "importer_smooth" itoa smooth; setConfigParam "OS3Duser" "importer_optim" itoa optim; setConfigParam "OS3Duser" "importer_optimgraph" itoa optimgraph; setConfigParam "OS3Duser" "importer_optimtex" itoa optimtex; setConfigParam "OS3Duser" "importer_lod" itoa lod; setConfigParam "OS3Duser" "importer_rotatex" itoa rotatex; setConfigParam "OS3Duser" "importer_scale" ftoa scale; if (!split) then nil else set impflags = impflags | SO3CONVERTER_SPLIT_LARGE_MESHES; if (!smooth) then nil else set impflags = impflags | SO3CONVERTER_GEN_SMOOTH_NORMALS; if (!optim) then nil else set impflags = impflags | SO3CONVERTER_OPTIMIZE_MESHES; if (!lod) then nil else set impflags = impflags | SO3CONVERTER_GEN_LOD; if (!optimgraph) then nil else set impflags = impflags | SO3CONVERTER_OPTIMIZE_SCENEGRAPH; if (!optimtex) then nil else ( set impflags = impflags | SO3CONVERTER_OPTIMIZE_TEXTURES; if (optimtex == 1) then set impflags = impflags | SO3CONVERTER_OPTIMIZE_TEXTURES_VERYLOW else if (optimtex == 2) then set impflags = impflags | SO3CONVERTER_OPTIMIZE_TEXTURES_LOW else if (optimtex == 3) then set impflags = impflags | SO3CONVERTER_OPTIMIZE_TEXTURES_MEDIUM else if (optimtex == 4) then set impflags = impflags | SO3CONVERTER_OPTIMIZE_TEXTURES_HIGH else if (optimtex == 5) then set impflags = impflags | SO3CONVERTER_OPTIMIZE_TEXTURES_VERYHIGH else nil; ); if (!rotatex) then nil else set impflags = impflags | SO3CONVERTER_ROTATE_X; dsEdWindow stpwinstr; let crEdWindow _channel winImportScene 10 10 (iw - 20) (ih - 45) WN_CHILDINSIDE nil nil "" -> stpwinstr in let crEdCtrlText stpwinstr 10 12 (iw - 40) 60 (loc "OS3D_0101") ET_BORDER nil -> labeltype in ( if (relpath == nil) || (!strcmp strtrim relpath "") then nil else set sOS3DAssets = relpath; setEdCtrlButtonEnable ctrlnext 0; let 0 -> convdone in let nil -> lexpfiles in ( while (lpfile != nil) do ( let hd lpfile -> pfile in let SO3SceneConvertFileEx pfile relpath impflags scale -> expfile in if (expfile == nil) then ( //error dsEdWindow winImportScene; set winImportScene = nil; set lpfile = nil; _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0424") 0; set convdone = 0; ) else ( set lexpfiles = (_PtoScol expfile)::lexpfiles; set lpfile = tl lpfile; set convdone = 1; ); ); if (!convdone) then nil else ( dsEdWindow stpwinstr; setEdCtrlButtonEnable ctrlnext 1; cbImportStep4 [[ctrlnext lexpfiles] [viewstr destgroupmark val treefather] [iw ih]]; ); ); ); ); 0;; fun cbDlgImportConverterDir(dlg, ctrlfolder, path)= if (path == nil) || (!strcmp "" (strtrim path)) then nil else ( setEdCtrlTextLineValue ctrlfolder (strlowercase path); set sLastDirectory = path; ); 0;; fun cbImportSetConverterDir(ctrlstr, ctrlfolder)= _DLGrflopenDir (_DLGOpenDir _channel winImportScene.EDW_win nil (loc "OS3D_0231")) @cbDlgImportConverterDir ctrlfolder; 0;; fun cbImportStepConverterFolder(p)= let p -> [[ctrlnext lpfile] [viewstr destgroupmark val treefather] [iw ih]] in let 10 -> ypos in let crEdWindow _channel winImportScene 10 ypos (iw - 20) (ih - 45) WN_CHILDINSIDE nil nil "" -> stpwinstr in let crEdCtrlText stpwinstr 10 ypos + 2 (iw - 40) 60 (loc "OS3D_0365") ET_BORDER nil -> labeltype in let crEdCtrlTextLine stpwinstr 10 (set ypos = 80) (iw - 80) 20 sOS3DAssets nil EDWIN_RESIZE_MW -> ctrlfolder in let crEdCtrlButton stpwinstr (iw - 60) ypos 20 20 "..." EDWIN_RESIZE_MW -> ctrldir in let atoi (getConfigParamDef "OS3Duser" "importer_split" "1") -> split in let atoi (getConfigParamDef "OS3Duser" "importer_smooth" "0") -> smooth in let atoi (getConfigParamDef "OS3Duser" "importer_optim" "1") -> optim in let atoi (getConfigParamDef "OS3Duser" "importer_optimgraph" "0") -> optimgraph in let atoi (getConfigParamDef "OS3Duser" "importer_optimtex" "0") -> optimtex in let atoi (getConfigParamDef "OS3Duser" "importer_lod" "0") -> lod in let atoi (getConfigParamDef "OS3Duser" "importer_rotatex" "0") -> rotatex in let atof (getConfigParamDef "OS3Duser" "importer_scale" "1.0") -> scale in let crEdCtrlCheck stpwinstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0589") EDWIN_RESIZE_MW -> ctrlsplit in let crEdCtrlCheck stpwinstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0590") EDWIN_RESIZE_MW -> ctrlsmooth in let crEdCtrlCheck stpwinstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0591") EDWIN_RESIZE_MW -> ctrloptim in let crEdCtrlCheck stpwinstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0592") EDWIN_RESIZE_MW -> ctrloptimgraph in let crEdCtrlLabel stpwinstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0814") nil -> labeltexture in let crEdCtrlSelect stpwinstr 170 ypos (iw - 200) 120 EDWIN_RESIZE_MW -> ctrloptimtex in let crEdCtrlCheck stpwinstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0593") EDWIN_RESIZE_MW -> ctrllod in let crEdCtrlCheck stpwinstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0678") EDWIN_RESIZE_MW -> ctrlrotatex in let crEdCtrlLabel stpwinstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0679") nil -> labelscale in let crEdCtrlFloat stpwinstr 170 ypos 90 20 scale 0.0 100000.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlscale in ( fillEdCtrlSelect ctrloptimtex (loc "OS3D_0815")::(loc "OS3D_0816")::(loc "OS3D_0817")::(loc "OS3D_0818")::(loc "OS3D_0819")::(loc "OS3D_0820")::nil; setEdCtrlCheckState ctrlsplit split; setEdCtrlCheckState ctrlsmooth smooth; setEdCtrlCheckState ctrloptim optim; setEdCtrlCheckState ctrloptimgraph optimgraph; selectEdCtrlSelectByPos ctrloptimtex optimtex; setEdCtrlCheckState ctrllod lod; setEdCtrlCheckState ctrlrotatex rotatex; setEdCtrlButtonCb ctrldir mkfun2 @cbImportSetConverterDir ctrlfolder; setEdCtrlButtonCb ctrlnext mkfun2 @cbImportStepConverter [[stpwinstr ctrlnext lpfile ctrlfolder ctrlsplit ctrlsmooth ctrloptim ctrloptimgraph ctrloptimtex ctrllod ctrlrotatex ctrlscale] [viewstr destgroupmark val treefather] [iw ih]]; ); 0;; fun checkImportFileFormats(pfile)= let getFileExt _GetFileNameFromP pfile -> ext in let _PtoScol pfile -> inpartition in ((inpartition != nil) && ((!strcmpi ext "SCENE") || (!strcmpi ext "XOS") || (!strcmpi ext "MESH"))) || (!strcmpi ext "PKOS") || (!strcmpi ext "PAK") || (!strcmpi ext "3DS") || (!strcmpi ext "BLEND") || (!strcmpi ext "DAE") || (!strcmpi ext "Collada") || (!strcmpi ext "FBX") || (!strcmpi ext "X3D") || (!strcmpi ext "IFC") || (!strcmpi ext "STEP") || (!strcmpi ext "STP") || (!strcmpi ext "IGS") || (!strcmpi ext "ASE") || (!strcmpi ext "DXF") || (!strcmpi ext "HMP") || (!strcmpi ext "MD2") || (!strcmpi ext "MD3") || (!strcmpi ext "MD5") || (!strcmpi ext "MD5MESH") || (!strcmpi ext "MDC") || (!strcmpi ext "MDL") || (!strcmpi ext "NFF") || (!strcmpi ext "PLY") || (!strcmpi ext "STL") || (!strcmpi ext "X") || (!strcmpi ext "OBJ") || (!strcmpi ext "SMD") || (!strcmpi ext "LWO") || (!strcmpi ext "LXO") || (!strcmpi ext "LWS") || (!strcmpi ext "TER") || (!strcmpi ext "AC3D") || (!strcmpi ext "MS3D") || (!strcmpi ext "COB") || (!strcmpi ext "Q3BSP") || (!strcmpi ext "XGL") || (!strcmpi ext "CSM") || (!strcmpi ext "BVH") || (!strcmpi ext "B3D") || (!strcmpi ext "GLB") || (!strcmpi ext "NDO") || (!strcmpi ext "GLTF") || (!strcmpi ext "XML") || (!strcmpi ext "3MF") || (!strcmpi ext "AC") || (!strcmpi ext "AC3D") || (!strcmpi ext "ACC") || (!strcmpi ext "AMJ") || (!strcmpi ext "ASK") || (!strcmpi ext "CMS") || (!strcmpi ext "ENFF") || (!strcmpi ext "IRR") || (!strcmpi ext "M3D") || (!strcmpi ext "MOT") || (!strcmpi ext "OGEX") || (!strcmpi ext "PMX") || (!strcmpi ext "PRJ") || (!strcmpi ext "Q3O") || (!strcmpi ext "Q3S") || (!strcmpi ext "RAW") || (!strcmpi ext "UC") || (!strcmpi ext "VTA") || (!strcmpi ext "X") || (!strcmpi ext "ZGL") || (!strcmpi ext "IRRMESH");; fun cbImportStep3(dlg, p, lpfile)= let p -> [[stpwinstr ctrlnext ctrlos3dlibrary ctrlos3dscene ctrlos3dtemplate] [viewstr destgroupmark val treefather] [iw ih]] in let nil -> lcfiles in let 0 -> fstop in ( while (lpfile != nil) do ( let hd lpfile -> pfile in let strlowercase (_PtoScol pfile) -> file in if (!checkImportFileFormats pfile) then ( if (file != nil) then _DLGMessageBox _channel winImportScene.EDW_win (loc "OS3D_0155") (loc "OS3D_0423") 0 else _DLGMessageBox _channel winImportScene.EDW_win (loc "OS3D_0155") (loc "OS3D_0420") 0; addLogMessage (loc "OS3D_0422"); 0; ) else let getFileExt _GetFileNameFromP pfile -> ext in ( if !strcmpi "scene" ext then ( dsEdWindow stpwinstr; set lpfile = nil; set fstop = 1; cbImportStep4 [[ctrlnext file::nil] [viewstr destgroupmark val treefather] [iw ih]]; ) else if !strcmpi "mesh" ext then ( let nil -> lfile in ( while (lpfile != nil) do ( let hd lpfile -> pfile in let getFileExt _GetFileNameFromP pfile -> ext in let _PtoScol pfile -> file in if (strcmpi "mesh" ext) then nil else ( set lfile = file::lfile; ); set lpfile = tl lpfile; ); dsEdWindow stpwinstr; set winImportMesh = winImportScene; set winImportScene = nil; set lpfile = nil; set fstop = 1; cbImportMeshStep4 [[ctrlnext lfile] [viewstr destgroupmark val iTypeScene treefather] [iw ih]]; ); ) else if !strcmpi "xos" ext then ( dsEdWindow stpwinstr; set lpfile = nil; set fstop = 1; cbImportXos [file [viewstr destgroupmark val treefather]]; ) else if ((!strcmpi "pkos" ext) || (!strcmpi "pak" ext)) then ( set lpfile = nil; set fstop = 1; cbImportPkos [pfile [stpwinstr viewstr destgroupmark val treefather]]; ) else ( set lcfiles = pfile::lcfiles; 0; ); set sLastDirectory = getFileDirectory file; 0; ); if (fstop == 1) then nil else set lpfile = tl lpfile; ); setEdCtrlButtonEnable ctrlnext 1; if (lcfiles == nil) then nil else cbImportStepConverterFolder [[ctrlnext lcfiles] [viewstr destgroupmark val treefather] [iw ih]]; ); 0;; fun cbImportOs3dStep3(pfile, p)= cbImportStep3 nil p if (pfile == nil) then nil else pfile::nil; 0;; fun cbImportOs3dMultiStep3(lp, p)= cbImportStep3 nil p lp; 0;; fun cbImportStep2(ctrlstr, p)= let p -> [[stpwinstr ctrlnext ctrlos3dlibrary ctrlos3dscene ctrlos3dtemplate] [viewstr destgroupmark val treefather] [iw ih]] in let getEdCtrlRadioState ctrlos3dlibrary -> os3dlibrary in let getEdCtrlRadioState ctrlos3dscene -> os3dscene in let getEdCtrlRadioState ctrlos3dtemplate -> os3dtemplate in let if os3dtemplate then "OpenSpace3D template\0*.xos;\0\0" else if os3dscene then "OpenSpace3D scene\0*.xos;*.pkos;*.pak;\0\0" else "Supported 3D formats\0*.scene;*.mesh;*.3DS;*.PRJ;*.BLEND;*.X3D;*.DAE;*.glb;*.gltf;*.Collada;*.FBX;*.IFC;*.STEP;*.STP;*.IGS;*.ASE;*.DXF;*.HMP;*.MD2;*.MD3;*.MD5mesh;*.MDC;*.MDL;*.NFF;*.PLY;*.STL;*.X;*.OBJ;*.SMD;*.LWO;*.LXO;*.LWS;*.TER;*.AC3D;*.MS3D;*.COB;*.Q3BSP;*.XGL;*.CSM;*.BVH;*.B3D;*.NDO;\0Ogre 3D (SCENE, MESH)\0*.scene;*.mesh;\03D Studio (3DS, PRJ)\0*.3DS;*.PRJ;\0Autodesk FBX (FBX)\0*.FBX;\0Autocad3D (DXF)\0*.DXF;\0Blender (BLEND)\0*.BLEND;\0Collada (DAE)\0*.DAE;*.Collada;\0Wavefront (OBJ)\0*.OBJ;\0glTF (gltf, glb)\0*.GLTF;*.GLB;\0Extensible 3D (X3D)\0*.X3D;\0STereoLithography (STL)\0*.STL;\0All\0*.*\0\0" -> format in ( setEdCtrlButtonEnable ctrlnext 0; if (os3dscene || os3dtemplate || os3dlibrary) then ( let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [750 450] -> [iw ih] in let if (os3dlibrary) then crEdOpenFileDialog _channel winImportScene nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (strcat (strcat (loc "OS3D_0195") " ") val) ["OpenSpace3D library" "xos"::"pkos"::"pak"::"scene"::"mesh"::nil]::["OpenSpace3D scene" "xos"::"pkos"::"pak"::nil]::["Ogre3D scene" "scene"::"mesh"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR "assets/models" sLastDirectory else if (os3dtemplate) then crEdOpenFileDialog _channel winImportScene nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (strcat (strcat (loc "OS3D_0195") " ") val) ["OpenSpace3D template" "xos"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_INFOS|EDFILE_DIALOG_SHOW_TOOLBAR "assets/templates" sLastDirectory else crEdOpenFileDialog _channel winImportScene nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (strcat (strcat (loc "OS3D_0195") " ") val) ["OpenSpace3D scene" "xos"::"pkos"::"pak"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_INFOS|EDFILE_DIALOG_SHOW_TOOLBAR nil sLastDirectory -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogInfoCb dlgfstr @cbGetOS3dProjectInfos; setEdOpenFileDialogCb dlgfstr mkfun2 @cbImportOs3dStep3 p; if (!os3dtemplate) then nil else setEdOpenFileDialogFilterCb dlgfstr @cbGetOS3dProjectTypeDynTemplate; //setEdOpenFileDialogCbMulti dlgfstr mkfun2 @cbImportOs3dMultiStep3 p; 0; ); ) else ( _DLGrflopenMulti _DLGOpenFileMulti _channel winImportScene.EDW_win sLastDirectory nil format @cbImportStep3 p; 0; ); ); 0;; /** cbDestroyImportWin [EdWindow] I * callback on destroy import window * * private * * return 0 **/ fun cbDestroyImportWin(winstr)= set winImportScene = nil; 0;; fun importSceneWizard(viewstr, destgroupmark, val, treefather, file)= if winImportScene == nil then nil else ( dsEdWindow winImportScene; set winImportScene = nil; ); let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [400 350] -> [iw ih] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0195") " ") val) sWinDlgIcon -> winstr in let crEdWindow _channel winstr 10 10 (iw - 20) (ih - 45) WN_CHILDINSIDE nil nil "" -> stpwinstr in let crEdCtrlText stpwinstr 10 12 (iw - 40) 60 (loc "OS3D_0368") ET_BORDER nil -> labeltype in let crEdCtrlRadio stpwinstr 20 80 (iw - 50) 20 (loc "OS3D_0408") EDWIN_RESIZE_MW -> ctrlstdformats in let crEdCtrlRadio stpwinstr 20 105 (iw - 50) 20 (loc "OS3D_0842") EDWIN_RESIZE_MW -> ctrlos3dlibrary in let crEdCtrlRadio stpwinstr 20 130 (iw - 50) 20 (loc "OS3D_0288") EDWIN_RESIZE_MW -> ctrlos3dscene in let crEdCtrlRadio stpwinstr 20 155 (iw - 50) 20 (loc "OS3D_0838") EDWIN_RESIZE_MW -> ctrlos3dtemplate in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0268") EDWIN_RESIZE_MW -> ctrlnext in ( set winImportScene = winstr; setEdCtrlRadioState ctrlstdformats 1; if file == nil then ( setEdCtrlButtonCb ctrlnext mkfun2 @cbImportStep2 [[stpwinstr ctrlnext ctrlos3dlibrary ctrlos3dscene ctrlos3dtemplate] [viewstr destgroupmark val treefather] [iw ih]]; 0; ) else ( dsEdWindow stpwinstr; cbImportStep4 [[ctrlnext file::nil] [viewstr destgroupmark val treefather] [iw ih]]; 0; ); setEdwindowCbDestroy winstr @cbDestroyImportWin; ); 0;; fun import3dFileWizard(viewstr, destgroupmark, val, treefather, lpfile)= if winImportScene == nil then nil else ( dsEdWindow winImportScene; set winImportScene = nil; ); let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [400 350] -> [iw ih] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0190") " ") val) sWinDlgIcon -> winstr in let crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0268") EDWIN_RESIZE_MW -> ctrlnext in ( set winImportScene = winstr; cbImportStepConverterFolder [[ctrlnext lpfile] [viewstr destgroupmark val treefather] [iw ih]]; setEdwindowCbDestroy winstr @cbDestroyImportWin; ); 0;; fun cbImportDynamicTpl(pfile, viewstr)= if (pfile == nil) then nil else cbImportXos [_PtoScol pfile [viewstr nil nil nil]]; 0;; fun importDynamicTpl()= let V3DgetSessionView c3dXsession -> viewstr in let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [750 450] -> [iw ih] in let crEdOpenFileDialog _channel winImportScene nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (loc "OS3D_0195") ["OpenSpace3D template" "xos"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_INFOS|EDFILE_DIALOG_SHOW_TOOLBAR "assets/templates" sLastDirectory -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogInfoCb dlgfstr @cbGetOS3dProjectInfos; setEdOpenFileDialogCb dlgfstr mkfun2 @cbImportDynamicTpl viewstr; setEdOpenFileDialogFilterCb dlgfstr @cbGetOS3dProjectTypeDynTemplate; //setEdOpenFileDialogCbMulti dlgfstr mkfun2 @cbImportOs3dMultiStep3 p; 0; ); 0;; /** cbDestroyMaterialsSetupWin [EdWindow] I * callback on destroy materials window * * private * * return 0 **/ fun cbDestroyMeshMaterialWin(winstr)= set winMeshMaterialSetup = nil; 0;; fun cbSubEntitySetup(ctrl, pos, elem, param)= let param -> [lentitystr ctrlmatname] in let nth_list lentitystr pos -> subentitystr in let XMLgetParam subentitystr "materialName" -> submatname in selectEdCtrlSelect ctrlmatname submatname; 0;; fun cbSubEntityMaterialSetup(ctrl, pos, elem, param)= let param -> [groupstr sessionstr mesh lentitystr ctrlid] in let getSelectedEdCtrlSelectPos ctrlid -> subidx in let nth_list lentitystr subidx -> subentitystr in let SO3SceneGetMaterial (V3DgetSession sessionstr) groupstr.GRP_sName elem -> submat in ( XMLsetParam subentitystr "materialName" elem; SO3EntitySetMaterial mesh submat subidx; ); 0;; fun cbDlgResetMaterial(dlg, param, rep)= let param -> [groupstr sessionstr mesh lentitystr ctrlid ctrlmatname] in if (rep == 0) then ( let getSelectedEdCtrlSelectPos ctrlid -> subidx in let nth_list lentitystr subidx -> subentitystr in let XMLgetParam subentitystr "defaultMaterial" -> defmatname in let SO3SceneGetMaterial (V3DgetSession sessionstr) groupstr.GRP_sName defmatname -> submat in ( XMLsetParam subentitystr "materialName" defmatname; selectEdCtrlSelect ctrlmatname defmatname; SO3EntitySetMaterial mesh submat subidx; ); 0; ) else if (rep == 1) then ( let sizelist lentitystr -> size in let 0 -> i in while (i < size) do ( let nth_list lentitystr i -> subentitystr in let XMLgetParam subentitystr "defaultMaterial" -> defmatname in let SO3SceneGetMaterial (V3DgetSession sessionstr) groupstr.GRP_sName defmatname -> submat in ( XMLsetParam subentitystr "materialName" defmatname; selectEdCtrlSelect ctrlmatname defmatname; SO3EntitySetMaterial mesh submat i; ); set i = i + 1; ); 0; ) else nil; 0;; fun cbBtnResetSubEntityMaterial(ctrl, param)= _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0672") 3 @cbDlgResetMaterial param; 0;; fun cbDlgResourceRemove(msg, lp, ret)= if !ret then nil else ( while (lp != nil) do ( let hd lp -> [name lval type] in let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype _ markstr _ groupmark initstate staticgeometry] in let if ttype == iTypeGroup || ttype == iTypeScene then markstr else groupmark -> groupmark in let XMLgetMarkByValueFromMarkSons groupmark "resources" -> resourcesmark in let XMLgetMarksByValueFromMarkSons resourcesmark "resource" -> lresourcemarks in ( if (isPathInGroup groupmark "path" name) || (isPathInGroup groupmark "skeletonlink" name) then nil else let XMLgetMarkByValueFromMarkSons groupmark "resources" -> resourcesmark in let XMLgetMarkByValueAndParamValueFromMarkSons resourcesmark "resource" "path" (strlowercase name) -> resmark in ( XMLdelMark xmlEditSceneFile resmark; delEdCtrlList ctrlResourcesList (strlowercase name); let switch lGroups groupmark -> groupstr in set groupstr.GRP_lLoadedResourcesFiles = remove_string_from_list groupstr.GRP_lLoadedResourcesFiles (strlowercase name); ); ); set lp = tl lp; ); ); 0;; fun cbRemoveResource(ctrlstr, sessionstr)= let getMultiSelectedEdCtrlList ctrlResourcesList -> elems in if elems == nil then nil else _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0064") 1 @cbDlgResourceRemove elems; // reload resources groups /* let SO3GroupList (V3DgetSession sessionstr) -> l in let sizelist l -> size in let 0 -> i in while i < size do ( let nth_list l i -> resgroup in if (!strcmp resgroup sV3DResourcesGroup) then nil else SO3GroupReload (V3DgetSession sessionstr) resgroup; set i = i + 1; ); */ 0;; fun cbTreeMenuMeshMaterialSetup(mnuitem, p)= if winMeshMaterialSetup == nil then nil else ( let winMeshMaterialSetup -> [_ winstr] in dsEdWindow winstr; set winMeshMaterialSetup = nil; ); let p -> [viewstr val type markstr groupmark] in let [450 75] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> mesh in let XMLgetMarkByValueFromMarkSons markstr "subentities" -> subentitiesstr in let XMLgetMarksByValueFromMarkSons subentitiesstr "subentity" -> lentitystr in let switch lGroups groupmark -> groupstr in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0244") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 12 130 20 (loc "OS3D_0239") nil -> labelid in let crEdCtrlSelect winstr 150 10 (iw - 210) 120 EDWIN_RESIZE_MW -> ctrlid in let crEdCtrlButton winstr (iw - 50) 10 40 20 (loc "OS3D_0485") EDWIN_RESIZE_MW -> ctrlreset in let crEdCtrlLabel winstr 10 42 130 20 (loc "OS3D_0491") nil -> labelmat in let crEdCtrlSelect winstr 150 40 (iw - 160) 120 EDWIN_RESIZE_MW -> ctrlmatname in ( set winMeshMaterialSetup = [mesh dwinstr]; let nil -> lid in ( let (sizelist lentitystr) - 1 -> i in while i >= 0 do ( set lid = (itoa i)::lid; set i = i - 1; ); fillEdCtrlSelect ctrlid lid; ); selectEdCtrlSelectByPos ctrlid 0; let SO3SceneParseMaterialsFromGroup (V3DgetSession sessionstr) groupstr.GRP_sName -> l in let sizelist l -> size in let nil -> lmats in let 0 -> i in ( while i < size do ( let nth_list l i -> mat in let SO3MaterialGetName mat -> name in set lmats = name::lmats; set i = i + 1; ); fillEdCtrlSelect ctrlmatname quicksort lmats @suppDoublon; let XMLgetParam hd lentitystr "materialName" -> submatname in selectEdCtrlSelect ctrlmatname submatname; ); setEdCtrlSelectCb ctrlid mkfun4 @cbSubEntitySetup [lentitystr ctrlmatname]; setEdCtrlSelectCb ctrlmatname mkfun4 @cbSubEntityMaterialSetup [groupstr sessionstr mesh lentitystr ctrlid]; setEdCtrlButtonCb ctrlreset mkfun2 @cbBtnResetSubEntityMaterial [groupstr sessionstr mesh lentitystr ctrlid ctrlmatname]; setEdwindowCbDestroy dwinstr @cbDestroyMeshMaterialWin; 0; ); 0;; fun cbSaveOnLaunch(viewstr)= let getProjectName -> projname in ( let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \""::sCurrentScenePath::"\" \""::projname::"\" \""::(getProjectSettingDef "defaultWidth" "1280")::"\" \""::(getProjectSettingDef "defaultHeight" "720")::"\" "::(itoa 0)::nil -> script in _newmachine (strreplace (strcat projname " Player") " " "_") script nil nil; 0; ); 0;; fun cbSaveBeforeLaunch(dlg, viewstr, state)= if (state == 2) then nil else // Cancel if (state == 1) then // OK ( saveSceneFile mkfun1 @cbSaveOnLaunch viewstr; 0; ) else nil; 0;; fun launchPlayer(viewstr)= if (sCurrentScenePath == nil) then ( _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0353") 2 @cbSaveBeforeLaunch viewstr; 0; ) else let getProjectName -> projname in ( saveSceneFile nil; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \""::sCurrentScenePath::"\" \""::projname::"\" \""::(getProjectSettingDef "defaultWidth" "1280")::"\" \""::(getProjectSettingDef "defaultHeight" "720")::"\" "::(itoa 0)::nil -> script in _newmachine (strreplace (strcat projname " Player") " " "_") script nil nil; 0; ); 0;; fun cbSceneFileSaved()= setEdWindowName mainInterf.MINT_winMain strcatn (strcat (loc "OS3D_0286") " ")::getVersionName::" > "::sCurrentScenePath::nil; _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0207") strcatn (strcat (loc "OS3D_0427") " ")::sCurrentScenePath::nil 0; 0;; fun cbDlgSaveOsScene(dlg, cbfun, wfile)= let _PtoScol (_WtoP wfile) -> file in if wfile == nil then nil else if file == nil then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0472") 0; 0; ) else let getFileExt file -> ext in let if !strcmpi "xos" ext then file else strcat file ".xos" -> file in ( set sCurrentScenePath = file; saveSceneFile @cbSceneFileSaved; set sLastDirectory = getFileDirectory file; exec cbfun with []; 0; ); let mainInterf.MINT_tbMain -> [cmpnew cmpopen cmpimport cmprsave cmprsaveas cmpsetting cmpthemeeditor cmpexport cmpplayer _ _ _ ] in ( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpnew OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpopen OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpimport OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsave OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsaveas OBJ_ENABLE|OBJ_VISIBLE 1; //if (sCurrentScenePath == nil) then nil else //( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpplayer OBJ_ENABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpexport OBJ_ENABLE|OBJ_VISIBLE 1; //); ); 0;; fun cbDlgSaveOsSceneCustom(wfile, cbfun)= cbDlgSaveOsScene nil cbfun wfile; 0;; fun saveSceneFile(cbfun)= if sCurrentScenePath == nil then ( let mainInterf.MINT_tbMain -> [cmpnew cmpopen cmpimport cmprsave cmprsaveas cmpsetting cmpthemeeditor cmpexport cmpplayer _ _ _ ] in ( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpnew OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpopen OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpimport OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsave OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsaveas OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpplayer OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpexport OBJ_DISABLE|OBJ_VISIBLE 1; ); let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [650 450] -> [iw ih] in let crEdSaveAsFileDialog _channel mainInterf.MINT_winMain nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (loc "saveAs") ["OpenSpace3D scene" "xos"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil sLastDirectory getProjectName -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdSaveFileDialogCb dlgfstr mkfun2 @cbDlgSaveOsSceneCustom cbfun; 0; ); //_DLGrflsave _DLGSaveFile _channel mainInterf.MINT_winMain.EDW_win sLastDirectory getProjectName "OpenSpace3D scene\0*.xos\0All\0*.*\0\0" @cbDlgSaveOsScene cbfun; 0; ) else let V3DgetDefaultSession v3dMain -> sessionstr in let hd sessionstr.V3D_lCamera -> [_ camera] in ( setProjectSetting "projectName" getProjectName; set currentProject.PRJ_sName = getProjectName; if ((getProjectSetting "language") != nil) then nil else setProjectSetting "language" currentLanguage; let XMLgetMarkByValue xmlEditSceneFile "scene" -> scenemark in let XMLgetMarkByValueFromMarkSons scenemark "environment" -> envmark in //default camera let XMLgetMarkByValueFromMarkSons envmark "defaultCamera" -> defcamerastr in let tCameraPosition -> [vpos vang dist] in let if bAppPlay then dist else let SO3ObjectGetPosition (V3DgetDefaultCamera sessionstr) -> [_ _ d] in d -> dist in let if bAppPlay then vpos else V3DgetShellNavPos sessionstr -> [xpos ypos zpos] in let if bAppPlay then vang else V3DgetShellNavAng sessionstr -> [xang yang zang wang] in ( XMLsetParam defcamerastr "orthographic" XMLgetBoolString (V3DgetOrthographicMode camera); XMLsetParam defcamerastr "windowScale" XMLgetShortFloatToString (V3DgetOrthographicScale camera); XMLsetParam defcamerastr "fov" XMLgetShortFloatToString (SO3MathsRadianToDegree (SO3CameraGetFOVy camera)); XMLsetParam defcamerastr "focalLength" XMLgetShortFloatToString (SO3CameraGetFocalLength camera); XMLsetParam defcamerastr "dist" XMLgetShortFloatToString dist; let XMLgetMarkByValueFromMarkSons defcamerastr "clipping" -> clippingmark in ( XMLsetParam clippingmark "near" XMLgetShortFloatToString (SO3CameraGetNearClipDistance camera); XMLsetParam clippingmark "far" XMLgetShortFloatToString (SO3CameraGetFarClipDistance camera); ); let XMLgetMarkByValueFromMarkSons defcamerastr "position" -> posmark in ( XMLsetParam posmark "x" XMLgetShortFloatToString xpos; XMLsetParam posmark "y" XMLgetShortFloatToString ypos; XMLsetParam posmark "z" XMLgetShortFloatToString zpos; ); let XMLgetMarkByValueFromMarkSons defcamerastr "rotation" -> angmark in let SO3MathsQuatToEulerXYZ [xang yang zang wang] -> [xang yang zang] in let [(SO3MathsRadianToDegree xang) (SO3MathsRadianToDegree yang) (SO3MathsRadianToDegree zang)] -> [xang yang zang] in ( XMLsetParam angmark "x" XMLgetShortFloatToString xang; XMLsetParam angmark "y" XMLgetShortFloatToString yang; XMLsetParam angmark "z" XMLgetShortFloatToString zang; ); // default light let XMLgetMarkByValueFromMarkSons envmark "defaultLight" -> deflightstr in XMLsetParam deflightstr "enable" XMLgetBoolString bLastDefaultLightState; ); XMLwriteZipped xmlEditSceneFile sCurrentScenePath; // force close to update material after save materialDestroyEditor; //write all modified materials, but not when it's playing to avoid modified texture or materials if (bAppPlay) then nil else ( while (lModifiedMaterialList != nil) do ( let hd lModifiedMaterialList -> [mat [pfile groupstr]] in ( //addLogMessage strcatn "save mat: "::(SO3MaterialGetName mat)::" to: "::(_PtoScol pfile)::nil; SO3MaterialExport mat pfile; //add material to resouces group let _PtoScol pfile -> fpath in ( addResourceFile v3dMain groupstr.GRP_xmlMark fpath nil; set sLastDirectory = getFileDirectory fpath; ); ); set lModifiedMaterialList = tl lModifiedMaterialList; ); //manage deleted materials while (lMaterialScriptsList != nil) do ( let hd lMaterialScriptsList -> mpath in ( let SO3MaterialCountInScript _checkpack mpath -> cnt in if (!cnt) then ( //delete the file _deletepack _checkpack mpath; //remove resource cbDlgResourceRemove nil [mpath nil nil]::nil 1; 0; ) else ( //rewrite material script SO3MaterialRewriteScript _checkpack mpath; 0; ); ); set lMaterialScriptsList = tl lMaterialScriptsList; ); ); //create scol file let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::getProjectName::"\" \""::(getProjectSettingDef "defaultWidth" "1280")::"\" \""::(getProjectSettingDef "defaultHeight" "720")::"\" "::(itoa 0)::nil -> script in let strcat (getFilePathWithoutExt sCurrentScenePath) ".scol" -> fname in _createpack script _getmodifypack fname; addLastProject sCurrentScenePath; if cbfun == nil then nil else exec cbfun with []; addLogMessage strcatn (strcat (loc "OS3D_0427") " ")::sCurrentScenePath::"."::nil; 0; ); 0;; fun cbDlgExportToPlayer(dlg, p, wfile)= if wfile == nil then nil else let _GetFileNameFromW wfile -> fname in let p -> [winstr script] in ( dsEdWindow winstr; set winExportSetup = nil; _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0207") strcatn (strcat (loc "OS3D_0428") " ")::fname::nil 0; addLogMessage strcatn (strcat (loc "OS3D_0426") " ")::fname::nil; _createpack script wfile; ); 0;; fun openProject(viewstr)= if (!bAppPlay) then nil else playEditor viewstr 0; let mainInterf.MINT_tbMain -> [cmpnew cmpopen cmpimport cmprsave cmprsaveas cmpsetting cmpthemeeditor cmpexport cmpplayer _ _ _ ] in ( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpnew OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpopen OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpimport OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsave OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsaveas OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpplayer OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpexport OBJ_DISABLE|OBJ_VISIBLE 1; ); let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [750 450] -> [iw ih] in let crEdOpenFileDialog _channel mainInterf.MINT_winMain nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (loc "OS3D_0285") ["OpenSpace3D scene" "xos"::"pkos"::"pak"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_INFOS|EDFILE_DIALOG_SHOW_TOOLBAR nil sLastDirectory -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogInfoCb dlgfstr @cbGetOS3dProjectInfos; setEdOpenFileDialogCb dlgfstr mkfun2 @cbDlgOpenOs3dSceneCustom viewstr; 0; ); 0;; fun cbOpenOnSave(p)= let p -> [viewstr prj] in if (prj == nil) then openProject viewstr else cbDlgOpenOs3dScene nil viewstr _checkpack prj; 0;; fun cbSaveBeforeOpen(dlg, p, state)= let p -> [viewstr prj] in if (state == 2) then nil else // Cancel if (state == 1) then // OK ( saveSceneFile mkfun1 @cbOpenOnSave p; 0; ) else // No ( if (prj == nil) then openProject viewstr else cbDlgOpenOs3dScene nil viewstr _checkpack prj; 0; ); 0;; fun cbMenuOpenLastProject(item, p)= let p -> [viewstr prj] in ( if (!bAppPlay) then nil else playEditor viewstr 0; if (isSceneModified) then ( _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0121") 3 @cbSaveBeforeOpen [viewstr prj]; 0; ) else ( cbDlgOpenOs3dScene nil viewstr _checkpack prj; ); ); 0;; /** cbTbBtnOpenScene [EdToolBar CompRollOver I I V3Dview] I * callback on open os3d scene button * * private * * return 0 **/ fun cbTbBtnOpenScene(tbstr, croll, btn, mask, viewstr)= if (btn == 2) then ( let getLastProject -> lprjs in if (lprjs == nil) then nil else ( let _CRpopupMenu _channel -> mnu in ( while (lprjs != nil) do ( let hd lprjs -> prjpath in _CBmenu (_APPitem _channel mnu ME_ENABLED prjpath) @cbMenuOpenLastProject [viewstr prjpath]; set lprjs = tl lprjs; ); let _GETscreenPos -> [x y] in _DRAWmenu mainInterf.MINT_winMain.EDW_win mnu x y PM_SCREEN|PM_LEFT_ALIGN|PM_TOP_ALIGN; ); ); 0; ) else if (isSceneModified) then ( if (!bAppPlay) then nil else playEditor viewstr 0; _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0121") 3 @cbSaveBeforeOpen [viewstr nil]; 0; ) else ( openProject viewstr; 0; ); 0;; /** cbTbBtnImportScene [EdToolBar CompRollOver I I V3Dview] I * callback on import ogre scene button * * private * * return 0 **/ fun cbTbBtnImportScene(tbstr, croll, btn, mask, viewstr)= //_DLGrflopen _DLGOpenFile _channel mainInterf.MINT_winMain.EDW_win sLastDirectory nil "Scene format\0*.scene;*.xos\0Ogre scene\0*.scene\0OpenSpace3D scene\0*.xos\0All\0*.*\0\0" @cbDlgImportScene [viewstr nil nil nil]; importSceneWizard viewstr nil nil nil nil; 0;; /** cbTbBtnThemeEditor [EdToolBar CompRollOver I I V3Dview] I * callback on theme editor button * * private * * return 0 **/ fun cbTbBtnThemeEditor(tbstr, croll, btn, mask, viewstr)= openThemeEditor; 0;; /** cbTbBtnSaveAsOsScene [EdToolBar CompRollOver I I V3Dview] I * callback on save as scene button * * private * * return 0 **/ fun cbTbBtnSaveAsOsScene(tbstr, croll, btn, mask, viewstr)= let mainInterf.MINT_tbMain -> [cmpnew cmpopen cmpimport cmprsave cmprsaveas cmpsetting cmpthemeeditor cmpexport cmpplayer _ _ _ ] in ( _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpnew OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpopen OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpimport OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsave OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmprsaveas OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpplayer OBJ_DISABLE|OBJ_VISIBLE 1; _CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode cmpexport OBJ_DISABLE|OBJ_VISIBLE 1; ); let getPathFile sCurrentScenePath "" -> [fpath fname] in let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [650 450] -> [iw ih] in let crEdSaveAsFileDialog _channel mainInterf.MINT_winMain nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (loc "saveAs") ["OpenSpace3D scene" "xos"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil fpath fname -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdSaveFileDialogCb dlgfstr mkfun2 @cbDlgSaveOsSceneCustom nil; 0; ); //_DLGrflsave _DLGSaveFile _channel mainInterf.MINT_winMain.EDW_win fpath fname "OpenSpace3D scene\0*.xos\0All\0*.*\0\0" @cbDlgSaveOsScene nil; 0;; /** cbTbBtnSaveOsScene [EdToolBar CompRollOver I I V3Dview] I * callback on save scene button * * private * * return 0 **/ fun cbTbBtnSaveOsScene(tbstr, croll, btn, mask, viewstr)= saveSceneFile nil; 0;; /** cbDestroyExportWin [EdWindow] I * callback on destroy export setting window * * private * * return 0 **/ fun cbDestroyExportWin(winstr)= set winExportSetup = nil; 0;; fun cbBtnCancelExportToPlayer(ctrlbtn, winstr)= dsEdWindow winstr; set winExportSetup = nil; 0;; fun cbExportDone(p)= let p -> [exportPkos projname w h] in if (!exportPkos) then nil else ( let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkOS3DPack mainInterf.MINT_winMain projname sCurrentScenePath script nil; ); 0;; fun cbExportToPlayerOk(btnstr, p)= let p -> [winstr /*ctrllocal ctrllocalweb ctrlapplet*/ ctrlpkosonly ctrlwindows ctrllinux ctrlosx ctrlrpi ctrlandroid ctrlandroidxr ctrlios ctrlpkos] in let getProjectName -> projname in let atoi getProjectSettingDef "defaultWidth" "1280" -> w in let atoi getProjectSettingDef "defaultHeight" "720" -> h in let (getEdCtrlCheckState ctrlpkos) -> exportPkos in let if (getEdCtrlRadioState ctrlwindows) then 1 else if (getEdCtrlRadioState ctrllinux) then 2 else if (getEdCtrlRadioState ctrlrpi) then 3 else if (getEdCtrlRadioState ctrlosx) then 4 else if (getEdCtrlRadioState ctrlandroid) then 5 else if (getEdCtrlRadioState ctrlios) then 6 else if (getEdCtrlRadioState ctrlandroidxr) then 7 else 0 -> platform in let [exportPkos projname w h] -> p in ( setProjectSetting "exportPkos" (itoa exportPkos); setProjectSetting "exportPlatform" (itoa platform); if sCurrentScenePath == nil then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0353") 0; 0; ) else if (!strcmp (strtrim projname) "") || (projname == nil) then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0371") 0; 0; ) /* else if (getEdCtrlRadioState ctrllocal) then ( saveSceneFile nil; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in let getFileNameWithoutExt sCurrentScenePath -> fname in _DLGrflsave _DLGSaveFile _channel mainInterf.MINT_winMain.EDW_win sLastDirectory (strcat fname ".scol") "Scol executable\0*.scol\0All\0*.*\0\0" @cbDlgExportToPlayer [winstr script]; 0; ) else if (getEdCtrlRadioState ctrllocalweb) then ( dsEdWindow winstr; saveSceneFile nil; _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0572") (loc "OS3D_0573") 0; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkStandAloneWeb mainInterf.MINT_winMain projname sCurrentScenePath script w h; 0; ) else if (getEdCtrlRadioState ctrlapplet) then ( dsEdWindow winstr; set winExportSetup = nil; saveSceneFile nil; _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0572") (loc "OS3D_0573") 0; let getFileNameWithoutExt sCurrentScenePath -> fname in let getFileDirectory sCurrentScenePath -> prjdir in let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: prjdir::fname::".pak"::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkApplet mainInterf.MINT_winMain projname sCurrentScenePath script w h; 0; )*/ else if (getEdCtrlRadioState ctrlpkosonly) then ( dsEdWindow winstr; saveSceneFile nil; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkOS3DPack mainInterf.MINT_winMain projname sCurrentScenePath script nil; 0; ) else if (getEdCtrlRadioState ctrlwindows) then ( dsEdWindow winstr; saveSceneFile nil; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkStandAlone mainInterf.MINT_winMain projname sCurrentScenePath script mkfun1 @cbExportDone p; 0; ) else if (getEdCtrlRadioState ctrllinux) then ( dsEdWindow winstr; saveSceneFile nil; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkLinuxApp mainInterf.MINT_winMain projname sCurrentScenePath script mkfun1 @cbExportDone p; 0; ) else if (getEdCtrlRadioState ctrlosx) then ( dsEdWindow winstr; saveSceneFile nil; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkMacOsApp mainInterf.MINT_winMain projname sCurrentScenePath script mkfun1 @cbExportDone p; 0; ) else if (getEdCtrlRadioState ctrlrpi) then ( dsEdWindow winstr; saveSceneFile nil; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkRpiApp mainInterf.MINT_winMain projname sCurrentScenePath script mkfun1 @cbExportDone p; 0; ) else if (getEdCtrlRadioState ctrlandroid) then ( dsEdWindow winstr; saveSceneFile nil; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkAndroidApp mainInterf.MINT_winMain projname sCurrentScenePath script mkfun1 @cbExportDone p; 0; ) else if (getEdCtrlRadioState ctrlandroidxr) then ( dsEdWindow winstr; saveSceneFile nil; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkAndroidXrApp mainInterf.MINT_winMain projname sCurrentScenePath script mkfun1 @cbExportDone p 5; 0; ) else if (getEdCtrlRadioState ctrlios) then ( dsEdWindow winstr; saveSceneFile nil; let strcatn "_load \""::APPBASEDIR::"os3dplayer/os3dload.pkg\"\nmain \"":: sCurrentScenePath::"\" \""::projname::"\" \""::(itoa w)::"\" \""::(itoa h)::"\" "::(itoa 0)::nil -> script in mkIosApp mainInterf.MINT_winMain projname sCurrentScenePath script mkfun1 @cbExportDone p; 0; ) else nil; ); 0;; fun cbBtnProjectSettings(ctrlstr, viewstr)= cbTbBtnProjectSetting nil nil nil nil viewstr; 0;; fun cbExportPlatformState(ctrlstr, state, p)= if (!state) then nil else let p -> [ctrlpkos en] in setEdCtrlCheckEnable ctrlpkos en; 0;; fun showExportDialog(viewstr)= if winExportSetup != nil then nil else ( let [420 411] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let 10 -> ypos in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0158")) sWinDlgIcon -> winstr in let crEdCtrlButton winstr (iw / 2 - 70) ypos 140 20 (loc "OS3D_0315") EDWIN_RESIZE_MW -> bsettings in let ypos + 5 -> ypos in let crEdCtrlBitmap winstr 10 (set ypos = ypos + 34) 32 32 strcat APPBASEDIR "os3deditor/res/logo_pkos.png" 0xf0f0f0 nil -> logopkos in let crEdCtrlRadio winstr 47 ypos + 5 (iw - 80) 20 (loc "OS3D_0669") EDWIN_RESIZE_MW -> ctrlpkosonly in let crEdCtrlBitmap winstr 10 (set ypos = ypos + 34) 32 32 strcat APPBASEDIR "os3deditor/res/logo_windows.png" 0xf0f0f0 nil -> logowin in let crEdCtrlRadio winstr 47 ypos + 5 (iw - 80) 20 (loc "OS3D_0067") EDWIN_RESIZE_MW -> ctrlwindows in let crEdCtrlBitmap winstr 10 (set ypos = ypos + 34) 32 32 strcat APPBASEDIR "os3deditor/res/logo_linux.png" 0xf0f0f0 nil -> logolinux in let crEdCtrlRadio winstr 47 ypos + 5 (iw - 80) 20 (loc "OS3D_0577") EDWIN_RESIZE_MW -> ctrllinux in let crEdCtrlBitmap winstr 10 (set ypos = ypos + 34) 32 32 strcat APPBASEDIR "os3deditor/res/logo_rpi.png" 0xf0f0f0 nil -> logorpi in let crEdCtrlRadio winstr 47 ypos + 5 (iw - 80) 20 (loc "OS3D_0578") EDWIN_RESIZE_MW -> ctrlrpi in let crEdCtrlBitmap winstr 10 (set ypos = ypos + 34) 32 32 strcat APPBASEDIR "os3deditor/res/logo_osx.png" 0xf0f0f0 nil -> logoosx in let crEdCtrlRadio winstr 47 ypos + 5 (iw - 80) 20 (loc "OS3D_0580") EDWIN_RESIZE_MW -> ctrlosx in let crEdCtrlBitmap winstr 10 (set ypos = ypos + 34) 32 32 strcat APPBASEDIR "os3deditor/res/logo_android.png" 0xf0f0f0 nil -> logoandroid in let crEdCtrlRadio winstr 47 ypos + 5 (iw - 80) 20 (loc "OS3D_0557") EDWIN_RESIZE_MW -> ctrlandroid in let crEdCtrlBitmap winstr 10 (set ypos = ypos + 34) 32 32 strcat APPBASEDIR "os3deditor/res/logo_android_xr.png" 0xf0f0f0 nil -> logoaxr in let crEdCtrlRadio winstr 47 ypos + 5 (iw - 80) 20 (loc "OS3D_0866") EDWIN_RESIZE_MW -> ctrlandroidxr in let crEdCtrlBitmap winstr 10 (set ypos = ypos + 34) 32 32 strcat APPBASEDIR "os3deditor/res/logo_ios.png" 0xf0f0f0 nil -> logoios in let crEdCtrlRadio winstr 47 ypos + 5 (iw - 80) 20 (loc "OS3D_0579") EDWIN_RESIZE_MW -> ctrlios in let crEdCtrlCheck winstr 20 (set ypos = ypos + 44) + 5 (iw - 30) 20 (loc "OS3D_0812") EDWIN_RESIZE_MW -> ctrlpkos in /* let crEdCtrlRadio winstr 10 (set ypos = ypos + 25) (iw - 40) 20 (loc "OS3D_0065") EDWIN_RESIZE_MW -> ctrllocalweb in let crEdCtrlRadio winstr 10 (set ypos = ypos + 25) (iw - 40) 20 (loc "OS3D_0069") EDWIN_RESIZE_MW -> ctrlapplet in */ ( setEdCtrlCheckState ctrlpkos atoi (getProjectSettingDef "exportPkos" "0"); set winExportSetup = winstr; setEdCtrlButtonCb bsettings mkfun2 @cbBtnProjectSettings viewstr; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 @cbExportToPlayerOk [winstr /*ctrllocal ctrllocalweb ctrlapplet*/ ctrlpkosonly ctrlwindows ctrllinux ctrlosx ctrlrpi ctrlandroid ctrlandroidxr ctrlios ctrlpkos]; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancelExportToPlayer winstr; // check windows files if (checkPlatform "windows/x64/scol.exe") then setEdCtrlRadioEnable ctrlwindows 1 else setEdCtrlRadioEnable ctrlwindows 0; // check linux files if (checkPlatform "Linux/scol.amd64") then setEdCtrlRadioEnable ctrllinux 1 else setEdCtrlRadioEnable ctrllinux 0; // check RPI files if (checkPlatform "RaspberryPi/scol.armv7") then setEdCtrlRadioEnable ctrlrpi 1 else setEdCtrlRadioEnable ctrlrpi 0; // check osx files if (checkPlatform "macos/scol.app/Contents/PkgInfo") then setEdCtrlRadioEnable ctrlosx 1 else setEdCtrlRadioEnable ctrlosx 0; // check if android tools are present if (_CHECKandroidTools) then ( setEdCtrlRadioEnable ctrlandroid 1; setEdCtrlRadioEnable ctrlandroidxr 1; ) else ( setEdCtrlRadioEnable ctrlandroid 0; setEdCtrlRadioEnable ctrlandroidxr 0; ); // check ios files if (checkPlatform "Ios/scol/scol") then setEdCtrlRadioEnable ctrlios 1 else setEdCtrlRadioEnable ctrlios 0; let atoi (getProjectSettingDef "exportPlatform" "0") -> platform in ( setEdCtrlCheckEnable ctrlpkos platform; if (platform == 0) then setEdCtrlRadioState ctrlpkosonly 1 else if (platform == 1) then setEdCtrlRadioState ctrlwindows 1 else if (platform == 2) then setEdCtrlRadioState ctrllinux 1 else if (platform == 3) then setEdCtrlRadioState ctrlrpi 1 else if (platform == 4) then setEdCtrlRadioState ctrlosx 1 else if (platform == 5) then setEdCtrlRadioState ctrlandroid 1 else if (platform == 6) then setEdCtrlRadioState ctrlios 1 else if (platform == 7) then setEdCtrlRadioState ctrlandroidxr 1 else nil; ); setEdCtrlRadioCbState ctrlpkosonly mkfun3 @cbExportPlatformState [ctrlpkos 0]; setEdCtrlRadioCbState ctrlwindows mkfun3 @cbExportPlatformState [ctrlpkos 1]; setEdCtrlRadioCbState ctrllinux mkfun3 @cbExportPlatformState [ctrlpkos 1]; setEdCtrlRadioCbState ctrlrpi mkfun3 @cbExportPlatformState [ctrlpkos 1]; setEdCtrlRadioCbState ctrlosx mkfun3 @cbExportPlatformState [ctrlpkos 1]; setEdCtrlRadioCbState ctrlandroid mkfun3 @cbExportPlatformState [ctrlpkos 1]; setEdCtrlRadioCbState ctrlios mkfun3 @cbExportPlatformState [ctrlpkos 1]; setEdCtrlRadioCbState ctrlandroidxr mkfun3 @cbExportPlatformState [ctrlpkos 1]; /* //disable web export for now setEdCtrlRadioEnable ctrllocalweb 0; setEdCtrlRadioEnable ctrlapplet 0; */ paintEdCtrlBitmap logopkos; paintEdCtrlBitmap logowin; paintEdCtrlBitmap logolinux; paintEdCtrlBitmap logorpi; paintEdCtrlBitmap logoandroid; paintEdCtrlBitmap logoios; paintEdCtrlBitmap logoosx; setEdwindowCbDestroy winstr @cbDestroyExportWin; 0; ); ); 0;; fun cbSaveOnExport(viewstr)= showExportDialog viewstr; 0;; fun cbSaveBeforeExport(dlg, viewstr, state)= if (state == 2) then nil else // Cancel if (state == 1) then // OK ( saveSceneFile mkfun1 @cbSaveOnExport viewstr; 0; ) else nil; 0;; /** cbTbBtnExportToPlayer [EdToolBar CompRollOver I I V3Dview] I * callback on export to player * * private * * return 0 **/ fun cbTbBtnExportToPlayer(tbstr, croll, btn, mask, viewstr)= if sCurrentScenePath == nil then ( _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0353") 2 @cbSaveBeforeExport viewstr; 0; ) else ( showExportDialog viewstr; 0; ); 0;; /** cbTbBtnLaunchPlayer [EdToolBar CompRollOver I I V3Dview] I * launch in player * * private * * return 0 **/ fun cbTbBtnLaunchPlayer(tbstr, croll, btn, mask, viewstr)= launchPlayer viewstr; 0;; fun cbDestroyProjectSettingWin(winstr)= set settingWindow = nil; 0;; fun cbBtnProjectSettingOk(btnstr, p)= let p -> [viewstr winstr ctrlname ctrlversion ctrlptype ctrlwebsite ctrldesc ctrllicense ctrlaname ctrlcompany ctrlemail ctrlsplash ctrlicon ctrllang ctrltheme ctrlw ctrlh ctrluifactor] in let getEdCtrlTextLineValue ctrlname -> projname in let XMLgetShortFloatToString (getEdCtrlFloatValue ctrlversion) -> projver in let getSelectedEdCtrlSelectPos ctrlptype -> ptype in let getEdCtrlTextLineValue ctrlwebsite -> projwebsite in let getEdCtrlEditTextValue ctrldesc -> projdesc in let getEdCtrlEditTextValue ctrllicense -> projlicense in let getEdCtrlTextLineValue ctrlaname -> authorname in let getEdCtrlTextLineValue ctrlcompany -> authorcompany in let getEdCtrlTextLineValue ctrlemail -> authorEmail in let getEdCtrlTextLineValue ctrlsplash -> splashpath in let getEdCtrlTextLineValue ctrlicon -> iconpath in let getSelectedEdCtrlSelect ctrllang -> lang in let getSelectedEdCtrlSelect ctrltheme -> theme in let itoa (ftoi getEdCtrlFloatValue ctrlw) -> width in let itoa (ftoi getEdCtrlFloatValue ctrlh) -> height in let getEdCtrlFloatValue ctrluifactor -> uiscalefactor in ( //reset package name on change if ((!strcmp projname (getProjectSetting "projectName")) && (!strcmp authorcompany (getProjectSetting "authorCompany"))) then nil else delProjectSetting "appPkgName"; setProjectSetting "projectName" projname; set currentProject.PRJ_sName = projname; setProjectSetting "projectVersion" projver; setProjectSetting "projectType" (getProjectTypeById ptype); setProjectSetting "projectWebsite" projwebsite; setProjectSetting "projectDescription" projdesc; setProjectSetting "projectLicense" projlicense; setProjectSetting "authorName" authorname; setProjectSetting "authorCompany" authorcompany; setProjectSetting "authorEmail" authorEmail; setProjectSetting "splashpath" splashpath; setProjectSetting "iconpath" iconpath; setProjectSetting "language" lang; setProjectSetting "themeName" theme; setProjectSetting "defaultWidth" width; setProjectSetting "defaultHeight" height; setProjectSetting "uiScaleFactor" ftoa (uiscalefactor /. 100.0); VUIsetGlobalScaleFactor (V3DgetDefaultSession viewstr) (uiscalefactor /. 100.0); let VUIgetThemePath theme -> themepath in if (!strcmpi VUIdefaultTheme.VUITH_sPath themepath) then nil else VUIsetTheme themepath; dsEdWindow winstr; ); 0;; fun cbDlgStandAloneGetSplashPath(dlg, p, pfile)= let p -> [ctrlbtn p1] in let p1 -> [pwinstr ctrlpath] in ( if pfile == nil then nil else setEdCtrlTextLineValue ctrlpath _PtoScol pfile; setEdCtrlButtonEnable ctrlbtn 1; ); 0;; fun cbBtnPickSplashPath(ctrlbtn, p)= let p -> [winstr _] in ( setEdCtrlButtonEnable ctrlbtn 0; _DLGrflopen _DLGOpenFile _channel winstr.EDW_win nil nil "Bitmaps\0*.bmp;*.jpg;*.png;*.tga;\0Bitmap\0*.bmp\0Jpeg\0*.jpg\0Png\0*.png\0All\0*.*\0\0" @cbDlgStandAloneGetSplashPath [ctrlbtn p]; ); 0;; fun cbBtnRefreshSplashPath(ctrlbtn, p)= let p -> [pwinstr ctrlpath] in setEdCtrlTextLineValue ctrlpath nil; 0;; fun cbDlgGetIconPath(dlg, p, pfile)= let p -> [ctrlbtn ctrlpath] in ( if pfile == nil then nil else let _PtoScol pfile -> fname in setEdCtrlTextLineValue ctrlpath fname; setEdCtrlButtonEnable ctrlbtn 1; //setProjectSetting "iconpath" _PtoScol pfile; ); 0;; fun cbBtnPickIconPath(ctrlbtn, p)= let p -> [winstr ctrlpath] in ( setEdCtrlButtonEnable ctrlbtn 0; _DLGrflopen _DLGOpenFile _channel winstr.EDW_win nil nil "Bitmaps\0*.bmp;*.jpg;*.png;*.tga;*.ico;\0Ico\0*.ico\0Bitmap\0*.bmp\0Jpeg\0*.jpg\0Png\0*.png\0All\0*.*\0\0" @cbDlgGetIconPath [ctrlbtn ctrlpath]; ); 0;; fun cbBtnRefreshIconPath(ctrlbtn, p)= let p -> [winstr ctrlpath] in ( setEdCtrlTextLineValue ctrlpath nil; //setProjectSetting "iconpath" nil; ); 0;; fun cbProjectLanguageChanged(ctrl, pos, elem)= //setProjectSetting "language" elem; 0;; /** cbTbBtnProjectSetting [EdToolBar CompRollOver I I V3Dview] I * show the project setting interface * * private * * return 0 **/ fun cbTbBtnProjectSetting(tbstr, croll, btn, mask, viewstr)= if (settingWindow != nil) then nil else let [400 810] -> [iw ih] in let _GETWorkingAreaSize -> [sw _] in let _GETdesktopSize -> [_ sh] in let if (ih > (sh - 100)) then (sh - 100) else ih -> ih in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let 770 -> sih in let 10 -> ypos in let setEdWindowIcon (crEdWindow _channel mainInterf.MINT_winMain x y iw + 12 ih WN_NOSCOL|WN_MENU|WN_SIZEBOX|WN_HIDDEN nil EDWIN_DIALOG (loc "OS3D_0315")) sWinDlgIcon -> projwinstr in let crEdScrollWindow _channel projwinstr 0 0 iw + 12 (ih - 40) WN_CHILDINSIDE|WN_VSCROLL EDWIN_RESIZE_MW|EDWIN_RESIZE_MH nil nil -> scrlwinstr in let crEdWindow _channel scrlwinstr 0 0 iw sih WN_CHILDINSIDE|WN_NOBORDER nil EDWIN_GROUP nil -> iwinstr in let atof (getProjectSetting "projectVersion") -> projversion in let if projversion == nil then 1.0 else projversion -> projversion in let crEdFrameWindow _channel iwinstr 0 0 iw 335 EDWIN_RESIZE_MW nil (loc "OS3D_0316") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 315 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3D_0257") nil -> labelname in let crEdCtrlTextLine winstr 170 ypos (iw - 180) 20 getProjectName nil EDWIN_RESIZE_MW -> ctrlname in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0450") nil -> labelversion in let crEdCtrlFloat winstr 170 ypos (iw - 180) 20 projversion 0.0 100000.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlversion in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0460") nil -> labelwebsite in let crEdCtrlTextLine winstr 170 ypos (iw - 180) 20 (getProjectSetting "projectWebsite") nil EDWIN_RESIZE_MW -> ctrlwebsite in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) (iw - 20) 20 (loc "OS3D_0312") nil -> labeldesc in let crEdCtrlEditText winstr 10 ((set ypos = ypos + 20) + 2) (iw - 20) 90 (getProjectSetting "projectDescription" ) nil EDWIN_RESIZE_MW -> ctrldesc in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 95) + 2) (iw - 20) 20 (loc "OS3D_0313") nil -> labellicense in let crEdCtrlEditText winstr 10 ((set ypos = ypos + 20) + 2) (iw - 20) 90 (getProjectSetting "projectLicense" ) nil EDWIN_RESIZE_MW -> ctrllicense in let crEdFrameWindow _channel iwinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3D_0834") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in //let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3D_0834") nil -> labelptype in let crEdCtrlSelect winstr 10 10 (iw - 20) 120 EDWIN_RESIZE_MW -> ctrlptype in let crEdFrameWindow _channel iwinstr 0 0 iw 105 EDWIN_RESIZE_MW nil (loc "OS3D_0070") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 85 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3D_0070") nil -> labelaname in let crEdCtrlTextLine winstr 170 ypos (iw - 180) 20 (getProjectSetting "authorName") nil EDWIN_RESIZE_MW -> ctrlaname in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0096") nil -> labelcompany in let crEdCtrlTextLine winstr 170 ypos (iw - 180) 20 (getProjectSetting "authorCompany") nil EDWIN_RESIZE_MW -> ctrlcompany in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 160 20 (loc "OS3D_0133") nil -> labelemail in let crEdCtrlTextLine winstr 170 ypos (iw - 180) 20 (getProjectSetting "authorEmail") nil EDWIN_RESIZE_MW -> ctrlemail in let crEdFrameWindow _channel iwinstr 0 0 iw 130 EDWIN_RESIZE_MW nil (loc "OS3D_0343") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 110 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 160 20 (loc "OS3D_0229") nil -> labelloader in let crEdCtrlTextLine winstr 170 ypos (iw - 260) 20 (getProjectSetting "splashpath") nil EDWIN_RESIZE_MW -> ctrlsplash in let crEdCtrlButton winstr (iw - 85) ypos 35 20 "..." nil -> pickbtn in let crEdCtrlButton winstr (iw - 45) ypos 35 20 "X" nil -> refreshpath in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) 160 20 (loc "OS3D_0534") nil -> labelicon in let crEdCtrlTextLine winstr 170 ypos (iw - 260) 20 (getProjectSetting "iconpath") nil EDWIN_RESIZE_MW -> ctrlicon in let crEdCtrlButton winstr (iw - 85) ypos 35 20 "..." nil -> pickiconbtn in let crEdCtrlButton winstr (iw - 45) ypos 35 20 "X" nil -> refreshiconbtn in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3D_0553") nil -> labellang in let crEdCtrlSelect winstr 170 ypos (iw - 180) 120 EDWIN_RESIZE_MW -> ctrllang in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3D_0793") nil -> labeltheme in let crEdCtrlSelect winstr 170 ypos (iw - 180) 120 EDWIN_RESIZE_MW -> ctrltheme in // default size let crEdFrameWindow _channel iwinstr 0 0 iw 80 EDWIN_RESIZE_MW nil (loc "OS3D_0576") (loc "OS3D_0250") -> 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 200 20 (loc "OS3D_0465") nil -> labelw in let crEdCtrlFloat winstr 220 ypos (iw - 230) 20 atof (getProjectSettingDef "defaultWidth" "1280") 1.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlw in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 200 20 (loc "OS3D_0464") nil -> labelh in let crEdCtrlFloat winstr 220 ypos (iw - 230) 20 atof (getProjectSettingDef "defaultHeight" "720") 1.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlh in // VUI options let crEdFrameWindow _channel iwinstr 0 0 iw 60 EDWIN_RESIZE_MW nil (loc "OS3D_0794") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 40 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (set ypos = 10) + 2 200 20 (loc "OS3D_0795") nil -> labelui in let crEdCtrlFloat winstr 220 ypos (iw - 230) 20 ((atof (getProjectSettingDef "uiScaleFactor" "1.0")) *. 100.0) 1.0 1000.0 1.0 2 nil EDWIN_RESIZE_MW -> ctrluifactor in ( set settingWindow = projwinstr; fillEdCtrlSelect ctrlptype (loc "OS3D_0835")::(loc "OS3D_0836")::(loc "OS3D_0837")::nil; selectEdCtrlSelectByPos ctrlptype (getProjectTypeByName getProjectSettingDef "projectType" "standard"); setEdCtrlTextLineEnable ctrlsplash 0; setEdCtrlButtonCb pickbtn mkfun2 @cbBtnPickSplashPath [winstr ctrlsplash]; setEdCtrlButtonCb refreshpath mkfun2 @cbBtnRefreshSplashPath [winstr ctrlsplash]; setEdCtrlTextLineEnable ctrlicon 0; setEdCtrlButtonCb pickiconbtn mkfun2 @cbBtnPickIconPath [winstr ctrlicon]; setEdCtrlButtonCb refreshiconbtn mkfun2 @cbBtnRefreshIconPath [winstr ctrlicon]; setEdCtrlButtonCb (crEdCtrlButton projwinstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_LH|EDWIN_RESIZE_RW) mkfun2 @cbBtnProjectSettingOk [viewstr projwinstr ctrlname ctrlversion ctrlptype ctrlwebsite ctrldesc ctrllicense ctrlaname ctrlcompany ctrlemail ctrlsplash ctrlicon ctrllang ctrltheme ctrlw ctrlh ctrluifactor]; setEdCtrlButtonCb (crEdCtrlButton projwinstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_LH|EDWIN_RESIZE_LW) mkfun2 @cbBtnCancel projwinstr; let buildLanguages (strcat APPBASEDIR "os3deditor/lang/") (strcat APPBASEDIR "os3deditor/lang/os3deditor.") -> languages in ( let 0 -> i in let sizelist languages -> size in while (i < size) do ( let nth_list languages i -> [_ lang] in addEdCtrlSelect ctrllang lang; set i = i + 1; ); setEdCtrlSelectCb ctrllang @cbProjectLanguageChanged; selectEdCtrlSelect ctrllang getProjectSettingDef "language" currentLanguage; ); fillEdCtrlSelect ctrltheme "default"::getThemeList; selectEdCtrlSelect ctrltheme getProjectSettingDef "themeName" "default"; let getEdWindowSize projwinstr -> [nw nh] in ( setEdWindowMinimumSize projwinstr nw 250; setEdWindowMaximumSize projwinstr nw sh - 40; ); setEdwindowCbDestroy projwinstr @cbDestroyProjectSettingWin; setEdWindowVisible projwinstr 1; ); 0;; fun cbOnlineDocumentation(testurl, p, rc) = if (rc == 1) then // Active Internet Connection detected ( let loc "LANGCODE" -> lg in let if !strcmpi "fr" lg then lg else "en" -> lg in let strcatn sOSD3Url::"/lang/"::lg::sHelpUrl::nil -> url in _openbrowserhttp url; 0; ) // No Active Internet Connection detected else ( _openbrowserhttp strcatn "http://127.0.0.1:"::(itoa MainDocServer.DOCSRV_port)::"/index.html"::nil; 0; );; /** cbTbBtnHelp [EdToolBar CompRollOver I I V3Dview] I * callback on help button * Open the online help * * private * * return 0 **/ fun cbTbBtnHelp(tbstr, croll, btn, mask, viewstr)= if ((_keybdstate & 2) && (_keybdstate & 1) && (_keybdstate & 4)) then ( let MainDocServer.DOCSRV_sLang -> plang in let currentLanguage -> pdeflang in ( set currentLanguage = "english"; startlocEx strcat APPBASEDIR "os3deditor/lang/os3deditor" currentLanguage; reloadPluginsLoc; setDocServerLang nil "en"; computeAllMissingDoc nil (strcat APPBASEDIR "os3deditor/doc") "/doc/"; set currentLanguage = "french"; startlocEx strcat APPBASEDIR "os3deditor/lang/os3deditor" currentLanguage; reloadPluginsLoc; setDocServerLang nil "fr"; computeAllMissingDoc nil (strcat APPBASEDIR "os3deditor/doc") "/doc/"; set currentLanguage = pdeflang; startlocEx strcat APPBASEDIR "os3deditor/lang/os3deditor" currentLanguage; reloadPluginsLoc; setDocServerLang nil plang; ); 0; ) else if ((_keybdstate & 2) && (_keybdstate & 1)) then ( let MainDocServer.DOCSRV_sLang -> plang in let currentLanguage -> pdeflang in ( set currentLanguage = "english"; startlocEx strcat APPBASEDIR "os3deditor/lang/os3deditor" currentLanguage; reloadPluginsLoc; setDocServerLang nil "en"; computeAllDoc nil (strcat APPBASEDIR "os3deditor/documentation") "/documentation/"; set currentLanguage = "french"; startlocEx strcat APPBASEDIR "os3deditor/lang/os3deditor" currentLanguage; reloadPluginsLoc; setDocServerLang nil "fr"; computeAllDoc nil (strcat APPBASEDIR "os3deditor/documentation") "/documentation/"; set currentLanguage = pdeflang; startlocEx strcat APPBASEDIR "os3deditor/lang/os3deditor" currentLanguage; reloadPluginsLoc; setDocServerLang nil plang; ); 0; ) else if (_keybdstate & 1) then ( _openbrowserhttp strcatn "http://127.0.0.1:"::(itoa MainDocServer.DOCSRV_port)::"/index.html"::nil; 0; ) else ( checkInternetConnection nil @cbOnlineDocumentation nil; 0; ); 0;; /** cbDestroyAboutWin [EdWindow ObjWebNavigator] I * callback on destroy about window * * private * * return 0 **/ fun cbDestroyAboutWin(winstr, navigator)= SO3WebNavigatorDestroy navigator; set winAbout = nil; 0;; fun cbAboutBtnWww(ctrlbtn)= _openbrowserhttp sOSD3Url; 0;; fun cbAboutNavigatorPopup(navigator, p, x, y, w, h, url)= _openbrowserhttp url; 0;; fun cbResizeAboutWin(winstr, w, h, navigator)= SO3WebNavigatorSetSize navigator (w - 20) (h - 200); 0;; /** cbTbBtnAbout [EdToolBar CompRollOver I I V3Dview] I * callback on about button * Show the about dialog * * private * * return 0 **/ fun cbTbBtnAbout(tbstr, croll, btn, mask, viewstr)= if winAbout != nil then nil else let [450 500] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else (mx - iw)) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_SIZEBOX nil EDWIN_DIALOG (loc "OS3D_0017")) sWinDlgIcon -> aboutwinstr in let SO3WebNavigatorCreate _channel aboutwinstr.EDW_win 10 130 (iw - 20) 300 "google.com" -> navigator in ( crEdCtrlBitmap aboutwinstr 5 5 150 120 strcat APPBASEDIR "os3deditor/res/logo.jpg" 0xf0f0f0 nil; crEdCtrlLabel aboutwinstr 160 10 (iw - 170) 20 (loc "OS3D_0287") nil; crEdCtrlLabel aboutwinstr 160 40 (iw - 170) 20 strcat (strcat (loc "OS3D_0106") " ") getVersionName nil; crEdCtrlLabel aboutwinstr 160 65 (iw - 170) 20 strcat (strcat (loc "OS3D_0326") " ") getVersionDate nil; crEdCtrlLabel aboutwinstr 160 90 (iw - 170) 20 (loc "OS3D_0222") nil; crEdCtrlLabel aboutwinstr 10 (ih - 28) (iw - 110) 20 (loc "OS3D_0103") nil; setEdCtrlButtonCb (crEdCtrlButton aboutwinstr 10 435 (iw-20) 20 "www.openspace3d.com" EDWIN_RESIZE_MW) @cbAboutBtnWww; setEdCtrlButtonCb (crEdCtrlButton aboutwinstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel aboutwinstr; SO3WebNavigatorLoadFile navigator _checkpack strcat APPBASEDIR "os3deditor/res/about/about.html" nil; SO3WebNavigatorCbOnPopup navigator @cbAboutNavigatorPopup nil; set winAbout = aboutwinstr; setEdwindowCbSize winAbout mkfun4 @cbResizeAboutWin navigator; setEdwindowCbDestroy winAbout mkfun2 @cbDestroyAboutWin navigator; ); 0;; fun cbObjectSetupRenderVisibility(ctrlstr, value, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in ( SO3ObjectSetRenderingDistance obj value; XMLsetParam markstr "renderingDistance" (XMLgetShortFloatToString value); ); 0;; fun cbObjectSetupRenderQueue(ctrlstr, value, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in ( SO3ObjectSetRenderQueue obj ftoi value; XMLsetParam markstr "renderQueue" (XMLgetShortFloatToString value); ); 0;; fun cbObjectSetupNbLodLevel(ctrlstr, value, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in ( SO3EntityGenerateLOD obj ftoi value; XMLsetParam markstr "nbLODlevel" (XMLgetShortFloatToString value); ); 0;; fun cbTreeMenuSetActiveCamera(mnuitem, p)= let p -> [viewstr val type markstr camstate] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> cam in let !strcmp "default_camera" val -> isdefaultcam in let V3DgetObjectByName sessionstr "default_camera" -> defaultcam in ( if(camstate && !isdefaultcam) then ( V3DsetDefaultCamera sessionstr defaultcam; V3DchangeCameraViewport sessionstr (V3DgetDefaultViewport viewstr) defaultcam; V3DenableNavigate sessionstr 1; showCameraViewport viewstr cam 1; ) else ( if (!isdefaultcam) then ( V3DenableNavigate sessionstr 0; ) else ( V3DsetDefaultCamera sessionstr cam; V3DenableNavigate sessionstr 1; ); showCameraViewport viewstr nil 0; V3DchangeCameraViewport sessionstr (V3DgetDefaultViewport viewstr) cam; ); ); 0;; /* // TODO replace by a subentity material management fun cbTreeMenuObjectIndexMaterials(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let SO3ObjectGetParent obj -> father in let SO3ObjectGetName father -> fathername in let XMLgetBoolParam markstr "indexMaterials" -> indexmat in let getGraphByValue val -> tgraph in let tgraph -> [treeitem [_ path groupmark]] in let getGroupName groupmark -> resgroup in let getGraphByValue fathername -> tgraphfather in let tgraphfather -> [treefather _] in ( XMLsetParam markstr "indexMaterials" (XMLgetBoolString !indexmat); //del object hierarchy and reload // apply on all sons removeObjectSons viewstr treeitem 0; set lSceneGraph = G2DremoveFromList lSceneGraph tgraph; delEdCtrlTreeItem ctrlSceneTree treeitem; V3DshowObjectAxis viewstr sessionstr obj iViewerEditMode 0; V3DshowObjectHelper viewstr sessionstr obj nil 0; SO3ObjectDestroy obj; //reload mark let XMLgetParam markstr "id" -> id in let XMLgetParam markstr "name" -> meshname in let XMLgetParam markstr "path" -> meshres in let XMLgetBoolParam markstr "indexMaterials" -> indexmat in let XMLgetBoolParam markstr "castShadows" -> meshcastshadow in let XMLgetBoolParam markstr "receiveShadows" -> meshreceiveshadow in let XMLgetMarkByValueFromMarkSons markstr "position" -> nodeposstr in let atof XMLgetParam nodeposstr "x" -> xpos in let atof XMLgetParam nodeposstr "y" -> ypos in let atof XMLgetParam nodeposstr "z" -> zpos in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> noderotstr in let atof XMLgetParam noderotstr "qx" -> xang in let atof XMLgetParam noderotstr "qy" -> yang in let atof XMLgetParam noderotstr "qz" -> zang in let atof XMLgetParam noderotstr "qw" -> wang in let XMLgetMarkByValueFromMarkSons markstr "scale" -> nodescalestr in let atof XMLgetParam nodescalestr "x" -> xscale in let atof XMLgetParam nodescalestr "y" -> yscale in let atof XMLgetParam nodescalestr "z" -> zscale in let OGMATfindResourcePath meshres lResourcesPath -> meshpath in let if meshpath != nil then if indexmat then SO3SceneLoadEntityWithIndex (V3DgetSession sessionstr) meshpath meshname id resgroup else SO3SceneLoadEntity (V3DgetSession sessionstr) meshpath (strcatn id::"."::meshname::nil) else nil -> mesh in ( let addEdCtrlTreeItem ctrlSceneTree treefather (strcatn id::"."::meshname::nil) (strcatn id::"."::meshname::nil) iTypeEntity sTreeBitmapEntity -> treenode in ( if father == nil then nil else SO3ObjectLink mesh father; SO3ObjectSetPosition mesh [xpos ypos zpos]; SO3ObjectSetOrientation mesh [xang yang zang wang]; SO3ObjectSetScale mesh [xscale yscale zscale]; set lSceneGraph = [treenode [markstr meshpath groupmark]]::lSceneGraph; V3DaddResource sessionstr meshpath resgroup SO3_RESOURCE_MESH; addOsSceneResource xmlEditSceneFile groupmark groupstr meshpath SO3_RESOURCE_MESH; SO3ObjectSetCastShadows mesh meshcastshadow; loadOsGraph viewstr markstr nil groupmark mesh treenode 0; selEdCtrlTreeItem ctrlSceneTree treenode; ); ); ); 0;; */ /* ********************************************************************************************* / Light / ********************************************************************************************* */ fun cbTreeMenuLightCastShadow(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let SO3ObjectGetCastShadows obj -> lightcastshadow in ( SO3ObjectSetCastShadows obj !lightcastshadow; XMLsetParam markstr "castShadows" (XMLgetBoolString !lightcastshadow); ); 0;; fun cbTreeMenuLightEnable(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in let SO3LightGetVisible light -> lightstate in ( setGraphItemInitState val !lightstate; if (!strcmp "default_light" val) then ( enableDefaultLight !lightstate; 0; ) else ( SO3LightSetVisible light !lightstate; XMLsetParam markstr "enable" (XMLgetBoolString !lightstate); 0; ); ); 0;; /** cbDestroySetupWin [EdWindow] I * callback on destroy light setting window * * private * * return 0 **/ fun cbDestroyLightSetupWin(winstr)= set winLightSetup = nil; 0;; fun cbLightSetupType(ctrl, pos, elem, param)= let param -> [p ctrlrange ctrlsrcw ctrlsrch ctrlinner ctrlouter] in let p -> [viewstr val type lightstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in let (getOgreMaxLightType elem) -> lighttype in ( if lighttype == SO3_DIRECTIONAL_LIGHT then ( setEdCtrlFloatEnable ctrlrange 0; setEdCtrlFloatEnable ctrlsrcw 0; setEdCtrlFloatEnable ctrlsrch 0; setEdCtrlFloatEnable ctrlinner 0; setEdCtrlFloatEnable ctrlouter 0; ) else if lighttype == SO3_POINT_LIGHT then ( setEdCtrlFloatEnable ctrlrange 1; setEdCtrlFloatEnable ctrlsrcw 0; setEdCtrlFloatEnable ctrlsrch 0; setEdCtrlFloatEnable ctrlinner 0; setEdCtrlFloatEnable ctrlouter 0; ) else if lighttype == SO3_RECT_LIGHT then ( setEdCtrlFloatEnable ctrlrange 1; setEdCtrlFloatEnable ctrlsrcw 1; setEdCtrlFloatEnable ctrlsrch 1; setEdCtrlFloatEnable ctrlinner 1; setEdCtrlFloatEnable ctrlouter 1; ) else ( setEdCtrlFloatEnable ctrlrange 1; setEdCtrlFloatEnable ctrlsrcw 0; setEdCtrlFloatEnable ctrlsrch 0; setEdCtrlFloatEnable ctrlinner 1; setEdCtrlFloatEnable ctrlouter 1; ); XMLsetParam lightstr "type" elem; SO3LightSetType light lighttype; V3DshowObjectHelper viewstr sessionstr light nil 0; V3DshowObjectHelper viewstr sessionstr light iTypeLight 1; ); 0;; /** cbLightSetupDiffuseColor [EdControl I V3Dview] I * callback on light diffuse color change * * private * * return 0 **/ fun cbLightSetupDiffuseColor(ctrlstr, color, p)= if color == nil then nil else let p -> [viewstr val type lightstr] in let XMLgetMarkByValueFromMarkSons lightstr "colourDiffuse" -> lightdiffusestr in let G2Dgetrgb color -> [r g b] in let ftoa ((itof r) /. 255.0) -> fr in let ftoa ((itof g) /. 255.0) -> fg in let ftoa ((itof b) /. 255.0) -> fb in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in ( XMLsetParam lightdiffusestr "r" fr; XMLsetParam lightdiffusestr "g" fg; XMLsetParam lightdiffusestr "b" fb; SO3LightSetDiffuseColor light G2Drgb2rgba color 0; ); 0;; /** cbLightSetupSpecularColor [EdControl I [V3Dview S I XMLmark]] I * callback on light specular color change * * private * * return 0 **/ fun cbLightSetupSpecularColor(ctrlstr, color, p)= if color == nil then nil else let p -> [viewstr val type lightstr] in let XMLgetMarkByValueFromMarkSons lightstr "colourSpecular" -> lightspecularstr in let G2Dgetrgb color -> [r g b] in let ftoa ((itof r) /. 255.0) -> fr in let ftoa ((itof g) /. 255.0) -> fg in let ftoa ((itof b) /. 255.0) -> fb in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in ( XMLsetParam lightspecularstr "r" fr; XMLsetParam lightspecularstr "g" fg; XMLsetParam lightspecularstr "b" fb; SO3LightSetSpecularColor light G2Drgb2rgba color 0; ); 0;; /** cbLightSetupPower [EdControl F [V3Dview S I XMLmark]] I * callback on light power change * * private * * return 0 **/ fun cbLightSetupPower(ctrl, value, p)= let p -> [viewstr val type lightstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in ( XMLsetParam lightstr "power" XMLgetShortFloatToString value; SO3LightSetPowerScale light value; ); 0;; /** cbLightSetupRange [EdControl F [V3Dview S I XMLmark]] I * callback on light range change * * private * * return 0 **/ fun cbLightSetupRange(ctrl, value, p)= let p -> [viewstr val type lightstr] in let XMLgetMarkByValueFromMarkSons lightstr "lightAttenuation" -> lightattenuationstr in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in ( XMLsetParam lightattenuationstr "range" XMLgetShortFloatToString value; SO3LightSetAttenuationAuto light value; ); 0;; /** cbLightSetupInnerRange [EdControl F [[V3Dview S I XMLmark] EdControl]] I * callback on light inner spot range change * * private * * return 0 **/ fun cbLightSetupInnerRange(ctrl, value, p)= let p -> [[viewstr val type lightstr] ctrlouter] in let SO3MathsDegreeToRadian value -> radang in let XMLgetMarkByValueFromMarkSons lightstr "lightRange" -> lightrangestr in let if lightrangestr == nil then (XMLaddMark xmlEditSceneFile "lightRange" lightstr nil nil) else lightrangestr -> lightrangestr in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in let getEdCtrlFloatValue ctrlouter -> outval in ( if (outval >=. value) then nil else ( setEdCtrlFloatValue ctrlouter value; SO3LightSetSpotOuterAngle light radang; XMLsetParam lightrangestr "outer" XMLgetShortFloatToString radang; ); XMLsetParam lightrangestr "inner" XMLgetShortFloatToString radang; SO3LightSetSpotInnerAngle light radang; ); 0;; /** cbLightSetupOuterRange [EdControl F [[V3Dview S I XMLmark] EdControl]] I * callback on light outer spot range change * * private * * return 0 **/ fun cbLightSetupOuterRange(ctrl, value, p)= let p -> [[viewstr val type lightstr] ctrlinner] in let SO3MathsDegreeToRadian value -> radang in let XMLgetMarkByValueFromMarkSons lightstr "lightRange" -> lightrangestr in let if lightrangestr == nil then (XMLaddMark xmlEditSceneFile "lightRange" lightstr nil nil) else lightrangestr -> lightrangestr in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in let getEdCtrlFloatValue ctrlinner -> inval in ( if (inval <=. value) then nil else ( setEdCtrlFloatValue ctrlinner value; SO3LightSetSpotInnerAngle light radang; XMLsetParam lightrangestr "inner" XMLgetShortFloatToString radang; ); XMLsetParam lightrangestr "outer" XMLgetShortFloatToString radang; SO3LightSetSpotOuterAngle light radang; ); 0;; /** cbLightSetupSourceSize [EdControl F [[V3Dview S I XMLmark] EdControl]] I * callback on light source size change * * private * * return 0 **/ fun cbLightSetupSourceSize(ctrl, value, p)= let p -> [[viewstr val type lightstr] [ctrlw ctrlh]] in let XMLgetMarkByValueFromMarkSons lightstr "lightSourceSize" -> lightsourcesizestr in let if lightsourcesizestr == nil then (XMLaddMark xmlEditSceneFile "lightSourceSize" lightstr nil nil) else lightsourcesizestr -> lightsourcesizestr in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in let getEdCtrlFloatValue ctrlw -> lightw in let getEdCtrlFloatValue ctrlh -> lighth in ( XMLsetParam lightsourcesizestr "w" XMLgetShortFloatToString lightw; XMLsetParam lightsourcesizestr "h" XMLgetShortFloatToString lighth; SO3LightSetSourceSize light [lightw lighth]; ); 0;; /** cbLightSetupCastShadow [EdControl F [V3Dview S I XMLmark]] I * callback on light outer spot range change * * private * * return 0 **/ fun cbLightSetupCastShadow(ctrl, state, p)= let p -> [viewstr val type lightstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in ( XMLsetParam lightstr "castShadows" (XMLgetBoolString state); SO3ObjectSetCastShadows light state; ); 0;; fun cbLightVolumetric(ctrl, state, p)= let p -> [viewstr val type lightstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> light in ( XMLsetParam lightstr "volumetric" (XMLgetBoolString state); SO3LightSetVolumetric light state; ); 0;; fun cbTreeMenuLightEditParameters(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let winLightSetup -> [wobj owinstr] in if wobj == obj then nil else ( if winLightSetup == nil then nil else ( dsEdWindow owinstr; set winLightSetup = nil; ); let [340 285] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let SO3LightGetType obj -> lighttype in let SO3ObjectGetCastShadows obj -> lightcastshadow in let G2Drgba2rgb (SO3LightGetDiffuseColor obj) -> diffusecolor in let G2Drgba2rgb (SO3LightGetSpecularColor obj) -> specularcolor in let SO3LightGetPowerScale obj -> powerscale in let SO3LightGetAttenuation obj -> [range const linear quad] in let SO3LightGetSpotInnerAngle obj -> innerang in let SO3LightGetSpotOuterAngle obj -> outerang in let SO3LightGetSourceSize obj -> [lightw lighth] in let SO3LightGetVolumetric obj -> volumetric in let 10 -> ypos in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0223") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 ypos + 2 190 20 (loc "OS3D_0224") nil -> labeltype in let crEdCtrlSelect winstr 210 ypos 120 120 EDWIN_RESIZE_MW -> ctrltype in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 190 20 (loc "OS3D_0117") nil -> labeldcolor in let crEdCtrlColorButton winstr 210 ypos 120 20 diffusecolor 0 EDWIN_RESIZE_MW nil -> ctrldcolor in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 190 20 (loc "OS3D_0406") nil -> labelscolor in let crEdCtrlColorButton winstr 210 ypos 120 20 specularcolor 0 EDWIN_RESIZE_MW nil -> ctrlscolor in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 190 20 (loc "OS3D_0317") nil -> labelrange in let crEdCtrlFloat winstr 210 ypos 120 20 range 0.0 1000000.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlrange in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 190 20 (loc "OS3D_0308") nil -> labelpower in let crEdCtrlFloat winstr 210 ypos 120 20 powerscale 0.0 10000.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlpower in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0211") nil -> labelinnerrange in let crEdCtrlFloat winstr 210 ypos 120 20 (SO3MathsRadianToDegree innerang) 0.0 180.0 1.0 2 nil EDWIN_RESIZE_MW -> ctrlinner in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0290") nil -> labelouterrange in let crEdCtrlFloat winstr 210 ypos 120 20 (SO3MathsRadianToDegree outerang) 0.0 180.0 1.0 2 nil EDWIN_RESIZE_MW -> ctrlouter in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0846") nil -> labelsrcw in let crEdCtrlFloat winstr 210 ypos 120 20 lightw 0.1 1000000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlsrcw in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0847") nil -> labelsrch in let crEdCtrlFloat winstr 210 ypos 120 20 lighth 0.1 1000000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlsrch in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0085") EDWIN_RESIZE_MW -> ctrlshadow in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0451") EDWIN_RESIZE_MW -> ctrlvolumetric in let if (lighttype == SO3_SPOT_LIGHT) then "spot" else if (lighttype == SO3_DIRECTIONAL_LIGHT) then "directional" else if (lighttype == SO3_RECT_LIGHT) then "rect" else "point" -> slighttype in ( set winLightSetup = [obj dwinstr]; fillEdCtrlSelect ctrltype "point"::"directional"::"spot"::"rect"::nil; if lighttype == SO3_DIRECTIONAL_LIGHT then ( setEdCtrlFloatEnable ctrlrange 0; setEdCtrlFloatEnable ctrlinner 0; setEdCtrlFloatEnable ctrlsrcw 0; setEdCtrlFloatEnable ctrlsrch 0; setEdCtrlFloatEnable ctrlouter 0; ) else if lighttype == SO3_POINT_LIGHT then ( setEdCtrlFloatEnable ctrlinner 0; setEdCtrlFloatEnable ctrlouter 0; setEdCtrlFloatEnable ctrlsrcw 0; setEdCtrlFloatEnable ctrlsrch 0; ) else if lighttype == SO3_SPOT_LIGHT then ( setEdCtrlFloatEnable ctrlsrcw 0; setEdCtrlFloatEnable ctrlsrch 0; ) else nil; setEdCtrlCheckState ctrlshadow lightcastshadow; setEdCtrlCheckState ctrlvolumetric volumetric; selectEdCtrlSelect ctrltype slighttype; setEdCtrlSelectCb ctrltype mkfun4 @cbLightSetupType [p ctrlrange ctrlsrcw ctrlsrch ctrlinner ctrlouter]; setEdCtrlColorButtonCb ctrldcolor mkfun3 @cbLightSetupDiffuseColor p; setEdCtrlColorButtonCb ctrlscolor mkfun3 @cbLightSetupSpecularColor p; setEdCtrlFloatCbChange ctrlpower mkfun3 @cbLightSetupPower p; setEdCtrlFloatCbChange ctrlrange mkfun3 @cbLightSetupRange p; setEdCtrlFloatCbChange ctrlinner mkfun3 @cbLightSetupInnerRange [p ctrlouter]; setEdCtrlFloatCbChange ctrlouter mkfun3 @cbLightSetupOuterRange [p ctrlinner]; setEdCtrlFloatCbChange ctrlsrcw mkfun3 @cbLightSetupSourceSize [p [ctrlsrcw ctrlsrch]]; setEdCtrlFloatCbChange ctrlsrch mkfun3 @cbLightSetupSourceSize [p [ctrlsrcw ctrlsrch]]; setEdCtrlCheckCbState ctrlshadow mkfun3 @cbLightSetupCastShadow p; setEdCtrlCheckCbState ctrlvolumetric mkfun3 @cbLightVolumetric p; setEdwindowCbDestroy dwinstr @cbDestroyLightSetupWin; 0; ); ); 0;; /* ********************************************************************************************* / Camera / ********************************************************************************************* */ /** cbDestroySetupWin [EdWindow] I * callback on destroy camera setting window * * private * * return 0 **/ fun cbDestroyCameraSetupWin(winstr)= set winCameraSetup = nil; 0;; fun cbCameraSetupFovy(ctrl, value, p)= let p -> [viewstr val type camerastr] in let SO3MathsDegreeToRadian value -> radang in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> camera in ( XMLsetParam camerastr "fov" XMLgetShortFloatToString radang; SO3CameraSetFOVy camera radang; ); 0;; fun cbCameraSetupNearClip(ctrl, value, p)= let p -> [viewstr val type camerastr] in let XMLgetMarkByValueFromMarkSons camerastr "clipping" -> cameraclipstr in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> camera in ( XMLsetParam cameraclipstr "near" XMLgetShortFloatToString value; SO3CameraSetNearClipDistance camera value; ); 0;; fun cbCameraSetupFarClip(ctrl, value, p)= let p -> [viewstr val type camerastr] in let XMLgetMarkByValueFromMarkSons camerastr "clipping" -> cameraclipstr in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> camera in ( XMLsetParam cameraclipstr "far" XMLgetShortFloatToString value; SO3CameraSetFarClipDistance camera value; ); 0;; fun cbCameraSetupFovLength(ctrl, value, p)= let p -> [viewstr val type camerastr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> camera in ( XMLsetParam camerastr "focalLength" XMLgetShortFloatToString value; SO3CameraSetFocalLength camera value; ); 0;; fun cbTreeMenuCameraEditParameters(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> cam in let winCameraSetup -> [wobj owinstr] in if wobj == cam then nil else ( if winCameraSetup == nil then nil else ( dsEdWindow owinstr; set winCameraSetup = nil; ); let [300 115] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let SO3CameraGetFocalLength cam -> fovlength in let SO3CameraGetFOVy cam -> fovy in let SO3CameraGetNearClipDistance cam -> nearclip in let SO3CameraGetFarClipDistance cam -> farclip in let 10 -> ypos in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0082") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 ypos + 2 180 20 (loc "OS3D_0170") nil -> labelfovy in let crEdCtrlFloat winstr 200 ypos 90 20 (SO3MathsRadianToDegree fovy) 1.0 180.0 1.0 2 nil EDWIN_RESIZE_MW -> ctrlfovy in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0259") nil -> labelnearclip in let crEdCtrlFloat winstr 200 ypos 90 20 nearclip 0.001 10000000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlnearclip in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0159") nil -> labelfarclip in let crEdCtrlFloat winstr 200 ypos 90 20 farclip 0.001 10000000.0 0.1 4 nil EDWIN_RESIZE_MW -> ctrlfarclip in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0163") nil -> labelfovlength in let crEdCtrlFloat winstr 200 ypos 90 20 fovlength 0.0 10000000.0 0.01 4 nil EDWIN_RESIZE_MW -> ctrlfovlength in ( set winCameraSetup = [cam dwinstr]; setEdCtrlFloatCbChange ctrlfovy mkfun3 @cbCameraSetupFovy p; setEdCtrlFloatCbChange ctrlnearclip mkfun3 @cbCameraSetupNearClip p; setEdCtrlFloatCbChange ctrlfarclip mkfun3 @cbCameraSetupFarClip p; setEdCtrlFloatCbChange ctrlfovlength mkfun3 @cbCameraSetupFovLength p; setEdwindowCbDestroy dwinstr @cbDestroyCameraSetupWin; 0; ); ); 0;; /* ********************************************************************************************* / Entities / ********************************************************************************************* */ /** cbDestroySetupWin [EdWindow] I * callback on destroy Entity setting window * * private * * return 0 **/ fun cbDestroyEntitySetupWin(winstr)= set winEntitySetup = nil; 0;; fun cbObjectSetupCastShadow(ctrlstr, state, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in ( SO3ObjectSetCastShadows obj state; XMLsetParam markstr "castShadows" (XMLgetBoolString state); ); 0;; /* fun cbObjectSetupHidden(ctrlstr, state, p)= let p -> [[viewstr treeitem val type markstr] sons] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in ( SO3ObjectSetVisible obj !state sons; XMLsetParam markstr "hidden" (XMLgetBoolString state); updateSceneTreeBitmap treeitem type state; ); 0;; */ fun cbObjectSetupStaticGeometry(ctrlstr, state, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in ( XMLsetParam markstr "staticGeometry" (XMLgetBoolString state); setGraphItemStaticGeometryState val state; ); 0;; fun cbEntityLayerEnable(ctrlstr, state, p)= let p -> [[viewstr val type markstr] layerIndex] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in ( SO3EntitySetVisibilityFlagIndexEnable obj layerIndex state; XMLsetParam markstr "visibilityFlags" (itoh (SO3EntityGetVisibilityFlags obj)); ); 0;; /** cbDestroySetupWin [EdWindow] I * callback on destroy Entity info window * * private * * return 0 **/ fun cbDestroyEntityInfoWin(winstr)= set winEntityInfo = nil; 0;; fun cbTreeMenuEntityInformations(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> ent in let winEntityInfo -> [wobj owinstr obwinstr] in let if winEntityInfo == nil then 1 else 0 -> reposition in let getEdWindowPos owinstr -> [ox oy] in let [550 165] -> [iw ih] in let 10 -> ypos in let SO3ObjectGetPolygonCount ent -> polycount in let SO3ObjectGetVerticesCount ent -> vertexcount in let SO3ObjectGetBoundingBoxInfo ent 0 -> [[bx by bz] _ _] in if wobj == ent then nil else ( if winEntityInfo != nil then ( dsEdWindow obwinstr; let crEdWindow _channel owinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in ( setEdWindowName owinstr strcatn (loc "OS3D_0279")::" "::val::nil; crEdCtrlLabel winstr 10 ypos + 2 180 20 (loc "OS3D_0246") nil; crEdCtrlLabel winstr 195 ypos + 2 (iw - 205) 20 (XMLgetParam markstr "path") nil; crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0588") nil; crEdCtrlLabel winstr 195 ypos + 2 (iw - 205) 20 (itoa vertexcount) nil; crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0307") nil; crEdCtrlLabel winstr 195 ypos + 2 (iw - 205) 20 (itoa polycount) nil; crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0079") nil; crEdCtrlLabel winstr 195 ypos + 2 (iw - 205) + 2 20 strcatn "X : "::(ftoa bx)::nil nil; crEdCtrlLabel winstr 195 (set ypos = ypos + 25) + 2 (iw - 205) + 2 20 strcatn "Y : "::(ftoa by)::nil nil; crEdCtrlLabel winstr 195 (set ypos = ypos + 25) + 2 (iw - 205) + 2 20 strcatn "Z : "::(ftoa bz)::nil nil; mutate winEntityInfo <- [_ _ winstr]; ); 0; ) else ( let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let if reposition then [x y] else [ox oy] -> [x y] in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0279") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in ( crEdCtrlLabel winstr 10 ypos + 2 180 20 (loc "OS3D_0246") nil; crEdCtrlLabel winstr 195 ypos + 2 (iw - 205) 20 (XMLgetParam markstr "path") nil; crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0588") nil; crEdCtrlLabel winstr 195 ypos + 2 (iw - 205) 20 (itoa vertexcount) nil; crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0307") nil; crEdCtrlLabel winstr 195 ypos + 2 (iw - 205) 20 (itoa polycount) nil; crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0079") nil; crEdCtrlLabel winstr 195 ypos + 2 (iw - 205) + 2 20 strcatn "X : "::(ftoa bx)::nil nil; crEdCtrlLabel winstr 195 (set ypos = ypos + 25) + 2 (iw - 205) + 2 20 strcatn "Y : "::(ftoa by)::nil nil; crEdCtrlLabel winstr 195 (set ypos = ypos + 25) + 2 (iw - 205) + 2 20 strcatn "Z : "::(ftoa bz)::nil nil; set winEntityInfo = [ent dwinstr winstr]; setEdwindowCbDestroy dwinstr @cbDestroyEntityInfoWin; 0; ); ); ); 0;; fun cbTreeMenuEntityEditParameters(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> ent in let winEntitySetup -> [wobj owinstr] in if wobj == ent then nil else ( if winEntitySetup == nil then nil else ( dsEdWindow owinstr; set winEntitySetup = nil; ); let [350 220] -> [iw ih] in let _GETWorkingAreaSize -> [sw _] in let _GETdesktopSize -> [_ sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let XMLgetMarkByValue xmlEditSceneFile "scene" -> scenestr in let XMLgetMarkByValueFromMarkSons scenestr "environment" -> envstr in let XMLgetMarkByValueFromMarkSons envstr "layers" -> layersstr in let atof (XMLgetParam markstr "renderingDistance") -> dist in let atof (XMLgetParam markstr "renderQueue") -> queue in let if queue == nil then 50.0 else queue -> queue in let XMLgetBoolParam markstr "castShadows" -> castshadow in let XMLgetBoolParam markstr "staticGeometry" -> staticGeometry in let atof XMLgetParam markstr "nbLODlevel" -> nblodlevel in let htoi XMLgetParam markstr "visibilityFlags" -> visibilityflags in let setEdWindowIcon (crEdWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_SIZEBOX nil nil strcat (strcat (loc "OS3D_0281") " ") val) sWinDlgIcon -> mwinstr in let crEdScrollWindow _channel mwinstr 0 0 iw ih WN_CHILDINSIDE|WN_VSCROLL EDWIN_RESIZE_MW|EDWIN_RESIZE_MH EDWIN_GROUP nil -> ewinstr in let 10 -> ypos in let crEdFrameWindow _channel ewinstr 0 0 (iw - 20) 180 EDWIN_RESIZE_MW nil (loc "OS3D_0140") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 (iw - 20) 160 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ypos + 2 120 20 (loc "OS3D_0118") nil -> labelvisibility in let crEdCtrlFloat winstr 130 ypos (iw - 160) 20 dist 0.0 1000000.0 0.1 6 nil nil -> ctrldist in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0085") nil -> ctrlshadow in //let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0188") nil -> ctrlhidden in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0410") nil -> ctrlstatic in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3D_0275") nil -> labelvisibility in let crEdCtrlFloat winstr 170 ypos (iw - 200) 20 nblodlevel 0.0 16.0 1.0 0 nil nil -> ctrlnblodlevel in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0336") nil -> labelqueue in let crEdCtrlFloat winstr 190 ypos (iw - 220) 20 queue 10.0 104.0 1.0 0 nil nil -> ctrlqueue in let crEdFrameWindowEx _channel ewinstr 0 0 (iw - 20) (25 * 32 + 35) nil nil (loc "OS3D_0141") (loc "OS3D_0250") 1 -> winfrm in let crEdWindow _channel winfrm 0 18 (iw-20) (25 * 32 + 15) WN_CHILDINSIDE|WN_NOBORDER nil nil nil -> winstr in ( setEdWindowMinimumSize mwinstr iw 90; setEdWindowMaximumSize mwinstr iw sh - 40; set winEntitySetup = [ent mwinstr]; setEdCtrlFloatCbChange ctrldist mkfun3 @cbObjectSetupRenderVisibility p; setEdCtrlCheckState ctrlshadow castshadow; setEdCtrlCheckCbState ctrlshadow mkfun3 @cbObjectSetupCastShadow p; //setEdCtrlCheckState ctrlhidden hidden; //setEdCtrlCheckCbState ctrlhidden mkfun3 @cbObjectSetupHidden [pn 0]; setEdCtrlCheckState ctrlstatic staticGeometry; setEdCtrlFloatCbChange ctrlnblodlevel mkfun3 @cbObjectSetupNbLodLevel p; setEdCtrlCheckCbState ctrlstatic mkfun3 @cbObjectSetupStaticGeometry p; setEdCtrlFloatCbChange ctrlqueue mkfun3 @cbObjectSetupRenderQueue p; set ypos = 10; let XMLgetMarksByValueFromMarkSons layersstr "layer" -> layerlistmark in let 0 -> i in while (layerlistmark != nil) do ( let XMLgetParam (hd layerlistmark) "name" -> layername in let crEdCtrlCheck winstr 10 ypos 20 20 "" EDWIN_RESIZE_MW -> ctrllayerenable in let crEdCtrlTextLine winstr 35 (ypos + 2) (iw - 65) 20 layername nil nil -> ctrllayername in ( setEdCtrlCheckState ctrllayerenable ((visibilityflags >> i) & 1); setEdCtrlCheckCbState ctrllayerenable mkfun3 @cbEntityLayerEnable [p i]; setEdCtrlTextLineEnable ctrllayername 0; set ypos = ypos + 25; ); set layerlistmark = tl layerlistmark; set i = i + 1; ); setEdwindowCbDestroy mwinstr @cbDestroyEntitySetupWin; 0; ); ); 0;; /* ********************************************************************************************* / Nodes / ********************************************************************************************* */ /** cbDestroyNodeSetupWin [EdWindow] I * callback on destroy Node setting window * * private * * return 0 **/ fun cbDestroyNodeSetupWin(winstr)= set winNodeSetup = nil; 0;; fun cbTreeMenuNodeEditParameters(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> node in let winNodeSetup -> [wobj owinstr] in if wobj == node then nil else ( if winNodeSetup == nil then nil else ( dsEdWindow owinstr; set winNodeSetup = nil; ); let [350 60] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in //let XMLgetBoolParam markstr "hidden" -> hidden in let XMLgetBoolParam markstr "staticGeometry" -> staticGeometry in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0281") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let 10 -> ypos in //let crEdCtrlCheck winstr 10 (set ypos = 10) (iw - 20) 20 (loc "OS3D_0187") EDWIN_RESIZE_MW -> ctrlhidden in let crEdCtrlCheck winstr 10 (set ypos = 10 /*ypos + 25*/) (iw - 20) 20 (loc "OS3D_0410") EDWIN_RESIZE_MW -> ctrlstatic in ( set winNodeSetup = [node dwinstr]; //setEdCtrlCheckState ctrlhidden hidden; //setEdCtrlCheckCbState ctrlhidden mkfun3 @cbObjectSetupHidden [pn 1]; setEdCtrlCheckState ctrlstatic staticGeometry; setEdCtrlCheckCbState ctrlstatic mkfun3 @cbObjectSetupStaticGeometry p; setEdwindowCbDestroy dwinstr @cbDestroyNodeSetupWin; 0; ); ); 0;; /* ********************************************************************************************* / Animations / ********************************************************************************************* */ /** cbDestroyAnimSetupWin [EdWindow] I * callback on destroy animation setting window * * private * * return 0 **/ fun cbDestroyAnimSetupWin(winstr, p)= let p -> [viewstr val type markstr] in let winAnimSetup -> [animstr _ tbstr chkplaypause trm] in let V3DgetDefaultSession viewstr -> sessionstr in ( if trm == nil then nil else _deltimer trm; V3DanimationsEnableScene sessionstr 0 0; ); set winAnimSetup = nil; 0;; fun cbAnimSetupEnable(ctrl, state, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in ( XMLsetParam markstr "enable" XMLgetBoolString state; setGraphItemInitState val state; ); 0;; fun cbAnimSetupLoop(mnuitem, state, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in ( XMLsetParam markstr "loop" XMLgetBoolString state; V3DsetAnimationLoop animstr state; ); 0;; fun cbAnimSetupSkipFrame(mnuitem, state, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in ( XMLsetParam markstr "skipFrame" XMLgetBoolString state; V3DanimationSetDefaultSkipFrame animstr state; ); 0;; fun cbAnimSetupSpeed(ctrl, value, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in ( XMLsetParam markstr "speed" XMLgetShortFloatToString value; V3DsetAnimationSpeed animstr value; ); 0;; fun cbAnimSetupWeight(ctrl, value, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in ( XMLsetParam markstr "weight" XMLgetShortFloatToString value; V3DsetAnimationWeight animstr value; ); 0;; fun cbAnimSetupInterpolationMode(ctrl, pos, elem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in ( XMLsetParam markstr "interpolationMode" elem; V3DsetAnimationInterpolationMode animstr (getOgreAnimationInterpolationType elem); ); 0;; fun cbAnimSetupRotInterpolationMode(ctrl, pos, elem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in ( XMLsetParam markstr "rotationInterpolationMode" elem; V3DsetAnimationRotInterpolationMode animstr (getOgreAnimationRotInterpolationType elem); ); 0;; fun cbAnimSetupPlayPause(tbstr, check, btn, mask, state, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in ( if state then ( V3DsetAnimationState animstr 0; if (!animstr.V3D_bAnimReset) then nil else V3DinitializeAnimation animstr 0; V3DplayAnimation animstr; ) else ( V3DpauseAnimation animstr; ); ); 0;; fun cbAnimSetupStop(tbstr, check, btn, mask, p)= let p -> [[viewstr val type markstr] chkplaypause] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in ( V3DstopAnimation animstr; V3DresetAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); 0;; fun cbTreeMenuAnimEditParameters(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in let winAnimSetup -> [wanimstr owinstr _ _ _] in if wanimstr == animstr then nil else ( if winAnimSetup == nil then nil else ( dsEdWindow owinstr; set winAnimSetup = nil; ); let [320 218] -> [iw ih] in let 10 -> ypos in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let XMLgetBoolParam markstr "enable" -> animstate in let XMLgetBoolParam markstr "loop" -> animloop in let XMLgetParam markstr "type" -> animtype in let XMLgetParam markstr "interpolationMode" -> intmode in let XMLgetParam markstr "rotationInterpolationMode" -> rotintmode in let atof (XMLgetParam markstr "speed") -> animspeed in let atof (XMLgetParam markstr "weight") -> animweight in let XMLgetBoolParam markstr "skipFrame" -> skipframe in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0047") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 (ypos + 2) 190 20 (loc "OS3D_0213") nil -> labelint in let crEdCtrlSelect winstr 210 ypos 100 120 EDWIN_RESIZE_MW -> ctrlint in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 190 20 (loc "OS3D_0346") nil -> labelrotint in let crEdCtrlSelect winstr 210 ypos 100 120 EDWIN_RESIZE_MW -> ctrlrotint in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 190 20 (loc "OS3D_0407") nil -> labelspeed in let crEdCtrlFloat winstr 210 ypos 100 20 animspeed (-.100000.0) 100000.0 0.1 5 nil EDWIN_RESIZE_MW -> ctrlspeed in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 190 20 (loc "OS3D_0461") nil -> labelweight in let crEdCtrlFloat winstr 210 ypos 100 20 animweight (0.0) 1.0 0.001 5 nil EDWIN_RESIZE_MW -> ctrlweight in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0236") EDWIN_RESIZE_MW -> ctrlloop in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0398") EDWIN_RESIZE_MW -> ctrlskipframe in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0139") EDWIN_RESIZE_MW -> ctrlenable in let crEdWindowToolBar winstr 0 (ih-28) iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_playpause.png" -> aplaypause in let crEdToolBarCheck tbstr aplaypause ETB_ALIGN_LEFT (loc "OS3D_0303") nil -> chkplaypause in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_stop.png" -> astop in let crEdToolBarButton tbstr astop ETB_ALIGN_LEFT (loc "OS3D_0411") nil -> chkstop in ( setEdToolBarVisible tbstr 1; setEdToolBarCheckCbClick tbstr chkplaypause mkfun6 @cbAnimSetupPlayPause p; setEdToolBarButtonCbClick tbstr chkstop mkfun5 @cbAnimSetupStop [p chkplaypause]; if (!strcmpi animtype "node") then nil else ( setEdCtrlSelectEnable ctrlint 0; setEdCtrlSelectEnable ctrlrotint 0; ); set winAnimSetup = [animstr dwinstr tbstr chkplaypause nil]; setEdCtrlCheckState ctrlloop animloop; setEdCtrlCheckCbState ctrlloop mkfun3 @cbAnimSetupLoop p; setEdCtrlCheckState ctrlskipframe skipframe; setEdCtrlCheckCbState ctrlskipframe mkfun3 @cbAnimSetupSkipFrame p; setEdCtrlCheckState ctrlenable animstate; setEdCtrlCheckCbState ctrlenable mkfun3 @cbAnimSetupEnable p; fillEdCtrlSelect ctrlint "linear"::"spline"::nil; selectEdCtrlSelect ctrlint intmode; setEdCtrlSelectCb ctrlint mkfun4 @cbAnimSetupInterpolationMode p; fillEdCtrlSelect ctrlrotint "linear"::"spherical"::nil; selectEdCtrlSelect ctrlrotint rotintmode; setEdCtrlSelectCb ctrlrotint mkfun4 @cbAnimSetupRotInterpolationMode p; setEdCtrlFloatCbChange ctrlspeed mkfun3 @cbAnimSetupSpeed p; setEdCtrlFloatCbChange ctrlweight mkfun3 @cbAnimSetupWeight p; setEdwindowCbDestroy dwinstr mkfun2 @cbDestroyAnimSetupWin p; paintEdToolBar tbstr; 0; ); ); 0;; fun cbAnimSetupSlider(ctrlstr, value, p)= let winAnimSetup -> [animstr ewinstr tbstr chkplaypause trm] in ( if trm == nil then nil else ( _deltimer trm; mutate winAnimSetup <- [_ _ _ _ nil]; ); if (!animstr.V3D_bAnimReset) then nil else V3DinitializeAnimation animstr 0; V3DplayAnimation animstr; V3DsetAnimationPosition animstr value; V3DpauseAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); 0;; fun refreshAnimSetupTrack(ctrltimeline, animstr, trackidx)= let V3DgetNbAnimationTrackKeys animstr trackidx -> nbkeys in let getEdCtrlTimeLineTrackByPos ctrltimeline trackidx -> trackstr in let 0 -> i in while i < nbkeys do ( let V3DgetSequenceAnimationKeyInfos animstr trackidx i -> [_ kpos klength ktrans kdecal] in let getEdCtrlTimeLineKeyByPos trackstr i -> keystr in setEdCtrlTimeLinekeyParams ctrltimeline keystr kpos klength; set i = i + 1; ); setEdCtrlTimeLineLength ctrltimeline (V3DgetAnimationLength animstr); 0;; fun cbAnimSetupKeyLength(ctrlstr, value, p)= let p -> [[viewstr val type markstr] ctrltimeline animstr trackidx keyidx] in let V3DgetSequenceAnimationKeyInfos animstr trackidx keyidx -> [_ kpos klength ktrans kdecal] in let XMLgetMarksByValueFromMarkSons markstr "track" -> ltrackmarks in let nth_list ltrackmarks trackidx -> trackmark in let XMLgetMarksByValueFromMarkSons trackmark "keyframe" -> lkeymarks in let nth_list lkeymarks keyidx -> keymark in ( XMLsetParam keymark "length" XMLgetShortFloatToString value; V3DsetSequenceAnimationKeyInfos animstr trackidx keyidx value ktrans kdecal; refreshAnimSetupTrack ctrltimeline animstr trackidx; ); 0;; fun cbAnimSetupKeyTrans(ctrlstr, value, p)= let p -> [[viewstr val type markstr] ctrltimeline animstr trackidx keyidx] in let V3DgetSequenceAnimationKeyInfos animstr trackidx keyidx -> [_ kpos klength ktrans kdecal] in let XMLgetMarksByValueFromMarkSons markstr "track" -> ltrackmarks in let nth_list ltrackmarks trackidx -> trackmark in let XMLgetMarksByValueFromMarkSons trackmark "keyframe" -> lkeymarks in let nth_list lkeymarks keyidx -> keymark in ( XMLsetParam keymark "transition" XMLgetShortFloatToString value; V3DsetSequenceAnimationKeyInfos animstr trackidx keyidx klength value kdecal; refreshAnimSetupTrack ctrltimeline animstr trackidx; ); 0;; fun cbAnimSetupKeyDecal(ctrlstr, value, p)= let p -> [[viewstr val type markstr] ctrltimeline animstr trackidx keyidx] in let V3DgetSequenceAnimationKeyInfos animstr trackidx keyidx -> [_ kpos klength ktrans kdecal] in let XMLgetMarksByValueFromMarkSons markstr "track" -> ltrackmarks in let nth_list ltrackmarks trackidx -> trackmark in let XMLgetMarksByValueFromMarkSons trackmark "keyframe" -> lkeymarks in let nth_list lkeymarks keyidx -> keymark in ( XMLsetParam keymark "decal" XMLgetShortFloatToString value; V3DsetSequenceAnimationKeyInfos animstr trackidx keyidx klength ktrans value; refreshAnimSetupTrack ctrltimeline animstr trackidx; ); 0;; fun cbAnimSetupSelectKey(ctrlstr, keystr, p)= let p -> [[viewstr val type markstr] ctrltimeline ctrllength ctrltrans ctrldecal] in let winAnimSetup -> [animstr ewinstr tbstr chkplaypause trm] in if keystr != nil then let getEdCtrlTimeLineKeyTrack keystr -> trackstr in let getEdCtrlTimeLineTrackPos trackstr -> trackidx in let getEdCtrlTimeLineKeyPos keystr -> keyidx in let V3DgetSequenceAnimationKeyInfos animstr trackidx keyidx -> [_ kpos klength ktrans kdecal] in ( setEdCtrlFloatCbChange ctrllength mkfun3 @cbAnimSetupKeyLength [[viewstr val type markstr] ctrltimeline animstr trackidx keyidx]; setEdCtrlFloatCbChange ctrltrans mkfun3 @cbAnimSetupKeyTrans [[viewstr val type markstr] ctrltimeline animstr trackidx keyidx]; setEdCtrlFloatCbChange ctrldecal mkfun3 @cbAnimSetupKeyDecal [[viewstr val type markstr] ctrltimeline animstr trackidx keyidx]; setEdCtrlFloatEnable ctrllength 1; setEdCtrlFloatEnable ctrltrans 1; setEdCtrlFloatEnable ctrldecal 1; setEdCtrlFloatValue ctrllength klength; setEdCtrlFloatValue ctrltrans ktrans; setEdCtrlFloatValue ctrldecal kdecal; if (!animstr.V3D_bAnimReset) then nil else V3DinitializeAnimation animstr 0; setEdCtrlTimeLineValue ctrltimeline kpos; V3DplayAnimation animstr; V3DsetAnimationPosition animstr kpos; V3DpauseAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ) else ( setEdCtrlFloatCbChange ctrllength nil; setEdCtrlFloatCbChange ctrltrans nil; setEdCtrlFloatCbChange ctrldecal nil; setEdCtrlFloatEnable ctrllength 0; setEdCtrlFloatEnable ctrltrans 0; setEdCtrlFloatEnable ctrldecal 0; setEdCtrlFloatValue ctrllength 0.0; setEdCtrlFloatValue ctrltrans 0.0; setEdCtrlFloatValue ctrldecal 0.0; ); 0;; fun cbAnimSetupSeqUpdate(trm, p)= let p -> [animstr ctrltimeline] in ( setEdCtrlTimeLineValue ctrltimeline V3DgetAnimationPosition animstr; ); 0;; fun cbAnimSetupSeqPlayPause(tbstr, check, btn, mask, state, ctrltimeline)= let winAnimSetup -> [animstr ewinstr tbstr chkplaypause trm] in ( if state then ( V3DsetAnimationState animstr 0; if (!animstr.V3D_bAnimReset) then nil else V3DinitializeAnimation animstr 0; V3DplayAnimation animstr; if trm != nil then nil else mutate winAnimSetup <- [_ _ _ _ (_rfltimer _starttimer _channel (1000/30) @cbAnimSetupSeqUpdate [animstr ctrltimeline])]; ) else ( V3DpauseAnimation animstr; if trm == nil then nil else ( _deltimer trm; mutate winAnimSetup <- [_ _ _ _ nil]; ); ); ); 0;; fun cbAnimSetupSeqStop(tbstr, check, btn, mask, ctrltimeline)= let winAnimSetup -> [animstr ewinstr tbstr chkplaypause trm] in ( V3DstopAnimation animstr; V3DresetAnimation animstr; setEdCtrlTimeLineValue ctrltimeline 0.0; setEdToolBarCheckState tbstr chkplaypause 0; if trm == nil then nil else ( _deltimer trm; mutate winAnimSetup <- [_ _ _ _ nil]; ); ); 0;; fun cbAnimSetupSeqZoomIn(tbstr, check, btn, mask, ctrltimeline)= let (getEdCtrlTimeLinePixelPerUnit ctrltimeline) -> cursize in if cursize >= 200 then nil else setEdCtrlTimeLinePixelPerUnit ctrltimeline cursize * 2 1; 0;; fun cbAnimSetupSeqZoomOut(tbstr, check, btn, mask, ctrltimeline)= let (getEdCtrlTimeLinePixelPerUnit ctrltimeline) -> cursize in if cursize <= 2 then nil else setEdCtrlTimeLinePixelPerUnit ctrltimeline cursize / 2 1; 0;; fun cbAnimSetupSeqAddTrack(tbstr, check, btn, mask, p)= let p -> [ctrltimeline [viewstr val type markstr]] in let winAnimSetup -> [animstr ewinstr tbstr chkplaypause trm] in let addEdCtrlTimeLineTrack ctrltimeline 1 -> trackstr in ( selectEdCtrlTimeLineTrack ctrltimeline trackstr; V3DaddSequenceAnimationTrack animstr; XMLaddMark xmlEditSceneFile "track" markstr nil nil; ); 0;; fun cbDlgAnimSetupRemoveTrack(dlg, p, state)= if !state then nil else let p -> [winstr ctrltimeline [viewstr val type markstr]] in let winAnimSetup -> [animstr ewinstr tbstr chkplaypause trm] in let getEdCtrlTimeLineSelectedTrack ctrltimeline -> trackstr in let getEdCtrlTimeLineTrackPos trackstr -> trackidx in let getEdCtrlTimeLineTrackByPos ctrltimeline (if trackidx >= 1 then trackidx - 1 else trackidx + 1) -> prevtrack in ( removeEdCtrlTimeLineTrack ctrltimeline trackstr 1; V3DdelSequenceAnimationTrack animstr trackidx; let XMLgetMarksByValueFromMarkSons markstr "track" -> ltrackmarks in let nth_list ltrackmarks trackidx -> trackmark in XMLdelMark xmlEditSceneFile trackmark; selectEdCtrlTimeLineTrack ctrltimeline prevtrack; ); 0;; fun cbAnimSetupSeqDelTrack(tbstr, check, btn, mask, p)= let p -> [winstr ctrltimeline [viewstr val type markstr]] in let getEdCtrlTimeLineSelectedTrack ctrltimeline -> trackstr in if trackstr == nil then nil else _DLGrflmessage _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0452") (loc "OS3D_0060") 1 @cbDlgAnimSetupRemoveTrack p; 0;; fun cbAnimSetupAddSelectAnimKey(kanimname, type, p)= let p -> [ctrltimeline [viewstr val type markstr]] in let winAnimSetup -> [animstr ewinstr tbstr chkplaypause trm] in let V3DgetDefaultSession viewstr -> sessionstr in let getEdCtrlTimeLineSelectedTrack ctrltimeline -> trackstr in let V3DgetAnimationByName sessionstr kanimname -> kanimstr in if (trackstr == nil) || (kanimstr == nil) || (kanimstr == animstr) then nil else ( if (!kanimstr.V3D_bAnimReset) then nil else V3DinitializeAnimation kanimstr 0; let getEdCtrlTimeLineTrackPos trackstr -> trackidx in let XMLgetMarksByValueFromMarkSons markstr "track" -> ltrackmarks in let nth_list ltrackmarks trackidx -> trackmark in let (V3DgetAnimationLength kanimstr) -> length in let if length <=. 0.0 then 0.10 else length -> length in let V3DaddSequenceAnimationKey animstr trackidx kanimstr length 0.0 0.0 -> keyidx in let V3DgetSequenceAnimationKeyInfos animstr trackidx keyidx -> [_ kpos klength ktrans kdecal] in ( addEdCtrlTimeLineKey ctrltimeline trackidx kanimstr.V3D_sAnimName kpos klength 1; XMLaddMark xmlEditSceneFile "keyframe" trackmark ["animId" (itoa kanimstr.V3D_iAnimId)]::["animName" kanimstr.V3D_sBaseName]::["length" (XMLgetShortFloatToString klength)]::["transition" (XMLgetShortFloatToString ktrans)]::["decal" (XMLgetShortFloatToString kdecal)]::nil nil; setEdCtrlTimeLineLength ctrltimeline (V3DgetAnimationLength animstr); ); ); 0;; fun cbAnimSetupCloseRes(p)= let p -> [tbstr check] in setEdToolBarButtonEnable tbstr check 1; 0;; fun cbAnimSetupSeqAddKey(tbstr, check, btn, mask, p)= let p -> [winstr ctrltimeline kp] in ( setEdToolBarButtonEnable tbstr check 0; dlgSelectPluginResource (getGroupByName "Scene") winstr iTypeGroup|iTypeAnim nil mkfun3 @cbAnimSetupAddSelectAnimKey [ctrltimeline kp] mkfun1 @cbAnimSetupCloseRes [tbstr check] 0; ); 0;; fun cbDlgAnimSetupRemoveKey(dlg, p, state)= if !state then nil else let p -> [winstr ctrltimeline [viewstr val type markstr]] in let winAnimSetup -> [animstr ewinstr tbstr chkplaypause trm] in let getEdCtrlTimeLineSelectedTrack ctrltimeline -> trackstr in let getEdCtrlTimeLineTrackPos trackstr -> trackidx in let getEdCtrlTimeLineSelectedKey ctrltimeline -> keystr in let getEdCtrlTimeLineKeyPos keystr -> keyidx in let V3DgetSequenceAnimationKeyInfos animstr trackidx keyidx -> [_ kpos klength ktrans kdecal] in let XMLgetMarksByValueFromMarkSons markstr "track" -> ltrackmarks in let nth_list ltrackmarks trackidx -> trackmark in ( removeEdCtrlTimeLineKey ctrltimeline keystr 1; V3DdelSequenceAnimationKey animstr trackidx keyidx; let XMLgetMarksByValueFromMarkSons trackmark "keyframe" -> lkeymarks in let nth_list lkeymarks keyidx -> keymark in XMLdelMark xmlEditSceneFile keymark; //decal the next key to keep it in place let getEdCtrlTimeLineKeyByPos trackstr keyidx -> nextkeystr in if (nextkeystr == nil) then nil else let XMLgetMarksByValueFromMarkSons trackmark "keyframe" -> lkeymarks in let nth_list lkeymarks keyidx -> nextkeymark in let V3DgetSequenceAnimationKeyInfos animstr trackidx keyidx -> [_ nkpos nklength nktrans nkdecal] in let kdecal +. klength -. ktrans +. nkdecal -> ndecal in ( V3DsetSequenceAnimationKeyInfos animstr trackidx keyidx nklength nktrans ndecal; XMLsetParam nextkeymark "decal" XMLgetShortFloatToString ndecal; ); setEdCtrlTimeLineLength ctrltimeline (V3DgetAnimationLength animstr); ); 0;; fun cbAnimSetupSeqDelKey(tbstr, check, btn, mask, p)= let p -> [winstr ctrltimeline [viewstr val type markstr]] in let getEdCtrlTimeLineSelectedKey ctrltimeline -> keystr in if keystr == nil then nil else _DLGrflmessage _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0452") (loc "OS3D_0058") 1 @cbDlgAnimSetupRemoveKey p; 0;; fun cbAnimSetupSeqMoveKey(tbstr, check, btn, mask, p)= let p -> [winstr ctrltimeline [viewstr val type markstr] dir] in let winAnimSetup -> [animstr ewinstr tbstr chkplaypause trm] in let getEdCtrlTimeLineSelectedTrack ctrltimeline -> trackstr in let getEdCtrlTimeLineTrackPos trackstr -> trackidx in let getEdCtrlTimeLineSelectedKey ctrltimeline -> keystr in let getEdCtrlTimeLineKeyPos keystr -> keyidx in let V3DgetNbAnimationTrackKeys animstr trackidx -> nbkeys in if (trackstr == nil) || (keystr == nil) || ((keyidx >= (nbkeys - 1)) && (dir >= 0)) || ((keyidx <= 0) && (dir <= 0)) then nil else let XMLgetMarksByValueFromMarkSons markstr "track" -> ltrackmarks in let nth_list ltrackmarks trackidx -> trackmark in ( //addLogMessage strcat "val > " itoa (keyidx + dir); V3DmoveSequenceAnimationKey animstr trackidx keyidx keyidx + dir; moveEdCtrlTimeLineKey trackstr keyidx keyidx + dir; XMLmoveMarkSons trackmark keyidx keyidx + dir; refreshAnimSetupTrack ctrltimeline animstr trackidx; ); 0;; fun cbTreeMenuAnimEdit(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in let winAnimSetup -> [wanimstr owinstr _ _ _] in if wanimstr == animstr then nil else ( if winAnimSetup == nil then nil else ( dsEdWindow owinstr; set winAnimSetup = nil; ); V3DanimationsEnableScene sessionstr 1 0; let [600 400] -> [iw ih] in let 38 -> ypos in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let XMLgetBoolParam markstr "enable" -> animstate in let XMLgetBoolParam markstr "loop" -> animloop in let XMLgetParam markstr "type" -> animtype in let atof (XMLgetParam markstr "speed") -> animspeed in let atof (XMLgetParam markstr "weight") -> animweight in let XMLgetBoolParam markstr "skipFrame" -> skipframe in let setEdWindowIcon (crEdWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_SIZEBOX nil EDWIN_GROUP strcat (strcat (loc "OS3D_0047") " ") val) sWinDlgIcon -> ewinstr in let crEdFrameWindow _channel ewinstr 0 0 iw 236 EDWIN_RESIZE_MW|EDWIN_RESIZE_MH nil (loc "OS3D_0046") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 220 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW|EDWIN_RESIZE_MH nil nil -> winstr in let crEdWindowToolBar winstr 0 (set ypos = 1) iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_playpause.png" -> aplaypause in let crEdToolBarCheck tbstr aplaypause ETB_ALIGN_LEFT (loc "OS3D_0303") nil -> chkplaypause in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_stop.png" -> astop in let crEdToolBarButton tbstr astop ETB_ALIGN_LEFT (loc "OS3D_0411") nil -> chkstop in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_hseparator.png" -> asep in let crEdToolBarBitmap tbstr asep ETB_ALIGN_LEFT nil nil -> hsep in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_addtrack.png" -> aaddtrack in let crEdToolBarButton tbstr aaddtrack ETB_ALIGN_LEFT (loc "OS3D_0039") nil -> chkaddtrack in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_deltrack.png" -> adeltrack in let crEdToolBarButton tbstr adeltrack ETB_ALIGN_LEFT (loc "OS3D_0114") nil -> chkdeltrack in let crEdToolBarBitmap tbstr asep ETB_ALIGN_LEFT nil nil -> hsep in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_addkey.png" -> aaddkey in let crEdToolBarButton tbstr aaddkey ETB_ALIGN_LEFT (loc "OS3D_0026") nil -> chkaddkey in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_delkey.png" -> adelkey in let crEdToolBarButton tbstr adelkey ETB_ALIGN_LEFT (loc "OS3D_0113") nil -> chkdelkey in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_movekey_left.png" -> amvleftkey in let crEdToolBarButton tbstr amvleftkey ETB_ALIGN_LEFT (loc "OS3D_0255") nil -> chkmvleftkey in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_movekey_right.png" -> amvrightkey in let crEdToolBarButton tbstr amvrightkey ETB_ALIGN_LEFT (loc "OS3D_0256") nil -> chkmvrightkey in let crEdToolBarBitmap tbstr asep ETB_ALIGN_LEFT nil nil -> hsep in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_zoomin.png" -> azoomin in let crEdToolBarButton tbstr azoomin ETB_ALIGN_LEFT (loc "OS3D_0473") nil -> chkzoomin in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_zoomout.png" -> azoomout in let crEdToolBarButton tbstr azoomout ETB_ALIGN_LEFT (loc "OS3D_0474") nil -> chkzoomout in //let crEdCtrlSlider winstr 10 35 (iw - 20) 20 0.0 0.0 (V3DgetAnimationLength animstr) nil EDWIN_RESIZE_MW nil -> ctrlslider in let crEdCtrlTimeLineEditor winstr 0 (set ypos = ypos + 29) iw 190 40 100 (V3DgetAnimationLength animstr) 450 EDWIN_RESIZE_MW|EDWIN_RESIZE_MH nil -> ctrltimeline in let setEdWindowBackgroundColor (crEdWindow _channel winstr 0 190 451 29 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_LH|EDWIN_RESIZE_RW nil nil) EdDefaultTheme.EDT_iMainBackgroundColor -> statuswinstr in let crEdCtrlColorLabel statuswinstr 10 5 70 18 (loc "OS3D_0220") nil EdDefaultTheme.EDT_iMainBackgroundColor nil -> labellength in let crEdCtrlFloat statuswinstr 80 4 70 20 0.001 0.001 1000.0 0.001 5 nil nil -> ctrllength in let crEdCtrlColorLabel statuswinstr 160 5 70 18 (loc "OS3D_0434") nil EdDefaultTheme.EDT_iMainBackgroundColor nil -> labeltrans in let crEdCtrlFloat statuswinstr 230 4 70 20 0.0 0.0 1000.0 0.001 5 nil nil -> ctrltrans in let crEdCtrlColorLabel statuswinstr 310 5 70 18 (loc "OS3D_0111") nil EdDefaultTheme.EDT_iMainBackgroundColor nil -> labeldecal in let crEdCtrlFloat statuswinstr 380 4 70 20 0.0 0.0 1000.0 0.001 5 nil nil -> ctrldecal in let crEdFrameWindow _channel ewinstr 0 135 iw 160 EDWIN_RESIZE_MW nil (loc "OS3D_0048") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 135 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ((set ypos = 10) + 2) 190 20 (loc "OS3D_0407") nil -> labelspeed in let crEdCtrlFloat winstr 210 ypos 100 20 animspeed (-.100000.0) 100000.0 0.1 5 nil nil -> ctrlspeed in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 190 20 (loc "OS3D_0461") nil -> labelweight in let crEdCtrlFloat winstr 210 ypos 100 20 animweight (0.0) 1.0 0.001 5 nil nil -> ctrlweight in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0236") nil -> ctrlloop in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0398") nil -> ctrlskipframe in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0139") nil -> ctrlenable in ( setEdWindowMinimumSize ewinstr iw ih; setEdToolBarVisible tbstr 1; setEdToolBarCheckCbClick tbstr chkplaypause mkfun6 @cbAnimSetupSeqPlayPause ctrltimeline; setEdToolBarButtonCbClick tbstr chkstop mkfun5 @cbAnimSetupSeqStop ctrltimeline; setEdToolBarButtonCbClick tbstr chkaddtrack mkfun5 @cbAnimSetupSeqAddTrack [ctrltimeline p]; setEdToolBarButtonCbClick tbstr chkdeltrack mkfun5 @cbAnimSetupSeqDelTrack [winfrm ctrltimeline p]; setEdToolBarButtonCbClick tbstr chkaddkey mkfun5 @cbAnimSetupSeqAddKey [winfrm ctrltimeline p]; setEdToolBarButtonCbClick tbstr chkdelkey mkfun5 @cbAnimSetupSeqDelKey [winfrm ctrltimeline p]; setEdToolBarButtonCbClick tbstr chkmvleftkey mkfun5 @cbAnimSetupSeqMoveKey [winfrm ctrltimeline p (-1)]; setEdToolBarButtonCbClick tbstr chkmvrightkey mkfun5 @cbAnimSetupSeqMoveKey [winfrm ctrltimeline p 1]; setEdToolBarButtonCbClick tbstr chkzoomin mkfun5 @cbAnimSetupSeqZoomIn ctrltimeline; setEdToolBarButtonCbClick tbstr chkzoomout mkfun5 @cbAnimSetupSeqZoomOut ctrltimeline; set winAnimSetup = [animstr ewinstr tbstr chkplaypause nil]; setEdCtrlFloatEnable ctrllength 0; setEdCtrlFloatEnable ctrltrans 0; setEdCtrlFloatEnable ctrldecal 0; setEdCtrlTimeLineCbValue ctrltimeline mkfun3 @cbAnimSetupSlider nil; setEdCtrlTimeLineCbSelectKey ctrltimeline mkfun3 @cbAnimSetupSelectKey [p ctrltimeline ctrllength ctrltrans ctrldecal]; setEdCtrlCheckState ctrlloop animloop; setEdCtrlCheckCbState ctrlloop mkfun3 @cbAnimSetupLoop p; setEdCtrlCheckState ctrlskipframe skipframe; setEdCtrlCheckCbState ctrlskipframe mkfun3 @cbAnimSetupSkipFrame p; setEdCtrlCheckState ctrlenable animstate; setEdCtrlCheckCbState ctrlenable mkfun3 @cbAnimSetupEnable p; setEdCtrlFloatCbChange ctrlspeed mkfun3 @cbAnimSetupSpeed p; setEdCtrlFloatCbChange ctrlweight mkfun3 @cbAnimSetupWeight p; setEdwindowCbDestroy ewinstr mkfun2 @cbDestroyAnimSetupWin p; let V3DgetNbAnimationTracks animstr -> nbtracks in let 0 -> i in while i < nbtracks do ( let V3DgetNbAnimationTrackKeys animstr i -> nbkeys in let if nbkeys == nil then 0 else nbkeys -> nbkeys in let addEdCtrlTimeLineTrack ctrltimeline 0 -> trackstr in let 0 -> j in while j < nbkeys do ( let V3DgetSequenceAnimationKeyInfos animstr i j -> [kanimstr kpos klength ktrans kdecal] in ( addEdCtrlTimeLineKey ctrltimeline i kanimstr.V3D_sAnimName kpos klength 0; ); set j = j + 1; ); set i = i + 1; ); updateEdCtrlTimeLineTracks ctrltimeline 1; selectEdCtrlTimeLineTrack ctrltimeline (getEdCtrlTimeLineTrackByPos ctrltimeline 0); paintEdToolBar tbstr; 0; ); ); 0;; fun cbTreeMenuObjectCastShadow(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let SO3ObjectGetCastShadows obj -> meshcastshadow in ( SO3ObjectSetCastShadows obj !meshcastshadow; XMLsetParam markstr "castShadows" (XMLgetBoolString !meshcastshadow); ); 0;; fun cbTreeMenuObjectReceiveShadow(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let XMLgetBoolParam markstr "receiveShadows" -> meshreceiveshadow in ( V3DsetObjectReceiveShadows sessionstr obj !meshreceiveshadow; XMLsetParam markstr "receiveShadows" (XMLgetBoolString !meshreceiveshadow); ); 0;; fun removeObjectSons(viewstr, treenode, delmark)= let V3DgetDefaultSession viewstr -> sessionstr in let getEdCtrlTreeSonsItem ctrlSceneTree treenode -> lsons in let sizelist lsons -> size in let 0 -> i in while i < size do ( let nth_list lsons i -> treeitem in let getEdCtrlTreeValueByItem ctrlSceneTree treeitem -> [sname _] in let SO3SceneGetObject (V3DgetSession sessionstr) sname -> son in let getGraphByValue sname -> tgraph in let tgraph -> [_ type alias markstr path groupmark initstate staticgeometry] in ( removeObjectSons viewstr treeitem delmark; // remove from resources and mesh list and tree delGraphItem sname; if (type != iTypeCamera) then nil else if (son != (V3DgetViewportCamera (V3DgetDefaultViewport viewstr))) then nil else let V3DgetObjectByName sessionstr "default_camera" -> defaultcam in ( V3DsetDefaultCamera sessionstr defaultcam; V3DchangeCameraViewport sessionstr (V3DgetDefaultViewport viewstr) defaultcam; V3DenableNavigate sessionstr 1; showCameraViewport viewstr nil 0; ); if type != iTypeGroup then nil else deleteOsGroup viewstr markstr; if type != iTypeAnim then nil else let (V3DgetAnimationByName sessionstr sname) -> animstr in ( let winAnimSetup -> [lobj swinstr _ _ trm] in if animstr != lobj then nil else ( if trm == nil then nil else _deltimer trm; dsEdWindow swinstr; set winAnimSetup = nil; ); V3DdelAnimation sessionstr animstr; ); if treeitem == nil then nil else delEdCtrlTreeItem ctrlSceneTree treeitem; if !delmark then nil else XMLdelMark xmlEditSceneFile markstr; if (path == nil) || !delmark then nil else let XMLgetMarkByValueFromMarkSons groupmark "graph" -> ggraph in let XMLgetMarkByValueAndParamValueFromMark ggraph "mesh" "path" path -> resexist in if (resexist.XMLvalue != nil) then nil else let XMLgetMarkByValueFromMarkSons groupmark "resources" -> resourcesmark in let XMLgetMarkByValueAndParamValueFromMarkSons resourcesmark "resource" "path" (strlowercase path) -> resmark in ( XMLdelMark xmlEditSceneFile resmark; let switch lGroups groupmark -> groupstr in set groupstr.GRP_lLoadedResourcesFiles = remove_string_from_list groupstr.GRP_lLoadedResourcesFiles (strlowercase path); delEdCtrlList ctrlResourcesList (strlowercase path); delEdCtrlList ctrlMeshList (strlowercase path); ); let winLightSetup -> [lobj swinstr] in if son != lobj then nil else ( dsEdWindow swinstr; set winLightSetup = nil; ); let winCameraSetup -> [lobj swinstr] in if son != lobj then nil else ( dsEdWindow swinstr; set winCameraSetup = nil; ); //physics physicsDestroyNodeSetting son; let winMeshMaterialSetup -> [lobj swinstr] in if son != lobj then nil else ( dsEdWindow swinstr; set winMeshMaterialSetup = nil; ); let winSkySetup -> [skname swinstr] in if (strcmp sname skname) then nil else ( dsEdWindow swinstr; set winSkySetup = nil; ); let winParticleSetup -> [lobj swinstr _ _] in if son != lobj then nil else ( dsEdWindow swinstr; set winParticleSetup = nil; ); let winCubeMapSetup -> [lobj swinstr _ _] in if son != lobj then nil else ( dsEdWindow swinstr; set winCubeMapSetup = nil; ); let winReflectionMapSetup -> [lobj swinstr _ _] in if son != lobj then nil else ( dsEdWindow swinstr; set winReflectionMapSetup = nil; ); let winCompositorSetup -> [name swinstr] in if (strcmp sname name) then nil else ( dsEdWindow swinstr; set winCompositorSetup = nil; ); let winNodeSetup -> [lobj swinstr] in if son != lobj then nil else ( dsEdWindow swinstr; set winNodeSetup = nil; ); let winEntitySetup -> [lobj swinstr] in if son != lobj then nil else ( dsEdWindow swinstr; set winEntitySetup = nil; ); let winEntityInfo -> [lobj swinstr _] in if son != lobj then nil else ( dsEdWindow swinstr; set winEntityInfo = nil; ); V3DshowObjectHelper viewstr sessionstr son nil 0; SO3ObjectDestroy son; if type != iTypeGroup then nil else SO3GroupDelete (V3DgetSession sessionstr) sname; ); set i = i + 1; ); 0;; fun cbDlgObjectRemove(dlg, p, rep)= let p -> [viewstr val type markstr] in ( if !rep then nil else let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let getGraphByValue val -> tgraph in let tgraph -> [treeitem type alias _ path groupmark initstate staticgeometry] in ( // apply on all sons removeObjectSons viewstr treeitem 1; // refresh physic materials / do not reset anymore //updateScenePhysicsMaterialList; if (type != iTypeGroup) then nil else deleteOsGroup viewstr markstr; if (type != iTypeCamera) then nil else if (obj != (V3DgetViewportCamera (V3DgetDefaultViewport viewstr))) then nil else let V3DgetObjectByName sessionstr "default_camera" -> defaultcam in ( V3DsetDefaultCamera sessionstr defaultcam; V3DchangeCameraViewport sessionstr (V3DgetDefaultViewport viewstr) defaultcam; V3DenableNavigate sessionstr 1; showCameraViewport viewstr nil 0; ); delEdCtrlTreeItem ctrlSceneTree treeitem; XMLdelMark xmlEditSceneFile markstr; // remove from resources and mesh list and tree delGraphItem val; if path == nil then nil else if (isPathInGroup groupmark "path" path) then nil else let XMLgetMarkByValueFromMarkSons groupmark "resources" -> resourcesmark in let XMLgetMarkByValueAndParamValueFromMarkSons resourcesmark "resource" "path" (strlowercase path) -> resmark in ( XMLdelMark xmlEditSceneFile resmark; let switch lGroups groupmark -> groupstr in set groupstr.GRP_lLoadedResourcesFiles = remove_string_from_list groupstr.GRP_lLoadedResourcesFiles (strlowercase path); delEdCtrlList ctrlResourcesList (strlowercase path); delEdCtrlList ctrlMeshList (strlowercase path); ); let winLightSetup -> [lobj swinstr] in if obj != lobj then nil else ( dsEdWindow swinstr; set winLightSetup = nil; ); let winCameraSetup -> [lobj swinstr] in if obj != lobj then nil else ( dsEdWindow swinstr; set winCameraSetup = nil; ); physicsDestroyNodeSetting obj; let winMeshMaterialSetup -> [lobj swinstr] in if obj != lobj then nil else ( dsEdWindow swinstr; set winMeshMaterialSetup = nil; ); let winSkySetup -> [skname swinstr] in if (strcmp val skname) then nil else ( dsEdWindow swinstr; set winSkySetup = nil; ); let winParticleSetup -> [lobj swinstr _ _] in if obj != lobj then nil else ( dsEdWindow swinstr; set winParticleSetup = nil; ); let winCubeMapSetup -> [lobj swinstr _ _] in if obj != lobj then nil else ( dsEdWindow swinstr; set winCubeMapSetup = nil; ); let winReflectionMapSetup -> [lobj swinstr _ _] in if obj != lobj then nil else ( dsEdWindow swinstr; set winReflectionMapSetup = nil; ); let winCompositorSetup -> [name swinstr] in if (strcmp val name) then nil else ( dsEdWindow swinstr; set winCompositorSetup = nil; ); let winNodeSetup -> [lobj swinstr] in if obj != lobj then nil else ( dsEdWindow swinstr; set winNodeSetup = nil; ); let winEntitySetup -> [lobj swinstr] in if obj != lobj then nil else ( dsEdWindow swinstr; set winEntitySetup = nil; ); let winEntityInfo -> [lobj swinstr _] in if obj != lobj then nil else ( dsEdWindow swinstr; set winEntityInfo = nil; ); V3DshowObjectAxis viewstr sessionstr obj iViewerEditMode 0; V3DshowObjectHelper viewstr sessionstr obj nil 0; SO3ObjectDestroy obj; if type != iTypeGroup then nil else SO3GroupDelete (V3DgetSession sessionstr) val; resetObjHistory; ); V3DviewSetFocus viewstr; ); 0;; fun cbTreeMenuObjectRemove(mnuitem, p)= _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0059") 1 @cbDlgObjectRemove p; 0;; fun cbDlgAnimRemove(dlg, p, rep)= let p -> [viewstr item val type markstr] in ( if !rep then nil else let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in ( delEdCtrlTreeItem ctrlSceneTree item; XMLdelMark xmlEditSceneFile markstr; // remove from resources and mesh list and tree delGraphItem val; let winAnimSetup -> [lanimstr swinstr _ _ trm] in if animstr != lanimstr then nil else ( if trm == nil then nil else _deltimer trm; dsEdWindow swinstr; set winAnimSetup = nil; ); V3DdelAnimation sessionstr animstr; ); V3DviewSetFocus viewstr; ); 0;; fun cbTreeMenuAnimRemove(mnuitem, p)= _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0057") 1 @cbDlgAnimRemove p; 0;; /** cbDestroySkySetupWin [EdWindow] I * callback on destroy sky setting window * * private * * return 0 **/ fun cbDestroySkySetupWin(winstr)= set winSkySetup = nil; 0;; fun cbSkySetupMaterial(ctrl, pos, elem, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup elem -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> skyboxqx in let atof XMLgetParam skyboxrotstr "qy" -> skyboxqy in let atof XMLgetParam skyboxrotstr "qz" -> skyboxqz in let atof XMLgetParam skyboxrotstr "qw" -> skyboxqw in ( XMLsetParam markstr "material" elem; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [skyboxqx skyboxqy skyboxqz skyboxqw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [skyboxqx skyboxqy skyboxqz skyboxqw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] scale tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupTiling(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "tiling" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) value xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] scale value (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupSegmentX(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "xSegments" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling (ftoi value) ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] scale tiling (if bow != nil then bow else 0.0) (ftoi value) ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupSegmentY(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "ySegments" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments (ftoi value) (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] scale tiling (if bow != nil then bow else 0.0) xsegments (ftoi value) resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupDistance(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "distance" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat value [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat value [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] scale tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupCurvature(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "curvature" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] value tiling xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] scale tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupScale(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "scale" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] value tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupBow(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "bow" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] scale tiling value xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupPlaneX(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "planeX" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [value planey planez] scale tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupPlaneY(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "planeY" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex value planez] scale tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupPlaneZ(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "planeZ" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey value] scale tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupPlaneD(ctrl, value, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetParam markstr "material" -> matname in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "planeD" XMLgetShortFloatToString value; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat value [planex planey planez] scale tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; fun cbSkySetupOrientation(ctrl, value, p)= let p -> [[viewstr item val type markstr] [ctrlx ctrly ctrlz]] in let getEdCtrlFloatValue ctrlx -> xval in let getEdCtrlFloatValue ctrly -> yval in let getEdCtrlFloatValue ctrlz -> zval in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let XMLgetParam markstr "material" -> matname in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let SO3MathsQuatFromDegreeAngle [xval yval zval] -> [qx qy qz qw] in let SO3MathsQuatGetDegreePitch [qx qy qz qw] 1 -> xov in let SO3MathsQuatGetDegreeYaw [qx qy qz qw] 1 -> yov in let SO3MathsQuatGetDegreeRoll [qx qy qz qw] 1 -> zov in ( setEdCtrlFloatValue ctrlx xov; setEdCtrlFloatValue ctrly yov; setEdCtrlFloatValue ctrlz zov; XMLsetParam skyboxrotstr "qx" XMLgetShortFloatToString qx; XMLsetParam skyboxrotstr "qy" XMLgetShortFloatToString qy; XMLsetParam skyboxrotstr "qz" XMLgetShortFloatToString qz; XMLsetParam skyboxrotstr "qw" XMLgetShortFloatToString qw; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup skyboxenable skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] scale tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable skyboxdrawfirst; 0; ); ); 0;; /** cbSkySetupDrawFirst [EdControl F [V3Dview S I XMLmark]] I * callback on sky drawfirst change * * private * * return 0 **/ fun cbSkySetupDrawFirst(ctrl, state, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let XMLgetParam markstr "material" -> matname in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "drawFirst" XMLgetBoolString state; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup skyboxenable state; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup skyboxenable state; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] scale tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup skyboxenable state; 0; ); ); 0;; /** cbSkySetupEnable [EdControl F [V3Dview S I XMLmark]] I * callback on sky drawfirst change * * private * * return 0 **/ fun cbSkySetupEnable(ctrl, state, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let XMLgetParam markstr "material" -> matname in let atof (XMLgetParam markstr "distance") -> distance in let XMLgetBoolParam markstr "enable" -> skyboxenable in let XMLgetBoolParam markstr "drawFirst" -> skyboxdrawfirst in let atof (XMLgetParam markstr "tiling") -> tiling in let atoi (XMLgetParam markstr "xSegments") -> xsegments in let atoi (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "bow") -> bow in let atof (XMLgetParam markstr "scale") -> scale in let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> skymat in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> qx in let atof XMLgetParam skyboxrotstr "qy" -> qy in let atof XMLgetParam skyboxrotstr "qz" -> qz in let atof XMLgetParam skyboxrotstr "qw" -> qw in ( XMLsetParam markstr "enable" XMLgetBoolString state; if type == iTypeSkyBox then ( SO3SceneSetSkyBox (V3DgetSession sessionstr) skymat distance [qx qy qz qw] resgroup state skyboxdrawfirst; 0; ) else if type == iTypeSkyDome then ( SO3SceneSetSkyDome (V3DgetSession sessionstr) skymat distance [qx qy qz qw] (if curvature != nil then curvature else 0.0) tiling xsegments ysegments (-1) resgroup state skyboxdrawfirst; 0; ) else ( SO3SceneSetSkyPlane (V3DgetSession sessionstr) skymat planed [planex planey planez] scale tiling (if bow != nil then bow else 0.0) xsegments ysegments resgroup state skyboxdrawfirst; 0; ); ); 0;; fun cbTreeMenuSkyEditParameters(mnuitem, p)= let p -> [viewstr item val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in ( if winSkySetup == nil then nil else ( let winSkySetup -> [sname winstr] in dsEdWindow winstr; set winSkySetup = nil; ); let [320 312] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let XMLgetBoolParam markstr "enable" -> state in let XMLgetBoolParam markstr "drawFirst" -> drawfirst in let XMLgetParam markstr "material" -> matname in let atof (XMLgetParam markstr "distance") -> distance in let atof (XMLgetParam markstr "tiling") -> tiling in let atof (XMLgetParam markstr "xSegments") -> xsegments in let atof (XMLgetParam markstr "ySegments") -> ysegments in let atof (XMLgetParam markstr "curvature") -> curvature in let atof (XMLgetParam markstr "planeX") -> planex in let atof (XMLgetParam markstr "planeY") -> planey in let atof (XMLgetParam markstr "planeZ") -> planez in let atof (XMLgetParam markstr "planeD") -> planed in let atof (XMLgetParam markstr "scale") -> scale in let atof (XMLgetParam markstr "bow") -> bow in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> skyboxrotstr in let atof XMLgetParam skyboxrotstr "qx" -> skyboxqx in let atof XMLgetParam skyboxrotstr "qy" -> skyboxqy in let atof XMLgetParam skyboxrotstr "qz" -> skyboxqz in let atof XMLgetParam skyboxrotstr "qw" -> skyboxqw in let SO3MathsQuatGetDegreePitch [skyboxqx skyboxqy skyboxqz skyboxqw] 1 -> xov in let SO3MathsQuatGetDegreeYaw [skyboxqx skyboxqy skyboxqz skyboxqw] 1 -> yov in let SO3MathsQuatGetDegreeRoll [skyboxqx skyboxqy skyboxqz skyboxqw] 1 -> zov in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let getGroupName currentProject groupmark -> resgroup in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0399") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 12 190 20 (loc "OS3D_0243") nil -> labelint in let crEdCtrlSelect winstr 210 10 100 120 EDWIN_RESIZE_MW -> ctrlmat in let crEdCtrlLabel winstr 10 37 190 20 (loc "OS3D_0119") nil -> labeldist in let crEdCtrlFloat winstr 210 35 100 20 distance 0.0 100000000.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrldistance in let crEdCtrlLabel winstr 10 62 190 20 (loc "OS3D_0430") nil -> labeltiling in let crEdCtrlFloat winstr 210 60 100 20 tiling 0.0 10000.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrltiling in let crEdCtrlLabel winstr 10 87 160 20 (loc "OS3D_0361") nil -> labelseg in let crEdCtrlFloat winstr 185 85 60 20 xsegments 0.0 1024.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlsegx in let crEdCtrlFloat winstr 250 85 60 20 ysegments 0.0 1024.0 1.0 0 nil EDWIN_RESIZE_MW -> ctrlsegy in let crEdCtrlLabel winstr 10 112 100 20 (loc "OS3D_0107") nil -> labelcurv in let crEdCtrlFloat winstr 210 110 100 20 curvature 0.0 100.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlcurv in let crEdCtrlLabel winstr 10 137 100 20 (loc "OS3D_0289") nil -> labelor in let crEdCtrlFloat winstr 120 135 60 20 xov (-.720.0) 720.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlorx in let crEdCtrlFloat winstr 185 135 60 20 yov (-.720.0) 720.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlory in let crEdCtrlFloat winstr 250 135 60 20 zov (-.720.0) 720.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlorz in let crEdCtrlLabel winstr 10 162 100 20 (loc "OS3D_0492") nil -> labelplanex in let crEdCtrlFloat winstr 120 160 60 20 planex (-.100000000.0) 100000000.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlplanex in let crEdCtrlFloat winstr 185 160 60 20 planey (-.100000000.0) 100000000.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlplaney in let crEdCtrlFloat winstr 250 160 60 20 planez (-.100000000.0) 100000000.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlplanez in let crEdCtrlLabel winstr 10 187 190 20 (loc "OS3D_0493") nil -> labelplaned in let crEdCtrlFloat winstr 210 185 100 20 planed (-.100000000.0) 100000000.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlplaned in let crEdCtrlLabel winstr 10 212 190 20 (loc "OS3D_0080") nil -> labelcurv in let crEdCtrlFloat winstr 210 210 100 20 bow 0.0 20.0 0.1 3 nil EDWIN_RESIZE_MW -> ctrlbow in let crEdCtrlLabel winstr 10 237 190 20 (loc "OS3D_0355") nil -> labelplanex in let crEdCtrlFloat winstr 210 235 100 20 scale 0.0 100000.0 1.0 3 nil EDWIN_RESIZE_MW -> ctrlscale in let crEdCtrlCheck winstr 10 262 190 20 (loc "OS3D_0123") EDWIN_RESIZE_MW -> ctrldrawfirst in let crEdCtrlCheck winstr 10 287 190 20 (loc "OS3D_0139") EDWIN_RESIZE_MW -> ctrlenable in ( set winSkySetup = [val dwinstr]; setEdCtrlSelectEnable ctrlmat 1; if type == iTypeSkyBox then ( setEdCtrlFloatEnable ctrltiling 0; setEdCtrlFloatEnable ctrlsegx 0; setEdCtrlFloatEnable ctrlsegy 0; setEdCtrlFloatEnable ctrlplanex 0; setEdCtrlFloatEnable ctrlplaney 0; setEdCtrlFloatEnable ctrlplanez 0; setEdCtrlFloatEnable ctrlplaned 0; setEdCtrlFloatEnable ctrlcurv 0; setEdCtrlFloatEnable ctrlbow 0; setEdCtrlFloatEnable ctrlscale 0; ) else if type == iTypeSkyDome then ( setEdCtrlFloatEnable ctrlplanex 0; setEdCtrlFloatEnable ctrlplaney 0; setEdCtrlFloatEnable ctrlplanez 0; setEdCtrlFloatEnable ctrlplaned 0; setEdCtrlFloatEnable ctrlbow 0; setEdCtrlFloatEnable ctrlscale 0; ) else ( setEdCtrlFloatEnable ctrlcurv 0; setEdCtrlFloatEnable ctrldistance 0; setEdCtrlFloatEnable ctrlorx 0; setEdCtrlFloatEnable ctrlory 0; setEdCtrlFloatEnable ctrlorz 0; ); let SO3SceneParseMaterialsFromGroup (V3DgetSession sessionstr) resgroup -> l in let sizelist l -> size in let nil -> lmats in let 0 -> i in ( while i < size do ( let nth_list l i -> mat in let SO3MaterialGetName mat -> name in set lmats = name::lmats; set i = i + 1; ); fillEdCtrlSelect ctrlmat quicksort lmats @suppDoublon; selectEdCtrlSelect ctrlmat matname; if (matname != nil) && (strcmp matname "") then nil else cbSkySetupMaterial ctrlmat 0 hd lmats p; ); setEdCtrlCheckState ctrldrawfirst drawfirst; setEdCtrlCheckState ctrlenable state; setEdCtrlSelectCb ctrlmat mkfun4 @cbSkySetupMaterial p; setEdCtrlFloatCbChange ctrldistance mkfun3 @cbSkySetupDistance p; setEdCtrlFloatCbChange ctrltiling mkfun3 @cbSkySetupTiling p; setEdCtrlFloatCbChange ctrlsegx mkfun3 @cbSkySetupSegmentX p; setEdCtrlFloatCbChange ctrlsegy mkfun3 @cbSkySetupSegmentY p; setEdCtrlFloatCbChange ctrlcurv mkfun3 @cbSkySetupCurvature p; setEdCtrlFloatCbChange ctrlscale mkfun3 @cbSkySetupScale p; setEdCtrlFloatCbChange ctrlplanex mkfun3 @cbSkySetupPlaneX p; setEdCtrlFloatCbChange ctrlplaney mkfun3 @cbSkySetupPlaneY p; setEdCtrlFloatCbChange ctrlplanez mkfun3 @cbSkySetupPlaneZ p; setEdCtrlFloatCbChange ctrlplaned mkfun3 @cbSkySetupPlaneD p; setEdCtrlFloatCbChange ctrlbow mkfun3 @cbSkySetupBow p; setEdCtrlFloatCbValidate ctrlorx mkfun3 @cbSkySetupOrientation [p [ctrlorx ctrlory ctrlorz]]; setEdCtrlFloatCbValidate ctrlory mkfun3 @cbSkySetupOrientation [p [ctrlorx ctrlory ctrlorz]]; setEdCtrlFloatCbValidate ctrlorz mkfun3 @cbSkySetupOrientation [p [ctrlorx ctrlory ctrlorz]]; setEdCtrlCheckCbState ctrldrawfirst mkfun3 @cbSkySetupDrawFirst p; setEdCtrlCheckCbState ctrlenable mkfun3 @cbSkySetupEnable p; setEdwindowCbDestroy dwinstr @cbDestroySkySetupWin; 0; ); ); 0;; fun cbDlgSkyBoxRemove(dlg, p, rep)= if !rep then nil else let p -> [viewstr treeitem val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in ( delEdCtrlTreeItem ctrlSceneTree treeitem; XMLdelMark xmlEditSceneFile markstr; SO3SceneSetSkyBoxEnable (V3DgetSession sessionstr) 0; delGraphItem val; let winSkySetup -> [skname swinstr] in if strcmp val skname then nil else ( dsEdWindow swinstr; set winSkySetup = nil; ); ); 0;; fun cbTreeMenuSkyBoxRemove(mnuitem, p)= _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0061") 1 @cbDlgSkyBoxRemove p; 0;; fun cbDlgSkyDomeRemove(dlg, p, rep)= if !rep then nil else let p -> [viewstr treeitem val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in ( delEdCtrlTreeItem ctrlSceneTree treeitem; XMLdelMark xmlEditSceneFile markstr; SO3SceneSetSkyDomeEnable (V3DgetSession sessionstr) 0; delGraphItem val; let winSkySetup -> [skname swinstr] in if strcmp val skname then nil else ( dsEdWindow swinstr; set winSkySetup = nil; ); ); 0;; fun cbTreeMenuSkyDomeRemove(mnuitem, p)= _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0062") 1 @cbDlgSkyDomeRemove p; 0;; fun cbDlgSkyPlanRemove(dlg, p, rep)= if !rep then nil else let p -> [viewstr treeitem val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in ( delEdCtrlTreeItem ctrlSceneTree treeitem; XMLdelMark xmlEditSceneFile markstr; SO3SceneSetSkyPlaneEnable (V3DgetSession sessionstr) 0; delGraphItem val; let winSkySetup -> [skname swinstr] in if strcmp val skname then nil else ( dsEdWindow swinstr; set winSkySetup = nil; ); ); 0;; fun cbTreeMenuSkyPlanRemove(mnuitem, p)= _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0063") 1 @cbDlgSkyPlanRemove p; 0;; fun cbDlgCompositorRemove(dlg, p, rep)= if !rep then nil else let p -> [viewstr treeitem val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let (V3DgetDefaultViewport viewstr) -> viewportstr in let XMLgetParam markstr "name" -> compname in ( delEdCtrlTreeItem ctrlSceneTree treeitem; XMLdelMark xmlEditSceneFile markstr; SO3ViewportRemoveCompositor viewportstr.V3D_viewport compname; delGraphItem val; let winCompositorSetup -> [name swinstr] in if strcmp val name then nil else ( dsEdWindow swinstr; set winCompositorSetup = nil; ); ); 0;; fun cbTreeMenuCompositorRemove(mnuitem, p)= _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0056") 1 @cbDlgCompositorRemove p; 0;; fun cbTreeMenuObjectEnable(mnuitem, p)= let p -> [viewstr val type markstr] in let XMLgetBoolParam markstr "enable" -> state in ( setGraphItemInitState val !state; XMLsetParam markstr "enable" XMLgetBoolString !state; ); 0;; fun cbTreeMenuObjectHidden(mnuitem, p)= let p -> [viewstr treeitem obj val type markstr] in let XMLgetBoolParam markstr "hidden" -> hidden in ( XMLsetParam markstr "hidden" (XMLgetBoolString !hidden); applyNodeVisibility obj type hidden; updateSceneTreeBitmap treeitem type hidden; ); 0;; fun isolateSelectionFromNode(name, l, state, mode)= while (l != nil) do ( let hd l -> child in let SO3ObjectGetName child -> cname in let getGraphByValue cname -> [treeitem type alias markstr _ groupmark _ _] in if (markstr == nil) then nil else ( if (state) then ( SO3ObjectSetVisible child (if (!strcmp name cname) then 1 else 0) mode; 0; ) else ( let XMLgetBoolParam markstr "hidden" -> hidden in applyNodeVisibility child type !hidden; ); if ((!strcmp name cname) && mode) then nil else isolateSelectionFromNode name (SO3ObjectGetChildren child) state mode; ); set l = tl l; ); 0;; fun isolateSelection(sessionstr, name, state, mode)= let SO3ObjectGetSceneRoot (V3DgetSession sessionstr) -> rootnode in isolateSelectionFromNode name (SO3ObjectGetChildren rootnode) state mode; 0;; fun cbTreeMenuObjectIsolate(mnuitem, p)= let p -> [viewstr val type markstr] in ( let if (type == iTypeGroup || type == iTypeNode || type == iTypeLight || type == iTypeCamera || type == iTypeCubeMap || type == iTypeReflectionMap) then 1 else 0 -> mode in let V3DgetDefaultSession viewstr -> sessionstr in if (type != iTypeScene) && (val != nil) && (strcmp val sIsolatedNode) then ( set sIsolatedNode = val; isolateSelection sessionstr val 1 mode; ) else ( set sIsolatedNode = nil; isolateSelection sessionstr val 0 mode; ); ); 0;; /** cbDestroyParticleSetupWin [EdWindow] I * callback on destroy particle setting window * * private * * return 0 **/ fun cbDestroyParticleSetupWin(winstr, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> partsystem in ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; ); set winParticleSetup = nil; 0;; fun cbParticleSetupEnable(ctrl, state, p)= let p -> [viewstr val type markstr] in ( XMLsetParam markstr "enable" XMLgetBoolString state; setGraphItemInitState val state; ); 0;; fun cbParticleSetupSpeed(ctrl, value, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> partsystem in ( XMLsetParam markstr "speed" XMLgetShortFloatToString value; SO3ParticleSystemSetSpeedFactor partsystem value; ); 0;; fun cbParticleSetupPlayPause(tbstr, check, btn, mask, state, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> partsystem in ( if state then ( if (SO3ParticleSystemGetEnable partsystem) then nil else SO3ParticleSystemSetEnable partsystem 1; SO3ParticleSystemSetPause partsystem 0; ) else ( SO3ParticleSystemSetPause partsystem 1; ); ); 0;; fun cbParticleSetupStop(tbstr, check, btn, mask, p)= let p -> [[viewstr val type markstr] chkplaypause] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> partsystem in ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; setEdToolBarCheckState tbstr chkplaypause 0; ); 0;; fun cbTreeMenuParticleEditParameters(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> partsystem in let winParticleSetup -> [wobj owinstr _ _] in if wobj == partsystem then nil else ( if winParticleSetup == nil then nil else ( dsEdWindow owinstr; set winParticleSetup = nil; ); let [280 138] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let XMLgetBoolParam markstr "enable" -> partenable in let atof (XMLgetParam markstr "speed") -> partspeed in let atof (XMLgetParam markstr "renderingDistance") -> dist in let XMLgetParam markstr "template" -> template in let 10 -> ypos in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0291") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 (ypos + 2) (iw - 20) 20 strcatn (loc "OS3D_0811")::": "::template::nil nil -> labeltemplate in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 160 20 (loc "OS3D_0407") nil -> labelspeed in let crEdCtrlFloat winstr 180 ypos 90 20 partspeed 0.0 100000.0 0.1 6 nil EDWIN_RESIZE_MW -> ctrlspeed in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 140 20 (loc "OS3D_0118") nil -> labelvisibility in let crEdCtrlFloat winstr 180 ypos 90 20 dist 0.0 1000000.0 0.1 6 nil EDWIN_RESIZE_MW -> ctrldist in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) + 2 (iw - 20) 20 (loc "OS3D_0139") EDWIN_RESIZE_MW -> ctrlenable in let crEdWindowToolBar winstr 0 (ih-28) iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_playpause.png" -> aplaypause in let crEdToolBarCheck tbstr aplaypause ETB_ALIGN_LEFT (loc "OS3D_0303") nil -> chkplaypause in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_stop.png" -> astop in let crEdToolBarButton tbstr astop ETB_ALIGN_LEFT (loc "OS3D_0411") nil -> chkstop in ( setEdToolBarVisible tbstr 1; setEdToolBarCheckCbClick tbstr chkplaypause mkfun6 @cbParticleSetupPlayPause p; setEdToolBarButtonCbClick tbstr chkstop mkfun5 @cbParticleSetupStop [p chkplaypause]; set winParticleSetup = [partsystem dwinstr tbstr chkplaypause]; setEdCtrlFloatCbChange ctrldist mkfun3 @cbObjectSetupRenderVisibility p; setEdCtrlCheckState ctrlenable partenable; setEdCtrlFloatCbChange ctrlspeed mkfun3 @cbParticleSetupSpeed p; setEdCtrlCheckCbState ctrlenable mkfun3 @cbParticleSetupEnable p; setEdwindowCbDestroy dwinstr mkfun2 @cbDestroyParticleSetupWin p; paintEdToolBar tbstr; 0; ); ); 0;; /** cbDestroyCompositorSetupWin [EdWindow] I * callback on destroy compositor setting window * * private * * return 0 **/ fun cbDestroyCompositorSetupWin(winstr, p)= let p -> [viewstr val type markstr play] in let V3DgetDefaultSession viewstr -> sessionstr in let (V3DgetDefaultViewport viewstr) -> viewportstr in SO3ViewportRemoveCompositor viewportstr.V3D_viewport val; set winCompositorSetup = nil; 0;; fun cbCompositorSetupEnable(ctrl, state, p)= let p -> [viewstr val type markstr play] in ( XMLsetParam markstr "enable" XMLgetBoolString state; setGraphItemInitState val state; ); 0;; fun cbCompositorSetupPlayStop(tbstr, check, btn, mask, state, p)= let p -> [viewstr val type markstr play] in let XMLgetParam markstr "scheme" -> compschemename in let (V3DgetDefaultViewport viewstr) -> viewportstr in ( if state then ( SO3ViewportAddCompositor viewportstr.V3D_viewport val compschemename; ) else ( SO3ViewportRemoveCompositor viewportstr.V3D_viewport val; ); mutate p <- [_ _ _ _ state]; ); 0;; fun cbCompositorSetupScheme(ctrl, pos, schemename, p)= let p -> [viewstr val type markstr play] in let if pos == 0 then nil else schemename -> schemename in let XMLgetParam markstr "name" -> compositorname in ( XMLsetParam markstr "scheme" schemename; if !play then nil else let (V3DgetDefaultViewport viewstr) -> viewportstr in ( SO3ViewportRemoveCompositor viewportstr.V3D_viewport compositorname; SO3ViewportAddCompositor viewportstr.V3D_viewport compositorname schemename; ); ); 0;; fun cbTreeMenuCompositorEditParameters(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let winCompositorSetup -> [name owinstr] in if !strcmp name val then nil else ( if winCompositorSetup == nil then nil else ( dsEdWindow owinstr; set winCompositorSetup = nil; ); let [400 118] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let XMLgetBoolParam markstr "enable" -> compenable in let XMLgetParam markstr "scheme" -> schemename in let lcat (V3DgetDefaultCompositorsList sessionstr) (SO3SceneParseCompositorsFromGroup (V3DgetSession sessionstr) "Scene") -> lcompname in let let nil -> nl in ( let sizelist lcompname -> size in let 0 -> i in while i < size do ( let nth_list lcompname i -> compname in set nl =compname::nl; set i = i + 1; ); quicksort nl @suppDoublon ) -> lcompname in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0099") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let 10 -> ypos in let crEdCtrlLabel winstr 10 (ypos + 2) 200 20 (loc "OS3D_0363") nil -> labelcomp in let crEdCtrlSelect winstr 220 ypos (iw - 230) 120 CB_AHSCROLL -> ctrlselect in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 200 20 (loc "OS3D_0360") nil -> labelscheme in let crEdCtrlSelect winstr 220 ypos (iw - 230) 120 EDWIN_RESIZE_MW -> ctrlscheme in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 (loc "OS3D_0139") EDWIN_RESIZE_MW -> ctrlenable in let crEdWindowToolBar winstr 0 (ih-28) iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_playpause.png" -> aplaypause in let crEdToolBarCheck tbstr aplaypause ETB_ALIGN_LEFT (loc "OS3D_0303") nil -> chkplaypause in let [viewstr val type markstr 0] -> p in ( fillEdCtrlSelect ctrlscheme "all"::(getAllMaterialScheme viewstr); if (schemename == nil) || (!strcmp "" schemename) then selectEdCtrlSelectByPos ctrlscheme 0 else selectEdCtrlSelect ctrlscheme schemename; setEdCtrlSelectCb ctrlscheme mkfun4 @cbCompositorSetupScheme p; setEdToolBarVisible tbstr 1; fillEdCtrlSelect ctrlselect lcompname; selectEdCtrlSelect ctrlselect val; setEdCtrlSelectEnable ctrlselect 0; setEdToolBarCheckCbClick tbstr chkplaypause mkfun6 @cbCompositorSetupPlayStop p; set winCompositorSetup = [val dwinstr]; setEdCtrlCheckState ctrlenable compenable; setEdCtrlCheckCbState ctrlenable mkfun3 @cbCompositorSetupEnable p; setEdwindowCbDestroy dwinstr mkfun2 @cbDestroyCompositorSetupWin p; paintEdToolBar tbstr; 0; ); ); 0;; fun cbTreeMenuImport(mnuitem, p)= let p -> [viewstr val type markstr item] in importSceneWizard viewstr markstr val item nil; // _DLGrflopen _DLGOpenFile _channel mainInterf.MINT_winMain.EDW_win sLastDirectory nil "Scene format\0*.scene;*.xos\0Ogre scene\0*.scene\0OpenSpace3D scene\0*.xos\0All\0*.*\0\0" @cbDlgImportScene [viewstr markstr val item]; 0;; fun cbTreeMenuAddResources(mnuitem, p)= let p -> [viewstr val type markstr item] in let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [750 450] -> [iw ih] in let crEdOpenFileDialogMulti _channel mainInterf.MINT_winMain nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (loc "OS3D_0285") ["All" "*.*"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil sLastDirectory -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdOpenFileDialogCbMulti dlgfstr mkfun2 @cbDlgAddResources [viewstr markstr val item]; ); 0;; fun cbTreeMenuAddMesh(mnuitem, p)= let p -> [viewstr val type markstr item] in importMeshWizard viewstr markstr val type item nil; //_DLGrflopen _DLGOpenFile _channel mainInterf.MINT_winMain.EDW_win sLastDirectory nil "Ogre mesh\0*.mesh\0All\0*.*\0\0" @cbDlgAddMesh [viewstr markstr val type item]; 0;; fun cbTreeMenuClone(mnuitem, p)= let p -> [viewstr val type markstr groupmark item] in cloneNode viewstr val type markstr groupmark item; 0;; fun cbTreeMenuAddSkyBox(mnuitem, p)= let p -> [viewstr val type markstr item] in let XMLgetMarkByValueFromMarkSons markstr "environment" -> envmark in let XMLaddMark xmlEditSceneFile "skyBox" envmark ["enable" (XMLgetBoolString 0)]::["material" ""]::["distance" "1000"]::["drawFirst" (XMLgetBoolString 1)]::nil nil -> skymark in let addGraphItem "SkyBox" "SkyBox" iTypeSkyBox nil skymark nil markstr item 1 0 -> treenode in ( XMLaddMark xmlEditSceneFile "rotation" skymark ["qx" "0"]::["qy" "0"]::["qz" "0"]::["qw" "1"]::nil nil; selEdCtrlTreeItem ctrlSceneTree treenode; cbTreeMenuSkyEditParameters treenode [viewstr item "SkyBox" iTypeSkyBox skymark]; ); 0;; fun cbTreeMenuAddSkyDome(mnuitem, p)= let p -> [viewstr val type markstr item] in let XMLgetMarkByValueFromMarkSons markstr "environment" -> envmark in let XMLaddMark xmlEditSceneFile "skyDome" envmark ["enable" (XMLgetBoolString 0)]::["material" ""]::["tiling" "4"]::["distance" "1000"]::["drawFirst" (XMLgetBoolString 1)]::["curvature" "1"]::["xSegments" "32"]::["ySegments" "16"]::nil nil -> skymark in let addGraphItem "SkyDome" "SkyDome" iTypeSkyDome nil skymark nil markstr item 1 0 -> treenode in ( XMLaddMark xmlEditSceneFile "rotation" skymark ["qx" "0"]::["qy" "0"]::["qz" "0"]::["qw" "1"]::nil nil; selEdCtrlTreeItem ctrlSceneTree treenode; cbTreeMenuSkyEditParameters treenode [viewstr item "skyDome" iTypeSkyDome skymark]; ); 0;; fun cbTreeMenuAddSkyPlane(mnuitem, p)= let p -> [viewstr val type markstr item] in let XMLgetMarkByValueFromMarkSons markstr "environment" -> envmark in let XMLaddMark xmlEditSceneFile "skyPlane" envmark ["enable" (XMLgetBoolString 0)]::["material" ""]::["planeX" "0"]::["planeY" "1"]::["planeZ" "0"]::["planeD" "200"]::["scale" "120"]::["tiling" "2"]::["drawFirst" (XMLgetBoolString 1)]::["bow" "0"]::["xSegments" "4"]::["ySegments" "4"]::nil nil -> skymark in let addGraphItem "SkyPlane" "SkyPlane" iTypeSkyPlane nil skymark nil markstr item 1 0 -> treenode in ( selEdCtrlTreeItem ctrlSceneTree treenode; cbTreeMenuSkyEditParameters treenode [viewstr item "SkyPlane" iTypeSkyPlane skymark]; ); 0;; fun cbAddCompositor(ctrlstr, p2)= let p2 -> [winstr ctrlselect chkplaypause p lastcompo] in let p -> [viewstr val type markstr item] in let getSelectedEdCtrlSelect ctrlselect -> compname in let XMLgetMarkByValueFromMarkSons markstr "environment" -> envmark in let XMLaddMark xmlEditSceneFile "compositor" envmark ["name" compname]::["enable" XMLgetBoolString 0]::nil nil -> compmark in let addGraphItem strcatn "Compositor \""::compname::"\""::nil compname iTypeCompositor nil compmark nil markstr item 0 0 -> treenode in ( if (lastcompo == nil) then nil else let (V3DgetDefaultViewport viewstr) -> viewportstr in SO3ViewportRemoveCompositor viewportstr.V3D_viewport lastcompo; selEdCtrlTreeItem ctrlSceneTree treenode; dsEdWindow winstr; ); 0;; fun cbBtnDestroyAddCompositorWin(winstr, p2)= let p2 -> [winstr ctrlselect chkplaypause p lastcompo] in let p -> [viewstr _ _ _ _] in ( if (lastcompo == nil) then nil else let (V3DgetDefaultViewport viewstr) -> viewportstr in SO3ViewportRemoveCompositor viewportstr.V3D_viewport lastcompo; ); 0;; fun cbBtnCancelAddCompositor(ctrlbtn, p2)= let p2 -> [winstr ctrlselect chkplaypause p lastcompo] in let p -> [viewstr _ _ _ _] in ( if (lastcompo == nil) then nil else let (V3DgetDefaultViewport viewstr) -> viewportstr in SO3ViewportRemoveCompositor viewportstr.V3D_viewport lastcompo; dsEdWindow winstr; ); 0;; fun cbCompositorAddSelect(ctrl, pos, compname, p2)= let p2 -> [winstr ctrlselect chkplaypause p lastcompo] in let p -> [viewstr _ _ _ _] in ( if (lastcompo == nil) then nil else let (V3DgetDefaultViewport viewstr) -> viewportstr in ( SO3ViewportRemoveCompositor viewportstr.V3D_viewport lastcompo; SO3ViewportAddCompositor viewportstr.V3D_viewport compname nil; mutate p2 <- [_ _ _ _ compname]; ); ); 0;; fun cbCompositorAddPlayStop(tbstr, check, btn, mask, state, p2)= let p2 -> [winstr ctrlselect chkplaypause p lastcompo] in let p -> [viewstr _ _ _ _] in let (V3DgetDefaultViewport viewstr) -> viewportstr in ( if state then let getSelectedEdCtrlSelect ctrlselect -> compname in ( SO3ViewportAddCompositor viewportstr.V3D_viewport compname nil; mutate p2 <- [_ _ _ _ compname]; ) else ( SO3ViewportRemoveCompositor viewportstr.V3D_viewport lastcompo; mutate p2 <- [_ _ _ _ nil]; ); ); 0;; fun cbTreeMenuAddCompositor(mnuitem, p)= let p -> [viewstr val type markstr item] in let XMLgetMarkByValueFromMarkSons markstr "environment" -> envmark in let V3DgetDefaultSession viewstr -> sessionstr in let lcat (V3DgetDefaultCompositorsList sessionstr) (SO3SceneParseCompositorsFromGroup (V3DgetSession sessionstr) "Scene") -> lcompname in let XMLgetMarksParamValueByValueAndParamFromMarkSons envmark "compositor" "name" -> lp in let let nil -> nl in ( let sizelist lcompname -> size in let 0 -> i in while i < size do ( let nth_list lcompname i -> compname in if (isStringInList lp compname) then nil else set nl = compname::nl; set i = i + 1; ); quicksort nl @suppDoublon; ) -> lcompname in if lcompname == nil then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0270") 0; 0; ) else ( let [400 90] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0021")) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 12 200 20 (loc "OS3D_0363") nil -> labelcomp in let crEdCtrlSelect winstr 220 10 (iw - 260) 120 CB_AHSCROLL -> ctrlselect in let crEdWindowToolBar winstr (220 + (iw - 260) + 6) 9 24 24 0 0 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_playpause.png" -> aplaypause in let crEdToolBarCheck tbstr aplaypause ETB_ALIGN_LEFT (loc "OS3D_0303") nil -> chkplaypause in let [dwinstr ctrlselect chkplaypause p nil] -> p2 in ( setEdToolBarVisible tbstr 1; setEdToolBarCheckCbClick tbstr chkplaypause mkfun6 @cbCompositorAddPlayStop p2; fillEdCtrlSelect ctrlselect lcompname; setEdCtrlSelectCb ctrlselect mkfun4 @cbCompositorAddSelect p2; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 @cbAddCompositor p2; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancelAddCompositor p2; setEdwindowCbDestroy dwinstr mkfun2 @cbBtnDestroyAddCompositorWin p2; paintEdToolBar tbstr; ); 0; ); 0;; fun cbAddParticleSystem(ctrlstr, d, p)= let p -> [winstr ctrltext ctrlselect [viewstr val type markstr item groupmark]] in let getSelectedEdCtrlSelect ctrlselect -> tplname in let getEdCtrlTextLineValue ctrltext -> name in if (name == nil) || (!strcmp "" (strtrim name)) then nil else ( let if (type == iTypeGroup || type == iTypeScene) then XMLgetMarkByValueFromMarkSons markstr "graph" else markstr -> destmark in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let if (type == iTypeGroup || type == iTypeScene) then markstr else groupmark -> groupmark in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let itoa (getNewSceneIndex nil) -> id in let XMLaddMark xmlEditSceneFile "particle" destmark ["id" id]::["name" name]::["template" tplname]::["renderingDistance" "0"]::["enable" (XMLgetBoolString 0)]::["speed" (XMLgetShortFloatToString 1.0)]::nil nil -> partmark in let addGraphItem (strcatn name::" #"::id::nil) (strcatn id::"."::name::nil) iTypeParticle nil partmark nil groupmark item 0 0 -> treenode in let V3DaddParticleSystem sessionstr (strcatn id::"."::name::nil) tplname -> partsystem in ( if father == nil then nil else SO3ObjectLink partsystem father; XMLaddMark xmlEditSceneFile "position" partmark ["x" "0"]::["y" "0"]::["z" "0"]::nil nil; XMLaddMark xmlEditSceneFile "rotation" partmark ["qx" "0"]::["qy" "0"]::["qz" "0"]::["qw" "1"]::nil nil; XMLaddMark xmlEditSceneFile "scale" partmark ["x" "1"]::["y" "1"]::["z" "1"]::nil nil; SO3ParticleSystemSetSpeedFactor partsystem 1.0; SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; V3DshowObjectHelper viewstr sessionstr partsystem iTypeParticle 1; selEdCtrlTreeItem ctrlSceneTree treenode; cbTreeMenuParticleEditParameters treenode [viewstr (strcatn id::"."::name::nil) iTypeParticle partmark]; dsEdWindow winstr; ); ); 0;; fun cbTreeMenuAddParticle(mnuitem, p)= let p -> [viewstr val type markstr item groupmark] in let getGroupName currentProject groupmark -> resgroup in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneParseParticleSystemsFromGroup (V3DgetSession sessionstr) resgroup -> ltplname in if ltplname == nil then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0273") 0; 0; ) else ( let [300 115] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0030")) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 12 60 20 (loc "OS3D_0257") nil -> label in let crEdCtrlTextLine winstr 80 10 (iw - 90) 20 "particle" nil EDWIN_RESIZE_MW -> ctrltext in let crEdCtrlLabel winstr 10 37 140 20 (loc "OS3D_0364") nil -> labeltpl in let crEdCtrlSelect winstr 160 35 (iw - 170) 120 CB_AHSCROLL -> ctrlselect in ( fillEdCtrlSelect ctrlselect quicksort ltplname @suppDoublon; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbAddParticleSystem [dwinstr ctrltext ctrlselect p]; setEdctrlTextLineFocus ctrltext; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 mkfun3 @cbAddParticleSystem [dwinstr ctrltext ctrlselect p] nil; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel dwinstr; ); 0; ); 0;; fun cbTreeMenuAnimSetLoop(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in let XMLgetBoolParam markstr "loop" -> animloop in ( XMLsetParam markstr "loop" XMLgetBoolString !animloop; V3DsetAnimationLoop animstr !animloop; ); 0;; fun cbBtnNewGroup(ctrlbtn, d, p)= let p -> [[viewstr val type markstr item] winstr ctrltext] in let getEdCtrlTextLineValue ctrltext -> name in if (name == nil) || (!strcmp "" (strtrim name)) then nil else ( let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let newOsSceneGroup viewstr xmlEditSceneFile markstr name nil nil father nil nil nil 0 item 3 1 -> [groupstr newgroupshell treenode] in ( if (!(isParentHidden newgroupshell)) then nil else SO3ObjectSetVisible newgroupshell 0 1; selEdCtrlTreeItem ctrlSceneTree treenode; ); paintEdCtrlModuleEditor mainInterf.MINT_meGroups; dsEdWindow winstr; ); 0;; fun cbTreeMenuAddGroup(mnuitem, p)= let p -> [viewstr val type markstr item] in let [230 90] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0266")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 12 60 20 (loc "OS3D_0257") nil -> label in let crEdCtrlTextLine winstr 80 10 (iw - 90) 20 "group" nil EDWIN_RESIZE_MW -> ctrltext in ( setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbBtnNewGroup [p winstr ctrltext]; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 mkfun3 @cbBtnNewGroup [p winstr ctrltext] nil; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel winstr; ); 0;; fun cbDlgSaveOsGroup(dlg, p, wfile)= let p -> [val markstr] in let _PtoScol (_WtoP wfile) -> file in if wfile == nil then nil else if file == nil then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0472") 0; 0; ) else let getFileExt file -> ext in let if !strcmpi "xos" ext then file else strcat file ".xos" -> file in let XMLcreate file nil -> xmlfilestr in ( XMLcopyMark xmlfilestr markstr nil; XMLwrite xmlfilestr file; set sLastDirectory = getFileDirectory file; _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0207") strcatn (strcat (loc "OS3D_0425") " ")::file::nil 0; 0; ); 0;; fun cbDlgSaveOsGroupCustom(wfile, p)= cbDlgSaveOsGroup nil p wfile; 0;; fun cbTreeMenuExportGroup(mnuitem, p)= let p -> [viewstr val type markstr item] in ( let getPathFile sCurrentScenePath "" -> [fpath fname] in let _GETdesktopSize -> [sw sh] in let getEdWindowPos mainInterf.MINT_winMain -> [nx ny] in let getEdWindowSize mainInterf.MINT_winMain -> [nmw nmh] in let [650 450] -> [iw ih] in let crEdSaveAsFileDialog _channel mainInterf.MINT_winMain nx + ((nmw / 2) - (iw / 2)) ny + ((nmh / 2) - (ih / 2)) iw ih (loc "saveAs") ["OpenSpace3D scene" "xos"::nil]::nil EDFILE_DIALOG_LIST_FOLDERS|EDFILE_DIALOG_SHOW_TOOLBAR nil sLastDirectory (strcat val ".xos") -> dlgfstr in ( setEdWindowIcon dlgfstr.EDFD_dialog sWinDlgIcon; setEdSaveFileDialogCb dlgfstr mkfun2 @cbDlgSaveOsGroupCustom [val markstr]; 0; ); //_DLGrflsave _DLGSaveFile _channel mainInterf.MINT_winMain.EDW_win sLastDirectory (strcat val ".xos") "OpenSpace3D scene\0*.xos\0All\0*.*\0\0" @cbDlgSaveOsGroup [val markstr]; ); 0;; fun cbBtnChangeAlias(ctrlbtn, d, p)= let p -> [[viewstr val type alias markstr item] winstr ctrltext] in let getEdCtrlTextLineValue ctrltext -> name in let XMLgetParam markstr "id" -> id in let XMLgetParam markstr "name" -> objname in let if (name == nil) || (!strcmp "" (strtrim name)) then (strcatn lcat objname::nil (if id == nil then nil else " #"::id::nil)) else if type == iTypeCompositor then strcatn name::" ("::"Compositor \""::objname::"\")"::nil else if type == iTypeSkyBox then strcatn name::" (SkyBox)"::nil else if type == iTypeSkyDome then strcatn name::" (SkyDome)"::nil else if type == iTypeSkyPlane then strcatn name::" (SkyPlane)"::nil else if type == iTypeAnim then ( let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetAnimationByName sessionstr val -> animstr in let SO3AnimationGetType animstr.V3D_anim -> atype in let if (atype == SO3_SCENENODE_ANIM) then "node" else if (atype == SO3_SKELETAL_ANIM) then "skeletal" else if (atype == SO3_VERTEX_ANIM) then "morph" else if (atype == SO3_POSE_ANIM) then "pose" else nil -> ratype in if (ratype != nil) then strcatn name::" ("::(strcatn lcat objname::nil (if id == nil then nil else " #"::id::nil))::" - "::ratype::")"::nil else strcatn name::" ("::(strcatn lcat objname::nil (if id == nil then nil else " #"::id::nil))::")"::nil; ) else strcatn name::" ("::(strcatn lcat objname::nil (if id == nil then nil else " #"::id::nil))::")"::nil -> nalias in ( addObjHistoryState val markstr nil 5; setGraphItemAlias val name; setEdCtrlTreeLabel ctrlSceneTree item nalias; XMLsetParam markstr "alias" name; if (type != iTypeGroup) then nil else let getGroupByName val -> groupstr in let mainInterf.MINT_winPlugins -> [plugswinstr [tbstr tabbarstr minmaxchk1]] in let if (name == nil) || (!strcmp "" (strtrim name)) then (strcatn lcat objname::nil (if id == nil then nil else " #"::id::nil)) else name -> groupname in ( setEdCtrlModuleEditorBoxLabel mainInterf.MINT_meGroups (getEdCtrlModuleEditorBoxByName mainInterf.MINT_meGroups val) groupname; renameEdTab tabbarstr groupstr.GRP_tabPlugins groupname; ); dsEdWindow winstr; ); 0;; fun cbTreeMenuChangeAlias(mnuitem, p)= let p -> [viewstr val type alias markstr item] in let [230 90] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0370")) sWinDlgIcon -> winstr in let if (alias == nil) || (!strcmp alias "") then XMLgetParam markstr "name" else alias -> alias in let crEdCtrlLabel winstr 10 12 60 20 (loc "OS3D_0041") nil -> label in let crEdCtrlTextLine winstr 80 10 (iw - 90) 20 alias nil EDWIN_RESIZE_MW -> ctrltext in ( setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbBtnChangeAlias [p winstr ctrltext]; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 mkfun3 @cbBtnChangeAlias [p winstr ctrltext] nil; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel winstr; ); 0;; fun cbBtnNewCamera(ctrlbtn, d, p)= let p -> [[viewstr val type markstr item] winstr ctrltext] in let getEdCtrlTextLineValue ctrltext -> name in if (name == nil) || (!strcmp "" (strtrim name)) then nil else ( let if (type == iTypeGroup || type == iTypeScene) then XMLgetMarkByValueFromMarkSons markstr "graph" else markstr -> destmark in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let if (type == iTypeGroup || type == iTypeScene) then markstr else groupmark -> groupmark in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let itoa (getNewSceneIndex nil) -> id in let XMLaddMark xmlEditSceneFile "camera" destmark ["id" id]::["name" name]::["fov" "1.0"]::nil nil -> cammark in let addGraphItem (strcatn name::" #"::id::nil) (strcatn id::"."::name::nil) iTypeCamera nil cammark nil groupmark item 0 0 -> treenode in let V3DaddCamera sessionstr (strcatn id::"."::name::nil) -> camera in ( if father == nil then nil else SO3ObjectLink camera father; XMLaddMark xmlEditSceneFile "scale" cammark ["x" "1"]::["y" "1"]::["z" "1"]::nil nil; XMLaddMark xmlEditSceneFile "position" cammark ["x" "0"]::["y" "0"]::["z" "0"]::nil nil; XMLaddMark xmlEditSceneFile "rotation" cammark ["qx" "0"]::["qy" "0"]::["qz" "0"]::["qw" "1"]::nil nil; XMLaddMark xmlEditSceneFile "clipping" cammark ["near" "0.1"]::["far" "1000"]::nil nil; SO3ObjectSetFlags camera iNodeFlagScene; V3DsetCamera camera nil 1.0 0.1 1000.0; V3DshowObjectHelper viewstr sessionstr camera iTypeCamera 1; selEdCtrlTreeItem ctrlSceneTree treenode; cbTreeMenuCameraEditParameters treenode [viewstr (strcatn id::"."::name::nil) iTypeCamera cammark]; showCameraViewport viewstr camera 1; ); dsEdWindow winstr; ); 0;; fun cbTreeMenuAddCamera(mnuitem, p)= let p -> [viewstr val type markstr item] in let [230 90] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_DIALOG nil (loc "OS3D_0261")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 12 60 20 (loc "OS3D_0257") nil -> label in let crEdCtrlTextLine winstr 80 10 (iw - 90) 20 "camera" nil EDWIN_RESIZE_MW -> ctrltext in ( setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbBtnNewCamera [p winstr ctrltext]; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 mkfun3 @cbBtnNewCamera [p winstr ctrltext] nil; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel winstr; ); 0;; fun cbBtnNewLight(ctrlbtn, d, p)= let p -> [[viewstr val type markstr item] winstr ctrltext] in let getEdCtrlTextLineValue ctrltext -> name in if (name == nil) || (!strcmp "" (strtrim name)) then nil else ( let if (type == iTypeGroup || type == iTypeScene) then XMLgetMarkByValueFromMarkSons markstr "graph" else markstr -> destmark in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let if (type == iTypeGroup || type == iTypeScene) then markstr else groupmark -> groupmark in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let itoa (getNewSceneIndex nil) -> id in let XMLaddMark xmlEditSceneFile "light" destmark ["id" id]::["name" name]::["type" (getOgreMaxLightByType SO3_POINT_LIGHT)]::["castShadows" (XMLgetBoolString 0)]::["volumetric" (XMLgetBoolString 0)]::["power" "1"]::["enable" XMLgetBoolString 1]::nil nil -> lightmark in let addGraphItem (strcatn name::" #"::id::nil) (strcatn id::"."::name::nil) iTypeLight nil lightmark nil groupmark item 1 0 -> treenode in let SO3LightCreate (V3DgetSession sessionstr) (strcatn id::"."::name::nil) -> light in ( if father == nil then nil else SO3ObjectLink light father; XMLaddMark xmlEditSceneFile "scale" lightmark ["x" "1"]::["y" "1"]::["z" "1"]::nil nil; XMLaddMark xmlEditSceneFile "position" lightmark ["x" "0"]::["y" "0"]::["z" "0"]::nil nil; XMLaddMark xmlEditSceneFile "rotation" lightmark ["qx" "0"]::["qy" "0"]::["qz" "0"]::["qw" "1"]::nil nil; XMLaddMark xmlEditSceneFile "colourDiffuse" lightmark ["r" "0.8"]::["g" "0.8"]::["b" "0.8"]::nil nil; XMLaddMark xmlEditSceneFile "colourSpecular" lightmark ["r" "1"]::["g" "1"]::["b" "1"]::nil nil; XMLaddMark xmlEditSceneFile "lightAttenuation" lightmark ["range" "10"]::nil nil; V3DshowObjectHelper viewstr sessionstr light iTypeLight 1; SO3ObjectSetFlags light iNodeFlagScene; SO3LightSetType light SO3_POINT_LIGHT; SO3LightSetPowerScale light 1.0; SO3LightSetDiffuseColor light (make_rgba (ftoi (0.8 *. 255.0)) (ftoi (0.8 *. 255.0)) (ftoi (0.8 *. 255.0)) 255); SO3LightSetSpecularColor light (make_rgba (ftoi (1.0 *. 255.0)) (ftoi (1.0 *. 255.0)) (ftoi (1.0 *. 255.0)) 255); SO3LightSetAttenuationAuto light 10.0; SO3ObjectSetCastShadows light 0; selEdCtrlTreeItem ctrlSceneTree treenode; cbTreeMenuLightEditParameters treenode [viewstr (strcatn id::"."::name::nil) iTypeLight lightmark]; ); dsEdWindow winstr; ); 0;; fun cbTreeMenuAddLight(mnuitem, p)= let p -> [viewstr val type markstr item] in let [230 90] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0267")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 12 60 20 (loc "OS3D_0257") nil -> label in let crEdCtrlTextLine winstr 80 10 (iw - 90) 20 "light" nil EDWIN_RESIZE_MW -> ctrltext in ( setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbBtnNewLight [p winstr ctrltext]; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 mkfun3 @cbBtnNewLight [p winstr ctrltext] nil; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel winstr; ); 0;; fun cbBtnNewDummy(ctrlbtn, d, p)= let p -> [[viewstr val type markstr item] winstr ctrltext] in let getEdCtrlTextLineValue ctrltext -> name in if (name == nil) || (!strcmp "" (strtrim name)) then nil else ( let if (type == iTypeGroup || type == iTypeScene) then XMLgetMarkByValueFromMarkSons markstr "graph" else markstr -> destmark in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let if (type == iTypeGroup || type == iTypeScene) then markstr else groupmark -> groupmark in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let itoa (getNewSceneIndex nil) -> id in let XMLaddMark xmlEditSceneFile "shell" destmark ["id" id]::["name" name]::nil nil -> shellmark in let addGraphItem (strcatn name::" #"::id::nil) (strcatn id::"."::name::nil) iTypeNode nil shellmark nil groupmark item 0 0 -> treenode in let SO3SceneNodeCreate (V3DgetSession sessionstr) (strcatn id::"."::name::nil) -> shell in ( SO3ObjectSetFlags shell iNodeFlagScene; if father == nil then nil else SO3ObjectLink shell father; XMLaddMark xmlEditSceneFile "scale" shellmark ["x" "1"]::["y" "1"]::["z" "1"]::nil nil; XMLaddMark xmlEditSceneFile "position" shellmark ["x" "0"]::["y" "0"]::["z" "0"]::nil nil; XMLaddMark xmlEditSceneFile "rotation" shellmark ["qx" "0"]::["qy" "0"]::["qz" "0"]::["qw" "1"]::nil nil; V3DshowObjectHelper viewstr sessionstr shell iTypeNode 1; selEdCtrlTreeItem ctrlSceneTree treenode; ); dsEdWindow winstr; ); 0;; fun cbTreeMenuAddDummy(mnuitem, p)= let p -> [viewstr val type markstr item] in let [230 90] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0263")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 12 60 20 (loc "OS3D_0257") nil -> label in let crEdCtrlTextLine winstr 80 10 (iw - 90) 20 "dummy" nil EDWIN_RESIZE_MW -> ctrltext in ( setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbBtnNewDummy [p winstr ctrltext]; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 mkfun3 @cbBtnNewDummy [p winstr ctrltext] nil; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel winstr; ); 0;; fun cbBtnNewCinematic(ctrlbtn, d, p)= let p -> [[viewstr val type markstr item] winstr ctrltext] in let getEdCtrlTextLineValue ctrltext -> animname in if (animname == nil) || (!strcmp "" (strtrim animname)) then nil else ( let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let V3DgetDefaultSession viewstr -> sessionstr in let itoa (getNewSceneIndex nil) -> id in let XMLaddMark xmlEditSceneFile "animation" markstr ["id" id]::["name" animname]::["type" "cinematic"]::["enable" (XMLgetBoolString 0)]::["loop" (XMLgetBoolString 0)]::["speed" (XMLgetShortFloatToString 1.0)]::["weight" (XMLgetShortFloatToString 1.0)]::["skipFrame" (XMLgetBoolString 1)]::nil nil -> newanimmark in let addGraphItem strcatn animname::" #"::id::nil (strcatn id::"."::animname::nil) iTypeAnim nil newanimmark nil groupmark item 0 0 -> treenode in let V3DaddSequenceAnimation sessionstr (atoi id) animname (strcatn id::"."::animname::nil) 1.0 1.0 0 0 -> animstr in ( V3DanimationSetDefaultSkipFrame animstr 1; V3DaddSequenceAnimationTrack animstr; XMLaddMark xmlEditSceneFile "track" newanimmark nil nil; selEdCtrlTreeItem ctrlSceneTree treenode; ); dsEdWindow winstr; ); 0;; fun cbTreeMenuAddCinematic(mnuitem, p)= let p -> [viewstr val type markstr item] in let [230 90] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0262")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 12 60 20 (loc "OS3D_0257") nil -> label in let crEdCtrlTextLine winstr 80 10 (iw - 90) 20 "cinematic" nil EDWIN_RESIZE_MW -> ctrltext in ( setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbBtnNewCinematic [p winstr ctrltext]; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 mkfun3 @cbBtnNewCinematic [p winstr ctrltext] nil; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel winstr; ); 0;; /** cbDestroyCubeMapSetupWin [EdWindow] I * callback on destroy cube map setting window * * private * * return 0 **/ fun cbDestroyCubeMapSetupWin(winstr, p)= let p -> [viewstr val type markstr groupmark] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in ( SO3DynamicCubeMapSetEnable object 0; ); set winCubeMapSetup = nil; 0;; fun cbCubeMapSetupPlayPause(tbstr, check, btn, mask, state, p)= let p -> [viewstr val type markstr groupmark] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in ( SO3DynamicCubeMapSetEnable object state; ); 0;; fun cbCubeMapSetupEnable(ctrl, state, p)= let p -> [viewstr val type markstr groupmark] in ( XMLsetParam markstr "enable" XMLgetBoolString state; setGraphItemInitState val state; ); 0;; fun cbCubeMapSetupAutoUpdate(ctrl, state, p)= let p -> [viewstr val type markstr groupmark] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in ( XMLsetParam markstr "autoUpdate" XMLgetBoolString state; SO3DynamicCubeMapSetAutoUpdate object state; ); 0;; fun cbCubeMapSetupMatName(ctrlstr, pos, elem, p)= let p -> [ctrlmattech ctrlmatpass ctrlmattex [viewstr val type markstr groupmark]] in let getGroupName currentProject groupmark -> resgroup in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in let if elem != nil then SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup elem else nil -> material in ( fillMaterialTechSelector viewstr [ctrlmattech ctrlstr ctrlmatpass ctrlmattex] material; XMLsetParam markstr "material" elem; XMLsetParam markstr "technique" "0"; XMLsetParam markstr "pass" "0"; XMLsetParam markstr "texunit" "0"; SO3DynamicCubeMapSetTargetMaterial object material 0 0 0; ); 0;; fun cbCubeMapSetupMatTechniqueName(ctrlstr, pos, elem, p)= let p -> [ctrlmatname ctrlmatpass ctrlmattex [viewstr val type markstr groupmark]] in let getGroupName currentProject groupmark -> resgroup in let getSelectedEdCtrlSelect ctrlmatname -> matname in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in let if matname != nil then SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname else nil -> material in ( fillMaterialPassSelector viewstr [ctrlmatpass ctrlmatname ctrlstr ctrlmattex] material pos; XMLsetParam markstr "material" matname; XMLsetParam markstr "technique" itoa pos; XMLsetParam markstr "pass" "0"; XMLsetParam markstr "texunit" "0"; SO3DynamicCubeMapSetTargetMaterial object material pos 0 0; ); 0;; fun cbCubeMapSetupMatPassName(ctrlstr, pos, elem, p)= let p -> [ctrlmatname ctrlmattech ctrlmattex [viewstr val type markstr groupmark]] in let getGroupName currentProject groupmark -> resgroup in let getSelectedEdCtrlSelectPos ctrlmattech -> tech in let getSelectedEdCtrlSelect ctrlmatname -> matname in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in let if matname != nil then SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname else nil -> material in ( fillMaterialTextureSelector viewstr ctrlmattex material tech pos; XMLsetParam markstr "material" matname; XMLsetParam markstr "technique" itoa tech; XMLsetParam markstr "pass" itoa pos; XMLsetParam markstr "texunit" "0"; SO3DynamicCubeMapSetTargetMaterial object material tech pos 0; ); 0;; fun cbCubeMapSetupMatTexName(ctrlstr, pos, elem, p)= let p -> [ctrlmatname ctrlmattech ctrlmatpass [viewstr val type markstr groupmark]] in let getGroupName currentProject groupmark -> resgroup in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in let getSelectedEdCtrlSelect ctrlmatname -> matname in let getSelectedEdCtrlSelectPos ctrlmattech -> technique in let getSelectedEdCtrlSelectPos ctrlmatpass -> pass in ( XMLsetParam markstr "material" matname; XMLsetParam markstr "technique" itoa technique; XMLsetParam markstr "pass" itoa pass; XMLsetParam markstr "texunit" itoa pos; let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> material in SO3DynamicCubeMapSetTargetMaterial object material technique pass pos; ); 0;; fun cbCubeMapSetupTexSize(ctrlstr, pos, elem, p)= let p -> [viewstr val type markstr groupmark] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in ( XMLsetParam markstr "texsize" elem; SO3DynamicCubeMapSetTextureSize object atoi elem; ); 0;; fun cbTreeMenuCubeMapEditParameters(mnuitem, p)= let p -> [viewstr val type markstr groupmark] in let V3DgetDefaultSession viewstr -> sessionstr in let getGroupName currentProject groupmark -> resgroup in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in let winCubeMapSetup -> [wobj owinstr _ _] in if wobj == object then nil else ( if winCubeMapSetup == nil then nil else ( dsEdWindow owinstr; set winCubeMapSetup = nil; ); let [380 235] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let 10 -> ypos in let XMLgetBoolParam markstr "enable" -> state in let XMLgetParam markstr "material" -> matname in let atoi XMLgetParam markstr "technique" -> mattech in let if mattech == nil then 0 else mattech -> mattech in let atoi XMLgetParam markstr "pass" -> matpass in let if matpass == nil then 0 else matpass -> matpass in let atoi XMLgetParam markstr "texunit" -> mattex in let if mattex == nil then 0 else mattex -> mattex in let atoi XMLgetParam markstr "texsize" -> texsize in let if texsize == nil then 256 else texsize -> texsize in let atof (XMLgetParam markstr "renderingDistance") -> dist in let XMLgetBoolParam markstr "autoUpdate" -> autoupdate in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0126") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 (ypos + 2) 170 20 (loc "OS3D_0241") nil -> labelmat in let crEdCtrlSelect winstr 180 ypos 180 120 EDWIN_RESIZE_MW -> ctrlmatname in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0242") nil -> labeltech in let crEdCtrlSelect winstr 180 ypos 180 120 EDWIN_RESIZE_MW -> ctrlmattech in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0414") nil -> labelpass in let crEdCtrlSelect winstr 180 ypos 180 120 EDWIN_RESIZE_MW -> ctrlmatpass in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0292") nil -> labelpass in let crEdCtrlSelect winstr 180 ypos 180 120 EDWIN_RESIZE_MW -> ctrlmattex in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0419") nil -> labelsize in let crEdCtrlSelect winstr 180 ypos 180 120 EDWIN_RESIZE_MW -> ctrltexsize in //let crEdCtrlLabel winstr 10 ((set ypos = ypos + 35) + 2) 170 20 (loc "OS3D_0118") nil -> labelvisibility in //let crEdCtrlFloat winstr 180 ypos 90 20 dist 0.0 1000000.0 0.1 6 nil EDWIN_RESIZE_MW -> ctrldist in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 190 20 (loc "OS3D_0073") EDWIN_RESIZE_MW -> ctrlautoupdate in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 190 20 (loc "OS3D_0139") EDWIN_RESIZE_MW -> ctrlenable in let crEdWindowToolBar winstr 0 (ih-28) iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_playpause.png" -> aplaypause in let crEdToolBarCheck tbstr aplaypause ETB_ALIGN_LEFT (loc "OS3D_0303") nil -> chkplaypause in ( //setEdCtrlFloatEnable ctrldist 0; setEdToolBarVisible tbstr 1; setEdToolBarCheckCbClick tbstr chkplaypause mkfun6 @cbCubeMapSetupPlayPause p; setEdCtrlSelectCb ctrlmatname mkfun4 @cbCubeMapSetupMatName [ctrlmattech ctrlmatpass ctrlmattex p]; setEdCtrlSelectCb ctrlmattech mkfun4 @cbCubeMapSetupMatTechniqueName [ctrlmatname ctrlmatpass ctrlmattex p]; setEdCtrlSelectCb ctrlmatpass mkfun4 @cbCubeMapSetupMatPassName [ctrlmatname ctrlmattech ctrlmattex p]; setEdCtrlSelectCb ctrlmattex mkfun4 @cbCubeMapSetupMatTexName [ctrlmatname ctrlmattech ctrlmatpass p]; fillEdCtrlSelect ctrltexsize "32"::"64"::"128"::"256"::"512"::"1024"::"2048"::"4096"::nil; selectEdCtrlSelect ctrltexsize itoa texsize; setEdCtrlSelectCb ctrltexsize mkfun4 @cbCubeMapSetupTexSize p; fillMaterialSelector viewstr resgroup ctrlmatname ctrlmattech ctrlmatpass ctrlmattex; selectEdCtrlSelect ctrlmatname matname; let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> mat in if mat == nil then nil else ( selectEdCtrlSelectByPos ctrlmattech mattech; fillMaterialPassSelector viewstr [ctrlmatpass ctrlmatname ctrlmattech ctrlmattex] mat mattech; selectEdCtrlSelectByPos ctrlmatpass matpass; fillMaterialTextureSelector viewstr ctrlmattex mat mattech matpass; selectEdCtrlSelectByPos ctrlmattex mattex; ); set winCubeMapSetup = [object dwinstr tbstr chkplaypause]; //setEdCtrlFloatCbChange ctrldist mkfun3 @cbObjectSetupRenderVisibility [viewstr val type markstr]; setEdCtrlCheckState ctrlautoupdate autoupdate; setEdCtrlCheckCbState ctrlautoupdate mkfun3 @cbCubeMapSetupAutoUpdate p; setEdCtrlCheckState ctrlenable state; setEdCtrlCheckCbState ctrlenable mkfun3 @cbCubeMapSetupEnable p; setEdwindowCbDestroy dwinstr mkfun2 @cbDestroyCubeMapSetupWin p; paintEdToolBar tbstr; 0; ); ); 0;; fun cbBtnNewCubeMap(ctrlbtn, d, p)= let p -> [[viewstr val type markstr item groupmark] winstr ctrltext] in let getEdCtrlTextLineValue ctrltext -> name in if (name == nil) || (!strcmp "" (strtrim name)) then nil else ( let if (type == iTypeGroup || type == iTypeScene) then XMLgetMarkByValueFromMarkSons markstr "graph" else markstr -> destmark in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let if (type == iTypeGroup || type == iTypeScene) then markstr else groupmark -> groupmark in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let itoa (getNewSceneIndex nil) -> id in let XMLaddMark xmlEditSceneFile "cubemap" destmark ["id" id]::["name" name]::nil nil -> shellmark in let addGraphItem (strcatn name::" #"::id::nil) (strcatn id::"."::name::nil) iTypeCubeMap nil shellmark nil groupmark item 0 0 -> treenode in let SO3DynamicCubeMapCreate (V3DgetSession sessionstr) (strcatn id::"."::name::nil) -> shell in ( if father == nil then nil else SO3ObjectLink shell father; XMLaddMark xmlEditSceneFile "scale" shellmark ["x" "1"]::["y" "1"]::["z" "1"]::nil nil; XMLaddMark xmlEditSceneFile "position" shellmark ["x" "0"]::["y" "0"]::["z" "0"]::nil nil; XMLaddMark xmlEditSceneFile "rotation" shellmark ["qx" "0"]::["qy" "0"]::["qz" "0"]::["qw" "1"]::nil nil; V3DshowObjectHelper viewstr sessionstr shell iTypeCubeMap 1; selEdCtrlTreeItem ctrlSceneTree treenode; cbTreeMenuCubeMapEditParameters treenode [viewstr (strcatn id::"."::name::nil) iTypeCubeMap shellmark groupmark]; ); dsEdWindow winstr; ); 0;; fun cbTreeMenuAddCubeMap(mnuitem, p)= let p -> [viewstr val type markstr item groupmark] in let [230 90] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0264")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 12 60 20 (loc "OS3D_0257") nil -> label in let crEdCtrlTextLine winstr 80 10 (iw - 90) 20 "cubemap" nil EDWIN_RESIZE_MW -> ctrltext in ( setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbBtnNewCubeMap [p winstr ctrltext]; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 mkfun3 @cbBtnNewCubeMap [p winstr ctrltext] nil; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel winstr; ); 0;; /** cbDestroyReflectionMapSetupWin [EdWindow] I * callback on destroy reflection map setting window * * private * * return 0 **/ fun cbDestroyReflectionMapSetupWin(winstr, p)= let p -> [viewstr val type markstr groupmark] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in ( SO3DynamicReflectionMapSetEnable object 0; ); set winReflectionMapSetup = nil; 0;; fun cbReflectionMapSetupPlayPause(tbstr, check, btn, mask, state, p)= let p -> [viewstr val type markstr groupmark] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in ( SO3DynamicReflectionMapSetEnable object state; ); 0;; fun cbReflectionMapSetupEnable(ctrl, state, p)= let p -> [viewstr val type markstr groupmark] in ( XMLsetParam markstr "enable" XMLgetBoolString state; setGraphItemInitState val state; ); 0;; fun cbReflectionMapSetupRevertClipPlane(ctrl, state, p)= let p -> [viewstr val type markstr groupmark] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in ( XMLsetParam markstr "revertClipPlane" XMLgetBoolString state; SO3DynamicReflectionMapSetRevertClipPlane object state; ); 0;; fun cbReflectionMapSetupMatName(ctrlstr, pos, elem, p)= let p -> [ctrlmattech ctrlmatpass ctrlmattex [viewstr val type markstr groupmark]] in let getGroupName currentProject groupmark -> resgroup in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in let if elem != nil then SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup elem else nil -> material in ( fillMaterialTechSelector viewstr [ctrlmattech ctrlstr ctrlmatpass ctrlmattex] material; XMLsetParam markstr "material" elem; XMLsetParam markstr "technique" "0"; XMLsetParam markstr "pass" "0"; XMLsetParam markstr "texunit" "0"; SO3DynamicReflectionMapSetTargetMaterial object material 0 0 0; ); 0;; fun cbReflectionMapSetupMatTechniqueName(ctrlstr, pos, elem, p)= let p -> [ctrlmatname ctrlmatpass ctrlmattex [viewstr val type markstr groupmark]] in let getGroupName currentProject groupmark -> resgroup in let getSelectedEdCtrlSelect ctrlmatname -> matname in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in let if matname != nil then SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname else nil -> material in ( fillMaterialPassSelector viewstr [ctrlmatpass ctrlmatname ctrlstr ctrlmattex] material pos; XMLsetParam markstr "material" matname; XMLsetParam markstr "technique" itoa pos; XMLsetParam markstr "pass" "0"; XMLsetParam markstr "texunit" "0"; SO3DynamicReflectionMapSetTargetMaterial object material pos 0 0; ); 0;; fun cbReflectionMapSetupMatPassName(ctrlstr, pos, elem, p)= let p -> [ctrlmatname ctrlmattech ctrlmattex [viewstr val type markstr groupmark]] in let getGroupName currentProject groupmark -> resgroup in let getSelectedEdCtrlSelectPos ctrlmattech -> tech in let getSelectedEdCtrlSelect ctrlmatname -> matname in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in let if matname != nil then SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname else nil -> material in ( fillMaterialTextureSelector viewstr ctrlmattex material tech pos; XMLsetParam markstr "material" matname; XMLsetParam markstr "technique" itoa tech; XMLsetParam markstr "pass" itoa pos; XMLsetParam markstr "texunit" "0"; SO3DynamicReflectionMapSetTargetMaterial object material tech pos 0; ); 0;; fun cbReflectionMapSetupMatTexName(ctrlstr, pos, elem, p)= let p -> [ctrlmatname ctrlmattech ctrlmatpass [viewstr val type markstr groupmark]] in let getGroupName currentProject groupmark -> resgroup in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in let getSelectedEdCtrlSelect ctrlmatname -> matname in let getSelectedEdCtrlSelectPos ctrlmattech -> technique in let getSelectedEdCtrlSelectPos ctrlmatpass -> pass in ( XMLsetParam markstr "material" matname; XMLsetParam markstr "technique" itoa technique; XMLsetParam markstr "pass" itoa pass; XMLsetParam markstr "texunit" itoa pos; let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> material in SO3DynamicReflectionMapSetTargetMaterial object material technique pass pos; ); 0;; fun cbReflectionMapSetupTexSize(ctrlstr, pos, elem, p)= let p -> [viewstr val type markstr groupmark] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in ( XMLsetParam markstr "texsize" elem; SO3DynamicReflectionMapSetTextureSize object atoi elem; ); 0;; fun cbTreeMenuReflectionMapEditParameters(mnuitem, p)= let p -> [viewstr val type markstr groupmark] in let V3DgetDefaultSession viewstr -> sessionstr in let getGroupName currentProject groupmark -> resgroup in let SO3SceneGetObject (V3DgetSession sessionstr) val -> object in let winReflectionMapSetup -> [wobj owinstr _ _] in if wobj == object then nil else ( if winReflectionMapSetup == nil then nil else ( dsEdWindow owinstr; set winReflectionMapSetup = nil; ); let [380 235] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let 10 -> ypos in let XMLgetBoolParam markstr "enable" -> state in let XMLgetParam markstr "material" -> matname in let atoi XMLgetParam markstr "technique" -> mattech in let if mattech == nil then 0 else mattech -> mattech in let atoi XMLgetParam markstr "pass" -> matpass in let if matpass == nil then 0 else matpass -> matpass in let atoi XMLgetParam markstr "texunit" -> mattex in let if mattex == nil then 0 else mattex -> mattex in let atoi XMLgetParam markstr "texsize" -> texsize in let if texsize == nil then 256 else texsize -> texsize in let atof (XMLgetParam markstr "renderingDistance") -> dist in let XMLgetBoolParam markstr "revertClipPlane" -> revertclip in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcat (strcat (loc "OS3D_0127") " ") val) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 (ypos + 2) 170 20 (loc "OS3D_0241") nil -> labelmat in let crEdCtrlSelect winstr 180 ypos 180 120 EDWIN_RESIZE_MW -> ctrlmatname in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0242") nil -> labeltech in let crEdCtrlSelect winstr 180 ypos 180 120 EDWIN_RESIZE_MW -> ctrlmattech in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0414") nil -> labelpass in let crEdCtrlSelect winstr 180 ypos 180 120 EDWIN_RESIZE_MW -> ctrlmatpass in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0292") nil -> labelpass in let crEdCtrlSelect winstr 180 ypos 180 120 EDWIN_RESIZE_MW -> ctrlmattex in let crEdCtrlLabel winstr 10 ((set ypos = ypos + 25) + 2) 170 20 (loc "OS3D_0419") nil -> labelsize in let crEdCtrlSelect winstr 180 ypos 180 120 EDWIN_RESIZE_MW -> ctrltexsize in //let crEdCtrlLabel winstr 10 ((set ypos = ypos + 35) + 2) 170 20 (loc "OS3D_0118") nil -> labelvisibility in //let crEdCtrlFloat winstr 180 ypos 90 20 dist 0.0 1000000.0 0.1 6 nil EDWIN_RESIZE_MW -> ctrldist in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw-20) 20 (loc "OS3D_0344") EDWIN_RESIZE_MW -> ctrlrevertclip in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) 190 20 (loc "OS3D_0139") EDWIN_RESIZE_MW -> ctrlenable in let crEdWindowToolBar winstr 0 (ih-28) iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_playpause.png" -> aplaypause in let crEdToolBarCheck tbstr aplaypause ETB_ALIGN_LEFT (loc "OS3D_0303") nil -> chkplaypause in ( setEdToolBarVisible tbstr 1; //setEdCtrlFloatEnable ctrldist 0; setEdToolBarCheckCbClick tbstr chkplaypause mkfun6 @cbReflectionMapSetupPlayPause p; setEdCtrlSelectCb ctrlmatname mkfun4 @cbReflectionMapSetupMatName [ctrlmattech ctrlmatpass ctrlmattex p]; setEdCtrlSelectCb ctrlmattech mkfun4 @cbReflectionMapSetupMatTechniqueName [ctrlmatname ctrlmatpass ctrlmattex p]; setEdCtrlSelectCb ctrlmatpass mkfun4 @cbReflectionMapSetupMatPassName [ctrlmatname ctrlmattech ctrlmattex p]; setEdCtrlSelectCb ctrlmattex mkfun4 @cbReflectionMapSetupMatTexName [ctrlmatname ctrlmattech ctrlmatpass p]; fillEdCtrlSelect ctrltexsize "32"::"64"::"128"::"256"::"512"::"1024"::"2048"::"4096"::nil; selectEdCtrlSelect ctrltexsize itoa texsize; setEdCtrlSelectCb ctrltexsize mkfun4 @cbReflectionMapSetupTexSize p; fillMaterialSelector viewstr resgroup ctrlmatname ctrlmattech ctrlmatpass ctrlmattex; selectEdCtrlSelect ctrlmatname matname; let SO3SceneGetMaterial (V3DgetSession sessionstr) resgroup matname -> mat in if mat == nil then nil else ( selectEdCtrlSelectByPos ctrlmattech mattech; fillMaterialPassSelector viewstr [ctrlmatpass ctrlmatname ctrlmattech ctrlmattex] mat mattech; selectEdCtrlSelectByPos ctrlmatpass matpass; fillMaterialTextureSelector viewstr ctrlmattex mat mattech matpass; selectEdCtrlSelectByPos ctrlmattex mattex; ); set winReflectionMapSetup = [object dwinstr tbstr chkplaypause]; //setEdCtrlFloatCbChange ctrldist mkfun3 @cbObjectSetupRenderVisibility [viewstr val type markstr]; setEdCtrlCheckState ctrlrevertclip revertclip; setEdCtrlCheckCbState ctrlrevertclip mkfun3 @cbReflectionMapSetupRevertClipPlane p; setEdCtrlCheckState ctrlenable state; setEdCtrlCheckCbState ctrlenable mkfun3 @cbReflectionMapSetupEnable p; setEdwindowCbDestroy dwinstr mkfun2 @cbDestroyReflectionMapSetupWin p; paintEdToolBar tbstr; 0; ); ); 0;; fun cbBtnNewReflectionMap(ctrlbtn, d, p)= let p -> [[viewstr val type markstr item groupmark] winstr ctrltext] in let getEdCtrlTextLineValue ctrltext -> name in if (name == nil) || (!strcmp "" (strtrim name)) then nil else ( let if (type == iTypeGroup || type == iTypeScene) then XMLgetMarkByValueFromMarkSons markstr "graph" else markstr -> destmark in let getGraphByValue val -> [_ _ _ _ _ groupmark _ _] in let if (type == iTypeGroup || type == iTypeScene) then markstr else groupmark -> groupmark in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> father in let itoa (getNewSceneIndex nil) -> id in let XMLaddMark xmlEditSceneFile "reflectionmap" destmark ["id" id]::["name" name]::nil nil -> shellmark in let addGraphItem (strcatn name::" #"::id::nil) (strcatn id::"."::name::nil) iTypeReflectionMap nil shellmark nil groupmark item 0 0 -> treenode in let V3DgetDefaultViewport viewstr -> viewport in let SO3DynamicReflectionMapCreate (V3DgetSession sessionstr) viewport.V3D_viewport (strcatn id::"."::name::nil) -> shell in ( if father == nil then nil else SO3ObjectLink shell father; XMLaddMark xmlEditSceneFile "scale" shellmark ["x" "1"]::["y" "1"]::["z" "1"]::nil nil; XMLaddMark xmlEditSceneFile "position" shellmark ["x" "0"]::["y" "0"]::["z" "0"]::nil nil; XMLaddMark xmlEditSceneFile "rotation" shellmark ["qx" "0"]::["qy" "0"]::["qz" "0"]::["qw" "1"]::nil nil; V3DshowObjectHelper viewstr sessionstr shell iTypeReflectionMap 1; selEdCtrlTreeItem ctrlSceneTree treenode; cbTreeMenuReflectionMapEditParameters treenode [viewstr (strcatn id::"."::name::nil) iTypeReflectionMap shellmark groupmark]; ); dsEdWindow winstr; ); 0;; fun cbTreeMenuAddReflectionMap(mnuitem, p)= let p -> [viewstr val type markstr item groupmark] in let [230 90] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0265")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 12 60 20 (loc "OS3D_0257") nil -> label in let crEdCtrlTextLine winstr 80 10 (iw - 90) 20 "reflectionmap" nil EDWIN_RESIZE_MW -> ctrltext in ( setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbBtnNewReflectionMap [p winstr ctrltext]; setEdCtrlButtonCb (crEdCtrlButton winstr 10 (ih - 30) 90 20 (loc "OS3D_0282") EDWIN_RESIZE_MW) mkfun2 mkfun3 @cbBtnNewReflectionMap [p winstr ctrltext] nil; setEdCtrlButtonCb (crEdCtrlButton winstr (iw - 100) (ih - 30) 90 20 (loc "OS3D_0084") EDWIN_RESIZE_MW) mkfun2 @cbBtnCancel winstr; ); 0;; fun cbFogSetupMode(ctrl, pos, elem, p)= let p -> [[viewstr val type scenemark] ctrldensity ctrlstart ctrlend] in let V3DgetDefaultSession viewstr -> sessionstr in let XMLgetMarkByValueFromMarkSons scenemark "environment" -> envmark in let XMLgetMarkByValueFromMarkSons envmark "fog" -> fogmark in let if fogmark != nil then fogmark else XMLaddMark xmlEditSceneFile "fog" envmark nil nil -> fogmark in let (getOgreFogType elem) -> fogmode in ( XMLsetParam fogmark "mode" elem; V3DsetSceneFog sessionstr fogmode nil nil nil nil; if (fogmode == SO3_FOG_LINEAR) then ( setEdCtrlFloatEnable ctrldensity 0; setEdCtrlFloatEnable ctrlstart 1; setEdCtrlFloatEnable ctrlend 1; 0; ) else if (fogmode == SO3_FOG_EXP) || (fogmode == SO3_FOG_EXP2) then ( setEdCtrlFloatEnable ctrldensity 1; setEdCtrlFloatEnable ctrlstart 0; setEdCtrlFloatEnable ctrlend 0; 0; ) else ( setEdCtrlFloatEnable ctrldensity 0; setEdCtrlFloatEnable ctrlstart 0; setEdCtrlFloatEnable ctrlend 0; 0; ); ); 0;; fun cbFogSetupColor(ctrlstr, color, p)= if color == nil then nil else let p -> [viewstr val type scenemark] in let G2Dgetrgb color -> [r g b] in let ftoa ((itof r) /. 255.0) -> fr in let ftoa ((itof g) /. 255.0) -> fg in let ftoa ((itof b) /. 255.0) -> fb in let V3DgetDefaultSession viewstr -> sessionstr in let XMLgetMarkByValueFromMarkSons scenemark "environment" -> envmark in let XMLgetMarkByValueFromMarkSons envmark "fog" -> fogmark in let if fogmark != nil then fogmark else XMLaddMark xmlEditSceneFile "fog" envmark nil nil -> fogmark in let XMLgetMarkByValueFromMarkSons fogmark "colourDiffuse" -> colormark in let if colormark != nil then colormark else XMLaddMark xmlEditSceneFile "colourDiffuse" fogmark nil nil -> colormark in ( XMLsetParam colormark "r" fr; XMLsetParam colormark "g" fg; XMLsetParam colormark "b" fb; V3DsetSceneFog sessionstr nil (G2Drgb2rgba color 0) nil nil nil; ); 0;; fun cbFogSetupLinearEnd(ctrl, value, p)= let p -> [[viewstr val type scenemark] ctrlstart] in let V3DgetDefaultSession viewstr -> sessionstr in let getEdCtrlFloatValue ctrlstart -> startval in let XMLgetMarkByValueFromMarkSons scenemark "environment" -> envmark in let XMLgetMarkByValueFromMarkSons envmark "fog" -> fogmark in let if fogmark != nil then fogmark else XMLaddMark xmlEditSceneFile "fog" envmark nil nil -> fogmark in ( if (startval <=. value) then nil else ( XMLsetParam fogmark "linearStart" XMLgetShortFloatToString value; setEdCtrlFloatValue ctrlstart value; ); XMLsetParam fogmark "linearEnd" XMLgetShortFloatToString value; V3DsetSceneFog sessionstr nil nil nil startval value; ); 0;; fun cbFogSetupLinearStart(ctrl, value, p)= let p -> [[viewstr val type scenemark] ctrlend] in let V3DgetDefaultSession viewstr -> sessionstr in let getEdCtrlFloatValue ctrlend -> endval in let XMLgetMarkByValueFromMarkSons scenemark "environment" -> envmark in let XMLgetMarkByValueFromMarkSons envmark "fog" -> fogmark in let if fogmark != nil then fogmark else XMLaddMark xmlEditSceneFile "fog" envmark nil nil -> fogmark in ( if (endval >=. value) then nil else ( XMLsetParam fogmark "linearEnd" XMLgetShortFloatToString value; setEdCtrlFloatValue ctrlend value; ); XMLsetParam fogmark "linearStart" XMLgetShortFloatToString value; V3DsetSceneFog sessionstr nil nil nil value endval; ); 0;; fun cbFogSetupDensity(ctrl, value, p)= let p -> [viewstr val type scenemark] in let V3DgetDefaultSession viewstr -> sessionstr in let XMLgetMarkByValueFromMarkSons scenemark "environment" -> envmark in let XMLgetMarkByValueFromMarkSons envmark "fog" -> fogmark in let if fogmark != nil then fogmark else XMLaddMark xmlEditSceneFile "fog" envmark nil nil -> fogmark in ( XMLsetParam fogmark "density" XMLgetShortFloatToString value; V3DsetSceneFog sessionstr nil nil value nil nil; ); 0;; /** cbDestroyFogSetupWin [EdWindow] I * callback on destroy fog setting window * * private * * return 0 **/ fun cbDestroyFogSetupWin(winstr)= set winFogSetup = nil; 0;; fun cbTreeMenuSetFogSetting(mnuitem, p)= if winFogSetup == nil then nil else ( dsEdWindow winFogSetup; set winFogSetup = nil; ); let p -> [viewstr val type markstr] in let [400 140] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetFogMode (V3DgetSession sessionstr) -> fogmode in let G2Drgba2rgb SO3SceneGetFogColor (V3DgetSession sessionstr) -> fogcolor in let SO3SceneGetFogDensity (V3DgetSession sessionstr) -> density in let SO3SceneGetFogStart (V3DgetSession sessionstr) -> fogstart in let SO3SceneGetFogEnd (V3DgetSession sessionstr) -> fogend in let if fogend == nil then 1000.0 else fogend -> fogend in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0169")) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 12 160 20 (loc "OS3D_0168") nil -> labeltype in let crEdCtrlSelect winstr 180 10 190 120 EDWIN_RESIZE_MW -> ctrlmode in let crEdCtrlLabel winstr 10 37 160 20 (loc "OS3D_0165") nil -> labelscolor in let crEdCtrlColorButton winstr 180 35 100 20 fogcolor 0 EDWIN_RESIZE_MW nil -> ctrlcolor in let crEdCtrlLabel winstr 10 62 160 20 (loc "OS3D_0164") nil -> labeldensity in let crEdCtrlFloat winstr 180 60 100 20 density 0.0 1.0 0.00001 5 nil EDWIN_RESIZE_MW -> ctrldensity in let crEdCtrlLabel winstr 10 87 160 20 (loc "OS3D_0167") nil -> labelstart in let crEdCtrlFloat winstr 180 85 100 20 fogstart 0.0 10000000.0 1.0 4 nil EDWIN_RESIZE_MW -> ctrlstart in let crEdCtrlLabel winstr 10 112 160 20 (loc "OS3D_0166") nil -> labelend in let crEdCtrlFloat winstr 180 110 100 20 fogend 0.0 100000000.0 1.0 4 nil EDWIN_RESIZE_MW -> ctrlend in ( set winFogSetup = dwinstr; if (fogmode == SO3_FOG_LINEAR) then ( setEdCtrlFloatEnable ctrldensity 0; setEdCtrlFloatEnable ctrlstart 1; setEdCtrlFloatEnable ctrlend 1; 0; ) else if (fogmode == SO3_FOG_EXP) || (fogmode == SO3_FOG_EXP2) then ( setEdCtrlFloatEnable ctrldensity 1; setEdCtrlFloatEnable ctrlstart 0; setEdCtrlFloatEnable ctrlend 0; 0; ) else ( setEdCtrlFloatEnable ctrldensity 0; setEdCtrlFloatEnable ctrlstart 0; setEdCtrlFloatEnable ctrlend 0; 0; ); fillEdCtrlSelect ctrlmode "none"::"linear"::"exp"::"exp2"::nil; selectEdCtrlSelect ctrlmode (getOgreFogByType fogmode); setEdCtrlSelectCb ctrlmode mkfun4 @cbFogSetupMode [p ctrldensity ctrlstart ctrlend]; setEdCtrlColorButtonCb ctrlcolor mkfun3 @cbFogSetupColor p; setEdCtrlFloatCbChange ctrldensity mkfun3 @cbFogSetupDensity p; setEdCtrlFloatCbChange ctrlstart mkfun3 @cbFogSetupLinearStart [p ctrlend]; setEdCtrlFloatCbChange ctrlend mkfun3 @cbFogSetupLinearEnd [p ctrlstart]; setEdwindowCbDestroy winFogSetup @cbDestroyFogSetupWin; 0; ); 0;; /** cbDestroyMaterialSchemeSetupWin [EdWindow] I * callback on destroy material scheme setting window * * private * * return 0 **/ fun cbDestroyMaterialSchemeSetupWin(winstr)= set winMatSchemeSetup = nil; 0;; fun cbMaterialSchemeSetupSelect(ctrl, pos, elem, p)= let p -> [viewstr val type scenemark] in let V3DgetDefaultViewport viewstr -> defaultviewportstr in let XMLgetMarkByValueFromMarkSons scenemark "environment" -> envmark in let XMLgetMarkByValueFromMarkSons envmark "materialScheme" -> schememark in let if schememark != nil then schememark else XMLaddMark xmlEditSceneFile "materialScheme" envmark nil nil -> schememark in ( XMLsetParam schememark "name" elem; SO3ViewportSetMaterialScheme defaultviewportstr.V3D_viewport elem; ); 0;; fun cbTreeMenuSetMaterialScheme(mnuitem, p)= if winMatSchemeSetup == nil then nil else ( dsEdWindow winMatSchemeSetup; set winMatSchemeSetup = nil; ); let p -> [viewstr val type markstr] in let getAllMaterialScheme viewstr -> lscheme in if !(sizelist lscheme) then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0272") 0; 0; ) else ( let [400 60] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetDefaultViewport viewstr -> viewportstr in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil (loc "OS3D_0240")) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 12 160 20 (loc "OS3D_0074") nil -> labeltype in let crEdCtrlSelect winstr 180 10 210 120 EDWIN_RESIZE_MW -> ctrlmode in ( set winMatSchemeSetup = dwinstr; fillEdCtrlSelect ctrlmode lscheme; selectEdCtrlSelect ctrlmode (SO3ViewportGetMaterialScheme viewportstr.V3D_viewport); setEdCtrlSelectCb ctrlmode mkfun4 @cbMaterialSchemeSetupSelect p; setEdwindowCbDestroy winMatSchemeSetup @cbDestroyMaterialSchemeSetupWin; 0; ); ); 0;; fun saveCoordsSetup()= let winCoordsSetup -> [obj objstr owinstr mode ctrlpx ctrlpy ctrlpz ctrlpgx ctrlpgy ctrlpgz _ x y] in if (mode == 1) then ( let XMLgetMarkByValueFromMarkSons objstr "position" -> markstr in let SO3ObjectGetPosition obj -> [x y z] in ( XMLsetParam markstr "x" XMLgetShortFloatToString x; XMLsetParam markstr "y" XMLgetShortFloatToString y; XMLsetParam markstr "z" XMLgetShortFloatToString z; ); ) else if (mode == 2) then ( let XMLgetMarkByValueFromMarkSons objstr "rotation" -> markstr in let SO3ObjectGetOrientation obj -> [qx qy qz qw] in ( let SO3ObjectGetOrientation obj -> [qx qy qz qw] in ( XMLsetParam markstr "qx" XMLgetShortFloatToString qx; XMLsetParam markstr "qy" XMLgetShortFloatToString qy; XMLsetParam markstr "qz" XMLgetShortFloatToString qz; XMLsetParam markstr "qw" XMLgetShortFloatToString qw; ); ); ) else if (mode == 3) then ( let XMLgetMarkByValueFromMarkSons objstr "scale" -> markstr in let SO3ObjectGetScale obj -> [x y z] in ( XMLsetParam markstr "x" XMLgetShortFloatToString x; XMLsetParam markstr "y" XMLgetShortFloatToString y; XMLsetParam markstr "z" XMLgetShortFloatToString z; ); ) else nil; 0;; fun cbCoordsSetupPositionX(ctrl, value, p)= let p -> [viewstr val type objstr global] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let if global then SO3ObjectGetGlobalPosition obj else SO3ObjectGetPosition obj -> [opx opy opz] in ( // reinit anim to avoid anim reset bad pose let winAnimSetup -> [animstr _ tbstr chkplaypause trm] in if (obj != animstr.V3D_meshAnim) || (!(V3DgetAnimationEnable animstr)) then nil else ( if trm == nil then nil else _deltimer trm; V3DresetAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); /* // reinit particle to use the same way than particles let winParticleSetup -> [partsystem _ tbstr chkplaypause] in if (obj != partsystem) || !(SO3ParticleSystemGetEnable partsystem) then nil else ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; setEdToolBarCheckState tbstr chkplaypause 0; ); */ if global then SO3ObjectSetGlobalPosition obj [value opy opz] else SO3ObjectSetPosition obj [value opy opz]; let SO3ObjectGetPosition obj -> [x y z] in let SO3ObjectGetGlobalPosition obj -> [gx gy gz] in let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in ( if (!global) then nil else setEdCtrlFloatValueWithoutCallback ctrlx x; setEdCtrlFloatValueWithoutCallback ctrly y; setEdCtrlFloatValueWithoutCallback ctrlz z; if (global) then nil else setEdCtrlFloatValueWithoutCallback ctrlgx gx; setEdCtrlFloatValueWithoutCallback ctrlgy gy; setEdCtrlFloatValueWithoutCallback ctrlgz gz; // update physic body updateSonsPhysicsBody sessionstr objstr obj; ); ); 0;; fun cbCoordsSetupPositionY(ctrl, value, p)= let p -> [viewstr val type objstr global] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let if global then SO3ObjectGetGlobalPosition obj else SO3ObjectGetPosition obj -> [opx opy opz] in ( // reinit anim to avoid anim reset bad pose let winAnimSetup -> [animstr _ tbstr chkplaypause trm] in if (obj != animstr.V3D_meshAnim) || (!(V3DgetAnimationEnable animstr)) then nil else ( if trm == nil then nil else _deltimer trm; V3DresetAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); /* // reinit particle to use the same way than particles let winParticleSetup -> [partsystem _ tbstr chkplaypause] in if (obj != partsystem) || !(SO3ParticleSystemGetEnable partsystem) then nil else ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; setEdToolBarCheckState tbstr chkplaypause 0; ); */ if global then SO3ObjectSetGlobalPosition obj [opx value opz] else SO3ObjectSetPosition obj [opx value opz]; let SO3ObjectGetPosition obj -> [x y z] in let SO3ObjectGetGlobalPosition obj -> [gx gy gz] in let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in ( setEdCtrlFloatValueWithoutCallback ctrlx x; if (!global) then nil else setEdCtrlFloatValueWithoutCallback ctrly y; setEdCtrlFloatValueWithoutCallback ctrlz z; setEdCtrlFloatValueWithoutCallback ctrlgx gx; if (global) then nil else setEdCtrlFloatValueWithoutCallback ctrlgy gy; setEdCtrlFloatValueWithoutCallback ctrlgz gz; // update physic body updateSonsPhysicsBody sessionstr objstr obj; ); ); 0;; fun cbCoordsSetupPositionZ(ctrl, value, p)= let p -> [viewstr val type objstr global] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let if global then SO3ObjectGetGlobalPosition obj else SO3ObjectGetPosition obj -> [opx opy opz] in ( // reinit anim to avoid anim reset bad pose let winAnimSetup -> [animstr _ tbstr chkplaypause trm] in if (obj != animstr.V3D_meshAnim) || (!(V3DgetAnimationEnable animstr)) then nil else ( if trm == nil then nil else _deltimer trm; V3DresetAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); /* // reinit particle to use the same way than particles let winParticleSetup -> [partsystem _ tbstr chkplaypause] in if (obj != partsystem) || !(SO3ParticleSystemGetEnable partsystem) then nil else ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; setEdToolBarCheckState tbstr chkplaypause 0; ); */ if global then SO3ObjectSetGlobalPosition obj [opx opy value] else SO3ObjectSetPosition obj [opx opy value]; let SO3ObjectGetPosition obj -> [x y z] in let SO3ObjectGetGlobalPosition obj -> [gx gy gz] in let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in ( setEdCtrlFloatValueWithoutCallback ctrlx x; setEdCtrlFloatValueWithoutCallback ctrly y; if (!global) then nil else setEdCtrlFloatValueWithoutCallback ctrlz z; setEdCtrlFloatValueWithoutCallback ctrlgx gx; setEdCtrlFloatValueWithoutCallback ctrlgy gy; if (global) then nil else setEdCtrlFloatValueWithoutCallback ctrlgz gz; // update physic body updateSonsPhysicsBody sessionstr objstr obj; ); ); 0;; fun cbCoordsSetupStatePosition(ctrl, pvalue, nvalue, p)= let p -> [viewstr val type objstr axis] in let XMLgetMarkByValueFromMarkSons objstr "position" -> objpositionstr in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let SO3ObjectGetPosition obj -> [x y z] in ( addObjHistoryState val objstr obj 1; if (axis == 1) then XMLsetParam objpositionstr "x" XMLgetShortFloatToString x else if (axis == 2) then XMLsetParam objpositionstr "y" XMLgetShortFloatToString y else if (axis == 3) then XMLsetParam objpositionstr "z" XMLgetShortFloatToString z else nil; ); 0;; /** cbDestroyCoordsSetupWin [EdWindow] I * callback on destroy coords setting window * * private * * return 0 **/ fun cbDestroyCoordsSetupWin(winstr)= set winCoordsSetup = nil; 0;; fun cbMoveCoordsSetupWin(winstr, x, y)= mutate winCoordsSetup <- [_ _ _ _ _ _ _ _ _ _ _ x y]; 0;; fun cbTreeMenuObjectSetPosition(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let winCoordsSetup -> [wobj wobjstr owinstr mode ctrlpx ctrlpy ctrlpz ctrlpgx ctrlpgy ctrlpgz _ x y] in let SO3ObjectGetPosition obj -> [opx opy opz] in let SO3ObjectGetGlobalPosition obj -> [ogpx ogpy ogpz] in if (wobj != obj) || (mode != 1) then ( if ((winCoordsSetup != nil) && (mode == 1)) then ( // save previous state saveCoordsSetup; if (type == iTypeScene) || (type == nil) || (type == iTypeCompositor) || (type == iTypeSkyBox) || (type == iTypeSkyDome) || (type == iTypeSkyPlane) || (type == iTypeAnim) then ( // save previous state saveCoordsSetup; dsEdWindow owinstr; set winCoordsSetup = nil; 0; ) else ( setEdWindowName owinstr strcatn val::" "::(loc "OS3D_0011")::nil; setEdCtrlFloatCbChange ctrlpx mkfun3 @cbCoordsSetupPositionX [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlpx mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlpy mkfun3 @cbCoordsSetupPositionY [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlpy mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 2]; setEdCtrlFloatCbChange ctrlpz mkfun3 @cbCoordsSetupPositionZ [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlpz mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 3]; setEdCtrlFloatCbChange ctrlpgx mkfun3 @cbCoordsSetupPositionX [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlpgx mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlpgy mkfun3 @cbCoordsSetupPositionY [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlpgy mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 2]; setEdCtrlFloatCbChange ctrlpgz mkfun3 @cbCoordsSetupPositionZ [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlpgz mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 3]; setEdCtrlFloatValue ctrlpx opx; setEdCtrlFloatValue ctrlpy opy; setEdCtrlFloatValue ctrlpz opz; setEdCtrlFloatValue ctrlpgx ogpx; setEdCtrlFloatValue ctrlpgy ogpy; setEdCtrlFloatValue ctrlpgz ogpz; mutate winCoordsSetup <- [obj markstr _ _ _ _ _ _ _ _ _ x y]; 0; ); 0; ) else ( if (winCoordsSetup == nil) then nil else ( // save previous state saveCoordsSetup; dsEdWindow owinstr; set winCoordsSetup = nil; ); if (type == iTypeScene) || (type == nil) || (type == iTypeCompositor) || (type == iTypeSkyBox) || (type == iTypeSkyDome) || (type == iTypeSkyPlane) || (type == iTypeAnim) then nil else let p -> [viewstr val type markstr] in let [280 115] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [px py] in let (if x == nil then px else x) -> x in let (if y == nil then py else y) -> y in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcatn val::" "::(loc "OS3D_0011")::nil) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 12 135 20 (loc "OS3D_0230") nil -> labelloc in let crEdCtrlLabel winstr 10 37 20 20 "X" nil -> labelx in let crEdCtrlFloat winstr 35 35 100 20 opx (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlx in let crEdCtrlLabel winstr 10 62 20 20 "Y" nil -> labely in let crEdCtrlFloat winstr 35 60 100 20 opy (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrly in let crEdCtrlLabel winstr 10 87 20 20 "Z" nil -> labelz in let crEdCtrlFloat winstr 35 85 100 20 opz (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlz in let crEdCtrlLabel winstr 145 12 135 20 (loc "OS3D_0176") nil -> labelloc in let crEdCtrlLabel winstr 145 37 20 20 "X" nil -> labelgx in let crEdCtrlFloat winstr 170 35 100 20 ogpx (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlgx in let crEdCtrlLabel winstr 145 62 20 20 "Y" nil -> labelgy in let crEdCtrlFloat winstr 170 60 100 20 ogpy (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlgy in let crEdCtrlLabel winstr 145 87 20 20 "Z" nil -> labelgz in let crEdCtrlFloat winstr 170 85 100 20 ogpz (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlgz in ( set winCoordsSetup = [obj markstr dwinstr 1 ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz nil x y]; setEdCtrlFloatCbChange ctrlx mkfun3 @cbCoordsSetupPositionX [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlx mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrly mkfun3 @cbCoordsSetupPositionY [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrly mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 2]; setEdCtrlFloatCbChange ctrlz mkfun3 @cbCoordsSetupPositionZ [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlz mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 3]; setEdCtrlFloatCbChange ctrlgx mkfun3 @cbCoordsSetupPositionX [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlgx mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlgy mkfun3 @cbCoordsSetupPositionY [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlgy mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 2]; setEdCtrlFloatCbChange ctrlgz mkfun3 @cbCoordsSetupPositionZ [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlgz mkfun4 @cbCoordsSetupStatePosition [viewstr val type markstr 3]; setEdwindowCbMove dwinstr @cbMoveCoordsSetupWin; setEdwindowCbDestroy dwinstr @cbDestroyCoordsSetupWin; 0; ); ); ) else ( setEdCtrlFloatValue ctrlpx opx; setEdCtrlFloatValue ctrlpy opy; setEdCtrlFloatValue ctrlpz opz; setEdCtrlFloatValue ctrlpgx ogpx; setEdCtrlFloatValue ctrlpgy ogpy; setEdCtrlFloatValue ctrlpgz ogpz; 0; ); 0;; fun cbCoordsSetupOrientation(ctrl, value, p)= let p -> [viewstr val type objstr global] in let V3DgetDefaultSession viewstr -> sessionstr in let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let getEdCtrlFloatValue if global then ctrlgx else ctrlx -> xval in let getEdCtrlFloatValue if global then ctrlgy else ctrly -> yval in let getEdCtrlFloatValue if global then ctrlgz else ctrlz -> zval in let [(SO3MathsDegreeToRadian xval) (SO3MathsDegreeToRadian yval) (SO3MathsDegreeToRadian zval)] -> eang in let SO3MathsEulerYXZToQuat eang -> quat in ( // reinit anim to avoid anim reset bad pose let winAnimSetup -> [animstr _ tbstr chkplaypause trm] in if (obj != animstr.V3D_meshAnim) || (!(V3DgetAnimationEnable animstr)) then nil else ( if trm == nil then nil else _deltimer trm; V3DresetAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); /* // reinit particle to use the same way than particles let winParticleSetup -> [partsystem _ tbstr chkplaypause] in if (obj != partsystem) || !(SO3ParticleSystemGetEnable partsystem) then nil else ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; setEdToolBarCheckState tbstr chkplaypause 0; );*/ if global then SO3ObjectSetGlobalOrientation obj quat else SO3ObjectSetOrientation obj quat; let SO3ObjectGetGlobalOrientation obj -> gquat in let SO3MathsQuatToEulerYXZ gquat -> [gx gy gz] in let SO3MathsRadianToDegree gx -> gx in let SO3MathsRadianToDegree gy -> gy in let SO3MathsRadianToDegree gz -> gz in let SO3ObjectGetOrientation obj -> [qx qy qz qw] in let SO3MathsQuatToEulerYXZ [qx qy qz qw] -> [x y z] in let SO3MathsRadianToDegree x -> x in let SO3MathsRadianToDegree y -> y in let SO3MathsRadianToDegree z -> z in ( if (!global) then nil else ( setEdCtrlFloatValueWithoutCallback ctrlx x; setEdCtrlFloatValueWithoutCallback ctrly y; setEdCtrlFloatValueWithoutCallback ctrlz z; ); if (global) then nil else ( setEdCtrlFloatValueWithoutCallback ctrlgx gx; setEdCtrlFloatValueWithoutCallback ctrlgy gy; setEdCtrlFloatValueWithoutCallback ctrlgz gz; ); ); // update physic body updateSonsPhysicsBody sessionstr objstr obj; ); 0;; fun cbCoordsSetupStateOrientation(ctrl, pvalue, nvalue, p)= let p -> [viewstr val type objstr] in let V3DgetDefaultSession viewstr -> sessionstr in let XMLgetMarkByValueFromMarkSons objstr "rotation" -> objorientationstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in ( addObjHistoryState val objstr obj 2; let SO3ObjectGetOrientation obj -> [qx qy qz qw] in ( XMLsetParam objorientationstr "qx" XMLgetShortFloatToString qx; XMLsetParam objorientationstr "qy" XMLgetShortFloatToString qy; XMLsetParam objorientationstr "qz" XMLgetShortFloatToString qz; XMLsetParam objorientationstr "qw" XMLgetShortFloatToString qw; ); ); 0;; fun cbTreeMenuObjectSetOrientation(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let SO3ObjectGetGlobalOrientation obj -> gquat in let SO3MathsQuatToEulerYXZ gquat -> [dgx dgy dgz] in let SO3MathsRadianToDegree dgx -> dgx in let SO3MathsRadianToDegree dgy -> dgy in let SO3MathsRadianToDegree dgz -> dgz in let SO3ObjectGetOrientation obj -> quat in let SO3MathsQuatToEulerYXZ quat -> [dx dy dz] in let SO3MathsRadianToDegree dx -> dx in let SO3MathsRadianToDegree dy -> dy in let SO3MathsRadianToDegree dz -> dz in let winCoordsSetup -> [wobj wobjstr owinstr mode ctrlpx ctrlpy ctrlpz ctrlpgx ctrlpgy ctrlpgz _ x y] in if (wobj != obj) || (mode != 2) then ( if ((winCoordsSetup != nil) && (mode == 2)) then ( // save previous state saveCoordsSetup; if (type == iTypeScene) || (type == nil) || (type == iTypeCompositor) || (type == iTypeSkyBox) || (type == iTypeSkyDome) || (type == iTypeSkyPlane) || (type == iTypeAnim) then ( // save previous state saveCoordsSetup; dsEdWindow owinstr; set winCoordsSetup = nil; 0; ) else ( setEdWindowName owinstr strcatn val::" "::(loc "OS3D_0010")::nil; setEdCtrlFloatCbValidate ctrlpx mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbValidate ctrlpy mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbValidate ctrlpz mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbChange ctrlpx mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbChange ctrlpy mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbChange ctrlpz mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlpx mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatCbChangedValue ctrlpy mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatCbChangedValue ctrlpz mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatCbValidate ctrlpgx mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbValidate ctrlpgy mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbValidate ctrlpgz mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlpgx mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlpgy mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlpgz mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlpgx mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatCbChangedValue ctrlpgy mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatCbChangedValue ctrlpgz mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatValue ctrlpx dx; setEdCtrlFloatValue ctrlpy dy; setEdCtrlFloatValue ctrlpz dz; setEdCtrlFloatValue ctrlpgx dgx; setEdCtrlFloatValue ctrlpgy dgy; setEdCtrlFloatValue ctrlpgz dgz; mutate winCoordsSetup <- [obj markstr _ _ _ _ _ _ _ _ _ x y]; 0; ); 0; ) else ( if (winCoordsSetup == nil) then nil else ( // save previous state saveCoordsSetup; dsEdWindow owinstr; set winCoordsSetup = nil; ); if (type == iTypeScene) || (type == nil) || (type == iTypeCompositor) || (type == iTypeSkyBox) || (type == iTypeSkyDome) || (type == iTypeSkyPlane) || (type == iTypeAnim) then nil else let [280 115] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [px py] in let (if x == nil then px else x) -> x in let (if y == nil then py else y) -> y in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcatn val::" "::(loc "OS3D_0010")::nil) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let crEdCtrlLabel winstr 10 12 135 20 (loc "OS3D_0230") nil -> labelloc in let crEdCtrlLabel winstr 10 37 20 20 "X" nil -> labelx in let crEdCtrlFloat winstr 35 35 100 20 dx (-.720.0) 720.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlx in let crEdCtrlLabel winstr 10 62 20 20 "Y" nil -> labely in let crEdCtrlFloat winstr 35 60 100 20 dy (-.720.0) 720.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrly in let crEdCtrlLabel winstr 10 87 20 20 "Z" nil -> labelz in let crEdCtrlFloat winstr 35 85 100 20 dz (-.720.0) 720.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlz in let crEdCtrlLabel winstr 145 12 135 20 (loc "OS3D_0176") nil -> labelloc in let crEdCtrlLabel winstr 145 37 20 20 "X" nil -> labelgx in let crEdCtrlFloat winstr 170 35 100 20 dgx (-.720.0) 720.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlgx in let crEdCtrlLabel winstr 145 62 20 20 "Y" nil -> labelgy in let crEdCtrlFloat winstr 170 60 100 20 dgy (-.720.0) 720.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlgy in let crEdCtrlLabel winstr 145 87 20 20 "Z" nil -> labelgz in let crEdCtrlFloat winstr 170 85 100 20 dgz (-.720.0) 720.0 0.1 2 nil EDWIN_RESIZE_MW -> ctrlgz in ( set winCoordsSetup = [obj markstr dwinstr 2 ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz nil x y]; setEdCtrlFloatCbValidate ctrlx mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbValidate ctrly mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbValidate ctrlz mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbChange ctrlx mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbChange ctrly mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbChange ctrlz mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlx mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatCbChangedValue ctrly mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatCbChangedValue ctrlz mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatCbValidate ctrlgx mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbValidate ctrlgy mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbValidate ctrlgz mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlgx mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlgy mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlgz mkfun3 @cbCoordsSetupOrientation [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlgx mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatCbChangedValue ctrlgy mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdCtrlFloatCbChangedValue ctrlgz mkfun4 @cbCoordsSetupStateOrientation [viewstr val type markstr]; setEdwindowCbMove dwinstr @cbMoveCoordsSetupWin; setEdwindowCbDestroy dwinstr @cbDestroyCoordsSetupWin; 0; ); ); ) else ( setEdCtrlFloatValue ctrlpx dx; setEdCtrlFloatValue ctrlpy dy; setEdCtrlFloatValue ctrlpz dz; setEdCtrlFloatValue ctrlpgx dgx; setEdCtrlFloatValue ctrlpgy dgy; setEdCtrlFloatValue ctrlpgz dgz; 0; ); 0;; fun cbCoordsSetupScaleOffset(ctrl, value, p)= let p -> [viewstr val type objstr global] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let SO3ObjectGetScale obj -> [opx opy opz] in let if opx == nil then 1.0 else opx -> opx in let if opy == nil then 1.0 else opy -> opy in let if opz == nil then 1.0 else opz -> opz in let value /. 100.0 -> value in let [(opx *. value) (opy *. value) (opz *. value)] -> [opx opy opz] in ( addObjHistoryState val objstr obj 3; // reinit anim to avoid anim reset bad pose let winAnimSetup -> [animstr _ tbstr chkplaypause trm] in if (obj != animstr.V3D_meshAnim) || (!(V3DgetAnimationEnable animstr)) then nil else ( if trm == nil then nil else _deltimer trm; V3DresetAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); // reinit particle to use the same way than particles /* let winParticleSetup -> [partsystem _ tbstr chkplaypause] in if (obj != partsystem) || !(SO3ParticleSystemGetEnable partsystem) then nil else ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; setEdToolBarCheckState tbstr chkplaypause 0; );*/ SO3ObjectSetScale obj [opx opy opz]; let SO3ObjectGetScale obj -> [x y z] in let SO3ObjectGetGlobalScale obj -> [gx gy gz] in let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz ctrlo _ _] in ( let XMLgetMarkByValueFromMarkSons objstr "scale" -> objscalestr in ( XMLsetParam objscalestr "x" XMLgetShortFloatToString x; XMLsetParam objscalestr "y" XMLgetShortFloatToString y; XMLsetParam objscalestr "z" XMLgetShortFloatToString z; ); setEdCtrlFloatValueWithoutCallback ctrlx x; setEdCtrlFloatValueWithoutCallback ctrly y; setEdCtrlFloatValueWithoutCallback ctrlz z; setEdCtrlFloatValueWithoutCallback ctrlgx gx; setEdCtrlFloatValueWithoutCallback ctrlgy gy; setEdCtrlFloatValueWithoutCallback ctrlgz gz; setEdCtrlFloatValueWithoutCallback ctrlo 100.0; ); // update physic body updateSonsPhysicsBody sessionstr objstr obj; ); 0;; fun cbCoordsSetupScaleX(ctrl, value, p)= let p -> [viewstr val type objstr global] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let if global then SO3ObjectGetGlobalScale obj else SO3ObjectGetScale obj -> [opx opy opz] in let if opx == nil then 1.0 else opx -> opx in let if opy == nil then 1.0 else opy -> opy in let if opz == nil then 1.0 else opz -> opz in ( // reinit anim to avoid anim reset bad pose let winAnimSetup -> [animstr _ tbstr chkplaypause trm] in if (obj != animstr.V3D_meshAnim) || (!(V3DgetAnimationEnable animstr)) then nil else ( if trm == nil then nil else _deltimer trm; V3DresetAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); // reinit particle to use the same way than particles /* let winParticleSetup -> [partsystem _ tbstr chkplaypause] in if (obj != partsystem) || !(SO3ParticleSystemGetEnable partsystem) then nil else ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; setEdToolBarCheckState tbstr chkplaypause 0; );*/ if global then SO3ObjectSetGlobalScale obj [value opy opz] else SO3ObjectSetScale obj [value opy opz]; let SO3ObjectGetScale obj -> [x y z] in let SO3ObjectGetGlobalScale obj -> [gx gy gz] in let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in ( let XMLgetMarkByValueFromMarkSons objstr "scale" -> objscalestr in ( XMLsetParam objscalestr "x" XMLgetShortFloatToString x; XMLsetParam objscalestr "y" XMLgetShortFloatToString y; XMLsetParam objscalestr "z" XMLgetShortFloatToString z; ); if (!global) then nil else setEdCtrlFloatValueWithoutCallback ctrlx x; setEdCtrlFloatValueWithoutCallback ctrly y; setEdCtrlFloatValueWithoutCallback ctrlz z; if (global) then nil else setEdCtrlFloatValueWithoutCallback ctrlgx gx; setEdCtrlFloatValueWithoutCallback ctrlgy gy; setEdCtrlFloatValueWithoutCallback ctrlgz gz; ); // update physic body updateSonsPhysicsBody sessionstr objstr obj; ); 0;; fun cbCoordsSetupScaleY(ctrl, value, p)= let p -> [viewstr val type objstr global] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let if global then SO3ObjectGetGlobalScale obj else SO3ObjectGetScale obj -> [opx opy opz] in let if opx == nil then 1.0 else opx -> opx in let if opy == nil then 1.0 else opy -> opy in let if opz == nil then 1.0 else opz -> opz in ( // reinit anim to avoid anim reset bad pose let winAnimSetup -> [animstr _ tbstr chkplaypause trm] in if (obj != animstr.V3D_meshAnim) || (!(V3DgetAnimationEnable animstr)) then nil else ( if trm == nil then nil else _deltimer trm; V3DresetAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); // reinit particle to use the same way than particles /* let winParticleSetup -> [partsystem _ tbstr chkplaypause] in if (obj != partsystem) || !(SO3ParticleSystemGetEnable partsystem) then nil else ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; setEdToolBarCheckState tbstr chkplaypause 0; );*/ if global then SO3ObjectSetGlobalScale obj [opx value opz] else SO3ObjectSetScale obj [opx value opz]; let SO3ObjectGetScale obj -> [x y z] in let SO3ObjectGetGlobalScale obj -> [gx gy gz] in let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in ( let XMLgetMarkByValueFromMarkSons objstr "scale" -> objscalestr in ( XMLsetParam objscalestr "x" XMLgetShortFloatToString x; XMLsetParam objscalestr "y" XMLgetShortFloatToString y; XMLsetParam objscalestr "z" XMLgetShortFloatToString z; ); setEdCtrlFloatValueWithoutCallback ctrlx x; if (!global) then nil else setEdCtrlFloatValueWithoutCallback ctrly y; setEdCtrlFloatValueWithoutCallback ctrlz z; setEdCtrlFloatValueWithoutCallback ctrlgx gx; if (global) then nil else setEdCtrlFloatValueWithoutCallback ctrlgy gy; setEdCtrlFloatValueWithoutCallback ctrlgz gz; ); // update physic body updateSonsPhysicsBody sessionstr objstr obj; ); 0;; fun cbCoordsSetupScaleZ(ctrl, value, p)= let p -> [viewstr val type objstr global] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let if global then SO3ObjectGetGlobalScale obj else SO3ObjectGetScale obj -> [opx opy opz] in let if opx == nil then 1.0 else opx -> opx in let if opy == nil then 1.0 else opy -> opy in let if opz == nil then 1.0 else opz -> opz in ( // reinit anim to avoid anim reset bad pose let winAnimSetup -> [animstr _ tbstr chkplaypause trm] in if (obj != animstr.V3D_meshAnim) || (!(V3DgetAnimationEnable animstr)) then nil else ( if trm == nil then nil else _deltimer trm; V3DresetAnimation animstr; setEdToolBarCheckState tbstr chkplaypause 0; ); // reinit particle to use the same way than particles /* let winParticleSetup -> [partsystem _ tbstr chkplaypause] in if (obj != partsystem) || !(SO3ParticleSystemGetEnable partsystem) then nil else ( SO3ParticleSystemSetEnable partsystem 0; SO3ParticleSystemClear partsystem; setEdToolBarCheckState tbstr chkplaypause 0; );*/ if global then SO3ObjectSetGlobalScale obj [opx opy value] else SO3ObjectSetScale obj [opx opy value]; let SO3ObjectGetScale obj -> [x y z] in let SO3ObjectGetGlobalScale obj -> [gx gy gz] in let winCoordsSetup -> [wobj _ _ mode ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz _ _ _] in ( let XMLgetMarkByValueFromMarkSons objstr "scale" -> objscalestr in ( XMLsetParam objscalestr "x" XMLgetShortFloatToString x; XMLsetParam objscalestr "y" XMLgetShortFloatToString y; XMLsetParam objscalestr "z" XMLgetShortFloatToString z; ); setEdCtrlFloatValueWithoutCallback ctrlx x; setEdCtrlFloatValueWithoutCallback ctrly y; if (!global) then nil else setEdCtrlFloatValueWithoutCallback ctrlz z; setEdCtrlFloatValueWithoutCallback ctrlgx gx; setEdCtrlFloatValueWithoutCallback ctrlgy gy; if (global) then nil else setEdCtrlFloatValueWithoutCallback ctrlgz gz; ); // update physic body updateSonsPhysicsBody sessionstr objstr obj; ); 0;; fun cbCoordsSetupStateScale(ctrl, pvalue, nvalue, p)= let p -> [viewstr val type objstr axis] in let XMLgetMarkByValueFromMarkSons objstr "scale" -> objscalestr in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let SO3ObjectGetScale obj -> [x y z] in ( addObjHistoryState val objstr obj 3; if (axis == 0) then ( XMLsetParam objscalestr "x" XMLgetShortFloatToString x; XMLsetParam objscalestr "y" XMLgetShortFloatToString y; XMLsetParam objscalestr "z" XMLgetShortFloatToString z; ) else if (axis == 1) then XMLsetParam objscalestr "x" XMLgetShortFloatToString x else if (axis == 2) then XMLsetParam objscalestr "y" XMLgetShortFloatToString y else if (axis == 3) then XMLsetParam objscalestr "z" XMLgetShortFloatToString z else nil; ); 0;; fun cbTreeMenuObjectSetScale(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let SO3ObjectGetScale obj -> [opx opy opz] in let SO3ObjectGetGlobalScale obj -> [ogpx ogpy ogpz] in let winCoordsSetup -> [wobj wobjstr owinstr mode ctrlpx ctrlpy ctrlpz ctrlpgx ctrlpgy ctrlpgz ctrlo x y] in if (wobj != obj) || (mode != 3) then ( if ((winCoordsSetup != nil) && (mode == 3)) then ( // save previous state saveCoordsSetup; if (type == iTypeScene) || (type == nil) || (type == iTypeCompositor) || (type == iTypeSkyBox) || (type == iTypeSkyDome) || (type == iTypeSkyPlane) || (type == iTypeAnim) then ( // save previous state saveCoordsSetup; dsEdWindow owinstr; set winCoordsSetup = nil; 0; ) else ( setEdWindowName owinstr strcatn val::" "::(loc "OS3D_0012")::nil; setEdCtrlFloatCbValidate ctrlo mkfun3 @cbCoordsSetupScaleOffset [viewstr val type markstr 0]; setEdCtrlFloatCbChange ctrlpx mkfun3 @cbCoordsSetupScaleX [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlpx mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlpy mkfun3 @cbCoordsSetupScaleY [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlpy mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 2]; setEdCtrlFloatCbChange ctrlpz mkfun3 @cbCoordsSetupScaleZ [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlpz mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 3]; setEdCtrlFloatCbChange ctrlpgx mkfun3 @cbCoordsSetupScaleX [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlpgx mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlpgy mkfun3 @cbCoordsSetupScaleY [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlpgy mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 2]; setEdCtrlFloatCbChange ctrlpgz mkfun3 @cbCoordsSetupScaleZ [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlpgz mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 3]; setEdCtrlFloatValue ctrlpx opx; setEdCtrlFloatValue ctrlpy opy; setEdCtrlFloatValue ctrlpz opz; setEdCtrlFloatValue ctrlpgx ogpx; setEdCtrlFloatValue ctrlpgy ogpy; setEdCtrlFloatValue ctrlpgz ogpz; mutate winCoordsSetup <- [obj markstr _ _ _ _ _ _ _ _ _ x y]; 0; ); 0; ) else ( if (winCoordsSetup == nil) then nil else ( // save previous state saveCoordsSetup; dsEdWindow owinstr; set winCoordsSetup = nil; ); if (type == iTypeScene) || (type == iTypeCamera) || (type == nil) || (type == iTypeCompositor) || (type == iTypeSkyBox) || (type == iTypeSkyDome) || (type == iTypeSkyPlane) || (type == iTypeAnim) then nil else let p -> [viewstr val type markstr] in let [280 140] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [px py] in let (if x == nil then px else x) -> x in let (if y == nil then py else y) -> y in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU nil strcatn val::" "::(loc "OS3D_0012")::nil) sWinDlgIcon -> dwinstr in let crEdWindow _channel dwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil nil "" -> winstr in let 10 -> ypos in let crEdCtrlLabel winstr 10 ypos + 2 80 20 (loc "OS3D_0574") nil -> labeloffset in let crEdCtrlFloat winstr ((iw / 2) - 40) ypos 100 20 100.0 (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrloffset in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 135 20 (loc "OS3D_0230") nil -> labelloc in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 20 20 "X" nil -> labelx in let crEdCtrlFloat winstr 35 ypos 100 20 opx (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlx in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 20 20 "Y" nil -> labely in let crEdCtrlFloat winstr 35 ypos 100 20 opy (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrly in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 20 20 "Z" nil -> labelz in let crEdCtrlFloat winstr 35 ypos 100 20 opz (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlz in let 10 -> ypos in let crEdCtrlLabel winstr 145 (set ypos = ypos + 25) + 2 135 20 (loc "OS3D_0176") nil -> labelloc in let crEdCtrlLabel winstr 145 (set ypos = ypos + 25) + 2 20 20 "X" nil -> labelgx in let crEdCtrlFloat winstr 170 ypos 100 20 ogpx (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlgx in let crEdCtrlLabel winstr 145 (set ypos = ypos + 25) + 2 20 20 "Y" nil -> labelgy in let crEdCtrlFloat winstr 170 ypos 100 20 ogpy (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlgy in let crEdCtrlLabel winstr 145 (set ypos = ypos + 25) + 2 20 20 "Z" nil -> labelgz in let crEdCtrlFloat winstr 170 ypos 100 20 ogpz (-.10000000.0) 10000000.0 0.01 5 nil EDWIN_RESIZE_MW -> ctrlgz in ( set winCoordsSetup = [obj markstr dwinstr 3 ctrlx ctrly ctrlz ctrlgx ctrlgy ctrlgz ctrloffset x y]; setEdCtrlFloatCbValidate ctrloffset mkfun3 @cbCoordsSetupScaleOffset [viewstr val type markstr 0]; //setEdCtrlFloatCbChangedValue ctrloffset mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 0]; setEdCtrlFloatCbChange ctrlx mkfun3 @cbCoordsSetupScaleX [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlx mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrly mkfun3 @cbCoordsSetupScaleY [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrly mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 2]; setEdCtrlFloatCbChange ctrlz mkfun3 @cbCoordsSetupScaleZ [viewstr val type markstr 0]; setEdCtrlFloatCbChangedValue ctrlz mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 3]; setEdCtrlFloatCbChange ctrlgx mkfun3 @cbCoordsSetupScaleX [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlgx mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 1]; setEdCtrlFloatCbChange ctrlgy mkfun3 @cbCoordsSetupScaleY [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlgy mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 2]; setEdCtrlFloatCbChange ctrlgz mkfun3 @cbCoordsSetupScaleZ [viewstr val type markstr 1]; setEdCtrlFloatCbChangedValue ctrlgz mkfun4 @cbCoordsSetupStateScale [viewstr val type markstr 3]; setEdwindowCbMove dwinstr @cbMoveCoordsSetupWin; setEdwindowCbDestroy dwinstr @cbDestroyCoordsSetupWin; 0; ); ); ) else ( setEdCtrlFloatValue ctrlpx opx; setEdCtrlFloatValue ctrlpy opy; setEdCtrlFloatValue ctrlpz opz; setEdCtrlFloatValue ctrlpgx ogpx; setEdCtrlFloatValue ctrlpgy ogpy; setEdCtrlFloatValue ctrlpgz ogpz; 0; ); 0;; fun setEditorModeState(viewstr, state)= if (bAppPlay) then nil else ( let mainInterf.MINT_winView -> [_ [tbstr _ _ chkselect chkmove chkrotate chkscale _ _ _ _ _ _ _ _ _ _ _ _ _]] in let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) sSelected -> obj in if (state) then ( setEdToolBarCheckEnable tbstr chkselect 1; setEdToolBarCheckEnable tbstr chkmove 1; setEdToolBarCheckEnable tbstr chkrotate 1; setEdToolBarCheckEnable tbstr chkscale 1; // get the selected object axis and rebuild the good axe mode if (!strcmp sSelected "default_light") then nil else V3DsetCbAxisClick (V3DshowObjectAxis viewstr sessionstr obj iViewerEditMode 1) mkfun8 @cbAxisClick viewstr; 0; ) else ( setEdToolBarCheckEnable tbstr chkselect 0; setEdToolBarCheckEnable tbstr chkmove 0; setEdToolBarCheckEnable tbstr chkrotate 0; setEdToolBarCheckEnable tbstr chkscale 0; V3DsetCbAxisClick (V3DshowObjectAxis viewstr sessionstr obj iViewerEditMode 0) nil; 0; ); ); set iViewerEditState = state; 0;; /** cbChangeEditMode [EdToolBar CompCheck I I I [V3Dview [CompCheck CompCheck CompCheck CompCheck]]] I * callback on change edit mode (select, move, rotate, scale) * * private * * return 0 **/ fun cbChangeEditMode(tbstr, check, btn, mask, state, p)= let p -> [viewstr [chkselect chkmove chkrotate chkscale]] in ( if check == chkselect then ( set iViewerEditMode = 0; setEdToolBarCheckState tbstr chkselect 1; setEdToolBarCheckState tbstr chkmove 0; setEdToolBarCheckState tbstr chkrotate 0; setEdToolBarCheckState tbstr chkscale 0; ) else if check == chkmove then ( set iViewerEditMode = 1; setEdToolBarCheckState tbstr chkselect 0; setEdToolBarCheckState tbstr chkmove 1; setEdToolBarCheckState tbstr chkrotate 0; setEdToolBarCheckState tbstr chkscale 0; if btn != 2 then nil else ( let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in if (ttype == iTypeScene) || (ttype == nil) || (ttype == iTypeCompositor) || (ttype == iTypeSkyBox) || (ttype == iTypeSkyDome) || (ttype == iTypeSkyPlane) || (ttype == iTypeAnim) then nil else cbTreeMenuObjectSetPosition treeitem [viewstr sSelected ttype markstr]; ); ) else if check == chkrotate then ( set iViewerEditMode = 2; setEdToolBarCheckState tbstr chkselect 0; setEdToolBarCheckState tbstr chkmove 0; setEdToolBarCheckState tbstr chkrotate 1; setEdToolBarCheckState tbstr chkscale 0; if btn != 2 then nil else ( let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in if (ttype == iTypeScene) || (ttype == nil) || (ttype == iTypeCompositor) || (ttype == iTypeSkyBox) || (ttype == iTypeSkyDome) || (ttype == iTypeSkyPlane) || (ttype == iTypeAnim) then nil else cbTreeMenuObjectSetOrientation treeitem [viewstr sSelected ttype markstr]; ); ) else if check == chkscale then ( set iViewerEditMode = 3; setEdToolBarCheckState tbstr chkselect 0; setEdToolBarCheckState tbstr chkmove 0; setEdToolBarCheckState tbstr chkrotate 0; setEdToolBarCheckState tbstr chkscale 1; if btn != 2 then nil else ( let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in if (ttype == iTypeScene) || (ttype == iTypeCamera) || (ttype == nil) || (ttype == iTypeCompositor) || (ttype == iTypeSkyBox) || (ttype == iTypeSkyDome) || (ttype == iTypeSkyPlane) || (ttype == iTypeAnim) then nil else cbTreeMenuObjectSetScale treeitem [viewstr sSelected ttype markstr]; ); ) else nil; // get the selected object axis and rebuild the good axe mode let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) sSelected -> obj in if (!strcmp sSelected "default_light") || !iViewerEditState then nil else V3DsetCbAxisClick (V3DshowObjectAxis viewstr sessionstr obj iViewerEditMode 1) mkfun8 @cbAxisClick viewstr; ); 0;; /** cbChangeCoordsMode [EdToolBar CompCheck I I I V3Dview] I * callback on change coords reference * * private * * return 0 **/ fun cbChangeCoordsMode(tbstr, check, btn, mask, state, viewstr)= V3DsetDefaultAxisRef state; 0;; /** cbChangeNavigateMode [EdToolBar CompCheck I I I V3Dview] I * callback on change navigation mode * * private * * return 0 **/ fun cbChangeNavigateMode(tbstr, check, btn, mask, state, viewstr)= set iNavigationMode = state; let V3DgetDefaultSession viewstr -> sessionstr in let SO3ObjectGetPosition sessionstr.V3D_shellNavigate -> spos in if iNavigationMode then ( V3DsetOrthographicMode (V3DgetDefaultCamera sessionstr) 0; startAvNavMode viewstr spos [0.0 0.0 0.0 1.0] [0.0 0.0 0.0 1.0] 1.5 1.60; ) else stopAvNavMode viewstr; 0;; /** cbChangeShowGrid [EdToolBar CompCheck I I I V3Dview] I * callback on change Show grid state * * private * * return 0 **/ fun cbChangeShowGrid(tbstr, check, btn, mask, state, viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in V3DshowSceneGrid sessionstr state; set bShowGrid = state; 0;; /** cbChangeShowHelpers [EdToolBar CompCheck I I I V3Dview] I * callback on change Show helpers state * * private * * return 0 **/ fun cbChangeShowHelpers(tbstr, check, btn, mask, state, viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in V3DenableHelpers (V3DgetDefaultViewport viewstr) sessionstr state; set bShowHelpers = state; 0;; /** cbChangeShowHelpers [EdToolBar CompCheck I I I V3Dview] I * callback on change Wire mode state * * private * * return 0 **/ fun cbChangeWireMode(tbstr, check, btn, mask, state, viewstr)= setViewWireMode viewstr !bShowWireMode; 0;; /** cbChangeShowInfos [EdToolBar CompCheck I I I V3Dview] I * callback on change Show infos state * * private * * return 0 **/ fun cbChangeShowInfos(tbstr, check, btn, mask, state, viewstr)= set bShowInfos = !bShowInfos; V3DenableScreenInfos viewstr bShowInfos; let V3DgetDefaultSession viewstr -> sessionstr in V3DphysShowDebug sessionstr bShowInfos; 0;; /** cbFitSelection [EdToolBar CompRollOver I I V3Dview] I * callback on fit view * * private * * return 0 **/ fun cbFitSelection(tbstr, cmproll, btn, mask, viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in let getEdCtrlTreeSelectedItem ctrlSceneTree -> item in let getEdCtrlTreeValueByItem ctrlSceneTree item -> [val type] in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let if obj == nil then [0.0 0.0 0.0] else if type == iTypeEntity then V3DgetGlobalObjectCenter obj else SO3ObjectGetGlobalPosition obj -> pos in let SO3SceneGetObject (V3DgetSession sessionstr) "default_camera" -> camera in let SO3CameraGetFOVy camera -> fovy in let if obj == nil then 10.0 *. (itof iGlobalUnit) else if type == iTypeEntity then (V3DgetObjectRadius sessionstr obj) else (1.0 *. (itof iGlobalUnit)) -> curdist in let curdist +. (curdist /. tan fovy) -> dist in ( V3DsetShellNavPos sessionstr pos; if iNavigationMode then nil else ( SO3ObjectSetPosition camera [0.0 0.0 dist]; V3DsetOrthographicScale camera dist; ); ); 0;; fun playEditor(viewstr, state)= let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) sSelected -> obj in let mainInterf.MINT_winView -> [_ [tbstr _ chkplay chkselect chkmove chkrotate chkscale chkcoords btnundo btnredo chknav chkgrid chkhelpers chkinfos btnfit chkwiremode btntop btnfront btnleft btnpers]] in let mainInterf.MINT_winInfos -> [_ _ _ [tbmatstr btnmated btnmatadd btnmatdel btnmatassing]] in ( V3DsetOrthographicMode (V3DgetDefaultCamera sessionstr) 0; set bAppPlay = state; set sIsolatedNode = nil; setEdToolBarCheckState tbstr chkplay state; if state then ( setInfoMessage (loc "OS3D_0209"); //load langs with correct language set prevLanguage = currentLanguage; let getProjectSettingDef "language" currentLanguage -> prjlang in if (!strcmp currentLanguage prjlang) then nil else ( set currentLanguage = prjlang; reloadPluginsLoc; ); //hide camera view showCameraViewport viewstr nil 0; let SO3ObjectGetPosition (V3DgetDefaultCamera sessionstr) -> [_ _ dist] in set tCameraPosition = [(V3DgetShellNavPos sessionstr) (V3DgetShellNavAng sessionstr) dist]; set tLastNavPos = avNavStr.AV_pos; SO3WorldSetBodiesInitialState (V3DgetSession sessionstr); //setEdToolBarCheckState tbstr chknav 0; stopAvNavMode viewstr; //set iNavigationMode = 0; if (OS3D_DEBUG) then nil else ( setEdToolBarCheckEnable tbstr chkselect 0; setEdToolBarCheckEnable tbstr chkmove 0; setEdToolBarCheckEnable tbstr chkrotate 0; setEdToolBarCheckEnable tbstr chkscale 0; setEdToolBarCheckEnable tbstr chkcoords 0; setEdToolBarCheckEnable tbstr chknav 0; setEdToolBarCheckEnable tbstr chkgrid 0; setEdToolBarCheckEnable tbstr chkhelpers 0; //setEdToolBarCheckEnable tbstr chkwiremode 0; setEdToolBarButtonEnable tbstr btnundo 0; setEdToolBarButtonEnable tbstr btnredo 0; setEdToolBarButtonEnable tbstr btnfit 0; setEdToolBarButtonEnable tbstr btntop 0; setEdToolBarButtonEnable tbstr btnfront 0; setEdToolBarButtonEnable tbstr btnleft 0; setEdToolBarButtonEnable tbstr btnpers 0; setEdToolBarButtonEnable tbmatstr btnmated 0; setEdToolBarButtonEnable tbmatstr btnmatadd 0; setEdToolBarButtonEnable tbmatstr btnmatdel 0; setEdToolBarButtonEnable tbmatstr btnmatassing 0; SO3ObjectShowBoundingBox obj 0; V3DshowObjectAxis viewstr sessionstr obj iViewerEditMode 0; //V3DsetViewportPolygonMode (V3DgetDefaultViewport viewstr) SO3_POLY_SOLID; V3DenableHelpers (V3DgetDefaultViewport viewstr) sessionstr 0; V3DshowSceneGrid sessionstr 0; shadowsDestroySetting; renderingDestroySetting viewstr; physicsDestroySetting; environmentDestroySetting; materialDestroyEditor; let winLightSetup -> [_ winstr] in dsEdWindow winstr; set winLightSetup = nil; let winCameraSetup -> [_ winstr] in dsEdWindow winstr; set winCameraSetup = nil; if (winCoordsSetup == nil) then nil else saveCoordsSetup; // save previous state let winCoordsSetup -> [_ _ winstr _ _ _ _ _ _ _ _ _ _] in dsEdWindow winstr; set winCoordsSetup = nil; let winAnimSetup -> [_ winstr _ _ _] in dsEdWindow winstr; set winAnimSetup = nil; let winParticleSetup -> [_ winstr _ _] in dsEdWindow winstr; set winParticleSetup = nil; let winCubeMapSetup -> [_ winstr _ _] in dsEdWindow winstr; set winCubeMapSetup = nil; let winReflectionMapSetup -> [_ winstr _ _] in dsEdWindow winstr; set winReflectionMapSetup = nil; let winCompositorSetup -> [_ winstr] in dsEdWindow winstr; set winCompositorSetup = nil; let winNodeSetup -> [_ winstr] in dsEdWindow winstr; set winNodeSetup = nil; let winEntitySetup -> [_ winstr] in dsEdWindow winstr; set winEntitySetup = nil; let winEntityInfo -> [_ winstr _] in dsEdWindow winstr; set winEntityInfo = nil; dsEdWindow winFogSetup; set winFogSetup = nil; let winFilterTree -> [winstr _] in dsEdWindow winstr; mutate winFilterTree <- [nil _]; dsEdWindow winMatSchemeSetup; set winMatSchemeSetup = nil; dsEdWindow winImportMesh; set winImportMesh = nil; dsEdWindow winImportScene; set winImportScene = nil; let winMeshMaterialSetup -> [_ swinstr] in dsEdWindow swinstr; set winMeshMaterialSetup = nil; ); playSceneGraph viewstr; startAllPluginInstances currentProject; if !bPhysicOnPlay then nil else V3DphysEnablePhysic sessionstr state; setInfoMessage (loc "OS3D_0049"); ) else ( if (!strcmp currentLanguage prevLanguage) then nil else ( set currentLanguage = prevLanguage; reloadPluginsLoc; ); setInfoMessage (loc "OS3D_0210"); V3DphysEnablePhysic sessionstr state; stopAllPluginInstances currentProject; let tCameraPosition -> [vpos vang dist] in ( SO3ObjectSetPosition (V3DgetDefaultCamera sessionstr) [0.0 0.0 dist]; V3DsetShellNavPos sessionstr vpos; V3DsetShellNavAng sessionstr vang; ); refreshSceneGraph viewstr; let getEdCtrlTreeFullValuesByValue ctrlSceneTree sSelected -> [_ _ type] in ( SO3ObjectShowBoundingBox obj (if (type != iTypeCamera) && (type != iTypeParticle) && (type != iTypeLight) && (type != iTypeSkyDome) && (type != iTypeSkyBox) && (type != iTypeSkyPlane) && (type != iTypeCompositor) && (type != iTypeBone) && (type != iTypeCubeMap) && (type != iTypeReflectionMap) then 1 else 0); let V3DgetViewportCamera V3DgetDefaultViewport viewstr -> curcam in if (type == iTypeCamera) && (obj != curcam) then showCameraViewport viewstr obj 1 else nil; ); if (!strcmp sSelected "default_light") || !iViewerEditState then nil else V3DsetCbAxisClick (V3DshowObjectAxis viewstr sessionstr obj iViewerEditMode 1) mkfun8 @cbAxisClick viewstr; V3DenableHelpers (V3DgetDefaultViewport viewstr) sessionstr bShowHelpers; V3DshowSceneGrid sessionstr bShowGrid; let if tLastNavPos == nil then [(SO3ObjectGetPosition sessionstr.V3D_shellNavigate) [0.0 0.0 0.0 1.0] [0.0 0.0 0.0 1.0]] else tLastNavPos -> [spos squat cquat] in if !iNavigationMode then nil else startAvNavMode viewstr spos squat cquat 1.5 1.60; setEdToolBarCheckEnable tbstr chkselect 1; setEdToolBarCheckEnable tbstr chkmove 1; setEdToolBarCheckEnable tbstr chkrotate 1; setEdToolBarCheckEnable tbstr chkscale 1; setEdToolBarCheckEnable tbstr chkcoords 1; setEdToolBarCheckEnable tbstr chknav 1; setEdToolBarCheckEnable tbstr chkgrid 1; setEdToolBarCheckEnable tbstr chkhelpers 1; updateToolbarHistoryBtn; setEdToolBarButtonEnable tbstr btnfit 1; //setEdToolBarCheckEnable tbstr chkwiremode 1; setEdToolBarButtonEnable tbstr btntop 1; setEdToolBarButtonEnable tbstr btnfront 1; setEdToolBarButtonEnable tbstr btnleft 1; setEdToolBarButtonEnable tbstr btnpers 1; setEdToolBarButtonEnable tbmatstr btnmated 1; setEdToolBarButtonEnable tbmatstr btnmatadd 1; setEdToolBarButtonEnable tbmatstr btnmatdel 1; setEdToolBarButtonEnable tbmatstr btnmatassing 1; //V3DsetViewportPolygonMode (V3DgetDefaultViewport viewstr) if bShowWireMode then SO3_POLY_WIREFRAME else SO3_POLY_SOLID; setInfoMessage (loc "OS3D_0131"); ); ); V3DviewSetFocus viewstr; 0;; fun stopEditorFromPlugin()= playEditor v3dMain 0;; /** cbChangePlayStop [EdToolBar CompCheck I I I V3Dview] I * callback on change Play Stop state * * private * * return 0 **/ fun cbChangePlayStop(tbstr, check, btn, mask, state, viewstr)= //addLogMessage strcat (strcat (loc "OS3D_0278") " ") itoa (getModNbLinks this); //addLogMessage strcat (strcat (loc "OS3D_0277") " ") itoa (getModNbEvents this); //addLogMessage strcat (strcat (loc "OS3D_0276") " ") itoa (getModNbActions this); playEditor viewstr state; 0;; fun cbTreeMenuShowSceneGrid(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in V3DshowSceneGrid sessionstr !(bShowGrid); set bShowGrid = !bShowGrid; let mainInterf.MINT_winView -> [_ [tbstr _ _ _ _ _ _ _ _ _ _ chkgrid _ _ _ _ _ _ _ _]] in setEdToolBarCheckState tbstr chkgrid bShowGrid; 0;; fun cbTreeMenuShowSceneHelpers(mnuitem, p)= let p -> [viewstr val type markstr] in let V3DgetDefaultSession viewstr -> sessionstr in V3DenableHelpers (V3DgetDefaultViewport viewstr) sessionstr !(bShowHelpers); set bShowHelpers = !bShowHelpers; let mainInterf.MINT_winView -> [_ [tbstr _ _ _ _ _ _ _ _ _ _ _ chkhelpers _ _ _ _ _ _ _]] in setEdToolBarCheckState tbstr chkhelpers bShowHelpers; 0;; fun cbTreeMenuShowSceneInfos(mnuitem, p)= let p -> [viewstr val type markstr] in ( set bShowInfos = !bShowInfos; V3DenableScreenInfos viewstr bShowInfos; let V3DgetDefaultSession viewstr -> sessionstr in V3DphysShowDebug sessionstr bShowInfos; ); let mainInterf.MINT_winView -> [_ [tbstr _ _ _ _ _ _ _ _ _ _ _ _ chkinfos _ _ _ _ _ _]] in setEdToolBarCheckState tbstr chkinfos bShowInfos; 0;; fun cbTreeMenuAutoFitOnSelect(mnuitem, p)= let p -> [viewstr val type markstr] in ( set bAutoFit = !bAutoFit; ); 0;; fun cbTreeMenuUnhideAll(mnuitem, viewstr)= unhideAll viewstr; 0;; fun showTreeMenu(ctrlstr, item, viewstr)= let getEdCtrlTreeValueByItem ctrlSceneTree item -> [val type] in let V3DgetDefaultSession viewstr -> sessionstr in let _CRpopupMenu _channel -> mnu in let getGraphByValue val -> [treeitem type alias markstr _ groupmark _ _] in let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let if ctrlstr == nil then viewstr.V3D_win else ctrlstr.EDC_father.EDW_win -> mwin in ( let XMLgetBoolParam markstr "hidden" -> hidden in let if !strcmp sIsolatedNode val then 1 else 0 -> isolated in if type == iTypeScene then ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0380")) @cbTreeMenuSetRenderingSetup [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0382")) @cbTreeMenuSetShadowMethod [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0374")) @cbTreeMenuSetFogSetting [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0375")) @cbTreeMenuSetMaterialScheme [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0377")) @cbTreeMenuSetPhysicSetup [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0373")) @cbTreeMenuSetEnvSetup [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu (if bShowGrid then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0395")) @cbTreeMenuShowSceneGrid [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu (if bShowHelpers then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0396")) @cbTreeMenuShowSceneHelpers [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu (if bShowInfos then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0397")) @cbTreeMenuShowSceneInfos [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu (if bAutoFit then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0071")) @cbTreeMenuAutoFitOnSelect [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0827")) @cbTreeMenuUnhideAll viewstr; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0036")) @cbTreeMenuAddSkyBox [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0037")) @cbTreeMenuAddSkyDome [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0038")) @cbTreeMenuAddSkyPlane [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0021")) @cbTreeMenuAddCompositor [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0028")) @cbTreeMenuAddMesh [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0019")) @cbTreeMenuAddCamera [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0027")) @cbTreeMenuAddLight [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0023")) @cbTreeMenuAddDummy [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0024")) @cbTreeMenuAddCubeMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0025")) @cbTreeMenuAddReflectionMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0030")) @cbTreeMenuAddParticle [viewstr val type markstr item groupmark]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0197")) @cbTreeMenuImport [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0033")) @cbTreeMenuAddResources [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0029")) @cbTreeMenuAddGroup [viewstr val type markstr item]; 0; ) else if type == iTypeEntity then let SO3ObjectGetCastShadows obj -> meshcastshadow in let XMLgetBoolParam markstr "receiveShadows" -> meshreceiveshadow in let XMLgetBoolParam markstr "indexMaterials" -> indexmat in ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0280")) @cbTreeMenuEntityInformations [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu (if meshcastshadow then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0085")) @cbTreeMenuObjectCastShadow [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu (if hidden then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0188")) @cbTreeMenuObjectHidden [viewstr treeitem obj val type markstr]; _CBmenu (_APPitem _channel mnu (if isolated then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0826")) @cbTreeMenuObjectIsolate [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuEntityEditParameters [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0129")) @cbTreeMenuMeshMaterialSetup [viewstr val type markstr groupmark]; //_CBmenu (_APPitem _channel mnu (if meshreceiveshadow then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0318")) @cbTreeMenuObjectReceiveShadow [viewstr val type markstr]; //_CBmenu (_APPitem _channel mnu (if indexmat then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0205")) @cbTreeMenuObjectIndexMaterials [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0379")) @cbTreeMenuObjectSetPosition [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0376")) @cbTreeMenuObjectSetOrientation [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0381")) @cbTreeMenuObjectSetScale [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0378")) @cbTreeMenuSetPhysicBodySetup [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0093")) @cbTreeMenuClone [viewstr val type markstr groupmark item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0028")) @cbTreeMenuAddMesh [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0019")) @cbTreeMenuAddCamera [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0027")) @cbTreeMenuAddLight [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0023")) @cbTreeMenuAddDummy [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0024")) @cbTreeMenuAddCubeMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0025")) @cbTreeMenuAddReflectionMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0030")) @cbTreeMenuAddParticle [viewstr val type markstr item groupmark]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuObjectRemove [viewstr val type markstr]; 0; ) else if type == iTypeGroup then ( _CBmenu (_APPitem _channel mnu (if hidden then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0188")) @cbTreeMenuObjectHidden [viewstr treeitem obj val type markstr]; _CBmenu (_APPitem _channel mnu (if isolated then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0826")) @cbTreeMenuObjectIsolate [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0379")) @cbTreeMenuObjectSetPosition [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0376")) @cbTreeMenuObjectSetOrientation [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0381")) @cbTreeMenuObjectSetScale [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0093")) @cbTreeMenuClone [viewstr val type markstr groupmark item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0028")) @cbTreeMenuAddMesh [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0019")) @cbTreeMenuAddCamera [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0027")) @cbTreeMenuAddLight [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0023")) @cbTreeMenuAddDummy [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0024")) @cbTreeMenuAddCubeMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0025")) @cbTreeMenuAddReflectionMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0030")) @cbTreeMenuAddParticle [viewstr val type markstr item groupmark]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0198")) @cbTreeMenuImport [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0034")) @cbTreeMenuAddResources [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0029")) @cbTreeMenuAddGroup [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0156")) @cbTreeMenuExportGroup [viewstr val type markstr item]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuObjectRemove [viewstr val type markstr]; 0; ) else if type == iTypeCamera then ( let SO3ObjectGetName V3DgetViewportCamera (V3DgetDefaultViewport viewstr) -> curcameraname in let if (!strcmp curcameraname val) then 1 else 0 -> camstate in _CBmenu (_APPitem _channel mnu (if camstate then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0372")) @cbTreeMenuSetActiveCamera [viewstr val type markstr camstate]; if !strcmp val "default_camera" then nil else ( _CBmenu (_APPitem _channel mnu (if hidden then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0188")) @cbTreeMenuObjectHidden [viewstr treeitem obj val type markstr]; _CBmenu (_APPitem _channel mnu (if isolated then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0826")) @cbTreeMenuObjectIsolate [viewstr val type markstr]; ); _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuCameraEditParameters [viewstr val type markstr]; if !strcmp val "default_camera" then nil else ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0379")) @cbTreeMenuObjectSetPosition [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0376")) @cbTreeMenuObjectSetOrientation [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0093")) @cbTreeMenuClone [viewstr val type markstr groupmark item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0028")) @cbTreeMenuAddMesh [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0019")) @cbTreeMenuAddCamera [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0027")) @cbTreeMenuAddLight [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0023")) @cbTreeMenuAddDummy [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0024")) @cbTreeMenuAddCubeMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0025")) @cbTreeMenuAddReflectionMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0030")) @cbTreeMenuAddParticle [viewstr val type markstr item groupmark]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuObjectRemove [viewstr val type markstr]; ); 0; ) else if type == iTypeLight then let SO3LightGetVisible obj -> lightstate in let SO3ObjectGetCastShadows obj -> lightcastshadow in ( _CBmenu (_APPitem _channel mnu (if lightstate then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0139")) @cbTreeMenuLightEnable [viewstr val type markstr]; if (!strcmp "default_light" val) then nil else ( _CBmenu (_APPitem _channel mnu (if hidden then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0188")) @cbTreeMenuObjectHidden [viewstr treeitem obj val type markstr]; _CBmenu (_APPitem _channel mnu (if isolated then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0826")) @cbTreeMenuObjectIsolate [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu (if lightcastshadow then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0085")) @cbTreeMenuLightCastShadow [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuLightEditParameters [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0379")) @cbTreeMenuObjectSetPosition [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0376")) @cbTreeMenuObjectSetOrientation [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0381")) @cbTreeMenuObjectSetScale [viewstr val type markstr]; ); if !strcmp val "default_light" then nil else ( _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0093")) @cbTreeMenuClone [viewstr val type markstr groupmark item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0028")) @cbTreeMenuAddMesh [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0019")) @cbTreeMenuAddCamera [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0027")) @cbTreeMenuAddLight [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0023")) @cbTreeMenuAddDummy [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0024")) @cbTreeMenuAddCubeMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0025")) @cbTreeMenuAddReflectionMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0030")) @cbTreeMenuAddParticle [viewstr val type markstr item groupmark]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuObjectRemove [viewstr val type markstr]; ); 0; ) else if type == iTypeNode then ( _CBmenu (_APPitem _channel mnu (if hidden then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0188")) @cbTreeMenuObjectHidden [viewstr treeitem obj val type markstr]; _CBmenu (_APPitem _channel mnu (if isolated then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0826")) @cbTreeMenuObjectIsolate [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuNodeEditParameters [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0379")) @cbTreeMenuObjectSetPosition [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0376")) @cbTreeMenuObjectSetOrientation [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0381")) @cbTreeMenuObjectSetScale [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0378")) @cbTreeMenuSetPhysicBodySetup [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0093")) @cbTreeMenuClone [viewstr val type markstr groupmark item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0028")) @cbTreeMenuAddMesh [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0019")) @cbTreeMenuAddCamera [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0027")) @cbTreeMenuAddLight [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0023")) @cbTreeMenuAddDummy [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0024")) @cbTreeMenuAddCubeMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0025")) @cbTreeMenuAddReflectionMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0030")) @cbTreeMenuAddParticle [viewstr val type markstr item groupmark]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuObjectRemove [viewstr val type markstr]; 0; ) else if type == iTypeAnim then let XMLgetBoolParam markstr "enable" -> animstate in let XMLgetBoolParam markstr "loop" -> animloop in let XMLgetParam markstr "type" -> animtype in ( _CBmenu (_APPitem _channel mnu (if animstate then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0139")) @cbTreeMenuObjectEnable [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu (if animloop then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0236")) @cbTreeMenuAnimSetLoop [viewstr val type markstr]; if (strcmpi animtype "cinematic") then _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuAnimEditParameters [viewstr val type markstr] else _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuAnimEdit [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; if ((strcmpi animtype "cinematic") && (strcmpi animtype "node")) then nil else _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuAnimRemove [viewstr item val type markstr]; 0; ) else if type == iTypeBone then ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0379")) @cbTreeMenuObjectSetPosition [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0376")) @cbTreeMenuObjectSetOrientation [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0381")) @cbTreeMenuObjectSetScale [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0378")) @cbTreeMenuSetPhysicBodySetup [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; 0; ) else if type == iTypeSkyBox then ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuSkyEditParameters [viewstr item val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuSkyBoxRemove [viewstr item val type markstr]; 0; ) else if type == iTypeSkyDome then ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuSkyEditParameters [viewstr item val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuSkyDomeRemove [viewstr item val type markstr]; 0; ) else if type == iTypeSkyPlane then ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuSkyEditParameters [viewstr item val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuSkyPlanRemove [viewstr item val type markstr]; 0; ) else if type == iTypeCompositor then let XMLgetBoolParam markstr "enable" -> compstate in ( _CBmenu (_APPitem _channel mnu (if compstate then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0139")) @cbTreeMenuObjectEnable [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuCompositorEditParameters [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuCompositorRemove [viewstr item val type markstr]; 0; ) else if type == iTypeParticle then let XMLgetBoolParam markstr "enable" -> partstate in ( _CBmenu (_APPitem _channel mnu (if partstate then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0139")) @cbTreeMenuObjectEnable [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu (if hidden then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0188")) @cbTreeMenuObjectHidden [viewstr treeitem obj val type markstr]; _CBmenu (_APPitem _channel mnu (if isolated then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0826")) @cbTreeMenuObjectIsolate [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuParticleEditParameters [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0379")) @cbTreeMenuObjectSetPosition [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0376")) @cbTreeMenuObjectSetOrientation [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0381")) @cbTreeMenuObjectSetScale [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0093")) @cbTreeMenuClone [viewstr val type markstr groupmark item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0028")) @cbTreeMenuAddMesh [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0019")) @cbTreeMenuAddCamera [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0027")) @cbTreeMenuAddLight [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0023")) @cbTreeMenuAddDummy [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0024")) @cbTreeMenuAddCubeMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0025")) @cbTreeMenuAddReflectionMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0030")) @cbTreeMenuAddParticle [viewstr val type markstr item groupmark]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuObjectRemove [viewstr val type markstr]; 0; ) else if type == iTypeCubeMap then let XMLgetBoolParam markstr "enable" -> cubemapstate in ( _CBmenu (_APPitem _channel mnu (if cubemapstate then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0139")) @cbTreeMenuObjectEnable [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu (if hidden then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0188")) @cbTreeMenuObjectHidden [viewstr treeitem obj val type markstr]; _CBmenu (_APPitem _channel mnu (if isolated then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0826")) @cbTreeMenuObjectIsolate [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuCubeMapEditParameters [viewstr val type markstr groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0379")) @cbTreeMenuObjectSetPosition [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0376")) @cbTreeMenuObjectSetOrientation [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0381")) @cbTreeMenuObjectSetScale [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0093")) @cbTreeMenuClone [viewstr val type markstr groupmark item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0028")) @cbTreeMenuAddMesh [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0019")) @cbTreeMenuAddCamera [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0027")) @cbTreeMenuAddLight [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0023")) @cbTreeMenuAddDummy [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0024")) @cbTreeMenuAddCubeMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0025")) @cbTreeMenuAddReflectionMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0030")) @cbTreeMenuAddParticle [viewstr val type markstr item groupmark]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuObjectRemove [viewstr val type markstr]; 0; ) else if type == iTypeReflectionMap then let XMLgetBoolParam markstr "enable" -> reflectionmapstate in ( _CBmenu (_APPitem _channel mnu (if reflectionmapstate then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0139")) @cbTreeMenuObjectEnable [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu (if hidden then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0188")) @cbTreeMenuObjectHidden [viewstr treeitem obj val type markstr]; _CBmenu (_APPitem _channel mnu (if isolated then ME_CHECKED|ME_ENABLED else ME_UNCHECKED|ME_ENABLED) (loc "OS3D_0826")) @cbTreeMenuObjectIsolate [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0130")) @cbTreeMenuReflectionMapEditParameters [viewstr val type markstr groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0379")) @cbTreeMenuObjectSetPosition [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0376")) @cbTreeMenuObjectSetOrientation [viewstr val type markstr]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0381")) @cbTreeMenuObjectSetScale [viewstr val type markstr]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0093")) @cbTreeMenuClone [viewstr val type markstr groupmark item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0028")) @cbTreeMenuAddMesh [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0019")) @cbTreeMenuAddCamera [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0027")) @cbTreeMenuAddLight [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0023")) @cbTreeMenuAddDummy [viewstr val type markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0024")) @cbTreeMenuAddCubeMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0025")) @cbTreeMenuAddReflectionMap [viewstr val type markstr item groupmark]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0030")) @cbTreeMenuAddParticle [viewstr val type markstr item groupmark]; _APPitem _channel mnu ME_SEPARATOR ""; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0370")) @cbTreeMenuChangeAlias [viewstr val type alias markstr item]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0333")) @cbTreeMenuObjectRemove [viewstr val type markstr]; 0; ) else if type == iTypeCinematics then ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0020")) @cbTreeMenuAddCinematic [viewstr val type markstr item]; 0; ) else nil; let _GETscreenPos -> [x y] in _DRAWmenu mwin mnu x y PM_SCREEN|PM_LEFT_ALIGN; ); 0;; fun cbSceneTreeClick(ctrlstr, father, item, value, type, pos, btn, viewstr)= if (item == nil) then nil else let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) value -> obj in let pos -> [nx ny] in ( if ((bAppPlay && !OS3D_DEBUG) || ((btn != 2) && (btn != 3))) then nil else ( let SO3SceneGetObject (V3DgetSession sessionstr) sSelected -> fobj in ( //addLogMessage strcatn "cbSceneTreeClick: "::value::" prev: "::sSelected::nil; SO3ObjectShowBoundingBox fobj 0; V3DshowObjectAxis viewstr sessionstr fobj iViewerEditMode 0; SO3ObjectShowBoundingBox obj (if (type != iTypeCamera) && (type != iTypeParticle) && (type != iTypeLight) && (type != iTypeSkyDome) && (type != iTypeSkyBox) && (type != iTypeSkyPlane) && (type != iTypeAnim) && (type != iTypeCompositor) && (type != iTypeBone) && (type != iTypeCubeMap) && (type != iTypeReflectionMap) then 1 else 0); if (!strcmp value "default_light") || !iViewerEditState then nil else V3DsetCbAxisClick (V3DshowObjectAxis viewstr sessionstr obj iViewerEditMode 1) mkfun8 @cbAxisClick viewstr; ); if winCoordsSetup == nil then nil else ( let getGraphByValue value -> [_ _ _ markstr _ _ _ _] in let winCoordsSetup -> [_ _ _ mode _ _ _ _ _ _ _ _ _] in if mode == 1 then cbTreeMenuObjectSetPosition item [viewstr value type markstr] else if mode == 2 then cbTreeMenuObjectSetOrientation item [viewstr value type markstr] else cbTreeMenuObjectSetScale item [viewstr value type markstr]; V3DviewSetFocus viewstr; ); if (btn != 2) then nil else showTreeMenu ctrlstr item viewstr; let V3DgetViewportCamera V3DgetDefaultViewport viewstr -> curcam in if (type != iTypeCamera) || (obj == curcam) then showCameraViewport viewstr nil 0 else if (type == iTypeCamera) then showCameraViewport viewstr obj 1 else nil; ); set sSelected = value; // show / hide if (((btn == 3) || ((_keybdstate == 2) && btn == 1)) && ((type == iTypeNode) || (type == iTypeGroup) || (type == iTypeEntity) || (type == iTypeCamera) || (type == iTypeParticle) || (type == iTypeLight) || (type == iTypeCubeMap) || (type == iTypeReflectionMap))) then ( if ((!strcmp value "default_camera") || (!strcmp value "default_light")) then nil else let getGraphByValue value -> [treeitem _ _ emark _ _ _ _] in let XMLgetBoolParam emark "hidden" -> hidden in ( XMLsetParam emark "hidden" (XMLgetBoolString !hidden); applyNodeVisibility obj type hidden; updateSceneTreeBitmap treeitem type hidden; ); ) else nil; ); 0;; fun cbSceneTreeSelect(ctrlstr, father, item, value, type, viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) value -> obj in ( let getEdCtrlTreePreviousSelectedItem ctrlSceneTree -> fitem in let getEdCtrlTreeValueByItem ctrlSceneTree fitem -> [fval ftype] in let SO3SceneGetObject (V3DgetSession sessionstr) fval -> fobj in ( if bAppPlay && !OS3D_DEBUG then nil else ( if (!strcmpi value fval) then nil else let getGraphByValue fval -> [_ _ _ markstr _ _ _ _] in addObjHistoryState fval markstr obj 4; if (!strcmp fval "default_camera") || (type == iTypeAnim) || (type == iTypeCompositor) || (type == iTypeSkyBox) || (type == iTypeSkyDome) || (type == iTypeSkyPlane) || !bAutoFit then nil else let if type == iTypeEntity then V3DgetGlobalObjectCenter obj else SO3ObjectGetGlobalPosition obj -> pos in let SO3SceneGetObject (V3DgetSession sessionstr) "default_camera" -> camera in let SO3CameraGetFOVy camera -> fovy in let if type == iTypeEntity then (V3DgetObjectRadius sessionstr obj) else (1.0 *. (itof iGlobalUnit)) -> curdist in let curdist +. (curdist /. tan fovy) -> dist in ( V3DsetShellNavPos sessionstr pos; if iNavigationMode then nil else ( SO3ObjectSetPosition camera [0.0 0.0 dist]; V3DsetOrthographicScale camera dist; ); ); //addLogMessage strcatn "cbSceneTreeSelect: "::value::" prev: "::fval::nil; SO3ObjectShowBoundingBox fobj 0; SO3ObjectShowBoundingBox obj (if (type != iTypeCamera) && (type != iTypeParticle) && (type != iTypeLight) && (type != iTypeSkyDome) && (type != iTypeSkyBox) && (type != iTypeSkyPlane) && (type != iTypeAnim) && (type != iTypeCompositor) && (type != iTypeBone) && (type != iTypeCubeMap) && (type != iTypeReflectionMap) then 1 else 0); V3DshowObjectAxis viewstr sessionstr fobj iViewerEditMode 0; if (!strcmp value "default_light") || !iViewerEditState then nil else V3DsetCbAxisClick (V3DshowObjectAxis viewstr sessionstr obj iViewerEditMode 1) mkfun8 @cbAxisClick viewstr; let getGraphByValue value -> [_ _ _ markstr _ _ _ _] in ( if (winCoordsSetup == nil) then nil else ( let winCoordsSetup -> [_ _ _ mode _ _ _ _ _ _ _ _ _] in if mode == 1 then cbTreeMenuObjectSetPosition item [viewstr value type markstr] else if mode == 2 then cbTreeMenuObjectSetOrientation item [viewstr value type markstr] else cbTreeMenuObjectSetScale item [viewstr value type markstr]; V3DviewSetFocus viewstr; ); if ((winEntityInfo == nil) || (type != iTypeEntity)) then nil else cbTreeMenuEntityInformations nil [viewstr value type markstr]; ); ); ); if (bAppPlay) then nil else let V3DgetViewportCamera V3DgetDefaultViewport viewstr -> curcam in if (type != iTypeCamera) || (obj == curcam) then showCameraViewport viewstr nil 0 else if (type == iTypeCamera) then showCameraViewport viewstr obj 1 else nil; if type != iTypeScene || !bAutoFit then nil else V3DsetShellNavPos sessionstr [0.0 0.0 0.0]; set sSelected = value; ); 0;; fun checkItemValidity(telem1, telem2)= let telem1 -> [father1 item1 val1 type1] in let telem2 -> [father2 item2 val2 type2] in let getEdCtrlTreeRootItem ctrlSceneTree -> rootitem in let getGraphByValue val1 -> [_ _ _ markstr _ groupmark _ _] in let getGraphByValue val2 -> [_ _ _ markdeststr _ destgroupmark _ _] in if (item1 == rootitem) && (item1 != item2) then 1 else if (!strcmp val1 "default_camera") || (!strcmp val2 "default_camera") || (!strcmp val1 "default_light") || (!strcmp val2 "default_light") || (item1 == item2) || (item2 == father1) || (item1 == father2) || (type1 == iTypeSkyDome) || (type1 == iTypeSkyBox) || (type1 == iTypeSkyPlane) || (type1 == iTypeCompositor) || (type1 == iTypeCinematics) || (type2 == iTypeCinematics) || (type2 == iTypeSkyDome) || (type2 == iTypeSkyBox) || (type2 == iTypeSkyPlane) || (type2 == iTypeCompositor) || (type1 == iTypeAnim) || (type2 == iTypeAnim) || (type1 == iTypeBone) || (type2 == iTypeBone) || (type1 == iTypeGroup && type2 == iTypeCamera) || (type1 == iTypeGroup && type2 == iTypeEntity) || (type1 == iTypeGroup && type2 == iTypeParticle) || (type1 == iTypeGroup && type2 == iTypeLight) || (type1 == iTypeGroup && type2 == iTypeNode) || (type1 == iTypeGroup && type2 == iTypeCubeMap) || (type1 == iTypeGroup && type2 == iTypeReflectionMap) || (type1 == iTypeGroup && (type2 == iTypeSkyDome || type2 == iTypeSkyBox || type2 == iTypeSkyPlane || type2 == iTypeCompositor)) || ((type1 != iTypeGroup) && ((type2 == iTypeGroup) || (type2 == iTypeScene)) && (groupmark != markdeststr)) || ((groupmark != destgroupmark) && (type1 != iTypeGroup) && (type2 != iTypeGroup) && (type2 != iTypeScene)) || (isEdCtrlTreeItemSon ctrlSceneTree item2 item1) then 0 else 1;; fun moveNodeToNode(viewstr, telem1, telem2)= if !(checkItemValidity telem1 telem2) then nil else ( let V3DgetDefaultSession viewstr -> sessionstr in let telem1 -> [father1 item1 val1 type1] in let telem2 -> [father2 item2 val2 type2] in let SO3SceneGetObject (V3DgetSession sessionstr) val1 -> obj1 in let SO3SceneGetObject (V3DgetSession sessionstr) val2 -> obj2 in let if obj2 == nil then SO3ObjectGetSceneRoot (V3DgetSession sessionstr) else obj2 -> obj2 in let SO3ObjectGetGlobalPosition obj1 -> newpos in let SO3ObjectGetGlobalOrientation obj1 -> newquat in let SO3ObjectGetGlobalScale obj1 -> newscale in let getGraphByValue val1 -> [_ _ _ markstr _ groupmark _ _] in let getGraphByValue val2 -> [_ _ _ markdeststr _ destgroupmark _ _] in ( addObjHistoryState val1 markstr obj1 0; if markdeststr == nil then nil else let if (type1 != iTypeGroup && ((type2 == iTypeGroup) || (type2 == iTypeScene))) then XMLgetMarkByValueFromMarkSons markdeststr "graph" else markdeststr -> markdeststr in XMLmoveMark xmlEditSceneFile markstr markdeststr; moveEdCtrlTreeItem ctrlSceneTree item1 item2; selEdCtrlTreeItemByValue ctrlSceneTree val1; SO3ObjectUnlink obj1; SO3ObjectLink obj1 obj2; SO3ObjectSetGlobalPosition obj1 newpos; SO3ObjectSetGlobalOrientation obj1 newquat; SO3ObjectSetGlobalScale obj1 newscale; let SO3ObjectGetPosition obj1 -> newpos in let SO3ObjectGetOrientation obj1 -> newquat in let SO3ObjectGetScale obj1 -> newscale in let XMLgetMarkByValueFromMarkSons markstr "position" -> objpositionmark in let XMLgetMarkByValueFromMarkSons markstr "rotation" -> objrotationmark in let XMLgetMarkByValueFromMarkSons markstr "scale" -> objscalemark in let newpos -> [nx ny nz] in let newquat -> [qx qy qz qw] in let newscale -> [sx sy sz] in ( XMLsetParam objpositionmark "x" XMLgetShortFloatToString nx; XMLsetParam objpositionmark "y" XMLgetShortFloatToString ny; XMLsetParam objpositionmark "z" XMLgetShortFloatToString nz; XMLsetParam objrotationmark "qx" XMLgetShortFloatToString qx; XMLsetParam objrotationmark "qy" XMLgetShortFloatToString qy; XMLsetParam objrotationmark "qz" XMLgetShortFloatToString qz; XMLsetParam objrotationmark "qw" XMLgetShortFloatToString qw; XMLsetParam objscalemark "x" XMLgetShortFloatToString sx; XMLsetParam objscalemark "y" XMLgetShortFloatToString sy; XMLsetParam objscalemark "z" XMLgetShortFloatToString sz; ); ); ); 0;; fun cbDlgObjectMoveToFather(msg, p, ret)= if !ret then nil else let p -> [viewstr telem1 telem2] in let telem1 -> [father1 item1 val1 type1] in let telem2 -> [father2 item2 val2 type2] in let getEdCtrlTreeRootItem ctrlSceneTree -> rootitem in if (item1 == rootitem) then ( //if parent is scene move all children except the target let item1.EDTITEM_lSons -> l in while (l != nil) do ( let hd l -> item1str in moveNodeToNode viewstr [item1str.EDTITEM_father item1str item1str.EDTITEM_sValue item1str.EDTITEM_iType] telem2; set l = tl l; ); 0; ) else moveNodeToNode viewstr telem1 telem2; 0;; fun cbSceneTreeDrag(ctrlstr, telem1, telem2, viewstr)= if bAppPlay then nil else ( if !(checkItemValidity telem1 telem2) then nil else let telem1 -> [father1 item1 val1 type1] in let telem2 -> [father2 item2 val2 type2] in let if val2 == nil then "Scene" else val2 -> val2 in _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") strcatn (strcat (loc "OS3D_0055") " ")::val1::" "::(loc "OS3D_0004")::" "::val2::" ?"::nil 1 @cbDlgObjectMoveToFather [viewstr telem1 telem2]; ); 0;; /** cbBtnAddResourcesDir [EdControl V3Dview] I * callback on add resources directory button * * private * * return 0 **/ fun cbBtnAddResourcesDir(ctrlstr, viewstr)= _DLGrflopenDir (_DLGOpenDir _channel mainInterf.MINT_winMain.EDW_win nil (loc "OS3D_0032")) @cbDlgAddResourceDir viewstr; 0;; fun cbView3dUnClick(viewstr, x, y, btn)= let V3DgetLastMouseClick viewstr 0 -> [cx cy] in let [abs (cx - x) abs (cy - y)] -> [ccx ccy] in if (ccx > 10) || (ccy > 10) then nil else let V3DgetDefaultSession viewstr -> sessionstr in let V3DgetLastMouseData viewstr 0 -> [_ _ obj mat _ _ _ _ _] in let V3DgetObjectFromHelper sessionstr obj -> obj in let SO3ObjectGetName obj -> objname in let if (objname == nil) then "Scene" else objname -> objname in ( let getGraphByValue objname -> found in let found -> [treeitem _ _ _ _ _ _ _] in if (btn == 1) && (found != nil) then ( if bAppPlay && !OS3D_DEBUG then nil else ( selEdCtrlTreeItemByValue ctrlSceneTree objname; set sSelected = objname; let SO3MaterialGetName mat -> matname in selectEdCtrlList ctrlMaterialList matname; ); //plugins resources selector selectPluginResourceByName objname; 0; ) else if (btn == 2) && (found != nil) then ( if bAppPlay && !OS3D_DEBUG then nil else ( selEdCtrlTreeItemByValue ctrlSceneTree objname; showTreeMenu nil treeitem viewstr; set sSelected = objname; ); 0; ) else nil; 0; ); if !bAppPlay then nil else cbPlugView3dUnClick viewstr x y btn; 0;; fun cbView3dDbClick(viewstr, x, y, btn)= if !bAppPlay then nil else cbPlugView3dDbClick viewstr x y btn; 0;; fun cbView3dClick(viewstr, x, y, btn)= if !bAppPlay then nil else cbPlugView3dClick viewstr x y btn; 0;; fun cbView3dWheel(viewstr, x, y, delta, btn)= if !bAppPlay then nil else cbPlugView3dWheel viewstr x y delta btn; 0;; fun cbView3dCursorMove(viewstr, x, y, btn)= if !bAppPlay then nil else cbPlugView3dCursorMove viewstr x y btn; 0;; fun cbView3dInputClick(viewstr, id, x, y, btn, pdata)= if !bAppPlay then nil else cbPlugView3dInputClick viewstr id x y btn pdata; 0;; fun cbView3dInputUnClick(viewstr, id, x, y, btn, pdata)= if !bAppPlay then nil else cbPlugView3dInputUnClick viewstr id x y btn pdata; 0;; fun cbView3dInputUpdate(viewstr, id, x, y, btn, pdata)= if !bAppPlay then nil else cbPlugView3dInputUpdate viewstr id x y btn pdata; 0;; fun createCameraToCurrentPosition(viewstr)= let getGraphByValue sSelected -> tgraph in let tgraph -> [treeitem ttype alias markstr path groupmark initstate staticgeometry] in let if (ttype == iTypeGroup || ttype == iTypeScene) then XMLgetMarkByValueFromMarkSons markstr "graph" else markstr -> markstr in if ((!strcmp sSelected "default_camera") || ((ttype != iTypeScene) && (ttype != iTypeNode) && (ttype != iTypeLight) && (ttype != iTypeCamera) && (ttype != iTypeEntity) && (ttype != iTypeGroup))) then nil else let V3DgetDefaultSession viewstr -> sessionstr in let SO3SceneGetObject (V3DgetSession sessionstr) sSelected -> father in let if father == nil then SO3ObjectGetSceneRoot (V3DgetSession sessionstr) else father -> father in let SO3SceneGetObject (V3DgetSession sessionstr) "default_camera" -> defcam in let SO3CameraGetFocalLength defcam -> fovlength in let SO3CameraGetFOVy defcam -> fovy in let SO3CameraGetNearClipDistance defcam -> nearclip in let SO3CameraGetFarClipDistance defcam -> farclip in let itoa (getNewSceneIndex nil) -> id in let XMLaddMark xmlEditSceneFile "camera" markstr ["id" id]::["name" "camera"]::["fov" (XMLgetShortFloatToString fovy)]::nil nil -> cammark in let addGraphItem (strcatn "camera"::" #"::id::nil) (strcatn id::"."::"camera"::nil) iTypeCamera nil cammark nil groupmark treeitem 0 0 -> treenode in let V3DaddCamera sessionstr (strcatn id::"."::"camera"::nil) -> camera in // get current prs let SO3ObjectGetGlobalPosition defcam -> newpos in let SO3ObjectGetOrientationInObjectRef defcam father -> newquat in let SO3ObjectGetGlobalOrientation defcam -> newquat in let [1.0 1.0 1.0] -> newscale in // SO3ObjectGetScaleInObjectRef defcam father -> newscale in ( SO3ObjectLink camera father; SO3ObjectSetFlags camera iNodeFlagScene; SO3ObjectSetGlobalPosition camera newpos; SO3ObjectSetGlobalOrientation camera newquat; SO3ObjectSetScale camera newscale; let newscale -> [nx ny nz] in XMLaddMark xmlEditSceneFile "scale" cammark ["x" (XMLgetShortFloatToString nx)]::["y" (XMLgetShortFloatToString ny)]::["z" (XMLgetShortFloatToString nz)]::nil nil; let SO3ObjectGetPosition camera -> newpos in let newpos -> [nx ny nz] in XMLaddMark xmlEditSceneFile "position" cammark ["x" (XMLgetShortFloatToString nx)]::["y" (XMLgetShortFloatToString ny)]::["z" (XMLgetShortFloatToString nz)]::nil nil; let SO3ObjectGetOrientation camera -> newquat in let newquat -> [nx ny nz nw] in XMLaddMark xmlEditSceneFile "rotation" cammark ["qx" (XMLgetShortFloatToString nx)]::["qy" (XMLgetShortFloatToString ny)]::["qz" (XMLgetShortFloatToString nz)]::["qw" (XMLgetShortFloatToString nw)]::nil nil; XMLaddMark xmlEditSceneFile "clipping" cammark ["near" (XMLgetShortFloatToString nearclip)]::["far" (XMLgetShortFloatToString farclip)]::nil nil; V3DsetCamera camera fovlength fovy nearclip farclip; V3DshowObjectHelper viewstr sessionstr camera iTypeCamera 1; selEdCtrlTreeItem ctrlSceneTree treenode; ); 0;; fun cameraModeLeftView(camera)= V3DsetOrthographicMode camera 1; let SO3ObjectGetPosition camera -> [_ _ level] in V3DsetOrthographicScale camera level; SO3ObjectSetOrientation SO3ObjectGetParent camera [0.0 (-.(sqrt 0.5)) 0.0 (sqrt 0.5)]; 0;; fun cameraModeRightView(camera)= V3DsetOrthographicMode camera 1; let SO3ObjectGetPosition camera -> [_ _ level] in V3DsetOrthographicScale camera level; SO3ObjectSetOrientation SO3ObjectGetParent camera [0.0 (sqrt 0.5) 0.0 (sqrt 0.5)]; 0;; fun cameraModeTopView(camera)= V3DsetOrthographicMode camera 1; let SO3ObjectGetPosition camera -> [_ _ level] in V3DsetOrthographicScale camera level; SO3ObjectSetOrientation SO3ObjectGetParent camera [-.(sqrt 0.5) 0.0 0.0 (sqrt 0.5)]; 0;; fun cameraModeBottomView(camera)= V3DsetOrthographicMode camera 1; let SO3ObjectGetPosition camera -> [_ _ level] in V3DsetOrthographicScale camera level; SO3ObjectSetOrientation SO3ObjectGetParent camera [(sqrt 0.5) 0.0 0.0 (sqrt 0.5)]; 0;; fun cameraModeFrontView(camera)= V3DsetOrthographicMode camera 1; let SO3ObjectGetPosition camera -> [_ _ level] in V3DsetOrthographicScale camera level; SO3ObjectSetOrientation SO3ObjectGetParent camera [0.0 0.0 0.0 1.0]; 0;; fun cameraModeBackView(camera)= V3DsetOrthographicMode camera 1; let SO3ObjectGetPosition camera -> [_ _ level] in V3DsetOrthographicScale camera level; SO3ObjectSetOrientation SO3ObjectGetParent camera [0.0 1.0 0.0 0.0]; 0;; fun cameraModeProjView(camera)= V3DsetOrthographicMode camera 0; 0;; /** cbLogKeyDown [EdWindow I I] I * callback on log key down * * private * * return 0 **/ fun cbLogKeyDown(winstr, key, ascode)= if (key == 63) then // F5 ( cbRefreshPlugits nil mainInterf.MINT_meGroups; ) else nil; 0;; fun mainKeyDown(viewstr, key, ascode)= if (!bAppPlay) then nil else cbPlugView3dKeyDown viewstr key ascode; 0;; fun cbViewModeTop(tbstr, cmproll, btn, mask, viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in if ((_keybdstate & 2) || (btn == 2)) then cameraModeBottomView (V3DgetDefaultCamera sessionstr) else cameraModeTopView (V3DgetDefaultCamera sessionstr); 0;; fun cbViewModeFront(tbstr, cmproll, btn, mask, viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in if ((_keybdstate & 2) || (btn == 2)) then cameraModeBackView (V3DgetDefaultCamera sessionstr) else cameraModeFrontView (V3DgetDefaultCamera sessionstr); 0;; fun cbViewModeLeft(tbstr, cmproll, btn, mask, viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in if ((_keybdstate & 2) || (btn == 2)) then cameraModeRightView (V3DgetDefaultCamera sessionstr) else cameraModeLeftView (V3DgetDefaultCamera sessionstr); 0;; fun cbViewModePers(tbstr, cmproll, btn, mask, viewstr)= let V3DgetDefaultSession viewstr -> sessionstr in cameraModeProjView (V3DgetDefaultCamera sessionstr); 0;; fun cbViewUndo(tbstr, cmproll, btn, mask, viewstr)= restoreLastObjHistoryState viewstr; 0;; fun cbViewRedo(tbstr, cmproll, btn, mask, viewstr)= restorePreviousObjHistoryState viewstr; 0;; fun mainKeyUp(viewstr, key)= if !bAppPlay then ( let V3DgetDefaultSession viewstr -> sessionstr in let getEdCtrlTreeSelectedItem ctrlSceneTree -> item in let getEdCtrlTreeValueByItem ctrlSceneTree item -> [val type] in let getGraphByValue val -> [_ _ _ markstr _ groupmark _ _] in let if (!strcmpi KEYBgetCurrentKeyboardType "azerty") then "Z" else "W" -> zkey in ( if (key == 31) && (_keybdstate & 2) && (_keybdstate & 1) then // Ctrl + Shift + S ( cbTbBtnSaveAsOsScene nil nil nil nil viewstr; 0; ) else if (key == 49) && (_keybdstate == 2) then // Ctrl + N ( cbTbBtnReset nil nil nil nil viewstr; 0; ) else if (key == 24) && (_keybdstate == 2) then // Ctrl + O ( cbTbBtnOpenScene nil nil nil nil viewstr; 0; ) else if (key == 18) && (_keybdstate == 2) then // Ctrl + E ( cbTbBtnExportToPlayer nil nil nil nil viewstr; 0; ) else if (key == 23) && (_keybdstate == 2) then // Ctrl + I ( cbTbBtnImportScene nil nil nil nil viewstr; 0; ) else if (key == 17) && (_keybdstate == 2) then // Ctrl + Z ( restoreLastObjHistoryState viewstr; 0; ) else if (key == 21) && (_keybdstate == 2) then // Ctrl + Y ( restorePreviousObjHistoryState viewstr; 0; ) else if (key == 30) && (_keybdstate == 4) then // Alt + Q ( cbTreeMenuObjectIsolate item [viewstr val type markstr]; 0; ) else if (key == 15) then // Tab ( // Change Edit mode let mainInterf.MINT_winView -> [_ [tbstr _ _ chkselect chkmove chkrotate chkscale _ _ _ _ _ _ _ _ _ _ _ _ _]] in let [viewstr [chkselect chkmove chkrotate chkscale]] -> editp in let if iViewerEditMode == 0 then chkmove else if iViewerEditMode == 1 then chkrotate else if iViewerEditMode == 2 then chkscale else chkselect -> check in cbChangeEditMode tbstr check 1 0 1 editp; ) else if (key == 2) then // 1 ( // Change Edit mode let mainInterf.MINT_winView -> [_ [tbstr _ _ chkselect chkmove chkrotate chkscale _ _ _ _ _ _ _ _ _ _ _ _ _]] in let [viewstr [chkselect chkmove chkrotate chkscale]] -> editp in cbChangeEditMode tbstr chkselect 1 0 1 editp; ) else if (key == 3) then // 2 ( // Change Edit mode let mainInterf.MINT_winView -> [_ [tbstr _ _ chkselect chkmove chkrotate chkscale _ _ _ _ _ _ _ _ _ _ _ _ _]] in let [viewstr [chkselect chkmove chkrotate chkscale]] -> editp in cbChangeEditMode tbstr chkmove 1 0 1 editp; ) else if (key == 4) then // 3 ( // Change Edit mode let mainInterf.MINT_winView -> [_ [tbstr _ _ chkselect chkmove chkrotate chkscale _ _ _ _ _ _ _ _ _ _ _ _ _]] in let [viewstr [chkselect chkmove chkrotate chkscale]] -> editp in cbChangeEditMode tbstr chkrotate 1 0 1 editp; ) else if (key == 5) then // 4 ( // Change Edit mode let mainInterf.MINT_winView -> [_ [tbstr _ _ chkselect chkmove chkrotate chkscale _ _ _ _ _ _ _ _ _ _ _ _ _]] in let [viewstr [chkselect chkmove chkrotate chkscale]] -> editp in cbChangeEditMode tbstr chkscale 1 0 1 editp; ) else if (key == 0) then // 0 ( V3DsetDefaultAxisRef !iDefaultAxisRef; // Change coords let mainInterf.MINT_winView -> [_ [tbstr _ _ _ _ _ _ chkcoords _ _ _ _ _ _ _ _ _ _ _ _]] in setEdToolBarCheckState tbstr chkcoords iDefaultAxisRef; ) else if(key == 46) && (_keybdstate == 1) then // SHIFT + C ( createCameraToCurrentPosition viewstr; 0; ) else if(key == 59) then // F1 ( let loc "LANGCODE" -> lg in let if !strcmpi "fr" lg then lg else "en" -> lg in let strcatn sOSD3Url::"/lang/"::lg::sHelpUrl::nil -> url in _openbrowserhttp url; 0; ) else if key == 339 then // suppr ( if type == iTypeEntity || type == iTypeGroup || type == iTypeNode || type == iTypeParticle || type == iTypeCubeMap || type == iTypeReflectionMap then ( cbTreeMenuObjectRemove item [viewstr val type markstr]; 0; ) else if type == iTypeCamera then ( if !strcmp val "default_camera" then nil else ( cbTreeMenuObjectRemove item [viewstr val type markstr]; ); 0; ) else if type == iTypeLight then ( if !strcmp val "default_light" then nil else ( cbTreeMenuObjectRemove item [viewstr val type markstr]; ); 0; ) else if type == iTypeSkyBox then ( cbTreeMenuSkyBoxRemove item [viewstr item val type markstr]; 0; ) else if type == iTypeSkyDome then ( cbTreeMenuSkyDomeRemove item [viewstr item val type markstr]; 0; ) else if type == iTypeSkyPlane then ( cbTreeMenuSkyPlanRemove item [viewstr item val type markstr]; 0; ) else if type == iTypeCompositor then ( cbTreeMenuCompositorRemove item [viewstr item val type markstr]; 0; ) else if type == iTypeAnim then ( let XMLgetParam markstr "type" -> animtype in if (strcmpi animtype "cinematic") then nil else cbTreeMenuAnimRemove item [viewstr item val type markstr]; ) else nil; ) else if (key == (KEYBgetKeyNumber zkey)) then // Z ( let SO3SceneGetObject (V3DgetSession sessionstr) val -> obj in let if obj == nil then [0.0 0.0 0.0] else if type == iTypeEntity then V3DgetGlobalObjectCenter obj else SO3ObjectGetGlobalPosition obj -> pos in let SO3SceneGetObject (V3DgetSession sessionstr) "default_camera" -> camera in let SO3CameraGetFOVy camera -> fovy in let if obj == nil then 10.0 *. (itof iGlobalUnit) else if type == iTypeEntity then (V3DgetObjectRadius sessionstr obj) else (1.0 *. (itof iGlobalUnit)) -> curdist in let curdist +. (curdist /. tan fovy) -> dist in ( V3DsetShellNavPos sessionstr pos; if iNavigationMode then nil else ( SO3ObjectSetPosition camera [0.0 0.0 dist]; V3DsetOrthographicScale camera dist; ); ); 0; ) else if key == 35 then // H helpers ( set bShowHelpers = !bShowHelpers; V3DenableHelpers (V3DgetDefaultViewport viewstr) sessionstr bShowHelpers; let mainInterf.MINT_winView -> [_ [tbstr _ _ _ _ _ _ _ _ _ _ _ chkhelpers _ _ _ _ _ _ _]] in setEdToolBarCheckState tbstr chkhelpers bShowHelpers; 0; ) else if key == 34 then // G grid ( set bShowGrid = !bShowGrid; V3DshowSceneGrid sessionstr bShowGrid; let mainInterf.MINT_winView -> [_ [tbstr _ _ _ _ _ _ _ _ _ _ chkgrid _ _ _ _ _ _ _ _]] in setEdToolBarCheckState tbstr chkgrid bShowGrid; 0; ) else if key == 25 then // P proj ( cameraModeProjView (V3DgetDefaultCamera sessionstr); 0; ) else if key == 38 then // L (left) ( cameraModeLeftView (V3DgetDefaultCamera sessionstr); 0; ) else if key == 19 then // R (right) ( cameraModeRightView (V3DgetDefaultCamera sessionstr); 0; ) else if key == 20 then // T (top) ( cameraModeTopView (V3DgetDefaultCamera sessionstr); 0; ) else if key == 48 then // B (bottom) ( cameraModeBottomView (V3DgetDefaultCamera sessionstr); 0; ) else if key == 37 then // K (back) ( cameraModeBackView (V3DgetDefaultCamera sessionstr); 0; ) else if key == 33 then // F (front) ( cameraModeFrontView (V3DgetDefaultCamera sessionstr); 0; ) else if (key == 49) && (_keybdstate & 1) then // Shift + N ( let mainInterf.MINT_winView -> [_ [tbstr _ chkplay chkselect chkmove chkrotate chkscale chkcoords btnundo btnredo chknav chkgrid chkhelpers chkinfos btnfit chkwiremode _ _ _ _]] in ( cbChangeNavigateMode tbstr chknav nil nil !iNavigationMode viewstr; setEdToolBarCheckState tbstr chknav iNavigationMode; ); 0; ) else nil; if !iNavigationMode then nil else cbAvNavKeyUp viewstr key avNavStr; 0; ); ) else cbPlugView3dKeyUp viewstr key; if key == 31 && _keybdstate == 2 then // Ctrl + S ( saveSceneFile nil; 0; ) else if key == 14 && _keybdstate == 2 then // Ctrl + Backspace ( playEditor viewstr !bAppPlay; 0; ) else if key == 25 && _keybdstate == 2 then // Ctrl + P ( cbTbBtnProjectSetting nil nil nil nil viewstr; 0; ) else if key == 23 then // I infos ( set bShowInfos = !bShowInfos; V3DenableScreenInfos viewstr bShowInfos; let V3DgetDefaultSession viewstr -> sessionstr in V3DphysShowDebug sessionstr bShowInfos; let mainInterf.MINT_winView -> [_ [tbstr _ _ _ _ _ _ _ _ _ _ _ _ chkinfos _ _ _ _ _ _]] in setEdToolBarCheckState tbstr chkinfos bShowInfos; ) else if key == 61 then // F3 wire mode ( setViewWireMode viewstr !bShowWireMode; let mainInterf.MINT_winView -> [_ [tbstr _ _ _ _ _ _ _ _ _ _ _ _ _ _ chkwiremode _ _ _ _]] in setEdToolBarCheckState tbstr chkwiremode bShowWireMode; 0; ) else if key == 88 then // F12 launch app in viewer ( launchPlayer viewstr; 0; ) else nil; 0;; fun cbSceneTreeKeyDown(ctrlstr, father, item, val, type, key, ascode, viewstr)= mainKeyDown viewstr key ascode; 0;; fun cbSceneTreeKeyUp(ctrlstr, father, item, val, type, key, viewstr)= mainKeyUp viewstr key; 0;; /** cbView3dKeyDown [V3Dview I I] I * callback on key down * * private * * return 0 **/ fun cbView3dKeyDown(viewstr, key, ascode)= mainKeyDown viewstr key ascode; 0;; /** cbView3dKeyUp [V3Dview I] I * callback on key up * * private * * return 0 **/ fun cbView3dKeyUp(viewstr, key)= mainKeyUp viewstr key; 0;; /** cbNavigateControlState [V3Dsession I] I * callback on navigation control enable * * private * * return 0 **/ fun cbNavigateControlState(sessionstr, state)= if !bAppPlay then nil else cbPlugNavigateControlState sessionstr state; 0;; /** cbScenePreRender [V3Dsession I] I * callback on scene pre render * * private * * return 0 **/ fun cbScenePreRender(sessionstr, etime)= if !bAppPlay then ( if !iNavigationMode || (sessionstr.V3D_selectedAxis != nil) then nil else cbAvNavPreRender sessionstr avNavStr etime; 0; ) else cbPlugScenePreRender sessionstr etime; 0;; /** cbScenePreRender [V3Dsession I] I * callback on scene pre render * * private * * return 0 **/ fun cbScenePreRender2(sessionstr, etime)= if !bAppPlay then nil else cbPlugScenePreRender2 sessionstr etime; 0;; /** cbScenePreRenderPhysic [V3Dsession I] I * callback on scene pre render physic * * private * * return 0 **/ fun cbScenePreRenderPhysic(sessionstr, etime)= if !bAppPlay then nil else cbPlugScenePreRenderPhysic sessionstr etime; cbPlugView3dEditorPostRender sessionstr etime; 0;; /** cbScenePostRender [V3Dsession I] I * callback on scene post render * * private * * return 0 **/ fun cbScenePostRender(sessionstr, etime)= if !bAppPlay then nil else cbPlugScenePostRender sessionstr etime; cbPlugView3dEditorPreRender sessionstr etime; 0;; /** cbView3dPreRender [V3Dview] I * callback on pre render * * private * * return 0 **/ fun cbView3dPreRender(viewstr)= if !bAppPlay then nil else cbPlugView3dPreRender viewstr; 0;; /** cbView3dPreRender2 [V3Dview] I * callback on pre render * * private * * return 0 **/ fun cbView3dPreRender2(viewstr)= if !bAppPlay then nil else cbPlugView3dPreRender2 viewstr; 0;; /** cbView3dPostRender [V3Dview] I * callback on post render * * private * * return 0 **/ fun cbView3dPostRender(viewstr)= if !bAppPlay then nil else cbPlugView3dPostRender viewstr; 0;; /** cbView3dCameraChange [V3Dview V3Dsession SO3_OBJECT] I * callback on camera default change * * private * * return 0 **/ fun cbView3dCameraChange(viewstr, sessiontstr, camera)= if !bAppPlay then nil else cbPlugView3dCameraChange viewstr sessiontstr camera; 0;; /** cbView3dResize [V3Dview I I] I * callback view resize * * private * * return 0 **/ fun cbView3dResize(viewstr, w, h)= if (CAMViewport == nil) then nil else let V3DgetDefaultViewport viewstr -> viewportstr in let V3DgetViewportSize viewstr viewportstr -> [_ _ vw vh] in let fCAMViewportW /. (itof vw) -> pw in let fCAMViewportH /. (itof vh) -> ph in V3DsetViewportPositionSize CAMViewport (1.0 -. pw) (1.0 -. ph) pw ph; cbPlugView3dResize viewstr w h; 0;; fun cbDropImportXosScene(mnuitem, p)= let p -> [viewstr file] in cbImportXos [file [viewstr nil nil nil]]; 0;; fun cbDropImportScene(mnuitem, p)= let p -> [viewstr file] in importSceneWizard viewstr nil nil nil file; 0;; fun cbDropOpenPkos(mnuitem, p)= let p -> [viewstr file] in loadPkOS viewstr file; 0;; fun cbDropImportPkos(mnuitem, p)= let p -> [viewstr file] in cbImportPkos [file [nil viewstr nil nil nil]]; 0;; fun cbDropImport3dFile(mnuitem, p)= let p -> [viewstr lpfile] in import3dFileWizard viewstr nil nil nil lpfile; 0;; fun cbSaveOnDrag(p)= let p -> [viewstr file] in ( let V3DgetDefaultSession viewstr -> sessionstr in initScene viewstr sessionstr; loadOs3DScene viewstr file; ); 0;; fun cbSaveBeforeDragOpen(dlg, p, state)= let p -> [viewstr file] in ( if (state == 2) then nil else // Cancel if (state == 1) then // OK ( saveSceneFile mkfun1 @cbSaveOnDrag p; 0; ) else ( let V3DgetDefaultSession viewstr -> sessionstr in initScene viewstr sessionstr; loadOs3DScene viewstr file; 0; ); ); 0;; fun cbDropOpenScene(mnuitem, p)= let p -> [viewstr file] in ( if (!bAppPlay) then nil else playEditor viewstr 0; if (isSceneModified) then ( _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0452") (loc "OS3D_0121") 3 @cbSaveBeforeDragOpen p; 0; ) else ( let V3DgetDefaultSession viewstr -> sessionstr in initScene viewstr sessionstr; loadOs3DScene viewstr file; 0; ); ); 0;; fun cbDropImportMesh(mnuitem, p)= let p -> [viewstr lfile] in importMeshWizard viewstr nil nil iTypeScene nil lfile; 0;; /** cbView3dDropFile [V3Dview I I [P r1]] I * callback view drop files * * private * * return 0 **/ fun cbView3dDropFile(viewstr, x, y, lp)= if !bAppPlay then ( if (lp == nil) then nil else let let 0 -> patherr in let 0 -> fmterr in let nil -> lfile in let lp -> nlp in while (nlp != nil) do ( let hd nlp -> pfile in let getFileExt _GetFileNameFromP pfile -> ext in let _PtoScol pfile -> file in if (!checkImportFileFormats pfile) then ( if (file == nil) then set patherr = 1 else set fmterr = 1; ) else ( set lfile = file::lfile; 0; ); set nlp = tl nlp; [lfile patherr fmterr] ) -> [lfile patherr fmterr] in ( if (fmterr) then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0423") 0; addLogMessage (loc "OS3D_0422"); 0; ) else if (patherr) then ( _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win (loc "OS3D_0155") (loc "OS3D_0420") 0; addLogMessage (loc "OS3D_0422"); 0; ) else let (hd lp) -> pfile in let getFileExt _GetFileNameFromP pfile -> ext in let _PtoScol pfile -> file in let _CRpopupMenu _channel -> mnu in ( if (!strcmpi ext "xos") then ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0285")) @cbDropOpenScene [viewstr file]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0196")) @cbDropImportXosScene [viewstr file]; 0; ) else if ((!strcmpi ext "pkos") || (!strcmpi ext "pak")) then ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0285")) @cbDropOpenPkos [viewstr pfile]; _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0196")) @cbDropImportPkos [viewstr pfile]; 0; ) else if (!strcmpi ext "scene") then ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0196")) @cbDropImportScene [viewstr file]; 0; ) else if (!strcmpi ext "mesh") then ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0197")) @cbDropImportMesh [viewstr lfile]; 0; ) else ( _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0197")) @cbDropImport3dFile [viewstr lp]; 0; ); _CBmenu (_APPitem _channel mnu ME_ENABLED (loc "OS3D_0084")) nil nil; let _GETscreenPos -> [x y] in _DRAWmenu viewstr.V3D_win mnu x y PM_SCREEN|PM_LEFT_ALIGN; 0; ); ); ) else ( cbPlugView3dDropFile viewstr x y lp; 0; ); 0;; /** cbDestroyPrefWin [EdWindow ObjWebNavigator] I * callback on destroy preference window * * private * * return 0 **/ fun cbDestroyPrefWin(winstr)= set winPref = nil; 0;; fun cbLanguageChanged(ctrl, pos, elem, winstr)= set currentLanguage = elem; _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0452") (loc "OS3D_0552") 0; 0;; fun cbInterfColorScheme(ctrl, pos, elem, winstr)= setConfigParam "OS3Duser" "colorScheme" elem; _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0452") (loc "OS3D_0552") 0; 0;; fun cbUserLevelChanged(ctrl, pos, elem, winstr)= setConfigParam "OS3Duser" "plugits_user_level" (itoa pos); refreshAllInterfLinks 1; 0;; fun cbCheckTplCategoryState(ctrl, state, pname)= setConfigParam "OS3Duser" pname itoa state; resetTemplateMenus; 0;; fun cbRendererChanged(ctrl, pos, elem, winstr)= chgusm "SO3Renderer" nil let strbuild ("SO3Renderer"::elem::nil)::nil -> s in substr s 0 (strlen s)-1; _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0452") (loc "OS3D_0552") 0; 0;; fun cbPartitionChange(ctrlstr, val, winstr)= let getInfo (strextr _loadusmini nil) "disku" -> upart in let getInfo (strextr _loadusmini nil) "diska" -> apart in let if (upart != nil) then upart else apart -> opath in let if (upart != nil) then "disku" else "diska" -> diskp in let if ((strfindi "%documents%" val 0) != nil) then "disku" else "diska" -> diskd in let if ((strfindi "%documents%/" val 0) != nil) then strreplace val "%documents%/" "./" else if ((strfind "./" val 0) != nil) then val else if ((strfind ":\\" val 0) != nil) then val else strcat "./" val -> path in ( addLogMessage strcatn "Part: "::diskd::" > "::path::nil; chgusm diskp opath let strbuild (diskd::path::nil)::nil -> s in strcat substr s 0 (strlen s)-1 " 0"; ); _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0452") (loc "OS3D_0552") 0; 0;; /** cbTbBtnPref [EdToolBar CompRollOver I I V3Dview] I * callback on preference button * Open the online help * * private * * return 0 **/ fun cbTbBtnPref(tbstr, croll, btn, mask, viewstr)= if winPref != nil then nil else let _isPrimary -> portable in let getOs3dTemplatesCategories "assets/templates" -> lcat in let (sizelist lcat) * 25 -> catheight in let if portable then 80 else 0 -> portheight in let [450 140 + catheight + portheight] -> [iw ih] in let 10 -> ypos in let _GETWorkingAreaSize -> [sw _] in let _GETdesktopSize -> [_ sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx - iw) (if ((my + ih) > sh) then (max 0 (sh - ih)) else my)] -> [x y] in let setEdWindowIcon (crEdWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_SIZEBOX nil EDWIN_DIALOG (loc "OS3D_0551")) sWinDlgIcon -> dlgwinstr in let crEdScrollWindow _channel dlgwinstr 0 0 iw ih WN_CHILDINSIDE|WN_VSCROLL EDWIN_RESIZE_MW|EDWIN_RESIZE_MH nil nil -> scrlwinstr in let crEdWindow _channel scrlwinstr 0 0 iw ih WN_CHILDINSIDE|WN_NOBORDER nil EDWIN_GROUP nil -> mwinstr in let crEdFrameWindow _channel mwinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3D_0553") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 ypos + 2 180 20 (loc "OS3D_0553") nil -> label in let crEdCtrlSelect winstr 200 ypos (iw - 210) 120 EDWIN_RESIZE_MW -> ctrllang in let if !portable then nil else let (let (getInfo (strextr _loadusmini nil) "SO3Renderer")->n in if n==nil then "OpenGL" else n) -> renderermode in let getInfo (strextr _loadusmini nil) "disku"-> upart in let getInfo (strextr _loadusmini nil) "diska" -> apart in let if (upart != nil) then strreplace upart "./" "%documents%/" else strreplace apart "./" "" -> diskp in let crEdFrameWindow _channel mwinstr 0 0 iw 80 EDWIN_RESIZE_MW nil (loc "OS3D_0844") (loc "OS3D_0250") -> 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 180 20 (loc "OS3D_0539") nil -> labelr in let crEdCtrlSelect winstr 200 ypos (iw - 210) 120 EDWIN_RESIZE_MW -> ctrlrenderer in let crEdCtrlLabel winstr 10 (set ypos = ypos + 25) + 2 180 20 (loc "OS3D_0845") nil -> labelp in let crEdCtrlTextLine winstr 200 ypos (iw - 210) 20 diskp nil EDWIN_RESIZE_MW -> ctrlpart in ( fillEdCtrlSelect ctrlrenderer "DirectX"::"OpenGL"/*::"Vulkan"*/::nil; selectEdCtrlSelect ctrlrenderer renderermode; setEdCtrlSelectCb ctrlrenderer mkfun4 @cbRendererChanged dlgwinstr; setEdCtrlTextLineCbValidate ctrlpart mkfun3 @cbPartitionChange dlgwinstr; ) -> _ in //let crEdFrameWindow _channel mwinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3D_0554") (loc "OS3D_0250") -> winfrm in //let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in //let crEdCtrlLabel winstr 10 (set ypos = 10) + 2 180 20 (loc "OS3D_0555") nil -> label in //let crEdCtrlSelect winstr 200 ypos (iw - 210) 120 EDWIN_RESIZE_MW -> ctrlscheme in let crEdFrameWindow _channel mwinstr 0 0 iw 55 EDWIN_RESIZE_MW nil (loc "OS3D_0829") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw 35 WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let crEdCtrlLabel winstr 10 (set ypos = 10) + 2 180 20 (loc "OS3D_0830") nil -> label in let crEdCtrlSelect winstr 200 ypos (iw - 210) 120 EDWIN_RESIZE_MW -> ctrlplugitlevel in let crEdFrameWindow _channel mwinstr 0 0 iw (catheight + 30) EDWIN_RESIZE_MW nil (loc "OS3D_0841") (loc "OS3D_0250") -> winfrm in let crEdWindow _channel winfrm 0 18 iw (catheight + 20) WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW nil nil -> winstr in let buildLanguages (strcat APPBASEDIR "os3deditor/lang/") (strcat APPBASEDIR "os3deditor/lang/os3deditor.") -> languages in ( set ypos = -15; while (lcat != nil) do ( let hd lcat -> catname in let strreplace catname "_" " " -> catlabel in let crEdCtrlCheck winstr 10 (set ypos = ypos + 25) (iw - 20) 20 catlabel EDWIN_RESIZE_MW -> ctrlcat in let strcat "tpl_category_filter_" catname -> pname in let atoi (getConfigParamDef "OS3Duser" pname "1") -> state in ( setEdCtrlCheckState ctrlcat state; setEdCtrlCheckCbState ctrlcat mkfun3 @cbCheckTplCategoryState pname; ); set lcat = tl lcat; ); let 0 -> i in let sizelist languages -> size in while (i < size) do ( let nth_list languages i -> [_ lang] in addEdCtrlSelect ctrllang lang; set i = i + 1; ); selectEdCtrlSelect ctrllang currentLanguage; setEdCtrlSelectCb ctrllang mkfun4 @cbLanguageChanged dlgwinstr; fillEdCtrlSelect ctrlplugitlevel (loc "OS3D_0831")::(loc "OS3D_0832")::(loc "OS3D_0833")::nil; let atoi (getConfigParamDef "OS3Duser" "plugits_user_level" "1") -> userlevel in selectEdCtrlSelectByPos ctrlplugitlevel userlevel; setEdCtrlSelectCb ctrlplugitlevel mkfun4 @cbUserLevelChanged dlgwinstr; //fillEdCtrlSelect ctrlscheme "Dark"::"Light"::"Blue light"::"Blue dark"::"Nature"::nil; //let getConfigParam "OS3Duser" "colorScheme" -> scheme in // selectEdCtrlSelect ctrlscheme if (scheme == nil) then "Dark" else scheme; //setEdCtrlSelectCb ctrlscheme mkfun4 @cbInterfColorScheme winstr; let getEdWindowExPosSize dlgwinstr -> [_ _ mw mh] in let mh - ih -> bordersize in let getEdWindowSize mwinstr -> [nw nh] in let if nw + 22 >= sw then sw else nw + 22 -> nw in let if nh + 40 + bordersize >= sh then sh - bordersize else nh + 40 -> nh in let [(if ((x + nw) > sw) then (sw - nw) else x) (if ((y + nh + bordersize) > sh) then (sh - nh - bordersize) else y)] -> [x y] in ( setEdWindowPosSize dlgwinstr x y nw nh; setEdWindowMinimumSize dlgwinstr nw 200; setEdWindowMaximumSize dlgwinstr nw sh - 40; ); set winPref = dlgwinstr; setEdwindowCbDestroy winPref @cbDestroyPrefWin; ); 0;; fun cbCloseOnSave(winstr)= dsEdWindow winstr; 0;; fun cbSaveBeforeQuit(dlg, winstr, state)= if (state == 2) then nil else // Cancel if (state == 1) then // OK saveSceneFile mkfun1 @cbCloseOnSave winstr else dsEdWindow winstr; 0;; fun cbWinMainClose(winstr)= if (isSceneModified) then ( _DLGrflmessage _DLGMessageBox _channel winstr.EDW_win (loc "OS3D_0452") (loc "OS3D_0120") 3 @cbSaveBeforeQuit winstr; 0; ) else ( dsEdWindow winstr; 0; ); 0;; /** cbWinMainDestroy [Edwindow] I * callback on destroy main window * * private * * return 0 **/ fun cbWinMainDestroy(winstr)= // save current config let getEdWindowPosSize winstr -> [x y w h] in let mainInterf.MINT_winInfos -> [winfostr _ _ _] in let mainInterf.MINT_winPlugins -> [pviewstr _] in let mainInterf.MINT_winLogs -> [winlogs _ _] in let _GETwindowPositionSize mainInterf.MINT_winHBorder.EDW_win -> [_ hy _ _] in let _GETwindowPositionSize mainInterf.MINT_winHBorder2.EDW_win -> [_ h2y _ _] in let _GETwindowPositionSize mainInterf.MINT_winVBorder.EDW_win -> [vx _ _ _] in let if (vx < 0) then 280 else vx -> vx in let if (hy < 0) then 600 else hy -> hy in let if (h2y < 0) then 900 else h2y -> h2y in ( if (w <= 5) || (h <= 5) then nil else ( setConfigParam "OS3Dmain" "posx" itoa x; setConfigParam "OS3Dmain" "posy" itoa y; setConfigParam "OS3Dmain" "width" itoa w; setConfigParam "OS3Dmain" "height" itoa h; if (pviewstr.EDW_father != mainInterf.MINT_winMain) then nil else setConfigParam "OS3Dmain" "seph" itoa hy; if (winlogs.EDW_father != mainInterf.MINT_winMain) then nil else setConfigParam "OS3Dmain" "seph2" itoa h2y; if (winfostr.EDW_father != mainInterf.MINT_winMain) then nil else setConfigParam "OS3Dmain" "sepv" itoa vx; ); ); setConfigParam "OS3Duser" "bShowGrid" itoa bShowGrid; setConfigParam "OS3Duser" "bShowHelpers" itoa bShowHelpers; setConfigParam "OS3Duser" "bShowInfos" itoa bShowInfos; setConfigParam "OS3Duser" "bAutoFit" itoa bAutoFit; setConfigParam "OS3Duser" "bWireMode" itoa bShowWireMode; XMLsetParam (XMLgetMarkByValue xmlConfigFile "config") "language" currentLanguage; XMLwrite xmlConfigFile strcat APPBASEDIR sConfigFile; stopDocServer nil; _closemachine; 0;; fun cbvborderMouseMove(winstr, x, y, btn)= if btn != 1 then nil else ( let mainInterf.MINT_winInfos -> [winfostr _ _ _] in let mainInterf.MINT_winView -> [wviewstr _] in let mainInterf.MINT_winVBorder -> vborder in let if (winfostr.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> binfo in let _GETwindowPositionSize mainInterf.MINT_winMain.EDW_win -> [_ _ mw mh] in ( let if (!binfo) then [0 0 0 0] else _GETwindowPositionSize winfostr.EDW_win -> [ix iy iw ih] in let _GETwindowPositionSize wviewstr.EDW_win -> [vx vy vw vh] in let _GETwindowPositionSize vborder.EDW_win -> [wx wy ww wh] in let wx + x -> xpos in let if (!binfo) then xpos else if xpos <= 120 then 120 else if (mw-xpos-ww) <= 350 then mw-350 else xpos -> xpos in ( setEdWindowPosSize vborder xpos wy ww wh; if (!binfo) then nil else setEdWindowPosSize winfostr ix iy ix+xpos ih; setEdWindowPosSize wviewstr xpos+ww vy mw-xpos-ww vh; ); ); ); 0;; fun cbHBorderMouseMove(winstr, x, y, btn)= if btn != 1 then nil else ( let mainInterf.MINT_winInfos -> [winfostr _ _ _] in let mainInterf.MINT_winView -> [wviewstr _] in let mainInterf.MINT_winPlugins -> [pviewstr _] in let mainInterf.MINT_winLogs -> [winlogs _ _] in let mainInterf.MINT_winHBorder -> hborder in let mainInterf.MINT_winHBorder2 -> h2border in let mainInterf.MINT_winVBorder -> vborder in let if (winfostr.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> binfo in let if (pviewstr.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> bpview in let if (winlogs.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> blogs in let _GETwindowPositionSize mainInterf.MINT_winMain.EDW_win -> [_ _ mw mh] in ( let if (!binfo) then [0 0 0 0] else _GETwindowPositionSize winfostr.EDW_win -> [ix iy iw ih] in let _GETwindowPositionSize wviewstr.EDW_win -> [vx vy vw vh] in let if (!bpview) then [0 0 0 0] else _GETwindowPositionSize pviewstr.EDW_win -> [px py pw ph] in let if (!blogs) then [0 0 0 0] else _GETwindowPositionSize winlogs.EDW_win -> [lx ly lw lh] in let _GETwindowPositionSize hborder.EDW_win -> [hx hy hw hh] in let _GETwindowPositionSize h2border.EDW_win -> [h2x h2y h2w h2h] in let _GETwindowPositionSize vborder.EDW_win -> [wx wy ww wh] in let if (!blogs) then 0 else h2h -> h2h in let hy + y -> ypos in let if ypos <= (36+28) then (36+28) else if ypos >= (h2y - hh - 28) then (h2y - hh - 28) else ypos -> ypos in ( setEdWindowPosSize hborder hx ypos hw hh; setEdWindowPosSize vborder wx wy ww ypos-wy; if (!binfo) then nil else setEdWindowPosSize winfostr ix iy iw ypos-iy; setEdWindowPosSize wviewstr vx vy vw ypos-vy; if (!bpview) then nil else setEdWindowPosSize pviewstr px ypos+hh pw mh-ypos-hh-h2h-lh; ); ); ); 0;; fun cbHBorderMouseMove2(winstr, x, y, btn)= if btn != 1 then nil else ( let mainInterf.MINT_winInfos -> [winfostr _ _ _] in let mainInterf.MINT_winView -> [wviewstr _] in let mainInterf.MINT_winPlugins -> [pviewstr _] in let mainInterf.MINT_winLogs -> [winlogs _ _] in let mainInterf.MINT_winHBorder -> hborder in let mainInterf.MINT_winHBorder2 -> h2border in let mainInterf.MINT_winVBorder -> vborder in let if (winfostr.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> binfo in let if (pviewstr.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> bpview in let if (winlogs.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> blogs in let _GETwindowPositionSize mainInterf.MINT_winMain.EDW_win -> [_ _ mw mh] in ( let if (!binfo) then [0 0 0 0] else _GETwindowPositionSize winfostr.EDW_win -> [ix iy iw ih] in let if (!bpview) then [0 0 0 0] else _GETwindowPositionSize pviewstr.EDW_win -> [px py pw ph] in let if (!blogs) then [0 0 0 0] else _GETwindowPositionSize winlogs.EDW_win -> [lx ly lw lh] in let _GETwindowPositionSize wviewstr.EDW_win -> [vx vy vw vh] in let _GETwindowPositionSize hborder.EDW_win -> [hx hy hw hh] in let _GETwindowPositionSize h2border.EDW_win -> [h2x h2y h2w h2h] in let _GETwindowPositionSize vborder.EDW_win -> [wx wy ww wh] in let hy -> ypos in let h2y + y -> y2pos in let if (bpview) then if y2pos <= (py + 28) then (py + 28) else if y2pos >= (mh - 28 - h2h) then (mh - 28 - h2h) else y2pos else if y2pos <= (36+28) then (36+28) else if y2pos >= (mh - 28 - h2h) then (mh - 28 - h2h) else y2pos -> y2pos in ( if (bpview) then nil else setEdWindowPosSize hborder hx y2pos hw hh; if (bpview) then nil else setEdWindowPosSize vborder wx wy ww y2pos-wy; setEdWindowPosSize h2border h2x y2pos h2w h2h; if (!binfo || bpview) then nil else setEdWindowPosSize winfostr ix iy iw y2pos-iy; if (!bpview) then setEdWindowPosSize wviewstr vx vy vw y2pos-vy else setEdWindowPosSize pviewstr px py pw y2pos-py; if (!blogs) then nil else setEdWindowPosSize winlogs lx y2pos+h2h lw mh-y2pos-h2h; ); ); ); 0;; fun cbWinMainSize(winstr, mw, mh)= if mw < 100 || mh < 100 then nil else ( let mainInterf.MINT_winInfos -> [winfostr _ _ _] in let mainInterf.MINT_winView -> [wviewstr _] in let mainInterf.MINT_winPlugins -> [pviewstr _] in let mainInterf.MINT_winLogs -> [winlogs _ _] in let mainInterf.MINT_winHBorder -> hborder in let mainInterf.MINT_winHBorder2 -> h2border in let mainInterf.MINT_winVBorder -> vborder in let if (winfostr.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> binfo in let if (pviewstr.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> bpview in let if (winlogs.EDW_father != mainInterf.MINT_winMain) then 0 else 1 -> blogs in if winfostr.EDW_bMinimize || wviewstr.EDW_bMinimize || pviewstr.EDW_bMinimize || winlogs.EDW_bMinimize then nil else ( let if (!binfo) then [0 0 0 0] else _GETwindowPositionSize winfostr.EDW_win -> [ix iy iw ih] in let _GETwindowPositionSize wviewstr.EDW_win -> [vx vy vw vh] in let if (!bpview) then [0 0 0 0] else _GETwindowPositionSize pviewstr.EDW_win -> [px py pw ph] in let if (!blogs) then [0 0 0 0] else _GETwindowPositionSize winlogs.EDW_win -> [lx ly lw lh] in let _GETwindowPositionSize hborder.EDW_win -> [hx ypos hw hh] in let _GETwindowPositionSize vborder.EDW_win -> [xpos wy ww wh] in let _GETwindowPositionSize h2border.EDW_win -> [h2x y2pos h2w h2h] in let if (!binfo) then (-ww) else if xpos <= 120 then 120 else if (mw-xpos-ww) <= 350 then mw-350 else xpos -> xpos in let if (!bpview) then if (!blogs) then mh else ly-h2h else if ypos <= (36+28) then (36+28) else if ypos >= (y2pos - hh - 28) then (y2pos - hh - 28) else ypos -> ypos in let if (!blogs) then mh else if y2pos <= (py + 28) then (py + 28) else if y2pos >= (mh - 28 - h2h) then (mh - 28 - h2h) else y2pos -> y2pos in ( setEdWindowPosSize hborder hx ypos hw hh; setEdWindowPosSize vborder xpos wy ww ypos-wy; if (!binfo) then nil else setEdWindowPosSize winfostr ix iy ix+xpos ypos-iy; setEdWindowPosSize wviewstr xpos+ww vy mw-xpos-ww ypos-vy; if (!bpview) then nil else setEdWindowPosSize pviewstr px ypos+hh pw y2pos-(ypos+hh); setEdWindowPosSize h2border h2x y2pos h2w h2h; if (!blogs) then nil else setEdWindowPosSize winlogs lx y2pos+h2h lw mh-y2pos-h2h; ); ); 0; ); 0;; fun cbSplashText(message, p)= let p -> [tbstr textstr tbtopstr bmpstr] in ( setEdToolBarText tbstr textstr strTruncate (strcat (strcat (loc "OS3D_0227") " ") message) 64 "[...]" 0xffffff; //paintEdCtrlBitmap bmpstr; paintEdToolBar tbtopstr; ); 0;; fun cbDestroyView3d(viewstr)= if (isSceneModified) then ( _DLGrflmessage _DLGMessageBox _channel mainWindow.EDW_win (loc "OS3D_0452") (loc "OS3D_0120") 3 @cbSaveBeforeQuit mainWindow; 0; ) else ( dsEdWindow mainWindow; 0; ); 0;; fun reloadFromPlugin()= V3DphysEnablePhysic c3dXsession 0; stopAllPluginInstances currentProject; refreshSceneGraph v3dMain; playSceneGraph v3dMain; startAllPluginInstances currentProject; V3DphysEnablePhysic c3dXsession bPhysicOnPlay; 0;; /** cbDestroyFilterTreeWin [EdWindow] I * callback on destroy filter tree window * * private * * return 0 **/ fun cbDestroyFilterTreeWin(winstr)= mutate winFilterTree <- [nil _]; 0;; fun cbFilterTreeValue(ctrlstr, val)= let winFilterTree -> [_ oval] in if (!strcmp oval val) then nil else ( setEdCtrlTreeFilter ctrlSceneTree val; mutate winFilterTree <- [_ val]; //reset last selection let SO3SceneGetObject (V3DgetSession c3dXsession) sSelected -> fobj in ( SO3ObjectShowBoundingBox fobj 0; V3DshowObjectAxis v3dMain c3dXsession fobj iViewerEditMode 0; set sSelected = nil; ); ); 0;; /** cbFilterTree [EdToolBar CompCheck I I I] I * callback on filter tree button * * private * * return 0 **/ fun cbFilterTree(tbstr, cbtn, btn, mask)= let winFilterTree -> [fwinstr val] in if (fwinstr != nil) then nil else let [300 60] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let setEdWindowIcon (crEdDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_DIALOG nil (loc "OS3D_0821")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 12 100 20 (loc "OS3D_0822") nil -> label in let crEdCtrlTextLine winstr 120 10 (iw - 130) 20 val nil EDWIN_RESIZE_MW -> ctrltext in ( set winFilterTree = [winstr val]; setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineCbValidate ctrltext @cbFilterTreeValue; setEdwindowCbDestroy winstr @cbDestroyFilterTreeWin; ); 0;; fun setSceneTreeFilterState(state)= if (state) then nil else let winFilterTree -> [winstr _] in dsEdWindow winstr; mutate winFilterTree <- [nil _]; 0;; fun cbDestroyMoveMultiWin(winstr)= set winMoveMulti = nil; 0;; fun fillMoveMultiList(ctrllist, ctrltree, filter)= resetEdCtrlList ctrllist; let revertlist getEdCtrlTreeItems ctrltree -> litems in while (litems != nil) do ( let hd litems -> [_ itemstr] in let itemstr.EDTITEM_iType -> type in if (!strcmp itemstr.EDTITEM_sValue "default_light") || (!strcmp itemstr.EDTITEM_sValue "default_camera") || ((type != iTypeNode) && (type != iTypeGroup) && (type != iTypeEntity) && (type != iTypeCamera) && (type != iTypeParticle) && (type != iTypeLight) && (type != iTypeCubeMap) && (type != iTypeReflectionMap)) || ((filter != nil) && (strcmp filter "") && ((strfindi filter itemstr.EDTITEM_sLabel 0) == nil)) then nil else addEdCtrlList ctrllist itemstr.EDTITEM_sLabel itemstr.EDTITEM_sValue::nil 0; set litems = tl litems; ); 0;; fun cbFilterMoveListValue(ctrlstr, val, p)= let p -> [ctrllist ctrltree] in fillMoveMultiList ctrllist ctrltree val; 0;; fun cbMoveMultiTreeClick(ctrlstr, father, item, value, type, pos, btn, movebtn)= let if (!strcmp value "default_light") || (!strcmp value "default_camera") || ((type != iTypeScene) && (type != iTypeGroup) && (type != iTypeNode) && (type != iTypeEntity) && (type != iTypeCamera) && (type != iTypeParticle) && (type != iTypeLight) && (type != iTypeCubeMap) && (type != iTypeReflectionMap)) then 0 else 1 -> state in setEdCtrlButtonEnable movebtn state; 0;; fun cbMoveMultiBtn(ctrlstr, p)= let p -> [ctrllist ctrltree] in let getMultiSelectedEdCtrlList ctrllist -> lelts in let getEdCtrlTreeSelectedItem ctrltree -> selem in let getEdCtrlTreeItemByValue ctrlSceneTree selem.EDTITEM_sValue -> telem2 in ( while (lelts != nil) do ( let hd lelts -> [name lval type] in let hd lval -> value in let getEdCtrlTreeItemByValue ctrlSceneTree value -> telem1 in moveNodeToNode v3dMain [telem1.EDTITEM_father telem1 telem1.EDTITEM_sValue telem1.EDTITEM_iType] [telem2.EDTITEM_father telem2 telem2.EDTITEM_sValue telem2.EDTITEM_iType]; set lelts = tl lelts; ); resetEdCtrlTree ctrltree; cpEdCtrlTreeContent ctrlSceneTree ctrltree; ); 0;; fun cbMoveMulti(tbstr, cbtn, btn, mask)= if (winMoveMulti != nil) then nil else let [600 300] -> [iw ih] in let _GETWorkingAreaSize -> [sw sh] in let _GETscreenPos -> [mx my] in let [(if ((mx + iw) > sw) then (sw - iw) else mx) (if ((my + ih) > sh) then max 0 (sh - ih) else my)] -> [x y] in let winFilterTree -> [_ val] in let setEdWindowIcon (crEdModalDialogWindow _channel mainInterf.MINT_winMain x y iw ih WN_NOSCOL|WN_MENU|WN_DIALOG|WN_SIZEBOX nil (loc "OS3D_0823")) sWinDlgIcon -> winstr in let crEdCtrlLabel winstr 10 12 100 20 (loc "OS3D_0824") nil -> label in let crEdCtrlTextLine winstr 120 10 (((iw - 60) / 2) - 120) 20 val nil EDWIN_RESIZE_MW -> ctrltext in let crEdCtrlList winstr 10 35 (((iw - 60) / 2) - 10) (ih - 40) LB_BORDER|LB_HSCROLL|LB_VSCROLL|LB_TABFOCUS|LB_MULTIPLE EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrllist in let crEdCtrlTree winstr ((iw / 2) + 30) 35 (((iw - 60) / 2) - 10) (ih - 40) EDWIN_RESIZE_LW|EDWIN_RESIZE_MH -> ctrltree in let crEdCtrlButton winstr ((iw / 2) - 20) (ih / 2) 40 20 ">>" EDWIN_RESIZE_RH|EDWIN_RESIZE_LW -> movebtn in ( setEdWindowMinimumSize winstr 600 300; cpEdCtrlTreeContent ctrlSceneTree ctrltree; fillMoveMultiList ctrllist ctrltree val; setEdCtrlTreeCbClick ctrltree mkfun8 @cbMoveMultiTreeClick movebtn; setEdCtrlButtonCb movebtn mkfun2 @cbMoveMultiBtn [ctrllist ctrltree]; setEdCtrlButtonEnable movebtn 0; set winMoveMulti = winstr; setEdctrlTextLineFocus ctrltext; setEdCtrlTextLineCbValidate ctrltext mkfun3 @cbFilterMoveListValue [ctrllist ctrltree]; setEdwindowCbDestroy winstr @cbDestroyMoveMultiWin; ); 0;; fun cbSceneTreeTabFocused(tabstr, tree)= setSceneTreeFilterState 1; 0;; fun cbRessourcesTabFocused(tabstr, tree)= setSceneTreeFilterState 0; 0;; fun loadColorTheme()= let (getConfigParam "OS3Duser" "colorScheme") -> scheme in if (scheme == nil) then nil else ( if (!strcmpi scheme "Dark") then ( set EdDefaultTheme.EDT_iMainBackgroundColor = iG2DDEFAULTBACKGROUNDCOLOR; set EdDefaultTheme.EDT_iToolBarColor = iG2DDEFAULTBACKGROUNDCOLOR; set EdDefaultTheme.EDT_iTabBarColor = iG2DDEFAULTBACKGROUNDCOLOR; set EdDefaultTheme.EDT_iFrameBarColor = iG2DDEFAULTBACKGROUNDCOLOR; set EdDefaultTheme.EDT_iLabelColor = iG2DDEFAULTLABELFONTCOLOR; set EdDefaultTheme.EDT_iFrameFontColor = iG2DDEFAULTFRAMEFONTCOLOR; set EdDefaultTheme.EDT_iTabFontColor = iG2DDEFAULTFONTCOLOR; set EdDefaultTheme.EDT_iModuleEditorBg = iG2DDEFAULTMODULEEDITORBGCOLOR; set EdDefaultTheme.EDT_iModuleEditorDot = iG2DDEFAULTMODULEEDITORDOTCOLOR; ) else if (!strcmpi scheme "Light") then ( set EdDefaultTheme.EDT_iMainBackgroundColor = 0x7D7DA0; set EdDefaultTheme.EDT_iToolBarColor = 0x7D7DA0; set EdDefaultTheme.EDT_iTabBarColor = 0x7D7DA0; set EdDefaultTheme.EDT_iFrameBarColor = 0x7D7DA0; set EdDefaultTheme.EDT_iLabelColor = 0xD5D5F9; set EdDefaultTheme.EDT_iFrameFontColor = 0xD5D5F9; set EdDefaultTheme.EDT_iTabFontColor = 0x7D7DA0; set EdDefaultTheme.EDT_iModuleEditorBg = 0xC6C6D3; set EdDefaultTheme.EDT_iModuleEditorDot = 0x7D7DA0; ) else nil; /* set EdDefaultTheme.EDT_iModuleEditorBoxOff = iG2DDEFAULTMODULEEDITORBOXOFFCOLOR; set EdDefaultTheme.EDT_iModuleEditorBoxOn = iG2DDEFAULTMODULEEDITORBOXONCOLOR; set EdDefaultTheme.EDT_iModuleEditorBoxDisableOff = iG2DDEFAULTMODULEEDITORBOXDISABLEOFFCOLOR; set EdDefaultTheme.EDT_iModuleEditorBoxDisableOn = iG2DDEFAULTMODULEEDITORBOXDISABLEONCOLOR; set EdDefaultTheme.EDT_iModuleEditorBoxBorderOff = iG2DDEFAULTMODULEEDITORBOXBORDEROFFCOLOR; set EdDefaultTheme.EDT_iModuleEditorBoxBorderOn = iG2DDEFAULTMODULEEDITORBOXBORDERONCOLOR; set EdDefaultTheme.EDT_iModuleEditorBoxTextOff = iG2DDEFAULTMODULEEDITORBOXTEXTOFFCOLOR; set EdDefaultTheme.EDT_iModuleEditorBoxTextOn = iG2DDEFAULTMODULEEDITORBOXTEXTONCOLOR; set EdDefaultTheme.EDT_iModuleEditorLinkOff = iG2DDEFAULTMODULEEDITORLINKOFFCOLOR; set EdDefaultTheme.EDT_iModuleEditorLinkOn = iG2DDEFAULTMODULEEDITORLINKONCOLOR; set EdDefaultTheme.EDT_iModuleEditorRLinkSize = iG2DDEFAULTMODULEEDITORROUNDLINKSIZE; set EdDefaultTheme.EDT_iModuleEditorBorderWidth = 1; set EdDefaultTheme.EDT_iTimeLineEditorBg = iG2DDEFAULTTIMELINEEDITORBGCOLOR; set EdDefaultTheme.EDT_iTimeLineEditorTrackOff = iG2DDEFAULTTIMELINEEDITORTRACKOFFCOLOR; set EdDefaultTheme.EDT_iTimeLineEditorTrackOn = iG2DDEFAULTTIMELINEEDITORTRACKONCOLOR; set EdDefaultTheme.EDT_iTimeLineEditorKeyOff = iG2DDEFAULTTIMELINEEDITORKEYOFFCOLOR; set EdDefaultTheme.EDT_iTimeLineEditorKeyOn = iG2DDEFAULTTIMELINEEDITORKEYONCOLOR; set EdDefaultTheme.EDT_iTimeLineEditorKeyInterOff = iG2DDEFAULTTIMELINEEDITORKEYINTEROFFCOLOR; set EdDefaultTheme.EDT_iTimeLineEditorKeyInterOn = iG2DDEFAULTTIMELINEEDITORKEYINTERONCOLOR; set EdDefaultTheme.EDT_iTimeLineEditorKeyBorderOff = iG2DDEFAULTTIMELINEEDITORKEYBORDEROFFCOLOR; set EdDefaultTheme.EDT_iTimeLineEditorKeyBorderOn = iG2DDEFAULTTIMELINEEDITORKEYBORDERONCOLOR;*/ let G2Dgetbgr EdDefaultTheme.EDT_iModuleEditorBg -> [b g r] in ( set iDefaultBackGroundRColor = r; set iDefaultBackGroundGColor = g; set iDefaultBackGroundBColor = b; ); ); 0;; fun cbPluginsLoaded(p)= let p -> [viewstr sessionstr file] in let _GETdesktopSize -> [sw sh] in ( initScene viewstr sessionstr; // TODO DEBUG don't work if called before initscene V3DsetScreenInfos viewstr 5 5 300 200 14 0xffffff; V3DenableScreenInfos viewstr bShowInfos; // load default scene loadOs3DScene viewstr file; // start Doc server startMainDocServer; dsEdWindow winSplash; set winSplash = nil; //apply last setting let atoi (getConfigParamDef "OS3Dmain" "posx" "0") -> nx in let atoi (getConfigParamDef "OS3Dmain" "posy" "0") -> ny in let atoi (getConfigParamDef "OS3Dmain" "width" "1024") -> nw in let atoi (getConfigParamDef "OS3Dmain" "height" "768") -> nh in let atoi (getConfigParamDef "OS3Dmain" "sepv" "280") -> xpos in let atoi (getConfigParamDef "OS3Dmain" "seph" "600") -> ypos in let atoi (getConfigParamDef "OS3Dmain" "seph2" "900") -> y2pos in let if (xpos < 0) then 280 else xpos -> xpos in let if (ypos < 0) then 600 else ypos -> ypos in let if (y2pos < 0) then 900 else y2pos -> y2pos in ( setEdWindowPosSize mainWindow nx ny nw nh; //test if we have to maximize window let getEdWindowExPosSize mainWindow -> [mx my mw mh] in if mw >= sw && mh >= sh then _SHOWwindow mainWindow.EDW_win WINDOW_MAXIMIZED else _SHOWwindow mainWindow.EDW_win WINDOW_UNHIDDEN; if xpos == nil || ypos == nil || y2pos == nil then nil else let mainInterf.MINT_winInfos -> [winfostr _ _ _] in let mainInterf.MINT_winView -> [wviewstr _] in let mainInterf.MINT_winPlugins -> [pviewstr _] in let mainInterf.MINT_winLogs -> [winlogs _ _] in let mainInterf.MINT_winHBorder -> hborder in let mainInterf.MINT_winHBorder2 -> h2border in let mainInterf.MINT_winVBorder -> vborder in let _GETwindowPositionSize mainInterf.MINT_winMain.EDW_win -> [_ _ mw mh] in ( let _GETwindowPositionSize winfostr.EDW_win -> [ix iy iw ih] in let _GETwindowPositionSize wviewstr.EDW_win -> [vx vy vw vh] in let _GETwindowPositionSize pviewstr.EDW_win -> [px py pw ph] in let _GETwindowPositionSize winlogs.EDW_win -> [lx ly lw lh] in let _GETwindowPositionSize hborder.EDW_win -> [hx hy hw hh] in let _GETwindowPositionSize h2border.EDW_win -> [h2x h2y h2w h2h] in let _GETwindowPositionSize vborder.EDW_win -> [wx wy ww wh] in ( if (ypos >= mh) then nil else ( setEdWindowPosSize hborder hx ypos hw hh; setEdWindowPosSize vborder xpos wy ww ypos-wy; setEdWindowPosSize winfostr ix iy ix+xpos ypos-iy; setEdWindowPosSize wviewstr xpos+ww vy mw-xpos-ww ypos-vy; setEdWindowPosSize pviewstr px ypos+hh pw y2pos-(ypos+hh); if (y2pos >= mh) then nil else ( setEdWindowPosSize h2border h2x y2pos h2w h2h; setEdWindowPosSize winlogs lx y2pos+h2h lw mh-y2pos-h2h; ); ); ); ); setEdWindowTopMost mainWindow; ); ); 0;; // UPDATE /** cbGetUpgrade [MessageBox [S S] I] I * open dl url * * return 0 **/ fun cbGetUpgrade(msgbox, url, state)= if (((strlen url) <= 4) || (state == 0)) then ( 0; ) else ( _openbrowserhttp url; _rfltimer _starttimer _channel 1000 @cbCloseTimer nil; 0; ); 0;; /** CheckReferenceVersion [[S r1]] I * test the current openspace3d version * * return 0 **/ fun CheckReferenceOs3dVersion(l) = let hd l -> keyword in let hd tl l -> response in ( _fooS strcat ">>>>>>>>> current version : " getVersionS; if (!strcmp "#OS3DVER#" keyword) then ( if (!strcmp response "nil") then ( _fooS ">>>>>>>>>> Local version is up to date !"; 0; ) else ( _fooS ">>>>>>>>>> New version available !"; _DLGrflmessage _DLGMessageBox _channel mainInterf.MINT_winMain.EDW_win "Update version" "A new version of OpenSpace3D Editor is available, do you want to download it now ?" 2 @cbGetUpgrade (hd tl l); 0; ); 0; ) else ( _fooS ">>>>>>>>> Recovering Openspace3d Reference Version from Internet - Bad file content !"; 0; ); ); 0;; /** cbGotCurrentVer [CURLOBJ [S S] S I] I * test the current openspace3d version * * return 0 **/ fun cbGotCurrentOs3dVer(curlobj, p, data, code) = let p -> [str url] in if (code == -1) then ( mutate p <- [(strcat str data) _]; 0; ) // download finished else if (code == 0) then ( CheckReferenceOs3dVersion lineextr str; 0; ) else ( _fooS strcatn ">>>>>>>>> Recovering Openspace3d Reference Version from Internet failed! from "::url::" with code : "::(itoa code)::nil; 0; ); 0;; /** cbGetCurrentVer [S S I] I * test the current openspace3d version * * return 0 **/ fun cbGetCurrentOs3dVer(url, p, rc) = if (!rc) then 0 else // Active Internet Connection detected ( let strcat "v=" getVersionS -> params in let _CRcurlRequest _channel sUpdateUrl -> objcurl in ( _SETcurlOption objcurl CURLOPT_HEADER 0; _SETcurlOption objcurl CURLOPT_FOLLOWLOCATION 1; _SETcurlOption objcurl CURLOPT_SSL_VERIFYPEER 0; _SETcurlOption objcurl CURLOPT_CONNECTTIMEOUT 5; if ((params == nil) || (!strcmp (strtrim params) "")) then nil else ( _SETcurlOption objcurl CURLOPT_HTTPGET 1; _SETcurlOptionS objcurl CURLOPT_POSTFIELDS params; ); _fooS ">>>>>>>>> Recovering OpenSpace3D Reference Version from Internet"; _CALLcurlRequest objcurl @cbGotCurrentOs3dVer ["" sUpdateUrl]; ); 0; ); 0;; /** initOs3dEditor [S] I * initialize the application * * return 0 **/ fun initOs3dEditor(file) = InitMainChannel; InitDefaultGlobalVar; //reset log file _storepack strcatn (strcat (loc "OS3D_0286") " ")::getVersionName::" ("::getVersionDate::")"::"\n"::nil strcat APPBASEDIR sLogFile; // init keyboards definition KEYBloadMaps; // Temporary hack since project is not yet managed in Editor set currentProject = crProject nil nil 1 ""; // set plugins to editor mode set iPluginMode = 1; // set lib 2D default res path set sG2DDEFAULTRESOURCESPATH = strcat APPBASEDIR "os3dlib/res/"; set sV3DDEFAULTRESOURCESPATH = strcat APPBASEDIR "os3dlib/res/"; set sKEYBDEFAULTRESOURCESPATH = strcat APPBASEDIR "os3dlib/res/def/"; set sTreeBitmapScene = strcat APPBASEDIR sTreeBitmapScene; set sTreeBitmapGroup = strcat APPBASEDIR sTreeBitmapGroup; set sTreeBitmapNode = strcat APPBASEDIR sTreeBitmapNode; set sTreeBitmapLight = strcat APPBASEDIR sTreeBitmapLight; set sTreeBitmapCamera = strcat APPBASEDIR sTreeBitmapCamera; set sTreeBitmapEntity = strcat APPBASEDIR sTreeBitmapEntity; set sTreeBitmapSky = strcat APPBASEDIR sTreeBitmapSky; set sTreeBitmapAnim = strcat APPBASEDIR sTreeBitmapAnim; set sTreeBitmapCompositor = strcat APPBASEDIR sTreeBitmapCompositor; set sTreeBitmapBone = strcat APPBASEDIR sTreeBitmapBone; set sTreeBitmapParticle = strcat APPBASEDIR sTreeBitmapParticle; set sTreeBitmapCubeMap = strcat APPBASEDIR sTreeBitmapCubeMap; set sTreeBitmapReflectionMap = strcat APPBASEDIR sTreeBitmapReflectionMap; set sTreeBitmapHidden = strcat APPBASEDIR sTreeBitmapHidden; set sTreeBitmapSceneCheck = strcat APPBASEDIR sTreeBitmapSceneCheck; set sTreeBitmapGroupCheck = strcat APPBASEDIR sTreeBitmapGroupCheck; set sTreeBitmapNodeCheck = strcat APPBASEDIR sTreeBitmapNodeCheck; set sTreeBitmapLightCheck = strcat APPBASEDIR sTreeBitmapLightCheck; set sTreeBitmapCameraCheck = strcat APPBASEDIR sTreeBitmapCameraCheck; set sTreeBitmapEntityCheck = strcat APPBASEDIR sTreeBitmapEntityCheck; set sTreeBitmapSkyCheck = strcat APPBASEDIR sTreeBitmapSkyCheck; set sTreeBitmapAnimCheck = strcat APPBASEDIR sTreeBitmapAnimCheck; set sTreeBitmapCompositorCheck = strcat APPBASEDIR sTreeBitmapCompositorCheck; set sTreeBitmapBoneCheck = strcat APPBASEDIR sTreeBitmapBoneCheck; set sTreeBitmapParticleCheck = strcat APPBASEDIR sTreeBitmapParticleCheck; set sTreeBitmapCubeMapCheck = strcat APPBASEDIR sTreeBitmapCubeMapCheck; set sTreeBitmapReflectionMapCheck = strcat APPBASEDIR sTreeBitmapReflectionMapCheck; set sWinMainIcon = strcat APPBASEDIR sWinMainIcon; set sWinDlgIcon = strcat APPBASEDIR sWinDlgIcon; set sWinPlayerMainIcon = strcat APPBASEDIR sWinPlayerMainIcon; set sPLUGINSPATH = strcat APPBASEDIR sPLUGINSPATH; //init theme resources set EdDefaultTheme = makeEdThemeResources _channel; // load config file set xmlConfigFile = XMLload strcat APPBASEDIR sConfigFile; //define current interfaces colors //loadColorTheme; //Splash let _GETdesktopSize -> [sw sh] in let [500 346] -> [iw ih] in ( set winSplash = setEdWindowIcon (crEdWindow _channel nil ((sw / 2) - (iw / 2)) ((sh / 2) - (ih / 2)) iw ih WN_NOBORDER|WN_NOCAPTION nil nil (strcatn (strcat (loc "OS3D_0286") " ")::getVersionName::nil)) sWinMainIcon; let if (!strcmpi currentLanguage "french") then "fr" else "en" -> splashver in let crEdCtrlBitmap winSplash 0 20 iw 306 strcat APPBASEDIR strcatn "os3deditor/res/splash_"::splashver::".png"::nil EdDefaultTheme.EDT_iMainBackgroundColor nil -> bmpstr in let crEdWindowToolBar winSplash 0 0 iw 20 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbtopstr in let crEdToolBarText tbtopstr strcatn (strcat (loc "OS3D_0286") " ")::getVersionName::" - "::getVersionDate::nil "Arial" 9 FF_PIXEL|FF_WEIGHT 0xffffff nil ETB_ALIGN_RIGHT -> verstr in let crEdWindowToolBar winSplash 0 (ih - 20) iw 20 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let crEdToolBarText tbstr (loc "OS3D_0226") "Arial" 9 FF_PIXEL|FF_WEIGHT 0xffffff nil ETB_ALIGN_LEFT -> textstr in ( //setEdWindowTopMost winSplash; paintEdCtrlBitmap bmpstr; paintEdToolBar tbtopstr; paintEdToolBar tbstr; //_PAINTwindow winSplash.EDW_win; set cbPluginLoadInfo = mkfun2 @cbSplashText [tbstr textstr tbtopstr bmpstr]; ); ); // init default global network callbacks set netcomOS3D = netCreateMinimum; netSetCbConnected netcomOS3D @cbPlugNetConnected; netSetCbSConnected netcomOS3D @cbPlugNetSConnected; netSetCbClosed netcomOS3D @cbPlugNetClosed; netSetCbSrvMessage netcomOS3D @cbPlugNetSrvMessage; netSetCbUserMessage netcomOS3D @cbPlugNetUserMessage; netSetCbUserPrivateMessage netcomOS3D @cbPlugNetUserPrivateMessage; netSetCbUserChangeLogin netcomOS3D @cbPlugUserChangeLogin; netSetCbNewUser netcomOS3D @cbPlugNewUser; netSetCbDelUser netcomOS3D @cbPlugDelUser; netSetCbGetFile netcomOS3D @cbPlugGetFile; netSetCbUserGetItem netcomOS3D @cbPlugUserGetItem; netSetCbRoomGetItem netcomOS3D @cbPlugRoomGetItem; netSetCbNbUsers netcomOS3D @cbPlugNbUsers; netSetCbRoomChanged netcomOS3D @cbPlugRoomChanged; set mainInterf = mkMainInterface [nil nil nil nil nil nil nil nil nil nil nil nil nil nil]; let _GETdesktopSize -> [sw sh] in let 3 -> border in let 36 -> hbar in let 28 -> hlog in let 240 -> hplug in let [280 (iWinH - hbar - hlog - hplug -(border*2))] -> [iw ih] in let [(iWinW - (iw + border)) (iWinH - hbar - hlog -hplug - (border*2))] -> [vw vh] in ( let setEdWindowIcon (crEdMainWindow _channel nil ((sw / 2) - (iWinW / 2)) ((sh / 2) - (iWinH / 2)) iWinW iWinH WN_HIDDEN|WN_NORMAL strcatn (strcat (loc "OS3D_0286") " ")::getVersionName::nil) sWinMainIcon -> winmainstr in let crEdWindowToolBar winmainstr 0 0 iWinW (hbar - border) 5 4 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> maintbstr in let setEdWindowIcon crEdWindow _channel winmainstr 0 hbar iw ih WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MH|EDWIN_RESIZE_RW nil "" sWinDlgIcon -> infowinstr in let setEdWindowIcon crEdWindow _channel winmainstr (iw + border) hbar vw vh WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW|EDWIN_RESIZE_MH nil "" sWinDlgIcon -> viewwinstr in let setEdWindowIcon crEdWindow _channel winmainstr 0 (hbar + ih + border) iWinW hplug WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW|EDWIN_RESIZE_LH nil "" sWinDlgIcon -> plugswinstr in let setEdWindowIcon crEdWindow _channel winmainstr 0 (hbar + ih + hplug + (border*2)) iWinW hlog WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW|EDWIN_RESIZE_LH nil "" sWinDlgIcon -> logwinstr in let crEdWindow _channel winmainstr iw hbar border ih WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MH|EDWIN_RESIZE_RW nil "" -> vborder in let crEdWindow _channel winmainstr 0 ih+hbar iWinW border WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW|EDWIN_RESIZE_LH nil "" -> hborder in let crEdWindow _channel winmainstr 0 (hbar + ih + hplug + border) iWinW border WN_CHILDINSIDE|WN_NOBORDER EDWIN_RESIZE_MW|EDWIN_RESIZE_LH nil "" -> h2border in let crEdCtrl3D viewwinstr 0 28 vw (vh-28) EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> ctrl3dviewstr in let getEdCtrlView3d ctrl3dviewstr -> viewstr in let V3DgetDefaultSession viewstr -> sessionstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_hseparator.png" -> asep in ( setEdCtrl3DdestroyCb ctrl3dviewstr @cbDestroyView3d; set mainWindow = winmainstr; set mainInterf.MINT_winMain = winmainstr; set mainInterf.MINT_winBig = viewwinstr; set mainInterf.MINT_winVBorder = vborder; set mainInterf.MINT_winHBorder = hborder; set mainInterf.MINT_winHBorder2 = h2border; _SETwinCursor vborder.EDW_win EdDefaultTheme.EDT_cursorWSize; _SETwinCursor hborder.EDW_win EdDefaultTheme.EDT_cursorHSize; _SETwinCursor h2border.EDW_win EdDefaultTheme.EDT_cursorHSize; setEdwindowCbCursorMove vborder @cbvborderMouseMove; setEdwindowCbCursorMove hborder @cbHBorderMouseMove; setEdwindowCbCursorMove h2border @cbHBorderMouseMove2; setEdWindowMinimumSize winmainstr 800 400; // create default config file if xmlConfigFile != nil then nil else ( set xmlConfigFile = XMLcreate nil nil; let XMLaddMark xmlConfigFile "config" nil ["author" "OpenSpace3D editor configuration file"]::["language" currentLanguage]::nil nil -> confmark in let XMLaddMark xmlConfigFile "OS3Dmain" confmark nil nil -> confmainmark in let XMLaddMark xmlConfigFile "OS3Duser" confmark nil nil -> confusermark in let _GETwindowPositionSize vborder.EDW_win -> [vx _ _ _] in let _GETwindowPositionSize hborder.EDW_win -> [_ hy _ _] in let _GETwindowPositionSize h2border.EDW_win -> [_ h2y _ _] in ( XMLaddMark xmlConfigFile "width" confmainmark ["value" (itoa iWinW)]::nil nil; XMLaddMark xmlConfigFile "height" confmainmark ["value" (itoa iWinH)]::nil nil; XMLaddMark xmlConfigFile "posx" confmainmark ["value" (itoa ((sw / 2) - (iWinW / 2)))]::nil nil; XMLaddMark xmlConfigFile "posy" confmainmark ["value" (itoa ((sh / 2) - (iWinH / 2)))]::nil nil; XMLaddMark xmlConfigFile "sepv" confmainmark ["value" (itoa vx)]::nil nil; XMLaddMark xmlConfigFile "seph" confmainmark ["value" (itoa hy)]::nil nil; XMLaddMark xmlConfigFile "seph2" confmainmark ["value" (itoa h2y)]::nil nil; XMLaddMark xmlConfigFile "bShowGrid" confusermark ["value" (itoa bShowGrid)]::nil nil; XMLaddMark xmlConfigFile "bShowHelpers" confusermark ["value" (itoa bShowHelpers)]::nil nil; XMLaddMark xmlConfigFile "bShowInfos" confusermark ["value" (itoa bShowInfos)]::nil nil; XMLaddMark xmlConfigFile "bAutoFit" confusermark ["value" (itoa bAutoFit)]::nil nil; XMLaddMark xmlConfigFile "bWireMode" confusermark ["value" (itoa bShowWireMode)]::nil nil; ); ); // init config vars let atoi (getConfigParam "OS3Duser" "bShowGrid") -> bmode in set bShowGrid = if bmode == nil then bShowHelpers else bmode; let atoi (getConfigParam "OS3Duser" "bShowHelpers") -> bmode in set bShowHelpers = if bmode == nil then bShowHelpers else bmode; let atoi (getConfigParam "OS3Duser" "bShowInfos") -> bmode in set bShowInfos = if bmode == nil then bShowInfos else bmode; let atoi (getConfigParam "OS3Duser" "bAutoFit") -> bmode in set bAutoFit = if bmode == nil then bAutoFit else bmode; let atoi (getConfigParam "OS3Duser" "bWireMode") -> bmode in set bShowWireMode = if bmode == nil then bShowWireMode else bmode; set s3dMainSession = sessionstr; set v3dMain = viewstr; setEdwindowCbDestroy mainWindow @cbWinMainDestroy; setEdwindowCbClose mainWindow @cbWinMainClose; setEdwindowCbSize mainWindow @cbWinMainSize; V3DsetCbScenePreRender sessionstr @cbScenePreRender; V3DsetCbScenePreRender2 sessionstr @cbScenePreRender2; V3DsetCbScenePreRenderPhysic sessionstr @cbScenePreRenderPhysic; V3DsetCbScenePostRender sessionstr @cbScenePostRender; V3DsetCbNavigateControlState sessionstr @cbNavigateControlState; V3DsetCbClick viewstr @cbView3dClick; V3DsetCbUnClick viewstr @cbView3dUnClick; V3DsetCbKeyDown viewstr @cbView3dKeyDown; V3DsetCbKeyUp viewstr @cbView3dKeyUp; V3DsetCbPreRender viewstr @cbView3dPreRender; V3DsetCbPreRender2 viewstr @cbView3dPreRender2; V3DsetCbPostRender viewstr @cbView3dPostRender; V3DsetCbCursorMove viewstr @cbView3dCursorMove; V3DsetCbDbClick viewstr @cbView3dDbClick; V3DsetCbWheel viewstr @cbView3dWheel; V3DsetCbInputClick viewstr @cbView3dInputClick; V3DsetCbInputUnClick viewstr @cbView3dInputUnClick; V3DsetCbInputUpdate viewstr @cbView3dInputUpdate; V3DsetCbCameraChange viewstr @cbView3dCameraChange; V3DsetCbResizeView viewstr @cbView3dResize; V3DsetCbDropFile viewstr @cbView3dDropFile; V3DsetCbFocusView viewstr @cbPlugView3dFocus; V3DsetCbKillFocusView viewstr @cbPlugView3dKillFocus; V3DsetCbVrModeChanged viewstr @cbPlugViewVrMode; V3DsetCbCameraTeleport viewstr @cbPlugCameraTeleport; //multi touch V3DsetViewTouchPointAddCb viewstr @cbPlugView3dTouchPointAdd; V3DsetViewTouchPointRemoveCb viewstr @cbPlugView3dTouchPointRemove; V3DsetViewTouchPointUpdateCb viewstr @cbPlugView3dTouchPointUpdate; // Main toolbar let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopnew.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_LEFT (loc "OS3D_0260") mkfun5 @cbTbBtnReset viewstr -> tbnew in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopopen.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_LEFT (loc "OS3D_0284") mkfun5 @cbTbBtnOpenScene viewstr -> tbopen in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopsave.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_LEFT (loc "OS3D_0351") mkfun5 @cbTbBtnSaveOsScene viewstr -> tbsave in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopsaveas.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_LEFT (loc "OS3D_0352") mkfun5 @cbTbBtnSaveAsOsScene viewstr -> tbsaveas in let crEdToolBarBitmap maintbstr asep ETB_ALIGN_LEFT nil nil -> tbsep in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopimport.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_LEFT (loc "OS3D_0194") mkfun5 @cbTbBtnImportScene viewstr -> tbimport in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopsetup.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_LEFT (loc "OS3D_0314") mkfun5 @cbTbBtnProjectSetting viewstr -> tbprjsetting in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnoptheme.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_LEFT (loc "OS3D_0684") mkfun5 @cbTbBtnThemeEditor viewstr -> tbthemeeditor in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopgo.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_LEFT (loc "OS3D_0157") mkfun5 @cbTbBtnExportToPlayer viewstr -> tbexport in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopplayer.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_LEFT (loc "OS3D_0217") mkfun5 @cbTbBtnLaunchPlayer viewstr -> tbplayer in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopabout.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_RIGHT (loc "OS3D_0017") mkfun5 @cbTbBtnAbout viewstr -> tbabout in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnophelp.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_RIGHT (loc "OS3D_0283") mkfun5 @cbTbBtnHelp viewstr -> tbhelp in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopconf.png" -> apng in let crEdToolBarButton maintbstr apng ETB_ALIGN_RIGHT (loc "OS3D_0551") mkfun5 @cbTbBtnPref viewstr -> tbpref in ( //_CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode tbplayer OBJ_DISABLE|OBJ_VISIBLE 1; //_CHANGEobjNodeFlags _CONVERTcompRollOverToObjNode tbexport OBJ_DISABLE|OBJ_VISIBLE 1; set mainInterf.MINT_tbMain = [tbnew tbopen tbimport tbsave tbsaveas tbprjsetting tbthemeeditor tbexport tbplayer tbpref tbabout tbhelp]; ); /* let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/btnopsetup.png" -> apng in crEdToolBarButton maintbstr apng ETB_ALIGN_LEFT (loc "OS3D_0383") mkfun5 @cbTbBtnSetup viewstr; */ paintEdToolBar maintbstr; let crEdWindowToolBar infowinstr 0 0 iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let crEdTabBarFromToolBar tbstr infowinstr 0 10 (iw - 30) 20 10 nil -> tabbarstr in let crEdTab tabbarstr (loc "OS3D_0359") nil 1 -> tabstr1 in let crEdTab tabbarstr (loc "OS3D_0594") nil 0 -> tabstr2 in let crEdTab tabbarstr (loc "OS3D_0180") nil 0 -> tabstr3 in let crEdTab tabbarstr (loc "OS3D_0179") nil 0 -> tabstr4 in let crEdTab tabbarstr (loc "OS3D_0341") nil 0 -> tabstr5 in let getEdTabWindow tabstr1 -> winstr1 in let getEdTabWindow tabstr2 -> winstr2 in let getEdTabWindow tabstr3 -> winstr3 in let getEdTabWindow tabstr4 -> winstr4 in let getEdTabWindow tabstr5 -> winstr5 in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/chkdetach.png" -> apng in let crEdToolBarCheck tbstr apng ETB_ALIGN_RIGHT (loc "OS3D_0825") mkfun6 @cbMinMaxWin infowinstr -> minmaxchk in let crEdCtrlButton winstr3 5 5 (iw - 10) 20 (loc "OS3D_0331") EDWIN_RESIZE_MW -> removebtn in let crEdWindowToolBar winstr1 0 0 iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> treetbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_search.png" -> afilter in let crEdToolBarButton treetbstr afilter ETB_ALIGN_LEFT (loc "OS3D_0821") @cbFilterTree -> tbfilter in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_assign_multi.png" -> amvmulti in let crEdToolBarButton treetbstr amvmulti ETB_ALIGN_LEFT (loc "OS3D_0823") @cbMoveMulti -> tbmvmulti in let crEdWindowToolBar winstr2 0 0 iw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> mattbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_mateditor.png" -> amedit in let crEdToolBarButton mattbstr amedit ETB_ALIGN_LEFT (loc "OS3D_0621") @cbTbBtnEditMaterial -> btneditmat in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_matadd.png" -> amadd in let crEdToolBarButton mattbstr amadd ETB_ALIGN_LEFT (loc "OS3D_0622") @cbTbBtnAddMaterial -> btnaddmat in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_matdel.png" -> amdel in let crEdToolBarButton mattbstr amdel ETB_ALIGN_LEFT (loc "OS3D_0623") @cbTbBtnDelMaterial -> btndelmat in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_matassign.png" -> amassign in let crEdToolBarButton mattbstr amassign ETB_ALIGN_LEFT (loc "OS3D_0624") @cbTbBtnAssignMaterial -> btnassignmat in ( set ctrlSceneTree = crEdCtrlTree winstr1 5 30 (iw - 10) (ih - 65) EDWIN_RESIZE_MW|EDWIN_RESIZE_MH; set ctrlMaterialList = crEdCtrlList winstr2 5 30 (iw - 10) (ih - 65) LB_BORDER|LB_VSCROLL|ET_TABFOCUS EDWIN_RESIZE_MW|EDWIN_RESIZE_MH; set ctrlResourcesList = crEdCtrlList winstr3 5 30 (iw - 10) (ih - 65) LB_BORDER|LB_VSCROLL|ET_TABFOCUS|LB_MULTIPLE EDWIN_RESIZE_MW|EDWIN_RESIZE_MH; set ctrlMeshList = crEdCtrlList winstr4 5 5 (iw - 10) (ih - 40) LB_NOSELECTION|LB_BORDER|LB_VSCROLL|ET_TABFOCUS EDWIN_RESIZE_MW|EDWIN_RESIZE_MH; set ctrlResourcesDirList = crEdCtrlList winstr5 5 40 (iw - 10) (ih - 75) LB_NOSELECTION|LB_BORDER|LB_VSCROLL|ET_TABFOCUS EDWIN_RESIZE_MW|EDWIN_RESIZE_MH; setEdTabCbFocused tabstr1 mkfun2 @cbSceneTreeTabFocused ctrlSceneTree; setEdTabCbFocused tabstr2 mkfun2 @cbMaterialsTabFocused ctrlMaterialList; setEdTabCbFocused tabstr3 mkfun2 @cbResourcesTabFocused ctrlResourcesList; setEdTabCbFocused tabstr4 mkfun2 @cbMeshesTabFocused ctrlMeshList; setEdTabCbFocused tabstr5 mkfun2 @cbRessourcesTabFocused ctrlResourcesDirList; setEdCtrlButtonCb removebtn mkfun2 @cbRemoveResource sessionstr; setEdCtrlTreeCbSelect ctrlSceneTree mkfun6 @cbSceneTreeSelect viewstr; setEdCtrlTreeCbClick ctrlSceneTree mkfun8 @cbSceneTreeClick viewstr; setEdCtrlTreeCbKeyDown ctrlSceneTree mkfun8 @cbSceneTreeKeyDown viewstr; setEdCtrlTreeCbKeyUp ctrlSceneTree mkfun7 @cbSceneTreeKeyUp viewstr; setEdCtrlTreeCbDrag ctrlSceneTree mkfun4 @cbSceneTreeDrag viewstr; setEdCtrlButtonCb (crEdCtrlButton winstr5 ((iw / 2) - 100) 10 200 20 (loc "OS3D_0031") EDWIN_RESIZE_MW) mkfun2 @cbBtnAddResourcesDir viewstr; set mainInterf.MINT_winInfos = [infowinstr [tbstr minmaxchk] [treetbstr tbfilter tbmvmulti] [mattbstr btneditmat btnaddmat btndelmat btnassignmat]]; paintEdToolBar tbstr; ); // 3d let crEdWindowToolBar viewwinstr 0 0 vw 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/chkminmax.png" -> apng in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_select.png" -> aselect in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_move.png" -> amove in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_rotate.png" -> arotate in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_scale.png" -> ascale in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_coords.png" -> acoords in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_undo.png" -> aundo in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_redo.png" -> aredo in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_navigate.png" -> anavigate in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_playstop.png" -> aplaystop in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_grid.png" -> agrid in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_helpers.png" -> ahelpers in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_wiremode.png" -> awiremode in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_infos.png" -> ainfos in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_fit.png" -> afit in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_top.png" -> atop in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_front.png" -> afront in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_left.png" -> aleft in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_pers.png" -> apers in let crEdToolBarCheck tbstr aplaystop ETB_ALIGN_LEFT (loc "OS3D_0304") nil -> chkplaystop in let crEdToolBarBitmap tbstr asep ETB_ALIGN_LEFT nil nil -> hsep in let crEdToolBarCheck tbstr aselect ETB_ALIGN_LEFT (loc "OS3D_0362") nil -> chkselect in let crEdToolBarCheck tbstr amove ETB_ALIGN_LEFT (loc "OS3D_0254") nil -> chkmove in let crEdToolBarCheck tbstr arotate ETB_ALIGN_LEFT (loc "OS3D_0345") nil -> chkrotate in let crEdToolBarCheck tbstr ascale ETB_ALIGN_LEFT (loc "OS3D_0354") nil -> chkscale in let crEdToolBarCheck tbstr acoords ETB_ALIGN_LEFT (loc "OS3D_0673") nil -> chkcoords in let crEdToolBarBitmap tbstr asep ETB_ALIGN_LEFT nil nil -> hsep in let crEdToolBarButton tbstr aundo ETB_ALIGN_LEFT (loc "OS3D_0436") mkfun5 @cbViewUndo viewstr -> btnundo in let crEdToolBarButton tbstr aredo ETB_ALIGN_LEFT (loc "OS3D_0319") mkfun5 @cbViewRedo viewstr -> btnredo in let crEdToolBarBitmap tbstr asep ETB_ALIGN_LEFT nil nil -> hsep in let crEdToolBarCheck tbstr agrid ETB_ALIGN_LEFT (loc "OS3D_0390") nil -> chkgrid in let crEdToolBarCheck tbstr ahelpers ETB_ALIGN_LEFT (loc "OS3D_0391") nil -> chkhelpers in let crEdToolBarCheck tbstr awiremode ETB_ALIGN_LEFT (loc "OS3D_0466") nil -> chkwiremode in let crEdToolBarCheck tbstr ainfos ETB_ALIGN_LEFT (loc "OS3D_0389") nil -> chkinfos in let crEdToolBarButton tbstr afit ETB_ALIGN_LEFT (loc "OS3D_0571") mkfun5 @cbFitSelection viewstr -> btnfit in let crEdToolBarBitmap tbstr asep ETB_ALIGN_LEFT nil nil -> hsep in let crEdToolBarButton tbstr atop ETB_ALIGN_LEFT (loc "OS3D_0433") mkfun5 @cbViewModeTop viewstr -> chktop in let crEdToolBarButton tbstr afront ETB_ALIGN_LEFT (loc "OS3D_0172") mkfun5 @cbViewModeFront viewstr -> chkfront in let crEdToolBarButton tbstr aleft ETB_ALIGN_LEFT (loc "OS3D_0219") mkfun5 @cbViewModeLeft viewstr -> chkleft in let crEdToolBarButton tbstr apers ETB_ALIGN_LEFT (loc "OS3D_0294") mkfun5 @cbViewModePers viewstr -> chkpers in let crEdToolBarBitmap tbstr asep ETB_ALIGN_LEFT nil nil -> hsep in let crEdToolBarCheck tbstr anavigate ETB_ALIGN_LEFT (loc "OS3D_0258") nil -> chknavigate in let crEdToolBarCheck tbstr apng ETB_ALIGN_RIGHT (loc "OS3D_0245") mkfun6 @cbMinMaxViewWin viewwinstr -> minmaxchk1 in ( setEdToolBarVisible tbstr 1; setEdToolBarCheckState tbstr chkselect 1; setEdToolBarCheckState tbstr chkgrid bShowGrid; setEdToolBarCheckState tbstr chkhelpers bShowHelpers; setEdToolBarCheckState tbstr chkinfos bShowInfos; setEdToolBarCheckState tbstr chkwiremode bShowWireMode; setEdToolBarCheckCbClick tbstr chkselect mkfun6 @cbChangeEditMode [viewstr [chkselect chkmove chkrotate chkscale]]; setEdToolBarCheckCbClick tbstr chkmove mkfun6 @cbChangeEditMode [viewstr [chkselect chkmove chkrotate chkscale]]; setEdToolBarCheckCbClick tbstr chkrotate mkfun6 @cbChangeEditMode [viewstr [chkselect chkmove chkrotate chkscale]]; setEdToolBarCheckCbClick tbstr chkscale mkfun6 @cbChangeEditMode [viewstr [chkselect chkmove chkrotate chkscale]]; setEdToolBarCheckCbClick tbstr chkcoords mkfun6 @cbChangeCoordsMode viewstr; setEdToolBarCheckCbClick tbstr chknavigate mkfun6 @cbChangeNavigateMode viewstr; setEdToolBarCheckCbClick tbstr chkplaystop mkfun6 @cbChangePlayStop viewstr; setEdToolBarCheckCbClick tbstr chkgrid mkfun6 @cbChangeShowGrid viewstr; setEdToolBarCheckCbClick tbstr chkhelpers mkfun6 @cbChangeShowHelpers viewstr; setEdToolBarCheckCbClick tbstr chkwiremode mkfun6 @cbChangeWireMode viewstr; setEdToolBarCheckCbClick tbstr chkinfos mkfun6 @cbChangeShowInfos viewstr; set mainInterf.MINT_winView = [viewwinstr [tbstr minmaxchk1 chkplaystop chkselect chkmove chkrotate chkscale chkcoords btnundo btnredo chknavigate chkgrid chkhelpers chkinfos btnfit chkwiremode chktop chkfront chkleft chkpers]]; paintEdToolBar tbstr; ); // plugins let crEdWindowToolBar plugswinstr 0 0 iWinW 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/chkdetach.png" -> apng in let crEdTabBarFromToolBar tbstr plugswinstr 0 10 (iWinW - 95) 20 10 nil -> tabbarstr in let crEdToolBarCheck tbstr apng ETB_ALIGN_RIGHT (loc "OS3D_0825") mkfun6 @cbMinMaxWinPlugs plugswinstr -> minmaxchk1 in /*let crEdToolBarBitmap tbstr asep ETB_ALIGN_RIGHT nil nil -> hsep in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_zoomin.png" -> azoomin in let crEdToolBarButton tbstr azoomin ETB_ALIGN_RIGHT (loc "OS3D_0473") nil -> chkzoomin in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_zoomout.png" -> azoomout in let crEdToolBarButton tbstr azoomout ETB_ALIGN_RIGHT (loc "OS3D_0474") nil -> chkzoomout in*/ ( setEdToolBarVisible tbstr 1; makeGroupPluginsTab plugswinstr tabbarstr (loc "OS3D_0184") viewstr; set mainInterf.MINT_winPlugins = [plugswinstr [tbstr tabbarstr minmaxchk1]]; paintEdToolBar tbstr; ); // logs let crEdWindowToolBar logwinstr 0 0 iWinW 28 5 1 EdDefaultTheme.EDT_iToolBarColor ETB_HORIZONTAL -> tbstr in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_log.png" -> logpng in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/tb_clslog.png" -> clslogpng in let _LDalphaBitmap _channel _checkpack strcat APPBASEDIR "os3deditor/res/chkdetach.png" -> apng in let crEdToolBarCheck tbstr apng ETB_ALIGN_RIGHT (loc "OS3D_0825") mkfun6 @cbMinMaxWinLogs logwinstr -> minmaxchk1 in let crEdToolBarCheck tbstr logpng ETB_ALIGN_RIGHT (loc "OS3D_0134") mkfun6 @cbEnablePlugitLog plugswinstr -> pluglogchk1 in let crEdToolBarButton tbstr clslogpng ETB_ALIGN_RIGHT (loc "OS3D_0092") mkfun5 @cbClearLog plugswinstr -> clearlogbtn in let crEdToolBarText tbstr (loc "OS3D_0234") "Arial" 9 FF_PIXEL|FF_WEIGHT 0xffffff nil ETB_ALIGN_LEFT -> lastlog in let crEdCtrlText logwinstr 5 5+28 (iWinW - 10) (hlog - 12 - 28) nil ET_VSCROLL|ET_AHSCROLL|ET_BORDER EDWIN_RESIZE_MW|EDWIN_RESIZE_MH -> logtext in ( setEdwindowCbKeyDown logwinstr @cbLogKeyDown; set mainInterf.MINT_winLogs = [logwinstr [tbstr minmaxchk1 lastlog] logtext]; paintEdToolBar tbstr; ); set DMSerror = @cbDmsLogs; V3DaddViewport viewstr 0.0 0.0 1.0 1.0 0x0; // load plugins files loadPluginsAsync sPLUGINSPATH mkfun1 @cbPluginsLoaded [viewstr sessionstr file]; checkInternetConnection nil @cbGetCurrentOs3dVer nil; ); ); 0;;