Loading Content

rated by 0 users
This post has 7 Replies | 2 Followers

Top 75 Contributor
Posts 47
SunBurn_Indie_Licensee
SunBurn_Pro_Licensee
Dave Posted: 02-25-2010 8:16 AM

As many have done before i need to create the Content Viewer for my team.

I have viewing normal meshes and animated meshes but what i really need is to be able to load these meshes from an outside source using say File\Open on a menu.

The main problem i come accross is loading the content and choosing the correct ContentPipeline. I need to choose the standard model processor and the custom SkinnedModel processor but can't seam to get it right.

I have taken a look into the WebForms demo but can't seam to get the animated SkinnedProcessor running.

Can you please advice

 

Top 10 Contributor
Posts 5,378
Employee
SunBurn_Studio_Licensee

Hi Dave,

I believe the WinForms example assumes the processor assemblies are in the Global Assembly Cache.

To get around this you can add a HintPath to the assembly's reference section of the project file.  To do this in the WinForms example I'm guessing something like this might work:


            // Register any custom importers or processors.
            foreach (string pipelineAssembly in pipelineAssemblies)
            {
                BuildItem item = msBuildProject.AddNewItem("Reference", pipelineAssembly);
                if(<skinning processor>)
                    item.SetMetadata("HintPath", <path to
skinning processor>);
            }


I'm not sure how you would detect if the model is skinned or not until after it's processed and loaded.  But you might be able to prompt the user to determine which processor to use.

Follow me on Twitter – development and personal tweets
Awesome XNA Videos – Lighting, Rendering, and game videos

Top 75 Contributor
Posts 47
SunBurn_Indie_Licensee
SunBurn_Pro_Licensee

Thanks for the idea, i will give this a try.

I don't mind having a seperate menu items to load Animated through the SkinnedModelProcessor
and load normal mesh

Thanks i will post results once i've triied this.

Top 75 Contributor
Posts 47
SunBurn_Indie_Licensee
SunBurn_Pro_Licensee

I'm still having problems with the ContentProcessor,

I'm trying to get sgMotion working as this has been integrated with Sunburn.

 I've added this in the contentbuilder.cs (CreateBuildProject)

foreach (string pipelineAssembly in pipelineAssemblies)

{

BuildItem item = msBuildProject.AddNewItem("Reference", pipelineAssembly);

if(item.Include == "SgMotionPipeline.Pipeline.SkinnedModelProcessor")

item.SetMetadata("HintPath", "C:\\Documents and Settings\\Lyrical\\Desktop\\XNAViewer\\sgMotion_Release_1.0.0\\sgMotionPipeline\\bin\\x86\\Debug\\XNAnimation.dll");

}

 I'm using the .Load<SkinnedModel>(???) to load my model but this is always returning

SkinnedModeProcessor not found

I'm at a loss on what i can do next.

 

Top 10 Contributor
Posts 5,378
Employee
SunBurn_Studio_Licensee

Hi Dave,

Try using Project.Save() to save the project file to disk, then open up the file in notepad to see what the xml looks like.  Make sure the hint path points to the assembly and that the assembly name and version in the xml match the actual assembly information.

A good way to see how the xml should look is to create a new test project, add the assembly to the project (by browsing for it), then open the project in notepad to see how the project xml looks - you'll need to reproduce the same assembly reference in your project file (though the hint path may be different, Visual Studio tries to use relative paths when possible).

Let me know if this helps!

Follow me on Twitter – development and personal tweets
Awesome XNA Videos – Lighting, Rendering, and game videos

Top 75 Contributor
Posts 47
SunBurn_Indie_Licensee
SunBurn_Pro_Licensee

Thanks John,

  I know where you are talking about and i can see the reference line, I will add these lines and see how it goes.

Top 75 Contributor
Posts 47
SunBurn_Indie_Licensee
SunBurn_Pro_Licensee

Please keep in mind i'm triing to add the sgMotion content pipeline to the Sunburn Winforms version

Here is the Sunburn implementation and sgMotion Pipeline Assemblies in the ContentBuilder : IDisposable class

 "SynapseGaming-SunBurn-" + LightingSystemManager.Edition + "-Processors, Version=" +                LightingSystemManager.Version + ", Culture=neutral, PublicKeyToken=" + LightingSystemManager.PublicKeyToken,
            
"XNAnimationPipeline, Version=0.7.0.0, Culture=neutral, PublicKeyToken=0c21691816f8c6d0",
       

 In the CreateBuildProject i changed the FOR loop to read

// Register any custom importers or processors.
foreach (string pipelineAssembly in pipelineAssemblies)
{
    BuildItem item =  msBuildProject.AddNewItem("Reference", pipelineAssembly);
    if (item.Include.Contains("XNAnimationPipeline"))
    {
        item.SetMetadata("HintPath",@"..\..\sgMotion Runtime\XNAnimation.dll");
    }
}

I also changed all the Model references to use the SkinnedModel from sgMotion

then finally changed the LoadModel() function where it adds the file to the contentBuilder

// Tell the ContentBuilder what to build.
contentBuilder.Clear();
contentBuilder.Add(fileName, "Model", null, "SkinnedModelProcessor");

 

 

When i load an animated model which i know works with the SkinnedModel in my other project
all it returns is a message stating it can't find the SkinnedModelProcessor.

I'm wondering if the actual SkinnedModelProcessor is not the main ContentProcessor name.

I will keep looking into this any additional help would be appreciated.

 

Top 75 Contributor
Posts 47
SunBurn_Indie_Licensee
SunBurn_Pro_Licensee

I've managed to get the sgMotion working with the Sunburn Pro WinForms application.

Thanks for all your help

I will be updating my main project and i will also work towards releaseing an update of the Win Forms Example for other Sunburn/sgMotion users.

I need to tidy code and make some additional features.

Page 1 of 1 (8 items) | RSS