gltf icon indicating copy to clipboard operation
gltf copied to clipboard

Missing Default implementation for some items

Open ghost opened this issue 6 years ago • 4 comments

To construct a new gltf file it'd be much easier if all of the struct in gltf-json implemented the Default trait.

Ex gltf_json::Buffer has no default.

(Have not checked the others)

ghost avatar Jan 08 '19 15:01 ghost

I see the exporter is not planned yet, #187 So I close the issue

ghost avatar Jan 08 '19 15:01 ghost

This should be the case, so re-opening.

alteous avatar Jan 12 '19 08:01 alteous

The main problem with implementing default values is (and this is the case for export more generally) that indices may be out of bounds. This isn't a problem per se but may be surprising. For the sake of simplicity, I say we implement Default anyway, set default indices to zero, and call validate upon export.

alteous avatar Jan 19 '19 15:01 alteous

I experienced with this idea and finally i created new, with_index functions where default was not possible. It seems safer and ergonomic too. (Sorry no pr as i've hacked too much for my minimal usacase) Or instead of zero some extremal max value'd be better that fails on validate for sure.

ghost avatar Jan 21 '19 17:01 ghost