diff --git a/direct/src/actor/Actor.py b/direct/src/actor/Actor.py index 7802ebc3eb..ae55e76d33 100644 --- a/direct/src/actor/Actor.py +++ b/direct/src/actor/Actor.py @@ -2,11 +2,10 @@ __all__ = ['Actor'] -from pandac.PandaModules import * +from panda3d.core import * from direct.showbase.DirectObject import DirectObject from direct.directnotify import DirectNotifyGlobal -from pandac.PandaModules import LODNode -import types, copy +import types class Actor(DirectObject, NodePath): """ diff --git a/direct/src/cluster/ClusterClient.py b/direct/src/cluster/ClusterClient.py index adb7f8744e..4dca3a1379 100644 --- a/direct/src/cluster/ClusterClient.py +++ b/direct/src/cluster/ClusterClient.py @@ -1,6 +1,6 @@ """ClusterClient: Master for mutli-piping or PC clusters. """ -from pandac.PandaModules import * +from panda3d.core import * from ClusterMsgs import * from ClusterConfig import * from direct.directnotify import DirectNotifyGlobal diff --git a/direct/src/cluster/ClusterConfig.py b/direct/src/cluster/ClusterConfig.py index 74313afc41..6cf71dcaab 100644 --- a/direct/src/cluster/ClusterConfig.py +++ b/direct/src/cluster/ClusterConfig.py @@ -1,6 +1,5 @@ from ClusterClient import * -import string # A dictionary of information for various cluster configurations. # Dictionary is keyed on cluster-config string diff --git a/direct/src/cluster/ClusterMsgs.py b/direct/src/cluster/ClusterMsgs.py index 1533884eb2..e06deeb132 100644 --- a/direct/src/cluster/ClusterMsgs.py +++ b/direct/src/cluster/ClusterMsgs.py @@ -3,7 +3,7 @@ # This module is intended to supply routines and dataformats common to # both ClusterClient and ClusterServer. -from pandac.PandaModules import * +from panda3d.core import * from direct.distributed.PyDatagram import PyDatagram from direct.distributed.PyDatagramIterator import PyDatagramIterator import time diff --git a/direct/src/cluster/ClusterServer.py b/direct/src/cluster/ClusterServer.py index a4a8177a9d..0e5cea0e0d 100644 --- a/direct/src/cluster/ClusterServer.py +++ b/direct/src/cluster/ClusterServer.py @@ -1,4 +1,4 @@ -from pandac.PandaModules import * +from panda3d.core import * from ClusterMsgs import * from direct.distributed.MsgTypes import * from direct.directnotify import DirectNotifyGlobal diff --git a/direct/src/directbase/TestStart.py b/direct/src/directbase/TestStart.py index 7439c691fa..7cb8ae37c7 100755 --- a/direct/src/directbase/TestStart.py +++ b/direct/src/directbase/TestStart.py @@ -1,10 +1,10 @@ -print 'TestStart: Starting up test environment.' +print('TestStart: Starting up test environment.') -from pandac.PandaModules import * +from panda3d.core import * from direct.showbase.PythonUtil import * from direct.showbase import ShowBase -ShowBase.ShowBase() +base = ShowBase.ShowBase() # Put an axis in the world: loader.loadModel("models/misc/xyzAxis").reparentTo(render) diff --git a/direct/src/directdevices/DirectDeviceManager.py b/direct/src/directdevices/DirectDeviceManager.py index 0c435849f1..1c0c89ca88 100644 --- a/direct/src/directdevices/DirectDeviceManager.py +++ b/direct/src/directdevices/DirectDeviceManager.py @@ -1,7 +1,8 @@ """ Class used to create and control vrpn devices """ from direct.showbase.DirectObject import DirectObject -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.vrpn import * ANALOG_MIN = -0.95 ANALOG_MAX = 0.95 @@ -294,18 +295,3 @@ class DirectTimecodeReader(AnalogNode, DirectObject): def __repr__(self): str = ('%s: %d:%d:%d:%d' % ((self.name,) + self.getTime()[:-1])) return str - - - - - - - - - - - - - - - diff --git a/direct/src/directnotify/Logger.py b/direct/src/directnotify/Logger.py index 8c7f6b6f3b..844dead3d5 100644 --- a/direct/src/directnotify/Logger.py +++ b/direct/src/directnotify/Logger.py @@ -1,7 +1,6 @@ """Logger module: contains the logger class which creates and writes data to log files on disk""" -import sys import time import math diff --git a/direct/src/directnotify/Notifier.py b/direct/src/directnotify/Notifier.py index 2d59c5bf70..816ab8c0df 100644 --- a/direct/src/directnotify/Notifier.py +++ b/direct/src/directnotify/Notifier.py @@ -6,7 +6,6 @@ from LoggerGlobal import defaultLogger from direct.showbase import PythonUtil from panda3d.core import ConfigVariableBool, NotifyCategory, StreamWriter, Notify import time -import types import sys class Notifier: diff --git a/direct/src/directscripts/doxygen_filter.py b/direct/src/directscripts/doxygen_filter.py index f69d2fa07f..43e8fc7aec 100644 --- a/direct/src/directscripts/doxygen_filter.py +++ b/direct/src/directscripts/doxygen_filter.py @@ -2,7 +2,7 @@ doxygen can understand and process. It can be used as an INPUT_FILTER in doxygen. """ -import sys, re, os +import sys, os # Explicitly include these files. Besides these, all # files ending in _src will be explicitly included too. diff --git a/direct/src/directscripts/extract_docs.py b/direct/src/directscripts/extract_docs.py index 9c59e05ff6..a0033ff5fe 100644 --- a/direct/src/directscripts/extract_docs.py +++ b/direct/src/directscripts/extract_docs.py @@ -7,7 +7,7 @@ files in the lib/pandac/input directory. """ __all__ = [] -import os, re +import os import panda3d, pandac from panda3d.dtoolconfig import * diff --git a/direct/src/directtools/DirectCameraControl.py b/direct/src/directtools/DirectCameraControl.py index b2333c2ff2..2ec27e8a5a 100644 --- a/direct/src/directtools/DirectCameraControl.py +++ b/direct/src/directtools/DirectCameraControl.py @@ -222,7 +222,7 @@ class DirectCameraControl(DirectObject): skipFlags |= SKIP_CAMERA * (1 - base.getControl()) self.computeCOA(base.direct.iRay.pickGeom(skipFlags = skipFlags)) # Record reference point - self.coaMarkerRef.iPosHprScale(base.cam) + self.coaMarkerRef.setPosHprScale(base.cam, 0, 0, 0, 0, 0, 0, 1, 1, 1) # Record entries self.cqEntries = [] for i in range(base.direct.iRay.getNumEntries()): diff --git a/direct/src/directtools/DirectGeometry.py b/direct/src/directtools/DirectGeometry.py index 437f09e448..9c748e57b3 100644 --- a/direct/src/directtools/DirectGeometry.py +++ b/direct/src/directtools/DirectGeometry.py @@ -1,5 +1,5 @@ -from pandac.PandaModules import * +from panda3d.core import * from DirectGlobals import * from DirectUtil import * import math diff --git a/direct/src/directtools/DirectGlobals.py b/direct/src/directtools/DirectGlobals.py index 11c500e622..2a70697598 100644 --- a/direct/src/directtools/DirectGlobals.py +++ b/direct/src/directtools/DirectGlobals.py @@ -1,4 +1,4 @@ -from pandac.PandaModules import Vec3, Point3, BitMask32 +from panda3d.core import Vec3, Point3, BitMask32 UNPICKABLE = ['x-disc-visible', 'y-disc-visible', 'z-disc-visible', 'GridBack', 'unpickable'] diff --git a/direct/src/directtools/DirectGrid.py b/direct/src/directtools/DirectGrid.py index d02195a2c1..71fedf52c1 100644 --- a/direct/src/directtools/DirectGrid.py +++ b/direct/src/directtools/DirectGrid.py @@ -1,5 +1,5 @@ -from pandac.PandaModules import * +from panda3d.core import * from direct.showbase.DirectObject import DirectObject from DirectUtil import * from DirectGeometry import * diff --git a/direct/src/directtools/DirectLights.py b/direct/src/directtools/DirectLights.py index 5e5a5eb5e2..1c4ffef230 100644 --- a/direct/src/directtools/DirectLights.py +++ b/direct/src/directtools/DirectLights.py @@ -1,5 +1,5 @@ -from pandac.PandaModules import * +from panda3d.core import * from string import lower class DirectLight(NodePath): diff --git a/direct/src/directtools/DirectSession.py b/direct/src/directtools/DirectSession.py index a68012c2d8..124799c6cb 100644 --- a/direct/src/directtools/DirectSession.py +++ b/direct/src/directtools/DirectSession.py @@ -2,7 +2,7 @@ import math import types import string -from pandac.PandaModules import * +from panda3d.core import * from DirectUtil import * from direct.showbase.DirectObject import DirectObject @@ -304,6 +304,7 @@ class DirectSession(DirectObject): except NameError: # Has the clusterMode been set via a config variable? self.clusterMode = base.config.GetString("cluster-mode", '') + if self.clusterMode == 'client': self.cluster = createClusterClient() elif self.clusterMode == 'server': @@ -400,7 +401,7 @@ class DirectSession(DirectObject): if self.oobeMode: # Position a target point to lerp the oobe camera to - base.direct.cameraControl.camManipRef.iPosHpr(self.trueCamera) + base.direct.cameraControl.camManipRef.setPosHpr(self.trueCamera, 0, 0, 0, 0, 0, 0) ival = self.oobeCamera.posHprInterval( 2.0, pos = Point3(0), hpr = Vec3(0), other = base.direct.cameraControl.camManipRef, @@ -416,7 +417,7 @@ class DirectSession(DirectObject): cameraParent = self.camera.getParent() # Prepare oobe camera self.oobeCamera.reparentTo(cameraParent) - self.oobeCamera.iPosHpr(self.trueCamera) + self.oobeCamera.setPosHpr(self.trueCamera, 0, 0, 0, 0, 0, 0) # Put camera under new oobe camera self.cam.reparentTo(self.oobeCamera) # Position a target point to lerp the oobe camera to @@ -432,13 +433,13 @@ class DirectSession(DirectObject): def beginOOBE(self): # Make sure we've reached our final destination - self.oobeCamera.iPosHpr(base.direct.cameraControl.camManipRef) + self.oobeCamera.setPosHpr(base.direct.cameraControl.camManipRef, 0, 0, 0, 0, 0, 0) base.direct.camera = self.oobeCamera self.oobeMode = 1 def endOOBE(self): # Make sure we've reached our final destination - self.oobeCamera.iPosHpr(self.trueCamera) + self.oobeCamera.setPosHpr(self.trueCamera, 0, 0, 0, 0, 0, 0) # Disable OOBE mode. self.cam.reparentTo(self.trueCamera) base.direct.camera = self.trueCamera @@ -806,7 +807,7 @@ class DirectSession(DirectObject): [nodePath, oldParent, self.activeParent, fWrt]) def isNotCycle(self, nodePath, parent): - if nodePath.id() == parent.id(): + if nodePath == parent: print 'DIRECT.reparent: Invalid parent' return 0 elif parent.hasParent(): @@ -1308,6 +1309,3 @@ class DisplayRegionList(DirectObject): if drc.cam == cam: self.displayRegionList.remove(drc) break - -# Create one -__builtins__['direct'] = base.direct = DirectSession() diff --git a/direct/src/distributed/PyDatagram.py b/direct/src/distributed/PyDatagram.py index 3699407b73..f5db501b72 100755 --- a/direct/src/distributed/PyDatagram.py +++ b/direct/src/distributed/PyDatagram.py @@ -3,7 +3,8 @@ # class variable FuncDict and so we can import DCSubatomicType at the top # of the file rather than every time we call the putArg function. -from pandac.PandaModules import * +from panda3d.core import Datagram +from panda3d.direct import * # Import the type numbers #from otp.ai.AIMsgTypes import * diff --git a/direct/src/distributed/PyDatagramIterator.py b/direct/src/distributed/PyDatagramIterator.py index ea3cd0ea02..88ebf4021b 100755 --- a/direct/src/distributed/PyDatagramIterator.py +++ b/direct/src/distributed/PyDatagramIterator.py @@ -3,7 +3,8 @@ # class variable FuncDict and so we can import DCSubatomicType at the top # of the file rather than every time we call the putArg function. -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * # Import the type numbers class PyDatagramIterator(DatagramIterator): diff --git a/direct/src/extensions_native/CInterval_extensions.py b/direct/src/extensions_native/CInterval_extensions.py index 34c7a781cc..f20232e2cb 100644 --- a/direct/src/extensions_native/CInterval_extensions.py +++ b/direct/src/extensions_native/CInterval_extensions.py @@ -1,7 +1,8 @@ +from .core import Dtool_funcToMethod from direct.directnotify.DirectNotifyGlobal import directNotify -notify = directNotify.newCategory("Interval") -Dtool_ObjectToDict(CInterval,"notify", notify) -del notify + +CInterval.DtoolClassDict["notify"] = directNotify.newCategory("Interval") + ##################################################################### def setT(self, t): # Overridden from the C++ function to call privPostEvent @@ -10,7 +11,7 @@ def setT(self, t): self.setT_Old(t) self.privPostEvent() -Dtool_ObjectToDict(CInterval, "setT_Old", CInterval.setT) +CInterval.DtoolClassDict["setT_Old"] = CInterval.setT Dtool_funcToMethod(setT, CInterval) del setT ##################################################################### diff --git a/direct/src/extensions_native/NodePath_extensions.py b/direct/src/extensions_native/NodePath_extensions.py index 7b17dc34f6..33c530180c 100644 --- a/direct/src/extensions_native/NodePath_extensions.py +++ b/direct/src/extensions_native/NodePath_extensions.py @@ -10,22 +10,16 @@ of the NodePath class #################################################################### def id(self): - """Returns a unique id identifying the NodePath instance""" - print "Warning: NodePath.id() is deprecated. Use hash(NodePath) or NodePath.get_key() instead." + """Deprecated. Returns a unique id identifying the NodePath instance""" + print("Warning: NodePath.id() is deprecated. Use hash(NodePath) or NodePath.get_key() instead.") return self.getKey() Dtool_funcToMethod(id, NodePath) del id ##################################################################### - -## def __hash__(self): // inside c code -## return self.getKey() -##################################################################### - - # For iterating over children def getChildrenAsList(self): - """Converts a node path's child NodePathCollection into a list""" - print "Warning: NodePath.getChildrenAsList() is deprecated. Use get_children() instead." + """Deprecated. Converts a node path's child NodePathCollection into a list""" + print("Warning: NodePath.getChildrenAsList() is deprecated. Use get_children() instead.") return list(self.getChildren()) Dtool_funcToMethod(getChildrenAsList, NodePath) @@ -35,7 +29,7 @@ del getChildrenAsList def printChildren(self): """Prints out the children of the bottom node of a node path""" for child in self.getChildren(): - print child.getName() + print(child.getName()) Dtool_funcToMethod(printChildren, NodePath) del printChildren ##################################################################### @@ -95,8 +89,8 @@ del isolate ##################################################################### def remove(self): - """Remove a node path from the scene graph""" - print "Warning: NodePath.remove() is deprecated. Use remove_node() instead." + """Deprecated. Remove a node path from the scene graph""" + print("Warning: NodePath.remove() is deprecated. Use remove_node() instead.") # Send message in case anyone needs to do something # before node is deleted messenger.send('preRemoveNodePath', [self]) @@ -109,11 +103,11 @@ del remove def lsNames(self): """Walk down a tree and print out the path""" if self.isEmpty(): - print "(empty)" + print("(empty)") else: type = self.node().getType().getName() name = self.getName() - print type + " " + name + print(type + " " + name) self.lsNamesRecurse() Dtool_funcToMethod(lsNames, NodePath) @@ -124,7 +118,7 @@ def lsNamesRecurse(self, indentString=' '): for nodePath in self.getChildren(): type = nodePath.node().getType().getName() name = nodePath.getName() - print indentString + type + " " + name + print(indentString + type + " " + name) nodePath.lsNamesRecurse(indentString + " ") Dtool_funcToMethod(lsNamesRecurse, NodePath) @@ -138,7 +132,7 @@ def reverseLsNames(self): for nodePath in ancestry: type = nodePath.node().getType().getName() name = nodePath.getName() - print indentString + type + " " + name + print(indentString + type + " " + name) indentString = indentString + " " Dtool_funcToMethod(reverseLsNames, NodePath) @@ -146,7 +140,7 @@ del reverseLsNames ##################################################################### def getAncestry(self): """Get a list of a node path's ancestors""" - print "NodePath.getAncestry() is deprecated. Use get_ancestors() instead.""" + print("NodePath.getAncestry() is deprecated. Use get_ancestors() instead.""") ancestors = list(self.getAncestors()) ancestors.reverse() return ancestors @@ -197,11 +191,11 @@ def printPos(self, other = None, sd = 2): else: pos = self.getPos() otherString = '' - print (self.getName() + '.setPos(' + otherString + + print((self.getName() + '.setPos(' + otherString + formatString % pos[0] + ', ' + formatString % pos[1] + ', ' + formatString % pos[2] + - ')\n') + ')\n')) Dtool_funcToMethod(printPos, NodePath) del printPos ##################################################################### @@ -215,11 +209,11 @@ def printHpr(self, other = None, sd = 2): else: hpr = self.getHpr() otherString = '' - print (self.getName() + '.setHpr(' + otherString + + print((self.getName() + '.setHpr(' + otherString + formatString % hpr[0] + ', ' + formatString % hpr[1] + ', ' + formatString % hpr[2] + - ')\n') + ')\n')) Dtool_funcToMethod(printHpr, NodePath) del printHpr ##################################################################### @@ -233,11 +227,11 @@ def printScale(self, other = None, sd = 2): else: scale = self.getScale() otherString = '' - print (self.getName() + '.setScale(' + otherString + + print((self.getName() + '.setScale(' + otherString + formatString % scale[0] + ', ' + formatString % scale[1] + ', ' + formatString % scale[2] + - ')\n') + ')\n')) Dtool_funcToMethod(printScale, NodePath) del printScale @@ -253,14 +247,14 @@ def printPosHpr(self, other = None, sd = 2): pos = self.getPos() hpr = self.getHpr() otherString = '' - print (self.getName() + '.setPosHpr(' + otherString + + print((self.getName() + '.setPosHpr(' + otherString + formatString % pos[0] + ', ' + formatString % pos[1] + ', ' + formatString % pos[2] + ', ' + formatString % hpr[0] + ', ' + formatString % hpr[1] + ', ' + formatString % hpr[2] + - ')\n') + ')\n')) Dtool_funcToMethod(printPosHpr, NodePath) del printPosHpr @@ -278,7 +272,7 @@ def printPosHprScale(self, other = None, sd = 2): hpr = self.getHpr() scale = self.getScale() otherString = '' - print (self.getName() + '.setPosHprScale(' + otherString + + print((self.getName() + '.setPosHprScale(' + otherString + formatString % pos[0] + ', ' + formatString % pos[1] + ', ' + formatString % pos[2] + ', ' + @@ -288,14 +282,14 @@ def printPosHprScale(self, other = None, sd = 2): formatString % scale[0] + ', ' + formatString % scale[1] + ', ' + formatString % scale[2] + - ')\n') + ')\n')) Dtool_funcToMethod(printPosHprScale, NodePath) del printPosHprScale ##################################################################### def printTransform(self, other = None, sd = 2, fRecursive = 0): - from pandac.PandaModules import Vec3 + from panda3d.core import Vec3 fmtStr = '%%0.%df' % sd name = self.getName() if other == None: @@ -306,23 +300,23 @@ def printTransform(self, other = None, sd = 2, fRecursive = 0): pos = transform.getPos() if not pos.almostEqual(Vec3(0)): outputString = '%s.setPos(%s, %s, %s)' % (name, fmtStr, fmtStr, fmtStr) - print outputString % (pos[0], pos[1], pos[2]) + print(outputString % (pos[0], pos[1], pos[2])) if transform.hasHpr(): hpr = transform.getHpr() if not hpr.almostEqual(Vec3(0)): outputString = '%s.setHpr(%s, %s, %s)' % (name, fmtStr, fmtStr, fmtStr) - print outputString % (hpr[0], hpr[1], hpr[2]) + print(outputString % (hpr[0], hpr[1], hpr[2])) if transform.hasScale(): if transform.hasUniformScale(): scale = transform.getUniformScale() if scale != 1.0: outputString = '%s.setScale(%s)' % (name, fmtStr) - print outputString % scale + print(outputString % scale) else: scale = transform.getScale() if not scale.almostEqual(Vec3(1)): outputString = '%s.setScale(%s, %s, %s)' % (name, fmtStr, fmtStr, fmtStr) - print outputString % (scale[0], scale[1], scale[2]) + print(outputString % (scale[0], scale[1], scale[2])) if fRecursive: for child in self.getChildren(): child.printTransform(other, sd, fRecursive) @@ -383,700 +377,6 @@ def iPosHprScale(self, other = None): Dtool_funcToMethod(iPosHprScale, NodePath) del iPosHprScale ##################################################################### - -def __lerp(self, functorFunc, duration, blendType, taskName=None): - """ - __lerp(self, functorFunc, float, string, string) - Basic lerp functionality used by other lerps. - Fire off a lerp. Make it a task if taskName given. - """ - # functorFunc is a function which can be called to create a functor. - # functor creation is defered so initial state (sampled in functorFunc) - # will be appropriate for the time the lerp is spawned - from direct.task import Task - from direct.interval import LerpBlendHelpers - from direct.task.TaskManagerGlobal import taskMgr - - # make the task function - def lerpTaskFunc(task): - from pandac.PandaModules import Lerp - from pandac.PandaModules import ClockObject - from direct.task.Task import Task, cont, done - if task.init == 1: - # make the lerp - functor = task.functorFunc() - task.lerp = Lerp(functor, task.duration, task.blendType) - task.init = 0 - dt = globalClock.getDt() - task.lerp.setStepSize(dt) - task.lerp.step() - if (task.lerp.isDone()): - # Reset the init flag, in case the task gets re-used - task.init = 1 - return(done) - else: - return(cont) - - # make the lerp task - lerpTask = Task.Task(lerpTaskFunc) - lerpTask.init = 1 - lerpTask.functorFunc = functorFunc - lerpTask.duration = duration - lerpTask.blendType = LerpBlendHelpers.getBlend(blendType) - - if (taskName == None): - # don't spawn a task, return one instead - return lerpTask - else: - # spawn the lerp task - taskMgr.add(lerpTask, taskName) - return lerpTask - -Dtool_funcToMethod(__lerp, NodePath) -del __lerp -##################################################################### -def __autoLerp(self, functorFunc, time, blendType, taskName): - """_autoLerp(self, functor, float, string, string) - This lerp uses C++ to handle the stepping. Bonus is - its more efficient, trade-off is there is less control""" - from pandac.PandaModules import AutonomousLerp - from direct.interval import LerpBlendHelpers - # make a lerp that lives in C++ land - functor = functorFunc() - lerp = AutonomousLerp(functor, time, - LerpBlendHelpers.getBlend(blendType), - base.eventHandler) - lerp.start() - return lerp - -Dtool_funcToMethod(__autoLerp, NodePath) -del __autoLerp -##################################################################### - -# user callable lerp methods -def lerpColor(self, *posArgs, **keyArgs): - """lerpColor(self, *positionArgs, **keywordArgs) - determine which lerpColor* to call based on arguments - """ - if (len(posArgs) == 2): - return apply(self.lerpColorVBase4, posArgs, keyArgs) - elif (len(posArgs) == 3): - return apply(self.lerpColorVBase4VBase4, posArgs, keyArgs) - elif (len(posArgs) == 5): - return apply(self.lerpColorRGBA, posArgs, keyArgs) - elif (len(posArgs) == 9): - return apply(self.lerpColorRGBARGBA, posArgs, keyArgs) - else: - # bad args - raise Exception("Error: NodePath.lerpColor: bad number of args") - -Dtool_funcToMethod(lerpColor, NodePath) -del lerpColor -##################################################################### - -def lerpColorRGBA(self, r, g, b, a, time, - blendType="noBlend", auto=None, task=None): - """lerpColorRGBA(self, float, float, float, float, float, - string="noBlend", string=none, string=none) - """ - def functorFunc(self = self, r = r, g = g, b = b, a = a): - from pandac.PandaModules import ColorLerpFunctor - # just end rgba values, use current color rgba values for start - startColor = self.getColor() - functor = ColorLerpFunctor( - self, - startColor[0], startColor[1], - startColor[2], startColor[3], - r, g, b, a) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - -Dtool_funcToMethod(lerpColorRGBA, NodePath) -del lerpColorRGBA -##################################################################### -def lerpColorRGBARGBA(self, sr, sg, sb, sa, er, eg, eb, ea, time, - blendType="noBlend", auto=None, task=None): - """lerpColorRGBARGBA(self, float, float, float, float, float, - float, float, float, float, string="noBlend", string=none, string=none) - """ - def functorFunc(self = self, sr = sr, sg = sg, sb = sb, sa = sa, - er = er, eg = eg, eb = eb, ea = ea): - from pandac.PandaModules import ColorLerpFunctor - # start and end rgba values - functor = ColorLerpFunctor(self, sr, sg, sb, sa, - er, eg, eb, ea) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - -Dtool_funcToMethod(lerpColorRGBARGBA, NodePath) -del lerpColorRGBARGBA -##################################################################### -def lerpColorVBase4(self, endColor, time, - blendType="noBlend", auto=None, task=None): - """lerpColorVBase4(self, VBase4, float, string="noBlend", string=none, - string=none) - """ - def functorFunc(self = self, endColor = endColor): - from pandac.PandaModules import ColorLerpFunctor - # just end vec4, use current color for start - startColor = self.getColor() - functor = ColorLerpFunctor( - self, startColor, endColor) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - -Dtool_funcToMethod(lerpColorVBase4, NodePath) -del lerpColorVBase4 -##################################################################### -def lerpColorVBase4VBase4(self, startColor, endColor, time, - blendType="noBlend", auto=None, task=None): - """lerpColorVBase4VBase4(self, VBase4, VBase4, float, string="noBlend", - string=none, string=none) - """ - def functorFunc(self = self, startColor = startColor, - endColor = endColor): - from pandac.PandaModules import ColorLerpFunctor - # start color and end vec - functor = ColorLerpFunctor( - self, startColor, endColor) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - - - -Dtool_funcToMethod(lerpColorVBase4VBase4, NodePath) -del lerpColorVBase4VBase4 -##################################################################### - # user callable lerp methods -def lerpColorScale(self, *posArgs, **keyArgs): - """lerpColorScale(self, *positionArgs, **keywordArgs) - determine which lerpColorScale* to call based on arguments - """ - if (len(posArgs) == 2): - return apply(self.lerpColorScaleVBase4, posArgs, keyArgs) - elif (len(posArgs) == 3): - return apply(self.lerpColorScaleVBase4VBase4, posArgs, keyArgs) - elif (len(posArgs) == 5): - return apply(self.lerpColorScaleRGBA, posArgs, keyArgs) - elif (len(posArgs) == 9): - return apply(self.lerpColorScaleRGBARGBA, posArgs, keyArgs) - else: - # bad args - raise Exception("Error: NodePath.lerpColorScale: bad number of args") - - -Dtool_funcToMethod(lerpColorScale, NodePath) -del lerpColorScale -##################################################################### -def lerpColorScaleRGBA(self, r, g, b, a, time, - blendType="noBlend", auto=None, task=None): - """lerpColorScaleRGBA(self, float, float, float, float, float, - string="noBlend", string=none, string=none) - """ - def functorFunc(self = self, r = r, g = g, b = b, a = a): - from pandac.PandaModules import ColorScaleLerpFunctor - # just end rgba values, use current color rgba values for start - startColor = self.getColor() - functor = ColorScaleLerpFunctor( - self, - startColor[0], startColor[1], - startColor[2], startColor[3], - r, g, b, a) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - -Dtool_funcToMethod(lerpColorScaleRGBA, NodePath) -del lerpColorScaleRGBA -##################################################################### -def lerpColorScaleRGBARGBA(self, sr, sg, sb, sa, er, eg, eb, ea, time, - blendType="noBlend", auto=None, task=None): - """lerpColorScaleRGBARGBA(self, float, float, float, float, float, - float, float, float, float, string="noBlend", string=none, string=none) - """ - def functorFunc(self = self, sr = sr, sg = sg, sb = sb, sa = sa, - er = er, eg = eg, eb = eb, ea = ea): - from pandac.PandaModules import ColorScaleLerpFunctor - # start and end rgba values - functor = ColorScaleLerpFunctor(self, sr, sg, sb, sa, - er, eg, eb, ea) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - -Dtool_funcToMethod(lerpColorScaleRGBARGBA, NodePath) -del lerpColorScaleRGBARGBA -##################################################################### -def lerpColorScaleVBase4(self, endColor, time, - blendType="noBlend", auto=None, task=None): - """lerpColorScaleVBase4(self, VBase4, float, string="noBlend", string=none, - string=none) - """ - def functorFunc(self = self, endColor = endColor): - from pandac.PandaModules import ColorScaleLerpFunctor - # just end vec4, use current color for start - startColor = self.getColor() - functor = ColorScaleLerpFunctor( - self, startColor, endColor) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - -Dtool_funcToMethod(lerpColorScaleVBase4, NodePath) -del lerpColorScaleVBase4 -##################################################################### -def lerpColorScaleVBase4VBase4(self, startColor, endColor, time, - blendType="noBlend", auto=None, task=None): - """lerpColorScaleVBase4VBase4(self, VBase4, VBase4, float, string="noBlend", - string=none, string=none) - """ - def functorFunc(self = self, startColor = startColor, - endColor = endColor): - from pandac.PandaModules import ColorScaleLerpFunctor - # start color and end vec - functor = ColorScaleLerpFunctor( - self, startColor, endColor) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - - - -Dtool_funcToMethod(lerpColorScaleVBase4VBase4, NodePath) -del lerpColorScaleVBase4VBase4 -##################################################################### -def lerpHpr(self, *posArgs, **keyArgs): - """lerpHpr(self, *positionArgs, **keywordArgs) - Determine whether to call lerpHprHPR or lerpHprVBase3 - based on first argument - """ - # check to see if lerping with - # three floats or a VBase3 - if (len(posArgs) == 4): - return apply(self.lerpHprHPR, posArgs, keyArgs) - elif(len(posArgs) == 2): - return apply(self.lerpHprVBase3, posArgs, keyArgs) - else: - # bad args - raise Exception("Error: NodePath.lerpHpr: bad number of args") - -Dtool_funcToMethod(lerpHpr, NodePath) -del lerpHpr -##################################################################### -def lerpHprHPR(self, h, p, r, time, other=None, - blendType="noBlend", auto=None, task=None, shortest=1): - """lerpHprHPR(self, float, float, float, float, string="noBlend", - string=none, string=none, NodePath=none) - Perform a hpr lerp with three floats as the end point - """ - def functorFunc(self = self, h = h, p = p, r = r, - other = other, shortest=shortest): - from pandac.PandaModules import HprLerpFunctor - # it's individual hpr components - if (other != None): - # lerp wrt other - startHpr = self.getHpr(other) - functor = HprLerpFunctor( - self, - startHpr[0], startHpr[1], startHpr[2], - h, p, r, other) - if shortest: - functor.takeShortest() - else: - startHpr = self.getHpr() - functor = HprLerpFunctor( - self, - startHpr[0], startHpr[1], startHpr[2], - h, p, r) - if shortest: - functor.takeShortest() - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - -Dtool_funcToMethod(lerpHprHPR, NodePath) -del lerpHprHPR -##################################################################### -def lerpHprVBase3(self, hpr, time, other=None, - blendType="noBlend", auto=None, task=None, shortest=1): - """lerpHprVBase3(self, VBase3, float, string="noBlend", string=none, - string=none, NodePath=None) - Perform a hpr lerp with a VBase3 as the end point - """ - def functorFunc(self = self, hpr = hpr, - other = other, shortest=shortest): - from pandac.PandaModules import HprLerpFunctor - # it's a vbase3 hpr - if (other != None): - # lerp wrt other - functor = HprLerpFunctor( - self, (self.getHpr(other)), hpr, other) - if shortest: - functor.takeShortest() - else: - functor = HprLerpFunctor( - self, (self.getHpr()), hpr) - if shortest: - functor.takeShortest() - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - - -Dtool_funcToMethod(lerpHprVBase3, NodePath) -del lerpHprVBase3 -##################################################################### -def lerpPos(self, *posArgs, **keyArgs): - """lerpPos(self, *positionArgs, **keywordArgs) - Determine whether to call lerpPosXYZ or lerpPosPoint3 - based on the first argument - """ - # check to see if lerping with three - # floats or a Point3 - if (len(posArgs) == 4): - return apply(self.lerpPosXYZ, posArgs, keyArgs) - elif(len(posArgs) == 2): - return apply(self.lerpPosPoint3, posArgs, keyArgs) - else: - # bad number off args - raise Exception("Error: NodePath.lerpPos: bad number of args") - -Dtool_funcToMethod(lerpPos, NodePath) -del lerpPos -##################################################################### -def lerpPosXYZ(self, x, y, z, time, other=None, - blendType="noBlend", auto=None, task=None): - """lerpPosXYZ(self, float, float, float, float, string="noBlend", - string=None, NodePath=None) - Perform a pos lerp with three floats as the end point - """ - def functorFunc(self = self, x = x, y = y, z = z, other = other): - from pandac.PandaModules import PosLerpFunctor - if (other != None): - # lerp wrt other - startPos = self.getPos(other) - functor = PosLerpFunctor(self, - startPos[0], startPos[1], startPos[2], - x, y, z, other) - else: - startPos = self.getPos() - functor = PosLerpFunctor(self, startPos[0], - startPos[1], startPos[2], x, y, z) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - -Dtool_funcToMethod(lerpPosXYZ, NodePath) -del lerpPosXYZ -##################################################################### -def lerpPosPoint3(self, pos, time, other=None, - blendType="noBlend", auto=None, task=None): - """lerpPosPoint3(self, Point3, float, string="noBlend", string=None, - string=None, NodePath=None) - Perform a pos lerp with a Point3 as the end point - """ - def functorFunc(self = self, pos = pos, other = other): - from pandac.PandaModules import PosLerpFunctor - if (other != None): - #lerp wrt other - functor = PosLerpFunctor( - self, (self.getPos(other)), pos, other) - else: - functor = PosLerpFunctor( - self, (self.getPos()), pos) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - - -Dtool_funcToMethod(lerpPosPoint3, NodePath) -del lerpPosPoint3 -##################################################################### -def lerpPosHpr(self, *posArgs, **keyArgs): - """lerpPosHpr(self, *positionArgs, **keywordArgs) - Determine whether to call lerpPosHprXYZHPR or lerpHprPoint3VBase3 - based on first argument - """ - # check to see if lerping with - # six floats or a Point3 and a VBase3 - if (len(posArgs) == 7): - return apply(self.lerpPosHprXYZHPR, posArgs, keyArgs) - elif(len(posArgs) == 3): - return apply(self.lerpPosHprPoint3VBase3, posArgs, keyArgs) - else: - # bad number off args - raise Exception("Error: NodePath.lerpPosHpr: bad number of args") - -Dtool_funcToMethod(lerpPosHpr, NodePath) -del lerpPosHpr -##################################################################### -def lerpPosHprPoint3VBase3(self, pos, hpr, time, other=None, - blendType="noBlend", auto=None, task=None, shortest=1): - """lerpPosHprPoint3VBase3(self, Point3, VBase3, string="noBlend", - string=none, string=none, NodePath=None) - """ - def functorFunc(self = self, pos = pos, hpr = hpr, - other = other, shortest=shortest): - from pandac.PandaModules import PosHprLerpFunctor - if (other != None): - # lerp wrt other - startPos = self.getPos(other) - startHpr = self.getHpr(other) - functor = PosHprLerpFunctor( - self, startPos, pos, - startHpr, hpr, other) - if shortest: - functor.takeShortest() - else: - startPos = self.getPos() - startHpr = self.getHpr() - functor = PosHprLerpFunctor( - self, startPos, pos, - startHpr, hpr) - if shortest: - functor.takeShortest() - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - -Dtool_funcToMethod(lerpPosHprPoint3VBase3, NodePath) -del lerpPosHprPoint3VBase3 -##################################################################### -def lerpPosHprXYZHPR(self, x, y, z, h, p, r, time, other=None, - blendType="noBlend", auto=None, task=None, shortest=1): - """lerpPosHpr(self, float, string="noBlend", string=none, - string=none, NodePath=None) - """ - def functorFunc(self = self, x = x, y = y, z = z, - h = h, p = p, r = r, other = other, shortest=shortest): - from pandac.PandaModules import PosHprLerpFunctor - if (other != None): - # lerp wrt other - startPos = self.getPos(other) - startHpr = self.getHpr(other) - functor = PosHprLerpFunctor(self, - startPos[0], startPos[1], - startPos[2], x, y, z, - startHpr[0], startHpr[1], - startHpr[2], h, p, r, - other) - if shortest: - functor.takeShortest() - else: - startPos = self.getPos() - startHpr = self.getHpr() - functor = PosHprLerpFunctor(self, - startPos[0], startPos[1], - startPos[2], x, y, z, - startHpr[0], startHpr[1], - startHpr[2], h, p, r) - if shortest: - functor.takeShortest() - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - - -Dtool_funcToMethod(lerpPosHprXYZHPR, NodePath) -del lerpPosHprXYZHPR -##################################################################### -def lerpPosHprScale(self, pos, hpr, scale, time, other=None, - blendType="noBlend", auto=None, task=None, shortest=1): - """lerpPosHpr(self, Point3, VBase3, float, float, string="noBlend", - string=none, string=none, NodePath=None) - Only one case, no need for extra args. Call the appropriate lerp - (auto, spawned, or blocking) based on how(if) a task name is given - """ - def functorFunc(self = self, pos = pos, hpr = hpr, - scale = scale, other = other, shortest=shortest): - from pandac.PandaModules import PosHprScaleLerpFunctor - if (other != None): - # lerp wrt other - startPos = self.getPos(other) - startHpr = self.getHpr(other) - startScale = self.getScale(other) - functor = PosHprScaleLerpFunctor(self, - startPos, pos, - startHpr, hpr, - startScale, scale, other) - if shortest: - functor.takeShortest() - else: - startPos = self.getPos() - startHpr = self.getHpr() - startScale = self.getScale() - functor = PosHprScaleLerpFunctor(self, - startPos, pos, - startHpr, hpr, - startScale, scale) - if shortest: - functor.takeShortest() - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - - -Dtool_funcToMethod(lerpPosHprScale, NodePath) -del lerpPosHprScale -##################################################################### -def lerpScale(self, *posArgs, **keyArgs): - """lerpSclae(self, *positionArgs, **keywordArgs) - Determine whether to call lerpScaleXYZ or lerpScaleaseV3 - based on the first argument - """ - # check to see if lerping with three - # floats or a Point3 - if (len(posArgs) == 4): - return apply(self.lerpScaleXYZ, posArgs, keyArgs) - elif(len(posArgs) == 2): - return apply(self.lerpScaleVBase3, posArgs, keyArgs) - else: - # bad number off args - raise Exception("Error: NodePath.lerpScale: bad number of args") - -Dtool_funcToMethod(lerpScale, NodePath) -del lerpScale -##################################################################### -def lerpScaleVBase3(self, scale, time, other=None, - blendType="noBlend", auto=None, task=None): - """lerpPos(self, VBase3, float, string="noBlend", string=none, - string=none, NodePath=None) - """ - def functorFunc(self = self, scale = scale, other = other): - from pandac.PandaModules import ScaleLerpFunctor - if (other != None): - # lerp wrt other - functor = ScaleLerpFunctor(self, - (self.getScale(other)), - scale, other) - else: - functor = ScaleLerpFunctor(self, - (self.getScale()), scale) - - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - -Dtool_funcToMethod(lerpScaleVBase3, NodePath) -del lerpScaleVBase3 -##################################################################### -def lerpScaleXYZ(self, sx, sy, sz, time, other=None, - blendType="noBlend", auto=None, task=None): - """lerpPos(self, float, float, float, float, string="noBlend", - string=none, string=none, NodePath=None) - """ - def functorFunc(self = self, sx = sx, sy = sy, sz = sz, other = other): - from pandac.PandaModules import ScaleLerpFunctor - if (other != None): - # lerp wrt other - startScale = self.getScale(other) - functor = ScaleLerpFunctor(self, - startScale[0], startScale[1], - startScale[2], sx, sy, sz, other) - else: - startScale = self.getScale() - functor = ScaleLerpFunctor(self, - startScale[0], startScale[1], - startScale[2], sx, sy, sz) - return functor - #determine whether to use auto, spawned, or blocking lerp - if (auto != None): - return self.__autoLerp(functorFunc, time, blendType, auto) - elif (task != None): - return self.__lerp(functorFunc, time, blendType, task) - else: - return self.__lerp(functorFunc, time, blendType) - - - - -Dtool_funcToMethod(lerpScaleXYZ, NodePath) -del lerpScaleXYZ -##################################################################### def place(self): base.startDirect(fWantTk = 1) from direct.tkpanels import Placer @@ -1253,8 +553,8 @@ Dtool_funcToMethod(colorScaleInterval, NodePath) del colorScaleInterval ##################################################################### def attachCollisionSphere(self, name, cx, cy, cz, r, fromCollide, intoCollide): - from pandac.PandaModules import CollisionSphere - from pandac.PandaModules import CollisionNode + from panda3d.core import CollisionSphere + from panda3d.core import CollisionNode coll = CollisionSphere(cx, cy, cz, r) collNode = CollisionNode(name) collNode.addSolid(coll) @@ -1267,8 +567,8 @@ Dtool_funcToMethod(attachCollisionSphere, NodePath) del attachCollisionSphere ##################################################################### def attachCollisionSegment(self, name, ax, ay, az, bx, by, bz, fromCollide, intoCollide): - from pandac.PandaModules import CollisionSegment - from pandac.PandaModules import CollisionNode + from panda3d.core import CollisionSegment + from panda3d.core import CollisionNode coll = CollisionSegment(ax, ay, az, bx, by, bz) collNode = CollisionNode(name) collNode.addSolid(coll) @@ -1281,8 +581,8 @@ Dtool_funcToMethod(attachCollisionSegment, NodePath) del attachCollisionSegment ##################################################################### def attachCollisionRay(self, name, ox, oy, oz, dx, dy, dz, fromCollide, intoCollide): - from pandac.PandaModules import CollisionRay - from pandac.PandaModules import CollisionNode + from panda3d.core import CollisionRay + from panda3d.core import CollisionNode coll = CollisionRay(ox, oy, oz, dx, dy, dz) collNode = CollisionNode(name) collNode.addSolid(coll) @@ -1296,7 +596,7 @@ del attachCollisionRay ##################################################################### def flattenMultitex(self, stateFrom = None, target = None, useGeom = 0, allowTexMat = 0, win = None): - from pandac.PandaModules import MultitexReducer + from panda3d.core import MultitexReducer mr = MultitexReducer() if target != None: mr.setTarget(target) @@ -1466,26 +766,31 @@ del r_constructCollisionTree ##################################################################### def analyze(self): - from pandac.PandaModules import SceneGraphAnalyzer + """ + Analyzes the geometry below this node and reports the + number of vertices, triangles, etc. This is the same + information reported by the bam-info program. + """ + from panda3d.core import SceneGraphAnalyzer sga = SceneGraphAnalyzer() sga.addNode(self.node()) if sga.getNumLodNodes() == 0: - print sga + print(sga) else: - print "At highest LOD:" + print("At highest LOD:") sga2 = SceneGraphAnalyzer() sga2.setLodMode(sga2.LMHighest) sga2.addNode(self.node()) - print sga2 + print(sga2) - print "\nAt lowest LOD:" + print("\nAt lowest LOD:") sga2.clear() sga2.setLodMode(sga2.LMLowest) sga2.addNode(self.node()) - print sga2 + print(sga2) - print "\nAll nodes:" - print sga + print("\nAll nodes:") + print(sga) Dtool_funcToMethod(analyze, NodePath) del analyze diff --git a/direct/src/extensions_native/VBase3_extensions.py b/direct/src/extensions_native/VBase3_extensions.py index 331bafdd4e..29fbb3dc00 100755 --- a/direct/src/extensions_native/VBase3_extensions.py +++ b/direct/src/extensions_native/VBase3_extensions.py @@ -14,7 +14,7 @@ def asTuple(self): """ Returns the vector as a tuple. """ - print "Warning: VBase3.asTuple() is no longer needed and deprecated. Use the vector directly instead." + print("Warning: VBase3.asTuple() is no longer needed and deprecated. Use the vector directly instead.") return tuple(self) Dtool_funcToMethod(asTuple, VBase3) del asTuple diff --git a/direct/src/extensions_native/VBase4_extensions.py b/direct/src/extensions_native/VBase4_extensions.py index 8b7c022593..cf5c790e51 100755 --- a/direct/src/extensions_native/VBase4_extensions.py +++ b/direct/src/extensions_native/VBase4_extensions.py @@ -14,7 +14,7 @@ def asTuple(self): """ Returns the vector as a tuple. """ - 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) Dtool_funcToMethod(asTuple, VBase4) diff --git a/direct/src/ffi/DoGenPyCode.py b/direct/src/ffi/DoGenPyCode.py index 5bb7cb56e7..9bfb627ab1 100644 --- a/direct/src/ffi/DoGenPyCode.py +++ b/direct/src/ffi/DoGenPyCode.py @@ -5,8 +5,6 @@ the user to specify alternate parameters on the command line. """ import getopt import sys import os -import glob -import types import time from direct.ffi import FFIConstants @@ -224,7 +222,7 @@ def doErrorCheck(): FFIConstants.CodeModuleNameList = codeLibs def generateNativeWrappers(): - from direct.extensions_native.extension_native_helpers import Dtool_FindModule, Dtool_PreloadDLL + from direct.extensions_native.extension_native_helpers import Dtool_PreloadDLL # Empty out the output directories of unnecessary crud from # previous runs before we begin. @@ -337,7 +335,7 @@ def run(): if doHTML: from direct.directscripts import gendocs - from pandac.PandaModules import PandaSystem + from panda3d.core import PandaSystem versionString = '%s %s' % ( PandaSystem.getDistributor(), PandaSystem.getVersionString()) diff --git a/direct/src/ffi/FFITypes.py b/direct/src/ffi/FFITypes.py index 8669d2ec85..da20acb499 100644 --- a/direct/src/ffi/FFITypes.py +++ b/direct/src/ffi/FFITypes.py @@ -8,7 +8,6 @@ They get constructed by and stored in FFIInterrogateDatabase. """ -import sys import os import string import FFIConstants diff --git a/direct/src/ffi/jGenPyCode.py b/direct/src/ffi/jGenPyCode.py index cc7440bd42..3c8ee77bee 100755 --- a/direct/src/ffi/jGenPyCode.py +++ b/direct/src/ffi/jGenPyCode.py @@ -72,7 +72,6 @@ if (EXTENSIONS is None): ############################################################## from direct.ffi import DoGenPyCode -from direct.ffi import FFIConstants DoGenPyCode.outputCodeDir = PANDAC DoGenPyCode.outputHTMLDir = os.path.join(PANDAC,"..","doc") DoGenPyCode.directDir = DIRECT diff --git a/direct/src/filter/CommonFilters.py b/direct/src/filter/CommonFilters.py index 42b06d740b..a6f9e43520 100644 --- a/direct/src/filter/CommonFilters.py +++ b/direct/src/filter/CommonFilters.py @@ -19,8 +19,8 @@ from FilterManager import FilterManager from panda3d.core import LVecBase4, LPoint2 from panda3d.core import Filename from panda3d.core import AuxBitplaneAttrib -from panda3d.core import RenderState, Texture, Shader, ATSNone -import sys,os +from panda3d.core import Texture, Shader, ATSNone +import os CARTOON_BODY=""" float4 cartoondelta = k_cartoonseparation * texpix_txaux.xwyw; diff --git a/direct/src/filter/FilterManager.py b/direct/src/filter/FilterManager.py index c03afe4bc0..432ae6fe93 100644 --- a/direct/src/filter/FilterManager.py +++ b/direct/src/filter/FilterManager.py @@ -14,13 +14,12 @@ Still need to implement: """ -from panda3d.core import NodePath, PandaNode -from panda3d.core import RenderState, Texture, Shader +from panda3d.core import NodePath +from panda3d.core import Texture from panda3d.core import CardMaker -from panda3d.core import TextureStage from panda3d.core import GraphicsPipe, GraphicsOutput from panda3d.core import WindowProperties, FrameBufferProperties -from panda3d.core import Camera, DisplayRegion +from panda3d.core import Camera from panda3d.core import OrthographicLens from panda3d.core import AuxBitplaneAttrib from direct.directnotify.DirectNotifyGlobal import * diff --git a/direct/src/fsm/FourState.py b/direct/src/fsm/FourState.py index 6f42046cef..52c9549d85 100755 --- a/direct/src/fsm/FourState.py +++ b/direct/src/fsm/FourState.py @@ -8,7 +8,6 @@ from direct.directnotify import DirectNotifyGlobal #import DistributedObject import ClassicFSM import State -from direct.task import Task class FourState: diff --git a/direct/src/fsm/SampleFSM.py b/direct/src/fsm/SampleFSM.py index e12c847a4b..ba2c1de138 100644 --- a/direct/src/fsm/SampleFSM.py +++ b/direct/src/fsm/SampleFSM.py @@ -3,7 +3,6 @@ __all__ = ['ClassicStyle', 'NewStyle', 'ToonEyes'] import FSM -from pandac.PandaModules import * from direct.task import Task import string diff --git a/direct/src/fsm/State.py b/direct/src/fsm/State.py index 0af9f45851..75e8269f11 100644 --- a/direct/src/fsm/State.py +++ b/direct/src/fsm/State.py @@ -4,7 +4,6 @@ __all__ = ['State'] from direct.directnotify.DirectNotifyGlobal import directNotify from direct.showbase.DirectObject import DirectObject -import types class State(DirectObject): diff --git a/direct/src/fsm/StatePush.py b/direct/src/fsm/StatePush.py index 49a6667fbb..10820b175b 100755 --- a/direct/src/fsm/StatePush.py +++ b/direct/src/fsm/StatePush.py @@ -5,7 +5,7 @@ __all__ = ['StateVar', 'FunctionCall', 'EnterExit', 'Pulse', 'EventPulse', 'EventArgument', ] from direct.showbase.DirectObject import DirectObject -import types + class PushesStateChanges: # base class for objects that broadcast state changes to a set of subscriber objects diff --git a/direct/src/gui/DirectButton.py b/direct/src/gui/DirectButton.py index 110b4e5a38..a40dfda94b 100644 --- a/direct/src/gui/DirectButton.py +++ b/direct/src/gui/DirectButton.py @@ -2,7 +2,7 @@ __all__ = ['DirectButton'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectFrame import * diff --git a/direct/src/gui/DirectCheckBox.py b/direct/src/gui/DirectCheckBox.py index cf2a371fec..6091f8bc31 100755 --- a/direct/src/gui/DirectCheckBox.py +++ b/direct/src/gui/DirectCheckBox.py @@ -1,5 +1,5 @@ from direct.gui.DirectGui import * -from pandac.PandaModules import * +from panda3d.core import * class DirectCheckBox(DirectButton): diff --git a/direct/src/gui/DirectCheckButton.py b/direct/src/gui/DirectCheckButton.py index 77244b185f..5212031600 100644 --- a/direct/src/gui/DirectCheckButton.py +++ b/direct/src/gui/DirectCheckButton.py @@ -2,8 +2,7 @@ __all__ = ['DirectCheckButton'] -from pandac.PandaModules import * -import DirectGuiGlobals as DGG +from panda3d.core import * from DirectButton import * from DirectLabel import * diff --git a/direct/src/gui/DirectDialog.py b/direct/src/gui/DirectDialog.py index 44cb182ab0..1aa75332d0 100644 --- a/direct/src/gui/DirectDialog.py +++ b/direct/src/gui/DirectDialog.py @@ -2,7 +2,7 @@ __all__ = ['findDialog', 'cleanupDialog', 'DirectDialog', 'OkDialog', 'OkCancelDialog', 'YesNoDialog', 'YesNoCancelDialog', 'RetryCancelDialog'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectFrame import * from DirectButton import * diff --git a/direct/src/gui/DirectEntry.py b/direct/src/gui/DirectEntry.py index e2b306af06..5fa8920328 100644 --- a/direct/src/gui/DirectEntry.py +++ b/direct/src/gui/DirectEntry.py @@ -2,7 +2,7 @@ __all__ = ['DirectEntry'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectFrame import * from OnscreenText import OnscreenText diff --git a/direct/src/gui/DirectEntryScroll.py b/direct/src/gui/DirectEntryScroll.py index bf829bed63..7341671d6a 100644 --- a/direct/src/gui/DirectEntryScroll.py +++ b/direct/src/gui/DirectEntryScroll.py @@ -1,6 +1,6 @@ __all__ = ['DirectEntryScroll'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectScrolledFrame import * from DirectFrame import * @@ -114,6 +114,4 @@ class DirectEntryScroll(DirectFrame): def resetCanvas(self): self.canvas.setPos(0,0,0) - - - \ No newline at end of file + diff --git a/direct/src/gui/DirectFrame.py b/direct/src/gui/DirectFrame.py index 4603f9356c..ed67b84c25 100644 --- a/direct/src/gui/DirectFrame.py +++ b/direct/src/gui/DirectFrame.py @@ -2,12 +2,12 @@ __all__ = ['DirectFrame'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectGuiBase import * from OnscreenImage import OnscreenImage from OnscreenGeom import OnscreenGeom -import string, types +import types class DirectFrame(DirectGuiWidget): DefDynGroups = ('text', 'geom', 'image') diff --git a/direct/src/gui/DirectGuiBase.py b/direct/src/gui/DirectGuiBase.py index 2d8c8241e7..11af7ec844 100644 --- a/direct/src/gui/DirectGuiBase.py +++ b/direct/src/gui/DirectGuiBase.py @@ -3,7 +3,7 @@ __all__ = ['DirectGuiBase', 'DirectGuiWidget'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from OnscreenText import * from OnscreenGeom import * @@ -11,9 +11,7 @@ from OnscreenImage import * from direct.directtools.DirectUtil import ROUND_TO from direct.showbase import DirectObject from direct.task import Task -from direct.showbase import ShowBase from direct.showbase.PythonUtil import recordCreationStackStr -from pandac.PandaModules import PStatCollector import types guiObjectCollector = PStatCollector("Client::GuiObjects") @@ -1069,8 +1067,8 @@ class DirectGuiWidget(DirectGuiBase, NodePath): def printConfig(self, indent = 0): space = ' ' * indent print space + self.guiId, '-', self.__class__.__name__ - print space + 'Pos: ' + self.getPos().pPrintValues() - print space + 'Scale: ' + self.getScale().pPrintValues() + print space + 'Pos: %s' % tuple(self.getPos()) + print space + 'Scale: %s' % tuple(self.getScale()) # Print out children info for child in self.getChildren(): messenger.send(DGG.PRINT + child.getName(), [indent + 2]) diff --git a/direct/src/gui/DirectGuiGlobals.py b/direct/src/gui/DirectGuiGlobals.py index 167d2a99b4..0602f9cfc0 100644 --- a/direct/src/gui/DirectGuiGlobals.py +++ b/direct/src/gui/DirectGuiGlobals.py @@ -7,7 +7,7 @@ __all__ = [] Global definitions used by Direct Gui Classes and handy constants that can be used during widget construction """ -from pandac.PandaModules import * +from panda3d.core import * defaultFont = None defaultFontFunc = TextNode.getDefaultFont diff --git a/direct/src/gui/DirectGuiTest.py b/direct/src/gui/DirectGuiTest.py index 2b076eed00..46edc3dd09 100644 --- a/direct/src/gui/DirectGuiTest.py +++ b/direct/src/gui/DirectGuiTest.py @@ -4,11 +4,13 @@ __all__ = [] if __name__ == "__main__": - from direct.directbase import DirectStart + from direct.showbase.ShowBase import ShowBase from DirectGui import * #from whrandom import * from random import * + base = ShowBase() + # EXAMPLE CODE # Load a model smiley = loader.loadModel('models/misc/smiley') diff --git a/direct/src/gui/DirectLabel.py b/direct/src/gui/DirectLabel.py index babd6d53c4..1728fdcb13 100644 --- a/direct/src/gui/DirectLabel.py +++ b/direct/src/gui/DirectLabel.py @@ -2,8 +2,7 @@ __all__ = ['DirectLabel'] -from pandac.PandaModules import * -import DirectGuiGlobals as DGG +from panda3d.core import * from DirectFrame import * class DirectLabel(DirectFrame): diff --git a/direct/src/gui/DirectOptionMenu.py b/direct/src/gui/DirectOptionMenu.py index b37436b5c7..bd2e45fffc 100644 --- a/direct/src/gui/DirectOptionMenu.py +++ b/direct/src/gui/DirectOptionMenu.py @@ -4,7 +4,7 @@ __all__ = ['DirectOptionMenu'] import types -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectButton import * from DirectLabel import * diff --git a/direct/src/gui/DirectRadioButton.py b/direct/src/gui/DirectRadioButton.py index c2cb423f0d..775ccf5648 100755 --- a/direct/src/gui/DirectRadioButton.py +++ b/direct/src/gui/DirectRadioButton.py @@ -2,7 +2,7 @@ __all__ = ['DirectRadioButton'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectButton import * from DirectLabel import * diff --git a/direct/src/gui/DirectScrollBar.py b/direct/src/gui/DirectScrollBar.py index f69896568b..a2a6f70ab2 100644 --- a/direct/src/gui/DirectScrollBar.py +++ b/direct/src/gui/DirectScrollBar.py @@ -2,7 +2,7 @@ __all__ = ['DirectScrollBar'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectFrame import * from DirectButton import * diff --git a/direct/src/gui/DirectScrolledFrame.py b/direct/src/gui/DirectScrolledFrame.py index e3efa164c7..325582ef52 100644 --- a/direct/src/gui/DirectScrolledFrame.py +++ b/direct/src/gui/DirectScrolledFrame.py @@ -2,7 +2,7 @@ __all__ = ['DirectScrolledFrame'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectFrame import * from DirectScrollBar import * diff --git a/direct/src/gui/DirectScrolledList.py b/direct/src/gui/DirectScrolledList.py index aa0293ae5e..d2ac37dfef 100644 --- a/direct/src/gui/DirectScrolledList.py +++ b/direct/src/gui/DirectScrolledList.py @@ -2,13 +2,13 @@ __all__ = ['DirectScrolledListItem', 'DirectScrolledList'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from direct.directnotify import DirectNotifyGlobal from direct.task.Task import Task from DirectFrame import * from DirectButton import * -import string, types +import types class DirectScrolledListItem(DirectButton): diff --git a/direct/src/gui/DirectSlider.py b/direct/src/gui/DirectSlider.py index d2066c3b68..40737e6c9f 100644 --- a/direct/src/gui/DirectSlider.py +++ b/direct/src/gui/DirectSlider.py @@ -2,7 +2,7 @@ __all__ = ['DirectSlider'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectFrame import * from DirectButton import * diff --git a/direct/src/gui/DirectWaitBar.py b/direct/src/gui/DirectWaitBar.py index c1e7bee0c9..2fe9567941 100644 --- a/direct/src/gui/DirectWaitBar.py +++ b/direct/src/gui/DirectWaitBar.py @@ -2,7 +2,7 @@ __all__ = ['DirectWaitBar'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from DirectFrame import * import types diff --git a/direct/src/gui/OnscreenGeom.py b/direct/src/gui/OnscreenGeom.py index d9ef571aa6..faf020a2d1 100644 --- a/direct/src/gui/OnscreenGeom.py +++ b/direct/src/gui/OnscreenGeom.py @@ -2,10 +2,9 @@ __all__ = ['OnscreenGeom'] -from pandac.PandaModules import * -import DirectGuiGlobals as DGG +from panda3d.core import * from direct.showbase.DirectObject import DirectObject -import string,types +import types class OnscreenGeom(DirectObject, NodePath): def __init__(self, geom = None, diff --git a/direct/src/gui/OnscreenImage.py b/direct/src/gui/OnscreenImage.py index 50923eec19..7f4579886d 100644 --- a/direct/src/gui/OnscreenImage.py +++ b/direct/src/gui/OnscreenImage.py @@ -2,10 +2,9 @@ __all__ = ['OnscreenImage'] -from pandac.PandaModules import * -import DirectGuiGlobals as DGG +from panda3d.core import * from direct.showbase.DirectObject import DirectObject -import string,types +import types class OnscreenImage(DirectObject, NodePath): def __init__(self, image = None, diff --git a/direct/src/gui/OnscreenText.py b/direct/src/gui/OnscreenText.py index ed212d2643..9e0f2cb18b 100644 --- a/direct/src/gui/OnscreenText.py +++ b/direct/src/gui/OnscreenText.py @@ -2,10 +2,10 @@ __all__ = ['OnscreenText', 'Plain', 'ScreenTitle', 'ScreenPrompt', 'NameConfirm', 'BlackOnWhite'] -from pandac.PandaModules import * +from panda3d.core import * import DirectGuiGlobals as DGG from direct.showbase.DirectObject import DirectObject -import string,types +import types ## These are the styles of text we might commonly see. They set the ## overall appearance of the text according to one of a number of diff --git a/direct/src/interval/ActorInterval.py b/direct/src/interval/ActorInterval.py index 98e82bc605..2e884fcc15 100644 --- a/direct/src/interval/ActorInterval.py +++ b/direct/src/interval/ActorInterval.py @@ -2,7 +2,8 @@ __all__ = ['ActorInterval', 'LerpAnimInterval'] -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import * import Interval import math diff --git a/direct/src/interval/AnimControlInterval.py b/direct/src/interval/AnimControlInterval.py index 3e1d1259d1..bd2acc17ff 100755 --- a/direct/src/interval/AnimControlInterval.py +++ b/direct/src/interval/AnimControlInterval.py @@ -2,7 +2,8 @@ __all__ = ['AnimControlInterval'] -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import * import Interval import math diff --git a/direct/src/interval/FunctionInterval.py b/direct/src/interval/FunctionInterval.py index fd46bad994..815fd8b090 100644 --- a/direct/src/interval/FunctionInterval.py +++ b/direct/src/interval/FunctionInterval.py @@ -2,11 +2,11 @@ __all__ = ['FunctionInterval', 'EventInterval', 'AcceptInterval', 'IgnoreInterval', 'ParentInterval', 'WrtParentInterval', 'PosInterval', 'HprInterval', 'ScaleInterval', 'PosHprInterval', 'HprScaleInterval', 'PosHprScaleInterval', 'Func', 'Wait'] -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.showbase.MessengerGlobal import * from direct.directnotify.DirectNotifyGlobal import directNotify import Interval -import types ############################################################# diff --git a/direct/src/interval/IndirectInterval.py b/direct/src/interval/IndirectInterval.py index 9039064d24..c435dbc76a 100644 --- a/direct/src/interval/IndirectInterval.py +++ b/direct/src/interval/IndirectInterval.py @@ -2,7 +2,8 @@ __all__ = ['IndirectInterval'] -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import * import Interval import LerpBlendHelpers diff --git a/direct/src/interval/Interval.py b/direct/src/interval/Interval.py index 0907c6d6a0..0ce940a261 100644 --- a/direct/src/interval/Interval.py +++ b/direct/src/interval/Interval.py @@ -4,10 +4,9 @@ __all__ = ['Interval'] from direct.directnotify.DirectNotifyGlobal import directNotify from direct.showbase.DirectObject import DirectObject -from pandac.PandaModules import * from direct.task.Task import Task, TaskManager -from direct.showbase import PythonUtil -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * import math class Interval(DirectObject): diff --git a/direct/src/interval/IntervalGlobal.py b/direct/src/interval/IntervalGlobal.py index ecc9abb6ad..d1589d268d 100644 --- a/direct/src/interval/IntervalGlobal.py +++ b/direct/src/interval/IntervalGlobal.py @@ -10,15 +10,17 @@ from FunctionInterval import * from LerpInterval import * from IndirectInterval import * from MopathInterval import * -import pandac.PandaModules -##Some people may have the particle system compiled out -if hasattr( pandac.PandaModules, 'ParticleSystem' ): - from ParticleInterval import * +try: + import panda3d.physics + ##Some people may have the particle system compiled out + if hasattr( panda3d.physics, 'ParticleSystem' ): + from ParticleInterval import * + if __debug__: + from TestInterval import * +except ImportError: + pass from SoundInterval import * from ProjectileInterval import * from MetaInterval import * from IntervalManager import * -if __debug__: - if hasattr( pandac.PandaModules, 'ParticleSystem' ): - from TestInterval import * -from pandac.PandaModules import WaitInterval +from panda3d.direct import WaitInterval diff --git a/direct/src/interval/IntervalManager.py b/direct/src/interval/IntervalManager.py index 95a0c754a9..3fa556f30c 100644 --- a/direct/src/interval/IntervalManager.py +++ b/direct/src/interval/IntervalManager.py @@ -2,12 +2,10 @@ __all__ = ['IntervalManager', 'ivalMgr'] -from pandac.PandaModules import * -from pandac import PandaModules +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import * from direct.showbase import EventManager -import Interval -import types import fnmatch class IntervalManager(CIntervalManager): diff --git a/direct/src/interval/IntervalTest.py b/direct/src/interval/IntervalTest.py index 7a4954a154..4bbfc9db57 100644 --- a/direct/src/interval/IntervalTest.py +++ b/direct/src/interval/IntervalTest.py @@ -4,13 +4,15 @@ __all__ = [] if __name__ == "__main__": - from direct.directbase import DirectStart - from pandac.PandaModules import * + from direct.showbase.ShowBase import ShowBase + from panda3d.core import * from IntervalGlobal import * from direct.actor.Actor import * from direct.directutil import Mopath + base = ShowBase() + boat = loader.loadModel('models/misc/smiley') boat.reparentTo(render) @@ -205,4 +207,4 @@ if __name__ == "__main__": # return mt test(5) - run() + base.run() diff --git a/direct/src/interval/LerpInterval.py b/direct/src/interval/LerpInterval.py index bba040494f..51e9a7e61e 100644 --- a/direct/src/interval/LerpInterval.py +++ b/direct/src/interval/LerpInterval.py @@ -12,7 +12,8 @@ __all__ = [ 'LerpFunctionInterval', 'LerpFunc','LerpFunctionNoStateInterval','LerpFuncNS' ] -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import * import Interval import LerpBlendHelpers diff --git a/direct/src/interval/MetaInterval.py b/direct/src/interval/MetaInterval.py index f521414593..067414aea1 100644 --- a/direct/src/interval/MetaInterval.py +++ b/direct/src/interval/MetaInterval.py @@ -2,14 +2,15 @@ __all__ = ['MetaInterval', 'Sequence', 'Parallel', 'ParallelEndTogether', 'Track'] -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import * from IntervalManager import ivalMgr import Interval -from direct.task.Task import Task, TaskManager +from direct.task.Task import TaskManager import types -if __debug__: - import direct.showbase.PythonUtil as PythonUtil +#if __debug__: +# import direct.showbase.PythonUtil as PythonUtil PREVIOUS_END = CMetaInterval.RSPreviousEnd PREVIOUS_START = CMetaInterval.RSPreviousBegin diff --git a/direct/src/interval/MopathInterval.py b/direct/src/interval/MopathInterval.py index fe16700fc9..4a479896f1 100644 --- a/direct/src/interval/MopathInterval.py +++ b/direct/src/interval/MopathInterval.py @@ -3,7 +3,8 @@ __all__ = ['MopathInterval'] import LerpInterval -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import * # import Mopath diff --git a/direct/src/interval/ParticleInterval.py b/direct/src/interval/ParticleInterval.py index 1456654330..fec166b6ec 100644 --- a/direct/src/interval/ParticleInterval.py +++ b/direct/src/interval/ParticleInterval.py @@ -6,11 +6,11 @@ __all__ = ['ParticleInterval'] Contains the ParticleInterval class """ -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import directNotify from Interval import Interval -from direct.particles import ParticleEffect class ParticleInterval(Interval): """ diff --git a/direct/src/interval/ProjectileInterval.py b/direct/src/interval/ProjectileInterval.py index 7118c36f4d..3372b415af 100755 --- a/direct/src/interval/ProjectileInterval.py +++ b/direct/src/interval/ProjectileInterval.py @@ -2,10 +2,10 @@ __all__ = ['ProjectileInterval'] -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import * from Interval import Interval -from direct.showbase.PythonUtil import lerp from direct.showbase import PythonUtil class ProjectileInterval(Interval): diff --git a/direct/src/interval/ProjectileIntervalTest.py b/direct/src/interval/ProjectileIntervalTest.py index 4a5dc0907a..7e0b080d5a 100755 --- a/direct/src/interval/ProjectileIntervalTest.py +++ b/direct/src/interval/ProjectileIntervalTest.py @@ -2,8 +2,8 @@ __all__ = ['doTest'] -from pandac.PandaModules import * -from direct.directbase.DirectStart import * +from panda3d.core import * +from panda3d.direct import * from IntervalGlobal import * def doTest(): diff --git a/direct/src/interval/SoundInterval.py b/direct/src/interval/SoundInterval.py index fab99973e0..5326f105e6 100644 --- a/direct/src/interval/SoundInterval.py +++ b/direct/src/interval/SoundInterval.py @@ -2,7 +2,8 @@ __all__ = ['SoundInterval'] -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import * import Interval import random diff --git a/direct/src/interval/TestInterval.py b/direct/src/interval/TestInterval.py index 7066bac0d5..b7a56d1698 100755 --- a/direct/src/interval/TestInterval.py +++ b/direct/src/interval/TestInterval.py @@ -6,11 +6,11 @@ __all__ = ['TestInterval'] Contains the ParticleInterval class """ -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.directnotify.DirectNotifyGlobal import directNotify from Interval import Interval -from direct.particles import ParticleEffect class TestInterval(Interval): # Name counter diff --git a/direct/src/motiontrail/MotionTrail.py b/direct/src/motiontrail/MotionTrail.py index ffcdbe5781..531deef003 100644 --- a/direct/src/motiontrail/MotionTrail.py +++ b/direct/src/motiontrail/MotionTrail.py @@ -1,6 +1,7 @@ -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.direct import * from direct.task import Task from direct.showbase.DirectObject import DirectObject diff --git a/direct/src/p3d/AppRunner.py b/direct/src/p3d/AppRunner.py index b9a1f17572..4b331ba272 100644 --- a/direct/src/p3d/AppRunner.py +++ b/direct/src/p3d/AppRunner.py @@ -9,9 +9,10 @@ runp3d.py for a command-line tool to invoke this module. """ +__all__ = ["AppRunner", "dummyAppRunner", "ArgumentError"] + import sys import os -import types import __builtin__ if 'VFSImporter' in sys.modules: @@ -29,7 +30,7 @@ else: from direct.showbase import VFSImporter from direct.showbase.DirectObject import DirectObject -from panda3d.core import VirtualFileSystem, Filename, Multifile, loadPrcFileData, unloadPrcFile, getModelPath, Thread, WindowProperties, ExecutionEnvironment, PandaSystem, Notify, StreamWriter, ConfigVariableString, ConfigPageManager +from panda3d.core import VirtualFileSystem, Filename, Multifile, loadPrcFileData, unloadPrcFile, getModelPath, WindowProperties, ExecutionEnvironment, PandaSystem, Notify, StreamWriter, ConfigVariableString, ConfigPageManager from panda3d.direct import init_app_for_gui from panda3d import core from direct.stdpy import file, glob @@ -43,7 +44,7 @@ from direct.p3d.InstalledHostData import InstalledHostData from direct.p3d.InstalledPackageData import InstalledPackageData # These imports are read by the C++ wrapper in p3dPythonRun.cxx. -from direct.p3d.JavaScript import UndefinedObject, Undefined, ConcreteStruct, BrowserObject +from direct.p3d.JavaScript import Undefined, ConcreteStruct class ArgumentError(AttributeError): pass diff --git a/direct/src/p3d/DWBPackageInstaller.py b/direct/src/p3d/DWBPackageInstaller.py index 43ee9fb71d..4d32e4d503 100644 --- a/direct/src/p3d/DWBPackageInstaller.py +++ b/direct/src/p3d/DWBPackageInstaller.py @@ -1,3 +1,5 @@ +__all__ = ["DWBPackageInstaller"] + from direct.p3d.PackageInstaller import PackageInstaller from direct.gui.DirectWaitBar import DirectWaitBar from direct.gui import DirectGuiGlobals as DGG diff --git a/direct/src/p3d/DeploymentTools.py b/direct/src/p3d/DeploymentTools.py index 10677cd5d4..5f316e35c7 100644 --- a/direct/src/p3d/DeploymentTools.py +++ b/direct/src/p3d/DeploymentTools.py @@ -4,7 +4,7 @@ to build for as many platforms as possible. """ __all__ = ["Standalone", "Installer"] -import os, sys, subprocess, tarfile, shutil, time, zipfile, glob, socket, getpass, struct +import os, sys, subprocess, tarfile, shutil, time, zipfile, socket, getpass, struct from cStringIO import StringIO from direct.directnotify.DirectNotifyGlobal import * from direct.showbase.AppRunnerGlobal import appRunner diff --git a/direct/src/p3d/FileSpec.py b/direct/src/p3d/FileSpec.py index 291149ad77..f6ca6b93d0 100644 --- a/direct/src/p3d/FileSpec.py +++ b/direct/src/p3d/FileSpec.py @@ -1,3 +1,5 @@ +__all__ = ["FileSpec"] + import os import time from panda3d.core import Filename, HashVal, VirtualFileSystem diff --git a/direct/src/p3d/HostInfo.py b/direct/src/p3d/HostInfo.py index f22e47cf82..82fa5001cd 100644 --- a/direct/src/p3d/HostInfo.py +++ b/direct/src/p3d/HostInfo.py @@ -1,3 +1,5 @@ +__all__ = ["HostInfo"] + from panda3d.core import HashVal, Filename, PandaSystem, DocumentSpec, Ramfile from panda3d.core import HTTPChannel, ConfigVariableInt from panda3d import core diff --git a/direct/src/p3d/InstalledHostData.py b/direct/src/p3d/InstalledHostData.py index e8c9e5d5d2..d98abb6d18 100644 --- a/direct/src/p3d/InstalledHostData.py +++ b/direct/src/p3d/InstalledHostData.py @@ -1,3 +1,5 @@ +__all__ = ["InstalledHostData"] + from panda3d.core import URLSpec class InstalledHostData: diff --git a/direct/src/p3d/InstalledPackageData.py b/direct/src/p3d/InstalledPackageData.py index 6d0675ac36..c6ebed3ec1 100644 --- a/direct/src/p3d/InstalledPackageData.py +++ b/direct/src/p3d/InstalledPackageData.py @@ -1,3 +1,5 @@ +__all__ = ["InstalledPackageData"] + class InstalledPackageData: """ A list of instances of this class is maintained by InstalledHostData (which is in turn returned by diff --git a/direct/src/p3d/JavaScript.py b/direct/src/p3d/JavaScript.py index 6c08d0ed29..f10ad28d1d 100644 --- a/direct/src/p3d/JavaScript.py +++ b/direct/src/p3d/JavaScript.py @@ -2,6 +2,8 @@ useful when writing code that integrates with JavaScript, especially code that runs in a browser via the web plugin. """ +__all__ = ["UndefinedObject", "Undefined", "ConcreteStruct", "BrowserObject", "MethodWrapper"] + import types class UndefinedObject: diff --git a/direct/src/p3d/PackageInfo.py b/direct/src/p3d/PackageInfo.py index 3e1767b91f..cceb2164c6 100644 --- a/direct/src/p3d/PackageInfo.py +++ b/direct/src/p3d/PackageInfo.py @@ -1,4 +1,6 @@ -from panda3d.core import Filename, URLSpec, DocumentSpec, Ramfile, Multifile, Decompressor, EUOk, EUSuccess, VirtualFileSystem, Thread, getModelPath, ExecutionEnvironment, PStatCollector, TiXmlDocument, TiXmlDeclaration, TiXmlElement +__all__ = ["PackageInfo"] + +from panda3d.core import Filename, DocumentSpec, Multifile, Decompressor, EUOk, EUSuccess, VirtualFileSystem, Thread, getModelPath, ExecutionEnvironment, PStatCollector, TiXmlDocument, TiXmlDeclaration, TiXmlElement import panda3d.core as core from direct.p3d.FileSpec import FileSpec from direct.p3d.ScanDirectoryNode import ScanDirectoryNode diff --git a/direct/src/p3d/PackageInstaller.py b/direct/src/p3d/PackageInstaller.py index 3f920b8bd3..33527ef94e 100644 --- a/direct/src/p3d/PackageInstaller.py +++ b/direct/src/p3d/PackageInstaller.py @@ -1,3 +1,5 @@ +__all__ = ["PackageInstaller"] + from direct.showbase.DirectObject import DirectObject from direct.stdpy.threading import Lock, RLock from direct.showbase.MessengerGlobal import messenger diff --git a/direct/src/p3d/PackageMerger.py b/direct/src/p3d/PackageMerger.py index e5b90705e3..a00a3f7d35 100644 --- a/direct/src/p3d/PackageMerger.py +++ b/direct/src/p3d/PackageMerger.py @@ -1,8 +1,9 @@ +__all__ = ["PackageMerger", "PackageMergerError"] + from direct.p3d.FileSpec import FileSpec from direct.p3d.SeqValue import SeqValue from direct.directnotify.DirectNotifyGlobal import * from panda3d.core import * -import copy import shutil import os diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index 9614e96d59..5386bb8d71 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -3,17 +3,17 @@ within a Panda3D Multifile, which can be easily be downloaded and/or patched onto a client machine, for the purpose of running a large application. """ +__all__ = ["Packager", "PackagerError", "OutsideOfPackageError", "ArgumentError"] + # Important to import panda3d first, to avoid naming conflicts with # Python's "string" and "Loader" names that are imported later. from panda3d.core import * import sys import os import glob -import marshal import string import types import getpass -import platform import struct import subprocess from direct.p3d.FileSpec import FileSpec diff --git a/direct/src/p3d/PatchMaker.py b/direct/src/p3d/PatchMaker.py index e8fbf80274..7055f5eb3e 100644 --- a/direct/src/p3d/PatchMaker.py +++ b/direct/src/p3d/PatchMaker.py @@ -1,3 +1,5 @@ +__all__ = ["PatchMaker"] + from direct.p3d.FileSpec import FileSpec from direct.p3d.SeqValue import SeqValue from panda3d.core import * diff --git a/direct/src/p3d/ScanDirectoryNode.py b/direct/src/p3d/ScanDirectoryNode.py index 94f323551e..429b8f0fd2 100644 --- a/direct/src/p3d/ScanDirectoryNode.py +++ b/direct/src/p3d/ScanDirectoryNode.py @@ -1,3 +1,5 @@ +__all__ = ["ScanDirectoryNode"] + from panda3d.core import VirtualFileSystem, VirtualFileMountSystem, Filename, TiXmlDocument vfs = VirtualFileSystem.getGlobalPtr() diff --git a/direct/src/p3d/SeqValue.py b/direct/src/p3d/SeqValue.py index 493098f4e6..6ae527578d 100644 --- a/direct/src/p3d/SeqValue.py +++ b/direct/src/p3d/SeqValue.py @@ -1,3 +1,5 @@ +__all__ = ["SeqValue"] + import types class SeqValue: diff --git a/direct/src/particles/ForceGroup.py b/direct/src/particles/ForceGroup.py index 8c04052232..9cd451f5ec 100644 --- a/direct/src/particles/ForceGroup.py +++ b/direct/src/particles/ForceGroup.py @@ -1,4 +1,5 @@ -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.physics import * from direct.showbase.DirectObject import DirectObject from direct.showbase.PhysicsManagerGlobal import * diff --git a/direct/src/particles/ParticleEffect.py b/direct/src/particles/ParticleEffect.py index 914630f19c..bfd4e0c7c9 100644 --- a/direct/src/particles/ParticleEffect.py +++ b/direct/src/particles/ParticleEffect.py @@ -1,7 +1,11 @@ -from pandac.PandaModules import * -import Particles -import ForceGroup +from panda3d.core import * + +# Leave these imports in, they may be used by ptf files. +from panda3d.physics import * +from . import Particles +from . import ForceGroup + from direct.directnotify import DirectNotifyGlobal class ParticleEffect(NodePath): diff --git a/direct/src/particles/ParticleFloorTest.py b/direct/src/particles/ParticleFloorTest.py index 39126fd080..8bb021eed0 100755 --- a/direct/src/particles/ParticleFloorTest.py +++ b/direct/src/particles/ParticleFloorTest.py @@ -1,5 +1,6 @@ -from pandac.PandaModules import * +from panda3d.core import NodePath +from panda3d.physics import LinearVectorForce from direct.particles import ParticleEffect from direct.particles import Particles from direct.particles import ForceGroup @@ -48,8 +49,8 @@ class ParticleFloorTest(NodePath): if __name__ == "__main__": from direct.directbase.TestStart import * - pt=ParticleFloorTest() + pt = ParticleFloorTest() pt.reparentTo(render) pt.start() - camera.setY(-10.0) - run() + base.camera.setY(-10.0) + base.run() diff --git a/direct/src/particles/Particles.py b/direct/src/particles/Particles.py index 826b004b80..ee82ffc81b 100644 --- a/direct/src/particles/Particles.py +++ b/direct/src/particles/Particles.py @@ -1,7 +1,7 @@ -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.physics import PhysicalNode from panda3d.physics import ParticleSystem -from panda3d.physics import BaseParticleFactory from panda3d.physics import PointParticleFactory from panda3d.physics import ZSpinParticleFactory #from panda3d.physics import OrientedParticleFactory @@ -25,8 +25,6 @@ from panda3d.physics import TangentRingEmitter import SpriteParticleRendererExt -import string -import os from direct.directnotify.DirectNotifyGlobal import directNotify import sys diff --git a/direct/src/showbase/Audio3DManager.py b/direct/src/showbase/Audio3DManager.py index 84c572d815..28dffc4bd7 100644 --- a/direct/src/showbase/Audio3DManager.py +++ b/direct/src/showbase/Audio3DManager.py @@ -2,7 +2,7 @@ __all__ = ['Audio3DManager'] -from pandac.PandaModules import Vec3, VBase3 +from panda3d.core import Vec3, VBase3 from direct.task import Task # class Audio3DManager: diff --git a/direct/src/showbase/ContainerLeakDetector.py b/direct/src/showbase/ContainerLeakDetector.py index bc85db1fda..7180ffe543 100755 --- a/direct/src/showbase/ContainerLeakDetector.py +++ b/direct/src/showbase/ContainerLeakDetector.py @@ -1,6 +1,5 @@ -from pandac.PandaModules import PStatCollector from direct.directnotify.DirectNotifyGlobal import directNotify -from direct.showbase.PythonUtil import Queue, invertDictLossless, makeFlywheelGen +from direct.showbase.PythonUtil import makeFlywheelGen from direct.showbase.PythonUtil import itype, serialNum, safeRepr, fastRepr from direct.showbase.Job import Job import types, weakref, random, __builtin__ diff --git a/direct/src/showbase/ContainerReport.py b/direct/src/showbase/ContainerReport.py index d12f42285f..fb5b1a4de1 100755 --- a/direct/src/showbase/ContainerReport.py +++ b/direct/src/showbase/ContainerReport.py @@ -1,6 +1,6 @@ from direct.directnotify.DirectNotifyGlobal import directNotify -from direct.showbase.PythonUtil import Queue, fastRepr, invertDictLossless -from direct.showbase.PythonUtil import itype, safeRepr +from direct.showbase.PythonUtil import Queue, invertDictLossless +from direct.showbase.PythonUtil import safeRepr from direct.showbase.Job import Job import types diff --git a/direct/src/showbase/DistancePhasedNode.py b/direct/src/showbase/DistancePhasedNode.py index 3f8be4306d..02b3fd7a24 100755 --- a/direct/src/showbase/DistancePhasedNode.py +++ b/direct/src/showbase/DistancePhasedNode.py @@ -1,6 +1,5 @@ from direct.showbase.DirectObject import DirectObject -from direct.directnotify import DirectNotifyGlobal -from pandac.PandaModules import * +from panda3d.core import * from PhasedObject import PhasedObject class DistancePhasedNode(PhasedObject, DirectObject, NodePath): diff --git a/direct/src/showbase/ExcelHandler.py b/direct/src/showbase/ExcelHandler.py index d1c6a89d92..01f932b1de 100755 --- a/direct/src/showbase/ExcelHandler.py +++ b/direct/src/showbase/ExcelHandler.py @@ -13,7 +13,6 @@ print e.tables """ from xml.sax import saxutils -from xml.sax import parse class ExcelHandler(saxutils.DefaultHandler): def __init__(self): diff --git a/direct/src/showbase/Finder.py b/direct/src/showbase/Finder.py index f209ef9b14..4c81b64b99 100644 --- a/direct/src/showbase/Finder.py +++ b/direct/src/showbase/Finder.py @@ -2,7 +2,6 @@ __all__ = ['findClass', 'rebindClass', 'copyFuncs', 'replaceMessengerFunc', 'replaceTaskMgrFunc', 'replaceStateFunc', 'replaceCRFunc', 'replaceAIRFunc', 'replaceIvalFunc'] -import time import types import os import sys diff --git a/direct/src/showbase/GarbageReport.py b/direct/src/showbase/GarbageReport.py index 6d6eacea0d..c04fb42367 100755 --- a/direct/src/showbase/GarbageReport.py +++ b/direct/src/showbase/GarbageReport.py @@ -3,7 +3,7 @@ __all__ = ['FakeObject', '_createGarbage', 'GarbageReport', 'GarbageLogger'] from direct.directnotify.DirectNotifyGlobal import directNotify -from direct.showbase.PythonUtil import safeRepr, fastRepr, printListEnumGen, printNumberedTypesGen +from direct.showbase.PythonUtil import fastRepr from direct.showbase.PythonUtil import AlphabetCounter from direct.showbase.Job import Job import gc diff --git a/direct/src/showbase/LazySort.py b/direct/src/showbase/LazySort.py index 90f33559a1..85ac166c00 100755 --- a/direct/src/showbase/LazySort.py +++ b/direct/src/showbase/LazySort.py @@ -109,7 +109,6 @@ if __debug__: print x def test(): - import random from itertools import islice control = sorted(data, key = lambda x: x[0]) diff --git a/direct/src/showbase/Messenger.py b/direct/src/showbase/Messenger.py index 3d901d219d..aba83d7d3a 100644 --- a/direct/src/showbase/Messenger.py +++ b/direct/src/showbase/Messenger.py @@ -7,7 +7,6 @@ from PythonUtil import * from direct.directnotify import DirectNotifyGlobal import types -from panda3d.core import ConfigVariableBool, Thread, Mutex from direct.stdpy.threading import Lock class Messenger: diff --git a/direct/src/showbase/ObjectPool.py b/direct/src/showbase/ObjectPool.py index acfd99696c..80109226ce 100755 --- a/direct/src/showbase/ObjectPool.py +++ b/direct/src/showbase/ObjectPool.py @@ -6,7 +6,6 @@ from direct.directnotify.DirectNotifyGlobal import directNotify from direct.showbase.PythonUtil import invertDictLossless, makeList, safeRepr from direct.showbase.PythonUtil import getNumberedTypedString, getNumberedTypedSortedString from direct.showbase.PythonUtil import getNumberedTypedSortedStringWithReferrersGen -import types import gc class Diff: diff --git a/direct/src/showbase/OnScreenDebug.py b/direct/src/showbase/OnScreenDebug.py index e193996cea..addd59f3ad 100755 --- a/direct/src/showbase/OnScreenDebug.py +++ b/direct/src/showbase/OnScreenDebug.py @@ -2,9 +2,7 @@ __all__ = ['OnScreenDebug'] - - -from pandac.PandaModules import * +from panda3d.core import * import types from direct.gui import OnscreenText diff --git a/direct/src/showbase/ProfileSession.py b/direct/src/showbase/ProfileSession.py index c2cd4f7b67..828272be8c 100755 --- a/direct/src/showbase/ProfileSession.py +++ b/direct/src/showbase/ProfileSession.py @@ -2,13 +2,10 @@ from panda3d.core import TrueClock from direct.directnotify.DirectNotifyGlobal import directNotify from direct.showbase.PythonUtil import ( StdoutCapture, _installProfileCustomFuncs,_removeProfileCustomFuncs, - _profileWithoutGarbageLeak, _getProfileResultFileInfo, _setProfileResultsFileInfo, - _clearProfileResultFileInfo, ) + _getProfileResultFileInfo, _setProfileResultsFileInfo) import __builtin__ import profile import pstats -from StringIO import StringIO -import marshal class PercentStats(pstats.Stats): # prints more useful output when sampled durations are shorter than a millisecond diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index 8d20e1683d..8b8d59394d 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -35,7 +35,6 @@ __all__ = ['indent', import types import string -import re import math import operator import inspect @@ -52,7 +51,6 @@ import marshal __report_indent = 3 -from direct.directutil import Verify from panda3d.core import ConfigVariableBool ScalarTypes = (types.FloatType, types.IntType, types.LongType) diff --git a/direct/src/showbase/RandomNumGen.py b/direct/src/showbase/RandomNumGen.py index 685fffa8fa..0b6df19d2b 100644 --- a/direct/src/showbase/RandomNumGen.py +++ b/direct/src/showbase/RandomNumGen.py @@ -3,7 +3,7 @@ __all__ = ['randHash', 'RandomNumGen'] from direct.directnotify import DirectNotifyGlobal -from pandac.PandaModules import Mersenne +from panda3d.core import Mersenne def randHash(num): """ this returns a random 16-bit integer, given a seed integer. diff --git a/direct/src/showbase/SfxPlayer.py b/direct/src/showbase/SfxPlayer.py index 9579ada442..496481e6a4 100644 --- a/direct/src/showbase/SfxPlayer.py +++ b/direct/src/showbase/SfxPlayer.py @@ -2,9 +2,8 @@ __all__ = ['SfxPlayer'] - import math -from pandac.PandaModules import * +from panda3d.core import * class SfxPlayer: """ diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 9ab3184d6a..057b049fd9 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -24,18 +24,14 @@ from PythonUtil import * from direct.showbase import PythonUtil #from direct.interval.IntervalManager import ivalMgr from direct.interval import IntervalManager -from InputStateGlobal import inputState from direct.showbase.BufferViewer import BufferViewer from direct.task import Task from direct.directutil import Verify from direct.showbase import GarbageReport -import math,sys,os +import sys import Loader import time -import gc import atexit -from direct.fsm import ClassicFSM -from direct.fsm import State from direct.showbase import ExceptionVarDump import DirectObject import SfxPlayer @@ -367,7 +363,7 @@ class ShowBase(DirectObject.DirectObject): builtins.cpMgr = ConfigPageManager.getGlobalPtr() builtins.cvMgr = ConfigVariableManager.getGlobalPtr() builtins.pandaSystem = PandaSystem.getGlobalPtr() - builtins.wantUberdog = base.config.GetBool('want-uberdog', 1) + builtins.wantUberdog = self.config.GetBool('want-uberdog', 1) if __debug__: builtins.deltaProfiler = DeltaProfiler.DeltaProfiler("ShowBase") builtins.onScreenDebug = OnScreenDebug.OnScreenDebug() @@ -419,7 +415,7 @@ class ShowBase(DirectObject.DirectObject): # adds a sleep right after the main render in igloop # tends to even out the frame rate and keeps it from going # to zero in the out of focus windows - if base.config.GetBool('multi-sleep', 0): + if self.config.GetBool('multi-sleep', 0): self.multiClientSleep = 1 else: self.multiClientSleep = 0 @@ -464,8 +460,8 @@ class ShowBase(DirectObject.DirectObject): profile.Profile.bias = float(self.config.GetString("profile-bias","0")) def f8(x): - return ("%"+"8.%df"%base.config.GetInt("profile-decimals",3)) % x - pstats.f8=f8 + return ("%" + "8.%df" % self.config.GetInt("profile-decimals", 3)) % x + pstats.f8 = f8 # temp; see ToonBase.py def getExitErrorCode(self): @@ -807,7 +803,7 @@ class ShowBase(DirectObject.DirectObject): # Set up a 3-d camera for the window by default. if keepCamera: self.makeCamera(win, scene = scene, aspectRatio = aspectRatio, - stereo = stereo, useCamera = base.cam) + stereo = stereo, useCamera = self.cam) elif makeCamera: self.makeCamera(win, scene = scene, aspectRatio = aspectRatio, stereo = stereo) @@ -832,10 +828,10 @@ class ShowBase(DirectObject.DirectObject): for i in range(numRegions): dr = win.getDisplayRegion(i) # [gjeon] remove drc in base.direct.drList - if base.direct is not None: - for drc in base.direct.drList: + if self.direct is not None: + for drc in self.direct.drList: if drc.cam == dr.getCamera(): - base.direct.drList.displayRegionList.remove(drc) + self.direct.drList.displayRegionList.remove(drc) break cam = NodePath(dr.getCamera()) @@ -888,7 +884,7 @@ class ShowBase(DirectObject.DirectObject): if not self.winList: # Give the window(s) a chance to actually close before we # continue. - base.graphicsEngine.renderFrame() + self.graphicsEngine.renderFrame() def openDefaultWindow(self, *args, **kw): # Creates the main window for the first time, without being @@ -2121,7 +2117,7 @@ class ShowBase(DirectObject.DirectObject): """ if self.__deadInputs: self.eventMgr.doEvents() - self.dgTrav.traverse(base.dataRootNode) + self.dgTrav.traverse(self.dataRootNode) self.eventMgr.eventQueue.clear() self.taskMgr.add(self.__dataLoop, 'dataLoop', sort = -50) self.__deadInputs = 0 @@ -2182,15 +2178,15 @@ class ShowBase(DirectObject.DirectObject): # Clean up the old mode. self.showVertices.node().setActive(0) dr = self.showVertices.node().getDisplayRegion(0) - base.win.removeDisplayRegion(dr) + self.win.removeDisplayRegion(dr) self.showVertices.removeNode() self.showVertices = None return - dr = base.win.makeDisplayRegion() + dr = self.win.makeDisplayRegion() dr.setSort(1000) cam = Camera('showVertices') - cam.setLens(base.camLens) + cam.setLens(self.camLens) # Set up a funny state to render only vertices. override = 100000 @@ -2381,7 +2377,7 @@ class ShowBase(DirectObject.DirectObject): # Tell the camera to cull from here instead of its own # origin. - for c in base.camList: + for c in self.camList: c.node().setCullCenter(self.oobeCullFrustum) if cam.node().isOfType(Camera): cam.node().setCullCenter(self.oobeCullFrustum) @@ -2390,7 +2386,7 @@ class ShowBase(DirectObject.DirectObject): else: # Disable OOBE culling. - for c in base.camList: + for c in self.camList: c.node().setCullCenter(NodePath()) if cam.node().isOfType(Camera): cam.node().setCullCenter(self.oobeCullFrustum) @@ -2487,16 +2483,16 @@ class ShowBase(DirectObject.DirectObject): """ if source == None: - source = base.win + source = self.win if camera == None: if hasattr(source, "getCamera"): camera = source.getCamera() if camera == None: - camera = base.camera + camera = self.camera if sourceLens == None: - sourceLens = base.camLens + sourceLens = self.camLens if hasattr(source, "getWindow"): source = source.getWindow() @@ -2513,15 +2509,15 @@ class ShowBase(DirectObject.DirectObject): # Now render a frame to fill up the texture. rig.reparentTo(camera) - base.graphicsEngine.openWindows() - base.graphicsEngine.renderFrame() + self.graphicsEngine.openWindows() + self.graphicsEngine.renderFrame() tex = buffer.getTexture() saved = self.screenshot(namePrefix = namePrefix, defaultFilename = defaultFilename, source = tex) - base.graphicsEngine.removeWindow(buffer) + self.graphicsEngine.removeWindow(buffer) rig.removeNode() return saved @@ -2547,16 +2543,16 @@ class ShowBase(DirectObject.DirectObject): there is a problem. """ if source == None: - source = base.win + source = self.win if camera == None: if hasattr(source, "getCamera"): camera = source.getCamera() if camera == None: - camera = base.camera + camera = self.camera if sourceLens == None: - sourceLens = base.camLens + sourceLens = self.camLens if hasattr(source, "getWindow"): source = source.getWindow() @@ -2571,7 +2567,7 @@ class ShowBase(DirectObject.DirectObject): rig = NodePath(namePrefix) buffer = toSphere.makeCubeMap(namePrefix, size, rig, cameraMask, 0) if buffer == None: - base.graphicsEngine.removeWindow(toSphere) + self.graphicsEngine.removeWindow(toSphere) raise StandardError, "Could not make cube map." # Set the near and far planes from the default lens. @@ -2600,18 +2596,18 @@ class ShowBase(DirectObject.DirectObject): # Now render a frame. This will render out the cube map and # then apply it to the the card in the toSphere buffer. rig.reparentTo(camera) - base.graphicsEngine.openWindows() - base.graphicsEngine.renderFrame() + self.graphicsEngine.openWindows() + self.graphicsEngine.renderFrame() # One more frame for luck. - base.graphicsEngine.renderFrame() + self.graphicsEngine.renderFrame() saved = self.screenshot(namePrefix = namePrefix, defaultFilename = defaultFilename, source = toSphere.getTexture()) - base.graphicsEngine.removeWindow(buffer) - base.graphicsEngine.removeWindow(toSphere) + self.graphicsEngine.removeWindow(buffer) + self.graphicsEngine.removeWindow(toSphere) rig.removeNode() return saved @@ -2832,11 +2828,11 @@ class ShowBase(DirectObject.DirectObject): def wxLoop(task): # First we need to ensure that the OS message queue is # processed. - base.wxApp.Yield() + self.wxApp.Yield() # Now do all the wxPython events waiting on this frame. - while base.wxApp.Pending(): - base.wxApp.Dispatch() + while self.wxApp.Pending(): + self.wxApp.Dispatch() return task.again @@ -2943,8 +2939,10 @@ class ShowBase(DirectObject.DirectObject): self.startWx(fWantWx) self.wantDirect = fWantDirect if self.wantDirect: - from direct.directtools import DirectSession - base.direct.enable() + from direct.directtools.DirectSession import DirectSession + self.direct = DirectSession() + self.direct.enable() + builtins.direct = self.direct else: builtins.direct = self.direct = None diff --git a/direct/src/showbase/Transitions.py b/direct/src/showbase/Transitions.py index ca4919a48f..86f5ee70fd 100644 --- a/direct/src/showbase/Transitions.py +++ b/direct/src/showbase/Transitions.py @@ -2,10 +2,8 @@ __all__ = ['Transitions'] - -from pandac.PandaModules import * +from panda3d.core import * from direct.gui.DirectGui import * -from direct.task import Task from direct.interval.LerpInterval import LerpColorScaleInterval, LerpColorInterval, LerpScaleInterval, LerpPosInterval from direct.interval.MetaInterval import Sequence, Parallel from direct.interval.FunctionInterval import Func diff --git a/direct/src/showbase/pandaSqueezeTool.py b/direct/src/showbase/pandaSqueezeTool.py index 0899689926..fd87135930 100755 --- a/direct/src/showbase/pandaSqueezeTool.py +++ b/direct/src/showbase/pandaSqueezeTool.py @@ -52,7 +52,7 @@ __all__ = ['usage', 'Squeezer', 'Loader', 'boot', 'open', 'explode', 'getloader' VERSION = "1.6/98-05-04" MAGIC = "[PANDASQUEEZE]" -import base64, imp, marshal, os, string, sys, md5 +import base64, imp, marshal, os, string, sys # -------------------------------------------------------------------- # usage @@ -246,7 +246,7 @@ def getloader(data, package): # # parse options -import getopt, glob, sys +import sys import zlib embed = 0 @@ -340,23 +340,23 @@ exec "import %(start)s" #%(localMagic)s %(archiveid)s import ihooks, zlib, marshal, os, sys -import pandac - def searchPath(filename): - # Look along pandac.__path__ for the indicated filename. Returns + # Look along panda3d.__path__ for the indicated filename. Returns # the located pathname, or None if the filename is not found. - for dir in pandac.__path__: + import panda3d + + for dir in panda3d.__path__: pathname = os.path.join(dir, filename) if os.path.exists(pathname): return pathname return None -# Look for %(archiveBase)s along pandac.__path__. +# Look for %(archiveBase)s along panda3d.__path__. archiveName = "%(archiveBase)s" archivePath = searchPath(archiveName) if archivePath == None: - raise ImportError, "Could not locate pandac.%%s." %% (archiveName) + raise ImportError, "Could not locate panda3d.%%s." %% (archiveName) f=open(archivePath,"rb") exec marshal.loads(%(zbegin)sf.read(%(loaderlen)d)%(zend)s) diff --git a/direct/src/showutil/BuildGeometry.py b/direct/src/showutil/BuildGeometry.py index 5dfec621e2..7a7ff73b49 100644 --- a/direct/src/showutil/BuildGeometry.py +++ b/direct/src/showutil/BuildGeometry.py @@ -1,8 +1,5 @@ -from direct.distributed import DistributedObject -from direct.directnotify import DirectNotifyGlobal -from pandac.PandaModules import * +from panda3d.core import * from math import * -import math GEO_ID = 0 @@ -385,4 +382,4 @@ def addArrowGeom(rootNode, sizeX, sizeY, color = Vec4(1.0, 1.0, 1.0, 1.0), layer GEO_ID += 1 NodePathGeom = rootNode.attachNewNode(GN) geo = addArrow(GN, sizeX, sizeY, color, layer) - return NodePathGeom, GN, geo \ No newline at end of file + return NodePathGeom, GN, geo diff --git a/direct/src/showutil/Effects.py b/direct/src/showutil/Effects.py index f2847d188d..19f9b40515 100644 --- a/direct/src/showutil/Effects.py +++ b/direct/src/showutil/Effects.py @@ -1,6 +1,6 @@ """ Showutil Effects module: contains code for useful showcode effects. """ -from pandac.PandaModules import * +from panda3d.core import * from direct.interval.IntervalGlobal import * # bounce types diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index 28c622a9be..df845b0c26 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -16,7 +16,6 @@ try: except ImportError: p3extend_frozen = None -import direct from panda3d.core import * from pandac.extension_native_helpers import dll_suffix, dll_ext diff --git a/direct/src/showutil/Rope.py b/direct/src/showutil/Rope.py index 9f4a3b1c90..5bbda785ed 100644 --- a/direct/src/showutil/Rope.py +++ b/direct/src/showutil/Rope.py @@ -1,4 +1,4 @@ -from pandac.PandaModules import * +from panda3d.core import * import types class Rope(NodePath): diff --git a/direct/src/showutil/TexMemWatcher.py b/direct/src/showutil/TexMemWatcher.py index 5368b49e2e..5de8ecb138 100644 --- a/direct/src/showutil/TexMemWatcher.py +++ b/direct/src/showutil/TexMemWatcher.py @@ -1,4 +1,4 @@ -from pandac.PandaModules import * +from panda3d.core import * from direct.showbase.DirectObject import DirectObject import math import copy diff --git a/direct/src/showutil/TexViewer.py b/direct/src/showutil/TexViewer.py index c645ca6403..7d325afdfc 100644 --- a/direct/src/showutil/TexViewer.py +++ b/direct/src/showutil/TexViewer.py @@ -1,4 +1,4 @@ -from pandac.PandaModules import * +from panda3d.core import * from direct.showbase.DirectObject import DirectObject class TexViewer(DirectObject): diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index 54458f0d2c..5374c135d2 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -11,9 +11,7 @@ from direct.showbase import ExceptionVarDump from direct.showbase.PythonUtil import * from direct.showbase.MessengerGlobal import messenger import types -import time import random -import string try: import signal diff --git a/direct/src/task/Timer.py b/direct/src/task/Timer.py index ddb188a24a..7474deb652 100644 --- a/direct/src/task/Timer.py +++ b/direct/src/task/Timer.py @@ -2,7 +2,6 @@ __all__ = ['Timer'] -from pandac.PandaModules import * import Task class Timer: diff --git a/direct/src/tkpanels/AnimPanel.py b/direct/src/tkpanels/AnimPanel.py index adb7a0f89b..e68f52fced 100644 --- a/direct/src/tkpanels/AnimPanel.py +++ b/direct/src/tkpanels/AnimPanel.py @@ -11,7 +11,7 @@ from direct.tkwidgets.AppShell import * from direct.showbase.TkGlobal import * from tkSimpleDialog import askfloat from Tkinter import * -import Pmw, string, math, types +import Pmw, string, types from direct.task import Task FRAMES = 0 diff --git a/direct/src/tkpanels/DirectSessionPanel.py b/direct/src/tkpanels/DirectSessionPanel.py index e10c0d91bb..a197cd385f 100644 --- a/direct/src/tkpanels/DirectSessionPanel.py +++ b/direct/src/tkpanels/DirectSessionPanel.py @@ -6,7 +6,7 @@ __all__ = ['DirectSessionPanel'] from direct.showbase.TkGlobal import * from direct.tkwidgets.AppShell import * from Tkinter import * -from pandac.PandaModules import * +from panda3d.core import * import Pmw, string from direct.tkwidgets import Dial from direct.tkwidgets import Floater @@ -724,7 +724,7 @@ class DirectSessionPanel(AppShell): dictName = name else: # Generate a unique name for the dict - dictName = name + '-' + repr(nodePath.id()) + dictName = name + '-' + repr(hash(nodePath)) if dictName not in dict: # Update combo box to include new item names.append(dictName) diff --git a/direct/src/tkpanels/Inspector.py b/direct/src/tkpanels/Inspector.py index ed0e3989cd..2ffa1a5249 100644 --- a/direct/src/tkpanels/Inspector.py +++ b/direct/src/tkpanels/Inspector.py @@ -7,7 +7,6 @@ so that I can just type: inspect(anObject) any time.""" __all__ = ['inspect', 'inspectorFor', 'Inspector', 'ModuleInspector', 'ClassInspector', 'InstanceInspector', 'FunctionInspector', 'InstanceMethodInspector', 'CodeInspector', 'ComplexInspector', 'DictionaryInspector', 'SequenceInspector', 'SliceInspector', 'InspectorWindow'] -import string from direct.showbase.TkGlobal import * from Tkinter import * import Pmw @@ -23,11 +22,11 @@ def inspect(anObject): ### private def inspectorFor(anObject): - typeName = string.capitalize(type(anObject).__name__) + 'Type' + typeName = type(anObject).__name__.capitalize() + 'Type' if typeName in _InspectorMap: inspectorName = _InspectorMap[typeName] else: - print "Can't find an inspector for " + typeName + print("Can't find an inspector for " + typeName) inspectorName = 'Inspector' inspector = globals()[inspectorName](anObject) return inspector @@ -96,7 +95,7 @@ class Inspector: def title(self): "Subclasses may override." - return string.capitalize(self.objectType().__name__) + return self.objectType().__name__.capitalize() def getLastPartNumber(self): return self.lastPartNumber @@ -406,14 +405,14 @@ class InspectorWindow: return self.topInspector().inspectorFor(part) def popupMenu(self, event): - print event + print(event) partNumber = self.selectedIndex() - print partNumber + print(partNumber) if partNumber == None: return part = self.topInspector().partNumber(partNumber) - print part - from pandac.PandaModules import NodePath + print(part) + from panda3d.core import NodePath from direct.fsm import ClassicFSM popupMenu = None if isinstance(part, NodePath): @@ -427,7 +426,7 @@ class InspectorWindow: popupMenu = self.createPopupMenu( part, [('Inspect ClassicFSM', FSMInspector.FSMInspector)]) - print popupMenu + print(popupMenu) if popupMenu: popupMenu.post(event.widget.winfo_pointerx(), event.widget.winfo_pointery()) diff --git a/direct/src/tkpanels/MopathRecorder.py b/direct/src/tkpanels/MopathRecorder.py index 929c166315..3e7bc3e0c5 100644 --- a/direct/src/tkpanels/MopathRecorder.py +++ b/direct/src/tkpanels/MopathRecorder.py @@ -3,7 +3,7 @@ __all__ = ['MopathRecorder'] # Import Tkinter, Pmw, and the dial code from this directory tree. -from pandac.PandaModules import * +from panda3d.core import * from direct.showbase.DirectObject import DirectObject from direct.showbase.TkGlobal import * from direct.tkwidgets.AppShell import * diff --git a/direct/src/tkpanels/NotifyPanel.py b/direct/src/tkpanels/NotifyPanel.py index b6156b31fe..76d139daad 100644 --- a/direct/src/tkpanels/NotifyPanel.py +++ b/direct/src/tkpanels/NotifyPanel.py @@ -16,8 +16,7 @@ class NotifyPanel: from direct.showbase.TkGlobal import Pmw, Toplevel, Frame, Label, Radiobutton from direct.showbase.TkGlobal import HORIZONTAL, X, W, NW, BOTH, LEFT, RIGHT, IntVar # To get severity levels - from pandac.PandaModules import NSFatal, NSError, NSWarning, NSInfo - from pandac.PandaModules import NSDebug, NSSpam + from panda3d.core import NSFatal, NSError, NSWarning, NSInfo, NSDebug, NSSpam if tl == None: tl = Toplevel() @@ -125,7 +124,7 @@ class NotifyPanel: return categories def getPandaCategories(self): - from pandac.PandaModules import Notify + from panda3d.core import Notify topCategory = Notify.ptr().getTopCategory() return self._getPandaCategories(topCategory) diff --git a/direct/src/tkpanels/ParticlePanel.py b/direct/src/tkpanels/ParticlePanel.py index 2d89609903..ccc622bdc6 100644 --- a/direct/src/tkpanels/ParticlePanel.py +++ b/direct/src/tkpanels/ParticlePanel.py @@ -17,7 +17,8 @@ from direct.particles import ParticleEffect from Tkinter import * import Pmw, os,Placer -from pandac.PandaModules import * +from panda3d.core import * +from panda3d.physics import * class ParticlePanel(AppShell): # Override class variables @@ -2778,7 +2779,8 @@ if __name__ == '__main__': try: base except: - from direct.directbase import DirectStart + from direct.showbase.ShowBase import ShowBase + base = ShowBase() root = Pmw.initialise() pp = ParticlePanel() diff --git a/direct/src/tkpanels/Placer.py b/direct/src/tkpanels/Placer.py index e762725bd5..9b52343bf7 100644 --- a/direct/src/tkpanels/Placer.py +++ b/direct/src/tkpanels/Placer.py @@ -3,7 +3,7 @@ __all__ = ['Placer', 'place'] # Import Tkinter, Pmw, and the dial code from this directory tree. -from pandac.PandaModules import * +from panda3d.core import * from direct.showbase.TkGlobal import * from direct.tkwidgets.AppShell import * from direct.tkwidgets import Dial @@ -429,7 +429,7 @@ class Placer(AppShell): background = self.nodePathMenuBG) # Check to see if node path and ref node path are the same if ((self.refCS != None) and - (self.refCS.id() == self['nodePath'].id())): + (self.refCS == self['nodePath'])): # Yes they are, use temp CS as ref # This calls updatePlacer self.setReferenceNodePath(self.tempCS) @@ -474,7 +474,7 @@ class Placer(AppShell): listbox = self.refNodePathMenu.component('scrolledlist') listbox.setlist(self.refNodePathNames) # Check to see if node path and ref node path are the same - if (nodePath != None) and (nodePath.id() == self['nodePath'].id()): + if (nodePath != None) and (nodePath == self['nodePath']): # Yes they are, use temp CS and update listbox accordingly nodePath = self.tempCS self.refNodePathMenu.selectitem('parent') @@ -509,7 +509,7 @@ class Placer(AppShell): dictName = name else: # Generate a unique name for the dict - dictName = name + '-' + repr(nodePath.id()) + dictName = name + '-' + repr(hash(nodePath)) if dictName not in dict: # Update combo box to include new item names.append(dictName) diff --git a/direct/src/tkwidgets/AppShell.py b/direct/src/tkwidgets/AppShell.py index 3f024c58e5..67a7e6b794 100644 --- a/direct/src/tkwidgets/AppShell.py +++ b/direct/src/tkwidgets/AppShell.py @@ -17,7 +17,6 @@ import Floater import Slider import EntryScale import VectorWidgets -import sys, string import ProgressBar """ diff --git a/direct/src/tkwidgets/Dial.py b/direct/src/tkwidgets/Dial.py index f4216ce844..13a3cc8472 100644 --- a/direct/src/tkwidgets/Dial.py +++ b/direct/src/tkwidgets/Dial.py @@ -10,7 +10,6 @@ from Tkinter import * from Valuator import Valuator, VALUATOR_MINI, VALUATOR_FULL from direct.task import Task import math, string, operator, Pmw -from pandac.PandaModules import ClockObject TWO_PI = 2.0 * math.pi ONEPOINTFIVE_PI = 1.5 * math.pi diff --git a/direct/src/tkwidgets/EntryScale.py b/direct/src/tkwidgets/EntryScale.py index f79afe00aa..e4c8a96a60 100644 --- a/direct/src/tkwidgets/EntryScale.py +++ b/direct/src/tkwidgets/EntryScale.py @@ -4,7 +4,6 @@ EntryScale Class: Scale with a label, and a linked and validated entry __all__ = ['EntryScale', 'EntryScaleGroup'] -from direct.showbase.DirectObject import DirectObject from direct.showbase.TkGlobal import * from Tkinter import * import string, Pmw diff --git a/direct/src/tkwidgets/Floater.py b/direct/src/tkwidgets/Floater.py index 799d6c7b8e..655b7728be 100644 --- a/direct/src/tkwidgets/Floater.py +++ b/direct/src/tkwidgets/Floater.py @@ -9,7 +9,7 @@ from direct.showbase.TkGlobal import * from Tkinter import * from Valuator import Valuator, VALUATOR_MINI, VALUATOR_FULL from direct.task import Task -import math, sys, string, Pmw +import math, Pmw FLOATER_WIDTH = 22 FLOATER_HEIGHT = 18 diff --git a/direct/src/tkwidgets/SceneGraphExplorer.py b/direct/src/tkwidgets/SceneGraphExplorer.py index 9faf76e5e0..f07b24b496 100644 --- a/direct/src/tkwidgets/SceneGraphExplorer.py +++ b/direct/src/tkwidgets/SceneGraphExplorer.py @@ -155,7 +155,7 @@ class SceneGraphExplorerItem(TreeItem): return type + " " + name def GetKey(self): - return self.nodePath.id() + return hash(self.nodePath) def IsEditable(self): # All nodes' names can be edited nowadays. diff --git a/direct/src/tkwidgets/Slider.py b/direct/src/tkwidgets/Slider.py index 2a28107d8d..f2d9bb1246 100644 --- a/direct/src/tkwidgets/Slider.py +++ b/direct/src/tkwidgets/Slider.py @@ -8,10 +8,8 @@ __all__ = ['Slider', 'SliderWidget', 'rgbPanel'] from direct.showbase.TkGlobal import * from Tkinter import * from Valuator import Valuator, rgbPanel, VALUATOR_MINI, VALUATOR_FULL -from direct.task import Task -import math, sys, string -import operator, Pmw -from pandac.PandaModules import ClockObject +import string +import Pmw class Slider(Valuator): """ diff --git a/direct/src/tkwidgets/Tree.py b/direct/src/tkwidgets/Tree.py index b8c8100940..45857934b8 100644 --- a/direct/src/tkwidgets/Tree.py +++ b/direct/src/tkwidgets/Tree.py @@ -20,12 +20,9 @@ __all__ = ['TreeNode', 'TreeItem'] # - optimize tree redraw after expand of subnode import os -import sys -import string from direct.showbase.TkGlobal import * from Tkinter import * -import Pmw -from pandac.PandaModules import * +from panda3d.core import * # Initialize icon directory ICONDIR = ConfigVariableSearchPath('model-path').findFile(Filename('icons')).toOsSpecific() diff --git a/direct/src/wxwidgets/ViewPort.py b/direct/src/wxwidgets/ViewPort.py index 494c3ab845..2fd21a7a41 100755 --- a/direct/src/wxwidgets/ViewPort.py +++ b/direct/src/wxwidgets/ViewPort.py @@ -13,7 +13,7 @@ from direct.directtools.DirectGrid import DirectGrid from direct.showbase.ShowBase import WindowControls from direct.directtools.DirectGlobals import * from WxPandaWindow import WxPandaWindow -from pandac.PandaModules import WindowProperties, OrthographicLens, Point3, Plane, CollisionPlane, CollisionNode, NodePath +from panda3d.core import OrthographicLens, Point3, Plane, CollisionPlane, CollisionNode, NodePath import wx HORIZONTAL = wx.SPLIT_HORIZONTAL diff --git a/direct/src/wxwidgets/WxPandaShell.py b/direct/src/wxwidgets/WxPandaShell.py index 00b2483276..76420489c7 100755 --- a/direct/src/wxwidgets/WxPandaShell.py +++ b/direct/src/wxwidgets/WxPandaShell.py @@ -1,8 +1,7 @@ import wx -import os from wx.lib.agw import fourwaysplitter as FWS -from pandac.PandaModules import * +from panda3d.core import * from direct.showbase.ShowBase import * from direct.directtools.DirectGlobals import * diff --git a/dtool/src/dtoolutil/executionEnvironment.cxx b/dtool/src/dtoolutil/executionEnvironment.cxx index a51fb7741c..8c67ace1c8 100644 --- a/dtool/src/dtoolutil/executionEnvironment.cxx +++ b/dtool/src/dtoolutil/executionEnvironment.cxx @@ -66,10 +66,6 @@ extern char **environ; #include #endif -#ifdef HAVE_PYTHON -#include "Python.h" -#endif - // We define the symbol PREREAD_ENVIRONMENT if we cannot rely on // getenv() to read environment variables at static init time. In // this case, we must read all of the environment variables directly @@ -265,60 +261,9 @@ ns_get_environment_variable(const string &var) const { } else if (var == "COMMON_APPDATA") { return Filename::get_common_appdata_directory().to_os_specific(); } else if (var == "MAIN_DIR") { -#ifdef HAVE_PYTHON - // If we're running from Python code, read out sys.argv. - if (!ns_has_environment_variable("PANDA_INCOMPATIBLE_PYTHON") && Py_IsInitialized()) { - // Since we might have gotten to this point from a function call - // marked BLOCKING, which releases the Python thread state, we - // have to temporarily re-establish our thread state in the - // Python interpreter. -#ifdef WITH_THREAD - PyGILState_STATE state = PyGILState_Ensure(); -#endif - - Filename main_dir; - PyObject *obj = PySys_GetObject((char*) "argv"); // borrowed reference - if (obj != NULL && PyList_Check(obj)) { - PyObject *item = PyList_GetItem(obj, 0); // borrowed reference - if (item != NULL) { - if (PyUnicode_Check(item)) { - Py_ssize_t size = PyUnicode_GetSize(item); - wchar_t *data = new wchar_t[size + 1]; -#if PY_MAJOR_VERSION >= 3 - if (PyUnicode_AsWideChar(item, data, size) != -1) { -#else - if (PyUnicode_AsWideChar((PyUnicodeObject*) item, data, size) != -1) { -#endif - wstring wstr (data, size); - main_dir = Filename::from_os_specific_w(wstr); - } - delete data; - } -#if PY_MAJOR_VERSION < 3 - else if (PyString_Check(item)) { - char *str = PyString_AsString(item); - if (str != (char *)NULL) { - main_dir = Filename::from_os_specific(str); - } - } -#endif - } - } - -#ifdef WITH_THREAD - PyGILState_Release(state); -#endif - - if (main_dir.empty()) { - // We must be running in the Python interpreter directly, so return the CWD. - return get_cwd().to_os_specific(); - } - main_dir.make_absolute(); - return Filename(main_dir.get_dirname()).to_os_specific(); - } -#endif - - // Otherwise, Return the binary name's parent directory. + // Return the binary name's parent directory. If we're running + // inside the Python interpreter, this will be overridden by + // a setting from panda3d/core.py. if (!_binary_name.empty()) { Filename main_dir (_binary_name); main_dir.make_absolute(); diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 1cef42e102..9bae13353f 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -1264,9 +1264,15 @@ write_sub_module(ostream &out, Object *obj) { std::string export_class_name = classNameFromCppName(obj->_itype.get_name(), false); std::string export_class_name2 = classNameFromCppName(obj->_itype.get_name(), true); -// out << " Py_INCREF(&Dtool_" << class_name << ".As_PyTypeObject());\n"; + // Note: PyModule_AddObject steals a reference, so we have to call Py_INCREF + // for every but the first time we add it to the module. + if (obj->_itype.is_typedef()) { + out << " Py_INCREF((PyObject *)&Dtool_" << class_name << ");\n"; + } + out << " PyModule_AddObject(module, \"" << export_class_name << "\", (PyObject *)&Dtool_" << class_name << ");\n"; if (export_class_name != export_class_name2) { + out << " Py_INCREF((PyObject *)&Dtool_" << class_name << ");\n"; out << " PyModule_AddObject(module, \"" << export_class_name2 << "\", (PyObject *)&Dtool_" << class_name << ");\n"; } } diff --git a/dtool/src/interrogate/interrogate_module.cxx b/dtool/src/interrogate/interrogate_module.cxx index 8aad13c5c6..8f5b39591e 100644 --- a/dtool/src/interrogate/interrogate_module.cxx +++ b/dtool/src/interrogate/interrogate_module.cxx @@ -95,13 +95,13 @@ int write_python_table_native(ostream &out) { FunctionIndex function_index = interrogate_get_function(fi); // Consider only those that belong in the module we asked for. - if (interrogate_function_has_module_name(function_index) && - module_name == interrogate_function_module_name(function_index)) { + //if (interrogate_function_has_module_name(function_index) && + // module_name == interrogate_function_module_name(function_index)) { // if it has a library name add it to set of libraries if (interrogate_function_has_library_name(function_index)) { libraries.insert(interrogate_function_library_name(function_index)); } - } + //} } for (int ti = 0; ti < interrogate_number_of_types(); ti++) { diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 23651b7d0d..16932aedfe 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -30,11 +30,6 @@ import time import os import sys -## jGenPyCode tries to get the directory for Direct from the sys.path. This only works if you -## have installed the sdk using a installer. This would not work if the installer was -## never used and everything was grabbed into a virgin environment using cvs. -sys.path.append(os.getcwd()) - ######################################################################## ## ## PARSING THE COMMAND LINE OPTIONS @@ -1332,9 +1327,8 @@ def CompileIgate(woutd,wsrc,opts): if (PkgSkip("PYTHON")): WriteFile(woutc, "") WriteFile(woutd, "") - CompileCxx(wobj, woutc, opts) ConditionalWriteFile(woutd, "") - return + return (wobj, woutc, opts) if not CrossCompiling(): # If we're compiling for this platform, we can use the one we've built. @@ -1385,8 +1379,8 @@ def CompileIgate(woutd,wsrc,opts): else: cmd += ' ' + BracketNameWithQuotes(os.path.basename(x)) oscmd(cmd) - CompileCxx(wobj,woutc,opts) - return + + return (wobj, woutc, opts) ######################################################################## ## @@ -1773,28 +1767,26 @@ def CompileRsrc(target, src, opts): ########################################################################################## # -# RunGenPyCode +# GenPyExtensions # ########################################################################################## -def RunGenPyCode(target, inputs, opts): - if (PkgSkip("PYTHON") != 0): - return +def GenPyExtensions(target, inputs, opts): + # Hopefully the need for this will soon go away as we migrate everything to + # C extensions. - cmdstr = BracketNameWithQuotes(SDK["PYTHONEXEC"]) + " " - if sys.version_info >= (2, 6): - cmdstr += "-B " + code = "# This file is automatically generated by makepanda.py. Do not modify.\n" + code += "from __future__ import absolute_import\n" - cmdstr += os.path.join(GetOutputDir(), "direct", "ffi", "jGenPyCode.py") - if (GENMAN): cmdstr += " -d" - cmdstr += " -r" for i in inputs: - if (GetOrigExt(i)==".pyd"): - cmdstr += " panda3d." + os.path.basename(os.path.splitext(i)[0]) - elif (GetOrigExt(i)==".dll"): - cmdstr += " " + os.path.basename(os.path.splitext(i)[0].replace("_d","")) + 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 - oscmd(cmdstr) + WriteFile(target, code) ########################################################################################## # @@ -1804,7 +1796,7 @@ def RunGenPyCode(target, inputs, opts): def FreezePy(target, inputs, opts): assert len(inputs) > 0 - # Make sure this function isn't called before genpycode is run. + cmdstr = BracketNameWithQuotes(SDK["PYTHONEXEC"]) + " " if sys.version_info >= (2, 6): cmdstr += "-B " @@ -1935,9 +1927,9 @@ def CompileAnything(target, inputs, opts, progress = None): if (origsuffix==".exe" and GetHost() != "windows"): os.system("chmod +x \"%s\"" % target) return - elif (target.endswith("pandac/PandaModules.py")): - ProgressOutput(progress, "Generating 'pandac' tree") - return RunGenPyCode(target, inputs, opts) + elif (target.endswith(".py")): + ProgressOutput(progress, "Generating", target) + return GenPyExtensions(target, inputs, opts) elif (infile.endswith(".py")): if (origsuffix==".exe"): ProgressOutput(progress, "Building frozen executable", target) @@ -1974,7 +1966,9 @@ def CompileAnything(target, inputs, opts, progress = None): return CompileLink(target, inputs, opts) elif (origsuffix==".in"): ProgressOutput(progress, "Building Interrogate database", target) - return CompileIgate(target, inputs, opts) + args = CompileIgate(target, inputs, opts) + ProgressOutput(progress, "Building C++ object", args[0]) + return CompileCxx(*args) elif (origsuffix==".plugin" and GetTarget() == "darwin"): ProgressOutput(progress, "Building plugin bundle", target) return CompileBundle(target, inputs, opts) @@ -2582,6 +2576,60 @@ if (PkgSkip("DIRECT")==0): if os.path.isfile(GetOutputDir() + '/direct/ffi/panda3d.pyc'): os.remove(GetOutputDir() + '/direct/ffi/panda3d.pyc') +# This used to exist; no longer. +if sys.platform == 'win32': + core_so = GetOutputDir() + '/panda3d/core.pyd' + direct_so = GetOutputDir() + '/panda3d/direct.pyd' +else: + core_so = GetOutputDir() + '/panda3d/core.so' + direct_so = GetOutputDir() + '/panda3d/direct.so' + +if os.path.isfile(core_so): + os.remove(core_so) +if os.path.isfile(direct_so): + os.remove(direct_so) + +# PandaModules is now deprecated; generate a shim for backward compatibility. +for fn in glob.glob(GetOutputDir() + '/pandac/*.py') + glob.glob(GetOutputDir() + '/pandac/*.py[co]'): + if os.path.basename(fn) not in ('PandaModules.py', '__init__.py'): + os.remove(fn) + +panda_modules = ['core'] +if not PkgSkip("PANDAPHYSICS"): + panda_modules.append('physics') +if not PkgSkip('PANDAFX'): + panda_modules.append('fx') +if not PkgSkip("DIRECT"): + panda_modules.append('direct') +if not PkgSkip("VISION"): + panda_modules.append('vision') +if not PkgSkip("SKEL"): + panda_modules.append('skel') +panda_modules.append('egg') +if not PkgSkip("AWESOMIUM"): + panda_modules.append('awesomium') +if not PkgSkip("ODE"): + panda_modules.append('ode') +if not PkgSkip("VRPN"): + panda_modules.append('vrpn') + +panda_modules_code = """ +"This module is deprecated. Import from panda3d.core and other panda3d.* modules instead." + +print("Warning: pandac.PandaModules is deprecated, import from panda3d.core instead") +""" + +for module in panda_modules: + panda_modules_code += """ +try: + from panda3d.%s import * +except ImportError, err: + if "No module named %s" not in str(err): + raise""" % (module, module) + +ConditionalWriteFile(GetOutputDir() + '/pandac/PandaModules.py', panda_modules_code) +ConditionalWriteFile(GetOutputDir() + '/pandac/__init__.py', '') + ########################################################################################## # # Generate the PRC files into the ETC directory. @@ -3812,58 +3860,67 @@ if (not RUNTIME): if PkgSkip("FREETYPE")==0: TargetAdd('core_module.obj', input='libp3pnmtext.in') - TargetAdd('core_module.obj', opts=['IMOD:panda3d.core', 'ILIB:core']) + TargetAdd('core_module.obj', opts=['IMOD:panda3d._core', 'ILIB:_core']) - TargetAdd('core.pyd', input='libp3downloader_igate.obj') - TargetAdd('core.pyd', input='p3express_ext_composite.obj') - TargetAdd('core.pyd', input='libp3express_igate.obj') + TargetAdd('_core.pyd', input='libp3downloader_igate.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.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: - TargetAdd('core.pyd', input="libp3pnmtext_igate.obj") + 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='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=COMMON_PANDA_LIBS) - TargetAdd('core.pyd', opts=['PYTHON', 'WINSOCK2']) + TargetAdd('_core.pyd', input='core_module.obj') + TargetAdd('_core.pyd', input='libp3tinyxml.ilb') + 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') # # DIRECTORY: panda/src/vision/ @@ -3885,7 +3942,7 @@ if (PkgSkip("VISION") == 0) and (not RUNTIME): TargetAdd('vision_module.obj', input='libp3vision.in') 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='libp3vision_igate.obj') @@ -3915,7 +3972,7 @@ if (PkgSkip("ROCKET") == 0) and (not RUNTIME): TargetAdd('rocket_module.obj', input='libp3rocket.in') 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='libp3rocket_igate.obj') @@ -3942,7 +3999,7 @@ if PkgSkip("AWESOMIUM") == 0 and not RUNTIME: TargetAdd('awesomium_module.obj', input='libp3awesomium.in') 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='libp3awesomium_igate.obj') @@ -3975,7 +4032,7 @@ if (PkgSkip('SKEL')==0) and (not RUNTIME): TargetAdd('libpandaskel.dll', opts=OPTS) 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='libp3skel_igate.obj') @@ -4013,7 +4070,7 @@ if (PkgSkip('PANDAFX')==0) and (not RUNTIME): OPTS=['DIR:panda/metalibs/pandafx', 'DIR:panda/src/distort', 'NVIDIACG'] TargetAdd('fx_module.obj', input='libp3distort.in') 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='libp3distort_igate.obj') @@ -4040,7 +4097,7 @@ if (PkgSkip("VRPN")==0 and not RUNTIME): TargetAdd('vrpn_module.obj', input='libp3vrpn.in') 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='libp3vrpn_igate.obj') @@ -4272,7 +4329,7 @@ if (not RUNTIME): TargetAdd('egg_module.obj', input='libp3egg2pg.in') TargetAdd('egg_module.obj', input='libp3egg.in') 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='p3egg_eggGroupNode_ext.obj') @@ -4438,7 +4495,7 @@ if (PkgSkip("ODE")==0 and not RUNTIME): OPTS=['DIR:panda/metalibs/pandaode', 'ODE'] TargetAdd('ode_module.obj', input='libpandaode.in') 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='libpandaode_igate.obj') @@ -4475,7 +4532,7 @@ if (PkgSkip("BULLET")==0 and not RUNTIME): OPTS=['DIR:panda/metalibs/pandabullet', 'BULLET'] TargetAdd('bullet_module.obj', input='libpandabullet.in') 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='libpandabullet_igate.obj') @@ -4513,7 +4570,7 @@ if (PkgSkip("PHYSX")==0): OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX', 'NOARCH:PPC'] TargetAdd('physx_module.obj', input='libpandaphysx.in') 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='libpandaphysx_igate.obj') @@ -4578,7 +4635,7 @@ if (PkgSkip("PANDAPHYSICS")==0) and (not RUNTIME): if (PkgSkip("PANDAPARTICLESYSTEM")==0): TargetAdd('physics_module.obj', input='libp3particlesystem.in') 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='libp3physics_igate.obj') @@ -4834,18 +4891,22 @@ if (PkgSkip("DIRECT")==0): TargetAdd('direct_module.obj', input='libp3interval.in') TargetAdd('direct_module.obj', input='libp3distributed.in') TargetAdd('direct_module.obj', opts=OPTS) - TargetAdd('direct_module.obj', opts=['IMOD:panda3d.direct', 'ILIB:direct', 'IMPORT:panda3d.core']) + 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.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.pyd', input='direct_module.obj') - TargetAdd('direct.pyd', input='libp3direct.dll') - TargetAdd('direct.pyd', input=COMMON_PANDA_LIBS) - TargetAdd('direct.pyd', opts=['PYTHON', 'OPENSSL', 'WINUSER', 'WINGDI']) + TargetAdd('_direct.pyd', input='direct_module.obj') + TargetAdd('_direct.pyd', input='libp3direct.dll') + TargetAdd('_direct.pyd', input=COMMON_PANDA_LIBS) + TargetAdd('_direct.pyd', opts=['PYTHON', 'OPENSSL', 'WINUSER', 'WINGDI']) + + OPTS=['DIR:direct/src/extensions_native'] + TargetAdd('panda3d/direct.py', input='_direct.pyd') + TargetAdd('panda3d/direct.py', opts=OPTS, input='CInterval_extensions.py') # # DIRECTORY: direct/src/dcparse/ @@ -6043,7 +6104,7 @@ if (PkgSkip("CONTRIB")==0 and not RUNTIME): TargetAdd('ai_module.obj', input='libpandaai.in') 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='libpandaai_igate.obj') @@ -6051,35 +6112,6 @@ if (PkgSkip("CONTRIB")==0 and not RUNTIME): TargetAdd('ai.pyd', input=COMMON_PANDA_LIBS) TargetAdd('ai.pyd', opts=['PYTHON']) -# -# Run genpycode -# - -if (PkgSkip("PYTHON")==0 and not RUNTIME): - # We're phasing out the concept of PandaModules, so do not - # add new libraries here. Only add new libraries when you've - # split them out of libpanda and need to maintain backward - # compatibility with old imports. See direct/src/ffi/panda3d.py - - TargetAdd('PandaModules.py', input='core.pyd') - if (PkgSkip("PANDAPHYSICS")==0): - TargetAdd('PandaModules.py', input='physics.pyd') - if (PkgSkip('PANDAFX')==0): - TargetAdd('PandaModules.py', input='fx.pyd') - if (PkgSkip("DIRECT")==0): - TargetAdd('PandaModules.py', input='direct.pyd') - if (PkgSkip("VISION")==0): - TargetAdd('PandaModules.py', input='vision.pyd') - if (PkgSkip("SKEL")==0): - TargetAdd('PandaModules.py', input='skel.pyd') - TargetAdd('PandaModules.py', input='egg.pyd') - if (PkgSkip("AWESOMIUM")==0): - TargetAdd('PandaModules.py', input='awesomium.pyd') - if (PkgSkip("ODE")==0): - TargetAdd('PandaModules.py', input='ode.pyd') - if (PkgSkip("VRPN")==0): - TargetAdd('PandaModules.py', input='vrpn.pyd') - # # Generate the models directory and samples directory # diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 3d45411016..a93b6cadd1 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -2694,17 +2694,20 @@ def SetOrigExt(x, v): ORIG_EXT[x] = v def CalcLocation(fn, ipath): + if fn.startswith("panda3d/") and fn.endswith(".py"): + return OUTPUTDIR + "/" + fn + if (fn.count("/")): return fn dllext = "" target = GetTarget() if (GetOptimize() <= 2 and target == 'windows'): dllext = "_d" - if (fn == "PandaModules.py"): return OUTPUTDIR+"/pandac/" + fn if (fn == "AndroidManifest.xml"): return OUTPUTDIR+"/"+fn if (fn.endswith(".cxx")): return CxxFindSource(fn, ipath) if (fn.endswith(".I")): return CxxFindSource(fn, ipath) if (fn.endswith(".h")): return CxxFindSource(fn, ipath) if (fn.endswith(".c")): return CxxFindSource(fn, ipath) + if (fn.endswith(".py")): return CxxFindSource(fn, ipath) if (fn.endswith(".yxx")): return CxxFindSource(fn, ipath) if (fn.endswith(".lxx")): return CxxFindSource(fn, ipath) if (fn.endswith(".pdef")):return CxxFindSource(fn, ipath)