PyOgre Tools using WinForms


25-04-2006 21:45:15

A few months back I was playing with PyOgre in an atempt to learn Python and Ogre at once. I set about creating a game tool using Windows .NET WinForms for the GUI and python as the renderer.

The following is the end result. Its barebones... basically its some stardard windows GUI components, responds to mouse and keyboard events, and renders a very basic ( and currently hard coded ) scenegraph to the screen. However, it does show two things very well. How to use Python with the .NET CLR for things like rendering, mouse feedback etc... And, how to work with Ogre ( pyOgre ) in a windowed application. I could find neither of these when I started working on it so this project would have been a great help for me :)

Warning, though... I knew nothing about Python programming... and it shows. The program structure is god aweful. That said this is the basis skeletal code that could easily be used to create simple tools. It consists of a tab control for putting your various controls/buttons/listboxes etc in, a VERY simple listbox in one of those controls, plus a render window that allows you to move around the scene holding down the left button and moving the mouse. Use the scroll wheel to zoom in and out.

* Note, it flickers like mad. Thats because im using RenderSingleFrame directly to my render surface. If I was going to keep work on it ( after re-writing to a decent design ) I would work on rendering to an offscreen texture then blitting all at once. That said, the flicker didnt really bother me.

Heres a screen shot. Yeah, not much too it.

You can get the sources here(about 7k in size)

You can get all binaries, example media here(about 10 megs in size)

Its nothing special, but hopefully it can help someone over some of the common lumps needed when developing tools. The only other dependancy other then pyOgre and obviously python, is you need a .NET compile python. I used python.NET but I think IronPython would have worked just as well.

Hope it helps someone.

EDIT: Uploaded the wrong (earlier) sources. Fixing as we speak. is your starting point.


27-04-2006 00:11:53

Looks cool.
And nice idea btw. I was thinking of using pyOgre before long, but never did.
So I will give your source code a hard look. Thank you for that ;)