static private ValidateMesh ( NodeContent node, ContentProcessorContext context, string parentBoneName ) : void | ||
node | NodeContent | |
context | ContentProcessorContext | |
parentBoneName | string | |
return | void |
public override ModelContent Process(NodeContent input, ContentProcessorContext context) { SkinnedModelProcessor.ValidateMesh(input, context, null); BoneContent boneContent = MeshHelper.FindSkeleton(input); bool count = boneContent != null; if (count) { SkinnedModelProcessor.FlattenTransforms(input, boneContent); IList <BoneContent> boneContents = MeshHelper.FlattenSkeleton(boneContent); count = boneContents.Count <= 59; if (count) { List <Matrix> matrices = new List <Matrix>(); List <Matrix> matrices1 = new List <Matrix>(); List <int> nums = new List <int>(); IEnumerator <BoneContent> enumerator = boneContents.GetEnumerator(); try { while (true) { count = enumerator.MoveNext(); if (!count) { break; } BoneContent current = enumerator.Current; matrices.Add(current.Transform); matrices1.Add(Matrix.Invert(current.AbsoluteTransform)); nums.Add(boneContents.IndexOf(current.Parent as BoneContent)); } } finally { count = enumerator == null; if (!count) { enumerator.Dispose(); } } Dictionary <string, AnimationClip> strs = SkinnedModelProcessor.ProcessAnimations(boneContent.Animations, boneContents); ModelContent modelContent = base.Process(input, context); modelContent.Tag = new SkinningData(strs, matrices, matrices1, nums); ModelContent modelContent1 = modelContent; return(modelContent1); } else { throw new InvalidContentException(string.Format("Skeleton has {0} bones, but the maximum supported is {1}.", boneContents.Count, 59)); } } else { throw new InvalidContentException("Input skeleton not found."); } }
private static void ValidateMesh(NodeContent node, ContentProcessorContext context, string parentBoneName) { object[] name; MeshContent meshContent = node as MeshContent; bool flag = meshContent == null; if (flag) { flag = node as BoneContent != null; if (!flag) { parentBoneName = node.Name; } } else { flag = parentBoneName == null; if (!flag) { name = new object[2]; name[0] = meshContent.Name; name[1] = parentBoneName; context.Logger.LogWarning(null, null, "Mesh {0} is a child of bone {1}. SkinnedModelProcessor does not correctly handle meshes that are children of bones.", name); } flag = SkinnedModelProcessor.MeshHasSkinning(meshContent); if (!flag) { name = new object[1]; name[0] = meshContent.Name; context.Logger.LogWarning(null, null, "Mesh {0} has no skinning information, so it has been deleted.", name); meshContent.Parent.Children.Remove(meshContent); return; } } IEnumerator <NodeContent> enumerator = (new List <NodeContent>(node.Children)).GetEnumerator(); try { while (true) { flag = enumerator.MoveNext(); if (!flag) { break; } NodeContent current = enumerator.Current; SkinnedModelProcessor.ValidateMesh(current, context, parentBoneName); } } finally { enumerator.Dispose(); } }