Hi,
I’m trying to parent directGui elements such as buttons to a created 2d display region and while the parenting works fine, the interaction is messed up. For instance, when the mouse cursor is atop a button, there is no change in text, nor is there any interaction when I click the button. However, when the cursor is outside the display region, the text changes and upon clicking some random area outside the display region, the button presses!
Here is the code:
dr = base.win.makeDisplayRegion(0.2,0.5,0.2,0.5)
dr.setSort(20)
#set the dp color:
dr.setClearColor(Vec4(0, 0,0, 0.3))
dr.setClearColorActive(True)
myCamera2d = NodePath(Camera('myCam2d'))
lens = OrthographicLens()
lens.setFilmSize(2, 2)
lens.setNearFar(-1000, 1000)
myCamera2d.node().setLens(lens)
myRender2d = NodePath('myRender2d')
myRender2d.setDepthTest(False)
myRender2d.setDepthWrite(False)
myCamera2d.reparentTo(myRender2d)
dr.setCamera(myCamera2d)
aspectRatio = base.getAspectRatio()
myAspect2d = myRender2d.attachNewNode(PGTop('myAspect2d'))
myAspect2d.setScale(1.0 / aspectRatio, 1.0, 1.0)
myAspect2d.node().setMouseWatcher(base.mouseWatcherNode)
butt1=DirectButton(text = ("OK", "click!", "rolling over", "disabled"),command=self.clickiWorks, parent=myAspect2d)
Here is how the error looks like:
So how would I go about fixing this error? Is it even an error, or did I forget to do something?
Thanks in advance.