Problem loading OBJ model via IntelliJ

Hey guys, I’m just getting started using jME3 for a new game I’m working on and having some trouble loading a Wavefront OBJ model in my IDE, IntelliJ. I’ve seen a couple references around to people using it here, so I was wondering if any of you that have experience with it might be able to help?



Here’s the problem:



I’m trying to load a model via the Asset Manager. I’ve followed the basic tutorials here on the website. The problem is thus: I can’t get IntelliJ to copy the .obj file into the output directory. Matter of fact, it doesn’t even recognize it in the project tree. Here’s what I’ve done:


  1. Create folders “assets/Models” inside the project root. (So assets is a sibling of “src”). And made “assets” a Source root directory in the IntelliJ project structure.
  2. Put “Tank.obj” in the assets/Models directory, and added “?.obj" to the resource name patterns in the Compiler pane of the Project Settings window. This is my exact patterns string: "?.obj;?.properties;?.xml;?.gif;?.png;?.jpeg;?.jpg;?.html;?.dtd;?.tld;?.ftl”
  3. Try to run, and get a NullPointerException on assetManager.loadModel(“Models/Tank.obj”);



    I’ve noticed that if I rename the “Tank.obj” file to “Tank.obj.properties” then it will copy over just fine. Did any of you have to do anything else to get IntelliJ to copy it for you? I’m running Community Edition 9.0.3.



    Another question: If, for some reason, I’m unable to get it to work with the .obj extension, is the Asset Manager smart enough to know what the model file is by looking at the contents, or does it depend on the extension?



    Thanks in advance.

You could register a loader in the assetmanager that loads the .whatever with the obj loader. However this really feels like a dirty hack.

Thanks for the suggestion-- didn’t know yet that I could register loaders with the asset manager! But yeah, I agree, and I’d rather not resort to it if possible since there’s already a nice framework that should be able to do it if my IDE was cooperating. But on the other hand, I need some method of loading my obj models, so I’ll do it if I have to.



Edit: Talked to a friend who’s running IntelliJ on Windows (I’m on Linux at the moment), and he said it’s able to pick up the .obj file just fine, so it may be an issue with the Linux version. Will test some more when I get home tonight.



Later Edit: Found the solution. Turns out that IntelliJ has a set of extensions that it is set to ignore in IDE Settings->File Types, down near the bottom. I guess IntelliJ on linux defaults to including .obj extensions in this list. Removed it, and it picked it up just fine.