anchor.diff:  = jMonkeyEngine SDK: Importing and Viewing Models
  -:author: 
  -:revnumber: 
  +:author:
  +:revnumber:
   :revdate: 2016/03/17 20:48
   :keywords: documentation, sdk, tool, asset, scene
   :relfileprefix: ../
   :imagesdir: ..
  +:experimental:
   ifdef::env-github,env-browser[:outfilesuffix: .adoc]
   
   
   The jMonkeyEngine SDK imports models from your project and stores them in the assets folder. The imported models are converted to a jME3 compatible binary format called .j3o. Double-click .j3o files in the jMonkeyEngine SDK to display them in the SceneViewer, or load them in-game using the AssetManager.
   
  -Presently, link:http://www.blender.org/[Blender 3D] is the preferred modelling tool for jME3 as it is also Open-Source Software and an exporter for OgreXML files exists. There is a direct .blend file importer available in the SDK and you can directly import or store blend files in your project to convert them. If for some reason your version of blender is not compatible, you can use the default OgreXML format. Note that the OgreXML exporter is not compatible with Blender 2.49 or before!
  +Presently, link:http://www.blender.org/[Blender 3D] is the preferred modelling tool for jME3 as it is also Open-Source Software and an exporter for GLTF files exists. View the 3D model <<jme3/features#supported-formats,Supported External File Types>> and their export/conversion options for more info.
  +
  +[WARNING]
  +====
  +Blender no longer supports Ogre exporting as of version 2.8. It's highly recommended that you export and convert files using the GLTF type. Ogre will eventually be removed from this wiki.
  +====
   
   Also, see this link:http://www.youtube.com/watch?v=nL7woH40i5c[demo video] on importing models.
  -
   
   == Installing the OgreXML Exporter in Blender
   
   The jMonkeyEngine SDK includes a tool to install the correct exporter tools in Blender to export OgreXML files. To install the exporter, do the following:
   
  -.  Select “Tools→“OgreXML→“Install Blender OgreXML in the jMonkeyEngine SDK Menu
  +.  Select menu:Tools[OgreXML>Install>Blender OgreXML] in the jMonkeyEngine SDK Menu
   .  If you are presented a filechooser, select the folder where your blender scripts reside
  -.  Press “Install in the window that opens
  +.  Press "`Install`" in the window that opens.
   
   Also check out <<jme3/external/blender#,how to create compatible models in blender>> and <<jme3/intermediate/multi-media_asset_pipeline#,how to organize your assets>>.
  -
  -
  -=== Importing and Viewing a Model
  -
  -
  -== Using the Model Importer Tool
  -
  -jMonkeyEngine SDK includes a model importer tool that allows you to preview and import supported models into your jMonkeyEngine3 project.
  -[.right.text-left]
  -image:https://github.com/jMonkeyEngine/sdk/raw/master/jme3-documentation/src/com/jme3/gde/docs/wp-uploads/2010/11/jmonkeyplatform003-300x117.jpg[jmonkeyplatform003-300x117.jpg,width="",height=""] +
  -image:https://github.com/jMonkeyEngine/sdk/raw/master/jme3-documentation/src/com/jme3/gde/docs/wp-uploads/2010/11/jmonkeyplatform002-300x218.jpg[jmonkeyplatform002-300x218.jpg,width="",height="",align="right"]
  -
  -
  -.  Select the project you want to import your model to
  -.  Click the “Import Model button in the toolbar
  -.  Click “open model.. and select the main model file
  -.  Check the preview and file list and press “Next
  -.  Check and change the import path if necessary
  -.  If you want to copy the original model files as well, check the checkbox
  -.  Press “finish
  -
  -The model is converted to j3o and all necessary files are copied to the project assets folder. If you have specified the corresponding option, all original model files will also be copied to your assets folder.
   
   
   == Using the model files directly
  
positive.code: 
  
  .  Create a separate folder for each model in the `assets` folder of your project.
  .  Save the model created in Blender (.blend) *in the `asset` folder of your project*, 
  .  Make sure that no textures are packed in the .blend file.
  .  Make sure all textures used in the .blend file are in the assets folder of the project.
  .  In the Projects Explorer Assets node, select the model that you want to import.
  .  Double-click the model or right-click and select “Convert to JME binary from the context-menu.
  .  In the Projects Explorer Assets node you should see your model j3o file.
  .  Double-click it to view it in the SceneViewer.
  .  Click on the lightbulb to turn on the light if you cannot see your model.
  
  [NOTE]
  ====
  It is important that you copy the model file and its textures to the correct assets folder before creating the j3o file because the paths for textures (and possibly other things) will be stored as absolute (to the assets folder root) when you convert that model. This means the texture location should not change after the import.
  ====
  
  [NOTE]
  
negative.code: 
  Each jMonkeyEngine SDK project has its own internal AssetManager that has the projects assets folder registered as a FileLocator. When the project is run, the assets folder is compressed into a jar file and added to the projects main jar classpath. This way the editors in jMonkeyEngine SDK and the running game have the same asset folder structure.
  
  You might wonder why jMonkeyEngine SDK requires you to copy the model that is to be converted to j3o into the assets folder before. The Model Import Tool also copies the model and associated files to the project directory before converting. To load the model it needs to be in a folder (or jar etc..) that belongs to the projects AssetManager root. To load a model from some other folder of the filesystem, that folder would have to be added to the AssetManager root. If every folder that contains a model was in the root of the AssetManager, all textures named "`hull.jpg`" for example would be the same for the AssetManager and it would only deliver the texture of the first model folder that was added.
  
  To have a valid jME3 object, the paths to textures and other assets belonging to the model have to be read with the correct, final path that can then be stored in the j3o object. The j3o object will use those paths when it is loaded with the AssetManager and it requires the AssetManager to deliver the assets on those paths, this is why the folder structure while converting has to be the same as when loading.
  