Hey all,
I was just curious if there's any way to add a Model from a .x file to the project by code (ie- without using the GSE's asset creation functionality).
I've disected my .csproj file, and I got something like the following, but I don't really know how to translate this to code.

Adding a .x Model to the Pipeline by hand
Tryin2Bgood
Shawn Hargreaves has posted on how to write a msbuild project file that just does content pipeline builds here. MSBuild is very flexible and its quite easy, once you understand the basic structure of build projects, to make it do what you want - for example it would be quite easy to make it use wild cards to build any file instead of specifying file names inside the build file.
Cheers,
Leaf.
JustinS
That's a great help, thanks so much for the very informative post.
I look forward to figuring all this out, and hopefully writing up a guide detailing my experience coding a 3d game in IronPython using XNA. I don't think it's something that's been done to any great extent yet, and I'd love to provide extensive documentation.
paolob
WilderLand
MSBuild gives me a lovely "obj" folder (with subfolder Windows that holds ContentPipeline.xml and House~0.xml) and a "bin" folder (sub windows with house.xnb).
I'd imagine that my next step is to tell my GraphicsProvider to use that ContentPipeline.xml file as my ContentPipeline, correct This is something that typically the GSE provides for us, but does anyone know exactly what goes on internally to compile a .cs file "with" the content pipeline
(Because I now need to do the equivalent, by hand, with a .py file, essentially).
I'll keep on googling around, I've found lots of fascinating stuff that's close to (but not exactly) what I want to be doing right now. I'm sure I'll figure it out, but if anyone knows the answer, and is willing to share it, that'd trump search engines :)
-Lee Bailey
Kris Nye
Cheers,
Leaf.
Mansoor Shiraz
content.Load[Model]("house")
One thing that might bite you is that the ContentManager defaults to using the executing assembly's directory as the root for locating content files. If you are using IPy this will be whereever ipy.exe is located. Fortunately the ContentManager has a second ctor that takes a string path to use as the root.
Cheers,
Leaf.
S_Parikh
The content pipeline is only needed to compile your meshes and textures. The *.cs or *.py source code is compiled separately (although in the case of Python I think maybe you just run the .py files directly without needing to compile them first Don't know exactly how that works).
Once you've run the content build, you will end up with .xnb files for all your built assets in the bin directory. You then just need to point your runtime game code at this directory, using the path parameter when you construct the ContentManager that you will be using the load the content into your game.
Nick Karasev
It's still not working correctly, content.Load<Model>("house") is returning False, but I think that might be an issue with Python's support (lack of ) for templating/generics.
When I get home from work, I'm going to try building a C# library with an overloaded (and renamed) version of ContentManager.Load() that always returns a model, just to simplify things on the python end. That should probably help a bit.
Thanks so much for all the help, guys
- Lee Bailey
(And yes, to answer you, you don't have to build IronPython, you just run the .py file with the ipy.exe interpreter. Sometimes, and I haven't figured out why exactly, you can get a .pyc file out of your .py, which windows recognizes as "Python Compiled Binary". As I understand it, this step is optional, and I haven't yet worried about the performance benefits this may have)