03-26-2008, 11:04 AM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
PyGTK Track Editor - Round 2
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?
|
|
03-26-2008, 03:30 PM,
|
|
alex25
Senior Member
|
Posts: 531
Threads: 42
Joined: Jun 2006
|
|
Re: PyGTK Track Editor - Round 2
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--
|
|
03-26-2008, 08:35 PM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
Re: PyGTK Track Editor - Round 2
alex25 Wrote:can you actually add the file and commit it to the repository? thanks.
--alex--
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?
|
|
03-26-2008, 09:03 PM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
Oops, forgot to add vdrift.i in my last commit. It's in the repo now.
|
|
03-27-2008, 08:13 AM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
Function GetConfigFileVersion() has declaration without implementation. Seems SWIG has problem with such cases.
|
|
03-27-2008, 11:39 AM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
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
texinfo = vdrift.TEXTUREINFO()
texinfo.SetName("textures/effects/white.png")
pyobj.drawable.GetPtr().SetAdditiveMap1(texinfo)
pyobj.drawable.GetPtr().SetSelfIllumination(True)
self.trackwindow.queue_draw()
On a side note, why do we need shader=on to have brakelight?
|
|
03-27-2008, 06:44 PM,
|
|
alex25
Senior Member
|
Posts: 531
Threads: 42
Joined: Jun 2006
|
|
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):
File "<stdin>", line 1, in ?
File "../vdrift/build/vdrift.py", line 7, in ?
import _vdrift
ImportError: ../vdrift/build/_vdrift.so: undefined symbol: _ZN8SETTINGS12GetLocaleDirEv
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--
|
|
03-27-2008, 09:32 PM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
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?
|
|
03-27-2008, 09:54 PM,
|
|
alex25
Senior Member
|
Posts: 531
Threads: 42
Joined: Jun 2006
|
|
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--
|
|
03-28-2008, 10:35 AM,
|
|
rookie1
Member
|
Posts: 231
Threads: 32
Joined: Nov 2006
|
|
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())
cam_pos = vdrift.VERTEX(obj_pos)
cam_pos.x -= 20
cam_pos.y += 10
cam_pos.z -= 20
vdrift.game.cam.SetPosition(cam_pos)
vdrift.game.cam.dir.LookAt(cam_pos.x, cam_pos.y, cam_pos.z, obj_pos.x, obj_pos.y, obj_pos.z, 0,1,0)
What it does is take the object's bounding box center as object position, and add some offset to get the camera position. Then cam.dir.LookAt() is called to point the camera at the object. From my test, the camera is not exactly pointing at the object though.
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?
|
|
03-28-2008, 01:46 PM,
|
|
alex25
Senior Member
|
Posts: 531
Threads: 42
Joined: Jun 2006
|
|
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.
I've committed my changes to svn. The selected object should have a redish tone.
the latest changes seem to have broken object selection. when i try to select an object i get:
Code: Traceback (most recent call last):
File "vdrift-track-editor.py", line 139, in select_obj
texinfo = vdrift.TEXTUREINFO()
AttributeError: 'module' object has no attribute 'TEXTUREINFO'
and the view doesn't change at all. not that it worked previously, as you correctly pointed out the camera was pointing in random directions but at least it was doing something.
--alex--
|
|
|