Panda3D Samples Dojo WX [less early stage@2009-11-03]

What Is It
This is a little framework where it is possible to browse with ease a collection of panda3D programs, either sample snippets or whole videogames, see and modifiy the script code and see each sample at work in the same environment, and with the power of WxWindows widgets library:

As you can see in the image above, there is a searching box where you can reap just the applications you want, to the upper left a selector to switch between sample and game rooms, a Camera menu where to switch antialiasing and fps meter on and off.

Here some screenshots of the P3DDojo in action:

The application is actually at an early stage so it is not at his full potential and there should be issues here and there, in fact if you got Panda3D 1.5.4 for Windows installed with the official installer, it is quite possible that the Dojo won’t work very well, but it works quite nice with my Ubuntu machine.
So, the environment sure to work with is:
Panda3d 1.6.2 on Ubuntu 9.10 and wxPython 2.8.10

Let me know if you just tried a different setup succesfully so I’ll put it here for reference.

The Files
[size=75]== Main package @ 2009-11-03
The main application files. It needs to be fed with a data pack (see below) to be really useful.[/size]

p3ddojo.zip
Create a folder and unpack into it the whole zip (e.g. using the ‘extract here’ command) and start the application issuing from console:

python p3ddojo.py

[size=75]== The Rooms @ 2009-11-03
The dojo content is organized in rooms - actually there are just two and with little things into but is probably going to grow in the future.[/size]

rooms.zip
Unpack it into the same folder you have unpacked the main application (e.g. using the ‘extract here’ command)

It would be nice to have some feedback especially from ppl having tried it on systems other than ubuntu linux or different configurations just to see how it works out there and of course suggestions on how to improve or make it better are welcome as well, so feel free to drop a line below here to talk about it.

Interesting i always found that WX thing cool and now it hosts panda3d stuff yey!

Very interesting ! I am new to panda and I am just starting to build a generic wx framework which can plug to a panda application for customizing the objects in panda (say fog, light, position, …). Your showcase shall help me on some integration issues.

I try to run your application on my PC, Windows XP, panda 1.5.4, wx 2.8.4. It is not able to start:

:display: Unable to set window properties: !undecorated parent:8324026
Traceback (most recent call last):
File “p3ddojo.py”, line 512, in
_app = demoApp(False)
File “C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx_core.py”, line 7757
, in init
self._BootstrapApp()
File “C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx_core.py”, line 7354
, in _BootstrapApp
return core.PyApp__BootstrapApp(*args, **kwargs)
File “D:\temp\Panda\download\sample dojo\p3ddojo\p3dwxpod.py”, line 140, in On
Init
self._startP3D()
File “D:\temp\Panda\download\sample dojo\p3ddojo\p3dwxpod.py”, line 289, in _s
tartP3D
self.onStartP3D()
File “p3ddojo.py”, line 256, in onStartP3D
self.reload_tree()
File “p3ddojo.py”, line 401, in reload_tree
tcroot=self.build_treelist(treeList, self.win.tree, None)
File “p3ddojo.py”, line 451, in build_treelist
treectrl.SetItemImage(treenode, 0)
File “C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx_controls.py”, line
5288, in SetItemImage
return controls.TreeCtrl_SetItemImage(*args, **kwargs)
ValueError: invalid null reference in method ‘TreeCtrl_SetItemImage’, expected a
rgument 2 of type ‘wxTreeItemId const &’
:display: Closing wglGraphicsWindow

Nice !
But, why does it need samples pack ? Can’t it just load any source files ?

thankyou all for the feedback!
@clcheung
ach! first issue found - apparently is a nonsense: the error you posted say that

ValueError: invalid null reference in method 'TreeCtrl_SetItemImage', expected a 
rgument 2 of type 'wxTreeItemId const &' 

but is not true also for your newer WXwidgets version - the second argument must be an imagelist index. Looks like I got to install Panda3D on my dusted PC with widowsXP to see what’s going on then, unless other windowers say it works nice for them and is just a your local issue. I’ll report you back asap.

@ynjh_jo
heh, you’re right, it’s just a flexible infrastructure that I used for that purpose - but that app can (and will) do more than I wrote above: I hinted that the app could be localized and indeed if you press CTRL+E in a selected item of the tree, it will pop an editor to modify the summary showed in the summary tab - you just got to save that file with your country extension (.id in your case) and translate the values to the right of the = sign. Pressing F11 will open another one to localize the main application strings as well.
In my todo-list then I mean to expand the dojo adding two more rooms other than samples, one for games and one for models and also to open the application to a web repository where to update the data pool dynamically.

I have not noticed that !
I tried to debug the problem. The function
def get_folder_list(starting_point, patterns=’*’, extfilter=[])
seems assuming the UNIX style file separator:
for node in x.split(’/’):

May be you shall change it to something platform independent.

After I fix it, it seems work except the source editor.

It’s os.sep

spot on guys - that was indeed an oversight due to my long windows inactivity. So I settled up a windowsXP machine and tested the app there and with a big :open_mouth: I found in windows a completely different and sloppy behaviour, therefore I have to consider it verboten for SOs different from linux and under huge revision.
Hope soon to return with good news.

Hi

Just find that you need to add evt.Skip() at
def OnNbtabClick(self, evt):

evt.Skip()

Otherwise win32 wx will not show your other tab pages.

I’m back
sorry for the long delay clcheung - your finds was good but nothing comparing with the further work I did to make things work in Windows. I’d simply revised the whole app from top to bottom because the issues I’d found but now I got something that runs, even if there’s lot to do more to be satisfied. Grab the zips and let me know.


I have found quite a lot of problems. It might be only my configuration causing it so I remove the original post here. Get back to you if I can confirm more.

Just start to read your implementation:
if wx.Platform == “WXMSW”: loadPrcFileData("", “load-display pandadx8”)
else: loadPrcFileData("", “load-display pandagl”)

Is it forcing to use directX on Windows ? I have a NVIDIA 9500GL, it has problems in Panda3D’s directX implementation. I usually use OpenGL driver.

yepp - in my XP machine (athlon 5200+ dual with radeon rv610 chip) opengl gotta half speed and much more issues and I saw directx as an obvious choice on a windows machine but looks like I was too naive to think like that.
I’m starting to feel a bit frustrated with all of this, and I simply can’t waste all my already thin spare time fixing Windows issues, given that that clunky OS is not anymore (and will) on my sight, therefore I’m sorry clcheung, but I definitely gotta mark this project as *linux only * compatible and just hope that it will works out-of-the-box with the upcoming Panda3D 1.6 on Windows either.

I haven’t tried the new version, so these are about the first release :

  1. there’re 2 flags used in the samples, P3DPOD and SAMPLEDOJO. Sounds like inconsistency to me.
  2. The N00B/actor sample simply doesn’t run outside the dojo. It’s lacking of DirectionalLight, VBase4, and DirectStart. I guess you missed it simply because you mix the sample’s namespace with the pod’s, you execute the sample in the pod’s namespace. Why don’t you use independent namespace for the sample ?
  3. In all samples, you forbid DirectStart import. It’s not necessary, since once it’s imported, it won’t be loaded from disk and ran again, so no matter how many times you import it, ShowBase is instantiated only once, unless you intentionally kick it out of sys.modules.
  4. Why do you use Shader.load in the shader sample ? That way, you have to pass the absolute path. The natural way to do it is by loader.loadShader. Then it’s your pod’s responsibility to append the sample’s path to getModelPath() before executing it.

thankyou for your post ynjh_jo

all the samples provided so far came mainly off the official p3d package 1.5.4 with some others found in this very forum, slightly touched by myself, but all of those without a serious overhaul, just the directstart disable you saw and other minor touches to make it work on my app, but they’re there just to have some cheap meat to roast and no more. The next step, already started, is indeed to provide a serious, real and polished bunch of samples for what will be the first release of the app that, actually, is still too young and need more polish and to add the features I told you before (repository and two more rooms). After that, I’ll mark the app as pre-release and I guess will starts to be pretty useful.

That’s fine. But I am quite surprised that it seems quite a lot of users in this forum is on linux. I thought that most games (commercial especially) are developed with a target of Windows platform.

Are you able to run this demo on your Windows XP platform with directx and opengl ? I tried both but meet a lot of crashs, unable to open source file for the ode car, and various minor problem found.

Try my IDE.

yeah it’s obviously true that if you want to make big money you gotta spend your time targetting Windows but that’s not my concern cos’ I’m a hobbyist and got a small free-time window during the week to play with the panda. But don’t be so surprised about linux cos’ the community is today very large, especially thanks to the several graphic OS that runs above his kernel and i suggest you to give it a try.

yes I did but actually I backed-off all the windows skews and the last update I guess it won’t work anymore, sorry.

Today I finished another step: I added a room switcher where to switch from samples and games branches. Grab the files from the first post of the thread and enjoy.

Another step beyond toward the alpha:
fixed and improved some stuff and added a couple more of nice samples: the famous pandasteer, soft shadows and LOD.
Grab’em as always from the first post of this thread and enjoy.
The next and last step shall be the repository and after that I’ll mark this project as definitely “alpha stage: towards windows compatibility”.
Sorta.