XNA (4.0) Custom Content Processing Problem

Started by
2 comments, last by Capoeirista 12 years, 4 months ago
Hey folks,

I'm trying to build a content pipeline extension that reads in an image and outputs a model (for height map generation), but I'm getting a problem with the content processor I've built; when I try and load the Image as a model I get the following error :


Error loading "CKEngineContent\HeightMaps\CKDefaultHeightMap". Cannot find ContentTypeReader CKEngineContentProcessor.CKTerrainHeightMapContentReader, CKEngineContentProcessor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.


So - I set up my content processor as follows :



namespace CKEngineContentProcessor
{
/// <summary>
/// Provides a custom content processor for converting an image file in to a heightmap
/// </summary>
[ContentProcessor(DisplayName = "CKTerrainHeightMapProcessor")]
public class CKTerrainHeightMapProcessor : ContentProcessor<TInput, TOutput>
{
...

// Tag the model as being a heightmap (need to build this still)
model.Tag = new CKTerrainHeightMapContent( imageHeightField );
}


And my content writer looks like this:



[ContentTypeWriter]
public class CKTerrainHeightMapContentWriter : ContentTypeWriter<CKTerrainHeightMapContent>
{
...

/// <summary>
/// Returns the writer's reader
/// </summary>
public override string GetRuntimeReader( TargetPlatform targetPlatform )
{
return typeof(CKTerrainHeightMapContentReader).AssemblyQualifiedName;
}

/// <summary>
/// The class type returned by this writer's reader
/// </summary>
public override string GetRuntimeType( TargetPlatform targetPlatform )
{
return typeof(CKHeightMap).AssemblyQualifiedName;
}
}


And here is the content reader:


/// <summary>
/// A reader for the CKTerrainHeightMapContentWriter class
/// </summary>
public class CKTerrainHeightMapContentReader : ContentTypeReader<CKHeightMap>
{
// ---------- Overridden Functions ----------

/// <summary>
/// Reads in values from a content reader to a height map instance
/// </summary>
protected override CKHeightMap Read( ContentReader input, CKHeightMap existingInstance )
{
...
}
}


Finally CKHeightMap is a very simple class that has a 2D vector of floating point values.

In my actual content project I've referenced the custom reader and set the content processor for the image I'm using to my CKTerrainHeightMapProcessor class... so for some reason my game project can't seem to correctly load the height map image. I've tried referencing the content pipeline extension project in my game project, but that doesn't seem to make any difference.

Any ideas what I'm doing wrong here?
Advertisement
I think I've found the problem - my reader class is in the content processing project, not the main game project

I think I've found the problem - my reader class is in the content processing project, not the main game project

Nope, that wasn't it - I moved the reader in to a project accessible by both the processor and the game projects and I still get the same error message.

Any ideas?



Nope, that wasn't it - I moved the reader in to a project accessible by both the processor and the game projects and I still get the same error message.

Any ideas?



Fixed.

Didn't have a reference to the content type project in the project that creates the executable... just the project that controls the engine.


This topic is closed to new replies.

Advertisement