Extend ResourceLoadingListener for missing resources

What it says on the tin: a place to discuss proposed new features.
Post Reply
Sauce
Kobold
Posts: 26
Joined: Sat Mar 27, 2010 12:38 pm
x 2

Extend ResourceLoadingListener for missing resources

Post by Sauce »

ResourceLoadingListener allows us to handle name collisions, but currently there's no method of handling requests for missing resources, besides handling exceptions for every single resource request at the site of the request. Could the listener be extended to handle this?

I would use this to replace the requested resource with a default resource which we can guarantee to be available - for example, If the requested resource is a mesh then I would replace it with something akin to the glowing red "ERROR" mesh used in the Source engine, or the question mark mesh used by Ogitor.

Image

Materials already default to a white material, but with these changes we could have default meshes, textures (for example the black and purple checkerboard texture, also used by Source), and even default resources for other user-defined types deriving Ogre::Resource.

Image

The current OGRE behaviour isn't very useful (if the exception isn't expected then the program will just crash). Thoughts?
Last edited by Sauce on Tue May 31, 2011 2:29 pm, edited 1 time in total.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by jacmoe »

Sounds like a very good idea. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
rhaith
Kobold
Posts: 27
Joined: Mon Nov 23, 2009 4:35 am
x 2

Re: Extend ResourceLoadingListener for missing resources

Post by rhaith »

I was just going to implement this in my code as well and was surprised not to find it in Ogre.
User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!
x 8

Re: Extend ResourceLoadingListener for missing resources

Post by Brocan »

Yeah, i 've implemented the same but using the resource exception and loading a error.mesh instead.

I think that this behaviour is better than handle the exception in every resource load call. Maybe can be possible also to define if you want to except or load a error mesh...

Furthermore, it's extrange that materials load a default material if not found, but the mesh not found generates an exception.
Rambus
Greenskin
Posts: 100
Joined: Tue Aug 01, 2006 6:50 am
Location: Canada
x 6
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by Rambus »

I like the idea.

I created an error mesh file for anyone to use when implementing this for them selves.
The exported .mesh, a simple .material and the .max(9) source file is included.

Image
346 vertices, 688 faces

Error.mesh
Simple error model with red material. No animations or LOD

AnimatedError.mesh
The mesh has a node animation titled: "rotate" which simply rotates the mesh once.

The model is released into the public domain.

Mirrored for hot linking: http://www.nonlife.net/downloads/error.zip

Enjoy.
Attachments
error.zip
(63.01 KiB) Downloaded 136 times
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by Klaim »

Wouldn't a cube with "error" or a cubic shape 3D error text like yours but in cubic shape mesh be more efficient?
Rambus
Greenskin
Posts: 100
Joined: Tue Aug 01, 2006 6:50 am
Location: Canada
x 6
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by Rambus »

This error text is designed to replicate the error mesh seen in the popular Source game engine. You could use any mesh- but it certainly does not need to be efficient because it should only appear when something has gone wrong in development.

Edit: I imagine they went for 3d text as apposed to a cube with an error message written on it as it may be easier to identify, even from a distance.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by jacmoe »

Bethesda uses a glowing question mark.. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Rambus
Greenskin
Posts: 100
Joined: Tue Aug 01, 2006 6:50 am
Location: Canada
x 6
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by Rambus »

Currently I use the previously supplied error mesh with an additional red glow pass in the material.

Since I could not tell if that ? comment was a request or not...

----

I created an error mesh file for anyone to use when implementing this for them selves.
The exported .mesh, a simple .material and the .max(9) source file is included.

Image
104 vertices, 200 faces

ErrorQuestionMark.mesh
Simple error model with red material. No animations or LOD


The model is released into the public domain.

Mirrored for hot linking: http://www.nonlife.net/downloads/errorquestion.zip

Enjoy.
Attachments
errorquestion.zip
(28.65 KiB) Downloaded 152 times
User avatar
Zonder
Ogre Magi
Posts: 1168
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 73

Re: Extend ResourceLoadingListener for missing resources

Post by Zonder »

They probably used a "?" as it is internationally understood :)
There are 10 types of people in the world: Those who understand binary, and those who don't...
Post Reply