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

Extend ResourceLoadingListener for missing resources

Post by Sauce » Thu Mar 03, 2011 1:52 pm

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.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by jacmoe » Thu Mar 03, 2011 2:02 pm

Sounds like a very good idea. :)
0 x
/* 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

Re: Extend ResourceLoadingListener for missing resources

Post by rhaith » Sat May 28, 2011 7:39 pm

I was just going to implement this in my code as well and was surprised not to find it in Ogre.
0 x

User avatar
Brocan
Orc
Posts: 441
Joined: Tue Aug 01, 2006 1:43 am
Location: Spain!!

Re: Extend ResourceLoadingListener for missing resources

Post by Brocan » Sat May 28, 2011 7:57 pm

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.
0 x

Rambus
Greenskin
Posts: 100
Joined: Tue Aug 01, 2006 6:50 am
Location: Canada
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by Rambus » Fri Jun 17, 2011 1:52 am

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 86 times
0 x

User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by Klaim » Sat Jun 18, 2011 11:39 am

Wouldn't a cube with "error" or a cubic shape 3D error text like yours but in cubic shape mesh be more efficient?
0 x

Rambus
Greenskin
Posts: 100
Joined: Tue Aug 01, 2006 6:50 am
Location: Canada
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by Rambus » Mon Jun 20, 2011 5:18 pm

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.
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by jacmoe » Mon Jun 20, 2011 5:33 pm

Bethesda uses a glowing question mark.. :)
0 x
/* 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
Contact:

Re: Extend ResourceLoadingListener for missing resources

Post by Rambus » Mon Jun 20, 2011 10:25 pm

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 90 times
0 x

User avatar
Zonder
Ogre Magi
Posts: 1133
Joined: Mon Aug 04, 2008 7:51 pm
Location: Manchester - England
x 22

Re: Extend ResourceLoadingListener for missing resources

Post by Zonder » Tue Jun 21, 2011 9:34 am

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

Post Reply