Browse Source

Deprecate many extension methods, make extension methods imported via modules instead of dumped into core.py, move _core.pyd and _direct.pyd back to core.pyd, direct.pyd respectively, move MAIN_DIR set-up code to module init time

rdb 10 years ago
parent
commit
31dbcae262

+ 2 - 3
direct/src/actor/Actor.py

@@ -525,9 +525,8 @@ class Actor(DirectObject, NodePath):
             self.__LODNode = None
             self.__LODNode = None
 
 
         # remove all its children
         # remove all its children
-        if(self.__geomNode):
-            self.__geomNode.removeChildren()
-
+        if self.__geomNode:
+            self.__geomNode.getChildren().detach()
         
         
         self.__hasLOD = 0
         self.__hasLOD = 0
 
 

+ 3 - 3
direct/src/controls/ControlManager.py

@@ -13,13 +13,13 @@ from direct.directnotify import DirectNotifyGlobal
 #if __debug__:
 #if __debug__:
 #    import DevWalker
 #    import DevWalker
 from direct.task import Task
 from direct.task import Task
+from panda3d.core import ConfigVariableBool
+
 CollisionHandlerRayStart = 4000.0 # This is a hack, it may be better to use a line instead of a ray.
 CollisionHandlerRayStart = 4000.0 # This is a hack, it may be better to use a line instead of a ray.
 
 
 class ControlManager:
 class ControlManager:
     notify = DirectNotifyGlobal.directNotify.newCategory("ControlManager")
     notify = DirectNotifyGlobal.directNotify.newCategory("ControlManager")
-    wantAvatarPhysicsIndicator = config.GetBool('want-avatar-physics-indicator', 0)
-    wantAvatarPhysicsDebug = config.GetBool('want-avatar-physics-debug', 0)
-    wantWASD = config.GetBool('want-WASD', 0)
+    wantWASD = ConfigVariableBool('want-WASD', True)
 
 
     def __init__(self, enable=True, passMessagesThrough = False):
     def __init__(self, enable=True, passMessagesThrough = False):
         assert self.notify.debug("init control manager %s" % (passMessagesThrough))
         assert self.notify.debug("init control manager %s" % (passMessagesThrough))

+ 6 - 4
direct/src/controls/GravityWalker.py

@@ -18,15 +18,17 @@ from direct.showbase import DirectObject
 from direct.controls.ControlManager import CollisionHandlerRayStart
 from direct.controls.ControlManager import CollisionHandlerRayStart
 from direct.showbase.InputStateGlobal import inputState
 from direct.showbase.InputStateGlobal import inputState
 from direct.task.Task import Task
 from direct.task.Task import Task
-from pandac.PandaModules import *
+from panda3d.core import *
+from direct.extensions_native import VBase3_extensions
+from direct.extensions_native import VBase4_extensions
 import math
 import math
 
 
 
 
 class GravityWalker(DirectObject.DirectObject):
 class GravityWalker(DirectObject.DirectObject):
     notify = directNotify.newCategory("GravityWalker")
     notify = directNotify.newCategory("GravityWalker")
-    wantDebugIndicator = base.config.GetBool('want-avatar-physics-indicator', 0)
-    wantFloorSphere = base.config.GetBool('want-floor-sphere', 0)
-    earlyEventSphere = base.config.GetBool('early-event-sphere', 0)
+    wantDebugIndicator = ConfigVariableBool('want-avatar-physics-indicator', False)
+    wantFloorSphere = ConfigVariableBool('want-floor-sphere', False)
+    earlyEventSphere = ConfigVariableBool('early-event-sphere', False)
 
 
     DiagonalFactor = math.sqrt(2.) / 2.
     DiagonalFactor = math.sqrt(2.) / 2.
 
 

+ 6 - 3
direct/src/controls/PhysicsWalker.py

@@ -19,7 +19,11 @@ from direct.showbase import DirectObject
 from direct.controls.ControlManager import CollisionHandlerRayStart
 from direct.controls.ControlManager import CollisionHandlerRayStart
 from direct.showbase.InputStateGlobal import inputState
 from direct.showbase.InputStateGlobal import inputState
 from direct.task.Task import Task
 from direct.task.Task import Task
-from pandac.PandaModules import *
+from panda3d.core import *
+from panda3d.physics import *
+from direct.extensions_native import Mat3_extensions
+from direct.extensions_native import VBase3_extensions
+from direct.extensions_native import VBase4_extensions
 import math
 import math
 
 
 #import LineStream
 #import LineStream
@@ -27,8 +31,7 @@ import math
 class PhysicsWalker(DirectObject.DirectObject):
 class PhysicsWalker(DirectObject.DirectObject):
 
 
     notify = DirectNotifyGlobal.directNotify.newCategory("PhysicsWalker")
     notify = DirectNotifyGlobal.directNotify.newCategory("PhysicsWalker")
-    wantDebugIndicator = base.config.GetBool('want-avatar-physics-indicator', 0)
-    wantAvatarPhysicsIndicator = base.config.GetBool('want-avatar-physics-indicator', 0)
+    wantDebugIndicator = ConfigVariableBool('want-avatar-physics-indicator', False)
 
 
     useLifter = 0
     useLifter = 0
     useHeightRay = 0
     useHeightRay = 0

+ 14 - 3
direct/src/directtools/DirectSelection.py

@@ -227,16 +227,27 @@ class SelectedNodePaths(DirectObject):
         selected = self.last
         selected = self.last
         # Toggle visibility of selected node paths
         # Toggle visibility of selected node paths
         if selected:
         if selected:
-            selected.toggleVis()
+            if selected.isHidden():
+                selected.show()
+            else:
+                selected.hide()
 
 
     def toggleVisAll(self):
     def toggleVisAll(self):
         # Toggle viz for all selected node paths
         # Toggle viz for all selected node paths
-        self.forEachSelectedNodePathDo(NodePath.toggleVis)
+        selectedNodePaths = self.getSelectedAsList()
+        for nodePath in selectedNodePaths:
+            if nodePath.isHidden():
+                nodePath.show()
+            else:
+                nodePath.hide()
 
 
     def isolateSelected(self):
     def isolateSelected(self):
         selected = self.last
         selected = self.last
         if selected:
         if selected:
-            selected.isolate()
+            selected.showAllDescendents()
+            for sib in selected.getParent().getChildren():
+                if sib.node() != selected.node():
+                    sib.hide()
 
 
     def getDirectNodePath(self, nodePath):
     def getDirectNodePath(self, nodePath):
         # Get this pointer
         # Get this pointer

+ 12 - 4
direct/src/directtools/DirectSession.py

@@ -879,7 +879,9 @@ class DirectSession(DirectObject):
             # Yes, show everything in level
             # Yes, show everything in level
             self.showAllDescendants(nodePath.getParent())
             self.showAllDescendants(nodePath.getParent())
             # Now hide all of this node path's siblings
             # Now hide all of this node path's siblings
-            nodePath.hideSiblings()
+            for sib in nodePath.getParent().getChildren():
+                if sib.node() != nodePath.node():
+                    sib.hide()
 
 
     def toggleVis(self, nodePath = 'None Given'):
     def toggleVis(self, nodePath = 'None Given'):
         """ Toggle visibility of node path """
         """ Toggle visibility of node path """
@@ -890,7 +892,10 @@ class DirectSession(DirectObject):
             nodePath = self.selected.last
             nodePath = self.selected.last
         if nodePath:
         if nodePath:
             # Now toggle node path's visibility state
             # Now toggle node path's visibility state
-            nodePath.toggleVis()
+            if nodePath.isHidden():
+                nodePath.show()
+            else:
+                nodePath.hide()
 
 
     def removeNodePath(self, nodePath = 'None Given'):
     def removeNodePath(self, nodePath = 'None Given'):
         if nodePath == 'None Given':
         if nodePath == 'None Given':
@@ -904,8 +909,11 @@ class DirectSession(DirectObject):
 
 
     def showAllDescendants(self, nodePath = render):
     def showAllDescendants(self, nodePath = render):
         """ Show the level and its descendants """
         """ Show the level and its descendants """
-        nodePath.showAllDescendants()
-        nodePath.hideCS()
+        if not isinstance(nodePath, CollisionNode):
+            nodePath.show()
+
+        for child in nodePath.getChildren():
+            self.showAllDescendants(child)
 
 
     def upAncestry(self):
     def upAncestry(self):
         if self.ancestry:
         if self.ancestry:

+ 2 - 1
direct/src/extensions_native/CInterval_extensions.py

@@ -1,4 +1,5 @@
-from .core import Dtool_funcToMethod
+from panda3d.direct import CInterval
+from .extension_native_helpers import Dtool_funcToMethod
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.directnotify.DirectNotifyGlobal import directNotify
 
 
 CInterval.DtoolClassDict["notify"] = directNotify.newCategory("Interval")
 CInterval.DtoolClassDict["notify"] = directNotify.newCategory("Interval")

+ 3 - 0
direct/src/extensions_native/HTTPChannel_extensions.py

@@ -3,6 +3,9 @@
 #del func
 #del func
 #####################################################################
 #####################################################################
 
 
+from panda3d.core import HTTPChannel
+from .extension_native_helpers import Dtool_funcToMethod
+
 """
 """
 HTTPChannel-extensions module: contains methods to extend functionality
 HTTPChannel-extensions module: contains methods to extend functionality
 of the HTTPChannel class
 of the HTTPChannel class

+ 2 - 0
direct/src/extensions_native/Mat3_extensions.py

@@ -8,6 +8,8 @@ Mat3-extensions module: contains methods to extend functionality
 of the LMatrix3f class.
 of the LMatrix3f class.
 """
 """
 
 
+from panda3d.core import Mat3
+from .extension_native_helpers import Dtool_funcToMethod
 
 
 def pPrintValues(self):
 def pPrintValues(self):
         """
         """

+ 57 - 24
direct/src/extensions_native/NodePath_extensions.py

@@ -8,6 +8,9 @@ NodePath-extensions module: contains methods to extend functionality
 of the NodePath class
 of the NodePath class
 """
 """
 
 
+from panda3d.core import NodePath
+from .extension_native_helpers import Dtool_funcToMethod
+
 ####################################################################
 ####################################################################
 def id(self):
 def id(self):
         """Deprecated.  Returns a unique id identifying the NodePath instance"""
         """Deprecated.  Returns a unique id identifying the NodePath instance"""
@@ -27,7 +30,8 @@ del getChildrenAsList
 #####################################################################
 #####################################################################
 
 
 def printChildren(self):
 def printChildren(self):
-        """Prints out the children of the bottom node of a node path"""
+        """Deprecated.  Prints out the children of the bottom node of a node path"""
+        print("Warning: NodePath.printChildren() is deprecated.")
         for child in self.getChildren():
         for child in self.getChildren():
             print(child.getName())
             print(child.getName())
 Dtool_funcToMethod(printChildren, NodePath)
 Dtool_funcToMethod(printChildren, NodePath)
@@ -35,14 +39,16 @@ del printChildren
 #####################################################################
 #####################################################################
 
 
 def removeChildren(self):
 def removeChildren(self):
-        """Deletes the children of the bottom node of a node path"""
+        """Deprecated.  Deletes the children of the bottom node of a node path"""
+        print("Warning: NodePath.removeChildren() is deprecated.  Use get_children().detach() instead.")
         self.getChildren().detach()
         self.getChildren().detach()
 Dtool_funcToMethod(removeChildren, NodePath)
 Dtool_funcToMethod(removeChildren, NodePath)
 del removeChildren
 del removeChildren
 #####################################################################
 #####################################################################
 
 
 def toggleVis(self):
 def toggleVis(self):
-        """Toggles visibility of a nodePath"""
+        """Deprecated.  Toggles visibility of a nodePath"""
+        print("Warning: NodePath.toggleVis() is deprecated.  Use is_hidden(), show() and hide() instead.")
         if self.isHidden():
         if self.isHidden():
             self.show()
             self.show()
             return 1
             return 1
@@ -54,7 +60,8 @@ del toggleVis
 #####################################################################
 #####################################################################
 
 
 def showSiblings(self):
 def showSiblings(self):
-        """Show all the siblings of a node path"""
+        """Deprecated.  Show all the siblings of a node path"""
+        print("Warning: NodePath.showSiblings() is deprecated.")
         for sib in self.getParent().getChildren():
         for sib in self.getParent().getChildren():
             if sib.node() != self.node():
             if sib.node() != self.node():
                 sib.show()
                 sib.show()
@@ -63,7 +70,8 @@ del showSiblings
 #####################################################################
 #####################################################################
 
 
 def hideSiblings(self):
 def hideSiblings(self):
-        """Hide all the siblings of a node path"""
+        """Deprecated.  Hide all the siblings of a node path"""
+        print("Warning: NodePath.hideSiblings() is deprecated.")
         for sib in self.getParent().getChildren():
         for sib in self.getParent().getChildren():
             if sib.node() != self.node():
             if sib.node() != self.node():
                 sib.hide()
                 sib.hide()
@@ -72,7 +80,8 @@ del hideSiblings
 #####################################################################
 #####################################################################
 
 
 def showAllDescendants(self):
 def showAllDescendants(self):
-        """Show the node path and all its children"""
+        """Deprecated.  Show the node path and all its children"""
+        print("Warning: NodePath.showAllDescendants() is deprecated.")
         self.show()
         self.show()
         for child in self.getChildren():
         for child in self.getChildren():
             child.showAllDescendants()
             child.showAllDescendants()
@@ -81,9 +90,12 @@ del showAllDescendants
 #####################################################################
 #####################################################################
 
 
 def isolate(self):
 def isolate(self):
-        """Show the node path and hide its siblings"""
+        """Deprecated.  Show the node path and hide its siblings"""
+        print("Warning: NodePath.isolate() is deprecated.")
         self.showAllDescendants()
         self.showAllDescendants()
-        self.hideSiblings()
+        for sib in self.getParent().getChildren():
+            if sib.node() != self.node():
+                sib.hide()
 Dtool_funcToMethod(isolate, NodePath)
 Dtool_funcToMethod(isolate, NodePath)
 del isolate
 del isolate
 #####################################################################
 #####################################################################
@@ -101,7 +113,8 @@ del remove
 #####################################################################
 #####################################################################
 
 
 def lsNames(self):
 def lsNames(self):
-        """Walk down a tree and print out the path"""
+        """Deprecated. Walk down a tree and print out the path"""
+        print("Warning: NodePath.lsNames() is deprecated.")
         if self.isEmpty():
         if self.isEmpty():
             print("(empty)")
             print("(empty)")
         else:
         else:
@@ -114,7 +127,8 @@ Dtool_funcToMethod(lsNames, NodePath)
 del lsNames
 del lsNames
 #####################################################################
 #####################################################################
 def lsNamesRecurse(self, indentString=' '):
 def lsNamesRecurse(self, indentString=' '):
-        """Walk down a tree and print out the path"""
+        """Deprecated.  Walk down a tree and print out the path"""
+        print("Warning: NodePath.lsNamesRecurse() is deprecated.")
         for nodePath in self.getChildren():
         for nodePath in self.getChildren():
             type = nodePath.node().getType().getName()
             type = nodePath.node().getType().getName()
             name = nodePath.getName()
             name = nodePath.getName()
@@ -125,7 +139,8 @@ Dtool_funcToMethod(lsNamesRecurse, NodePath)
 del lsNamesRecurse
 del lsNamesRecurse
 #####################################################################
 #####################################################################
 def reverseLsNames(self):
 def reverseLsNames(self):
-        """Walk up a tree and print out the path to the root"""
+        """Deprecated.  Walk up a tree and print out the path to the root"""
+        print("Warning: NodePath.reverseLsNames() is deprecated.")
         ancestors = list(self.getAncestors())
         ancestors = list(self.getAncestors())
         ancestry = ancestors.reverse()
         ancestry = ancestors.reverse()
         indentString = ""
         indentString = ""
@@ -139,8 +154,8 @@ Dtool_funcToMethod(reverseLsNames, NodePath)
 del reverseLsNames
 del reverseLsNames
 #####################################################################
 #####################################################################
 def getAncestry(self):
 def getAncestry(self):
-        """Get a list of a node path's ancestors"""
-        print("NodePath.getAncestry() is deprecated.  Use get_ancestors() instead.""")
+        """Deprecated.  Get a list of a node path's ancestors"""
+        print("NodePath.getAncestry() is deprecated.  Use get_ancestors() instead.")
         ancestors = list(self.getAncestors())
         ancestors = list(self.getAncestors())
         ancestors.reverse()
         ancestors.reverse()
         return ancestors
         return ancestors
@@ -151,8 +166,9 @@ del getAncestry
 
 
 def pPrintString(self, other = None):
 def pPrintString(self, other = None):
         """
         """
-        pretty print
+        Deprecated.  pretty print
         """
         """
+        print("NodePath.pPrintString() is deprecated.")
         if __debug__:
         if __debug__:
             # Normally I would have put the if __debug__ around
             # Normally I would have put the if __debug__ around
             # the entire funciton, the that doesn't seem to work
             # the entire funciton, the that doesn't seem to work
@@ -183,7 +199,8 @@ del pPrintString
 #####################################################################
 #####################################################################
 
 
 def printPos(self, other = None, sd = 2):
 def printPos(self, other = None, sd = 2):
-        """ Pretty print a node path's pos """
+        """ Deprecated.  Pretty print a node path's pos """
+        print("NodePath.printPos() is deprecated.")
         formatString = '%0.' + '%d' % sd + 'f'
         formatString = '%0.' + '%d' % sd + 'f'
         if other:
         if other:
             pos = self.getPos(other)
             pos = self.getPos(other)
@@ -201,7 +218,8 @@ del printPos
 #####################################################################
 #####################################################################
 
 
 def printHpr(self, other = None, sd = 2):
 def printHpr(self, other = None, sd = 2):
-        """ Pretty print a node path's hpr """
+        """ Deprecated.  Pretty print a node path's hpr """
+        print("NodePath.printHpr() is deprecated.")
         formatString = '%0.' + '%d' % sd + 'f'
         formatString = '%0.' + '%d' % sd + 'f'
         if other:
         if other:
             hpr = self.getHpr(other)
             hpr = self.getHpr(other)
@@ -219,7 +237,8 @@ del printHpr
 #####################################################################
 #####################################################################
 
 
 def printScale(self, other = None, sd = 2):
 def printScale(self, other = None, sd = 2):
-        """ Pretty print a node path's scale """
+        """ Deprecated.  Pretty print a node path's scale """
+        print("NodePath.printScale() is deprecated.")
         formatString = '%0.' + '%d' % sd + 'f'
         formatString = '%0.' + '%d' % sd + 'f'
         if other:
         if other:
             scale = self.getScale(other)
             scale = self.getScale(other)
@@ -237,7 +256,8 @@ Dtool_funcToMethod(printScale, NodePath)
 del printScale
 del printScale
 #####################################################################
 #####################################################################
 def printPosHpr(self, other = None, sd = 2):
 def printPosHpr(self, other = None, sd = 2):
-        """ Pretty print a node path's pos and, hpr """
+        """ Deprecated.  Pretty print a node path's pos and, hpr """
+        print("NodePath.printPosHpr() is deprecated.")
         formatString = '%0.' + '%d' % sd + 'f'
         formatString = '%0.' + '%d' % sd + 'f'
         if other:
         if other:
             pos = self.getPos(other)
             pos = self.getPos(other)
@@ -260,7 +280,8 @@ Dtool_funcToMethod(printPosHpr, NodePath)
 del printPosHpr
 del printPosHpr
 #####################################################################
 #####################################################################
 def printPosHprScale(self, other = None, sd = 2):
 def printPosHprScale(self, other = None, sd = 2):
-        """ Pretty print a node path's pos, hpr, and scale """
+        """ Deprecated.  Pretty print a node path's pos, hpr, and scale """
+        print("NodePath.printPosHprScale() is deprecated.")
         formatString = '%0.' + '%d' % sd + 'f'
         formatString = '%0.' + '%d' % sd + 'f'
         if other:
         if other:
             pos = self.getPos(other)
             pos = self.getPos(other)
@@ -289,6 +310,8 @@ del printPosHprScale
 #####################################################################
 #####################################################################
 
 
 def printTransform(self, other = None, sd = 2, fRecursive = 0):
 def printTransform(self, other = None, sd = 2, fRecursive = 0):
+    "Deprecated."
+    print("NodePath.printTransform() is deprecated.")
     from panda3d.core import Vec3
     from panda3d.core import Vec3
     fmtStr = '%%0.%df' % sd
     fmtStr = '%%0.%df' % sd
     name = self.getName()
     name = self.getName()
@@ -327,7 +350,8 @@ del printTransform
 
 
 
 
 def iPos(self, other = None):
 def iPos(self, other = None):
-        """ Set node path's pos to 0, 0, 0 """
+        """ Deprecated.  Set node path's pos to 0, 0, 0 """
+        print("NodePath.iPos() is deprecated.")
         if other:
         if other:
             self.setPos(other, 0, 0, 0)
             self.setPos(other, 0, 0, 0)
         else:
         else:
@@ -337,7 +361,8 @@ del iPos
 #####################################################################
 #####################################################################
 
 
 def iHpr(self, other = None):
 def iHpr(self, other = None):
-        """ Set node path's hpr to 0, 0, 0 """
+        """ Deprecated.  Set node path's hpr to 0, 0, 0 """
+        print("NodePath.iHpr() is deprecated.")
         if other:
         if other:
             self.setHpr(other, 0, 0, 0)
             self.setHpr(other, 0, 0, 0)
         else:
         else:
@@ -347,7 +372,8 @@ Dtool_funcToMethod(iHpr, NodePath)
 del iHpr
 del iHpr
 #####################################################################
 #####################################################################
 def iScale(self, other = None):
 def iScale(self, other = None):
-        """ SEt node path's scale to 1, 1, 1 """
+        """ Deprecated.  Set node path's scale to 1, 1, 1 """
+        print("NodePath.iScale() is deprecated.")
         if other:
         if other:
             self.setScale(other, 1, 1, 1)
             self.setScale(other, 1, 1, 1)
         else:
         else:
@@ -357,7 +383,8 @@ Dtool_funcToMethod(iScale, NodePath)
 del iScale
 del iScale
 #####################################################################
 #####################################################################
 def iPosHpr(self, other = None):
 def iPosHpr(self, other = None):
-        """ Set node path's pos and hpr to 0, 0, 0 """
+        """ Deprecated.  Set node path's pos and hpr to 0, 0, 0 """
+        print("NodePath.iPosHpr() is deprecated.")
         if other:
         if other:
             self.setPosHpr(other, 0, 0, 0, 0, 0, 0)
             self.setPosHpr(other, 0, 0, 0, 0, 0, 0)
         else:
         else:
@@ -367,7 +394,8 @@ Dtool_funcToMethod(iPosHpr, NodePath)
 del iPosHpr
 del iPosHpr
 #####################################################################
 #####################################################################
 def iPosHprScale(self, other = None):
 def iPosHprScale(self, other = None):
-        """ Set node path's pos and hpr to 0, 0, 0 and scale to 1, 1, 1 """
+        """ Deprecated.  Set node path's pos and hpr to 0, 0, 0 and scale to 1, 1, 1 """
+        print("NodePath.iPosHprScale() is deprecated.")
         if other:
         if other:
             self.setPosHprScale(other, 0, 0, 0, 0, 0, 0, 1, 1, 1)
             self.setPosHprScale(other, 0, 0, 0, 0, 0, 0, 1, 1, 1)
         else:
         else:
@@ -417,11 +445,13 @@ del deselect
 #####################################################################
 #####################################################################
 def showCS(self, mask = None):
 def showCS(self, mask = None):
         """
         """
+        Deprecated.
         Shows the collision solids at or below this node.  If mask is
         Shows the collision solids at or below this node.  If mask is
         not None, it is a BitMask32 object (e.g. WallBitmask,
         not None, it is a BitMask32 object (e.g. WallBitmask,
         CameraBitmask) that indicates which particular collision
         CameraBitmask) that indicates which particular collision
         solids should be made visible; otherwise, all of them will be.
         solids should be made visible; otherwise, all of them will be.
         """
         """
+        print("NodePath.showCS() is deprecated.  Use findAllMatches('**/+CollisionNode').show() instead.")
         npc = self.findAllMatches('**/+CollisionNode')
         npc = self.findAllMatches('**/+CollisionNode')
         for p in range(0, npc.getNumPaths()):
         for p in range(0, npc.getNumPaths()):
             np = npc[p]
             np = npc[p]
@@ -433,11 +463,13 @@ del showCS
 #####################################################################
 #####################################################################
 def hideCS(self, mask = None):
 def hideCS(self, mask = None):
         """
         """
+        Deprecated.
         Hides the collision solids at or below this node.  If mask is
         Hides the collision solids at or below this node.  If mask is
         not None, it is a BitMask32 object (e.g. WallBitmask,
         not None, it is a BitMask32 object (e.g. WallBitmask,
         CameraBitmask) that indicates which particular collision
         CameraBitmask) that indicates which particular collision
         solids should be hidden; otherwise, all of them will be.
         solids should be hidden; otherwise, all of them will be.
         """
         """
+        print("NodePath.hideCS() is deprecated.  Use findAllMatches('**/+CollisionNode').hide() instead.")
         npc = self.findAllMatches('**/+CollisionNode')
         npc = self.findAllMatches('**/+CollisionNode')
         for p in range(0, npc.getNumPaths()):
         for p in range(0, npc.getNumPaths()):
             np = npc[p]
             np = npc[p]
@@ -621,6 +653,7 @@ del getNumDescendants
 #####################################################################
 #####################################################################
 def removeNonCollisions(self):
 def removeNonCollisions(self):
         # remove anything that is not collision-related
         # remove anything that is not collision-related
+        print("NodePath.removeNonCollisions() is deprecated")
         stack = [self]
         stack = [self]
         while len(stack):
         while len(stack):
                 np = stack.pop()
                 np = stack.pop()

+ 3 - 0
direct/src/extensions_native/VBase3_extensions.py

@@ -2,6 +2,9 @@
 Methods to extend functionality of the VBase3 class
 Methods to extend functionality of the VBase3 class
 """
 """
 
 
+from panda3d.core import VBase3
+from .extension_native_helpers import Dtool_funcToMethod
+
 def pPrintValues(self):
 def pPrintValues(self):
     """
     """
     Pretty print
     Pretty print

+ 3 - 1
direct/src/extensions_native/VBase4_extensions.py

@@ -2,6 +2,9 @@
 Methods to extend functionality of the VBase4 class
 Methods to extend functionality of the VBase4 class
 """
 """
 
 
+from panda3d.core import VBase4
+from .extension_native_helpers import Dtool_funcToMethod
+
 def pPrintValues(self):
 def pPrintValues(self):
     """
     """
     Pretty print
     Pretty print
@@ -16,6 +19,5 @@ def asTuple(self):
     """
     """
     print("Warning: VBase4.asTuple() is no longer needed and deprecated.  Use the vector directly instead.")
     print("Warning: VBase4.asTuple() is no longer needed and deprecated.  Use the vector directly instead.")
     return tuple(self)
     return tuple(self)
-
 Dtool_funcToMethod(asTuple, VBase4)
 Dtool_funcToMethod(asTuple, VBase4)
 del asTuple
 del asTuple

+ 0 - 28
direct/src/extensions_native/core_extensions.py

@@ -1,28 +0,0 @@
-import sys
-
-main_dir = Filename()
-
-if sys.argv and sys.argv[0]:
-    main_dir = Filename.from_os_specific(sys.argv[0])
-
-if main_dir.empty():
-    # We must be running in the Python interpreter directly, so return the CWD.
-    main_dir = ExecutionEnvironment.get_cwd()
-else:
-    main_dir.make_absolute()
-    main_dir = Filename(main_dir.get_dirname())
-ExecutionEnvironment.shadow_environment_variable('MAIN_DIR', main_dir.to_os_specific())
-del sys, main_dir
-
-
-def Dtool_funcToMethod(func, cls, method_name=None):
-    """Adds func to class so it is an accessible method; use method_name to specify the name to be used for calling the method.
-    The new method is accessible to any instance immediately."""
-    #if sys.version_info < (3, 0):
-    #    func.im_class = cls
-    func.im_func = func
-    func.im_self = None
-    if not method_name:
-        method_name = func.__name__
-    cls.DtoolClassDict[method_name] = func;
-

+ 2 - 0
direct/src/interval/Interval.py

@@ -7,6 +7,8 @@ from direct.showbase.DirectObject import DirectObject
 from direct.task.Task import Task, TaskManager
 from direct.task.Task import Task, TaskManager
 from panda3d.core import *
 from panda3d.core import *
 from panda3d.direct import *
 from panda3d.direct import *
+from direct.extensions_native import CInterval_extensions
+from direct.extensions_native import NodePath_extensions
 import math
 import math
 
 
 class Interval(DirectObject):
 class Interval(DirectObject):

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

@@ -11,6 +11,8 @@ from panda3d.core import *
 from panda3d.direct import get_config_showbase, throw_new_frame, init_app_for_gui
 from panda3d.direct import get_config_showbase, throw_new_frame, init_app_for_gui
 from panda3d.direct import storeAccessibilityShortcutKeys, allowAccessibilityShortcutKeys
 from panda3d.direct import storeAccessibilityShortcutKeys, allowAccessibilityShortcutKeys
 
 
+# Register the extension methods for NodePath.
+from direct.extensions_native import NodePath_extensions
 
 
 # This needs to be available early for DirectGUI imports
 # This needs to be available early for DirectGUI imports
 import __builtin__ as builtins
 import __builtin__ as builtins

+ 1 - 0
direct/src/task/Task.py

@@ -19,6 +19,7 @@ except ImportError:
     signal = None
     signal = None
 
 
 from panda3d.core import *
 from panda3d.core import *
+from direct.extensions_native import HTTPChannel_extensions
 
 
 def print_exc_plus():
 def print_exc_plus():
     """
     """

+ 45 - 0
dtool/src/interrogatedb/py_panda.cxx

@@ -14,6 +14,7 @@
 
 
 #include "py_panda.h"
 #include "py_panda.h"
 #include "config_interrogatedb.h"
 #include "config_interrogatedb.h"
+#include "executionEnvironment.h"
 
 
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
 
 
@@ -626,6 +627,50 @@ PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], const char *modulename) {
 #endif
 #endif
   }
   }
 
 
+  // MAIN_DIR needs to be set very early; this seems like a convenient place
+  // to do that.  Perhaps we'll find a better place for this in the future.
+  static bool initialized_main_dir = false;
+  if (!initialized_main_dir) {
+    // Grab the __main__ module.
+    PyObject *main_module = PyImport_ImportModule("__main__");
+    if (main_module == NULL) {
+      interrogatedb_cat.warning() << "Unable to import __main__\n";
+    }
+
+    // Extract the __file__ attribute, if present.
+    Filename main_dir;
+    PyObject *file_attr = PyObject_GetAttrString(main_module, "__file__");
+    if (file_attr == NULL) {
+      // Must be running in the interactive interpreter.  Use the CWD.
+      main_dir = ExecutionEnvironment::get_cwd();
+    } else {
+#if PY_MAJOR_VERSION >= 3
+      Py_ssize_t length;
+      wchar_t *buffer = PyUnicode_AsWideCharString(file_attr, &length);
+      if (buffer != NULL) {
+        main_dir = Filename::from_os_specific_w(std::wstring(buffer, length));
+        main_dir.make_absolute();
+        main_dir = main_dir.get_dirname();
+        PyMem_Free(buffer);
+      }
+#else
+      char *buffer;
+      Py_ssize_t length;
+      if (PyString_AsStringAndSize(file_attr, &buffer, &length) != -1) {
+        main_dir = Filename::from_os_specific(std::string(buffer, length));
+        main_dir.make_absolute();
+        main_dir = main_dir.get_dirname();
+      }
+#endif
+      else {
+        interrogatedb_cat.warning() << "Invalid string for __main__.__file__\n";
+      }
+    }
+    ExecutionEnvironment::shadow_environment_variable("MAIN_DIR", main_dir.to_os_specific());
+    PyErr_Clear();
+    initialized_main_dir = true;
+  }
+
   PyModule_AddIntConstant(module, "Dtool_PyNativeInterface", 1);
   PyModule_AddIntConstant(module, "Dtool_PyNativeInterface", 1);
   return module;
   return module;
 }
 }

+ 101 - 142
makepanda/makepanda.py

@@ -1789,29 +1789,6 @@ def CompileRsrc(target, src, opts):
     cmd += " " + BracketNameWithQuotes(src)
     cmd += " " + BracketNameWithQuotes(src)
     oscmd(cmd)
     oscmd(cmd)
 
 
-##########################################################################################
-#
-# GenPyExtensions
-#
-##########################################################################################
-
-def GenPyExtensions(target, inputs, opts):
-    # Hopefully the need for this will soon go away as we migrate everything to
-    # C extensions.
-
-    code = "# This file is automatically generated by makepanda.py.  Do not modify.\n"
-    code += "from __future__ import absolute_import\n"
-
-    for i in inputs:
-        if GetOrigExt(i) == ".pyd":
-            code += "from .%s import *\n" % (os.path.splitext(os.path.basename(i))[0])
-        elif GetOrigExt(i) == ".py":
-            code += "### BEGIN %s\n" % i
-            code += ReadFile(i)
-            code += "### END %s\n" % i
-
-    WriteFile(target, code)
-
 ##########################################################################################
 ##########################################################################################
 #
 #
 # FreezePy
 # FreezePy
@@ -1968,10 +1945,6 @@ def CompileAnything(target, inputs, opts, progress = None):
             os.system("chmod +x \"%s\"" % target)
             os.system("chmod +x \"%s\"" % target)
         return
         return
 
 
-    elif (target.endswith(".py")):
-        ProgressOutput(progress, "Generating", target)
-        return GenPyExtensions(target, inputs, opts)
-
     elif (infile.endswith(".py")):
     elif (infile.endswith(".py")):
         if origsuffix == ".obj":
         if origsuffix == ".obj":
             source = os.path.splitext(target)[0] + ".c"
             source = os.path.splitext(target)[0] + ".c"
@@ -2622,28 +2595,22 @@ if (PkgSkip("DIRECT")==0):
     if os.path.isfile(GetOutputDir() + '/lib/panda3d.py'):
     if os.path.isfile(GetOutputDir() + '/lib/panda3d.py'):
         os.remove(GetOutputDir() + '/lib/panda3d.py')
         os.remove(GetOutputDir() + '/lib/panda3d.py')
 
 
-    # Don't copy this file, which would cause conflict with our 'panda3d' module.
-    if os.path.isfile(GetOutputDir() + '/direct/ffi/panda3d.py'):
-        os.remove(GetOutputDir() + '/direct/ffi/panda3d.py')
-    if os.path.isfile(GetOutputDir() + '/direct/ffi/panda3d.pyc'):
-        os.remove(GetOutputDir() + '/direct/ffi/panda3d.pyc')
+    # This directory doesn't exist at all any more.
+    if os.path.isdir(os.path.join(GetOutputDir(), 'direct', 'ffi')):
+        shutil.rmtree(os.path.join(GetOutputDir(), 'direct', 'ffi'))
 
 
-# This used to exist; no longer.
-if GetTarget() == 'windows':
-    core_so = GetOutputDir() + '/panda3d/core.pyd'
-    direct_so = GetOutputDir() + '/panda3d/direct.pyd'
-    dtoolconfig_so = GetOutputDir() + '/panda3d/dtoolconfig.pyd'
-else:
-    core_so = GetOutputDir() + '/panda3d/core.so'
-    direct_so = GetOutputDir() + '/panda3d/direct.so'
-    dtoolconfig_so = GetOutputDir() + '/panda3d/dtoolconfig.so'
+# These files used to exist; remove them to avoid conflicts.
+del_files = ['core.py', 'core.pyc', 'core.pyo',
+             '_core.pyd', '_core.so',
+             'direct.py', 'direct.pyc', 'direct.pyo',
+             '_direct.pyd', '_direct.so',
+             'dtoolconfig.pyd', 'dtoolconfig.so']
 
 
-if os.path.isfile(core_so):
-    os.remove(core_so)
-if os.path.isfile(direct_so):
-    os.remove(direct_so)
-if os.path.isfile(dtoolconfig_so):
-    os.remove(dtoolconfig_so)
+for basename in del_files:
+    path = os.path.join(GetOutputDir(), 'panda3d', basename)
+    if os.path.isfile(path):
+        print("Removing %s" % (path))
+        os.remove(path)
 
 
 # Write an appropriate panda3d/__init__.py
 # Write an appropriate panda3d/__init__.py
 p3d_init = """"Python bindings for the Panda3D libraries"
 p3d_init = """"Python bindings for the Panda3D libraries"
@@ -2663,7 +2630,14 @@ if os.path.isfile(os.path.join(bindir, 'libpanda.dll')):
 del os, bindir
 del os, bindir
 """
 """
 
 
-ConditionalWriteFile(GetOutputDir() + '/panda3d/__init__.py', p3d_init)
+if not PkgSkip("PYTHON"):
+    ConditionalWriteFile(GetOutputDir() + '/panda3d/__init__.py', p3d_init)
+
+    # Also add this file, for backward compatibility.
+    ConditionalWriteFile(GetOutputDir() + '/panda3d/dtoolconfig.py', """
+print("Warning: panda3d.dtoolconfig is deprecated, use panda3d.interrogatedb instead.")
+from .interrogatedb import *
+""")
 
 
 # PandaModules is now deprecated; generate a shim for backward compatibility.
 # PandaModules is now deprecated; generate a shim for backward compatibility.
 for fn in glob.glob(GetOutputDir() + '/pandac/*.py') + glob.glob(GetOutputDir() + '/pandac/*.py[co]'):
 for fn in glob.glob(GetOutputDir() + '/pandac/*.py') + glob.glob(GetOutputDir() + '/pandac/*.py[co]'):
@@ -2703,8 +2677,9 @@ except ImportError as err:
     if "No module named %s" not in str(err):
     if "No module named %s" not in str(err):
         raise""" % (module, module)
         raise""" % (module, module)
 
 
-ConditionalWriteFile(GetOutputDir() + '/pandac/PandaModules.py', panda_modules_code)
-ConditionalWriteFile(GetOutputDir() + '/pandac/__init__.py', '')
+if not PkgSkip("PYTHON"):
+    ConditionalWriteFile(GetOutputDir() + '/pandac/PandaModules.py', panda_modules_code)
+    ConditionalWriteFile(GetOutputDir() + '/pandac/__init__.py', '')
 
 
 ##########################################################################################
 ##########################################################################################
 #
 #
@@ -3197,9 +3172,6 @@ if not PkgSkip("PYTHON"):
   TargetAdd('interrogatedb.pyd', input='libp3interrogatedb.dll')
   TargetAdd('interrogatedb.pyd', input='libp3interrogatedb.dll')
   TargetAdd('interrogatedb.pyd', opts=['PYTHON'])
   TargetAdd('interrogatedb.pyd', opts=['PYTHON'])
 
 
-  # Make a stub file importing the new one for backward compatibility.
-  TargetAdd('panda3d/dtoolconfig.py', input='interrogatedb.pyd')
-
 #
 #
 # DIRECTORY: dtool/src/pystub/
 # DIRECTORY: dtool/src/pystub/
 #
 #
@@ -3930,69 +3902,60 @@ if (not RUNTIME):
   if PkgSkip("FREETYPE")==0:
   if PkgSkip("FREETYPE")==0:
     TargetAdd('core_module.obj', input='libp3pnmtext.in')
     TargetAdd('core_module.obj', input='libp3pnmtext.in')
 
 
-  TargetAdd('core_module.obj', opts=['IMOD:panda3d._core', 'ILIB:_core'])
-
-  TargetAdd('_core.pyd', input='libp3downloader_igate.obj')
-  TargetAdd('_core.pyd', input='p3downloader_stringStream_ext.obj')
-  TargetAdd('_core.pyd', input='p3express_ext_composite.obj')
-  TargetAdd('_core.pyd', input='libp3express_igate.obj')
-
-  TargetAdd('_core.pyd', input='libp3recorder_igate.obj')
-  TargetAdd('_core.pyd', input='libp3pgraphnodes_igate.obj')
-  TargetAdd('_core.pyd', input='libp3pgraph_igate.obj')
-  TargetAdd('_core.pyd', input='libp3movies_igate.obj')
-  TargetAdd('_core.pyd', input='libp3grutil_igate.obj')
-  TargetAdd('_core.pyd', input='libp3chan_igate.obj')
-  TargetAdd('_core.pyd', input='libp3pstatclient_igate.obj')
-  TargetAdd('_core.pyd', input='libp3char_igate.obj')
-  TargetAdd('_core.pyd', input='libp3collide_igate.obj')
-  TargetAdd('_core.pyd', input='libp3device_igate.obj')
-  TargetAdd('_core.pyd', input='libp3dgraph_igate.obj')
-  TargetAdd('_core.pyd', input='libp3display_igate.obj')
-  TargetAdd('_core.pyd', input='libp3pipeline_igate.obj')
-  TargetAdd('_core.pyd', input='libp3event_igate.obj')
-  TargetAdd('_core.pyd', input='libp3gobj_igate.obj')
-  TargetAdd('_core.pyd', input='libp3gsgbase_igate.obj')
-  TargetAdd('_core.pyd', input='libp3linmath_igate.obj')
-  TargetAdd('_core.pyd', input='libp3mathutil_igate.obj')
-  TargetAdd('_core.pyd', input='libp3parametrics_igate.obj')
-  TargetAdd('_core.pyd', input='libp3pnmimage_igate.obj')
-  TargetAdd('_core.pyd', input='libp3text_igate.obj')
-  TargetAdd('_core.pyd', input='libp3tform_igate.obj')
-  TargetAdd('_core.pyd', input='libp3putil_igate.obj')
-  TargetAdd('_core.pyd', input='libp3audio_igate.obj')
-  TargetAdd('_core.pyd', input='libp3pgui_igate.obj')
-  TargetAdd('_core.pyd', input='libp3net_igate.obj')
-  TargetAdd('_core.pyd', input='libp3nativenet_igate.obj')
-  TargetAdd('_core.pyd', input='libp3dxml_igate.obj')
+  TargetAdd('core_module.obj', opts=['IMOD:panda3d.core', 'ILIB:core'])
+
+  TargetAdd('core.pyd', input='libp3downloader_igate.obj')
+  TargetAdd('core.pyd', input='p3downloader_stringStream_ext.obj')
+  TargetAdd('core.pyd', input='p3express_ext_composite.obj')
+  TargetAdd('core.pyd', input='libp3express_igate.obj')
+
+  TargetAdd('core.pyd', input='libp3recorder_igate.obj')
+  TargetAdd('core.pyd', input='libp3pgraphnodes_igate.obj')
+  TargetAdd('core.pyd', input='libp3pgraph_igate.obj')
+  TargetAdd('core.pyd', input='libp3movies_igate.obj')
+  TargetAdd('core.pyd', input='libp3grutil_igate.obj')
+  TargetAdd('core.pyd', input='libp3chan_igate.obj')
+  TargetAdd('core.pyd', input='libp3pstatclient_igate.obj')
+  TargetAdd('core.pyd', input='libp3char_igate.obj')
+  TargetAdd('core.pyd', input='libp3collide_igate.obj')
+  TargetAdd('core.pyd', input='libp3device_igate.obj')
+  TargetAdd('core.pyd', input='libp3dgraph_igate.obj')
+  TargetAdd('core.pyd', input='libp3display_igate.obj')
+  TargetAdd('core.pyd', input='libp3pipeline_igate.obj')
+  TargetAdd('core.pyd', input='libp3event_igate.obj')
+  TargetAdd('core.pyd', input='libp3gobj_igate.obj')
+  TargetAdd('core.pyd', input='libp3gsgbase_igate.obj')
+  TargetAdd('core.pyd', input='libp3linmath_igate.obj')
+  TargetAdd('core.pyd', input='libp3mathutil_igate.obj')
+  TargetAdd('core.pyd', input='libp3parametrics_igate.obj')
+  TargetAdd('core.pyd', input='libp3pnmimage_igate.obj')
+  TargetAdd('core.pyd', input='libp3text_igate.obj')
+  TargetAdd('core.pyd', input='libp3tform_igate.obj')
+  TargetAdd('core.pyd', input='libp3putil_igate.obj')
+  TargetAdd('core.pyd', input='libp3audio_igate.obj')
+  TargetAdd('core.pyd', input='libp3pgui_igate.obj')
+  TargetAdd('core.pyd', input='libp3net_igate.obj')
+  TargetAdd('core.pyd', input='libp3nativenet_igate.obj')
+  TargetAdd('core.pyd', input='libp3dxml_igate.obj')
 
 
   if PkgSkip("FREETYPE")==0:
   if PkgSkip("FREETYPE")==0:
-    TargetAdd('_core.pyd', input="libp3pnmtext_igate.obj")
-
-  TargetAdd('_core.pyd', input='p3putil_typedWritable_ext.obj')
-  TargetAdd('_core.pyd', input='p3putil_pythonCallbackObject.obj')
-  TargetAdd('_core.pyd', input='p3pnmimage_pfmFile_ext.obj')
-  TargetAdd('_core.pyd', input='p3event_pythonTask.obj')
-  TargetAdd('_core.pyd', input='p3gobj_ext_composite.obj')
-  TargetAdd('_core.pyd', input='p3pgraph_ext_composite.obj')
-  TargetAdd('_core.pyd', input='p3display_graphicsStateGuardian_ext.obj')
-  TargetAdd('_core.pyd', input='p3display_graphicsWindow_ext.obj')
-  TargetAdd('_core.pyd', input='p3display_pythonGraphicsWindowProc.obj')
-
-  TargetAdd('_core.pyd', input='core_module.obj')
-  TargetAdd('_core.pyd', input='libp3tinyxml.ilb')
-  TargetAdd('_core.pyd', input='libp3interrogatedb.dll')
-  TargetAdd('_core.pyd', input=COMMON_PANDA_LIBS)
-  TargetAdd('_core.pyd', opts=['PYTHON', 'WINSOCK2'])
-
-  OPTS=['DIR:direct/src/extensions_native']
-  TargetAdd('panda3d/core.py', input='_core.pyd')
-  TargetAdd('panda3d/core.py', opts=OPTS, input='core_extensions.py')
-  TargetAdd('panda3d/core.py', opts=OPTS, input='NodePath_extensions.py')
-  TargetAdd('panda3d/core.py', opts=OPTS, input='Mat3_extensions.py')
-  TargetAdd('panda3d/core.py', opts=OPTS, input='VBase3_extensions.py')
-  TargetAdd('panda3d/core.py', opts=OPTS, input='VBase4_extensions.py')
-  TargetAdd('panda3d/core.py', opts=OPTS, input='HTTPChannel_extensions.py')
+    TargetAdd('core.pyd', input="libp3pnmtext_igate.obj")
+
+  TargetAdd('core.pyd', input='p3putil_typedWritable_ext.obj')
+  TargetAdd('core.pyd', input='p3putil_pythonCallbackObject.obj')
+  TargetAdd('core.pyd', input='p3pnmimage_pfmFile_ext.obj')
+  TargetAdd('core.pyd', input='p3event_pythonTask.obj')
+  TargetAdd('core.pyd', input='p3gobj_ext_composite.obj')
+  TargetAdd('core.pyd', input='p3pgraph_ext_composite.obj')
+  TargetAdd('core.pyd', input='p3display_graphicsStateGuardian_ext.obj')
+  TargetAdd('core.pyd', input='p3display_graphicsWindow_ext.obj')
+  TargetAdd('core.pyd', input='p3display_pythonGraphicsWindowProc.obj')
+
+  TargetAdd('core.pyd', input='core_module.obj')
+  TargetAdd('core.pyd', input='libp3tinyxml.ilb')
+  TargetAdd('core.pyd', input='libp3interrogatedb.dll')
+  TargetAdd('core.pyd', input=COMMON_PANDA_LIBS)
+  TargetAdd('core.pyd', opts=['PYTHON', 'WINSOCK2'])
 
 
 #
 #
 # DIRECTORY: panda/src/vision/
 # DIRECTORY: panda/src/vision/
@@ -4014,7 +3977,7 @@ if (PkgSkip("VISION") == 0) and (not RUNTIME):
 
 
   TargetAdd('vision_module.obj', input='libp3vision.in')
   TargetAdd('vision_module.obj', input='libp3vision.in')
   TargetAdd('vision_module.obj', opts=OPTS)
   TargetAdd('vision_module.obj', opts=OPTS)
-  TargetAdd('vision_module.obj', opts=['IMOD:panda3d.vision', 'ILIB:vision', 'IMPORT:panda3d._core'])
+  TargetAdd('vision_module.obj', opts=['IMOD:panda3d.vision', 'ILIB:vision', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('vision.pyd', input='vision_module.obj')
   TargetAdd('vision.pyd', input='vision_module.obj')
   TargetAdd('vision.pyd', input='libp3vision_igate.obj')
   TargetAdd('vision.pyd', input='libp3vision_igate.obj')
@@ -4045,7 +4008,7 @@ if (PkgSkip("ROCKET") == 0) and (not RUNTIME):
 
 
   TargetAdd('rocket_module.obj', input='libp3rocket.in')
   TargetAdd('rocket_module.obj', input='libp3rocket.in')
   TargetAdd('rocket_module.obj', opts=OPTS)
   TargetAdd('rocket_module.obj', opts=OPTS)
-  TargetAdd('rocket_module.obj', opts=['IMOD:panda3d.rocket', 'ILIB:rocket', 'IMPORT:panda3d._core'])
+  TargetAdd('rocket_module.obj', opts=['IMOD:panda3d.rocket', 'ILIB:rocket', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('rocket.pyd', input='rocket_module.obj')
   TargetAdd('rocket.pyd', input='rocket_module.obj')
   TargetAdd('rocket.pyd', input='libp3rocket_igate.obj')
   TargetAdd('rocket.pyd', input='libp3rocket_igate.obj')
@@ -4073,7 +4036,7 @@ if PkgSkip("AWESOMIUM") == 0 and not RUNTIME:
 
 
   TargetAdd('awesomium_module.obj', input='libp3awesomium.in')
   TargetAdd('awesomium_module.obj', input='libp3awesomium.in')
   TargetAdd('awesomium_module.obj', opts=OPTS)
   TargetAdd('awesomium_module.obj', opts=OPTS)
-  TargetAdd('awesomium_module.obj', opts=['IMOD:panda3d.awesomium', 'ILIB:awesomium', 'IMPORT:panda3d._core'])
+  TargetAdd('awesomium_module.obj', opts=['IMOD:panda3d.awesomium', 'ILIB:awesomium', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('awesomium.pyd', input='awesomium_module.obj')
   TargetAdd('awesomium.pyd', input='awesomium_module.obj')
   TargetAdd('awesomium.pyd', input='libp3awesomium_igate.obj')
   TargetAdd('awesomium.pyd', input='libp3awesomium_igate.obj')
@@ -4107,7 +4070,7 @@ if (PkgSkip('SKEL')==0) and (not RUNTIME):
   TargetAdd('libpandaskel.dll', opts=OPTS)
   TargetAdd('libpandaskel.dll', opts=OPTS)
 
 
   TargetAdd('skel_module.obj', input='libp3skel.in')
   TargetAdd('skel_module.obj', input='libp3skel.in')
-  TargetAdd('skel_module.obj', opts=['IMOD:panda3d.skel', 'ILIB:skel', 'IMPORT:panda3d._core'])
+  TargetAdd('skel_module.obj', opts=['IMOD:panda3d.skel', 'ILIB:skel', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('skel.pyd', input='skel_module.obj')
   TargetAdd('skel.pyd', input='skel_module.obj')
   TargetAdd('skel.pyd', input='libp3skel_igate.obj')
   TargetAdd('skel.pyd', input='libp3skel_igate.obj')
@@ -4146,7 +4109,7 @@ if (PkgSkip('PANDAFX')==0) and (not RUNTIME):
   OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG']
   OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG']
   TargetAdd('fx_module.obj', input='libp3distort.in')
   TargetAdd('fx_module.obj', input='libp3distort.in')
   TargetAdd('fx_module.obj', opts=OPTS)
   TargetAdd('fx_module.obj', opts=OPTS)
-  TargetAdd('fx_module.obj', opts=['IMOD:panda3d.fx', 'ILIB:fx', 'IMPORT:panda3d._core'])
+  TargetAdd('fx_module.obj', opts=['IMOD:panda3d.fx', 'ILIB:fx', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('fx.pyd', input='fx_module.obj')
   TargetAdd('fx.pyd', input='fx_module.obj')
   TargetAdd('fx.pyd', input='libp3distort_igate.obj')
   TargetAdd('fx.pyd', input='libp3distort_igate.obj')
@@ -4174,7 +4137,7 @@ if (PkgSkip("VRPN")==0 and not RUNTIME):
 
 
   TargetAdd('vrpn_module.obj', input='libp3vrpn.in')
   TargetAdd('vrpn_module.obj', input='libp3vrpn.in')
   TargetAdd('vrpn_module.obj', opts=OPTS)
   TargetAdd('vrpn_module.obj', opts=OPTS)
-  TargetAdd('vrpn_module.obj', opts=['IMOD:panda3d.vrpn', 'ILIB:vrpn', 'IMPORT:panda3d._core'])
+  TargetAdd('vrpn_module.obj', opts=['IMOD:panda3d.vrpn', 'ILIB:vrpn', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('vrpn.pyd', input='vrpn_module.obj')
   TargetAdd('vrpn.pyd', input='vrpn_module.obj')
   TargetAdd('vrpn.pyd', input='libp3vrpn_igate.obj')
   TargetAdd('vrpn.pyd', input='libp3vrpn_igate.obj')
@@ -4407,7 +4370,7 @@ if (not RUNTIME):
   TargetAdd('egg_module.obj', input='libp3egg2pg.in')
   TargetAdd('egg_module.obj', input='libp3egg2pg.in')
   TargetAdd('egg_module.obj', input='libp3egg.in')
   TargetAdd('egg_module.obj', input='libp3egg.in')
   TargetAdd('egg_module.obj', opts=OPTS)
   TargetAdd('egg_module.obj', opts=OPTS)
-  TargetAdd('egg_module.obj', opts=['IMOD:panda3d.egg', 'ILIB:egg', 'IMPORT:panda3d._core'])
+  TargetAdd('egg_module.obj', opts=['IMOD:panda3d.egg', 'ILIB:egg', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('egg.pyd', input='egg_module.obj')
   TargetAdd('egg.pyd', input='egg_module.obj')
   TargetAdd('egg.pyd', input='p3egg_eggGroupNode_ext.obj')
   TargetAdd('egg.pyd', input='p3egg_eggGroupNode_ext.obj')
@@ -4574,7 +4537,7 @@ if (PkgSkip("ODE")==0 and not RUNTIME):
   OPTS=['DIR:panda/metalibs/pandaode', 'ODE']
   OPTS=['DIR:panda/metalibs/pandaode', 'ODE']
   TargetAdd('ode_module.obj', input='libpandaode.in')
   TargetAdd('ode_module.obj', input='libpandaode.in')
   TargetAdd('ode_module.obj', opts=OPTS)
   TargetAdd('ode_module.obj', opts=OPTS)
-  TargetAdd('ode_module.obj', opts=['IMOD:panda3d.ode', 'ILIB:ode', 'IMPORT:panda3d._core'])
+  TargetAdd('ode_module.obj', opts=['IMOD:panda3d.ode', 'ILIB:ode', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('ode.pyd', input='ode_module.obj')
   TargetAdd('ode.pyd', input='ode_module.obj')
   TargetAdd('ode.pyd', input='libpandaode_igate.obj')
   TargetAdd('ode.pyd', input='libpandaode_igate.obj')
@@ -4612,7 +4575,7 @@ if (PkgSkip("BULLET")==0 and not RUNTIME):
   OPTS=['DIR:panda/metalibs/pandabullet', 'BULLET']
   OPTS=['DIR:panda/metalibs/pandabullet', 'BULLET']
   TargetAdd('bullet_module.obj', input='libpandabullet.in')
   TargetAdd('bullet_module.obj', input='libpandabullet.in')
   TargetAdd('bullet_module.obj', opts=OPTS)
   TargetAdd('bullet_module.obj', opts=OPTS)
-  TargetAdd('bullet_module.obj', opts=['IMOD:panda3d.bullet', 'ILIB:bullet', 'IMPORT:panda3d._core'])
+  TargetAdd('bullet_module.obj', opts=['IMOD:panda3d.bullet', 'ILIB:bullet', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('bullet.pyd', input='bullet_module.obj')
   TargetAdd('bullet.pyd', input='bullet_module.obj')
   TargetAdd('bullet.pyd', input='libpandabullet_igate.obj')
   TargetAdd('bullet.pyd', input='libpandabullet_igate.obj')
@@ -4651,7 +4614,7 @@ if (PkgSkip("PHYSX")==0):
   OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX', 'NOARCH:PPC']
   OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX', 'NOARCH:PPC']
   TargetAdd('physx_module.obj', input='libpandaphysx.in')
   TargetAdd('physx_module.obj', input='libpandaphysx.in')
   TargetAdd('physx_module.obj', opts=OPTS)
   TargetAdd('physx_module.obj', opts=OPTS)
-  TargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx', 'IMPORT:panda3d._core'])
+  TargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('physx.pyd', input='physx_module.obj')
   TargetAdd('physx.pyd', input='physx_module.obj')
   TargetAdd('physx.pyd', input='libpandaphysx_igate.obj')
   TargetAdd('physx.pyd', input='libpandaphysx_igate.obj')
@@ -4717,7 +4680,7 @@ if (PkgSkip("PANDAPHYSICS")==0) and (not RUNTIME):
   if (PkgSkip("PANDAPARTICLESYSTEM")==0):
   if (PkgSkip("PANDAPARTICLESYSTEM")==0):
     TargetAdd('physics_module.obj', input='libp3particlesystem.in')
     TargetAdd('physics_module.obj', input='libp3particlesystem.in')
   TargetAdd('physics_module.obj', opts=OPTS)
   TargetAdd('physics_module.obj', opts=OPTS)
-  TargetAdd('physics_module.obj', opts=['IMOD:panda3d.physics', 'ILIB:physics', 'IMPORT:panda3d._core'])
+  TargetAdd('physics_module.obj', opts=['IMOD:panda3d.physics', 'ILIB:physics', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('physics.pyd', input='physics_module.obj')
   TargetAdd('physics.pyd', input='physics_module.obj')
   TargetAdd('physics.pyd', input='libp3physics_igate.obj')
   TargetAdd('physics.pyd', input='libp3physics_igate.obj')
@@ -4974,23 +4937,19 @@ if (PkgSkip("DIRECT")==0):
   TargetAdd('direct_module.obj', input='libp3interval.in')
   TargetAdd('direct_module.obj', input='libp3interval.in')
   TargetAdd('direct_module.obj', input='libp3distributed.in')
   TargetAdd('direct_module.obj', input='libp3distributed.in')
   TargetAdd('direct_module.obj', opts=OPTS)
   TargetAdd('direct_module.obj', opts=OPTS)
-  TargetAdd('direct_module.obj', opts=['IMOD:panda3d._direct', 'ILIB:_direct', 'IMPORT:panda3d._core'])
-
-  TargetAdd('_direct.pyd', input='libp3dcparser_igate.obj')
-  TargetAdd('_direct.pyd', input='libp3showbase_igate.obj')
-  TargetAdd('_direct.pyd', input='libp3deadrec_igate.obj')
-  TargetAdd('_direct.pyd', input='libp3interval_igate.obj')
-  TargetAdd('_direct.pyd', input='libp3distributed_igate.obj')
+  TargetAdd('direct_module.obj', opts=['IMOD:panda3d.direct', 'ILIB:direct', 'IMPORT:panda3d.core'])
 
 
-  TargetAdd('_direct.pyd', input='direct_module.obj')
-  TargetAdd('_direct.pyd', input='libp3direct.dll')
-  TargetAdd('_direct.pyd', input='libp3interrogatedb.dll')
-  TargetAdd('_direct.pyd', input=COMMON_PANDA_LIBS)
-  TargetAdd('_direct.pyd', opts=['PYTHON', 'OPENSSL', 'WINUSER', 'WINGDI'])
+  TargetAdd('direct.pyd', input='libp3dcparser_igate.obj')
+  TargetAdd('direct.pyd', input='libp3showbase_igate.obj')
+  TargetAdd('direct.pyd', input='libp3deadrec_igate.obj')
+  TargetAdd('direct.pyd', input='libp3interval_igate.obj')
+  TargetAdd('direct.pyd', input='libp3distributed_igate.obj')
 
 
-  OPTS=['DIR:direct/src/extensions_native']
-  TargetAdd('panda3d/direct.py', input='_direct.pyd')
-  TargetAdd('panda3d/direct.py', opts=OPTS, input='CInterval_extensions.py')
+  TargetAdd('direct.pyd', input='direct_module.obj')
+  TargetAdd('direct.pyd', input='libp3direct.dll')
+  TargetAdd('direct.pyd', input='libp3interrogatedb.dll')
+  TargetAdd('direct.pyd', input=COMMON_PANDA_LIBS)
+  TargetAdd('direct.pyd', opts=['PYTHON', 'OPENSSL', 'WINUSER', 'WINGDI'])
 
 
 #
 #
 # DIRECTORY: direct/src/dcparse/
 # DIRECTORY: direct/src/dcparse/
@@ -5052,7 +5011,7 @@ if (RTDIST or RUNTIME):
     # Freeze VFSImporter and its dependency modules into p3dpython.
     # Freeze VFSImporter and its dependency modules into p3dpython.
     # Mark panda3d.core as a dependency to make sure to build that first.
     # Mark panda3d.core as a dependency to make sure to build that first.
     TargetAdd('p3dpython_frozen.obj', input='VFSImporter.py', opts=['DIR:direct/src/showbase', 'FREEZE_STARTUP'])
     TargetAdd('p3dpython_frozen.obj', input='VFSImporter.py', opts=['DIR:direct/src/showbase', 'FREEZE_STARTUP'])
-    TargetAdd('p3dpython_frozen.obj', dep='panda3d/core.py')
+    TargetAdd('p3dpython_frozen.obj', dep='core.pyd')
 
 
     TargetAdd('p3dpython_p3dpython_composite1.obj', opts=OPTS, input='p3dpython_composite1.cxx')
     TargetAdd('p3dpython_p3dpython_composite1.obj', opts=OPTS, input='p3dpython_composite1.cxx')
     TargetAdd('p3dpython_p3dPythonMain.obj', opts=OPTS, input='p3dPythonMain.cxx')
     TargetAdd('p3dpython_p3dPythonMain.obj', opts=OPTS, input='p3dPythonMain.cxx')
@@ -6201,7 +6160,7 @@ if (PkgSkip("CONTRIB")==0 and not RUNTIME):
 
 
   TargetAdd('ai_module.obj', input='libpandaai.in')
   TargetAdd('ai_module.obj', input='libpandaai.in')
   TargetAdd('ai_module.obj', opts=OPTS)
   TargetAdd('ai_module.obj', opts=OPTS)
-  TargetAdd('ai_module.obj', opts=['IMOD:panda3d.ai', 'ILIB:ai', 'IMPORT:panda3d._core'])
+  TargetAdd('ai_module.obj', opts=['IMOD:panda3d.ai', 'ILIB:ai', 'IMPORT:panda3d.core'])
 
 
   TargetAdd('ai.pyd', input='ai_module.obj')
   TargetAdd('ai.pyd', input='ai_module.obj')
   TargetAdd('ai.pyd', input='libpandaai_igate.obj')
   TargetAdd('ai.pyd', input='libpandaai_igate.obj')