Xclna conversion to XNA 2.0... somebody has sucess?

Dec 29, 2007 at 11:47 PM

I'm trying convert Xclna 1.0 xna refresh version to xna 2.0... but i'm having problems...

in the method process, in the class AnimatedModelProcessor, I has error about
"return type must be ContentProcessorContext", but before was ModelContent...

I'm going crazy.... :-)

somebody has sucess in the conversion to XNA 2.0???

Jan 1, 2008 at 7:37 AM
Edited Jan 1, 2008 at 7:37 AM
Yea it is kind of a bummer that there hasn't been an update for this library for so longer, especailly when it had so much potential.
Luckly for you, I have a conversion of this library from XNA 1.0 to XNA 2.0.
You can get the source code from here: http://www.laterminal.net/xna/AnimationComponent.rar( The only downside is that it was done in Visual Studio 2005, so if you want to do it in Visual Studio Express 2005 then just recreate a new solution copy over all the files and you should be good to go).
If you just want the dlls then you can dowload them from here: http://www.laterminal.net/xna/AnimationComponentDLL.rar
I hope this helps you and also hope that dastle will have enough time to pick up the project again.
Jan 1, 2008 at 2:08 PM
Edited Jan 1, 2008 at 2:11 PM
Hi elSibor...

I get the file AnimationComponent.rar...

I extract the files and open the project in my Visual Studio Express 2005...

Compiled all files and create the DLLs...

then create the project new, add content processor (ModelAnimationCollection) and Content Importer X File - Animation Library, and write the simple code... the tutorial dwarf...

but, when start debugging (F5) I get the error message:
Error 1
Wrong content processor input type. Processor AnimationProcessor expects an input of Microsoft.Xna.Framework.Content.Pipeline.Graphics.BoneContent, but Microsoft.Xna.Framework.Content.Pipeline.Graphics.NodeContent was passed.
Your importer and processor selections may not be compatible.

in my observation, look the same problem in my first post above, when I was trying convert the library to xna version 2...


do you can help me???

what do you think???

Jan 1, 2008 at 3:10 PM
Edited Jan 1, 2008 at 3:13 PM
OK, in the top list of ContentProcessor I find the Model - Animation Library... I Change, and it did run...

but, it stop with:


"Both a valid vertex shader and pixel shader (or valid effect) must be set on the device before any draw operations may be performed"

but, the statements foreach (modelmesh... and so on) are there...

please guys, dont let this wornderfull project die...

will be what after more 1 year of much much work this project go away... finish?


Jan 2, 2008 at 8:58 PM
Edited Jan 2, 2008 at 9:21 PM
For the error:
"Both a valid vertex shader and pixel shader (or valid effect) must be set on the device before any draw operations may be performed"

I had to rearrange the order of my rendering calls in 2.0. Pretty much everywhere I ran into this, I first had to call graphics.SetRenderTarget(0, null); where graphics represents a GraphicsDevice. This is more to do with the XNA Framework changes than with the animation library.


After making the changes above in other parts of my code, I am still getting this error when I try to run in debug mode and it points me to ModelAnimator.cs. In release, it works fine.
Jan 2, 2008 at 10:38 PM
thanks gfowler, I will go try...

thanks, again...
Jan 4, 2008 at 11:28 PM
The problem has something to do with the fact that BasicPaletteEffect doesn't define a Vertex Shader. I'm currently digging through code to figure out what is causing this issue.
Jan 4, 2008 at 11:47 PM
Well, I'm still looking for the problem, but here's an update.

The effect does contain a vertex shader and what's more, it's being loaded correctly. However, when pass.Begin() is called in ModelAnimator, the vertex shader is not being applied to the graphics device. I'll keep looking for a solution.
Jan 5, 2008 at 9:53 AM
Edited Jan 5, 2008 at 9:54 AM

Hey guys,
Sorry for the delayed response.
I have converted the DwarfTutorial to XNA 2.0. The reason why you were getting those errors was because the method that was used to apply effects to the model during content processing doesn't work in XNA 2.0. As such the effect wasn't allocated. To over come this you have to load an effect file (.fx file) during runtime that contains skinning algorthim ( or any other HLSL techinques).
You can download the dwarf tutorial from here http://www.laterminal.net/xna/DwarfTutorial%202.0.rar
It includes everything you need, the corrent Xclna (just incase you haven't compile it yet) dlls, the fx file (this fx just contains the same skinning algorithm that was found in the original tutorial).
It is a Visual Studio Pro solution so it wont work open directly in Visul Studio C# express ( to make it work with visual studio c# express just add the .cs files and, contents folder, and any other porject files manually).
Good luck guys and happy new years.

Jan 5, 2008 at 9:24 PM
Awesome man, thanks for doing this. I was totally hitting a wall. Any chance you could also put up the source for the dlls or is it the same as the ones you posted above?
Jan 5, 2008 at 10:55 PM

Hey ddbrown30,
the source for the dlls is the same one from my original post.
Jan 10, 2008 at 6:42 AM
Wow, amazing work on updating that code, Sibor. I wanted to use the Animation Component Library mostly cause it had a tutorial explaining how to use it and I didn't have to go reading through somebody else's code like I would if I used XNA's skinning sample. So kudos to you for digging through somebody else's code, I know I don't like to do it.

So on a similar note, thanks for the big comment blocks on your update that clearly point out what needs to be changed.

Now I hope this isn't a dumb question, but would that custom shader work for any model? or do I need to write a new one for my own models, assuming that all I want to do is just display it, nothing really fancy?
Jan 10, 2008 at 8:15 AM
Oh, and also a good thing to know, this obviously works with the dwarf, I downloaded the files and saw that for myself, but has anybody tried using a custom model? There is a post on the XNA forums where someone tried using these DLLs I think but could not get his model to animate properly. It could have been just his code. Has anybody else tried?
Jan 10, 2008 at 1:48 PM

spacefly wrote:
Oh, and also a good thing to know, this obviously works with the dwarf, I downloaded the files and saw that for myself, but has anybody tried using a custom model? There is a post on the XNA forums where someone tried using these DLLs I think but could not get his model to animate properly. It could have been just his code. Has anybody else tried?

Hey Spacefly,
Yes these dlls(and the tutorial) should work with any custom model. Both .X files (We use 3DS Max studio to make models and we use kwXporter as our xporter of choice http://sourceforge.net/projects/kwxport/), and FBX files.
The most common mistake most people do, is when they bring their model in Visual Studio they forget to change the content processor from the default Model-XNA Framework to Model - Animation Library (in Visual Studio, in the solution explorer right click on you model and click properties this is where you can change the Content Processor type).
Also exporter x files allow you to give and animation a name, which you can use to call the animation you want, but fbx files dont do that so you have to call them by their index (ei: 0, for the first animation, 1, for the next animation ect..)

I have used this dll (both the old version 1.0 refresh and 2.0) to work on school game and am still using it to for my current game.

Hope these info help
Jan 10, 2008 at 9:42 PM
Why yes it does. Thank you so much Sibor. I'm going through the dwarf tutorial right now and if that goes well will continue on to use my own models. I may be back if I come across any more concerns.

Thanks again!
Jan 11, 2008 at 12:51 AM
Edited Jan 11, 2008 at 10:36 PM
You would think I would have learned by now to never get excited when a program looks like it's going to work.

I've programmed the tutorial up to the step number 10, "Making the Dwarf Walk" and added in the shader from the dwarf tutorial 2.0. I should be able to run it from this pint, if not earlier, right? But when I build the project I now have only one warning, and that is:

Member 'DwarfTest.Game1.LoadGraphicsContent(bool)' overrides obsolete member 'Microsoft.Xna.Framework.Game.LoadGraphicsContent(bool)'. Add the Obsolete attribute to 'DwarfTest.Game1.LoadGraphicsContent(bool)'.

However after doing a little research I found that all that is accomplished by adding the obsolete attribute is that you get an error message telling you that your code is obsolete. also noticed that in XNA 2.0 they have LoadContent instead of LoadGraphicsContent, but it seems to work fine in dwarfTutorial2.0, which is why I have not added the Obsolete attribute.

But when I run the program I just get... what would you call it... the dialog box of doom? that tells my that my program will not run and I can choose to send the error report to Microsoft... You know the one, right?

Now when I go through and try to debug the program the debugger stops on the line in the LoadGraphicsContent Method where the dwarfAnimator is initialized:
dwarfAnimator = new ModelAnimator(this, model);
there is an error window when I try to run this line that is titled "Exception is unhandled" and then says "Model has too many skinned bones for the matrix palette"

When I look with the debugger the model only has 49 bones, where I thought the maximum was 50.

Then just out of curiosity I debugged the 2.0 tutorial, to see that the model there also has 49 bones, so the one in my attempt should work.

I don't want to exhaust your hospitality, but do you have any ideas what might be happening?

Nevermind... somehow I fixed it, all I did was try making some changes to the way that I added the xml file and rebuilt the entire solution a bunch of times and spent lots of time in debug mode. Oh man, look at that little guy go!
Mar 25, 2008 at 7:26 AM
Thanks to this post I was able to migrate my game to 2.0 but only on Windows. On the Xbox 360 I get the following runtime error:
An unhandled exception of type 'System.InvalidCastException' occurred
On the following line of code
BasicPaletteEffect oldEffect = (BasicPaletteEffect)part.Effect;
When I compiled the DLL for the 360 I just used the same files that were used for the windows version, assuming they were the same. Just created a new Xbox 360 Game Library 2.0 and linked to the files. I removed the ModelViewer.cs in order to Build. because I was getting errors and on the original 1.0 version that file was not included on the 360 version.
Does anybody had success on the 360?
Mar 26, 2008 at 3:50 AM
I confirm that the port to 2.0 works on the XBOX 360. I just forgot to set the Content Processor to Model - Animation Library , and since It was 2 a.m. in the morning, I was unable to find the cause.
Thanks again to all the community.
Mar 28, 2008 at 7:39 AM
Both the AnimationComponent and DrawfTutorial worked straight off for me, thanks a lot guys.

We should probably get this stuff checked in to the source repository?

Apr 17, 2008 at 4:16 PM
Edited Apr 18, 2008 at 10:39 PM
Just one correction to the code in Game1.cs.

The rotation about the z-axis is missing for the weapon. That is why it is displayed upside down.

Just add the following:
// Add this to the end of the Update method
BonePose weapon = dwarfAnimator.BonePoses"weapon";
weapon.CurrentController = null;
weapon.CurrentBlendController = null;
weapon.DefaultTransform =
Matrix.CreateRotationX(MathHelper.Pi) *
Matrix.CreateRotationY(MathHelper.Pi) *
Matrix.CreateRotationZ(MathHelper.Pi) * // <--------- add the missing rotation about the z-axis
Apr 21, 2008 at 12:03 PM
Hey guys
Who can tell me how to use xclna in WinFormsContentLoading sample?
Aug 4, 2008 at 12:55 PM
To elSibor
It looks that there are some problem while converting to XNA2.0. If we delete the dwarfmodel.xnb file in Debug\Content, there will have an error at line 142. Hope that you can fix this.
Sep 23, 2008 at 12:20 AM
Edited Sep 23, 2008 at 4:40 PM
I think we should be a little more clear in how to do this.

The setup up for the project is different.  In 2.0 when you add a reference to the content pipeline, it is not done in Project Properties. In Reference, I added the Xclna.Xna.Animationx86.dll
and in Content->Reference I added the Xclna.Xna.Animation.Content.dll. To do that:  Right Click -> Add Reference.  That worked for me.

I was looking at this:;

                // Add this in the if (state=="idle") block of the UpdateState method
                if (keyState.IsKeyDown(Keys.Space))
                    crouch.ElapsedTime = 0;
                    crouch.IsLooping = false;
                    //crouch.AnimationEnded += new AnimationEventHandler(crouch_AnimationEnded);
                    state = "crouchDown";
The line about  AnimationEventHandler was just taken out.  But I need to have an event handler like that.  How is this done in Xna 2.0?

I changed AnimationEventHandler (that no longer exists in:  using System;

namespace Xclna.Xna.Animation )  to EventHandler ( which is in System.Runtime.InteropServices;
namespace System )

It worked.

Oct 28, 2008 at 2:40 PM

I'm currently trying to get the 2.0 Library to work. I've managed to get everything where it's supposed to be, but when I try to load the dwarfmodel I get an error. For some reason there are no animations in dwarfmodel.Animations.
Any idea what's wrong here?

Oct 28, 2008 at 3:26 PM
Do yo have the .xml file with the animations in the same directory as the X file?