When u modify a 3D model in blender,
- You have to export it as fbx
- Use fbx-conv.exe for convert as g3db/g3dj
The goal of this project is to do this 2 step automatically at each build.gradle for all files.
(linux and macos) set up environment for binary lib see fbx-conv
- Download jar
- Put it in your favorite folder
- Create folder BlendertoGdx at same level
- Inside BlendertoGdx, create a properties file for export options, example properties file
- Configure properties (example non binary export, flip texture, look differents option)
- The required properties are 'fbxFolderPath' (folder who contains all .fbx) and 'exportFolderPath' (generally your assets/models folder)
- The paths should be relative to jar position
- Use jar directly java -jar BlenderToGdx
- Add to your core/build.gradle
processResources.dependsOn('blenderToGdx') task blenderToGdx(type: JavaExec) { group 'other' description 'Execute BlenderToGdx jar' classpath = files('../blender/BlenderToGdx.jar') //jar relative Path }
- Modify source to set your path directly and re-export as jar
You can find example in test/resources
- Search the properties files for export options
- Scan the entry directory and list all .fbx
- Copy fbx-conv.exe from resource to BlenderToGdx
- Convert all fbx files to .G3DB/G3DJ and keep file name and tree structure
- Write in a CSV file(fbx-convert-db.csv the path and last modification date of the .fbx
- Next execution will look the last modification date of the .fbx and compare with CSV to check if the file need to be reexported
- a .gitignore file is created for exclude fbx-conv exe and fbx-convert-db.csv