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:
using a recent example:
let "tools/os3dlib/tools.pkg"::"tools/os3dlib/xmlparser.pkg"::nil -> list_of_dependencies in
can the vm get the filesize of the .pkg files?
can the vm get the size in bytes of the .pkg's as they are being loaded with a do while loop?
can the vm get the size of other packages/components that are being loaded by the vm that are not loaded by a particular .pkg (I am thinking default .pkg's that are loaded by the vm and perhaps .dll files or whatever else the vm from the moment a person double clicks on a local .scol file.)
goal: to make a loading bar with a simple flash widget
Last edited by hebdemnobad (20-Oct-2014 16:15:41)
Offline
Offline
thx arkeon....is there a way to access .pkg and .dll and whatever other files are that are present in a given environment?
Offline
Offline
thx.....I'll look through the scol voyager directories to see how this is done.
Offline
For example, to get the list of loaded packages (for the current channel) :
fun getPackageNames(env)=
if env == nil then
nil
else
(_envfirstname env) :: getPackageNames _removepkg env;;fun main ()=
_showconsole;
_fooSList getPackageNames _envchannel _channel;
0;;
Offline
Maybe also it :
http://www.scolring.org/files/doc_html/ … cript.html
This is return the content of the *.scol file.
Offline
thx guys
Offline
Another example :
To remove the N last loaded packages in a given channel.
chn : a channel, like _channel (the current channel)
n : the number to remove
fun removeNLast (chn, n)=
if chn == nil then nil
else
let _envchannel chn -> env in
(
while n > 0 do
(
set env = _removepkg env;
if env != nil then
set n = n-1
else
set n = 0
);
_setenv chn env
);;
These packages are not released in memory. This is another example to work with the environment API.
See in http://www.scolring.org/files/doc_html/ … ement.html
Offline
I'll try this out. But as my brother (a university level computer science professor) told me over the weekend take little tiny steps.Right not I'm stuck and creating a toolbar color.
Offline
So first element in _removepkg is the last package loaded, correct?
Offline
I just realized that in the context of the os3d player, a widget will only display after all the dependency packages are loaded.....so for any loading bar displayed when the dependencies are loading will best use components that are present when the VM starts up.
Offline
pkg loads take very little time, usually a progress bar should be useful for 3D resources loading and file download
Offline
ok, I tried a couple of methods, and this one seems to be getting closer to my goal. it calls getPackageNames as long as
while (lfiles != nil) && (secureLoad hd lfiles) do
is not nil, and you can see addtext is being fired as each package is being loaded.
below is a video screen capture of the running of the modified os3d player. you will see that a scol window appears almost immediately, however there is something in the getPackageNames or os3dload that is not handling the environment variable correctly. I would think that every time that the
while (lfiles != nil) && (secureLoad hd lfiles) do
is run, an addtitional package has been added to the environment and the last loaded pacakage's name will change, but the window displays only the package hosting the function (os3dload.pkg).
a couple of more observations:
during the loading process, windows concludes that scol is 'not responding'...is this something I can avoid with scol code, or is it just the limitations of the vm at this point or my machine (i3 cpu 2.1ghz, 4gb ram)
once the packages are loaded, there is a bit of time between the appearance of the mainwindow and the appearance of the loading screen image.
a movie will explain it better I think:
http://www.ifam.net/mediaoctopus3d/pack … 3dload.avi
so there appear to be two periods of loading. the first is when the packages called by os3dload are loading, and the second is between the loading of the packages and the appearance of the os3d loading screen, indicating that os3d has called initOs3dPlayer
but first things first, which is to display the packages names as they are loaded, that's my present little problem
thx!
-h
Last edited by hebdemnobad (21-Oct-2014 16:29:03)
Offline
answer the previous post at your leisure, I think I figured out a way to find do a loading bar by getting the size of the packages in bytes and then incrementing the size of bytes already loaded each time without using the environment functions.
although I do wonder if there is a way around the unresponsive window problem by using scol (if not, such is life.)
while (lfiles != nil) && (secureLoad hd lfiles) do
Offline
in fact this is just windows is bad
in a while loop, the vm treat the code, and while this time the window messages are not managed. and then windows send a ping message to the application window, but at this time the window can't just respond to the ping message (we are in a loop).
I think a little hack in the loading loop could avoid this, maybe by forcing the window to treat messages by sending a change on it like a paint ?! I'm not sure.
This is a strange way how windows works but yes it's life
Offline
in fact this is just windows is bad
in a while loop, the vm treat the code, and while this time the window messages are not managed. and then windows send a ping message to the application window, but at this time the window can't just respond to the ping message (we are in a loop).I think a little hack in the loading loop could avoid this, maybe by forcing the window to treat messages by sending a change on it like a paint ?! I'm not sure.
This is a strange way how windows works but yes it's life
as we say in the u.s. " it is what it is"
Offline
You may write a recursive function instead of a while loop.
For a working progress bar, i already wrote in Scol an API for that, It is on the svn.
For the only os3dload.pkg name displayed, are you make a changement in the code ?
Offline
I think the simplest way to get to the loading bar is:
find out total size in bytes of all .pkg files with _checkpack and _fileSize
fire function every time a new package is loaded as in loadOS3D() to update the amount in bytes already loaded
then
bytes loaded/total size in bytes * 100 = percentage
then figure out the least resource intensive way of making loading bar itself (using some ui element whose size can be set to an initial value and then made smaller...or use a slider bar?)
Offline
You may write a recursive function instead of a while loop.
For a working progress bar, i already wrote in Scol an API for that, It is on the svn.
thx iri
yes i intend to create a list of all the loaded packages, then run through the list and increment an interger until i get a total size of all of them together. where would I look for code on making a progress bar? (just tell me function name and I can google that)
are recursive functions faster than do while loops as a general rule?
Offline
then figure out the least resource intensive way of making loading bar itself (using some ui element whose size can be set to an initial value and then made smaller...or use a slider bar?)
Example :
Create a child window (with the flag CHILDINSIDE by example)
and resize a colored rectangle drawn inside it :
http://www.scolring.org/files/doc_html/ … angle.html
Offline
hebdemnobad wrote:then figure out the least resource intensive way of making loading bar itself (using some ui element whose size can be set to an initial value and then made smaller...or use a slider bar?)
Example :
Create a child window (with the flag CHILDINSIDE by example)
and resize a colored rectangle drawn inside it :
http://www.scolring.org/files/doc_html/ … angle.html
that's a good idea, forget about flash/webnavigator. I'll go with rectangle.
Offline
this seems to do it! at least numerically, I'll work on rectangle tomorrow. thx for your help!
feel free to use in os3d although i'm pretty sure you guys can do it with less code
function to get total size of all loaded pkgs in bytes:
fun getsizeofallfilesaddedtogether (filelist, totalfilesize)=
//get head of list, totalfilesize starts at 0
let hd filelist -> filepath in
//get file represented by filepath
let _checkpack filepath -> file in
(
//we are at end of list, return the total of all the bytes of all the files in the list
if filelist == nil then
//open then brace
(
//this is where we want function to end
totalfilesize;
)
else
(
//increase totalfilesize by size of current head of list
set totalfilesize = totalfilesize + (_fileSize file);
//make list smaller by one element
set filelist = tl filelist;
//call function again with decapitated list
getsizeofallfilesaddedtogether filelist totalfilesize;
);
);;
modified loader with some junk code I will clear out so I don't confuse myself
typeof total_filesize = I;;
typeof loadedfilelist = [S r1];;
fun loadOS3D (file, projname, pw, ph, fullscreen, text_control, log_window, environment)=
set total_filesize = 0;
let "tools/os3dlib/tools.pkg"::
"tools/os3dlib/xmlparser.pkg"::
"tools/os3dlib/keyblib.pkg"::
"tools/os3dlib/ogrematparser.pkg"::
"tools/os3dlib/v3dlib.pkg"::
"tools/os3dlib/v3dlib_physics.pkg"::
"tools/os3dlib/2dglib.pkg"::
"tools/os3dlib/minidhdms.pkg"::
"tools/os3dlib/mkapplet.pkg"::
"tools/os3dlib/netcomlib.pkg"::
"tools/os3dlib/os3dpaths.pkg"::
"tools/os3dlib/os3dstruct.pkg"::
"tools/os3dlib/os3dtypeconv.pkg"::
"tools/os3dlib/os3dplugins.pkg"::
"tools/os3dlib/os3dpluginscb.pkg"::
"tools/os3dlib/os3dloader.pkg"::
"tools/mediaoctopus3dplayer/os3dversion.pkg"::
"tools/mediaoctopus3dplayer/os3dlogs.pkg"::
"tools/mediaoctopus3dplayer/mediaoctopus3dplayer.pkg"::
nil
-> lfiles in
(
//print the total size of all the packages
_ADDtext text_control strcatn "the total amount of bytes to be loaded is "::(itoa (getsizeofallfilesaddedtogether lfiles 0)):: "\n"::nil;
while (lfiles != nil) && (secureLoad hd lfiles) do
(
let _checkpack hd lfiles -> file in
let _fileSize file -> package_filesize_inbytes in
(
set total_filesize = total_filesize + package_filesize_inbytes;
_ADDtext text_control strcatn "the amount in bytes that have been currently loaded are "::(itoa total_filesize):: "\n"::nil;
_PAINTtext text_control;
_PAINTwindow log_window;
//_ADDtext text_control strcat (_envfirstname environment) "\n";
//print the name of the last loaded .pkg in text_control
//getPackageNames environment text_control;
getPackageNames2 (hd lfiles) text_control;
//for the next iteration of the while do loop,
set environment = _removepkg environment;
set lfiles = tl lfiles;
);
);
if (lfiles == nil) then
(
commandToAx "OS3DPlayerLoading" "Done.";
//show console
// launch Player
initOs3dPlayer file projname pw ph fullscreen;
0;
)
else
(
if (winAX == nil) then
(
_DLGrflmessage (_DLGMessageBox _channel nil "Error" "This version of OpenSpace3D Player is not compatible with your Scol Voy@ger version, please perform an update or ask the webmaster to uptade his projects." 0) @cbVersionError nil;
0;
)
else
(
commandToAx "OS3DPlayerError" "This version of OpenSpace3D Player is not compatible with your Scol Voy@ger version, please perform an update or ask the webmaster to uptade his projects.";
0;
);
0;
);
);
0;;
Offline