Entity.SetMaterialName and paths?


22-08-2007 21:58:39

Hi, I'm pretty new at Mogre/Ogre and I'm having some problems with Entity.SetMaterialName(). I don't know if I'm asking in the correct forum, so forgive me if not. I should note that I'm still using Mogre 0.2.0 (not sure if this matters).

I'm working on a WinForms application using Mogre for the 3D. I'm also using IronPython embedded as a scripting language so that I may try ideas out on the fly.

I'm seeing some inconsistencies when I do the exact same thing in IronPython as opposed to C#. I don't think it's an IronPython problem (at least directly) as I'll explain in a bit.

Whenever I call SetMaterialName() on an instance of an Entity in C# I have no problems. I get exactly what I expected.

I have a "console" window in the application where I can type out Python code and have it executed immediately. When I type the equivalent Python code, in the console window, I also have no problem. So far, so good.

In order to save typing, the application lets you load a python script. When I load a script that calls SetMaterialName on an Entity instance, it crashes. There doesn't seem to be anything in the Ogre.log file to indicate why or that it crashed at all. The code in the script is the exact same code that I typed in the console window.

Then I had the idea that it could have something to do with paths. I copied the script to the application directory (also where Mogre lives), and when I browse for the script and execute it, now it works fine.

Does anybody have an idea why? Why should browsing to a file in another directory cause a crash?