Dummy Window GUI?

I’m making a desktop GUI with dummy windows, to demonstrate some 3D desktop concepts in Panda3D. I have some basic questions that are pretty important to the project:

*If there are multiple objects on the screen, and I click on one, how can I get Panda3D to realize which one I clicked? I’m guessing this involves a ray that returns the name of the first object it hits? A short example, summary, or link to more help would be very appreciated

*Let’s say the user clicks one of these fake windows. It should behave differently depending on what part of the window it clicks. I was thinking of doing this by constructing the window from smaller pieces, and just detecting which of these pieces is hit, does this seem like the best way?

Any and all help or input is greatly appreciated, thanks!

Brian

I just remembered the chessboard sample in the tutorials! This seems to do exactly what I was asking so I feel a little silly having posted this.

However, when I tried to move the entire sample to another directory and execute it I get this error:


C:\Program Files\Dev\Panda3D-1.2.3\Projects\Dummy GUI>ppython Tut-Chessboard.py
DirectStart: Starting the game.
Warning: DirectNotify: category 'Interval' already exists
Known pipe types:
  wglGraphicsPipe
(3 aux display modules not yet loaded.)
:pgraph(warning): Using deprecated LightAttrib interface.
:pgraph(warning): Using deprecated LightAttrib interface.
Assertion failed: !is_empty() at line 270 of c:\temp\mkpr\panda3d-1.2.3\panda\sr
c\pgraph\nodePath.I
Traceback (most recent call last):
  File "Tut-Chessboard.py", line 253, in ?
    w = World()
  File "Tut-Chessboard.py", line 101, in __init__
    self.squares[i].find("**/polygon").node().setIntoCollideMask(
AssertionError: !is_empty() at line 270 of c:\temp\mkpr\panda3d-1.2.3\panda\src\
pgraph\nodePath.I

and yet it still runs fine in its original directory? Any help would be much appreciated.

Thanks,
Brian

Maybe you forgot to copy some files, such as some of the models?

I guess this was the problem. I ended up deleting the directory and copying again and it worked this time.

I have another question now. Is it possible to load a Panda3D app from within another Panda application and use render-to-texture to create “Windows” like in a graphical GUI and redirect input to these programs?

For example, imagine a Panda program that simulates a desktop environment with icons representing Panda3D programs. Then, when those icons are clicked, open those Panda apps within that application and create windows in that virtual GUI for them to run in using render-to-texture rather than making a new application window? If that’s possible, would there be a way to select an active windows to send input to (minus a few escape keys)?

Interesting idea…

I don’t know how far you want to take this, but if you used Linux you could write a real window manager in Python only.
Together with Panda3D you might be able to write an interesting 3D GUI (see Beryl under Linux for another interesting 3D Desktop).

That’s funny you should say that because that’s exactly the project I’ve been working on. Unfortunately, I don’t have the time available to make a whole window manager, but I tried! It takes a lot of code dealing with X Window, and a lot of the features that code would have to take advantage of modules like xcommgr (X Composite Manager) which are pretty hard to write stable code for. It may be possible, but it’d be a big undertaking. I’m settling with just exploring some 3D desktop concepts using a dummy GUI in Panda3D ( hence this thread ).

I spoke with David Reveman, creator of Compiz (from which Beryl forked), and he told me there is a lot of promise for using Panda3D as a window manager if you implemented a plugin for Compiz that would basically incorporate Panda3D. I’d really like to see this idea get off the ground, but I need to finish my bachelor’s thesis research first (deadline fast approaching).


I have another question too, if anyone can help.

Right now I have windows being represented as a group of five single panels (window face, and the four bars on each side of the window used to shape and rotate the window). I’m working on implementing resizing functions, like when you pull at the side of a window to make it longer or higher. My problem is that, when I pull on the X axis, the window expands both left AND right, not just to the left. If I knew how to find the width of the window object, I could adjust its position as it grew, but I don’t know how. Here’s the code so far:

if(self.stretX):    self.windowlist[self.focus].face.setSx((self.windowlist[self.focus].face.getSx() + self.xorigin - x + 1)*.01)

windowlist - stores all the window objects
focus - the currently “in focus” window, that is the one being acted upon
face - the main face of the window, to which all the other nodes making up the window are parented to
self.xorigin - the location of the mouse (in pixels) when the window’s left or right resize bar was clicked

I hope you’ll find some time for a real Window manager in the near future :stuck_out_tongue_winking_eye:

In the meantime…

I don’t know what kind of object you are using for displaying your windows, but if you resize an object, its object axis will stay in position. If this axis happens to be in the center of the object, then your object will expand in every direction. Try to relocate this axis to the top left corner of your object.
This way you can resize it from the bottom right corner in the desired manner.