SharpGLTF icon indicating copy to clipboard operation
SharpGLTF copied to clipboard

Validation Method only available for loading from file

Open famda opened this issue 1 year ago • 6 comments

Hey,

The Validate method from ModelRoot available for models from a filePath. Is it possible to add the same method for Stream or byte array (ParseGLB and ReadGLB)?

Thanks in advance.

famda avatar Oct 16 '22 17:10 famda

these methods already have a ReadSettings argument, you can call:

ParseGLB( bytes, ValidationMode.Strict);
ReadGLB( stream, ValidationMode.Strict);

vpenades avatar Oct 17 '22 06:10 vpenades

That's true but you can't validate before you read it. When you read it from file you can check before and select the option (strick, tryfix, skip) based on the validation errors.

On those methods it's a try catch experience and I can't know what is happening with the GLB (there's no way to see why it's failing).

I have a bunch of glb's that have assessors out of bounds. To fix it, I just need to update bounds of the arrays. This is something that I can't solve without knowing the reason.

famda avatar Oct 17 '22 07:10 famda

you can create an instance of ReadContext.CreateFromFile and then call Validate(fileName)

vpenades avatar Oct 17 '22 07:10 vpenades

I actually tried but that method accepts a string. If you have a stream or a byte array, what would you pass to it? There's no filename in that case.

famda avatar Oct 17 '22 07:10 famda

I'll review the code to see if there's a path through... it'll take some time

vpenades avatar Oct 17 '22 09:10 vpenades

Thanks. 😉

famda avatar Oct 17 '22 09:10 famda