Horde3D
http://horde3d.org/forums/

How am I supposed to know a resource is loaded?
http://horde3d.org/forums/viewtopic.php?f=2&t=445
Page 1 of 1

Author:  cantele [ 24.07.2008, 02:53 ]
Post subject:  How am I supposed to know a resource is loaded?

When a resource isn't loaded successfully, I can see an entry in the log file. But from the code side this isn't really helpful. I can still apparently possible to successfully add nodes from a resource that wasn't successfully loaded, as apparently it does no error checking or at least it returns a nonzero node. (I think it *should* do error checking even if it's a bit slower though).

There is no utility function to only load a single resource from disk (well, I guess I'll have to write one). Wouldn't it be nice to just be able to check whether a resource is loaded or not, after calling loadResourcesFromDisk?

In addition to the patch below, I think adding nodes from the resource should also fail.

I won't make separate patch, but just paste the changed I made here because my diffs show extremal amount of windows linebreaks... Also the whitespace seems to get smashed when I paste here, but it's just a matter of indenting it again.

in egMain.cpp
Code:
DLLEXP bool isResourceLoaded( ResHandle res )
   {
      return Modules::resMan().resolveResHandle(res)->isLoaded();
   }


in Horde3d.h

Code:

   /*    Function: loadResource
         Returns whether a resource has been successfully loaded.

        This function returns whether a resource has been successfully loaded.

      Parameters:
         res      - handle to the inspected resource

      Returns:
         true in case resource is loaded, otherwise false
   */
   DLL bool isResourceLoaded( ResHandle res );

Author:  marciano [ 24.07.2008, 19:45 ]
Post subject:  Re: How am I supposed to know a resource is loaded?

Thanks for these hints. The isResourceLoaded functionality can be useful in some cases.
I also just discussed with Volker the best behavior when calling addNodes with an unloaded resource and it makes sense to return 0 since the scene graph will not be updated automatically even if the scene graph resource is loaded later.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/