HOW TO USE COMPONENT

Topics: User Forum
Coordinator
Nov 18, 2006 at 11:34 PM
*download release and unzip it (contains dll and XML file)
*In your project, add the dll as a reference, and also add it in the components panel under properties
*Select Model - Animation Library for all .X files you want to animate, and also X File - Animation Library as the importer (or you can try leaving it as the default, but this has problems)

Then, it's as simple as:

AnimationController controller = new AnimationController(this, model,
"Animation0");
Coordinator
Nov 20, 2006 at 12:43 AM
I've provided a demonstration solution for you to download at the release tab.
Nov 22, 2006 at 1:06 AM
I'm having problems with using this component. I get a NullReferenceException when using:
<code>
models0 = content.Load<Model>("Content\\Models\\floor");
models1 = content.Load<Model>("Content\\Models\\testmodel");
net = new NetworkClient();
Animation.AnimationController controller = new Animation.AnimationController (this, models1, "Animation0"); </code>

Is this because I'm using an fbx model?

The fbx model has a character skeleton with a walking animation. I would really appreciate any help and if you need more information please let me know.
Nov 22, 2006 at 1:12 AM
Oh and just to let you know your sample AnimationDemo works fine... I am thinking its got to do with the format but just want someone to clear it up for me.
Coordinator
Nov 22, 2006 at 2:50 AM
1. Skinned animations are currently only supported for .X files. Unskinned animations should work fine for any format, provided the importer correctly imports the animations.

2. Make sure that "Model - Animation Library" is selected as the processor for your fbx files.

3. I don't have access to an fbx exporter, so providing me with an animated model would help me a lot.
Nov 22, 2006 at 3:13 AM
OK.. thanks for your help I got a really lame test model in fbx format with some walking animation you can use that its located at http://www.durhailay.co.uk/testmodel.fbx I'll try exporting it as a .X file and see if it works and let you know.
Nov 22, 2006 at 3:38 AM
I have tested the alien.X model provided in the demo but still get the same NullException error. I'm really confused now. I'll look more into it, but if you could list some reasons why this error would occur I would really appreciate it.
Coordinator
Nov 22, 2006 at 4:40 AM
Are you using the correct importer and processor?
I.E.

"X File - Animation Library"
as the importer and
"Model - Animation Library" as the processor?
Coordinator
Nov 22, 2006 at 4:42 AM
Also, when I go to the link: http://www.durhailay.co.uk/testmodel.fbx
I get a file not found error.
Coordinator
Nov 22, 2006 at 4:53 AM
There really shouldn't be anything that can cause a null reference exception besides using the wrong processor
Nov 22, 2006 at 4:57 PM
Unless you never "new" your ContentManager (content) or your Models array, or if the call to initialize them is being called after your trying to use either one.
Nov 22, 2006 at 10:29 PM
How can I check what processor I'm using, sorry if it seems stupid, I'm a noob at this...
Nov 22, 2006 at 10:30 PM
oh and the link has to be with capital file extension sorry:

http://www.durhailay.co.uk/testmodel.FBX
Coordinator
Nov 22, 2006 at 10:49 PM
I have to run, and will give a more detailed answer later. When you add your content item and clikc on it, there should be a properties table in the bottom right of the screen. This allows you to set that content item's processor and importer. If still have a problem you can search the XNA forums or I can give a more detailed explanation later.
Nov 23, 2006 at 12:24 PM
I would really appreciate if you could give me a detailed description.
Coordinator
Nov 23, 2006 at 11:13 PM
I tested out the file and the processor doesn't read it correctly. I'm looking into this, but the best I can suggest for now is to export the file in .X format and follow the steps below. I'll let you know when I get fbx files working with the controller.
Coordinator
Nov 23, 2006 at 11:18 PM
Sorry that the FBX file isn't animated properly. I did some quick checking, and it appears that each joint is a separate animation instead of being all part of the same animation. The error that I get while loading the model has to do with the palette effect. I'll look into these problems, in the meantime, you can export to .X format and use the following routine:


- Start up visual C# express
- Start a new game of type Windows game
- Add a reference to Animation.dll by right clicking on references, clicking the browse tab, and going to the directory where you unzipped the project (should contain the dll)
- Allow the content pipeline to use this dll by right clicking on your project in solution explorer (By default, WindowsGame1), clicking properteis, clicking hte Content Pipeline tab on the left, clicking add, and then adding Animation.dll
- Add your art to the project by right clicking on your project, clicking add->existing item, browsing to your art, and adding your art
- Right click on your art item and select properties
- A properties window should open in the bottom right. Click on content importer, and select "X File - Animation Library" if you are using a .X file, or fbx importer otherwise
- Click on content processor, and select "Model - Animation"
Coordinator
Nov 23, 2006 at 11:20 PM
I updated the release info to inform users that the animation controller only works for ascii .X files. I couldn't properly test it on fbx files because I have no fbx exporter, but after I add non matrix key support, I'll definitely look into it.
Nov 24, 2006 at 2:33 PM
Ok, I have got the alien.X model working in my own project, thanks for your detailed explanation. I have this .X model of my own which I created in 3DS Max 7 and exported it with a plugin called Panda X exporter. When I try to load it in my project I get an error:

Error 1 Building content threw ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at Animation.Content.AnimatedModelImporter.AnimatedMeshImporter.ImportSkinWeights()
at Animation.Content.AnimatedModelImporter.AnimatedMeshImporter.ImportMesh()
at Animation.Content.AnimatedModelImporter.ImportNode()
at Animation.Content.AnimatedModelImporter.ImportNode()
at Animation.Content.AnimatedModelImporter.ImportRoot()
at Animation.Content.AnimatedModelImporter.Import(String filename, ContentImporterContext context)
at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1.Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import(String filename, ContentImporterContext context)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAssetDirectly(BuildItem item, String importerName)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAndLoadAsset(BuildItem item, BuildItem requestingItem)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAssetViaCache(BuildItem item, String importerName)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, ITaskItem[] sourceAssets, TaskLoggingHelper msbuildLog, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates) C:\Documents and Settings\Ricky\My Documents\Visual Studio 2005\Projects\VStest\VStest\Content\Models\VSmodel.X VStest


I would really appreciate if you could tell me why this is occuring.
Nov 24, 2006 at 2:35 PM
You can download the model and test it yourself: http://www.durhailay.co.uk/VSmodel.X
Coordinator
Nov 24, 2006 at 11:40 PM
Ok, the problem is that you have two meshes that contain vertices that are influenced by the same bone. My animator didn't account for this case - an oversight, and I am fixing it.

Another problem is that your mesh uses 63 bones - which is a large amount and more than the matrix palette could support.

I am fixing this as well.

Hopefull I'll have it working tonight, I'll keep you informed.
Coordinator
Nov 25, 2006 at 8:36 AM
I got the animation working on my computer... but since it is part of a large change set I'll have to run it through some debugging first.

The .X file will not get loaded correctly by the default .X importer, because you have multiple meshes who can have verts influenced by the same bone. If you try loading the file using the default importer, it gives you a warning and just deletes the info from the second bone. I may file this on connect, because this is a feature the normal importer should REALLY have.

Tomorrow I'll post the new DLL in the release sections under "Special Build."
Coordinator
Nov 25, 2006 at 11:25 PM
Well, my computer here that can run XNA decided to stop working, so I'll have to post the updated dll/project tomorrow when I get back to my main one. Sorry :(
Nov 26, 2006 at 5:01 AM
uh this isn't really about the animation stuff itself, but using your notation and stuff i figured out how to use it and display animated models. In your example the effect initiation is done outside the Draw method. In the example for displaying a 3d model in the tutorials for xna, it puts the effects into the draw method. What is the best way to do this? My non-animated models aren't appearing inside the game using your outside the draw-method. What gives?
Coordinator
Nov 26, 2006 at 6:27 AM
Are they appearing when you do the initiation inside the draw method?
Nov 26, 2006 at 5:28 PM
yea, they are. this is the initiating that is being done in the draw method when it works:

foreach (ModelMesh mesh in model.Meshes)
{
//This is where the mesh orientation is set, as well as our camera and projection
foreach (BasicEffect effect in mesh.Effects)
{
effect.EnableDefaultLighting();
effect.World = Matrix.CreateRotationX(MathHelper.ToRadians(0.0f)) * mesh.ParentBone.Transform
* Matrix.CreateTranslation(Vector3.Zero);
effect.View = Matrix.CreateLookAt(camposition, modelposition, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
aspectRatio, 1.0f, 100000.0f);
}
mesh.Draw();
//Draw the mesh, will use the effects set above.

}

however if i do this before like you do, it doesn't show up. any help? in my opinion doing it in the draw method would probably slow down the program, but it doesnt work doing it before.
Nov 26, 2006 at 5:44 PM
oh and while i'm at it, how do u handle events such as "controller.AnimationReset"? shouldn't there be a method that is called when events like that and key presses and such happen? I already got my animation to only play when the model is moving but i'd like to have it continue until reaching completion. The only way to do this (that i can see) is to find out when the "AnimationReset" is being called. BUT HOW?

PS lol sry for my XNA noobyness. just started working with this half a week ago. i've been programming for like 7 years though.
Nov 26, 2006 at 6:22 PM
oh and while i'm at it still, is it possible to update the camera after execution? When i have my inanimate objects reference a vector3 "cameraposition" like such:

effect.View = Matrix.CreateLookAt(cameraPosition,modelposition, Vector3.Up);

It updates them in relation to the camera so the camera is pointing at the model. HOWEVER, the model itself (an animate object) screws around and refuse to go where it should be. It is initialized like the examples in your demo download. help?
Nov 26, 2006 at 10:10 PM
http://www.megaupload.com/?d=NL5WDLA1

There be Man.x. Can someone tell me why this doesnt work with your animation thing OR the directx viewer?
Nov 26, 2006 at 10:11 PM
http://www13.megaupload.com/files/22612ce97c6aafa94312800dc2172d9b/man.x

that "might" be a direct link to the file. try it before the other one.
Coordinator
Nov 27, 2006 at 3:19 AM
Sorry, I was on a train ride all day.

You shouldn't need to draw the mesh manually, the point is that the animation controller does that for you. I don't know why it won't work when you initialize the effect in a place other than the draw method. I'll see if I can get it to work.

Once this happens, you should be able to move the camera around independent of the animation. A possible reason why it might look screwy is because you are looking at the model every frame, which would make it seem like the model never moves.

If you want to control when your animation stops, there will be more functionality for this in the future. For now, you can make a class that inherits AnimationController, and manually set enabled to false when you want the animation to stop. This would occur in the update method.
Coordinator
Nov 27, 2006 at 3:19 AM
As for sukh, since my computer died at home :(, I need to rewrite the code for allowing your model to be animated, so it may not be ready today.
Coordinator
Nov 27, 2006 at 3:45 AM
Yah... I lost a good amount of work.. which is extremely frustrating to say the least. I've also been busy this past week with thanksgiving and family/friend business, so the issues have been stacking up.

Now that I'm back on my main comp and have some spare time, I'll see if I can knock these issues out tomorrow.
Nov 27, 2006 at 4:33 AM
so once i set the worldview to that code, i should be able to move the camera around, correct?

and, i've figured out the .Enabled stuff and i can enable and disable the controller at will, but is it possible to handle the events or do i have to make a subclass to find out when the events specified in the class happen?

and has anyone looked at my .x file yet? help on that would be greatly appreciated.

~Jonathan
Coordinator
Nov 27, 2006 at 5:27 AM
Yes, you should be able to move the camera around at will, independent of the world, IF you use an effect that makes a distinction between world and worldview.

The animation controller needs to use the world matrix in order to do the animations. But, to give you enough flexibility, there is a world matrix on the animation controller that you can use to set the location of your animated model. Also, the animation controller does not touch the view or projection matrices, so you can do whatever you want with those.

I'm working on getting the code I wrote over the last week to work again. Once that is done, I'll have a look at your model.

It is easy to see when events occur. Here is an example:

controller.AnimationReset += new EventHandler(controller_AnimationReset);

void controller_AnimationReset(object sender, EventArgs e)
{
// TODO: Write your code for when the animation resets here
}


I will give a lot more documentation/examples on the controller once it is completely stable and a very flexible set of features is in place. The alpha release was mainly to get early feedback, and to help find bugs, since it is very difficult to debug an animation controller alone. This is because all exporters will have slight quirks that make them write the data in a slightly different format, and I only have access to the blender exporter (and I have thoroughly debugged it on blender exported models).
Coordinator
Nov 27, 2006 at 5:42 AM
Ok, I had a look at your file and the problem is that the joints for the arms are not included in the file, and they are being referenced as if they were there. This will make the file not work for any .X viewer. This seems to be a common problem, so I'll add a more informative error message to the importer for the next release.

If you want a better understanding, you can read the following, but it may be a bit too complex. In every .X file for "skinned" meshes, which are just meshes with bones (armatures in blender), each bone has a section called a SkinWeights section. In this section, the bone name will be listed first, and then a list of vertices that are "attached" to that bone are listed. However, each bone is defined by a transformation matrix that represents the "bind pose" of that bone (again I won't go into this). The problem is that the SkinWeight section for the arms appears in the file, but the transformation matrix for the arm bones is never defined.

Are you doing this with blender? If so, I may be able to help.
Coordinator
Nov 27, 2006 at 10:26 PM
sukh5684, I have everything working for your model, but have one question:

Is the model that you uploaded centered in the screen? Did you export it for a left handed coordinate system? I can't figure out where it is in world coordinates. I just want to make sure everything is working before a release.

As soon as you can confirm that it is not centered in the model editor, then I can release the example.
Nov 28, 2006 at 12:42 PM
I made the model in 3DS max and yes I think they use a right-hand coordinate system, cos i had to rotate the model to get it standing upright. so it shouldn't be a problem. Thankyou so much dastle i really appreciate your help and hard work.
Nov 28, 2006 at 1:43 PM
here is a screenshot of my model in 3ds max, http://www.durhailay.co.uk/model_screen.bmp
Developer
Nov 28, 2006 at 2:42 PM
With Change Set: 12183, textures disapeared from models displayed by AnimationController.

David, can you please give a clue why is that happening?
I can't figure out how to fix it.

Coordinator
Nov 28, 2006 at 3:37 PM
Whoops, the TextureEnabled property defaults to false...

Here is how you can enable it on a skinned model:

foreach (ModelMesh mesh in model.Meshes)
{
foreach (BasicPaletteEffect effect in mesh.Effects)
{
effect.World = Matrix.Identity;
effect.View = Matrix.CreateLookAt(
new Vector3(0, 0, 1000),
new Vector3(0, 0, 0),
Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(
MathHelper.PiOver4,
(float)port.Width / port.Height,
.1f,
100000.0f);
effect.TextureEnabled = true;

}
}
Coordinator
Nov 28, 2006 at 3:40 PM
In response to sukh:
The model that you posted in the .X format only has part of the body and the head. I assumed that this was intentional to protect your work, but if not, then I'd reexamine your exporter. Make sure the directx viewer properly views it.
Developer
Nov 28, 2006 at 4:04 PM
Thanks for pointing this out. Texture works now.
Nov 28, 2006 at 4:37 PM
Here is a exported model that appears correctly but I don't think it animates http://www.durhailay.co.uk/test2.X
Coordinator
Nov 28, 2006 at 5:25 PM
Im going to hold off on the release of the dll till later today or tomorrow, because I'm about to perform another surgery on the code so that it uses a new data structure to store animations.
Nov 29, 2006 at 12:39 AM
ty so much for the help. Yes i am using blender. I am using the default .x exporter that is included in it. I made a model of a man, made an armature and bones, correctly defined the vertex groups, made the animation with the keyframes, and exported it. What settings should i use for the exporter?
Coordinator
Nov 30, 2006 at 5:31 PM
Sounds like you did everything properly. The settings for the blender exporter don't matter much (but make sure you are using the latest one. Google for it: there are a few out there.) The most important thing is that the bones fit inside the mesh correctly. I would try deleting the armatures and remaking them, and make sure that all the armatures are stored inside one object.
Coordinator
Nov 30, 2006 at 5:32 PM
Sorry that I haven't gotten the next release out yet, which I planned to have done by now. There are two reasons for this:

1. (the main reason) I'm currently having a lot of trouble getting to sleep. I've been up for about 24 hours now :(
2. I'm knee deep in a final project for robotics programming
Nov 30, 2006 at 10:16 PM
don't worry about getting it out... your robotics project is MUCH more important! thanks again for the help, i'll try making different armatures again and see if that helps. I also realized why you were a little confused about my reset() thing. After successfully making the event handler, i realized that the reset event is only called when u MANUALLY reset it as opposed to the automatic cycle of frames going back to the start. It would be useful if the controller had a reference to what frame the animation is currently on, or had an event (i can't figure out how to add one with a subclass yet) for whenever the frames start over.

THANK YOU
Coordinator
Nov 30, 2006 at 11:59 PM
Don't worry, I'm not losing sleep over the codeplex library :)

I'll add a property that gives the elapsed animation time, and thanks for the idea.
Dec 1, 2006 at 1:41 AM
np. i made another animation with blender and.... it sort of worked. by sort of, i mean not. It displayed some bugged out screwed up box in the x viewer and gave an error in the xna.

http://upload2.net/page/download/2rScK79SoNxAOFS/flu.x.html

http://upload2.net/page/download/FIBipVQ5KioRRKw/flu.blend.html

there the .blend and .x files are. good luck figuring out what i'm doing wrong.

Thanks again!
Coordinator
Dec 4, 2006 at 5:47 AM
I'll get back on these issues after I get things straightened out for finals. I'm not going to rush things - I want to make sure each release from here on out is as stable as possible.

Sorry for not releasing the next dll (this especially refers to sukh), but if you want to run your animation, the source code will always be up to date, and you can compile that into a dll.

Im extremely busy right now with school since its finals time, but I'll get back to this codeplex project asap.
Dec 11, 2006 at 5:45 AM
could someone look at my files and/or write a tutorial for how to make a skeleton actually work with the .x exporter?
Coordinator
Dec 13, 2006 at 5:04 AM
You mean for blender?

Which exporter version are you using?
Coordinator
Dec 14, 2006 at 11:54 AM
Sukh: Model loads fine with latest source code release, so problem solved.
Dec 15, 2006 at 8:17 PM
When I used the component in my code I got it to render but with visual errors.
The bear sub-meshes get rendered on top of each other as if there's no Z Buffer.

My app is using the AnimationController class. Am I missing a configuration option? Am I messing it up with conflicting configuration for other objects rendered in my app?

Thanks
Coordinator
Dec 16, 2006 at 2:04 AM
The bear is one mesh and contains no submeshes, so I can't see why it would have depth buffer problems. Is it possible that you are referring to odd lighting? The lighting is messed up because
1. There was a bug in the lighting for that dll that have been fixed in the source since then. The dll was just intended to see if cross-culture float parsing worked
2. The normals were exported incorrectly from blender for the Mesh, so it will be displayed incorrectly in the X Viewer as well
Coordinator
Dec 16, 2006 at 2:15 AM
See if it renders differently in the X viewer than it does in your xna window. Also, testing it on tiny.x or other complex models would be helpful if it does render differently in the X viewer.
Dec 16, 2006 at 1:58 PM
By X Viewer you mean Animation.ModelViewer or an external DirectX app? I tried it in my code using Animation.ModelViewer. It shows up with the same bugs. I was inaccurate in describing what I see though, I said I saw just the bear get rendered with incorrect z-order (with respect to its limbs - That's what I meant by sub-meshes, my mistake). The bear parts actually get rendered on top of the entire scene, no matter if I place them behind other objects.

Important to note, when displaying the exact same bear XNB using the SimpleDemo project, I see it just fine.

Assuming this is a lighting issue... I'm using this version animationcomponents-13900.zip I'll download the latest and give it a try.

Thanks
Dec 16, 2006 at 2:17 PM
Well it's still the same even with the latest version. Next step is to go to my code and disable any setting I make to XNA, see what's causing the trouble.

I've got this image here that shows the artiact: http://server6.theimagehosting.com/image.php?img=Odd Bear.JPG.
Maybe it'll make more sense.
Coordinator
Dec 16, 2006 at 3:44 PM
Sounds like you disabled the Z buffer somewhere in your code:
graphics.GraphicsDevice.RenderState.DepthBufferEnable = false;

This would cause the behavior seen in your screenshot.
Dec 16, 2006 at 4:47 PM
I'm using blender 2.42a with .x exporter "DirectX Exporter (for Blender 2.41)" by Arben OMARI. I think i downloaded the latest version of blender a month or so ago. should i perhaps get blender 2.41 to see if the problem is the failure of backwards compatability with 2.42a?
Dec 16, 2006 at 9:31 PM
I thought if it before and checked. There was no where in the code that does that.
Just to make sure I placed

IGraphicsDeviceService graphicsService = (IGraphicsDeviceService)game.Services.GetService(typeof(IGraphicsDeviceService));
GraphicsDevice device = graphicsService.GraphicsDevice;
device.RenderState.DepthBufferEnable = true;

Right before mesh.Draw() in AnimationController.Draw()

It fixed the problem. I can't really explain it. I made sure I call only DepthBufferEnable = true throughout the code. Is there anything else that might implicitly change that?

Thanks for your replies
Dec 16, 2006 at 9:40 PM
Hi all, firstly thanks for this great initiative. I still can't believe they did not send any animation support with XNA. Anyways, I was hoping you could tell me what I might be doing wrong with my program. I have made an animated model in 3ds max 6 and exported it with PandaX. Once loaded, I got an error saying there were too many bones so I dropped some out. Now it throws this: "An entry with the same key already exists." What does that mean, and how can I fix it?
Thanks again
Dec 16, 2006 at 9:41 PM
OK, figured it out. It was my mouse cursor rendering method (SpriteBatch based).
Sorry for the hassle, and thanks for your help.
Coordinator
Dec 16, 2006 at 10:54 PM
In response to SavyCat:

The error you are getting is because the panda exporter gives the same names to bones and meshes. This problem was fixed in the source code, but exists in the dll for the released example.

In response to 99jonathan, I would try this exporter:

http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?p=93694&sid=7e62e629f7db786a5978014bd3ebf659
Dec 17, 2006 at 4:15 AM
Thanks Dastle, so what you're saying is that I should recompile the source into a new dll? I cant do it till tomorrow coz its really late now; but in theory that will help? thanks once again
Coordinator
Dec 17, 2006 at 4:52 AM
Yes, although you need to now split up the source into two projects.
Dec 17, 2006 at 1:49 PM
Ok I will give it a try; but forgive me if I am a bit of a noob, or if I have misread the site... are there any instrucions for that? Oh and if you're still looking for animated models - i have done quite a few, so just let me know and i will send u some :)
Dec 17, 2006 at 2:05 PM
Okay I got the library to compile, but still no luck with my models. Just a different error. Now it tells me that an index is out of range when I reach the function 'InterpolationTable' in the class bonePoseTable.

public Matrix[] GetPose(ref int frameNum)
{
return bonePosesframeNum;
}
frameNum was -1 when I debugged it.

The model that you sent with your demo works fine - but none of mine seem to work. Im not sure where im going wrong.. could I send u my model and xfile to see if u can spot what I may be doing?
Coordinator
Dec 17, 2006 at 2:08 PM
Yes you can, and it would be much appreciated (david_astle@hotmail.com)

The panda exporter is one I don't have access to, so it's the one that is currently least likely to work. But I have some example models, I'm sure I can get them to work.

Thanks.
Coordinator
Dec 17, 2006 at 2:09 PM
By the way, I just woke up - some coincidence that it was 3 minutes after your post, since I almost never wake up this early
Dec 17, 2006 at 3:54 PM
Okay, I sent you the x file. Its got quite a few bones, so it might be a good tester for complicated files.
Coordinator
Dec 17, 2006 at 9:34 PM
Yeah, the compile error you were getting was due to the animation speed being too fast, causing a floating point NaN. Can be easily fixed by putting an

AnimTicksPerSecond {
25;
}

in the file.

But, after that, only half the model displays correctly. I think it has to do with the model having 7 influences per vertex for some verts, which is pushing it to the limit. Hopefully I can find out exactly what is happening and fix it within the next couple days.
Dec 18, 2006 at 1:58 AM
ok, i got the exporter, it works fine except (of course) the ANIM button won't go down because i "don't have any 3d windows open"... uh... what the heck does it mean?

thanks again for the help

~Jonathan
Coordinator
Dec 18, 2006 at 3:08 AM
SavyCat:

I fixed the problem, and the model now animates correctly. I uploaded the latest source code and sent an updated project.

99jonathan:

You need to split your windows when exporting so that a 3d view window is open. To do this, go to the side of the screen, right click, and select "split area." Then make one of the two areas 3d view.
Dec 18, 2006 at 11:22 PM
So... I figured out how to split the screen. Guess whats wrong now? My man i made apparently has a multiple hierarchy bone structure. How do I fix that? And, I used another model, (the one with the link up there) but it gave an error about File "(string)" and a typeerror with the len() of unsized object.
Coordinator
Dec 18, 2006 at 11:42 PM
1. Fix it by making all the bones attached to eachother in blender and by making them all part of the same armature object. This is an annoying quirk of blender, and it won't export if you don't do this.

2. The file above contains absolute paths to textures, which XNA doesn't allow. Also, the textures don't exist, so you'll have to remove them. Also, that model contains no animations so it's not very interesting to look at.

I'm trying to get a model with multiple animations that I have permission to distribute for an example of how to make a model walk. Then I will make the sample, make sure it runs on xbox, and have the next release.

Getting the model is far from easy however. High quality models, and especially animations for them, are not easy to make, and there really isn't even a single free skinned animation that you can google for.
Coordinator
Dec 18, 2006 at 11:43 PM
Blender is not very good for animation because the community has yet to make a good exporter. One of these days I might tackle that...

Maya and 3ds are really the best for this; too bad they cost tons of money.
Jan 3, 2007 at 7:44 PM
I downloaded your simple demo of the bear animation which I was able to compile and seems to work fine. I exported a .x file using the latest Panda exporter for 3ds max 8. I also downloaded the lastest source of the animation components and compiled a new DLL.

Now when I add this new .x file and compile I get the following error:

<start of error>

Error 3 Building content threw Exception: Failed to parse System.Single at token number 177026
value: SkinEyeWhiteSub1
Surrounding tokens:
,0,0,0,0,0;{SkinSkinSub0}{*SkinEyeWhiteSub1}{SkinIrisSub2}{SkinPupilSub3}{SkinMouthSub4}}XSkinMeshHeader{4;
at Animation.Content.XFileTokenizer.Throw(Type type)
at Animation.Content.XFileTokenizer.NextFloat()
at Animation.Content.AnimatedModelImporter.AnimatedMeshImporter.ImportMaterial()
at Animation.Content.AnimatedModelImporter.AnimatedMeshImporter.ImportMaterialList()
at Animation.Content.AnimatedModelImporter.AnimatedMeshImporter.ImportMesh()
at Animation.Content.AnimatedModelImporter.ImportNode()
at Animation.Content.AnimatedModelImporter.ImportNode()
at Animation.Content.AnimatedModelImporter.ImportNode()
at Animation.Content.AnimatedModelImporter.ImportRoot()
at Animation.Content.AnimatedModelImporter.Import(String filename, ContentImporterContext context)
at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1.Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import(String filename, ContentImporterContext context)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAssetDirectly(BuildItem item, String importerName)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAndLoadAsset(BuildItem item, BuildItem requestingItem)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAssetViaCache(BuildItem item, String importerName)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, ITaskItem[] sourceAssets, TaskLoggingHelper msbuildLog, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates) C:\Documents and Settings\hamilts.ADS\My Documents\Visual Studio 2005\Projects\SimpleDemo\SimpleDemo\chameleon.X SimpleDemo


<end of error>


Here is an excerp from the .x file

MeshMaterialList {
5;
5798;
0,
<<< many lines removed >>>
0;
{ Skin_SkinSub0 }
{ SkinEyeWhiteSub1 } <<< line referenced in error
{ Skin_IrisSub2 }
{ Skin_PupilSub3 }
{ Skin_MouthSub4 }
}


Any suggestions on what the problem might be? I can provide the full .x file if you would like it.

Scott
Coordinator
Jan 3, 2007 at 8:41 PM
MeshMaterialList {
5;
5798;
0,
<<< many lines removed >>>
0;
{ Skin_SkinSub0 }
{ SkinEyeWhiteSub1 } <<< line referenced in error
{ Skin_IrisSub2 }
{ Skin_PupilSub3 }
{ Skin_MouthSub4 }
}

It is trying to parse a float when it gets there, so there may be less than 5798 numbers between the "5798;" line and the error line. Other than that, I can't see what would be wrong from a quick glance.