Table of Contents

Class ContentProcessorContext

Namespace
Microsoft.Xna.Framework.Content.Pipeline
Assembly
MonoGame.Framework.Content.Pipeline.dll

Provides access to custom processor parameters, methods for converting member data, and triggering nested builds.

public abstract class ContentProcessorContext
Inheritance
ContentProcessorContext
Derived
Inherited Members

Constructors

ContentProcessorContext()

Initializes a new instance of ContentProcessorContext.

public ContentProcessorContext()

Properties

BuildConfiguration

Gets the name of the current content build configuration.

public abstract string BuildConfiguration { get; }

Property Value

string

IntermediateDirectory

Gets the path of the directory that will contain any intermediate files generated by the content processor.

public abstract string IntermediateDirectory { get; }

Property Value

string

Logger

Gets the logger interface used for status messages or warnings.

public abstract ContentBuildLogger Logger { get; }

Property Value

ContentBuildLogger

OutputDirectory

Gets the output path of the content processor.

public abstract string OutputDirectory { get; }

Property Value

string

OutputFilename

Gets the output file name of the content processor.

public abstract string OutputFilename { get; }

Property Value

string

Parameters

Gets the collection of parameters used by the content processor.

public abstract OpaqueDataDictionary Parameters { get; }

Property Value

OpaqueDataDictionary

SourceIdentity

Gets the ContentIdentity representing the source asset imported.

public abstract ContentIdentity SourceIdentity { get; }

Property Value

ContentIdentity

TargetPlatform

Gets the current content build target platform.

public abstract TargetPlatform TargetPlatform { get; }

Property Value

TargetPlatform

TargetProfile

Gets the current content build target profile.

public abstract GraphicsProfile TargetProfile { get; }

Property Value

GraphicsProfile

Methods

AddDependency(string)

Adds a dependency to the specified file. This causes a rebuild of the file, when modified, on subsequent incremental builds.

public abstract void AddDependency(string filename)

Parameters

filename string

Name of an asset file.

AddOutputFile(string)

Add a file name to the list of related output files maintained by the build item. This allows tracking build items that build multiple output files.

public abstract void AddOutputFile(string filename)

Parameters

filename string

The name of the file.

BuildAndLoadAsset<TInput, TOutput>(ExternalReference<TInput>, string)

Initiates a nested build of the specified asset and then loads the result into memory.

public TOutput BuildAndLoadAsset<TInput, TOutput>(ExternalReference<TInput> sourceAsset, string processorName)

Parameters

sourceAsset ExternalReference<TInput>

Reference to the source asset.

processorName string

Optional processor for this content.

Returns

TOutput

Copy of the final converted content.

Type Parameters

TInput

Type of the input.

TOutput

Type of the converted output.

Remarks

An example of usage would be a mesh processor calling BuildAndLoadAsset to build any associated textures and replace the original .tga file references with an embedded copy of the converted texture.

BuildAndLoadAsset<TInput, TOutput>(ExternalReference<TInput>, string, OpaqueDataDictionary, string)

Initiates a nested build of the specified asset and then loads the result into memory.

public abstract TOutput BuildAndLoadAsset<TInput, TOutput>(ExternalReference<TInput> sourceAsset, string processorName, OpaqueDataDictionary processorParameters, string importerName)

Parameters

sourceAsset ExternalReference<TInput>

Reference to the source asset.

processorName string

Optional processor for this content.

processorParameters OpaqueDataDictionary

Optional collection of named values available as input to the content processor.

importerName string

Optional importer for this content.

Returns

TOutput

Copy of the final converted content.

Type Parameters

TInput

Type of the input.

TOutput

Type of the converted output.

Remarks

An example of usage would be a mesh processor calling BuildAndLoadAsset to build any associated textures and replace the original .tga file references with an embedded copy of the converted texture.

BuildAsset<TInput, TOutput>(ExternalReference<TInput>, string)

Initiates a nested build of an additional asset.

public ExternalReference<TOutput> BuildAsset<TInput, TOutput>(ExternalReference<TInput> sourceAsset, string processorName)

Parameters

sourceAsset ExternalReference<TInput>

Reference to the source asset.

processorName string

Optional processor for this content.

Returns

ExternalReference<TOutput>

Reference to the final compiled content. The build work is not required to complete before returning. Therefore, this file may not be up to date when BuildAsset returns but it will be available for loading by the game at runtime.

Type Parameters

TInput

Type of the input.

TOutput

Type of the output.

Remarks

An example of usage for BuildAsset is being called by a mesh processor to request that any related textures used are also built, replacing the original TGA file references with new references to the converted texture files.

BuildAsset<TInput, TOutput>(ExternalReference<TInput>, string, OpaqueDataDictionary, string, string)

Initiates a nested build of an additional asset.

public abstract ExternalReference<TOutput> BuildAsset<TInput, TOutput>(ExternalReference<TInput> sourceAsset, string processorName, OpaqueDataDictionary processorParameters, string importerName, string assetName)

Parameters

sourceAsset ExternalReference<TInput>

Reference to the source asset.

processorName string

Optional processor for this content.

processorParameters OpaqueDataDictionary

Optional collection of named values available as input to the content processor.

importerName string

Optional importer for this content.

assetName string

Optional name of the final compiled content.

Returns

ExternalReference<TOutput>

Reference to the final compiled content. The build work is not required to complete before returning. Therefore, this file may not be up to date when BuildAsset returns but it will be available for loading by the game at runtime.

Type Parameters

TInput

Type of the input.

TOutput

Type of the output.

Remarks

An example of usage for BuildAsset is being called by a mesh processor to request that any related textures used are also built, replacing the original TGA file references with new references to the converted texture files.

Convert<TInput, TOutput>(TInput, string)

Converts a content item object using the specified content processor.

public TOutput Convert<TInput, TOutput>(TInput input, string processorName)

Parameters

input TInput

Source content to be converted.

processorName string

Optional processor for this content.

Returns

TOutput

Reference of the final converted content.

Type Parameters

TInput

Type of the input content.

TOutput

Type of the converted output.

Convert<TInput, TOutput>(TInput, string, OpaqueDataDictionary)

Converts a content item object using the specified content processor.

public abstract TOutput Convert<TInput, TOutput>(TInput input, string processorName, OpaqueDataDictionary processorParameters)

Parameters

input TInput

Source content to be converted.

processorName string

Optional processor for this content.

processorParameters OpaqueDataDictionary

Optional parameters for the processor.

Returns

TOutput

Reference of the final converted content.

Type Parameters

TInput

Type of the input content.

TOutput

Type of the converted output.