aerys / minko

3D framework for web, desktop and mobile devices.
http://minko.io
Other
906 stars 210 forks source link

ASSIMP_BUILD_NO_IMPORTER_INSTANCIATION? #216

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hey, I'm trying to make a small function that registers all possible model parsers from ASSIMP. Originally I had manually registered each parser with each file extension, but this seemed like a bone dead stupid way to do it; surely a better way was possible, and I thought file::ASSIMPParser::getSupportedFileExtensions() was a plausible way to do so.

Unfortunately, this static function is not available unless ASSIMP_BUILD_NO_IMPORTER_INSTANCIATION is defined, and while it seems like a straightforward macro, it's effect on the code isn't obvious. As well, MinkoASSIMP.hpp won't include 'ASSIMPParser.hpp' unless the macro does not exist. This leads me to believe there is some sort of interdependence there.

Can you shed any light on why getSupportedFileExtensions isn't available unless this macro is defined?

jpx commented 9 years ago

Hello,

You are right about the intent of the flag ASSIMP_BUILD_NO_IMPORTER_INSTANCIATION.

It was originally used to provide a global switch to tell whether few ASSIMP parsers should be arbitrarily created or, if the flag is not defined, every parsers should be used, in order to be able to eliminate unnecessary code from final executable.

There is actually an issue from ASSIMPParser class and the tests on both declaration and definition of ASSIMPParser::getSupportedFileExtensions should actually be #if !defined (ASSIMP_BUILD_NO_IMPORTER_INSTANCIATION)

The fix shall soon get to dev branch. For now you should be able to do the fix from your side on those two files.

ghost commented 9 years ago

@jpx

Is the fix as easy as the one or two line change I'm thinking? If so, why isn't it in mainline?

warrenseine commented 9 years ago

It is: https://github.com/aerys/minko/commit/98b446a1dc41f5f716412d6cd669e38e47510e09