Skip to content

Commit

Permalink
Fixed bug in animation importer
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunkerbewohner committed Aug 27, 2011
1 parent bd87622 commit 0333e1a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
Expand Up @@ -70,6 +70,12 @@ public void Play(String clipName = "Take 001")
player.StartClip(clip);
}

public void PlayFirstClip()
{
AnimationClip clip = skinningData.AnimationClips.Values.First();
player.StartClip(clip);
}

/// <summary>
/// Advances the animation by given time and updates the model
/// skin accordingly.
Expand Down
Expand Up @@ -28,8 +28,8 @@ public class Game1 : Microsoft.Xna.Framework.Game
Matrix view;
Matrix projection;

Vector3 pos = Vector3.Zero;
Vector3 rot = Vector3.Zero;
Vector3 pos;
Vector3 rot;
bool showHints = true;

List<Model> models = new List<Model>();
Expand Down Expand Up @@ -75,7 +75,7 @@ protected override void Initialize()
view = Matrix.CreateLookAt(new Vector3(0, 0, -10), Vector3.Zero, Vector3.Up);

pos = new Vector3(0, -40, 100);
rot = new Vector3(-MathHelper.PiOver2, 0, 0);
rot = new Vector3(-MathHelper.PiOver2, 0, MathHelper.Pi - MathHelper.PiOver4);

base.Initialize();
}
Expand Down Expand Up @@ -112,7 +112,7 @@ protected override void LoadContent()
}

// Start default animation clip
animatedModels[model].Play();
animatedModels[model].PlayFirstClip();
}
else
{
Expand Down
Expand Up @@ -55,7 +55,7 @@
<Importer>ColladaStdModelImporter</Importer>
<Processor>ModelProcessor</Processor>
<SubType>Designer</SubType>
<ProcessorParameters_RotationZ>-45</ProcessorParameters_RotationZ>
<ProcessorParameters_RotationZ>-180</ProcessorParameters_RotationZ>
</Compile>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -86,8 +86,7 @@
<Name>Igor</Name>
<Importer>ColladaStdModelImporter</Importer>
<Processor>ModelProcessor</Processor>
<ProcessorParameters_Scale>20</ProcessorParameters_Scale>
<ProcessorParameters_RotationZ>180</ProcessorParameters_RotationZ>
<ProcessorParameters_Scale>30</ProcessorParameters_Scale>
</Compile>
<Compile Include="Igor\IgorTex.tga">
<Name>IgorTex</Name>
Expand All @@ -101,7 +100,6 @@
<Importer>ColladaStdModelImporter</Importer>
<Processor>ModelProcessor</Processor>
<ProcessorParameters_Scale>30</ProcessorParameters_Scale>
<ProcessorParameters_RotationZ>135</ProcessorParameters_RotationZ>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" />
Expand Down
4 changes: 2 additions & 2 deletions ColladaXnaBase/Import/AnimationImporter.cs
Expand Up @@ -344,9 +344,9 @@ static JointAnimation ImportAnimation(XmlNode xmlAnimation, Dictionary<string,Jo
string target)
{
// Input and Output sources
Source input = Source.FromInput(xmlSampler.SelectSingleNode("//input[@semantic='INPUT']"),
Source input = Source.FromInput(xmlSampler.SelectSingleNode("input[@semantic='INPUT']"),
xmlAnimation);
Source output = Source.FromInput(xmlSampler.SelectSingleNode("//input[@semantic='OUTPUT']"),
Source output = Source.FromInput(xmlSampler.SelectSingleNode("input[@semantic='OUTPUT']"),
xmlAnimation);

// Target (matrix, translation.*, rotation.*, scale.*)
Expand Down
4 changes: 2 additions & 2 deletions ColladaXnaBase/Import/SceneImporter.cs
Expand Up @@ -110,11 +110,11 @@ string GetMeshLibKey(XmlNode xmlNode, string id)
}

Matrix CreateAbsoluteTransformFromSkeleton(XmlNode xmlControllerInstance)
{
{
XmlNode skeleton = xmlControllerInstance.SelectSingleNode("skeleton");
string nodeId = skeleton != null
? skeleton.InnerText.Trim().Substring(1)
: _model.RootJoint.GlobalID;
: _model.RootJoint.GlobalID;

XmlNode xmlRoot = xmlControllerInstance.OwnerDocument.DocumentElement;
XmlNode xmlNode = xmlRoot.SelectSingleNode("id('" + nodeId + "')");
Expand Down

0 comments on commit 0333e1a

Please sign in to comment.