Registering ResourceHandlers

16 views
Skip to first unread message

Christopher Sosa

unread,
Jan 31, 2016, 12:32:10 PM1/31/16
to Helium Project
Hi again, i'm still figuring out the asset production pipeline (if is an correct term) and i wanted how to register ResourceHandlers, in the EditorSupports seems there's no initialization or register an type to be available for iterating, in my project i've removed all the obsolete resource handlers (since i'm using an completely different third-party renderer)  but when i initialize the LoosePackageLoader with my Data folder which contains for now only .txt files, it triggers an assert of there's no resource handler available for this kind of file.

I have an dead-simple resource and ResourceHandler below:

The Resource class:

 class DummyResourceHandler;


 
class HELIUM_STUDIOSUPPORT_API DummyResource : public Resource
 
{
 HELIUM_DECLARE_ASSET
(DummyResource, Resource);

 
friend class DummyResourceHandler;

 
public:
 
/// @name Construction/Destruction
 
//@{
 
DummyResource();
 
virtual ~DummyResource();
 
//@}

 
virtual Name GetCacheName() const;

 
};


 class HELIUM_STUDIOSUPPORT_API DummyResourceHandler : public ResourceHandler
 
{
 HELIUM_DECLARE_ASSET
(DummyResourceHandler, ResourceHandler);


 
public:
 
/// @name Construction/Destruction
 
//@{
 
DummyResourceHandler();
 
virtual ~DummyResourceHandler();
 
//@}

 
/// @name Resource Handling Support
 
//@{
 
virtual const AssetType* GetResourceType() const;
 
virtual void GetSourceExtensions(const char* const*& rppExtensions, size_t& rExtensionCount) const;

 
virtual bool CacheResource(AssetPreprocessor* pAssetPreprocessor, Resource* pResource, const String& rSourceFilePath);
 
//@}

 
};



And they compile and links fine.

Those objects are defined and declared in the same project, i don't know if can have some issues about that.

In the GetSourceExtensions has the extensions .txt like this:

 static const char* extensions[] = { ".txt", ".dummy" };


I tried to search around the Editor code and i saw no ResourceHandler registration, i would appreciate a lot giving me some clues to register resourcehandlers since i'm stuck because the LoosePackageLoader can't find an ResourceHandler for this kind of file.

Thanks you.


Christopher Sosa

unread,
Feb 1, 2016, 2:45:13 PM2/1/16
to Helium Project
The only quick-and-dirty way to do it is instancing it, to LoosePackageLoader gets the asset being registered....

Christopher Sosa

unread,
Feb 2, 2016, 4:01:09 PM2/2/16
to Helium Project
Really this project is really dying so slowly, well was an worthy code project after all.

Just i wanted to know just how to register properly new asset types such resources and resourcehandlers, how i can access the raw data of the source resource file (texture, script, shader etc) because OGRE the renderer i use doesn't care to use an Data driven solution, he wants the bytes of my referenced resource as well, ResourceHandlers i don't know how to work properly for me, with a couple of hacks (like in RenderResourceManager class do for gathering the shaders) i'm able to access it but, somehow my own ProjectViewModel display empty names, NULL pointers, etc.

Anyways if you don't respond guys, don't worry i know you're really busy!, but this kind of architecture with a good documentation or dead-simple code implementations makes harder to understand to other newcomers. Also i'm sorry from myself because i forked entirely Helium and rolling in my own. farewell guys!
Reply all
Reply to author
Forward
0 new messages