소스 검색

*** empty log message ***

Mark Mine 24 년 전
부모
커밋
6cfa7cc2b5

+ 0 - 1
direct/src/directdevices/DirectRadamec.py

@@ -4,7 +4,6 @@ from PandaObject import *
 from DirectDeviceManager import *
 
 import DirectNotifyGlobal
-import OnscreenText
 
 
 """

+ 0 - 7
direct/src/fsm/StateData.py

@@ -20,13 +20,6 @@ class StateData(DirectObject):
         self.isEntered = 0
         return None
     
-    def cleanup(self):
-        """cleanup(self)
-        """
-        print "state data cleanup!!!"
-        self.unload()
-        return None
-
     def enter(self):
         """enter(self)
         """

+ 0 - 52
direct/src/gui/Background.py

@@ -1,52 +0,0 @@
-from ShowBaseGlobal import *
-from DirectObject import *
-from GuiGlobals import *
-import GuiBackground
-
-class Background(DirectObject):
-
-    def __init__(self, name, item, label):
-        self.name = name
-        self.item = item
-        self.label = label
-        self.background = GuiBackground.GuiBackground(name, self.item,
-                                                      self.label)
-        self.managed = 0
-        return None
-
-    def cleanup(self):
-        """cleanup(self)
-        """
-        if (self.managed):
-            self.unmanage()
-        self.background = None
-        return None
-
-    def __str__(self):
-        return "Background: %s behind %s" % (self.name, self.item )
-    
-    # accessing
-    def getName(self):
-        return self.name
-
-    def getGuiItem(self):
-        return self.background
-
-    def setPos(self, x, y):
-        v3 = Vec3.Vec3(x, 0, y)
-        self.background.setPos(v3)
-        
-    def setScale(self, scale):
-        self.background.setScale(scale)
-
-    # actions
-    def manage(self):
-        self.managed = 1
-        self.background.manage(guiMgr, base.eventMgr.eventHandler)
-
-    def unmanage(self):
-        self.managed = 0
-        self.background.unmanage()
-
-    def getItem(self):
-        return self.item

+ 0 - 233
direct/src/gui/Button.py

@@ -1,233 +0,0 @@
-from ShowBaseGlobal import *
-from DirectObject import *
-from GuiGlobals import *
-import GuiButton
-import Label
-
-
-class Button(DirectObject):
-
-    def __init__(self, name,
-                 label = None,
-                 # If you have labels you want to use for the
-                 # various states, pass them as a list in labels
-                 labels = None,
-                 scale = 0.1,
-                 width = None,
-                 align = None,
-                 drawOrder = getDefaultDrawOrder(),
-                 font = getDefaultFont(),
-                 pos = (0, 0),
-                 geomRect = None,
-                 supportInactive = 0,
-                 inactive = 0,
-                 upStyle = Label.ButtonUp,
-                 litStyle = Label.ButtonLit,
-                 downStyle = Label.ButtonDown,
-                 inactiveStyle = Label.ButtonInactive,
-                 event = None, rolloverSound = None, clickSound = None):
-        self.name = name
-        self.width = width
-
-        # if no label given, use the button name
-        if (label == None) and (labels == None):
-            label = self.name
-
-        self.inactive = inactive
-        if inactive:
-            supportInactive = 1
-
-        # check to see if this is an actual guiLabel or just text
-        if (type(label) == type('')):
-            # text label, make text button
-            self.label = label
-
-            self.lUp = Label.textLabel(self.label, upStyle, scale,
-                                       width, drawOrder, font)
-
-            if width == None:
-                width = self.lUp.getWidth() / scale
-                self.width = width
-
-            self.lLit = Label.textLabel(self.label, litStyle, scale,
-                                        width, drawOrder, font)
-            self.lDown = Label.textLabel(self.label, downStyle, scale,
-                                         width, drawOrder, font)
-
-            if supportInactive:
-                self.lInactive = Label.textLabel(self.label, inactiveStyle,
-                                                 scale, width, drawOrder, font)
-
-        elif (isinstance(label, NodePath)):
-            # If it's a NodePath, assume it's a little texture card.
-            self.lUp = Label.modelLabel(label,
-                                        geomRect = geomRect,
-                                        style = upStyle,
-                                        scale = (scale, scale),
-                                        drawOrder = drawOrder)
-
-            if width == None:
-                width = self.lUp.getWidth() / scale
-                self.width = width
-
-            self.lLit = Label.modelLabel(label,
-                                         geomRect = geomRect,
-                                         style = litStyle,
-                                         scale = (scale, scale),
-                                         drawOrder = drawOrder)
-            self.lDown = Label.modelLabel(label,
-                                          geomRect = geomRect,
-                                          style = downStyle,
-                                          scale = (scale, scale),
-                                          drawOrder = drawOrder)
-            if supportInactive:
-                self.lInactive = Label.modelLabel(label,
-                                                  geomRect = geomRect,
-                                                  style = inactiveStyle,
-                                                  scale = (scale, scale),
-                                                  drawOrder = drawOrder)
-
-        else:
-            if labels:
-                # label provided, use it for all labels
-                self.lUp, self.lLit, self.lDown, self.lInactive = labels
-            else:
-                # label provided, use it for all labels
-                self.lUp = self.lLit = self.lDown = self.lInactive = label
-            if width == None:
-                width = self.lUp.getWidth()
-
-        if not supportInactive:
-            self.lInactive = self.lUp
-
-        self.button = GuiButton.GuiButton(self.name, self.lUp, self.lLit,
-                                          self.lDown, self.lDown,
-                                          self.lInactive)
-        self.button.setDrawOrder(drawOrder)
-        self.button.setRolloverFunctor(getNewRolloverFunctor(rolloverSound))
-        self.button.setBehaviorFunctor(getNewClickFunctor(clickSound))
-
-        if (event != None):
-            self.button.setBehaviorEvent(event)
-        self.event = event
-
-        if align == TMALIGNLEFT:
-            self.xoffset = width / 2.0 * scale
-        elif align == TMALIGNRIGHT:
-            self.xoffset = -width / 2.0 * scale
-        else:
-            self.xoffset = 0
-
-        self.setPos(pos[0], pos[1])
-        self.managed = 0
-
-        return None
-
-    def cleanup(self):
-        if (self.managed):
-            self.unmanage()
-        del self.lUp
-        del self.lLit
-        del self.lDown
-        del self.lInactive
-        del self.button
-        return None
-
-    def __str__(self):
-        return "Button: %s" % self.name
-
-
-    def getName(self):
-        return self.name
-
-    def getLabel(self):
-        return self.label
-
-    def getGuiItem(self):
-        return self.button
-
-    def getWidth(self):
-        return self.width
-
-    def setWidth(self, width):
-        self.lUp.setWidth(width)
-        self.lLit.setWidth(width)
-        self.lDown.setWidth(width)
-        self.lInactive.setWidth(width)
-
-    def setInactive(self, inactive):
-        self.inactive = inactive
-        if self.managed:
-            self.button.exit()
-            if self.inactive:
-                self.button.inactive()
-            else:
-                self.button.up()
-                # Turning the button inactive stops the behavior, so
-                # we must restart it here
-                if (self.event != None):
-                    self.button.startBehavior()
-
-    def manage(self, nodepath = aspect2d):
-        if not self.managed:
-            if nodepath:
-                self.button.manage(guiMgr, base.eventMgr.eventHandler,
-                                   nodepath.node())
-            else:
-                self.button.manage(guiMgr, base.eventMgr.eventHandler)
-
-            if (self.event != None):
-                self.button.startBehavior()
-
-            if self.inactive:
-                self.button.exit()
-                self.button.inactive()
-
-            self.managed = 1
-
-
-    def unmanage(self):
-        if self.managed:
-            self.button.unmanage()
-            self.managed = 0
-
-    def getPos(self):
-        v = self.button.getPos()
-        return Vec3(v[0] - self.xoffset, v[1], v[2])
-
-    def setPos(self, x, y, node = None):
-        if node == None:
-            v3 = Vec3(x + self.xoffset, 0., y)
-        else:
-            mat = node.getMat(base.render2d)
-            v3 = Vec3(mat.xformPoint(Point3(x + self.xoffset, 0., y)))
-
-        self.button.setPos(v3)
-
-    def setBehaviorEvent(self, eventName):
-        self.button.setBehaviorEvent(eventName)
-        self.event = eventName
-
-    def setBehaviorEventParameter(self, param):
-        self.button.setBehaviorEventParameter(param)
-
-    def startBehavior(self):
-        self.button.startBehavior()
-
-    def stopBehavior(self):
-        self.button.stopBehavior()
-
-    def setRolloverEvent(self, eventName):
-        self.button.setUpRolloverEvent(eventName)
-
-    def setDownRolloverEvent(self, eventName):
-        self.button.setDownRolloverEvent(eventName)
-
-    def setUpRolloverEvent(self, eventName):
-        self.button.setUpRolloverEvent(eventName)
-
-    def setDownEvent(self, eventName):
-        self.button.setDownEvent(eventName)
-
-    def setUpEvent(self, eventName):
-        self.button.setUpEvent(eventName)

+ 0 - 65
direct/src/gui/Chooser.py

@@ -1,65 +0,0 @@
-from ShowBaseGlobal import *
-from DirectObject import *
-import GuiChooser
-import GuiManager
-import GuiButton
-
-guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.render2d.node())
-
-class Chooser(DirectObject):
-
-    def __init__(self, name, prev, next):
-        self.name = name
-        self.prev = prev
-        self.next = next
-        self.chooser = GuiChooser.GuiChooser(self.name, self.prev, self.next)
-        self.managed = 0
-        return None
-
-    def cleanup(self):
-        """cleanup(self)
-        """
-        if (self.managed):
-            self.unmanage()
-        self.chooser = None
-        return None
-
-    def __str__(self):
-        return "Chooser: %s" % self.name
-
-    # accessing
-    def getName(self):
-        return self.name
-
-    def getGuiItem(self):
-        return self.chooser
-
-    def setScale(self, scale):
-        self.chooser.setScale(scale)
-
-    def addItem(self, item):
-        self.chooser.addItem(item)
-
-    def getCurrItem(self):
-        item = self.chooser.getCurrItem()
-        if (item == -1):
-            return None
-        return item
-
-    def setLoop(self, loop):
-        self.chooser.setLoop(loop)
-
-    # actions
-    def manage(self):
-        self.managed = 1
-        self.chooser.manage(guiMgr, base.eventMgr.eventHandler)
-
-    def unmanage(self):
-        self.managed = 0
-        self.chooser.unmanage()
-
-    def freeze(self):
-        self.chooser.freeze()
-
-    def thaw(self):
-        self.chooser.thaw()

+ 0 - 59
direct/src/gui/Collection.py

@@ -1,59 +0,0 @@
-from ShowBaseGlobal import *
-from DirectObject import *
-from GuiGlobals import *
-import GuiCollection
-import Vec3
-
-class Collection(DirectObject):
-
-    def __init__(self, name):
-        self.name = name
-        self.collection = GuiCollection.GuiCollection(self.name)
-        self.items= []
-        self.managed = 0
-        return None
-
-    def cleanup(self):
-        """cleanup(self)
-        """
-        if (self.managed):
-            self.unmanage()
-        self.collection = None
-        return None
-
-    def __str__(self):
-        return "Collection: %s = %s" % (self.name, self.items)
-    
-    # accessing
-    def getName(self):
-        return self.name
-
-    def getGuiItem(self):
-        return self.collection
-
-    def setPos(self, x, y):
-        v3 = Vec3.Vec3(x, 0, y)
-        self.collection.setPos(v3)
-        
-    def setScale(self, scale):
-        self.collection.setScale(scale)
-
-    # actions
-    def manage(self):
-        self.managed = 1
-        self.collection.manage(guiMgr, base.eventMgr.eventHandler)
-
-    def unmanage(self):
-        self.managed = 0
-        self.collection.unmanage()
-
-    def addItem(self, item):
-        self.items.append(item)
-        self.collection.addItem(item.getGuiItem())
-
-    def removeItem(self, item):
-        self.items.remove(item)
-        self.collection.removeItem(item.getGuiItem())
-
-    def getItems(self):
-        return self.items

+ 1 - 1
direct/src/gui/DirectButton.py

@@ -11,7 +11,7 @@ class DirectButton(DirectFrame):
     DirectButton(parent) - Create a DirectGuiWidget which responds
     to mouse clicks and execute a callback function if defined
     """
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Inherits from DirectFrame
         # A Direct Frame can have:
         # - A background texture (pass in path to image, or Texture Card)

+ 9 - 7
direct/src/gui/DirectDialog.py

@@ -35,7 +35,7 @@ class DirectDialog(DirectFrame):
     AllDialogs = {}
     PanelIndex = 0
 
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         """
         DirectDialog(kw)
 
@@ -103,9 +103,11 @@ class DirectDialog(DirectFrame):
             ('topPad',            0.06,          INITOPT),
             ('midPad',            0.12,          INITOPT),
             ('buttonPadSF',       1.05,          INITOPT),
+            # Alpha of fade screen behind dialog
             ('fadeScreen',        0,             None),
             ('command',           None,          None),
             ('extraArgs',         [],            None),
+            ('sortOrder',    NO_FADE_SORT_INDEX, None),
             )
         # Merge keyword options with default options
         self.defineoptions(kw, optiondefs, dynamicGroups = ("button",))
@@ -296,7 +298,7 @@ class DirectDialog(DirectFrame):
         """show(self)
         """
         if self['fadeScreen']:
-            base.transitions.guiFadeScreen()
+            base.transitions.fadeScreen(self['fadeScreen'])
         NodePath.show(self)
 
     def hide(self):
@@ -329,7 +331,7 @@ class DirectDialog(DirectFrame):
         DirectFrame.destroy(self)
 
 class OkDialog(DirectDialog):
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Inherits from DirectFrame
         optiondefs = (
             # Define type of DirectGuiWidget
@@ -342,7 +344,7 @@ class OkDialog(DirectDialog):
         self.initialiseoptions(OkDialog)
 
 class OkCancelDialog(DirectDialog):
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Inherits from DirectFrame
         optiondefs = (
             # Define type of DirectGuiWidget
@@ -355,7 +357,7 @@ class OkCancelDialog(DirectDialog):
         self.initialiseoptions(OkCancelDialog)
 
 class YesNoDialog(DirectDialog):
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Inherits from DirectFrame
         optiondefs = (
             # Define type of DirectGuiWidget
@@ -368,7 +370,7 @@ class YesNoDialog(DirectDialog):
         self.initialiseoptions(YesNoDialog)
 
 class YesNoCancelDialog(DirectDialog):
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Inherits from DirectFrame
         optiondefs = (
             # Define type of DirectGuiWidget
@@ -382,7 +384,7 @@ class YesNoCancelDialog(DirectDialog):
         self.initialiseoptions(YesNoCancelDialog)
 
 class RetryCancelDialog(DirectDialog):
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Inherits from DirectFrame
         optiondefs = (
             # Define type of DirectGuiWidget

+ 2 - 2
direct/src/gui/DirectEntry.py

@@ -10,7 +10,7 @@ class DirectEntry(DirectFrame):
     DirectEntry(parent) - Create a DirectGuiWidget which responds
     to keyboard buttons
     """
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Inherits from DirectFrame
         # A Direct Frame can have:
         # - A background texture (pass in path to image, or Texture Card)
@@ -49,7 +49,7 @@ class DirectEntry(DirectFrame):
         # Create Text Node Component
         self.onscreenText = self.createcomponent(
             'text', (), None,
-            OnscreenText.OnscreenText,
+            OnscreenText,
             (), parent = hidden,
             # Pass in empty text to avoid extra work, since its really
             # The PGEntry which will use the TextNode to generate geometry

+ 4 - 4
direct/src/gui/DirectFrame.py

@@ -1,7 +1,7 @@
 from DirectGuiBase import *
 
 class DirectFrame(DirectGuiWidget):
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Inherits from DirectGuiWidget
         # A Direct Frame can have:
         # - A background texture (pass in path to image, or Texture Card)
@@ -66,7 +66,7 @@ class DirectFrame(DirectGuiWidget):
                 else:
                     self.createcomponent(
                         component, (), 'text',
-                        OnscreenText.OnscreenText,
+                        OnscreenText,
                         (), parent = self.stateNodePath[i],
                         text = text, scale = 1,
                         sort = TEXT_SORT_INDEX,
@@ -105,7 +105,7 @@ class DirectFrame(DirectGuiWidget):
                 else:
                     self.createcomponent(
                         component, (), 'geom',
-                        OnscreenGeom.OnscreenGeom,
+                        OnscreenGeom,
                         (), parent = self.stateNodePath[i],
                         geom = geom, scale = 1,
                         sort = GEOM_SORT_INDEX)
@@ -153,7 +153,7 @@ class DirectFrame(DirectGuiWidget):
                 else:
                     self.createcomponent(
                         component, (), 'image',
-                        OnscreenImage.OnscreenImage,
+                        OnscreenImage,
                         (), parent = self.stateNodePath[i],
                         image = image, scale = 1,
                         sort = IMAGE_SORT_INDEX)

+ 0 - 6
direct/src/gui/DirectGui.py

@@ -1,11 +1,5 @@
 from DirectGuiGlobals import *
 
-# Initialize global variable guiTop
-import __builtin__
-__builtin__.guiTop = aspect2d.attachNewNode(PGTop('DirectGuiTop'))
-guiTop.node().setMouseWatcher(base.mouseWatcherNode)
-base.mouseWatcherNode.addRegion(PGMouseWatcherBackground())
-
 # Set up default font
 PGItem.getTextNode().setFont(getDefaultFont())
 

+ 1 - 1
direct/src/gui/DirectGuiBase.py

@@ -657,7 +657,7 @@ class DirectGuiWidget(DirectGuiBase, NodePath):
         inactiveInitState = DISABLED
             
 
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Direct gui widgets are node paths
         # Direct gui widgets have:
         # -  stateNodePaths (to hold visible representation of widget)

+ 20 - 6
direct/src/gui/DirectGuiGlobals.py

@@ -2,12 +2,7 @@
 Global definitions used by Direct Gui Classes and handy constants
 that can be used during widget construction
 """
-
 from PandaModules import *
-import OnscreenText
-import OnscreenGeom
-import OnscreenImage
-import types
 
 # USEFUL GUI CONSTANTS
 # Constant used to indicate that an option can only be set by a call
@@ -70,12 +65,13 @@ IMAGE_SORT_INDEX = 10
 GEOM_SORT_INDEX = 20
 TEXT_SORT_INDEX = 30
 FADE_SORT_INDEX = 100
-DIALOG_SORT_INDEX = 200
 
 defaultFont = None
 defaultClickSound = None
 defaultRolloverSound = None
 defaultDialogGeom = None
+drawOrder = 100
+panel = None
 
 def getDefaultRolloverSound():
     global defaultRolloverSound
@@ -115,3 +111,21 @@ def getDefaultDialogGeom():
 def setDefaultDialogGeom(newDialogGeom):
     global defaultDialogGeom
     defaultDialogGeom = newDialogGeom
+
+def getDefaultDrawOrder():
+    return drawOrder
+
+def setDefaultDrawOrder(newDrawOrder):
+    global drawOrder
+    drawOrder = newDrawOrder
+
+def getDefaultPanel():
+    return panel
+
+def setDefaultPanel(newPanel):
+    global panel
+    panel = newPanel
+
+from OnscreenText import *
+from OnscreenGeom import *
+from OnscreenImage import *

+ 1 - 1
direct/src/gui/DirectLabel.py

@@ -5,7 +5,7 @@ class DirectLabel(DirectFrame):
     DirectLabel(parent) - Create a DirectGuiWidget which has multiple
     states.  User explicitly chooses a state to display
     """
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Inherits from DirectFrame
         # A Direct Frame can have:
         # - A background texture (pass in path to image, or Texture Card)

+ 1 - 1
direct/src/gui/DirectScrolledList.py

@@ -3,7 +3,7 @@ from DirectButton import *
 import Task
 
 class DirectScrolledList(DirectFrame):
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
 
         self.index = 0
 

+ 38 - 14
direct/src/gui/DirectWaitBar.py

@@ -11,7 +11,7 @@ class DirectWaitBar(DirectFrame):
     DirectEntry(parent) - Create a DirectGuiWidget which responds
     to keyboard buttons
     """
-    def __init__(self, parent = guiTop, **kw):
+    def __init__(self, parent = aspect2d, **kw):
         # Inherits from DirectFrame
         # A Direct Frame can have:
         # - A background texture (pass in path to image, or Texture Card)
@@ -19,23 +19,31 @@ class DirectWaitBar(DirectFrame):
         # - A foreground text Node (pass in text string or Onscreen Text)
         optiondefs = (
             # Define type of DirectGuiWidget
-            ('pgFunc',          PGWaitBar,        None),
-            ('frameSize',       (-1,1,-0.1,0.1),  None),
-            ('range',           100,              self.setRange),
-            ('value',           50,               self.setValue),
-            ('barBorderWidth',  (0,0),            self.setBarBorderWidth),
-            ('barColor',        (1,0,0,1),        self.setBarColor),
-            ('barRelief',       FLAT,             self.setBarRelief),
+            ('pgFunc',         PGWaitBar,          None),
+            ('frameSize',      (-1,1,-0.08,0.08),  None),
+            ('borderWidth',    (0,0),              None),
+            ('range',          100,                self.setRange),
+            ('value',          50,                 self.setValue),
+            ('barBorderWidth', (0,0),              self.setBarBorderWidth),
+            ('barColor',       (1,0,0,1),          self.setBarColor),
+            ('barRelief',      FLAT,               self.setBarRelief),
+            ('sortOrder',      NO_FADE_SORT_INDEX, None),
             )
-        
-        self.barStyle = PGFrameStyle()
-        
+        if kw.has_key('text'):
+            textoptiondefs = (
+                ('text_pos',    (0,-0.025),          None),
+                ('text_scale',  0.1,                 None)
+                )
+        else:
+            textoptiondefs = ()
         # Merge keyword options with default options
-        self.defineoptions(kw, optiondefs)
+        self.defineoptions(kw, optiondefs + textoptiondefs)
 
         # Initialize superclasses
         DirectFrame.__init__(self, parent)
 
+        self.barStyle = PGFrameStyle()
+
         # Call option initialization functions
         self.initialiseoptions(DirectWaitBar)
 
@@ -65,6 +73,22 @@ class DirectWaitBar(DirectFrame):
     def setBarColor(self):
         self.barStyle.setColor(*self['barColor'])
         self.updateBarStyle()
+
+    def update(self, value):
+        self['value'] = value
+        # finally update the window
+        base.win.update()
+
+    def finish(self):
+        # Fill the bar in N frames
+        N = 10 # take 10 frames
+        remaining = self['range'] - self['value']
+        if remaining:
+            step = max(1, int(remaining / N))
+            count = self['value']
+            while count != self['range']:
+                count += step
+                if count > self['range']:
+                    count = self['range']
+                self.update(count)
         
-        
-    

+ 0 - 80
direct/src/gui/ForceAcknowledge.py

@@ -1,80 +0,0 @@
-import string
-import OnscreenText
-import Button
-import StateData
-
-from DirectObject import *
-from ShowBaseGlobal import *
-
-class ForceAcknowledge(StateData.StateData):
-
-    def __init__(self, doneEvent, message):
-        """___init___(self, Event)"""
-        StateData.StateData.__init__(self, doneEvent)
-        return None
-
-    def enter(self, message):
-        """enter(self, string)
-        """
-        if self.isLoaded == 0:
-            self.load()
-
-        if self.text:
-            self.text.setText(message)
-            self.text.reparentTo(aspect2d)
-
-        if self.okButton:
-            self.okButton.manage()
-            self.accept("ForceAcknowledge-ok", self.__handleOk)
-        return None
-
-    def exit(self):
-        """exit(self)
-        """
-        if self.isLoaded == 0:
-            return None
-
-        self.ignore("ForceAcknowledge-ok")
-
-        self.text.reparentTo(hidden)
-        self.okButton.unmanage()
-        return None
-
-    def load(self):
-        """load(self)
-        """
-        if self.isLoaded == 1:
-            return None
-
-        # create a message
-        self.text = OnscreenText.OnscreenText(parent = hidden,
-                                              scale = 0.08,
-                                              pos = (0.0, 0.25))
-        # create a button
-        self.okButton = Button.Button("ForceAcknowledge", "OK",
-                                      event = "ForceAcknowledge-ok")
-        self.okButton.setPos(0.0, -0.5)
-        self.okButton.button.setPriority(self.okButton.button,
-                                         GuiItem.PHighest)
-
-        self.isLoaded = 1
-        return None
-
-    def unload(self):
-        """unload(self)
-        """
-        if self.isLoaded == 0:
-            return None
-
-        self.exit()
-
-        # GUI
-        self.okButton.cleanup()
-        self.okButton = None
-        self.isLoaded = 0
-        return None
-
-    def __handleOk(self, item):
-        if (item == self.okButton.button):
-            self.doneStatus = "ok"
-            messenger.send(self.doneEvent)

+ 0 - 135
direct/src/gui/Frame.py

@@ -1,135 +0,0 @@
-from ShowBaseGlobal import *
-from DirectObject import *
-from GuiGlobals import *
-import GuiFrame
-import Vec3
-
-class Frame(DirectObject):
-
-    # special methods
-    def __init__(self, name):
-        self.name = name
-        self.managed = 0
-        self.offset = 0
-        self.frame = GuiFrame.GuiFrame(name)
-        self.items = []
-        return None
-
-    def cleanup(self):
-        """cleanup(self)
-        """
-        if (self.managed):
-            self.frame.unmanage()
-        self.frame = None
-        return None
-        
-    def __str__(self):
-        return "Frame: %s = %s" % (self.name, self.items)
-
-    # accessing
-    def getName(self):
-        return self.name
-
-    def getPos(self):
-        return self.frame.getPos()
-
-    def setPos(self, x, y):
-        v3 = Vec3.Vec3(x, 0., y)
-        self.frame.setPos(v3)
-
-    def setScale(self, scale):
-        self.frame.setScale(scale)
-
-    def getOffset(self):
-        return self.offset
-
-    def setOffset(self, offset):
-        self.offset = offset
-
-    # actions
-    def freeze(self):
-        self.frame.freeze()
-
-    def thaw(self):
-        self.frame.thaw()
-
-    def manage(self, nodepath = aspect2d):
-        if nodepath:
-            self.frame.manage(guiMgr, base.eventMgr.eventHandler,
-                               nodepath.node())
-        else:
-            self.frame.manage(guiMgr, base.eventMgr.eventHandler)
-        self.managed = 1
-        
-    def unmanage(self):
-        self.frame.unmanage()
-        self.managed = 0
-
-    def recompute(self):
-        self.frame.recompute()
-
-    def clearAllPacking(self):
-        self.frame.clearAllPacking()
-        
-    # content functions
-    def addItem(self, item):
-        self.frame.addItem(item.getGuiItem())
-        self.items.append(item)
-
-    def removeItem(self, item):
-        self.frame.removeItem(item.getGuiItem())
-        self.items.remove(item)
-
-    def getGuiItem(self):
-        return self.frame
-    
-    def getItems(self):
-        return self.items
-
-    def printItems(self):
-        print "frame items: %s" % (self.items)
-        
-    def packItem(self, item, relation, otherItem):
-        if (item in self.items) and (otherItem in self.items):
-            self.frame.packItem(item.getGuiItem(), relation,
-                                otherItem.getGuiItem(), self.offset)
-        else:
-            print "warning: tried to pack item that isn't in frame"
-            
-    # convenience functions
-    def makeVertical(self):
-        # make each item (except first) align under the last
-        for itemNum in range(1, len(self.items)):            
-            self.packItem(self.items[itemNum], GuiFrame.GuiFrame.UNDER,
-                          self.items[itemNum - 1])
-            self.packItem(self.items[itemNum], GuiFrame.GuiFrame.ALIGNLEFT,
-                          self.items[itemNum - 1])
-        self.frame.recompute()
-            
-    def makeHorizontal(self):
-        # make each item (except first) align right of the last
-        for itemNum in range(1, len(self.items)):
-            self.packItem(self.items[itemNum], GuiFrame.GuiFrame.RIGHT,
-                          self.items[itemNum - 1])
-            self.packItem(self.items[itemNum], GuiFrame.GuiFrame.ALIGNABOVE,
-                          self.items[itemNum - 1])
-        self.frame.recompute()
-            
-    def makeWideAsWidest(self):
-        # make all the buttons as wide as the widest button in
-        # the frame
-        widestWidth = 0.0
-        # find the widest
-        for item in self.items:
-            thisWidth = item.getWidth()
-            if (thisWidth > widestWidth):
-                widestWidth = thisWidth
-
-        # make them all this wide
-        for item in self.items:
-            item.setWidth(widestWidth)
-
-            
-        
-
-

+ 0 - 77
direct/src/gui/GuiGlobals.py

@@ -1,77 +0,0 @@
-# GuiGlobals.py : global info for the gui package
-
-from ShowBaseGlobal import *
-import GuiManager
-
-guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(),
-                                      base.render2d.node())
-
-font = None
-sndClick = None
-sndRollover = None
-panel = None
-drawOrder = 100
-
-def getDefaultFont():
-    global font
-    if font == None:
-        font = loader.loadFont("models/fonts/Comic")
-    return font
-
-def setDefaultFont(newFont):
-    global font
-    font = newFont
-
-def getDefaultPanel():
-    return panel
-
-def setDefaultPanel(newPanel):
-    global panel
-    panel = newPanel
-
-def getDefaultDrawOrder():
-    return drawOrder
-
-def setDefaultDrawOrder(newDrawOrder):
-    global drawOrder
-    drawOrder = newDrawOrder
-
-def getDefaultRolloverSound():
-    global sndRollover
-    if not base.wantSfx:
-        return None
-    if sndRollover == None:
-        sndRollover = base.loadSfx("phase_3/audio/sfx/GUI_rollover.mp3")
-    return sndRollover
-
-def getDefaultClickSound():
-    global sndClick
-    if not base.wantSfx:
-        return None
-    if sndClick == None:
-        sndClick = base.loadSfx("phase_3/audio/sfx/GUI_create_toon_fwd.mp3")
-    return sndClick
-
-def getNewRolloverFunctor(sound = None):
-    val = None
-    if sound:
-        roll = sound
-    else:
-        roll = getDefaultRolloverSound()
-    if roll:
-        val = AudioGuiFunctor(roll)
-    else:
-        val = AudioGuiFunctor()
-    return val
-
-def getNewClickFunctor(sound = None):
-    val = None
-    if sound:
-        click = sound
-    else:
-        click = getDefaultClickSound()
-    if click:
-        val = AudioGuiFunctor(click)
-    else:
-        val = AudioGuiFunctor()
-    return val

+ 0 - 198
direct/src/gui/Label.py

@@ -1,198 +0,0 @@
-from ShowBaseGlobal import *
-from DirectObject import *
-from GuiGlobals import *
-
-## These are the styles of labels we might commonly see.  They control
-## the way the label looks.
-
-ButtonUp = 1
-ButtonUpGui = 2
-ButtonLit = 3
-ButtonDown = 4
-ButtonInactive = 5
-Sign = 6
-SignBlack = 7
-ScrollTitle = 8
-ScrollItem = 9
-
-
-def textLabel(string, style,
-              scale = 0.1,
-              width = None,
-              drawOrder = getDefaultDrawOrder(),
-              font = getDefaultFont(),
-              mayChange = 0):
-    """textLabel(string, int style, float scale, float width,
-                 int drawOrder, Node font)
-
-    Generates a text label suitable for adding to a GuiButton or
-    GuiSign.
-
-    """
-    
-    (label, text) = \
-            textLabelAndText(string, style, scale, width, drawOrder,
-                             font, mayChange)
-    return label
-    
-def textLabelAndText(string, style,
-                     scale = 0.1,
-                     width = None,
-                     drawOrder = getDefaultDrawOrder(),
-                     font = getDefaultFont(),
-                     mayChange = 0):
-    """textLabelAndText(string, int style, float scale, float width,
-                        int drawOrder, Node font)
-
-    Generates a text label suitable for adding to a GuiButton or
-    GuiSign.
-
-    This function returns both the label and the TextNode that is
-    within the label, allowing the calling function to update the
-    label's text later.  If there are a limited number of text
-    strings, however, it would probably be better to create a separate
-    GuiItem for each possible text string, and rotate them in and out.
-
-    """
-    text = TextNode()
-
-    # Freeze the text so we can set up its properties.
-    text.freeze()
-    
-    text.setFont(font)
-    text.setAlign(TMALIGNCENTER)
-    text.setDrawOrder(drawOrder)
-    text.setTextColor(0.0, 0.0, 0.0, 1.0)
-    text.setCardColor(1.0, 1.0, 1.0, 1.0)
-    text.setCardAsMargin(0.1, 0.1, 0.0, 0.0)
-    text.setTransform(Mat4.scaleMat(scale))
-
-    # The style might *itself* be a four-component color.
-    if (isinstance(style, types.TupleType) or
-        isinstance(style, VBase4)):
-        # If the style is a tuple, it means black on the specified color.
-        text.setCardColor(style[0], style[1], style[2], style[3])
-
-    elif style == ButtonUp:
-        # This is the default: black on white.
-        pass
-
-    elif style == ButtonUpGui:
-        # special GUI button with our lovely gui color
-        text.setCardColor(0.25, 0.7, 0.85, 1.0)
-        
-    elif style == ButtonLit:
-        # When the mouse is over the button, the background turns
-        # yellow.
-        text.setCardColor(1.0, 1.0, 0.0, 1.0)
-        
-    elif style == ButtonDown:
-        # When the button is being depressed, its turns to white
-        # on black.
-        text.setTextColor(1.0, 1.0, 1.0, 1.0)
-        text.setCardColor(0.0, 0.0, 0.0, 1.0)
-        
-    elif style == ButtonInactive:
-        # When the button is inactive, it's gray on gray.
-        text.setTextColor(0.4, 0.4, 0.4, 1.0)
-        text.setCardColor(0.9, 0.9, 0.9, 1.0)
-        
-    elif style == Sign:
-        # For a sign, we want red text with no background card.
-        text.setTextColor(1., 0., 0., 1.)
-        text.clearCard()
-
-    elif style == SignBlack:
-        # For a black sign, we want black text with no background card.
-        text.setTextColor(0., 0., 0., 1.)
-        text.clearCard()
-
-    elif style == ScrollTitle:
-        text.setTextColor(1., 0., 0., 1.)
-        text.setCardColor(1., 1., 1., 0.)
-    
-    elif style == ScrollItem:
-        pass
-
-    else:
-        raise ValueError
-
-
-    # Don't set the text until the very last thing, so the TextNode
-    # has minimal work to do (even though it's frozen).
-    text.setText(string)
-
-    v = text.getCardActual()
-
-    if width != None:
-        # If the user specified a specific width to use, keep it.
-        v = VBase4(-width / 2.0, width / 2.0, v[2], v[3])
-        if text.hasCard():
-            text.setCardActual(v[0], v[1], v[2], v[3])
-
-    # Now we're completely done setting up the text, and we can safely
-    # thaw it.
-    if mayChange:
-        # If we might change the text later, we have to keep the
-        # TextNode around.
-        text.thaw()
-    else:
-        # Otherwise, we can throw it away.
-        node = text.generate()
-        text = node
-
-    # Now create a GuiLabel containing this text.
-    label = GuiLabel.makeModelLabel(text, v[0] * scale, v[1] * scale,
-                                    v[2] * scale, v[3] * scale)
-
-    label.setDrawOrder(drawOrder)
-    return (label, text)
-
-
-def modelLabel(model,
-               geomRect = None,
-               style = None,
-               scale = (0.1, 0.1),
-               drawOrder = getDefaultDrawOrder()):
-    # Preserve transitions on the arc by creating an intervening node.
-    topnode = NamedNode('model')
-    topnp = NodePath(topnode)
-    mi = model.instanceTo(topnp)
-    mi.setScale(scale[0], scale[0], scale[1])
-    mi.setBin('fixed', drawOrder)
-    if style != None:
-        # For a modelLabel, the style determines the color that may be
-        # applied.
-        color = None        
-        # The style might *itself* be a four-component color.
-        if (isinstance(style, types.TupleType) or
-            isinstance(style, VBase4)):
-            color = style
-        # Otherwise, there might be a predefined default color for one
-        # of the canned styles.  Most don't have a default color,
-        # though.
-        elif style == ButtonInactive:
-            color = (0.5, 0.5, 0.5, 1.0)            
-        if color != None:
-            mi.setColor(color[0], color[1], color[2], color[3])
-            if color[3] != 1.0:
-                mi.setTransparency(1)        
-    if geomRect == None:
-        geomRect = (1, 1)
-    if len(geomRect) == 2:
-        # If we got only two parameters, it's height and width.
-        label = GuiLabel.makeModelLabel(topnode,
-                                        geomRect[0] * scale[0],
-                                        geomRect[1] * scale[1])
-    elif len(geomRect) == 4:
-        # If we got four, they're left, right, bottom, top.
-        label = GuiLabel.makeModelLabel(topnode,
-                                        geomRect[0] * scale[0],
-                                        geomRect[1] * scale[0],
-                                        geomRect[2] * scale[1],
-                                        geomRect[3] * scale[1])
-    else:
-        raise ValueError    
-    label.setDrawOrder(drawOrder)
-    return label
-                                    

+ 0 - 129
direct/src/gui/ListBox.py

@@ -1,129 +0,0 @@
-from ShowBaseGlobal import *
-from DirectObject import *
-from GuiGlobals import *
-import Button
-import Label
-import types
-
-
-class ListBox(DirectObject):
-
-    def __init__(self, name, numSlots,
-                 scale = 0.1,
-                 width = None,
-                 drawOrder = getDefaultDrawOrder(),
-                 font = getDefaultFont()):
-
-        self.name = name
-        self.numSlots = numSlots
-
-        self.scale = scale
-        self.width = width
-        self.drawOrder = drawOrder
-        self.font = font
-
-        arrow = loader.loadModelOnce('phase_3/models/props/scroll-arrow')
-
-        arrowScale = 0.1
-        self.up = Button.Button(name + '-up', arrow,
-                                geomRect = (-1, 1, 0, 0.5),
-                                scale = arrowScale,
-                                drawOrder = drawOrder,
-                                downStyle = (0.5, 0, 0, 1),
-                                supportInactive = 1)
-        arrow.setR(180)
-        self.down = Button.Button(name + '-down', arrow,
-                                  geomRect = (-1, 1, -0.5, 0),
-                                  scale = arrowScale,
-                                  drawOrder = drawOrder,
-                                  downStyle = (0.5, 0, 0, 1),
-                                  supportInactive = 1)
-        arrow.removeNode()
-
-        self.listBox = GuiListBox(self.name + '-lb', self.numSlots,
-                                  self.up.button, self.down.button)
-
-        self.managed = 0
-
-        self.items = []
-
-        return None
-
-    def addItem(self, item, label, event = None, param = None):
-        if event:
-            button = Button.Button(item, label, scale = self.scale,
-                                   width = self.width,
-                                   drawOrder = self.drawOrder,
-                                   font = self.font, event = event)
-            button.button.setBehaviorEventParameter(param)
-            button.button.startBehavior()
-        else:
-            button = Button.Button(item, label,
-                                   scale = self.scale,
-                                   width = self.width,
-                                   drawOrder = self.drawOrder,
-                                   font = self.font)
-        
-        self.items.append((item, button))
-        self.listBox.addItem(button.button)
-
-    def addItems(self, items):
-        for i in items:
-            if isinstance(i, types.StringType):
-                self.addItem(i, i)
-            else:
-                if (len(i) == 3):
-                    self.addItem(i[0], i[1])
-                else:
-                    self.addItem(i[0], i[1], i[3], i[4])
-
-    def cleanup(self):
-        if (self.managed):
-            self.unmanage()
-        for i in self.items:
-            i[1].cleanup()
-        self.up.cleanup()
-        self.down.cleanup()
-        self.listBox = None
-        return None
-        
-    def __str__(self):
-        return "ListBox: %s" % (self.name)
-
-    def getName(self):
-        return self.name
-
-    def getNumSlots(self):
-        return self.numSlots
-    
-    def getGuiItem(self):
-        return self.listBox
-
-    def getUpButton(self):
-        return self.up
-
-    def getDownButton(self):
-        return self.down
-
-    def freeze(self):
-        self.listBox.freeze()
-
-    def thaw(self):
-        self.listBox.thaw()
-        
-    def manage(self, nodepath = aspect2d):
-        if nodepath:
-            self.listBox.manage(guiMgr, base.eventMgr.eventHandler,
-                                nodepath.node())
-        else:
-            self.listBox.manage(guiMgr, base.eventMgr.eventHandler)
-        self.listBox.startBehavior()
-        self.managed = 1
-
-    def unmanage(self):
-        self.listBox.unmanage()
-        self.listBox.stopBehavior()
-        self.managed = 0
-    
-    def setPos(self, x, y):
-        self.listBox.setPos(Vec3(x, 0., y))

+ 0 - 413
direct/src/gui/OnscreenPanel.py

@@ -1,413 +0,0 @@
-from ShowBaseGlobal import *
-import GuiGlobals
-import PandaObject
-import Button
-import Label
-import OnscreenText
-import types
-
-
-def findPanel(uniqueName):
-    """findPanel(string uniqueName)
-    
-    Returns the panel whose uniqueName is given.  This is mainly
-    useful for debugging, to get a pointer to the current onscreen
-    panel of a particular type.
-
-    """
-    if OnscreenPanel.AllPanels.has_key(uniqueName):
-        return OnscreenPanel.AllPanels[uniqueName]
-    return None
-
-def cleanupPanel(uniqueName):
-    """cleanupPanel(string uniqueName)
-
-    Cleans up (removes) the panel with the given uniqueName.  This
-    may be useful when some panels know about each other and know
-    that opening panel A should automatically close panel B, for
-    instance.
-    """
-        
-    if OnscreenPanel.AllPanels.has_key(uniqueName):
-        # calling cleanup() will remove it out of the AllPanels dict
-        # This way it will get removed from the dict even it we did
-        # not clean it up using this interface (ie somebody called
-        # self.cleanup() directly
-        OnscreenPanel.AllPanels[uniqueName].cleanup()
-
-
-class OnscreenPanel(PandaObject.PandaObject, NodePath):
-    """OnscreenPanel:
-
-    This class defines the basic interface to a user-interface panel
-    that pops up within the Panda window, overlaying whatever graphics
-    we may have already.
-
-    """
-
-    AllPanels = {}
-
-    def __init__(self, panelName):
-        self.panelName = panelName
-        self.panelSetup = 0
-        
-        # initialize our NodePath essence.
-        NodePath.__init__(self, aspect2d.attachNewNode(panelName))
-        NodePath.hide(self)
-        
-    def makePanel(self,
-                  rect = (-0.5, 0.5, -0.5, 0.5),
-                  bg = (1, 1, 1, 1),
-                  geom = GuiGlobals.getDefaultPanel(),
-                  geomRect = (-0.5, 0.5, -0.5, 0.5),
-                  drawOrder = 0,
-                  font = GuiGlobals.getDefaultFont(),
-                  support3d = 0):
-        """makePanel()
-
-        Initializes the geometry to render the panel with the
-        specified parameters.  This should only be called once, and
-        generally by the __init__ function.
-
-        The parameters are as follows:
-
-          rect: the (left, right, bottom, top) of the panel on the
-              screen.  This is in aspect2d coordinates.  The panel
-              will be set up in its own coordinate system so that (0,
-              0) is the center of the panel.
-
-          bg: the (r, g, b, a) background color of the panel.
-
-          geom: the model to use as the background panel geometry.
-              Normally you can safely let this default.
-
-          geomRect: the (left, right, bottom, top) rectangle around
-              the background panel geometry as it is modeled.  This is
-              used to compute how the panel should be scaled to make
-              it fit the rectangle specified by rect, above.
-
-          drawOrder: the drawing order of this panel with respect to
-              all other things in the 'fixed' bin within render2d.
-              Buttons and text created within the panel via
-              makeButton() and makeText() will by default be given a
-              drawOrder slightly higher than this.  Normally you can
-              safely let this default, unless you really expect this
-              panel to overlay some other panels.
-
-          font: the default font for buttons and text created within
-              the panel via makeButton() and makeText().
-
-          support3d: if this is set true, the panel will be set up so
-              that 3-d geometry (like a floating head) may be safely
-              parented to the panel.
-        """
-
-        assert not self.panelSetup
-
-        # Clean up any previously existing panel with the same unique
-        # name.  We don't allow any two panels with the same name to
-        # coexist.
-        uniqueName = self.getUniqueName()
-        cleanupPanel(uniqueName)
-
-        # Store this panel in our map of all open panels.
-        OnscreenPanel.AllPanels[uniqueName] = self
-        
-        self.panelSetup = 1
-        self.panelDrawOrder = drawOrder
-        self.panelFont = font
-
-        self.panelButtons = []
-        self.panelText = []
-
-        if geom == None:
-            # If 'geom' is None, it means not to have a background
-            # panel at all.
-            self.panelGeom = None
-            
-        elif isinstance(geom, types.StringType):
-            # If 'geom' is a string, it's the name of a model to load.
-            self.panelGeom = loader.loadModelCopy(geom)
-            self.panelGeom.reparentTo(self)
-        else:
-            # Otherwise, it's a model to instance.
-            self.panelGeom = geom.instanceTo(self)
-
-        centerX = (rect[0] + rect[1]) / 2.0
-        centerY = (rect[2] + rect[3]) / 2.0
-        NodePath.setPos(self, centerX, 0, centerY)
-
-        self.setBin('fixed', self.panelDrawOrder)
-        self.panelRegion = None
-
-        if self.panelGeom != None:
-            # Scale and position the geometry to fill up our desired
-            # rectangle.
-            gCenterX = (geomRect[0] + geomRect[1]) / 2.0
-            gCenterY = (geomRect[2] + geomRect[3]) / 2.0
-
-            self.panelGeom.setPos(-gCenterX, 0, -gCenterY)
-            self.panelGeom.setScale((rect[1] - rect[0]) / (geomRect[1] - geomRect[0]), 1,
-                                    (rect[3] - rect[2]) / (geomRect[3] - geomRect[2]))
-
-            if bg[3] != 1:
-                self.panelGeom.setTransparency(1)
-            self.panelGeom.setColor(bg[0], bg[1], bg[2], bg[3])
-
-            if support3d:
-                # If we're supposed to support 3-d geometry in front of
-                # the panel, set a few extra attributes to ensure the
-                # panel geometry fills up the depth buffer as it goes,
-                # making it safe to put 3-d geometry in front of it.
-                dw = DepthWriteTransition()
-                self.panelGeom.setY(100)
-                self.panelGeom.arc().setTransition(dw, 1)
-
-            # Set up the panel as its own mouse region so mouse clicks on
-            # the panel don't inadvertently drive the toon around.  This
-            # must be done after the panelGeom has been scaled
-            # appropriately, above.
-            self.geomRect = geomRect
-            self.panelRegion = MouseWatcherRegion(uniqueName, 0, 0, 0, 0)
-            self.panelRegion.setRelative(self.panelGeom,
-                                         geomRect[0], geomRect[1],
-                                         geomRect[2], geomRect[3])
-            self.panelRegion.setSort(self.panelDrawOrder)
-
-    def cleanup(self):
-        """cleanup(self):
-
-        Removes the panel and frees all the resources associated with
-        it.  This must be called to safely remove the panel from the
-        screen.
-
-        The return value is true if the panel was cleaned up, or false
-        if it had already been cleaned up.
-
-        """
-        if not self.panelSetup:
-            return 0
-
-        self.hide()
-        
-        for button in self.panelButtons:
-            button.cleanup()
-        del self.panelButtons
-
-        for text in self.panelText:
-            text.cleanup()
-        del self.panelText
-
-        if not self.isEmpty():
-            self.removeNode()
-
-        # Remove this panel out of the AllPanels list
-        uniqueName = self.getUniqueName()
-        if OnscreenPanel.AllPanels.has_key(uniqueName):
-            del OnscreenPanel.AllPanels[uniqueName]
-
-        self.panelSetup = 0
-        return 1
-
-    def show(self):
-        """show(self):
-        Show everything and hang hooks
-        """
-        if not self.panelSetup:
-            return 0
-
-        NodePath.show(self)
-
-        # show the buttons that are meant to be shown
-        for button in self.panelButtons:
-            if button.panelManage:
-                button.manage(self)
-            if button.func != None:
-                if (button.event != None):
-                    self.accept(button.event, button.func, [button.button])
-                else:
-                    self.accept(button.button.getDownRolloverEvent(),
-                                button.func, [button.button])
-                button.startBehavior()
-
-        if self.panelRegion != None:
-            base.mouseWatcherNode.addRegion(self.panelRegion)
-        
-    def hide(self):
-        """hide(self):
-        Hide everything and remove hooks
-        """
-        if not self.panelSetup:
-            return 0
-
-        NodePath.hide(self)
-
-        # hide the shown buttons and remove all hooks
-        for button in self.panelButtons:        
-            if (button.event != None):
-                self.ignore(button.event)
-            else:
-                self.ignore(button.button.getDownRolloverEvent())
-            if button.panelManage:
-                button.unmanage()
-
-        if self.panelRegion != None:
-            base.mouseWatcherNode.removeRegion(self.panelRegion)
-
-    def makeButton(self, name,
-                   func = None,
-                   manage = 1,
-                   label = None,
-                   labels = None,
-                   scale = 0.1,
-                   width = None,
-                   align = None,
-                   drawOrder = None,
-                   font = None,
-                   pos = (0, 0),
-                   geomRect = None,
-                   supportInactive = 0,
-                   inactive = 0,
-                   upStyle = Label.ButtonUp,
-                   litStyle = Label.ButtonLit,
-                   downStyle = Label.ButtonDown,
-                   inactiveStyle = Label.ButtonInactive,
-                   event = None):
-        """makeButton(self, ...)
-
-        Creates a button on the panel.  The return value is the button
-        itself.  The position of the button is relative to the panel,
-        where (0, 0) is the center.
-
-        The button will automatically be managed (i.e. made visible)
-        unless manage is set to 0.
-
-        If func is specified, it is the name of a function that will
-        be called when the button is clicked.  In this case, a hook
-        will automatically be assigned for the button, and removed
-        when cleanup() is called.
-        """
-
-        assert self.panelSetup
-
-        if (label == None) and (labels == None):
-            label = name
-        if drawOrder == None:
-            drawOrder = self.panelDrawOrder + 10
-        if font == None:
-            font = self.panelFont
-
-        buttonName = self.getUniqueName() + '-' + name
-            
-        button = Button.Button(buttonName,
-                               label = label,
-                               labels = labels,
-                               scale = scale,
-                               width = width,
-                               align = align,
-                               drawOrder = drawOrder,
-                               font = font,
-                               pos = pos,
-                               geomRect = geomRect,
-                               supportInactive = supportInactive,
-                               inactive = inactive,
-                               upStyle = upStyle,
-                               litStyle = litStyle,
-                               downStyle = downStyle,
-                               inactiveStyle = inactiveStyle,
-                               event = event)
-
-        self.panelButtons.append(button)
-        
-        button.panelManage = manage
-        button.func = func
-        
-        return button
-
-    def makeText(self, text = '',
-                 style = OnscreenText.Plain,
-                 pos = (0, 0),
-                 scale = None,
-                 fg = None,
-                 bg = None,
-                 shadow = None,
-                 frame = None,
-                 align = None,
-                 wordwrap = None,
-                 drawOrder = None,
-                 font = None,
-                 parent = None,
-                 mayChange = 0):
-        """makeText(self, ...)
-
-        Creates some text on the panel.  The return value is an
-        OnscreenText object.  The position of the text is relative to
-        the panel, where (0, 0) is the center.
-
-        The text need not be further managed by the derived class.  It
-        will automatically be removed when cleanup() is called.
-        
-        """
-
-        assert self.panelSetup
-
-        if drawOrder == None:
-            drawOrder = self.panelDrawOrder + 10
-        if font == None:
-            font = self.panelFont
-        if parent == None:
-            parent = self
-
-        text = OnscreenText.OnscreenText(text,
-                                         style = style,
-                                         pos = pos,
-                                         scale = scale,
-                                         fg = fg,
-                                         bg = bg,
-                                         shadow = shadow,
-                                         frame = frame,
-                                         align = align,
-                                         wordwrap = wordwrap,
-                                         drawOrder = drawOrder,
-                                         font = font,
-                                         parent = parent,
-                                         mayChange = mayChange)
-        
-        self.panelText.append(text)
-        return text
-
-    def getUniqueName(self):
-        """getUniqueName(self):
-
-        Returns a name unique to this panel.  If no two instances of
-        the same panel will ever be in existence at once, this can
-        simply be the panel name.  If, for some reason, you want to
-        define a panel type that can have multiple instances, you
-        should redefine this function to return a unique name for each
-        instance.
-
-        """
-        
-        return self.panelName
-
-
-    def setPos(self, x, y, z):
-        """setPos(self, x, y, z)
-
-        Repositions the panel onscreen, taking all of the panel's
-        managed buttons along with it.
-        
-        """
-        assert self.panelSetup
-        NodePath.setPos(self, x, y, z)
-
-        for button in self.panelButtons:
-            if button.managed:
-                button.unmanage()
-                button.manage(self)
-
-        if self.panelRegion != None:
-            self.panelRegion.setRelative(self.panelGeom,
-                                         self.geomRect[0], self.geomRect[1],
-                                         self.geomRect[2], self.geomRect[3])
-

+ 3 - 3
direct/src/gui/OnscreenText.py

@@ -1,7 +1,7 @@
 """OnscreenText module: contains the OnscreenText class"""
 
 from PandaObject import *
-import GuiGlobals
+import DirectGuiGlobals
 import types
 
 ## These are the styles of text we might commonly see.  They set the
@@ -26,8 +26,8 @@ class OnscreenText(PandaObject, NodePath):
                  frame = None,
                  align = None,
                  wordwrap = None,
-                 drawOrder = GuiGlobals.getDefaultDrawOrder(),
-                 font = GuiGlobals.getDefaultFont(),
+                 drawOrder = DirectGuiGlobals.getDefaultDrawOrder(),
+                 font = DirectGuiGlobals.getDefaultFont(),
                  parent = aspect2d,
                  sort = 0,
                  mayChange = 0):

+ 0 - 224
direct/src/gui/PickList.py

@@ -1,224 +0,0 @@
-"""PickList module: contains the PickList class"""
-from ShowBaseGlobal import *
-from GuiGlobals import *
-import PandaObject
-import Frame
-import Button
-
-class PickList(PandaObject.PandaObject):
-    """PickList class: display a menu of choices and report users
-    choice (via mouse or keyboard) as an event with the choice as
-    an extra argument
-    """
-
-    # special methods
-    def __init__(self, name, choiceList,
-                 scale = 0.1,
-                 width = None,
-                 drawOrder = getDefaultDrawOrder(),
-                 font = getDefaultFont()):
-
-        self.name = name
-        self.frame = Frame.Frame(name)
-        
-        # initialization
-        self.choice = -1
-        self.choiceList = []
-        self.eventName = self.name
-        self.frame.setOffset(0.015)
-        
-        # display the menu
-        self.__displayChoices(choiceList, scale, width, drawOrder, font)
-        self.isClean = 0
-        return None
-
-    def owns(self, item):
-        for x in self.choiceList:
-            if (x.button == item):
-                return 1
-        return None
-
-    def cleanup(self):
-        """cleanup(self)
-        """
-        if self.isClean == 0:
-            self.isClean = 1
-            self.disable()
-            self.frame.unmanage()
-            self.frame = None
-            self.choiceList = []
-        return None
-        
-    # accessing
-    def getName(self):
-        return self.name
-
-    def getEventName(self):
-        return self.eventName
-
-    def setEventName(self, eventName):
-        self.eventName = eventName
-
-    # actions
-    def __displayChoices(self, choiceList,
-                         scale, width, drawOrder, font):
-        """__displayChoices(self, string[])
-        Display the list of choices
-        """
-
-        if width == None:
-            # First, compute the maximum width of the buttons.  We do this
-            # ahead of time so the Gui code doesn't have to do it and take
-            # forever about it.
-            width = 0
-            text = TextNode()
-            text.setFont(font)
-            for choice in choiceList:
-                w = text.calcWidth(choice) + 0.2
-                width = max(width, w)
-
-        # Now create all the buttons.
-        for choice in choiceList:
-            # create a button for each choice
-            button = Button.Button(choice, scale = scale, width = width,
-                                   drawOrder = drawOrder, font = font,
-                                   event = "choose")
-            choiceIndex = choiceList.index(choice)
-            button.setBehaviorEventParameter(choiceIndex)
-            # set the rollover-up event
-            eventName = self.name + "-up"
-            button.button.setUpRolloverEvent(eventName)
-            # set exit event
-            eventName = self.name + "-exit"
-            button.button.setUpEvent(eventName)
-            # keep a list of the choice buttons
-            self.frame.addItem(button)
-            self.choiceList.append(button)
-        
-        # set up the frame
-        self.frame.makeVertical()
-
-        return None
-
-    def manage(self):
-        self.enable()
-        self.frame.manage()
-        for x in self.choiceList:
-            x.startBehavior()
-        return None
-
-    def unmanage(self):
-        self.disable()
-        self.frame.unmanage()
-        return None
-
-    def enable(self):
-        # turn the buttons on
-        self.activate()
-        
-        # listen for keyboard events
-        self.accept("up-up", self.__decrementChoice)
-        self.accept("down-up", self.__incrementChoice)
-        self.accept("enter-up", self.__makeChoice, [1, None, None])
-        self.accept(self.name + "-up", self.__updateButtonChoice)
-        self.accept(self.name + "-exit", self.__exitChoice)
-        self.accept("choose", self.__makeChoice, [0])
-
-    def disable(self, button=None):
-        # turn the buttons off
-        self.deactivate(button)
-
-        # ignore all hooks
-        self.ignore("up-up")
-        self.ignore("down-up")
-        self.ignore("enter-up")
-        self.ignore(self.name + "-up")
-        self.ignore(self.name + "-exit")
-        self.ignore("choose")
-
-    def activate(self):
-        # make sure items are active
-        for choice in self.choiceList:
-            choice.getGuiItem().up()
-
-    def deactivate(self, button=None):
-        # make sure all items are inactive, if a button
-        # is passed in do NOT deactivate it.
-        for choice in self.choiceList:
-            if (choice.getGuiItem().isActive()):
-                if not (button == None):
-                    if not (self.choiceList.index(choice) == button):
-                        choice.getGuiItem().inactive()
-                else:
-                    choice.getGuiItem().inactive()
-                    
-    def recompute(self):
-        self.frame.recompute()
-
-    def setPos(self, x, y):
-        self.frame.setPos(x, y)
-
-    # event handlers
-    def __incrementChoice(self):
-        # handle the up arrow
-        choice = self.choice + 1
-        if (choice > len(self.choiceList) - 1):
-            choice = 0
-        # enter the new choice
-        self.choiceList[choice].getGuiItem().enter()
-    
-    def __decrementChoice(self):
-        # handle the down arrow
-        choice = self.choice - 1
-        if (choice < 0):
-            choice = len(self.choiceList) - 1
-        # enter this choice
-        self.choiceList[choice].getGuiItem().enter()
-
-    def __updateButtonChoice(self, item):
-        # handle the mouse rollovers
-        if self.owns(item):
-            if (self.choice == -1):
-                self.choice = item.getBehaviorEventParameter()
-            if (self.choice != item.getBehaviorEventParameter()):
-                self.choice = item.getBehaviorEventParameter()
-                # make sure all the other buttons have exited
-                for choice in self.choiceList:
-                    if (choice.button != item):
-                        choice.getGuiItem().exit()
-                # throw event
-                messenger.send(self.name + "-rollover")
-            
-    def __exitChoice(self, item):
-        # reset choice when mouse exits a button
-        if self.owns(item):
-            if (self.choice == item.getBehaviorEventParameter()):
-                self.choice = -1
-        
-    def __makeChoice(self, button, item, whichOne):
-        # handle the enter key
-        if (self.choice == -1):
-            # nothing selected yet
-            return None
-        else:
-            # if the keyboard was used, update the button manually
-            if (button):
-                self.choiceList[self.choice].getGuiItem().down()
-                def buttonUp(state):
-                    state.choice.getGuiItem().up()
-                    return Task.done
-                task = Task.Task(buttonUp)
-                task.choice = self.choiceList[self.choice]
-                taskMgr.spawnTaskNamed(Task.doLater(0.035, task,
-                                                    "buttonUp-later"),
-                                       "doLater-buttonUp-later")
-            else:
-                # let everyone know a choice was made                
-                if self.owns(item):
-                    messenger.send(self.eventName, [self.choice])
-                    self.disable(self.choice)
-                
-                
-
-
-

+ 0 - 290
direct/src/gui/ScrollingLabel.py

@@ -1,290 +0,0 @@
-from ShowBaseGlobal import *
-from GuiGlobals import *
-import PandaObject
-import Frame
-import GuiFrame
-import Button
-import GuiLabel
-import Sign
-import Label
-
-
-
-class ScrollingLabel(PandaObject.PandaObject):
-
-    # special methods
-    def __init__(self, name, itemList,
-                 label = None,
-                 scale = 0.1,
-                 width = None,
-                 drawOrder = getDefaultDrawOrder(),
-                 font = getDefaultFont(),
-                 showLabels = 1,
-                 leftLabels = None,
-                 rightLabels = None,
-                 ):
-
-        self.name = name
-        if (label == None):
-            self.label = self.name
-        else:
-            self.label = label
-        self.eventName = self.name
-        self.frame = Frame.Frame(name)
-        self.frame.setOffset(0.015)
-        self.item = 0
-        self.items = itemList
-        self.showLabels = showLabels
-        if (showLabels):
-            # we'll need a card to add text to later
-            itemString = " "
-        else:
-            # no card needed
-            itemString = ""
-        self.keyFocus = 1
-
-        if width == None:
-            # Compute the maximum width of the all the items.
-            width = 0
-            text = TextNode()
-            text.setFont(font)
-            for item in itemList:
-                w = text.calcWidth(item) + 0.2
-                width = max(width, w)
-
-        # create the new title
-        self.title = Sign.Sign(self.name, self.label, Label.ScrollTitle,
-                               scale, width, drawOrder, font)
-        self.frame.addItem(self.title)
-                
-        self.itemSign = Sign.Sign('item', itemString, Label.ScrollItem,
-                                  scale, width, drawOrder, font)
-        self.frame.addItem(self.itemSign)
-            
-        # pack the first label under the name 
-        self.frame.packItem(self.itemSign, GuiFrame.GuiFrame.UNDER,
-                            self.title)
-        self.frame.packItem(self.itemSign, GuiFrame.GuiFrame.ALIGNLEFT,
-                            self.title)
-        
-        # create the scroll buttons
-        if leftLabels:
-            self.leftButton = Button.Button(self.eventName + "-left",
-                                            labels = leftLabels,
-                                            scale = scale,
-                                            drawOrder = drawOrder,
-                                            font = font, event = "left-button")
-        else:
-            self.leftButton = Button.Button(self.eventName + "-left",
-                                            label = " < ",
-                                            scale = scale,
-                                            drawOrder = drawOrder,
-                                            font = font, event = "left-button")
-        self.leftButton.getGuiItem().setUpRolloverEvent(self.eventName + "-rollover")
-        self.frame.addItem(self.leftButton)
-        self.frame.packItem(self.leftButton, GuiFrame.GuiFrame.UNDER,
-                            self.title)
-        self.frame.packItem(self.leftButton, GuiFrame.GuiFrame.LEFT,
-                            self.title)
-
-        if rightLabels:
-            self.rightButton = Button.Button(self.eventName + "-right",
-                                             labels = rightLabels,
-                                             scale = scale,
-                                             drawOrder = drawOrder,
-                                             font = font, event = "right-button")
-        else:
-            self.rightButton = Button.Button(self.eventName + "-right",
-                                             label = " > ",
-                                             scale = scale,
-                                             drawOrder = drawOrder,
-                                             font = font, event = "right-button")            
-        self.rightButton.getGuiItem().setUpRolloverEvent(self.eventName + "-rollover")
-        self.frame.addItem(self.rightButton)
-        self.frame.packItem(self.rightButton, GuiFrame.GuiFrame.UNDER,
-                            self.title)
-        self.frame.packItem(self.rightButton, GuiFrame.GuiFrame.RIGHT,
-                            self.title)        
-
-        # set list to first element
-        self.setItem(self.item)
-        
-        # refresh the frame
-        self.frame.recompute()
-        return None
-
-    def cleanup(self):
-        """cleanup(self)
-        """
-        # ignore events
-        self.ignore("left-button")
-        self.ignore("right-button")
-        self.ignore(self.eventName + "-rollover")
-        self.setKeyFocus(0)
-
-        # remove gui items
-        self.frame.cleanup()
-        self.frame = None
-        self.items = None
-
-        self.label = None
-        self.title.cleanup()
-        self.title = None
-        self.itemSign.cleanup()
-        self.itemSign = None
-        self.leftButton.cleanup()
-        self.leftButton = None
-        self.rightButton.cleanup()
-        self.rightButton = None
-        return None
-
-    # accessing
-    def getTitle(self):
-        return self.name
-
-    def setTitle(self, name):
-        self.name = name
-        if (self.showLabels):
-            self.title.setText(name)
-            self.frame.recompute()
-
-    def getItemSign(self):
-        return self.itemSign
-    
-    def getItem(self):
-        return self.items[self.item]
-
-    def setItem(self, item):
-        self.item = item
-        if (self.showLabels):
-            self.itemSign.setText(self.items[self.item])
-        
-    def getEventName(self):
-        return self.eventName
-
-    def setEventName(self, eventName):
-        self.eventName = eventName
-
-    def getPos(self):
-        return self.frame.getPos()
-    
-    def setPos(self, x, y):
-        self.frame.freeze()
-        self.frame.setPos(x, y)
-        self.frame.recompute()
-        self.frame.thaw()
-        
-    def setScale(self, scale):
-        self.frame.freeze()
-        self.frame.setScale(scale)
-        self.frame.recompute()
-        self.frame.thaw()
-
-    def setWidth(self, width):
-        self.frame.freeze()
-        self.itemSign.setWidth(width)
-        self.frame.recompute()
-        self.frame.thaw()
-        
-    def getKeyFocus(self):
-        return self.keyFocus
-
-    def setKeyFocus(self, focus):
-        self.keyFocus = focus
-        if (focus == 1):
-            # remove old keyboard hooks
-            self.ignore("left-up")
-            self.ignore("right-up")            
-            # listen for new keyboard hits
-            self.accept("left-up", self.handleLeftArrow)
-            self.accept("right-up", self.handleRightArrow)
-        else:
-            # remove keyboard hooks
-            self.ignore("left-up")
-            self.ignore("right-up")
-        
-    # actions
-    def recompute(self):
-        self.frame.recompute()
-        
-    def manage(self):
-        # listen for the scroll buttons
-        self.accept("left-button", self.handleLeftButton)
-        self.accept("right-button", self.handleRightButton)
-
-        self.frame.manage()
-        self.setKeyFocus(0)
-
-        self.leftButton.startBehavior()
-        self.rightButton.startBehavior()
-
-        return None
-
-    def unmanage(self):
-        # ignore keyboard hits
-        self.ignore("left-up")
-        self.ignore("right-up")            
-
-        # ignore events
-        self.ignore("left-button")
-        self.ignore("right-button")
-        self.ignore(self.eventName + "-rollover")
-        self.setKeyFocus(0)
-
-        self.frame.unmanage()
-
-        return None
-        
-    def handleLeftButton(self, item):
-        # update the current item and the scroll label
-        if (self.leftButton.button == item):
-            self.item = self.item - 1
-            if (self.item < 0):
-                self.item = len(self.items) - 1
-            self.setItem(self.item)
-            messenger.send(self.eventName, [self.item])
-
-    def handleRightButton(self, item):
-        # update the current item and the scroll label
-        if (self.rightButton.button == item):
-            self.item = self.item + 1
-            if (self.item >= len(self.items)):
-                self.item = 0
-            self.setItem(self.item)
-            messenger.send(self.eventName, [self.item])
-
-    def handleLeftArrow(self):
-        # make the button toggle
-        self.leftButton.getGuiItem().down()
-        self.spawnButtonUpTask(self.leftButton)
-        # then act like a mouse click
-        # not needed, using the behavior system, this will happen once the
-        # button transitions to up again.
-        # self.handleLeftButton(self.leftButton.button)
-
-    def handleRightArrow(self):
-        # make the button toggle
-        self.rightButton.getGuiItem().down()
-        self.spawnButtonUpTask(self.rightButton)
-        # then act like a mouse click
-        # not needed, using the behavior system, this will happen once the
-        # button transitions to up again.
-        # self.handleRightButton(self.rightButton.button)
-
-    def spawnButtonUpTask(self, button):
-        def buttonUp(state):
-            state.button.getGuiItem().up()
-            return Task.done
-        task = Task.Task(buttonUp)
-        task.button = button
-        taskMgr.spawnTaskNamed(Task.doLater(.035, task, "buttonUp-later"),
-                               "doLater-buttonUp-later")
-    
-
-
-    
-
-
-
-
-

+ 0 - 78
direct/src/gui/Sign.py

@@ -1,78 +0,0 @@
-from ShowBaseGlobal import *
-from DirectObject import *
-from GuiGlobals import *
-import GuiSign
-import GuiLabel
-import Label
-
-class Sign(DirectObject):
-
-    def __init__(self, name,
-                 label = None,
-                 style = Label.Sign,
-                 scale = 0.1,
-                 width = None,
-                 drawOrder = getDefaultDrawOrder(),
-                 font = getDefaultFont()):
-        self.name = name
-        self.labelText = None
-        
-        if (label == None):
-            label = self.name
-
-        if (type(label) == type('')):
-            (self.label, self.labelText) = \
-                         Label.textLabelAndText(label, style,
-                                                scale, width, drawOrder, font)
-        else:
-            self.label = label
-
-        self.sign = GuiSign.GuiSign(self.name, self.label)
-        self.managed = 0
-        return None
-
-    def cleanup(self):
-        """cleanup(self)
-        """
-        if (self.managed):
-            self.unmanage()
-        self.sign = None
-        return None
-
-    def __str__(self):
-        return "sign: %s contains label: %s" % (self.name, self.label)
-    
-    # accessing
-    def getName(self):
-        return self.name
-
-    def setText(self, text):
-        self.labelText.setText(text)
-        
-    def getLabel(self):
-        return self.label
-    
-    def getGuiItem(self):
-        return self.sign
-
-    def getPos(self):
-        self.sign.getPos()
-        
-    def setPos(self, x, y):
-        self.sign.setPos(Vec3(x, 0, y))
-
-    def getWidth(self):
-        return self.label.getWidth()
-        
-    # actions
-    def manage(self, nodepath = aspect2d):
-        if nodepath:
-            self.sign.manage(guiMgr, base.eventMgr.eventHandler,
-                               nodepath.node())
-        else:
-            self.sign.manage(guiMgr, base.eventMgr.eventHandler)
-        self.managed = 1
-
-    def unmanage(self):
-        self.managed = 0
-        self.sign.unmanage()

+ 1 - 1
direct/src/leveleditor/LevelEditor.py

@@ -1,7 +1,7 @@
 from ShowBaseGlobal import *
 from PandaObject import *
 from PieMenu import *
-from GuiGlobals import *
+from DirectGuiGlobals import *
 from Tkinter import *
 from DirectGeometry import *
 from SceneGraphExplorer import *

+ 11 - 2
direct/src/showbase/ShowBase.py

@@ -22,6 +22,10 @@ import Loader
 import time
 import FSM
 import State
+import __builtin__
+
+__builtin__.FADE_SORT_INDEX = 1000
+__builtin__.NO_FADE_SORT_INDEX = 2000
 
 globalClock = ClockObject.getGlobalClock()
 class ShowBase:
@@ -123,7 +127,7 @@ class ShowBase:
         # For now, we assume that the window will have an aspect ratio
         # matching that of a traditional PC screen.
         self.aspectRatio = 4.0 / 3.0
-        self.aspect2d = self.render2d.attachNewNode("aspect2d")
+        self.aspect2d = self.render2d.attachNewNode(PGTop("aspect2d"))
         self.aspect2d.setScale(1.0 / self.aspectRatio, 1.0, 1.0)
 
         # It's important to know the bounds of the aspect2d screen.
@@ -186,6 +190,10 @@ class ShowBase:
 
         self.buttonThrower = self.mouseWatcher.attachNewNode(ButtonThrower())
 
+        # Set up gui mouse watcher
+        self.aspect2d.node().setMouseWatcher(self.mouseWatcherNode)
+        self.mouseWatcherNode.addRegion(PGMouseWatcherBackground())
+
         self.loader = Loader.Loader(self)
         self.eventMgr = eventMgr
         self.messenger = messenger
@@ -211,7 +219,6 @@ class ShowBase:
 
         self.AppHasAudioFocus = 1
 
-        import __builtin__
         __builtin__.base = self
         __builtin__.render2d = self.render2d
         __builtin__.aspect2d = self.aspect2d
@@ -224,6 +231,8 @@ class ShowBase:
         __builtin__.messenger = self.messenger
         __builtin__.config = self.config
         __builtin__.run = self.run
+        __builtin__.ostream = Notify.out()
+        __builtin__.directNotify = directNotify
 
         # Tk
         if self.wantTk:

+ 3 - 6
direct/src/showbase/ShowBaseGlobal.py

@@ -1,13 +1,9 @@
 """instantiate global ShowBase object"""
 
 from ShowBase import *
-import __builtin__
-
-__builtin__.base = ShowBase()
 
-# Make some global aliases for convenience
-__builtin__.ostream = Notify.out()
-__builtin__.directNotify = directNotify
+# Create the showbase instance
+ShowBase()
 
 # Set direct notify categories now that we have config
 directNotify.setDconfigLevels()
@@ -16,5 +12,6 @@ def inspect(anObject):
     import Inspector
     return Inspector.inspect(anObject)
 
+import __builtin__
 __builtin__.inspect = inspect
 

+ 5 - 17
direct/src/showbase/Transitions.py

@@ -5,9 +5,7 @@ import Task
 class Transitions:
     def __init__(self, loader):
         self.iris = loader.loadModel("phase_3/models/misc/iris")
-        self.iris.setBin("fixed", 1000)
         self.fade = loader.loadModel("phase_3/models/misc/fade")
-        self.fade.setBin("fixed", 1000)
 
         self.iris.setPos(0,0,0)
         self.fade.setScale(3)
@@ -30,7 +28,7 @@ class Transitions:
         """
         self.noTransitions()
 
-        self.fade.reparentTo(aspect2d)
+        self.fade.reparentTo(aspect2d, FADE_SORT_INDEX)
 
         if (t == 0):
             # Fade in immediately with no lerp
@@ -67,7 +65,7 @@ class Transitions:
         """
         self.noTransitions()
 
-        self.fade.reparentTo(aspect2d)
+        self.fade.reparentTo(aspect2d, FADE_SORT_INDEX)
 
         if (t == 0):
             # Fade out immediately with no lerp
@@ -90,17 +88,7 @@ class Transitions:
         a dialog box for instance
         """
         self.noTransitions()
-        self.fade.reparentTo(aspect2d)
-        self.fade.setColor(0,0,0,alpha)
-
-    def guiFadeScreen(self, alpha=0.5):
-        """
-        Put a semitransparent screen over the camera plane
-        to darken out the world. Useful for drawing attention to
-        a dialog box for instance
-        """
-        self.noTransitions()
-        self.fade.reparentTo(guiTop, 100)
+        self.fade.reparentTo(aspect2d, FADE_SORT_INDEX)
         self.fade.setColor(0,0,0,alpha)
 
     def fadeOutTask(self, task, time=0.3, noFade=1):
@@ -146,7 +134,7 @@ class Transitions:
         if (t == 0):
             self.iris.reparentTo(hidden)
         else:
-            self.iris.reparentTo(aspect2d)
+            self.iris.reparentTo(aspect2d, FADE_SORT_INDEX)
             self.iris.setScale(0.015)
             # Create a sequence that scales the iris up,
             # then parents the fade to hidden
@@ -186,7 +174,7 @@ class Transitions:
         if (t == 0):
             self.iris.reparentTo(hidden)
         else:
-            self.iris.reparentTo(aspect2d)
+            self.iris.reparentTo(aspect2d, FADE_SORT_INDEX)
             self.iris.setScale(0.18)
             # Create a sequence that scales the iris up,
             # then parents the fade to hidden