Adding Support for 3D Models

Aug 6, 2012 at 1:32 PM
Edited Aug 7, 2012 at 3:58 AM

This is a great utility! Thanks a lot for creating it!

 

For anyone interested to add support for 3D Models (.X and .fbx), there are two small additions to be made:

 

1) Form1.cs

Right near the top of the file in the method private void LoadFileTypes(), add an entry for the models in the combo box. Something similar to the following:

 

this.FileTypes.Add(new ComboItem("3D Models", "3D Models (*.fbx;*.X)|*.fbx;*.X"));

 

 

2) ContentBuilder.cs

In #region Initialization, specifically in the public ContentBuilder() constructor, add the following two lines:

 

Importers.Add(new ComboItem(".X", "XImporter", "ModelProcessor"));
Importers.Add(new ComboItem(".fbx", "FbxImporter", "ModelProcessor"));

 

When adding the models in the utility to be compiled, it is not necessary to also add the corresponding textures - all necessary textures will be automatically compiled into additional .xnb files alongside the models. Just add the .fbx or .X files in the utility.

 

EDIT: Compiling .fbx files works correctly. However, apparently compiling .X files does not work. Since I always work with .fbx files and they compiled with no problems, I assumed that the same would be true with .X files, since the "XImporter" class is defined in the Microsoft.Xna.Framework.Content.Pipeline namespace (http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.content.pipeline(v=xnagamestudio.40).aspx). Does anyone have a solution?

Coordinator
Aug 7, 2012 at 11:40 AM

Hi, I will verify for you what's the problem. I'm think this involved some references.