As part of another thread ([SOLVED] BinaryExporter and materials - #66 by mitm) I got the itch to see if I could make a command line “converter”. Or at least poke around at would make it hard or not.
Friday night I played around with some ideas and had some nice success so I’ve pushed up a prototype with basic functionality. You can find the latest downloadable release here:
…where I’ll keep updating that release until I start making “official versions”.
The tool is very basic but functional and so far works with every GLTF that I’ve tried from Sketchfab. I’ve been less successful with other formats that JME is supposed to support… but I don’t know if the SDK would read them either because I don’t have the SDK installed.
To use:
- download and unzip the zip somewhere
- run bin/jmec.bat or bin/jmec (on Linux) from that zip
…it will print command line help like:
Current command line help:
_ __ __ ___ ___
_ | | | \/ | | __| / __|
| || | | |\/| | | _| | (__
\__/ |_| |_| |___| \___|
JME3 Asset Converter v1.0.0
Usage: jmec [options] [models]
Where [models] are a list of model files.
Where [options] are:
-sourceRoot <dir> : specifies the asset root for the models.
Model paths will be evaluated relative to this root.
-targetRoot <dir> : specifies the asset target root for writing
converted assets and their dependencies.
-targetPath <path> : a path string specifying where to place
the copied/converted assets within the targetRoot. Any
internal asset keys will be 'rehomed' to this path.
Examples:
>jmec -sourceRoot C:\Downloads\CoolModel -targetRoot assets -targetPath Models/CoolModel C:\Downloads\CoolModel\AwesomeThing.gltf
Converts C:\Downloads\CoolModel\AwesomeThing.gltf to a j3o and writes it
to ./assets/Models/CoolModel/AwesomeThing.gltf.j3o
Any dependent textures, etc. relative to C:\Downloads\CoolModel will
be copied until the appropriate ./assets/Models/CoolModel/* subdirectory.
For example:
C:\Downloads\CoolModel\textures\awesome-sauce.jpg
Gets copied to:
./assets/Models/CoolModel/textures/awesome-sauce.jpg
But basically the idea is that if you download some file or have saved a file from blender with its dependent textures and so on, you’d use -sourceRoot to tell it the relative root for that model (ie: where the textures, etc. should be resolved relative to). You give a -targetRoot that’s probably your project’s assets directory. Then specify a -targetPath within your assets directory for where you want to write the files. And then give it a file to convert.
It will write the j3o and all of the textures, etc. to that location.
As said, this is a super basic tool at the moment. It only allows straight convert + copy.
Next steps:
- add scripting support so that you can modify the models once loaded… say to set a proper scale or mark materials for j3m export. (Probably by giving it an asset key.)
- support selectively exporting j3m materials.
…that will be where I’ll cut a “version 1” because it will be a pretty powerful tool by then.
Edit: made a real release 1.0.0 with the above ‘next steps’ features. Read more below. Link here if you’re impatient: Release JMEC Version 1.0.0 · Simsilica/JmeConvert · GitHub