![]() |
PyGTK Track Editor - Round 2 - Printable Version +- Forums (https://www.vdrift.net/Forum) +-- Forum: Project (https://www.vdrift.net/Forum/forumdisplay.php?fid=4) +--- Forum: Development (https://www.vdrift.net/Forum/forumdisplay.php?fid=9) +--- Thread: PyGTK Track Editor - Round 2 (/showthread.php?tid=937) |
PyGTK Track Editor - Round 2 - rookie1 - 03-26-2008 I've updated PyGTK Track Editor to use the new scene graph engine. This time I used SWIG to export vdrift to python. The SWIG interface file is vdrift/src/vdrift.i. When you select an object in the objects list, the camera will move and focus on the object selected. I've not yet decided how to highlight the object in the 3D view. Ideas? - joevenzon - 03-26-2008 Excellent, sounds like good progress. How about highlighting the object red or blue or something? Re: PyGTK Track Editor - Round 2 - alex25 - 03-26-2008 rookie1 Wrote:I've updated PyGTK Track Editor to use the new scene graph engine. This time I used SWIG to export vdrift to python. The SWIG interface file is vdrift/src/vdrift.i. can you actually add the file and commit it to the repository? thanks. --alex-- Re: PyGTK Track Editor - Round 2 - rookie1 - 03-26-2008 alex25 Wrote:can you actually add the file and commit it to the repository? thanks. It's there in the repo - vdrift r1969 and vdrift track editor r62 (in pygtk-trackeditor branch) joevenzon Wrote:How about highlighting the object red or blue or something? Do I need to manipulate the object texture to achieve that? Or is there a simple way? - rookie1 - 03-26-2008 Oops, forgot to add vdrift.i in my last commit. It's in the repo now. - thelusiv - 03-26-2008 Just wondering - you changed settings.h to remove the definition of the unused function GetConfigFileVersion - was this just because it wasn't used? http://svn.vdrift.net/viewvc.cgi/trunk/include/settings.h?root=VDrift&r1=1835&r2=1969 - rookie1 - 03-27-2008 Function GetConfigFileVersion() has declaration without implementation. Seems SWIG has problem with such cases. Re: PyGTK Track Editor - Round 2 - joevenzon - 03-27-2008 rookie1 Wrote:Do I need to manipulate the object texture to achieve that? Or is there a simple way? Hmm... if you're using the VDrift scenegraph interface to do you drawing, then you could probably use DRAWABLE::SetAdditiveMap1(const TEXTUREINFO & tex) and DRAWABLE::SetSelfIllumination(bool newsi). The "additive map" just gets added to the texture, so make the additive map in the gimp or something as a small image with a constant color like RGB (0,0,50). A call to SetSelfIllumination(true) will render with the additive map applied, false with it not applied... it's how the brake lights are done. Now that I look at the code more, this might only work if shaders are enabled. Doh. Another simple way to do this would be to make a simple "selected object" type texture in the gimp and just replace the diffuse texture of the selected object with this texture. - thelusiv - 03-27-2008 I didn't get a chance to play with this last night, hopefully I will look at it some tonight. On object highlighting, whatever you do, I think it would be best to provide a light source so that the object can be easily seen, and not change the texture of the object. Another texture could be overlayed or something, but changing the texture totally would make it look funny. - rookie1 - 03-27-2008 I've pretty much came to the same solution as your first suggestion. Unfortunately it doesn't seem to work. I"m using data/textures/effects/white.png as the additive texture. There is no visible difference however. Did I miss a step? Here is the python code, Code: #highlight selected object On a side note, why do we need shader=on to have brakelight? - alex25 - 03-27-2008 rookie1 Wrote:Oops, forgot to add vdrift.i in my last commit. It's in the repo now. i got a chance to play with it a little bit, looks good. one problem i have is that is usually build vdrift without nls support so when it tries to load vdrift i get: Code: Traceback (most recent call last): i got around this by building vdrift with nls support but i was wondering if there is a way to disable nls support for the track editor as well. thanks. --alex-- - rookie1 - 03-27-2008 This is the same issue as SETTINGS::GetConfigFileVersion(). If NLS is not enabled, GetLocaleDir() will have a declaration without implementation. I think what we need to do is add #ifdef ENABLE_NLS around GetLocaleDir() in settings.h. I don't have access to my developement pc right now. Can someone go ahead and commit this change? - alex25 - 03-27-2008 rookie1 Wrote:This is the same issue as SETTINGS::GetConfigFileVersion(). If NLS is not enabled, GetLocaleDir() will have a declaration without implementation. I think what we need to do is add #ifdef ENABLE_NLS around GetLocaleDir() in settings.h. I don't have access to my developement pc right now. Can someone go ahead and commit this change? indeed, that did the trick. i've committed the change to the svn repository. --alex-- - rookie1 - 03-28-2008 It turns out my additive texture calls do work as expected. It's the camera code that's screwed up. The camera is not looking at the object when it's selected. I've committed my changes to svn. The selected object should have a redish tone. Now I need help on the camera math. This is the code to position the camera, Code: obj_pos = vdrift.VERTEX(pyobj.model.jmodel.GetBBOX().GetCenter()) So, 1. How do we decide the camera position? Ideally, it should not be too near nor too far. And it should not be obstructed by other objects. 2. Is there anything wrong in the above code to calculate camera direction? - alex25 - 03-28-2008 rookie1 Wrote:It turns out my additive texture calls do work as expected. It's the camera code that's screwed up. The camera is not looking at the object when it's selected. the latest changes seem to have broken object selection. when i try to select an object i get: Code: Traceback (most recent call last): --alex-- |