Jump to content
  • Advertisement
Sign in to follow this  
Capoeirista

XNA (4.0) Custom Content Processing Problem

This topic is 2564 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement

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?

Share this post


Link to post
Share on other sites


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.


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!