glTF-CSharp-Loader icon indicating copy to clipboard operation
glTF-CSharp-Loader copied to clipboard

Switch to System.Text.Json + inheritance

Open ZingBallyhoo opened this issue 2 years ago • 1 comments

Not sure if there's any interest in taking this change, but hey, its here for anyone who needs it :)

Notes:

  • The library is now compatible with trimming & NativeAOT
  • Added actual inheritance support instead of inserting the same base members (e.g name, extensions, extra) in every type. The base types (e.g GltfChildOfRootProperty) were always generated, but weren't used.
  • Minimum target is now .netstandard2.0 (was 1.3)
  • There's no automatic ShouldSerializeXX handling in STJ, so so default value handling is registered through generated code
  • JsonStringEnumConverterWithEnumMemberAttrSupport is required to allow custom serialized enum names. Preview version of STJ 8 is needed to make this trim safe.
  • Removed ArrayConverter
    • See the commit message from when it was added. https://github.com/KhronosGroup/glTF-CSharp-Loader/commit/90932db7e3cee8c2d914099aaa7d3fb8c028ee90. I'm sure this is a leftover from glTF 1.0 or something
  • Removed run-on-build from Generator.csproj (another legacy thing)

Resolves https://github.com/KhronosGroup/glTF-CSharp-Loader/issues/50 Closes https://github.com/KhronosGroup/glTF-CSharp-Loader/issues/28

ZingBallyhoo avatar Sep 08 '23 23:09 ZingBallyhoo

Thank you for this contribution. As a user I would definitely want your PR to be merged. I tested it locally and it works wonderfully. Not depending on Newtonsoft for JSON parsing is a huge improvement in my opinion. I've also noticed slightly lower loading times.

BoyBaykiller avatar Sep 27 '23 08:09 BoyBaykiller