# [C#] SkinInformation problem

## Recommended Posts

Hello everyone. I've written a class that loads and displays skinned meshes (using the .x file format) using LoadHierarchyFromFile. Works very good with full skinned meshes, and now I'm trying to add support for non-skinned meshes, but I've run into a small problem. In the CreateMeshContainer (override from AllocateHierarchy) function I get a SkinInformation object that can be null... and if so I want to create a new one. Seems pretty easy huh? The problem is that the SkinInformation constructor doesn't work (throws an application error exception) and I don't know if this is a bug of MDX or something else -___-' This is what I'm doing:
public override MeshContainer CreateMeshContainer(string name, MeshData meshData,
ExtendedMaterial[] materials, EffectInstance[] effectInstances,
{
if (meshData.Mesh == null)
throw new ArgumentException();

MeshContainerDerived container = new MeshContainerDerived();

container.Name = name;

if (skinInfo == null)
{
// the function crashes here
SkinInformation s = new SkinInformation(meshData.Mesh.NumberVertices,
VertexDeclarations.SimpleVertexSkinned, 1);
}
/******* non essential part *****/


meshData.Mesh is a valid object, NumberVertices is positive and finite (-> approx 300...), SimpleVertexSkinned is a custom Vertex Declaration I've already used, and 1...is one bone :D Any help will be really appreciated :D

##### Share on other sites
bump...(sorry :S )

##### Share on other sites
In order to help you out more, we would need to see output from the debug runtimes as well as the actual information from the exception itself.

As a side note, MDX is old and even officially deprecated, and will no longer be updated. Depending on how far you are with your project, I would suggest taking a look at SlimDX, which is extremely similar to MDX, but improves upon it in a number of ways. Also, if your bug occurs in both MDX and SlimDX, it's likely that the problem is your fault.

##### Share on other sites
Just an observation. I'm not familiar with MDX. However, in general terms, skin information contains frame information (i.e., the bones for skinning).

If you load a non-skinned mesh, which doesn't have a hierarchy (no bones) so SkinInfo is null, I'm not sure that you can force the container to have information it.. well, doesn't have.

SkinInformation is the result of the setup of a frame hierarchy; it doesn't create one. It appears that's what you're trying to do.

##### Share on other sites
"SkinInformation is the result of the setup of a frame hierarchy; it doesn't create one. It appears that's what you're trying to do."
In the engine I wrote in C++, I could create a "dummy" frame hierarchy with only one bone and assign it to a new skin information object.

Seems that with MDX this cannot be done.... I've taken a look at SlimDX, but at this point I think I'll return to C++ :)

Thank you :D

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627654
• Total Posts
2978447

• 10
• 12
• 22
• 13
• 33