mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
ShowBase: Fixed crash when want-render2dp is False
- Fixed crash in ShowBase when want-render2dp setting is set to 0(False). Signed-off-by: deflected <deflected@users.noreply.github.com>
This commit is contained in:
parent
7a46b2ca60
commit
bdd53d60fc
@ -968,7 +968,9 @@ class ShowBase(DirectObject.DirectObject):
|
||||
if isinstance(self.win, GraphicsWindow):
|
||||
self.setupMouse(self.win)
|
||||
self.makeCamera2d(self.win)
|
||||
self.makeCamera2dp(self.win)
|
||||
|
||||
if self.wantRender2dp:
|
||||
self.makeCamera2dp(self.win)
|
||||
|
||||
if oldLens != None:
|
||||
# Restore the previous lens properties.
|
||||
@ -1559,9 +1561,11 @@ class ShowBase(DirectObject.DirectObject):
|
||||
|
||||
# Tell the gui system about our new mouse watcher.
|
||||
self.aspect2d.node().setMouseWatcher(mw.node())
|
||||
self.aspect2dp.node().setMouseWatcher(mw.node())
|
||||
self.pixel2d.node().setMouseWatcher(mw.node())
|
||||
self.pixel2dp.node().setMouseWatcher(mw.node())
|
||||
if self.wantRender2dp:
|
||||
self.aspect2dp.node().setMouseWatcher(mw.node())
|
||||
self.pixel2dp.node().setMouseWatcher(mw.node())
|
||||
|
||||
mw.node().addRegion(PGMouseWatcherBackground())
|
||||
|
||||
return self.buttonThrowers[0]
|
||||
@ -2729,7 +2733,8 @@ class ShowBase(DirectObject.DirectObject):
|
||||
xsize, ysize = self.getSize()
|
||||
if xsize > 0 and ysize > 0:
|
||||
self.pixel2d.setScale(2.0 / xsize, 1.0, 2.0 / ysize)
|
||||
self.pixel2dp.setScale(2.0 / xsize, 1.0, 2.0 / ysize)
|
||||
if self.wantRender2dp:
|
||||
self.pixel2dp.setScale(2.0 / xsize, 1.0, 2.0 / ysize)
|
||||
|
||||
def adjustWindowAspectRatio(self, aspectRatio):
|
||||
""" This function is normally called internally by
|
||||
@ -2753,11 +2758,12 @@ class ShowBase(DirectObject.DirectObject):
|
||||
self.a2dLeft = -1
|
||||
self.a2dRight = 1.0
|
||||
# Don't forget 2dp
|
||||
self.aspect2dp.setScale(1.0, aspectRatio, aspectRatio)
|
||||
self.a2dpTop = 1.0 / aspectRatio
|
||||
self.a2dpBottom = - 1.0 / aspectRatio
|
||||
self.a2dpLeft = -1
|
||||
self.a2dpRight = 1.0
|
||||
if self.wantRender2dp:
|
||||
self.aspect2dp.setScale(1.0, aspectRatio, aspectRatio)
|
||||
self.a2dpTop = 1.0 / aspectRatio
|
||||
self.a2dpBottom = - 1.0 / aspectRatio
|
||||
self.a2dpLeft = -1
|
||||
self.a2dpRight = 1.0
|
||||
|
||||
else:
|
||||
# If the window is WIDE, lets expand the left and right
|
||||
@ -2767,11 +2773,12 @@ class ShowBase(DirectObject.DirectObject):
|
||||
self.a2dLeft = -aspectRatio
|
||||
self.a2dRight = aspectRatio
|
||||
# Don't forget 2dp
|
||||
self.aspect2dp.setScale(1.0 / aspectRatio, 1.0, 1.0)
|
||||
self.a2dpTop = 1.0
|
||||
self.a2dpBottom = -1.0
|
||||
self.a2dpLeft = -aspectRatio
|
||||
self.a2dpRight = aspectRatio
|
||||
if self.wantRender2dp:
|
||||
self.aspect2dp.setScale(1.0 / aspectRatio, 1.0, 1.0)
|
||||
self.a2dpTop = 1.0
|
||||
self.a2dpBottom = -1.0
|
||||
self.a2dpLeft = -aspectRatio
|
||||
self.a2dpRight = aspectRatio
|
||||
|
||||
# Reposition the aspect2d marker nodes
|
||||
self.a2dTopCenter.setPos(0, 0, self.a2dTop)
|
||||
@ -2793,15 +2800,16 @@ class ShowBase(DirectObject.DirectObject):
|
||||
self.a2dBottomRightNs.setPos(self.a2dRight, 0, self.a2dBottom)
|
||||
|
||||
# Reposition the aspect2dp marker nodes
|
||||
self.a2dpTopCenter.setPos(0, 0, self.a2dpTop)
|
||||
self.a2dpBottomCenter.setPos(0, 0, self.a2dpBottom)
|
||||
self.a2dpLeftCenter.setPos(self.a2dpLeft, 0, 0)
|
||||
self.a2dpRightCenter.setPos(self.a2dpRight, 0, 0)
|
||||
if self.wantRender2dp:
|
||||
self.a2dpTopCenter.setPos(0, 0, self.a2dpTop)
|
||||
self.a2dpBottomCenter.setPos(0, 0, self.a2dpBottom)
|
||||
self.a2dpLeftCenter.setPos(self.a2dpLeft, 0, 0)
|
||||
self.a2dpRightCenter.setPos(self.a2dpRight, 0, 0)
|
||||
|
||||
self.a2dpTopLeft.setPos(self.a2dpLeft, 0, self.a2dpTop)
|
||||
self.a2dpTopRight.setPos(self.a2dpRight, 0, self.a2dpTop)
|
||||
self.a2dpBottomLeft.setPos(self.a2dpLeft, 0, self.a2dpBottom)
|
||||
self.a2dpBottomRight.setPos(self.a2dpRight, 0, self.a2dpBottom)
|
||||
self.a2dpTopLeft.setPos(self.a2dpLeft, 0, self.a2dpTop)
|
||||
self.a2dpTopRight.setPos(self.a2dpRight, 0, self.a2dpTop)
|
||||
self.a2dpBottomLeft.setPos(self.a2dpLeft, 0, self.a2dpBottom)
|
||||
self.a2dpBottomRight.setPos(self.a2dpRight, 0, self.a2dpBottom)
|
||||
|
||||
# If anybody needs to update their GUI, put a callback on this event
|
||||
messenger.send("aspectRatioChanged")
|
||||
|
Loading…
x
Reference in New Issue
Block a user