def resetWindowProperties(self, pipe, properties):
     if base.win:
         currentProperties = WindowProperties(base.win.getProperties())
         gsg = base.win.getGsg()
     else:
         currentProperties = WindowProperties.getDefault()
         gsg = None
     newProperties = WindowProperties(currentProperties)
     newProperties.addProperties(properties)
     if base.pipe != pipe:
         gsg = None
     if gsg == None or currentProperties.getFullscreen() != newProperties.getFullscreen() or currentProperties.getParentWindow() != newProperties.getParentWindow():
         self.notify.debug('window properties: %s' % properties)
         self.notify.debug('gsg: %s' % gsg)
         base.pipe = pipe
         if not base.openMainWindow(props=properties, gsg=gsg, keepCamera=True):
             self.notify.warning('OPEN MAIN WINDOW FAILED')
             return 0
         self.notify.info('OPEN MAIN WINDOW PASSED')
         base.graphicsEngine.openWindows()
         if base.win.isClosed():
             self.notify.warning('Window did not open, removing.')
             base.closeWindow(base.win)
             return 0
         base.disableShowbaseMouse()
         if 'libotp' in sys.modules:
             from libotp import NametagGlobals
             NametagGlobals.setCamera(base.cam)
             NametagGlobals.setMouseWatcher(base.mouseWatcherNode)
     else:
         self.notify.debug('Adjusting properties')
         base.win.requestProperties(properties)
         base.graphicsEngine.renderFrame()
     return 1
 def resetWindowProperties(self, pipe, properties):
     if base.win:
         currentProperties = WindowProperties(base.win.getProperties())
         gsg = base.win.getGsg()
     else:
         currentProperties = WindowProperties.getDefault()
         gsg = None
     newProperties = WindowProperties(currentProperties)
     newProperties.addProperties(properties)
     if base.pipe != pipe:
         gsg = None
     if gsg == None or currentProperties.getFullscreen() != newProperties.getFullscreen() or currentProperties.getParentWindow() != newProperties.getParentWindow():
         self.notify.debug('window properties: %s' % properties)
         self.notify.debug('gsg: %s' % gsg)
         base.pipe = pipe
         if not base.openMainWindow(props=properties, gsg=gsg, keepCamera=True):
             self.notify.warning('OPEN MAIN WINDOW FAILED')
             return 0
         self.notify.info('OPEN MAIN WINDOW PASSED')
         base.graphicsEngine.openWindows()
         if base.win.isClosed():
             self.notify.warning('Window did not open, removing.')
             base.closeWindow(base.win)
             return 0
         base.disableShowbaseMouse()
         if 'libotp' in sys.modules:
             from libotp import NametagGlobals
             NametagGlobals.setCamera(base.cam)
             NametagGlobals.setMouseWatcher(base.mouseWatcherNode)
     else:
         self.notify.debug('Adjusting properties')
         base.win.requestProperties(properties)
         base.graphicsEngine.renderFrame()
     return 1
Esempio n. 3
0
    def resetWindowProperties(self, pipe, properties):
        if base.win:
            currentProperties = WindowProperties(base.win.getProperties())
            gsg = base.win.getGsg()
        else:
            currentProperties = WindowProperties.getDefault()
            gsg = None

        # Check to see if the window properties will change in any
        # important way.
        newProperties = WindowProperties(currentProperties)
        newProperties.addProperties(properties)

        if base.pipe != pipe:
            gsg = None

        if (gsg == None) or \
            (currentProperties.getFullscreen() != newProperties.getFullscreen()) or \
            (currentProperties.getParentWindow() != newProperties.getParentWindow()):
            # For now, assume that if we change fullscreen state, we
            # need to destroy the window and create a new one.

            self.notify.debug("window properties: %s" % properties)
            self.notify.debug("gsg: %s" % gsg)

            base.pipe = pipe
            if not base.openMainWindow(
                    props=properties, gsg=gsg, keepCamera=True):
                self.notify.warning("OPEN MAIN WINDOW FAILED")
                return 0

            self.notify.info("OPEN MAIN WINDOW PASSED")

            base.graphicsEngine.openWindows()
            if base.win.isClosed():
                self.notify.warning("Window did not open, removing.")
                base.closeWindow(base.win)
                return 0

            base.disableShowbaseMouse()

            # If we've already imported (and therefore downloaded)
            # libotp.dll, then we already have a NametagGlobals, and
            # we should keep it up-to-date with the new MouseWatcher
            # etc.
            if 'libotp' in sys.modules:
                from libotp import NametagGlobals
                NametagGlobals.setCamera(base.cam)
                NametagGlobals.setMouseWatcher(base.mouseWatcherNode)

        else:
            # If the properties are changing only slightly
            # (e.g. window size), we can keep the current window and
            # just adjust its properties directly.
            self.notify.debug("Adjusting properties")
            base.win.requestProperties(properties)
            base.graphicsEngine.renderFrame()

        return 1
Esempio n. 4
0
    def postOpenWindow(self):
        NametagGlobals.setCamera(base.cam)
        if base.wantEnviroDR:
            base.cam.node().setCameraMask(OTPRender.MainCameraBitmask)
        else:
            base.cam.node().setCameraMask(OTPRender.MainCameraBitmask | OTPRender.EnviroCameraBitmask)
        NametagGlobals.setMouseWatcher(base.mouseWatcherNode)
        if base.wantEnviroDR:
            base.setupEnviroCamera()

        if self.config.GetBool('show-tex-mem', False):
            if not (self.texmem) or self.texmem.cleanedUp:
                self.toggleTexMem()
Esempio n. 5
0
    def postOpenWindow(self):
        NametagGlobals.setCamera(base.cam)
        if base.wantEnviroDR:
            base.cam.node().setCameraMask(OTPRender.MainCameraBitmask)
        else:
            base.cam.node().setCameraMask(OTPRender.MainCameraBitmask
                                          | OTPRender.EnviroCameraBitmask)
        NametagGlobals.setMouseWatcher(base.mouseWatcherNode)
        if base.wantEnviroDR:
            base.setupEnviroCamera()

        if self.config.GetBool('show-tex-mem', False):
            if not (self.texmem) or self.texmem.cleanedUp:
                self.toggleTexMem()
Esempio n. 6
0
    def initNametagGlobals(self):
        arrow = loader.loadModel('models/gui/arrow')
        card = NodePath('card')
        speech3d = ChatBalloon(loader.loadModel('models/gui/chatbox'))
        thought3d = ChatBalloon(loader.loadModel('models/gui/chatbox_thought_cutout'))
        speech2d = ChatBalloon(loader.loadModel('models/gui/chatbox_noarrow'))
        chatButtonGui = loader.loadModel('models/gui/triangle')
        chatButtonGui.setScale(0.10000000000000001)
        chatButtonGui.flattenStrong()
        lookoutButtonGui = loader.loadModel('models/gui/lookout_gui')
        lookoutButtonGui.setScale(0.40000000000000002)
        lookoutButtonGui.flattenStrong()
        NametagGlobals.setCamera(self.cam)
        NametagGlobals.setArrowModel(arrow)
        NametagGlobals.setNametagCard(card, VBase4(-1, 1, -1, 1))
        if self.mouseWatcherNode:
            NametagGlobals.setMouseWatcher(self.mouseWatcherNode)

        NametagGlobals.setSpeechBalloon3d(speech3d)
        NametagGlobals.setThoughtBalloon3d(thought3d)
        NametagGlobals.setSpeechBalloon2d(speech2d)
        NametagGlobals.setThoughtBalloon2d(thought3d)
        NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/triangle'))
        NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/triangle_down'))
        NametagGlobals.setPageButton(PGButton.SRollover, chatButtonGui.find('**/triangle_over'))
        NametagGlobals.setQuitButton(PGButton.SReady, lookoutButtonGui.find('**/lookout_close_window'))
        NametagGlobals.setQuitButton(PGButton.SDepressed, lookoutButtonGui.find('**/lookout_close_window_down'))
        NametagGlobals.setQuitButton(PGButton.SRollover, lookoutButtonGui.find('**/lookout_close_window_over'))
        rolloverSound = PiratesGuiGlobals.getDefaultRolloverSound()
        clickSound = PiratesGuiGlobals.getDefaultClickSound()
        NametagGlobals.setRolloverSound(rolloverSound)
        NametagGlobals.setClickSound(clickSound)
        NametagGlobals.setToon(self.cam)
        self.marginManager = MarginManager()
        self.margins = self.aspect2d.attachNewNode(self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1)
        mm = self.marginManager
        self.leftCells = [
            mm.addGridCell(0, 1.5, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
            mm.addGridCell(0, 2.5, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
            mm.addGridCell(0, 3.5, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop)]
        self.bottomCells = [
            mm.addGridCell(0.5, 0.5, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
            mm.addGridCell(1.5, 0.5, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
            mm.addGridCell(2.5, 0.5, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
            mm.addGridCell(3.5, 0.5, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
            mm.addGridCell(4.5, 0.5, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop)]
        self.rightCells = [
            mm.addGridCell(5, 2.5, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
            mm.addGridCell(5, 1.5, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop)]
Esempio n. 7
0
 def initNametagGlobals(self):
     arrow = loader.loadModel('phase_3/models/props/arrow')
     card = loader.loadModel('phase_3/models/props/panel')
     speech3d = ChatBalloon(loader.loadModelNode('phase_3/models/props/chatbox'))
     thought3d = ChatBalloon(loader.loadModelNode('phase_3/models/props/chatbox_thought_cutout'))
     speech2d = ChatBalloon(loader.loadModelNode('phase_3/models/props/chatbox_noarrow'))
     chatButtonGui = loader.loadModel('phase_3/models/gui/chat_button_gui')
     NametagGlobals.setCamera(self.cam)
     NametagGlobals.setArrowModel(arrow)
     NametagGlobals.setNametagCard(card, VBase4(-0.5, 0.5, -0.5, 0.5))
     if self.mouseWatcherNode:
         NametagGlobals.setMouseWatcher(self.mouseWatcherNode)
     NametagGlobals.setSpeechBalloon3d(speech3d)
     NametagGlobals.setThoughtBalloon3d(thought3d)
     NametagGlobals.setSpeechBalloon2d(speech2d)
     NametagGlobals.setThoughtBalloon2d(thought3d)
     NametagGlobals.setPageButton(PGButton.SReady, chatButtonGui.find('**/Horiz_Arrow_UP'))
     NametagGlobals.setPageButton(PGButton.SDepressed, chatButtonGui.find('**/Horiz_Arrow_DN'))
     NametagGlobals.setPageButton(PGButton.SRollover, chatButtonGui.find('**/Horiz_Arrow_Rllvr'))
     NametagGlobals.setQuitButton(PGButton.SReady, chatButtonGui.find('**/CloseBtn_UP'))
     NametagGlobals.setQuitButton(PGButton.SDepressed, chatButtonGui.find('**/CloseBtn_DN'))
     NametagGlobals.setQuitButton(PGButton.SRollover, chatButtonGui.find('**/CloseBtn_Rllvr'))
     rolloverSound = DirectGuiGlobals.getDefaultRolloverSound()
     if rolloverSound:
         NametagGlobals.setRolloverSound(rolloverSound)
     clickSound = DirectGuiGlobals.getDefaultClickSound()
     if clickSound:
         NametagGlobals.setClickSound(clickSound)
     NametagGlobals.setToon(self.cam)
     self.marginManager = MarginManager()
     self.margins = self.aspect2d.attachNewNode(self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1)
     mm = self.marginManager
     self.leftCells = [mm.addGridCell(0, 1, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(0, 2, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(0, 3, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop)]
     self.bottomCells = [mm.addGridCell(0.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
      mm.addGridCell(1.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
      mm.addGridCell(2.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
      mm.addGridCell(3.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop),
      mm.addGridCell(4.5, 0, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop)]
     self.rightCells = [mm.addGridCell(5, 2, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop), mm.addGridCell(5, 1, base.a2dLeft, base.a2dRight, base.a2dBottom, base.a2dTop)]
Esempio n. 8
0
    def initNametagGlobals(self):
        arrow = loader.loadModel('models/gui/arrow')
        card = NodePath('card')
        speech3d = ChatBalloon(loader.loadModel('models/gui/chatbox'))
        thought3d = ChatBalloon(
            loader.loadModel('models/gui/chatbox_thought_cutout'))
        speech2d = ChatBalloon(loader.loadModel('models/gui/chatbox_noarrow'))
        chatButtonGui = loader.loadModel('models/gui/triangle')
        chatButtonGui.setScale(0.10000000000000001)
        chatButtonGui.flattenStrong()
        lookoutButtonGui = loader.loadModel('models/gui/lookout_gui')
        lookoutButtonGui.setScale(0.40000000000000002)
        lookoutButtonGui.flattenStrong()
        NametagGlobals.setCamera(self.cam)
        NametagGlobals.setArrowModel(arrow)
        NametagGlobals.setNametagCard(card, VBase4(-1, 1, -1, 1))
        if self.mouseWatcherNode:
            NametagGlobals.setMouseWatcher(self.mouseWatcherNode)

        NametagGlobals.setSpeechBalloon3d(speech3d)
        NametagGlobals.setThoughtBalloon3d(thought3d)
        NametagGlobals.setSpeechBalloon2d(speech2d)
        NametagGlobals.setThoughtBalloon2d(thought3d)
        NametagGlobals.setPageButton(PGButton.SReady,
                                     chatButtonGui.find('**/triangle'))
        NametagGlobals.setPageButton(PGButton.SDepressed,
                                     chatButtonGui.find('**/triangle_down'))
        NametagGlobals.setPageButton(PGButton.SRollover,
                                     chatButtonGui.find('**/triangle_over'))
        NametagGlobals.setQuitButton(
            PGButton.SReady, lookoutButtonGui.find('**/lookout_close_window'))
        NametagGlobals.setQuitButton(
            PGButton.SDepressed,
            lookoutButtonGui.find('**/lookout_close_window_down'))
        NametagGlobals.setQuitButton(
            PGButton.SRollover,
            lookoutButtonGui.find('**/lookout_close_window_over'))
        rolloverSound = PiratesGuiGlobals.getDefaultRolloverSound()
        clickSound = PiratesGuiGlobals.getDefaultClickSound()
        NametagGlobals.setRolloverSound(rolloverSound)
        NametagGlobals.setClickSound(clickSound)
        NametagGlobals.setToon(self.cam)
        self.marginManager = MarginManager()
        self.margins = self.aspect2d.attachNewNode(
            self.marginManager, DirectGuiGlobals.MIDGROUND_SORT_INDEX + 1)
        mm = self.marginManager
        self.leftCells = [
            mm.addGridCell(0, 1.5, base.a2dLeft, base.a2dRight, base.a2dBottom,
                           base.a2dTop),
            mm.addGridCell(0, 2.5, base.a2dLeft, base.a2dRight, base.a2dBottom,
                           base.a2dTop),
            mm.addGridCell(0, 3.5, base.a2dLeft, base.a2dRight, base.a2dBottom,
                           base.a2dTop)
        ]
        self.bottomCells = [
            mm.addGridCell(0.5, 0.5, base.a2dLeft, base.a2dRight,
                           base.a2dBottom, base.a2dTop),
            mm.addGridCell(1.5, 0.5, base.a2dLeft, base.a2dRight,
                           base.a2dBottom, base.a2dTop),
            mm.addGridCell(2.5, 0.5, base.a2dLeft, base.a2dRight,
                           base.a2dBottom, base.a2dTop),
            mm.addGridCell(3.5, 0.5, base.a2dLeft, base.a2dRight,
                           base.a2dBottom, base.a2dTop),
            mm.addGridCell(4.5, 0.5, base.a2dLeft, base.a2dRight,
                           base.a2dBottom, base.a2dTop)
        ]
        self.rightCells = [
            mm.addGridCell(5, 2.5, base.a2dLeft, base.a2dRight, base.a2dBottom,
                           base.a2dTop),
            mm.addGridCell(5, 1.5, base.a2dLeft, base.a2dRight, base.a2dBottom,
                           base.a2dTop)
        ]