A wxWindows pod for Panda3D [v.2009-05-05]

Panda3D Forum Index -> Code Snippets Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
astelix


Posts: 851
Location: Milano, ITA

PostPosted: Wed Dec 17, 2008 12:28 pm    Post subject: A wxWindows pod for Panda3D [v.2009-05-05] Reply with quote
The idea is to have a startup shell (I call it 'pod') to begin from scratch a panda3d application using the power of Wxwidgets to ease as much as possible the job.
The stuff is known to work on panda3D 1.5.4 and 1.6.x on a linux desktop and on windowsXP with python 2.5 or 2.6 and WxWidgets 2.7.8 and 2.8.9

Download the package here:
p3dwxpod.zip

Create a folder on your hard disk and unpack into it the whole stuff and start it using run.sh on linux or run.bat on windows or issuing from console
Code:
python p3dwxpod.py

Enjoy.
_________________
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)


Last edited by astelix on Tue May 05, 2009 4:00 pm; edited 15 times in total
rdb
pro-rsoft

Posts: 5836
Location: Netherlands

PostPosted: Wed Dec 17, 2008 12:44 pm    Post subject: Reply with quote
I should point out that there's a similar thing to this available already in the Panda3D source code. It's called the WxAppShell and it will be available in 1.6.0 and later. This code looks more or less like the WxAppShell though -- what is exactly the difference between them?

I should also mention that (in case you took code from either the WxAppShell or the Panda3D Editor from the other thread) the BSD license (afaik) does not permit relicensing (even if you specify "no license") with or without modified code.
astelix


Posts: 851
Location: Milano, ITA

PostPosted: Wed Dec 17, 2008 12:57 pm    Post subject: Reply with quote
pro-rsoft wrote:
I should point out that there's a similar thing to this available already in the Panda3D source code. It's called the WxAppShell and it will be available in 1.6.0 and later. This code looks more or less like the WxAppShell though -- what is exactly the difference between them?

I should also mention that (in case you took code from either the WxAppShell or the Panda3D Editor from the other thread) the BSD license (afaik) does not permit relicensing (even if you specify "no license") with or without modified code.


Yes i saw it and that inspired me this but this it very different - that was an empty wx shell with just a base.userExit() P3D code and mine is a complete and working environment where you can start from scratch coding you P3D app without doing anything else. I hope the fact it have a similar menu and about messagebox will not raise licensing issues...
Anyway I'm curious to know what David think about it
_________________
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
rdb
pro-rsoft

Posts: 5836
Location: Netherlands

PostPosted: Wed Dec 17, 2008 1:07 pm    Post subject: Reply with quote
No, don't worry. I didn't notice this class actually also shows a Panda3D window inside the Wx window. It looks useful to start with.
Laurens


Posts: 145

PostPosted: Wed Dec 17, 2008 1:17 pm    Post subject: Reply with quote
Thanks! Very nice example. I notice that when the about dialog shows, panda3d is no longer updated.
astelix


Posts: 851
Location: Milano, ITA

PostPosted: Wed Dec 17, 2008 3:48 pm    Post subject: Reply with quote
thankyou Laurens.
Yes indeed is so 'cos the about messagebox is opened in blocking mode - closing it you'll start again where you were so you won't miss anything of your app.
_________________
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
Nemesis#13


Posts: 485
Location: virtual world

PostPosted: Wed Dec 17, 2008 4:04 pm    Post subject: Reply with quote
thank you very much astelix!
i'm sure, i'll find use for that code Smile
astelix


Posts: 851
Location: Milano, ITA

PostPosted: Wed Dec 17, 2008 4:15 pm    Post subject: Reply with quote
Nemesis#13 wrote:
thank you very much astelix!
i'm sure, i'll find use for that code Smile

Cool this is what I hope for - good coding and dont forget to share it to us
_________________
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
ynjh_jo


Posts: 1596
Location: Malang, Indonesia

PostPosted: Wed Dec 17, 2008 7:21 pm    Post subject: Reply with quote
Laurens wrote:
I notice that when the about dialog shows, panda3d is no longer updated.

That's why I spawn modal dialog in a new thread.
_________________
http://ynjh.panda3dprojects.com | http://ynjh.p3dp.com
Intel P4Prescott 2.8GHz HT | Elixir 1.5GB | ATI HD4670 1GB GDDR3
Derek


Posts: 18
Location: Ontario, Canada

PostPosted: Fri Dec 19, 2008 1:04 pm    Post subject: Reply with quote
I have used your code well, thanks for it.
I created a wx.Frame decendant which allows you to have multiple frames open on the same or different parent window.
I have finally managed to set up a nodepath attached to the camera node of each frame upon which a gui is rendered with scale set like aspect2d to duplicate the wx coordinate system.
Also I have attached a 3d model underneath the mouse cursor (or in place of) which, along with the other hud items (which are soon to be click3d/drag3dable) is also parented under the perspective lense of the frames camera nodepath to allow 3d scenes to look more realistic when viewed as hud items.

The source will be put to use in my current project ($) so I wont be releasing it unles you post which specific project of yours it is for.

Next I plan to find a way to autogenerate all of the widget classes using the other half of the project - an app designer/compiler which uses my panel3d for the interface. I am planning on using a ZUI.
astelix


Posts: 851
Location: Milano, ITA

PostPosted: Fri Dec 19, 2008 5:17 pm    Post subject: Reply with quote
I actually ain't get where you are planning to go Derek, but sound you're starting something big. I'm looking forward to see it when you got some to show.
About my piece of code, it is not intended to develop any particular project but to have a generic starting point to build p3d apps with the commodity of wxWindows library and as less effort as possible.
Soon I'll post an update with new stuff so stay tuned!
_________________
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
Derek


Posts: 18
Location: Ontario, Canada

PostPosted: Fri Dec 19, 2008 9:22 pm    Post subject: Reply with quote
astelix


Posts: 851
Location: Milano, ITA

PostPosted: Sun Dec 21, 2008 11:19 am    Post subject: Reply with quote
nice stuff Derek! this is something I would do by myself sooner or later but if you got some to share do not hesitate to send me or post here - if I think that could be useful I'll fit into the project.

People, as I said before I got a first less drafty revision of this snippet. I have tons of ideas to add but for now I guess could be a nice start.
Check the first post of this thread, download and play and maybe tellme what you think about.
_________________
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
astelix


Posts: 851
Location: Milano, ITA

PostPosted: Tue May 05, 2009 11:35 am    Post subject: Reply with quote
A new version is up - beside several fixes now it runs nice on windows as well as linux.
Go here to download the stuff.
_________________
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
pbouf


Posts: 25

PostPosted: Wed May 06, 2009 11:57 am    Post subject: Reply with quote
I just tried the new version and it segfaults:

Code:
patrick@t40puter:~/Desktop/p3dwxpod$ python p3dwxpod.py
DirectStart: Starting the game.
:util: Reading /home/patrick/Desktop/p3dwxpod/config/p3dwxpod.prc
>>>opening p3dsurface
:display: loading display module: libpandagl.so
Known pipe types:
  glxGraphicsPipe
(all display modules loaded.)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadWindow (invalid Window parameter)
:display:glxdisplay(error): BadDrawable (invalid Pixmap or Window parameter)
:display:glxdisplay(error): BadValue (integer parameter out of range for operation)
Segmentation fault


My own panda-only stuff is working fine. Now, I've been having some issues with graphics drivers since I upgraded to Ubuntu 9.04 (Jaunty Jackalope) so that might be the cause.
rdb
pro-rsoft

Posts: 5836
Location: Netherlands

PostPosted: Wed May 06, 2009 12:14 pm    Post subject: Reply with quote
I'm getting similar errors too (GLXBadDrawable), it happens because panda's window gets reparented before the wx window is fully opened.
In p3dwxpod.py, replace the line that says "self.init_end()" with something like this:
Code:
    taskMgr.doMethodLater(0.5, self.init_end, "blah", extraArgs=[])

That makes sure it opens 0.5 seconds later. Would be cleaner to have an onOpen event or so.

PS. Nice work, the wxpod. I like it. Maybe we should have something like this in pview. Smile
astelix


Posts: 851
Location: Milano, ITA

PostPosted: Thu May 07, 2009 3:40 am    Post subject: Reply with quote
*squish* the bug correctly pointed out by the always precious pro_rsoft has gone, BUT looks like there is more: in my rig 2 (see my signature) the Ubuntu flavor, I can't say if it is a matter of something changed in the P3D 1.6 or the ATI drivers but I'm experiencing a bad behavior whit the Panda overlay (either using my pod or the usual panda window) revealing out whatever window I put in front of it and therefore the wx menus are not visible 'cos are covered by the P3d overlay. Download again the pod and see for yourselves.

pro-rsoft wrote:

PS. Nice work, the wxpod. I like it. Maybe we should have something like this in pview. Smile

hey thankyo dude, I'm glad you like it - would you believe I started to make it to replace pview? then the little snippet has grown since then - it is under the hood of my p3ddojo - but it is open enough to make any kind of p3d app.
_________________
My Rig:
P3D 1.7.0@WinXP & Kubuntu 10.04- Athlon 64 5200 X2 ~ Radeon 3200HD (integrated)
pbouf


Posts: 25

PostPosted: Thu May 07, 2009 7:25 am    Post subject: Reply with quote
@astelix: In fact that's the very problem I was talking about (with graphics drivers), I also have an ATI card (and I can't do anything about it, it's a laptop..). I filed this bug if you want to take a look: http://bugs.freedesktop.org/show_bug.cgi?id=21600
Display posts from previous:   
Post new topic   Reply to topic    Panda3D Forum Index -> Code Snippets All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group