The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.31 (Linux)
|
PyGTK track editor idea - Printable Version +- Forums (https://www.vdrift.net/Forum) +-- Forum: Community (https://www.vdrift.net/Forum/forumdisplay.php?fid=3) +--- Forum: Cars & Tracks (https://www.vdrift.net/Forum/forumdisplay.php?fid=11) +--- Thread: PyGTK track editor idea (/showthread.php?tid=517) |
PyGTK track editor idea - thelusiv - 02-07-2007 I've been doing some PyGTK programming lately, and I've found it's fairly easy to set up a pretty good GUI using it with Glade to design the interfaces. It is pretty fast and ports to OS X and Windows very easily. There are bindings for Python to OpenGL as well as SDL, PyOpenGL and PyGame respectively. How's that for link saturation? So what I propose is to set up a GUI around a sort of viewport that will basically have inside it the track editor we already have. The gui would have lots of buttons to do things easily, like for instance add objects, move and edit them, set track parameters, export tracks to in-game readable format, etc. The "viewport" code could either consist of the C++ code we have for the track editor now, converted to Python, or it could be set up as an external C++ library that is used by Python. Python has bindings for lots of languages so this shouldn't be too hard. However it might make the code a little more managable to just convert to Python. Farther down the road we could probably even write code to generate road models based on user-input dimensions, and perhaps even import them directly into the editor. Perhaps we could get some ideas on how to do this from the Java-based open source TORCS track editor that generates roads. So, what do you guys think about Python and GTK? To me, the biggest advantage for Python is how easy it is to develop things quickly, and for GTK it's the cross-platform interface designer (Glade). - cotharyus - 02-07-2007 I'd say, based on the current situation with tracks, and the editor, that you've got something vastly superior to what we currently have in mind. I'd be interested in seeing how it turns out. It's been said many times that our tracks are our greatest weakness. - joevenzon - 02-07-2007 Sounds like a great idea. Also, although I'm not sure how much it'll help, it's nice that python is also used for all of the blender import/export scripts. I'm somewhat familiar with python (whitespace as a token? what were they thinking...) so I can help get you up to speed if you're not. - reece146 - 02-07-2007 I say go for it. At this stage it is more important to have a user friendly tool prototyped and workable for users than going back to first principles and coding something from scratch in C/C++. - thelusiv - 02-07-2007 OK, I will see what I can whip up in terms of basic gui and Python code to go with it. Hopefully others will be able to pick up on it and add things. I thought Python would be a good language to go with since, as Joe said, we use it for Blender export scripts. Also, our build system, SCons, is all written in Python (and its SConscript files are also all Python). So, the more Python knowledge our team has, the better, I say... Joe, when you mention using whitespace as a token, are you talking about how Python assumes code block nesting from indentation? At first this seems confusing to most people with C/C++ backgrounds but really it makes things way easier in the end. Not having to worry about the curly braces and what not is very nice. You just have to remember to be consistent. Personally, I do two spaces for indentation in Python. I might get something set up tonight, it will be very basic though. And yeah reece146, this tool could be viewed as a prototype that could then be rewritten in C++ later, or if it works well enough, it could just be used as the finished product. - reece146 - 02-07-2007 thelusiv Wrote:And yeah reece146, this tool could be viewed as a prototype that could then be rewritten in C++ later, or if it works well enough, it could just be used as the finished product. Yep, these days computers have so much power it doesn't matter if the coding language underlying a tool is not C or whatever since the CPU can power through most things, particularly if it is a non-real-time type app running on a single user box. Value add per user benefit and all that. - thelusiv - 02-07-2007 I'm working on setting up a basic Glade interface now. Also I found GtkGLExt which is an OpenGL extension for GTK. The Python binding for it is PyGtkGLExt which is available from the link above. - joevenzon - 02-07-2007 Quote:are you talking about how Python assumes code block nesting from indentation? At first this seems confusing to most people with C/C++ backgrounds but really it makes things way easier in the end. Not having to worry about the curly braces and what not is very nice Yep, that's what I'm talking about. Bugs the hell out of me. Have you ever tried copying & pasting code from one project to another, or from some website? What a pain.... - thelusiv - 02-07-2007 Heh yeah, but you know me, I am really picky about indentation and whitespace anyway, so it doesn't bother me much I just checked something in to the vdrift-trackeditor repository. To check it out: Code: svn co http://svn.vdrift.net/repos/vdrift-trackeditor/branches/pygtk-trackeditor vdrift-track-editor It doesn't actually do anything yet. It's just a mockup in glade and a framework for a program. It starts up and quits. It has a few functionless buttons. More to come... - thelusiv - 02-08-2007 To use what I added you'll need to install the following: python 2.4, gtk 2.8+, pygtk, libglade, libgtkglext, and pygtkglext. I haven't actually added the GL stuff yet but go ahead and get it. Ubuntu 6.10: download the package python-gtkglext1_1.1.0-1_i386.deb from here, then sudo apt-get install python2.4 python-gtk2 python-glade2 python-opengl libgtkglext1 sudo dpkg -i python-gtkglext1_1.1.0-1_i386.deb On Gentoo, I'm not sure what the python GTK and Glade packages are called but you can get pygtkglext thus: emerge pygtkglext - reece146 - 02-08-2007 thelusiv Wrote:On Gentoo, I'm not sure what the python GTK and Glade packages are called emerge -avt gtk+ libglade pygtkglext - thelusiv - 02-08-2007 Thanks for filling in that blank for me reece146 I've made a few more updates. I added some simple icons and an About dialog. The program now properly checks for all the libs it will need. Quitting was broken before, fixed now. I've started playing with Glade 3 and it's great! If you're still using Glade 2, I strongly suggest an upgrade (also, Anjuta 2 has Glade 3 built in, but I'm not sure how good the support is yet). I've also started looking at GLChess, a simple PyGTK + OpenGL chess game. It's the best example I can find for using the Python 3D libraries. By the way, PyGtkGLExt only provides the interface between GTK and GL, you still have to have PyOpenGL to do the actual OpenGL stuff. I didn't realize this before, Fortunately though most OpenGL calls are the same in Python as they are in C/C++, so it should be pretty easy to port our track/model load/display code to Python. - rookie1 - 04-20-2007 I'm experimenting with Boost.Python to wrap the existing c++ codes. Already successfully loaded the track data using the wrapped OBJECTS class in Python. Now trying to display the track in the new Python track editor. Will update you once the display works. - rookie1 - 04-20-2007 Well, I can't get the display to work. I've wrapped all the necessary functions. Not sure where is the problem. Can I upload my changes to svn so others can take a look? - thelusiv - 04-20-2007 Yes go right ahead, I'd love to take a look at it. Thanks for your work on this! |