Entraides et échanges autour de la technologie Scol - Informations and exchanges on the Scol technology
Vous pouvez changer la langue de l'interface une fois inscrit - You can change the language once registered
You are not logged in.
colleagues:
what would be necessary for getting the vm to load and save a plugit (or interface created with the os3d library) that is not in the sPLUGINSPATH?
what I am thinking of doing is having a client and editor live in the player folder, for the user to set player configuration options that could be saved to an .xos file between sessions of using the player. i.e. to affect player behavior according to benchmark, shader level, fps, max .pak size, etc.
the .xos could be loaded at startup, the fields of the .xos read into global variables in the player, and then unloaded before a scene is loaded or downloaded.
perhaps there is an easier way to do this, but it seems like a matter of a bit of code transplantation and adaption.
-h
Last edited by hebdemnobad (28-Oct-2014 17:33:04)
Offline
0
hmm not sure to understand
You want to make an editor in the player ?
Yes, for example
1. player starts up
2.a button in player , if pressed, calls an editor window. This window configures the player's options. I'm mostly thinking of performance related things. Like, don't download a .pak if it's bigger than 20 megabytes, or unload a project if the fps goes below a certain framerate, or if the computer doesn't reach a benchmark. Check boxes, float fields, sliders, things like that. Then when the user closes the editor window, the values in the window are saved to an .xos file. The next time at startup, the player loads the values from the .xml file into the player's variables, and then unloads the .xos file prior to loading a local .xos or .pak from the net.
Offline
You could only create this setting window and save the values in a playerconfig.xml
no need of xos for that.
I see. Ok...I'm going to learn how to write to an .xml file when the editor window is destroyed.
Offline
you have this exact behavior in the OS3D editor code
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 cbWinMainDestroy(winstr)=
// save current config
let getEdWindowPosSize winstr -> [x y w h] 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
(
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;
setConfigParam "OS3Dmain" "seph" itoa hy;
setConfigParam "OS3Dmain" "seph2" itoa h2y;
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;
XMLwrite xmlConfigFile strcat APPBASEDIR sConfigFile;
_closemachine;
0;;
// 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"]::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;
Offline
thanks arkeon!
Offline