Good day,
it is as You wrote. It only gets the separate files "DONE" registered.
It is NOT how it should be - it is HOW IT IS at the moment.
Sorry for any inconvenience. I haven't touched that piece of code since - but i put it on my ToDo list, and let You know. I hope You don't have short deadlines...
In the project i used it i had a "Texture X out of MAX" text displaying the process, i suppose that was my solution to the problem of not getting all the info during loading (or i never had the intention of displaying a separate progressbar for each - as that could have been misleading).
Cheers,
dbam.
ps: and of course, if You find a solution in the meantime, let me know.
Date: Mon, 16 Aug 2010 13:21:05 -0700
From: ml-node+2327406-96822927-73352-***@public.gmane.org
To: darbam-***@public.gmane.org
Subject: Re: Displaying a preloader for a Collada (.DAE) file
Hi dbam,
I made the changes you suggested and used the code below
private function load():void{
daeFile = new DAE();
daeFile.addEventListener(FileLoadEvent.LOAD_PROGRESS, handleProgress);
daeFile.addEventListener(FileLoadEvent.LOAD_COMPLETE, init);
daeFile.load("lib/dae/nature.dae");
}
private function handleProgress(e:FileLoadEvent):void{
per = Math.floor(e.bytesLoaded/e.bytesTotal)*100;
tf.text = String(per) + "% loaded";
}
it compiled but the "handleProgress" function displayed only "0% loaded" and "100% loaded" for each texture associated with the .dae, is this the functionality your changes were supposed to implement? I'd like to display a growing percentage as the textures load, but don't know how to edit the code =P
thanx,
sixtus
Huge Ontoman wrote:
Hello Eric-Paul,
it is 2010 now (pv3d 2.1.9200, branch CS4, dated '18.09.08'), and still the same VOID with DAE and materials loading...
But the good news is...that applying these patches in both DAE.as and BitmapFileMaterial.as You can have a working solution.
My idea was re-dispatching the FileLoadEvent from the DAE class. While i was at it, i added a new FileLoadEvent type, COLLADA_LOADED, because the method Tim wrote about ProgressEvent.PROGRESS in my case actually didn't register anything (i'm wondering how YOU got Your listener get called)...
For all the control-over-load-process-geeks, here is the deal:
in...org/papervision3d/objects/parsers/DAE.as:
...
/**
* Loads the next material.
*
* @param event
*/
private function loadNextMaterial(event:FileLoadEvent=null):void
{
...
var material:BitmapFileMaterial = data.material;
material.addEventListener(FileLoadEvent.LOAD_COMPLETE, loadNextMaterial);
material.addEventListener(FileLoadEvent.LOAD_ERROR, onMaterialError);
// dbam added...support for monitoring material loading progress.
material.addEventListener(FileLoadEvent.LOAD_PROGRESS, onMaterialProgress);
// dbam out.
...
}
// dbam added...redispatching event into the flow.
private function onMaterialProgress( event: FileLoadEvent ):void {
dispatchEvent( event );
}
// dbam out.
...
/**
* Called on parsing progress.
*
* @param event
*/
private function onParseProgress(event:ProgressEvent):void
{
// dbam added...event dispatch to actually DO somethig here.
// let the outside know how the .DAE is doing.
dispatchEvent ( new FileLoadEvent( FileLoadEvent.LOAD_PROGRESS, this.filename, event.bytesLoaded, event.bytesTotal));
// dbam out.
}
...
/**
* Called when the DaeReader completed parsing.
*
* @param event
*/
private function onParseComplete(event:Event):void
{
...
// dbam added...dispatching the fact that the DAE was completely loaded.
// IT DID NOT LOAD NO MATERIALS YET, JUST THE ACTUAL .DAE FILE!
dispatchEvent ( new FileLoadEvent( FileLoadEvent.COLLADA_LOADED, this.filename ));
buildMaterials();
loadNextMaterial();
...
}
...
org/papervision3d/objects/parsers/DAE.as...out.
So far the "bridge" is set up, but because of a typo(?bug) the 'file' string of the BitmapFileMaterial won't reflect the actual url of the files when loading a bunch (more than one) of them via DAE.as,
so You have to set it as follows to get the CORRECT url up with the event..
in...org/papervision3d/materials/BitmapFileMaterials.as:
...
// ___________________________________________________________________ LOAD BITMAP PROGRESS HANDLER
private function loadBitmapProgressHandler( e:ProgressEvent ):void
{
// dbam changed...
// var progressEvent:FileLoadEvent = new FileLoadEvent( FileLoadEvent.LOAD_PROGRESS, url, e.bytesLoaded, e.bytesTotal);
// to...
var progressEvent:FileLoadEvent = new FileLoadEvent( FileLoadEvent.LOAD_PROGRESS, _loaderUrls[e.target.loader], e.bytesLoaded, e.bytesTotal);
// dbam out.
dispatchEvent( progressEvent );
}
...
org/papervision3d/materials/BitmapFileMaterials.as...out.
and to make it complete, here's what is new in my FileLoadEvent.as:
in...org/papervision3d/events/FileLoadEvent.as:
...
public class FileLoadEvent extends Event
{
...
public static const ANIMATIONS_PROGRESS :String = "animationsProgress";
// dbam added...
// to send load complete after file loaded,
// before MaterialBitmaps start to load...
public static const COLLADA_LOADED :String = "colladaLoaded";
// dbam out.
...
}
...
// dto added: Adobe standard
// every event MUST override clone...still asking myself why.
public override function clone():Event {
return new FileLoadEvent(type, file, bytesLoaded, bytesTotal, message, dataObj, bubbles, cancelable);
}
}
This is fresh out the oven (5:30 in the morning), works so far, but not heavy tested.
If anything goes wrong later on (this stuff breaks something), please feel warned. (If so, please let me know.)
Hope that this will help. And if so, please let me know...
cheers,
dbam.
Eric-Paul Lecluse wrote:
Hey Tim,
The ProgressEvent.PROGRESS works great for the DAE/XML, but not for
possible bitmap textures that are loaded in automatically. The Collada
class used the FileLoadEvent.COLLADA_MATERIALS_DONE, but this seems to
be unimplemented in the DAE.
Now, there is the static BitmapFileMaterial.callback
<http://lostboys.epologee.net/papervision/greatwhite.doc/html/org_paperv
ision3d_materials_BitmapFileMaterial.html#callback> , to which you could
assign a method that's triggered when all bitmap loading has finished.
But I'm not sure if you want us abusing that property instead of maybe
listening to an event of a kind.
What's your advice?
Cheers,
Eric-Paul.
-----Original Message-----
On Behalf Of Tim Knip
Subject: Re: [Papervision3D] Displaying a preloader for a Collada (.DAE)
file
dae = new DAE();
dae.addEventListener( ProgressEvent.PROGRESS, myLoadHandler );
dae.load( "myfile.DAE" );
Tim
Post by garion1Can someone please explain how to display a preloader for a .dae file.
_______________________________________________
Papervision3D mailing list
Papervision3D-***@public.gmane.org
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
View message @ http://papervision3d.758870.n4.nabble.com/Displaying-a-preloader-for-a-Collada-DAE-file-tp782807p2327406.html
To unsubscribe from Re: Displaying a preloader for a Collada (.DAE) file, click here.
--
View this message in context: http://papervision3d.758870.n4.nabble.com/Displaying-a-preloader-for-a-Collada-DAE-file-tp782807p2329529.html
Sent from the Papervision3D mailing list archive at Nabble.com.