I've got a situation where a parser could now return either a Mesh or a 
Skeleton, based on the contents of the Collada .dae file.  (Or frankly, in 
the general case, BOTH (you could easily put a skeleton and a mesh in the 
same file))

2 issues I have:
a) The initHandle() method of the parser can only return one type of 
instance, and there's no way to pass context to getResource() to tell it 
which i'm expecting, or to have it parse "just enough" of the file to 
determine which type to return (since this method is called by definition 
before the file is loaded).
b) Skeleton at the moment doesn't implement IResource, so it can't be 
returned anyway.

Some things I could think of to overcome this.
1) Make Skeleton implement IResource.  I do not know if the overhead of this 
is something people wanted to avoid.
2) Implement the custom parser addition (to ResourceManager) I mentioned 
about a month back. Then, vary the extension of the skeleton dae to 
something slightly different.  It's still collada, but the custom parser 
variation could handle production of the proper resource.  This feels 
hack-ish.
3) Change the initHandle method to return a Vector.<IResource>.  The 
degenerate case of 1 is easy.

Thoughts?

-Dave

Reply via email to