vpenades / SharpGLTF

glTF reader and writer for .NET Standard
MIT License
476 stars 75 forks source link

CurveFactory might need to be public #107

Closed emackey closed 3 years ago

emackey commented 3 years ago

Not sure if I've done something wrong, but I can't seem to access CurveFactory from outside SharpGLTF.

https://github.com/vpenades/SharpGLTF/blob/b4e0140ee874abb63c0bfc990c84ad2013935878/src/SharpGLTF.Toolkit/Animations/CurveFactory.cs#L12

Is this supposed to be public static class CurveFactory ?

vpenades commented 3 years ago

CurveFactory is essentially used to back the functionality of AnimatableProperty{T}.UseTrackBuilder

You could call CurveFactory indirectly by creating an AnimatableProperty, call UseTrackBuilder, and then discard the AnimatableProperty{T}.

To some degree, AnimatableProperty{T} is the public API of CurveFactory.

Notice that, in glTF, the only place you can use curves is in scene Nodes, that's why AnimatableProperty is being used in the appropiate places of NodeBuilder.

The calling hierarchy looks like this:

NodeBuilder -> Translation|Scale|Rotation AnimatableProperty -> UseTrackBuilder -> (internal) CurveBuilder.

emackey commented 3 years ago

Aha, user error, perfect. I switched my code to UseTrackBuilder. Thanks!