|
@@ -97,14 +97,22 @@ namespace SharpGLTF.Schema2
|
|
|
|
|
|
|
|
protected override void OnValidateContent(Validation.ValidationContext validate)
|
|
protected override void OnValidateContent(Validation.ValidationContext validate)
|
|
|
{
|
|
{
|
|
|
- if (_weights.Count > 0)
|
|
|
|
|
|
|
+ // https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#morph-targets
|
|
|
|
|
+
|
|
|
|
|
+ int morphsCount = -1;
|
|
|
|
|
+
|
|
|
|
|
+ foreach (var p in this.Primitives)
|
|
|
{
|
|
{
|
|
|
- foreach (var p in this.Primitives)
|
|
|
|
|
- {
|
|
|
|
|
- validate.GetContext(p).AreEqual("MorphTargetsCount", p.MorphTargetsCount, _weights.Count);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (morphsCount < 0) morphsCount = p.MorphTargetsCount;
|
|
|
|
|
+
|
|
|
|
|
+ validate.GetContext(p).AreEqual("MorphTargets.Count", p.MorphTargetsCount, morphsCount);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (_weights.Count > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ validate.AreEqual("Weights", morphsCount, _weights.Count);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
base.OnValidateContent(validate);
|
|
base.OnValidateContent(validate);
|
|
|
}
|
|
}
|
|
|
|
|
|