In addition to making the output ObjectLoader compatible, I've also added or
improved a bunch of functionality:
- Fixed oddity whereby textures were output to a 'maps/' directory but only
referenced by filename. The relative path is now stored in JSON.
- Added texture filename collision detection which aborts conversion when two
textures would be copied over each other. The abortion behavior can be
replaced with a printed warning by specifying --ignore-texture-collisions
(-i).
- Textures can now be saved to directories other than 'maps/' by specifying
--texture-output-dir (-o). This path is relative to the output JSON file and
file references in the JSON are updated accordingly.
- Materials whose textures contain a non-empty alpha channel now automatically
have 'transparent' set to true (Requires ImageMagick). This can be disabled
by specifying --no-transparency-detection (-a).
- Non web compatible textures are now automatically converted to PNG or JPEG
files, the former if they contain alpha (Requires ImageMagick). If
ImageMagick is not available a warning is reported and we gracefully fall
back to the old behavior.
- Existing --pretty-print (-p) behavior has now been extended to print JSON
properties in the order 'metadata', 'type', 'uuid', <other keys>, 'data',
'children'.
- Redirected errors and warnings to stderr rather than printing to stdout.
- Fixed FBX -> three.js texture bindings.
- Added support for LineSegments.
- Added duplicate geometry detection functionality enabled by specifying
--optimize-geometry (-g). This just does a brute force search for identical
geometry and removes the duplicates, replacing node geometry references
accordingly.
Also performed general refactoring which included:
- Deleted lots of dead and commented-out code.
- Made method naming consistent (using underscores).
- Deleted unused/pointless variables.
- Replaced manual path string manipulation with native python methods (which
fixed a couple of obscure bugs).
The following functionality has been removed:
- Scene flattening, --flatten-scene (-f), has been removed as it made a heap
of assumptions and doesn't really make sense in a *converter*. The task is
better performed in a 3D modelling package, or even in three.js itself after
a Scene has been loaded.