You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The program I'm writing merges several glb files, now I would like to be able to read the animation data from the original files and write them into the new file. Below the simplified code
ModelRoot model = SharpGLTF.Schema2.ModelRoot.Load(glb.FileName);
foreach (Node nd in model.LogicalNodes){
if (nd.Mesh != null){
//duplicate mesh -> NewMesh and merged rootNode.WithLocalTransform(afm).WithMesh(NewMesh);
.....
//
foreach (Animation animation in model.LogicalAnimations){
foreach (AnimationChannel ch in animation.Channels){
if (ch.TargetNode == nd){
IAnimationSampler<Vector3> AS=ch.GetTranslationSampler();
ICurveSampler<Vector3> CS = AS.CreateCurveSampler(true);
rootNode.WithTranslationAnimation(name, CS);
}
}
}
}
}
the line rootNode.WithTranslationAnimation(name, CS); returns an error at runtime:
Message: "Must implement IConvertibleCurve\r\nNome parametro: sampler"
ParamName: "sampler"
Source: "SharpGLTF.Toolkit"
StackTrace: " in SharpGLTF.Schema2.Toolkit.WithTranslationAnimation(Node node, String animationName, ICurveSampler1 sampler) in D:\\Sorgenti\\SharpGLTF\\src\\SharpGLTF.Toolkit\\Schema2\\AnimationExtensions.cs:riga 56" TargetSite: {SharpGLTF.Schema2.Node WithTranslationAnimation(SharpGLTF.Schema2.Node, System.String, SharpGLTF.Animations.ICurveSampler1[System.Numerics.Vector3])}
Where am i going wrong? Which instructions should I use?
Thanks in advance for the time you will dedicate to me
The text was updated successfully, but these errors were encountered:
Generally speaking, ICurverSampler is an interface used to "sample values along the curve" but does not state how the curve was built in the first place.
So you need to use an object that implements both ICurveSampler and IConvertibleCurve so it can be written back to a file.
Also, there's a number of incompatible curves: you cannot mix STEP, LINEAR, or SPLINE curves,
The program I'm writing merges several glb files, now I would like to be able to read the animation data from the original files and write them into the new file. Below the simplified code
ModelRoot model = SharpGLTF.Schema2.ModelRoot.Load(glb.FileName);
foreach (Node nd in model.LogicalNodes){
if (nd.Mesh != null){
}
the line rootNode.WithTranslationAnimation(name, CS); returns an error at runtime:
Message: "Must implement IConvertibleCurve\r\nNome parametro: sampler"
ParamName: "sampler"
Source: "SharpGLTF.Toolkit"
StackTrace: " in SharpGLTF.Schema2.Toolkit.WithTranslationAnimation(Node node, String animationName, ICurveSampler
1 sampler) in D:\\Sorgenti\\SharpGLTF\\src\\SharpGLTF.Toolkit\\Schema2\\AnimationExtensions.cs:riga 56" TargetSite: {SharpGLTF.Schema2.Node WithTranslationAnimation(SharpGLTF.Schema2.Node, System.String, SharpGLTF.Animations.ICurveSampler
1[System.Numerics.Vector3])}Where am i going wrong? Which instructions should I use?
Thanks in advance for the time you will dedicate to me
The text was updated successfully, but these errors were encountered: