facebookincubator / FBX2glTF

A command-line tool for the conversion of 3D model assets on the FBX file format to the glTF file format.
Other
2.08k stars 331 forks source link

Change --output to always specify file #192

Open FreakTheMighty opened 5 years ago

FreakTheMighty commented 5 years ago

I'd like to humbly suggest the --output argument be changed to specify the main output file rather than the prefix to an output directory.

To summarize the current behavior, currently for a command such as

FBX2glTF -i ./glTF-Sample-Models/sourceModels/Lantern/SM_LanternPole.fbx -o /tmp/light

A new directory, /tmp/light_out is created. I found this a bit awkward when trying to programmatically get the output of the shell command. It requires a little path munging to get the actual output. Simply, I would like to specify the output, and then have that output exist.


I propose the output should be a path to the main file

FBX2glTF -i ./glTF-Sample-Models/sourceModels/Lantern/SM_LanternPole.fbx -o /tmp/light/light.gltf

All supporting files should be written to the same directory or children of that directory. If a user wishes to ensure that the directory only contains artifacts of the FBX2glTF script, they should be responsible for creating an empty directory.

zellski commented 5 years ago

I don't want to abandon the convenience interpretation... it makes sense in a lot of ways. Also, practically, I don't want to break dozens of production scripts out there. I agree that it'd be good to be able to at least opt out of its magic,. though.

We could do different things depending on the extension:

If we did this, then the remaining question would be whether -o C:\foo\bar.txt (or any meaningless output extension) should error out. I think probably yes.

FreakTheMighty commented 5 years ago

@zellski that sounds great. I've made the change here. I'll create a pull request once I've tested it more.