XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Content processor problem n°.....

Last post 05-13-2008 1:21 PM by jwatte. 2 replies.
  • 05-11-2008 3:21 AM

    Content processor problem n°.....

    Hi people,

    I'm having a problem with the content processor. My setup is a "lib"-project containing all of my engine-parts, and a "windows"-application project. and now i inserted a "content extention" like it was said in the sample "HeightmapCollision".

    the content writer
        [ContentTypeWriter]
    public class HeightMapInfoWriter : ContentTypeWriter<HeightMapInfoContent>
    {
    protected override void Write(ContentWriter output, HeightMapInfoContent value)
    {
    output.Write(value.TerrainScale);

    output.Write(value.Height.GetLength(0));
    output.Write(value.Height.GetLength(1));
    foreach (float height in value.Height)
    {
    output.Write(height);
    }
    }

    public override string GetRuntimeType(TargetPlatform targetPlatform)
    {
    return base.GetRuntimeType(targetPlatform);
    }

    public override string GetRuntimeReader(TargetPlatform targetPlatform)
    {
    return typeof(HeightMapInfoReader).AssemblyQualifiedName;
    }
    }

     and the contentReader

        public class HeightMapInfoReader : ContentTypeReader<HeightMapInfo>
    {
    protected override HeightMapInfo Read(ContentReader input,
    HeightMapInfo existingInstance)
    {
    float terrainScale = input.ReadSingle();
    int width = input.ReadInt32();
    int height = input.ReadInt32();
    float[,] heights = new float[width, height];

    for (int x = 0; x < width; x++)
    {
    for (int z = 0; z < height; z++)
    {
    heights[x, z] = input.ReadSingle();
    }
    }
    return new HeightMapInfo(heights, terrainScale);
    }

    }


    And in the "windows application" i've added a reference for the content, changed the processor to the newly created terrain processor... and uess what?...
    It doesn't work :(

    At runtime it clames not to be able to find the reader???

    In several forums, there where several answers and none was relevant for my problem (tried them all)

    So hopefully there can be a conclusive answer on this matter, the one states that the reader and writer can live side by side in the same lib project... why????

    Hopefully someone can help me out with this...

    greetz
  • 05-12-2008 1:31 PM In reply to

    Re: Content processor problem n°.....

    What string is your GetRuntimeReader method returning? (this will be in the text of the exception message).

    Does your game actually contain an assembly with that same name? Does the type mentioned in this string exist inside that assembly?

    (as a general note for anyone else who might be reading this: if you are getting an exception it is useful if you can include the complete and exact text of the exception message, not just a simplified/reworded version of it)
    XNA Framework Developer - blog - homepage
  • 05-13-2008 1:21 PM In reply to

    Re: Content processor problem n°.....

    Note that the Reader should be in your engine library, or your windows app, not in the content pipeline assembly. Only the writer should be in the content extension.
    Also, you want to add a reference to the content pipeline extension to the Content sub-project of your Windows project, not the Windows project itself. Perhaps you've already done that.

    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
Page 1 of 1 (3 items) Previous Next