@Walt_Niehoff wrote:
Let me level-set. I know very little about MonoGame and the way it should be used. On the other hand, I've been working with OpenGL since the mid-1990s, Open Rails, which uses XNA, more recently, and computer graphics in general since the late 1960s. Having had my first taste of success with a textured FBX model yesterday, I set out today to do some experiments to determine the way that the pipeline tool was meant to be used.
Between the tool's Help documentation and Chamillard's book "Beginning C# Programming with MonoGame," I got the idea that one should use the pipeline tool to set up (Visual Studio) MonoGame projects. (I no longer believe that.) I did two experiments today that led me to how I will use the pipeline tool, at least until somebody tells me the RIGHT way to use it.
I decided to try out creating a new project with the pipeline tool to see what it produced. I created a Test folder inside my Experiments folder. In the pipeline tool, I selected File/New, navigated to Test, and changed the default target filename from Tools.mgcb to MyTools.mgcb. I added a Content folder under MyTools and subfolders Models and Textures under MyTools. (Drag and drop is apparently not available in the tree pane.) With File Explorer, I copied an FBX model into Models. In the pipeline tool, I added the existing item to the Models folder. I saved the project and attempted to build it with the tool. It failed, not finding the texture image file referenced in the model. (I wanted to test using an unbuilt image file rather than an XNB file, just for academic reasons.) At this point, My project folder Test contains only folder Content and MyTools.mgcb. (It also contained a Textures folder that I mistakenly added outside the Contents folder. I deleted it in the pipeline tree pane, but that did not delete it physically.) At this point, I abandoned my intent to not create an XNB for the texture, and I physically moved the image file into the Textures folder with File Explorer, then added it in the tool’s tree pane. I did a File/Save and attempted a build. Two successes: the model and the texture. At this point, there is a bin folder and an obj folder in Test. In bin, there is a Content folder, with Models and Textures subfolders. In Models, there is an XNB file corresponding to my FXB model file. In Textures, there are two (I double-checked) XNB files, one corresponding to my single image file and one with a suffix of “0” added to the filename portion. Where did this come from? (In my successful run yesterday, only one XNB was built in the bin Textures folder – the one with the “0” suffix. In addition, the tool builds a shorter path to bin’s Contents folder. Starting from the project directory, the tool builds: Test\bin\Content. VS builds: Test\bin\Windows\x86\Debug\Content. In light of this, because of the apparent need to edit VS files (e.g., .csproj), I will set up my projects in VS first and use the pipeline tool as little as possible.
I created a totally separate solution (Test2), project name, Game1, with VS. Project type: MonoGame Windows Project. I added Textures and Models subfolders to Content. I added my FBX file only to the Models folder. I built the VS project. But no content was built as output. At this point, I turned to the pipeline tool. I opened the Content.mgcb in my VS project. There was no content reflected. Nevertheless, I created the content file tree with the FBX model, but no image, which had not yet been added physically. I built the content. It failed with the expected notification that the image file referenced in the FBX file was not found. I physically moved the image file into the VS project’s Contents\Textures folder, but I DID NOT ADD IT IN EITHER VS OR THE PIPELINE TOOL. I went to the pipeline tool and built the content. Surprise 1: It reported one successful build (the model) and no failures. Surprise 2: I went to VS and ran the program. There was my textured cube. Surprise 3: I checked the bin path, and there were two XNB files, one in Textures (with the “_0 suffix) and one in Models.
I am not yet willing to draw conclusions, but I’m thinking that I should do as much work as possible in VS. But, when it comes to building content, I should use the pipeline tool. But, it is not necessary to Add image files (as items) in either the VS or pipeline tool Textures folders when they are referenced in a model file. The build process apparently resolves the reference and creates the XNB for the image.
In my opinion, the Help documentation for the pipeline tool is just not thorough enough for the edification of newbs like me. Just like with a hammer or saw, newbs need guidance regarding how to use the tool.
Walt
Posts: 2
Participants: 2