共用方式為


Standard Importers and Processors

Describes the standard Content Pipeline importers and content processors of XNA Game Studio that support various common art asset file formats.

Importers and content processors are implemented as assemblies. In addition to the standard ones provided by XNA Game Studio and listed below, you can also use custom importers and processors developed by you or third parties. Use the Properties window to assign an appropriate importer and processor to each game asset added to your game project (see Using dialog properties for more information).

Standard Importers

The following is a description of the standard importers shipped with XNA Game Studio and the type of game asset each supports.

All standard importers are declared as part of the Microsoft.Xna.Framework.Content.Pipeline namespace.

Name Type name Output type Description
Autodesk FBX FbxImporter NodeContent

Imports game assets specified with the Autodesk FBX file format (.fbx).

This importer is designed to work with assets exported with the 2006.11 version of the FBX exporter.

Effect EffectImporter EffectContent Imports a game asset specified with the DirectX Effect file format (.fx).
Sprite Font Description FontDescriptionImporter FontDescription Imports a font description specified in a .spritefont file.
Texture TextureImporter TextureContent Imports a texture. These file types are supported: .bmp, .dds, .dib, .hdr, .jpg, .pfm, .png, .ppm, and .tga.
X File XImporter NodeContent Imports game assets specified with the DirectX X file format (.x). This importer expects the coordinate system to be left-sided.
XACT Project N/A N/A

Imports game audio specified in the Microsoft Cross-Platform Audio Creation Tool (XACT) format (.xap file).

Bb447762.note(en-us,XNAGameStudio.41).gifTip
Associating an .xap file with XACT allows you to automatically open XACT when editing any .xap file.

To associate the file in XNA Game Studio

  1. In Solution Explorer, right-click the .xap file, and then click Open With.
  2. In the dialog box, select the XACT-specific string, and then click Set As Default.

To run XACT

If the XACT-specific option is unavailable, you must run XACT before this option appears. The application is available from the Microsoft XNA Game Studio group.

  • On the Start menu, click Tools, and then click Microsoft Cross-Platform Audio Creation Tool (XACT) .
XML Content XmlImporter object

Imports XML content used for editing the values of a custom object at run time. For instance, you could pass XML code to this importer that looks for the specified property of a custom type and changes it to the specified value. You could then process the custom object with a processor or pass it to your game untouched using the No Processing Required processor.

This importer is designed for scenarios like importing an XML file that describes game data at run time (similar to the Sprite Font Description importer) or importing terrain data in an XML file that then is passed to a processor that generates a random terrain grid using that data.

Standard Content Processors

XNA Game Studio ships with a variety of processors that support several common game asset types. Many of the standard processors, such as the TextureProcessor, support parameters for modifying the default behavior of the processor. For more information, see Parameterized Processors.

The following describes the standard processors and the type of game asset each supports.

Name Type name Input type Output type Description
Model ModelProcessor NodeContent Class ModelContent Class

A parameterized processor that outputs models as a ModelContent Class object.

Available parameters:

  • Color Key Color–Any valid Color. Magenta is the default value.
  • Color Key Enabled–A Boolean value indicating if color keying is enabled. The default value is true.
  • Generate Mipmaps–A Boolean value indicating if mipmaps are generated. The default value is false.
  • Generate Tangent Frames–A Boolean value indicating if tangent frames are generated. The default value is false.
  • Resize Textures to Power of Two–A Boolean value indicating if a texture is resized to the next largest power of 2. The default value is false.
  • Scale–Any valid float value. The default value is 1.0.
  • Swap Winding Order–A Boolean value indicating if the winding order is swapped. This is useful for models that appear to be drawn inside out. The default value is false.
  • Texture Format–Any valid SurfaceFormat value. Textures are either unchanged, converted to the Color format, or DXT Compressed. For more information, see TextureProcessorOutputFormat.
  • X Axis Rotation–Number, in degrees of rotation. The default value is 0.
  • Y Axis Rotation–Number, in degrees of rotation. The default value is 0.
  • Z Axis Rotation–Number, in degrees of rotation. The default value is 0.
No Processing Required PassThroughProcessor Object Object

Performs no processing on the file.

Select this processor if your content is already in a game-ready format (for example, an externally prepared DDS file) or a specialized XML format (.xml) designed for use with XNA Game Studio.

Sprite Font Description FontDescriptionProcessor FontDescription SpriteFontContent Converts a .spritefont file specifying a font description into a font.
Sprite Font Texture FontTextureProcessor TextureContent SpriteFontContent

A parameterized processor that outputs a sprite font texture as a SpriteFontContent object.

Available parameters:

  • First Character–Any valid character. The space character is the default value.
Sprite Font Texture FontTextureProcessor Texture2DContent SpriteFontContent Converts a specially marked 2D bitmap file (.bmp) into a font. Pixels of Color.Magenta are converted to Color.Transparent.
Texture TextureProcessor TextureContent Class TextureContent Class

A parameterized processor that outputs textures as a TextureContent Class object.

Available parameters:

  • Color Key Color–Any valid Color. Magenta is the default value.
  • Color Key Enabled–A Boolean value indicating if color keying is enabled. The default value is true.
  • Generate Mipmaps–A Boolean value indicating if mipmaps are generated. The default value is false.
  • Resize to Power of Two–A Boolean value indicating if a texture is resized to the next largest power of 2. The default value is false.
  • Texture Format–Any valid SurfaceFormat value. Textures are either unchanged, converted to the Color format, or DXT Compressed. For more information, see TextureProcessorOutputFormat.
XACT Project N/A N/A N/A Generates audio assets from an XACT project.

See Also

Adding Content to a Game
What Is Content?
Adding a Custom Importer