Getting directgui objects to block 3d picker

I’m currently using snaptothegrid retro world as the base to my project. The 3d picker is essentially the 3d object picker in the manual. I want to have objects in the aspect2d layer to block the picker. Despite my attempts I’m unable to get anything in the aspect2d layer in the collision queue, even when base.cTrav.traverse(aspect2d) [this is set by base.cTrav = CollisionTraverser()]. Any suggestions?

The collision traverser is designed for 3-D geometry, not for the 2-D geometry in aspect2d. So ctrav.traverse(aspect2d) can’t possibly work.

But if you just want a mouse click on a 2-D widget to supercede the collision event, that should happen automatically if you are listening for the “mouse1” event (by default, “mouse1” is suppressed below a 2-D widget).

So, what precisely are you seeing happen, and what would you rather see happen?


You are correct. Mouse1 event is suppressed, however mouse1-up, which is what i was using before, is not suppressed below a 2d widget.

My issue is that my frame size is set using self.background[‘frameSize’]. I’m writing a “pixel perfect” gui that doesn’t scale with the panda window so my base window class inherits from DirectFrame, the title bar is a DirectButton, and the background is also a DirectFrame. I’ve never been able to get a DirectFrame to show anything unless I explicitly state the frameSize.

Currently Mouse1 is not suppressed with my DirectFrame widget, but is with the DirectButton title bar.

In bullet point form:
What I see now:

  • I click on a building and the building information window appears.
  • Clicking on the titlebar or the close button does what i want.
  • Clicking anywhere else in the building information window will cause another building infromation window to appear if there is a building behind the information window.

What I want is the last point to not happen!

Sure, you just need to make your DirectFrame enabled. They’re disabled by default, since there’s usually no reason to click on a DirectFrame. Pass state = DGG.NORMAL to the constructor.


Isnt it annoying when you spent a week working on a problem, and the fix was so simple? Thank you sir.