Setting up assimpLoader on Windows

Hi everybody,

if anyone is interested in making assimploader work now on CodeBlocks under Windows here are the steps i followed to achieve it. I post this here because is not the best way to do it and as I consider myself an everlasting noob, I thought here would be the best place to post this.

LET’S GO:
1.- Go to the download page of Open Asset Import Library: http://assimp.sourceforge.net/main-downloads.html
2.- Download the last SDK release (2.0)
3.- Get from the zip the library from the folder** lib/assimp_release-dll_win32** and copy it into the openframeworks/libs/assimp/lib/win_cb folder (this is not strictly necessary as we will set from the IDE where to get the library, but it is mainly for keeping files order :P)
4.- Get a project that works with CodeBlocks (for example, emptyExample, ;D)
5.- Add the files of the assimploaderexample data into the emptyExample and override the main.cpp and testApp.cpp and testApp.h
6.- Add the addon files to the project tree and into the project options>include libraries
7.- Go to project’s “Build options” and in Linker Settings tab add the assimp.lib that was copied at the thirth step
8.- At search directories add the addon src folder “…\addons\ofxAssimpModelLoader\src” and the library include folder “…\libs\assimp\include”

It should work now! But… no textures loaded! (OH MY GOD! :o)

Do not panic! Let’s do a quick hack of the addon to make it load nicely our textures (not correctly though, you will need to have the textures at the same level of the model and do not mess with folders!):
1.- Open with CodeBlocks IDE the ofxAssimpLoader.cpp
2.- Go to line 311, there should be the if condition “if(ofFilePath::isAbsolute(texPath.data) && ofFile::doesFileExist(texPath.data)) {”
4.- Comment it
5.- Comment the closing key left orphan when we commented the if condition (should be at** line 315**)
6.- Recompile (clean project and Cntrl+F11) and enjoy yhe textured models (except the Squirel, the one that meses with folders :P)

Ok maybe these aren’t the nicest steps to make the addon example work, but at least now you will “just” have to fight with exporting isues… hehe

Cheers!

Important
When designing the 3D model, wll, it’s skeleton, do not copy&paste bones. Make the skeleton bone by bone not copying yhem (for example when symetric skeletons). I had many problems when exporting the model and loading it with assimpLoader… searching for causes, but by now, let’s work as cp didn’t ever exist!

1 Like

Thank you @jmoraguiard.
I was looking for a solution for a different problem, but your post was very helpful. I’ll add my problem and solution here just in case someone searches for the same terms as me in the future.

Problem
It is a pain to use ofxAssimpModelLoader on Code Blocks because of the compile time. The compiler seems to hang for about one minute on libassimp.dll every time. It is so annoying that I would drop features and use any other libraries just to avoid ofxAssimpModelLoader. But it is the best 3D model loader in openFrameworks today, so every problem that you encounter with other libs usually have ‘use ofxAssimpModelLoader’ as an answer.

Solution - openFrameworks version 0.8.4

  1. Download assimp 2.0 from http://assimp.sourceforge.net/main_downloads.html
  2. In the zip, get assimp.lib from /lib/assimp_release-dll_win32
  3. Copy it to /addons/ofxAssimpModelLoader/libs/assimp/lib/win_cb
  4. Open your project in Code Blocks, Project > Build options > Linker settings, remove the link to libassimp.dll
  5. Still in the Liker settings, add a link to assimp.lib that you copied on Step 3.
  6. If you compile now, there will be an error. So go back to the zip and get Assimp32.dll from /bin/assimp_release-dll_win32
  7. Copy it to [your project path]/bin
  8. Compile your project - it will be much faster now.

An alternative to steps 6 and 7 would be to copy Assimp32.dll from the zip directly into /addons/ofxAssimpModelLoader/libs/assimp/lib/win_cb and then add a post-build step in your project.
In Code Blocks, Project > Build options > Pre/post build steps > Post-build steps, add the following line:

xcopy /e /i /y "$(PROJECT_DIR)..\..\..\addons\ofxAssimpModelLoader\libs\assimp\lib\win_cb\Assimp32.dll"  "$(PROJECT_DIR)bin"

Cheers!