From 51ebbba9860227cc25e9c7da200e673b0d785cce Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 18 Feb 2004 22:51:41 +0000 Subject: [PATCH] add name to GraphicsWindow constructor --- direct/src/showbase/ShowBase.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index bc03948592..0173cb4d72 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -52,6 +52,8 @@ class ShowBase(DirectObject.DirectObject): else: vfs = None + self.nextWindowIndex = 1 + # Store dconfig variables self.sfxActive = self.config.GetBool('audio-sfx-active', 1) self.musicActive = self.config.GetBool('audio-music-active', 1) @@ -340,7 +342,7 @@ class ShowBase(DirectObject.DirectObject): self.notify.info("Could not make graphics pipe %s." % (pipeType.getName())) def openWindow(self, props = None, pipe = None, gsg = None, - type = None): + type = None, name = None): """ Creates a window and adds it to the list of windows that are to be updated every frame. @@ -371,11 +373,23 @@ class ShowBase(DirectObject.DirectObject): if props == None: props = self.defaultWindowProps - if type == 'onscreen': - win = self.graphicsEngine.makeWindow(pipe, gsg) - elif type == 'offscreen': - win = self.graphicsEngine.makeBuffer( - pipe, gsg, props.getXSize(), props.getYSize(), 0) + if name == None: + name = 'window%s' % (self.nextWindowIndex) + self.nextWindowIndex += 1 + + # Temporary try .. except for old Pandas. + try: + if type == 'onscreen': + win = self.graphicsEngine.makeWindow(pipe, gsg, name) + elif type == 'offscreen': + win = self.graphicsEngine.makeBuffer( + pipe, gsg, name, props.getXSize(), props.getYSize(), 0) + except: + if type == 'onscreen': + win = self.graphicsEngine.makeWindow(pipe, gsg) + elif type == 'offscreen': + win = self.graphicsEngine.makeBuffer( + pipe, gsg, props.getXSize(), props.getYSize(), 0) if win == None: # Couldn't create a window!