I'm trying to make multiple animations for multiple models in XNA 4.0 and I need to get the name of the model/asset from the content processor which is a custom one (XNA default I think), I'm trying doing this by the split method which requires reading from a file the animations but I need to get the model's name to match it with the files because I'll have several files for several models.
public override ModelContent Process(NodeContent input,
ContentProcessorContext context)
{
ValidateMesh(input, context, null);
// Find the skeleton.
BoneContent skeleton = MeshHelper.FindSkeleton(input);
if (skeleton == null)
throw new InvalidContentException("Input skeleton not found.");
// We don't want to have to worry about different parts of the model being
// in different local coordinate systems, so let's just bake everything.
FlattenTransforms(input, skeleton);
// Read the bind pose and skeleton hierarchy data.
IList<BoneContent> bones = MeshHelper.FlattenSkeleton(skeleton);
if (bones.Count > SkinnedEffect.MaxBones)
{
throw new InvalidContentException(string.Format(
"Skeleton has {0} bones, but the maximum supported is {1}.",
bones.Count, SkinnedEffect.MaxBones));
}
List<Matrix> bindPose = new List<Matrix>();
List<Matrix> inverseBindPose = new List<Matrix>();
List<int> skeletonHierarchy = new List<int>();
foreach (BoneContent bone in bones)
{
bindPose.Add(bone.Transform);
inverseBindPose.Add(Matrix.Invert(bone.AbsoluteTransform));
skeletonHierarchy.Add(bones.IndexOf(bone.Parent as BoneContent));
}
// Convert animation data to our runtime format.
Dictionary<string, AnimationClip> animationClips;
animationClips = ProcessAnimations(skeleton.Animations, bones);
//split animations
animationClips = SplitAnimations(animationClips["Take 001"], @"F:\Education\GP\GP\Animations\defs.txt");
// Chain to the base ModelProcessor class so it can convert the model data.
ModelContent model = base.Process(input, context);
// Store our custom animation data in the Tag property of the model.
model.Tag = new SkinningData(animationClips, bindPose,
inverseBindPose, skeletonHierarchy);
return model;
}
I want to replace the "defs" with the model/asset name to make it load the correct animations. Sorry if my question is vague or redundant. Thanks in advance. Is there something wrong with the question ? ._.!