From d9342043b098da270aa295b34dade574c6e05de3 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 28 Jun 2015 13:55:31 +0200 Subject: [PATCH 1/6] Deprecate pandac.PandaModules and genPyCode, move extensions to panda3d/, clean up imports and deprecated behaviour --- direct/src/actor/Actor.py | 5 +- direct/src/cluster/ClusterClient.py | 2 +- direct/src/cluster/ClusterConfig.py | 1 - direct/src/cluster/ClusterMsgs.py | 2 +- direct/src/cluster/ClusterServer.py | 2 +- direct/src/directbase/TestStart.py | 6 +- .../src/directdevices/DirectDeviceManager.py | 18 +- direct/src/directnotify/Logger.py | 1 - direct/src/directnotify/Notifier.py | 1 - direct/src/directscripts/doxygen_filter.py | 2 +- direct/src/directscripts/extract_docs.py | 2 +- direct/src/directtools/DirectCameraControl.py | 2 +- direct/src/directtools/DirectGeometry.py | 2 +- direct/src/directtools/DirectGlobals.py | 2 +- direct/src/directtools/DirectGrid.py | 2 +- direct/src/directtools/DirectLights.py | 2 +- direct/src/directtools/DirectSession.py | 16 +- direct/src/distributed/PyDatagram.py | 3 +- direct/src/distributed/PyDatagramIterator.py | 3 +- .../extensions_native/CInterval_extensions.py | 9 +- .../extensions_native/NodePath_extensions.py | 789 ++---------------- .../extensions_native/VBase3_extensions.py | 2 +- .../extensions_native/VBase4_extensions.py | 2 +- direct/src/ffi/DoGenPyCode.py | 6 +- direct/src/ffi/FFITypes.py | 1 - direct/src/ffi/jGenPyCode.py | 1 - direct/src/filter/CommonFilters.py | 4 +- direct/src/filter/FilterManager.py | 7 +- direct/src/fsm/FourState.py | 1 - direct/src/fsm/SampleFSM.py | 1 - direct/src/fsm/State.py | 1 - direct/src/fsm/StatePush.py | 2 +- direct/src/gui/DirectButton.py | 2 +- direct/src/gui/DirectCheckBox.py | 2 +- direct/src/gui/DirectCheckButton.py | 3 +- direct/src/gui/DirectDialog.py | 2 +- direct/src/gui/DirectEntry.py | 2 +- direct/src/gui/DirectEntryScroll.py | 6 +- direct/src/gui/DirectFrame.py | 4 +- direct/src/gui/DirectGuiBase.py | 8 +- direct/src/gui/DirectGuiGlobals.py | 2 +- direct/src/gui/DirectGuiTest.py | 4 +- direct/src/gui/DirectLabel.py | 3 +- direct/src/gui/DirectOptionMenu.py | 2 +- direct/src/gui/DirectRadioButton.py | 2 +- direct/src/gui/DirectScrollBar.py | 2 +- direct/src/gui/DirectScrolledFrame.py | 2 +- direct/src/gui/DirectScrolledList.py | 4 +- direct/src/gui/DirectSlider.py | 2 +- direct/src/gui/DirectWaitBar.py | 2 +- direct/src/gui/OnscreenGeom.py | 5 +- direct/src/gui/OnscreenImage.py | 5 +- direct/src/gui/OnscreenText.py | 4 +- direct/src/interval/ActorInterval.py | 3 +- direct/src/interval/AnimControlInterval.py | 3 +- direct/src/interval/FunctionInterval.py | 4 +- direct/src/interval/IndirectInterval.py | 3 +- direct/src/interval/Interval.py | 5 +- direct/src/interval/IntervalGlobal.py | 18 +- direct/src/interval/IntervalManager.py | 6 +- direct/src/interval/IntervalTest.py | 8 +- direct/src/interval/LerpInterval.py | 3 +- direct/src/interval/MetaInterval.py | 9 +- direct/src/interval/MopathInterval.py | 3 +- direct/src/interval/ParticleInterval.py | 4 +- direct/src/interval/ProjectileInterval.py | 4 +- direct/src/interval/ProjectileIntervalTest.py | 4 +- direct/src/interval/SoundInterval.py | 3 +- direct/src/interval/TestInterval.py | 4 +- direct/src/motiontrail/MotionTrail.py | 3 +- direct/src/p3d/AppRunner.py | 7 +- direct/src/p3d/DWBPackageInstaller.py | 2 + direct/src/p3d/DeploymentTools.py | 2 +- direct/src/p3d/FileSpec.py | 2 + direct/src/p3d/HostInfo.py | 2 + direct/src/p3d/InstalledHostData.py | 2 + direct/src/p3d/InstalledPackageData.py | 2 + direct/src/p3d/JavaScript.py | 2 + direct/src/p3d/PackageInfo.py | 4 +- direct/src/p3d/PackageInstaller.py | 2 + direct/src/p3d/PackageMerger.py | 3 +- direct/src/p3d/Packager.py | 4 +- direct/src/p3d/PatchMaker.py | 2 + direct/src/p3d/ScanDirectoryNode.py | 2 + direct/src/p3d/SeqValue.py | 2 + direct/src/particles/ForceGroup.py | 3 +- direct/src/particles/ParticleEffect.py | 10 +- direct/src/particles/ParticleFloorTest.py | 9 +- direct/src/particles/Particles.py | 6 +- direct/src/showbase/Audio3DManager.py | 2 +- direct/src/showbase/ContainerLeakDetector.py | 3 +- direct/src/showbase/ContainerReport.py | 4 +- direct/src/showbase/DistancePhasedNode.py | 3 +- direct/src/showbase/ExcelHandler.py | 1 - direct/src/showbase/Finder.py | 1 - direct/src/showbase/GarbageReport.py | 2 +- direct/src/showbase/LazySort.py | 1 - direct/src/showbase/Messenger.py | 1 - direct/src/showbase/ObjectPool.py | 1 - direct/src/showbase/OnScreenDebug.py | 4 +- direct/src/showbase/ProfileSession.py | 5 +- direct/src/showbase/PythonUtil.py | 2 - direct/src/showbase/RandomNumGen.py | 2 +- direct/src/showbase/SfxPlayer.py | 3 +- direct/src/showbase/ShowBase.py | 78 +- direct/src/showbase/Transitions.py | 4 +- direct/src/showbase/pandaSqueezeTool.py | 16 +- direct/src/showutil/BuildGeometry.py | 7 +- direct/src/showutil/Effects.py | 2 +- direct/src/showutil/FreezeTool.py | 1 - direct/src/showutil/Rope.py | 2 +- direct/src/showutil/TexMemWatcher.py | 2 +- direct/src/showutil/TexViewer.py | 2 +- direct/src/task/Task.py | 2 - direct/src/task/Timer.py | 1 - direct/src/tkpanels/AnimPanel.py | 2 +- direct/src/tkpanels/DirectSessionPanel.py | 4 +- direct/src/tkpanels/Inspector.py | 17 +- direct/src/tkpanels/MopathRecorder.py | 2 +- direct/src/tkpanels/NotifyPanel.py | 5 +- direct/src/tkpanels/ParticlePanel.py | 6 +- direct/src/tkpanels/Placer.py | 8 +- direct/src/tkwidgets/AppShell.py | 1 - direct/src/tkwidgets/Dial.py | 1 - direct/src/tkwidgets/EntryScale.py | 1 - direct/src/tkwidgets/Floater.py | 2 +- direct/src/tkwidgets/SceneGraphExplorer.py | 2 +- direct/src/tkwidgets/Slider.py | 6 +- direct/src/tkwidgets/Tree.py | 5 +- direct/src/wxwidgets/ViewPort.py | 2 +- direct/src/wxwidgets/WxPandaShell.py | 3 +- dtool/src/dtoolutil/executionEnvironment.cxx | 61 +- .../interfaceMakerPythonNative.cxx | 8 +- dtool/src/interrogate/interrogate_module.cxx | 6 +- makepanda/makepanda.py | 284 ++++--- makepanda/makepandacore.py | 5 +- 136 files changed, 484 insertions(+), 1222 deletions(-) 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) From 08fbfb1874a079caa7df955fbd9fef94887b321f Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 28 Jun 2015 14:04:16 +0200 Subject: [PATCH 2/6] Add missing file, update .gitignores --- contrib/.gitignore | 7 ++++- direct/.gitignore | 1 + .../src/extensions_native/core_extensions.py | 28 +++++++++++++++++++ makepanda/.gitignore | 1 + panda/.gitignore | 1 + 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 direct/src/extensions_native/core_extensions.py diff --git a/contrib/.gitignore b/contrib/.gitignore index 33fa81ab6b..aa93cd250a 100644 --- a/contrib/.gitignore +++ b/contrib/.gitignore @@ -1,4 +1,9 @@ +*.pyc +*.pyo /__init__.py -/built/ +# These are files that are generated within the source tree by the +# ppremake system. Makefile pp.dep +/built/ +Opt?-* diff --git a/direct/.gitignore b/direct/.gitignore index 97b7fbcf49..aa93cd250a 100644 --- a/direct/.gitignore +++ b/direct/.gitignore @@ -1,4 +1,5 @@ *.pyc +*.pyo /__init__.py # These are files that are generated within the source tree by the # ppremake system. diff --git a/direct/src/extensions_native/core_extensions.py b/direct/src/extensions_native/core_extensions.py new file mode 100644 index 0000000000..3380dc3cf3 --- /dev/null +++ b/direct/src/extensions_native/core_extensions.py @@ -0,0 +1,28 @@ +import sys + +main_dir = Filename() + +if sys.argv and sys.argv[0]: + main_dir = Filename.from_os_specific(sys.argv[0]) + +if main_dir.empty(): + # We must be running in the Python interpreter directly, so return the CWD. + main_dir = ExecutionEnvironment.get_cwd() +else: + main_dir.make_absolute() + main_dir = Filename(main_dir.get_dirname()) +ExecutionEnvironment.shadow_environment_variable('MAIN_DIR', main_dir.to_os_specific()) +del sys, main_dir + + +def Dtool_funcToMethod(func, cls, method_name=None): + """Adds func to class so it is an accessible method; use method_name to specify the name to be used for calling the method. + The new method is accessible to any instance immediately.""" + #if sys.version_info < (3, 0): + # func.im_class = cls + func.im_func = func + func.im_self = None + if not method_name: + method_name = func.__name__ + cls.DtoolClassDict[method_name] = func; + diff --git a/makepanda/.gitignore b/makepanda/.gitignore index 94487b9516..c3667923e0 100644 --- a/makepanda/.gitignore +++ b/makepanda/.gitignore @@ -1 +1,2 @@ *.pyc +*.pyo diff --git a/panda/.gitignore b/panda/.gitignore index 3fbb4b2955..ec20cdb1ee 100644 --- a/panda/.gitignore +++ b/panda/.gitignore @@ -1,4 +1,5 @@ *.pyc +*.pyo # These are files that are generated within the source tree by the # ppremake system. Makefile From 5625df0e5143be58dd342aaf0b6afc2beb2ac7b9 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 29 Jun 2015 20:37:33 +0100 Subject: [PATCH 3/6] panda3d/__init__.py should add 'bin' dir to PATH on Windows --- makepanda/makepanda.py | 20 ++++++++++++++++++++ makepanda/makepandacore.py | 1 - 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 16932aedfe..f7ee0d5d2c 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2589,6 +2589,26 @@ if os.path.isfile(core_so): if os.path.isfile(direct_so): os.remove(direct_so) +# Write an appropriate panda3d/__init__.py +p3d_init = """"Python bindings for the Panda3D libraries" +""" + +if GetTarget() == 'windows': + p3d_init += """ +import os + +bindir = os.path.join(os.path.dirname(__file__), '..', 'bin') +if os.path.isfile(os.path.join(bindir, 'libpanda.dll')): + if not os.environ.get('PATH'): + os.environ['PATH'] = bindir + else: + os.environ['PATH'] = bindir + os.pathsep + os.environ['PATH'] + +del os, bindir +""" + +ConditionalWriteFile(GetOutputDir() + '/panda3d/__init__.py', p3d_init) + # 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'): diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index a93b6cadd1..c490f0eafb 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1061,7 +1061,6 @@ def MakeBuildTree(): MakeDirectory(OUTPUTDIR + "/pandac") MakeDirectory(OUTPUTDIR + "/pandac/input") MakeDirectory(OUTPUTDIR + "/panda3d") - CreateFile(OUTPUTDIR + "/panda3d/__init__.py") if GetTarget() == 'darwin': MakeDirectory(OUTPUTDIR + "/Frameworks") From 63e682055de1865f8e6244e1a42f583df0971086 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 30 Jun 2015 15:06:18 +0200 Subject: [PATCH 4/6] travis: add --verbose flag --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2a3437725a..bb0b07dd51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ compiler: - clang before_script: - sudo apt-get install python-dev libpng-dev zlib1g-dev libssl-dev libx11-dev libgl1-mesa-dev libxrandr-dev libxxf86dga-dev libxcursor-dev bison flex libfreetype6-dev libvorbis-dev libjpeg-dev libopenal-dev libode-dev nvidia-cg-toolkit -script: python makepanda/makepanda.py --everything --git-commit $TRAVIS_COMMIT --installer --threads 2 +script: python makepanda/makepanda.py --everything --verbose --git-commit $TRAVIS_COMMIT --installer --threads 2 notifications: irc: channels: From c0f6588c885b21c886eaefad9e8d52c3b4f41c2f Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 30 Jun 2015 15:17:15 +0200 Subject: [PATCH 5/6] Separate libp3interrogatedb out of libp3dtoolconfig. This aids further in removing the core lib dependency on Python. --- makepanda/makepanda.py | 25 +++++++++++++++++++++++-- panda/src/express/memoryUsagePointers.h | 7 ------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index f7ee0d5d2c..c434c97c89 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -3131,6 +3131,10 @@ TargetAdd('p3dconfig_composite1.obj', opts=OPTS, input='p3dconfig_composite1.cxx OPTS=['DIR:dtool/src/interrogatedb', 'BUILDING:DTOOLCONFIG'] TargetAdd('p3interrogatedb_composite1.obj', opts=OPTS, input='p3interrogatedb_composite1.cxx') TargetAdd('p3interrogatedb_composite2.obj', opts=OPTS, input='p3interrogatedb_composite2.cxx') +TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite1.obj') +TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite2.obj') +TargetAdd('libp3interrogatedb.dll', input='libp3dtool.dll') +TargetAdd('libp3interrogatedb.dll', opts=['PYTHON']) # # DIRECTORY: dtool/metalibs/dtoolconfig/ @@ -3139,8 +3143,6 @@ TargetAdd('p3interrogatedb_composite2.obj', opts=OPTS, input='p3interrogatedb_co OPTS=['DIR:dtool/metalibs/dtoolconfig', 'BUILDING:DTOOLCONFIG'] TargetAdd('p3dtoolconfig_dtoolconfig.obj', opts=OPTS, input='dtoolconfig.cxx') TargetAdd('libp3dtoolconfig.dll', input='p3dtoolconfig_dtoolconfig.obj') -TargetAdd('libp3dtoolconfig.dll', input='p3interrogatedb_composite1.obj') -TargetAdd('libp3dtoolconfig.dll', input='p3interrogatedb_composite2.obj') TargetAdd('libp3dtoolconfig.dll', input='p3dconfig_composite1.obj') TargetAdd('libp3dtoolconfig.dll', input='p3prc_composite1.obj') TargetAdd('libp3dtoolconfig.dll', input='p3prc_composite2.obj') @@ -3153,6 +3155,7 @@ if not PkgSkip("PYTHON"): TargetAdd('dtoolconfig.pyd', input='dtoolconfig_pydtool.obj') TargetAdd('dtoolconfig.pyd', input='libp3dtoolconfig.dll') TargetAdd('dtoolconfig.pyd', input='libp3dtool.dll') + TargetAdd('dtoolconfig.pyd', input='libp3interrogatedb.dll') TargetAdd('dtoolconfig.pyd', opts=['PYTHON']) # @@ -3177,12 +3180,14 @@ if (not RUNTIME): TargetAdd('interrogate.exe', input='interrogate_composite2.obj') TargetAdd('interrogate.exe', input='libp3cppParser.ilb') TargetAdd('interrogate.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('interrogate.exe', input='libp3interrogatedb.dll') TargetAdd('interrogate.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) TargetAdd('interrogate_module_interrogate_module.obj', opts=OPTS, input='interrogate_module.cxx') TargetAdd('interrogate_module.exe', input='interrogate_module_interrogate_module.obj') TargetAdd('interrogate_module.exe', input='libp3cppParser.ilb') TargetAdd('interrogate_module.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('interrogate_module.exe', input='libp3interrogatedb.dll') TargetAdd('interrogate_module.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) if (not RTDIST): @@ -3190,6 +3195,7 @@ if (not RUNTIME): TargetAdd('parse_file.exe', input='parse_file_parse_file.obj') TargetAdd('parse_file.exe', input='libp3cppParser.ilb') TargetAdd('parse_file.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('parse_file.exe', input='libp3interrogatedb.dll') TargetAdd('parse_file.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) # @@ -3212,6 +3218,7 @@ if (not RTDIST and not RUNTIME): TargetAdd('test_interrogate_test_interrogate.obj', opts=OPTS, input='test_interrogate.cxx') TargetAdd('test_interrogate.exe', input='test_interrogate_test_interrogate.obj') TargetAdd('test_interrogate.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('test_interrogate.exe', input='libp3interrogatedb.dll') TargetAdd('test_interrogate.exe', opts=['ADVAPI', 'OPENSSL', 'WINSHELL', 'WINGDI', 'WINUSER']) # @@ -3930,6 +3937,7 @@ if (not RUNTIME): TargetAdd('_core.pyd', input='core_module.obj') TargetAdd('_core.pyd', input='libp3tinyxml.ilb') + TargetAdd('_core.pyd', input='libp3interrogatedb.dll') TargetAdd('_core.pyd', input=COMMON_PANDA_LIBS) TargetAdd('_core.pyd', opts=['PYTHON', 'WINSOCK2']) @@ -3967,6 +3975,7 @@ if (PkgSkip("VISION") == 0) and (not RUNTIME): TargetAdd('vision.pyd', input='vision_module.obj') TargetAdd('vision.pyd', input='libp3vision_igate.obj') TargetAdd('vision.pyd', input='libp3vision.dll') + TargetAdd('vision.pyd', input='libp3interrogatedb.dll') TargetAdd('vision.pyd', input=COMMON_PANDA_LIBS) TargetAdd('vision.pyd', opts=['PYTHON']) @@ -3998,6 +4007,7 @@ if (PkgSkip("ROCKET") == 0) and (not RUNTIME): TargetAdd('rocket.pyd', input='libp3rocket_igate.obj') TargetAdd('rocket.pyd', input='p3rocket_rocketRegion_ext.obj') TargetAdd('rocket.pyd', input='libp3rocket.dll') + TargetAdd('rocket.pyd', input='libp3interrogatedb.dll') TargetAdd('rocket.pyd', input=COMMON_PANDA_LIBS) TargetAdd('rocket.pyd', opts=['PYTHON', 'ROCKET']) @@ -4024,6 +4034,7 @@ if PkgSkip("AWESOMIUM") == 0 and not RUNTIME: TargetAdd('awesomium.pyd', input='awesomium_module.obj') TargetAdd('awesomium.pyd', input='libp3awesomium_igate.obj') TargetAdd('awesomium.pyd', input='libp3awesomium.dll') + TargetAdd('awesomium.pyd', input='libp3interrogatedb.dll') TargetAdd('awesomium.pyd', input=COMMON_PANDA_LIBS) TargetAdd('awesomium.pyd', opts=['PYTHON']) @@ -4057,6 +4068,7 @@ if (PkgSkip('SKEL')==0) and (not RUNTIME): TargetAdd('skel.pyd', input='skel_module.obj') TargetAdd('skel.pyd', input='libp3skel_igate.obj') TargetAdd('skel.pyd', input='libpandaskel.dll') + TargetAdd('skel.pyd', input='libp3interrogatedb.dll') TargetAdd('skel.pyd', input=COMMON_PANDA_LIBS) TargetAdd('skel.pyd', opts=['PYTHON']) @@ -4095,6 +4107,7 @@ if (PkgSkip('PANDAFX')==0) and (not RUNTIME): TargetAdd('fx.pyd', input='fx_module.obj') TargetAdd('fx.pyd', input='libp3distort_igate.obj') TargetAdd('fx.pyd', input='libpandafx.dll') + TargetAdd('fx.pyd', input='libp3interrogatedb.dll') TargetAdd('fx.pyd', input=COMMON_PANDA_LIBS) TargetAdd('fx.pyd', opts=['PYTHON']) @@ -4122,6 +4135,7 @@ if (PkgSkip("VRPN")==0 and not RUNTIME): TargetAdd('vrpn.pyd', input='vrpn_module.obj') TargetAdd('vrpn.pyd', input='libp3vrpn_igate.obj') TargetAdd('vrpn.pyd', input='libp3vrpn.dll') + TargetAdd('vrpn.pyd', input='libp3interrogatedb.dll') TargetAdd('vrpn.pyd', input=COMMON_PANDA_LIBS) TargetAdd('vrpn.pyd', opts=['PYTHON']) @@ -4356,6 +4370,7 @@ if (not RUNTIME): TargetAdd('egg.pyd', input='libp3egg_igate.obj') TargetAdd('egg.pyd', input='libp3egg2pg_igate.obj') TargetAdd('egg.pyd', input='libpandaegg.dll') + TargetAdd('egg.pyd', input='libp3interrogatedb.dll') TargetAdd('egg.pyd', input=COMMON_PANDA_LIBS) TargetAdd('egg.pyd', opts=['PYTHON']) @@ -4521,6 +4536,7 @@ if (PkgSkip("ODE")==0 and not RUNTIME): TargetAdd('ode.pyd', input='libpandaode_igate.obj') TargetAdd('ode.pyd', input='p3ode_ext_composite.obj') TargetAdd('ode.pyd', input='libpandaode.dll') + TargetAdd('ode.pyd', input='libp3interrogatedb.dll') TargetAdd('ode.pyd', input=COMMON_PANDA_LIBS) TargetAdd('ode.pyd', opts=['PYTHON', 'WINUSER', 'ODE']) @@ -4557,6 +4573,7 @@ if (PkgSkip("BULLET")==0 and not RUNTIME): TargetAdd('bullet.pyd', input='bullet_module.obj') TargetAdd('bullet.pyd', input='libpandabullet_igate.obj') TargetAdd('bullet.pyd', input='libpandabullet.dll') + TargetAdd('bullet.pyd', input='libp3interrogatedb.dll') TargetAdd('bullet.pyd', input=COMMON_PANDA_LIBS) TargetAdd('bullet.pyd', opts=['PYTHON', 'WINUSER', 'BULLET']) @@ -4595,6 +4612,7 @@ if (PkgSkip("PHYSX")==0): TargetAdd('physx.pyd', input='physx_module.obj') TargetAdd('physx.pyd', input='libpandaphysx_igate.obj') TargetAdd('physx.pyd', input='libpandaphysx.dll') + TargetAdd('physx.pyd', input='libp3interrogatedb.dll') TargetAdd('physx.pyd', input=COMMON_PANDA_LIBS) TargetAdd('physx.pyd', opts=['PYTHON', 'WINUSER', 'PHYSX', 'NOARCH:PPC']) @@ -4662,6 +4680,7 @@ if (PkgSkip("PANDAPHYSICS")==0) and (not RUNTIME): if (PkgSkip("PANDAPARTICLESYSTEM")==0): TargetAdd('physics.pyd', input='libp3particlesystem_igate.obj') TargetAdd('physics.pyd', input='libpandaphysics.dll') + TargetAdd('physics.pyd', input='libp3interrogatedb.dll') TargetAdd('physics.pyd', input=COMMON_PANDA_LIBS) TargetAdd('physics.pyd', opts=['PYTHON']) @@ -4921,6 +4940,7 @@ if (PkgSkip("DIRECT")==0): TargetAdd('_direct.pyd', input='direct_module.obj') TargetAdd('_direct.pyd', input='libp3direct.dll') + TargetAdd('_direct.pyd', input='libp3interrogatedb.dll') TargetAdd('_direct.pyd', input=COMMON_PANDA_LIBS) TargetAdd('_direct.pyd', opts=['PYTHON', 'OPENSSL', 'WINUSER', 'WINGDI']) @@ -6129,6 +6149,7 @@ if (PkgSkip("CONTRIB")==0 and not RUNTIME): TargetAdd('ai.pyd', input='ai_module.obj') TargetAdd('ai.pyd', input='libpandaai_igate.obj') TargetAdd('ai.pyd', input='libpandaai.dll') + TargetAdd('ai.pyd', input='libp3interrogatedb.dll') TargetAdd('ai.pyd', input=COMMON_PANDA_LIBS) TargetAdd('ai.pyd', opts=['PYTHON']) diff --git a/panda/src/express/memoryUsagePointers.h b/panda/src/express/memoryUsagePointers.h index ceab784752..2512ea9f00 100644 --- a/panda/src/express/memoryUsagePointers.h +++ b/panda/src/express/memoryUsagePointers.h @@ -24,13 +24,6 @@ #include "referenceCount.h" #include "pvector.h" -#ifdef HAVE_PYTHON - -#undef _POSIX_C_SOURCE -#include - -#endif // HAVE_PYTHON - //////////////////////////////////////////////////////////////////// // Class : MemoryUsagePointers // Description : This is a list of pointers returned by a MemoryUsage From dd17fd864b40bd0fce781adc3baa79f78c6f6565 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 30 Jun 2015 16:16:35 +0200 Subject: [PATCH 6/6] Properly separate dtoolconfig and interrogatedb --- dtool/metalibs/dtoolconfig/pydtool.cxx | 11 +- dtool/src/dtoolbase/dtoolsymbols.h | 8 + .../src/dtoolutil/p3dtoolutil_composite2.cxx | 1 + .../vector_int.cxx | 4 +- .../{interrogatedb => dtoolutil}/vector_int.h | 4 +- .../src/interrogatedb/config_interrogatedb.h | 2 +- dtool/src/interrogatedb/dtool_super_base.cxx | 2 +- dtool/src/interrogatedb/extension.h | 4 +- dtool/src/interrogatedb/indexRemapper.h | 2 +- .../src/interrogatedb/interrogateComponent.h | 2 +- dtool/src/interrogatedb/interrogateDatabase.h | 2 +- dtool/src/interrogatedb/interrogateElement.h | 2 +- dtool/src/interrogatedb/interrogateFunction.h | 2 +- .../interrogateFunctionWrapper.h | 2 +- dtool/src/interrogatedb/interrogateMakeSeq.h | 2 +- dtool/src/interrogatedb/interrogateManifest.h | 2 +- dtool/src/interrogatedb/interrogateType.h | 2 +- .../src/interrogatedb/interrogate_interface.h | 262 +++++++++--------- dtool/src/interrogatedb/interrogate_request.h | 4 +- .../p3interrogatedb_composite2.cxx | 1 - dtool/src/interrogatedb/py_panda.cxx | 2 +- dtool/src/interrogatedb/py_panda.h | 78 +++--- makepanda/makepanda.py | 46 +-- 23 files changed, 233 insertions(+), 214 deletions(-) rename dtool/src/{interrogatedb => dtoolutil}/vector_int.cxx (91%) rename dtool/src/{interrogatedb => dtoolutil}/vector_int.h (95%) diff --git a/dtool/metalibs/dtoolconfig/pydtool.cxx b/dtool/metalibs/dtoolconfig/pydtool.cxx index 7b3a017b34..bde03f4197 100644 --- a/dtool/metalibs/dtoolconfig/pydtool.cxx +++ b/dtool/metalibs/dtoolconfig/pydtool.cxx @@ -2475,20 +2475,22 @@ static PyMethodDef python_simple_funcs[] = { #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef python_simple_module = { PyModuleDef_HEAD_INIT, - "dtoolconfig", + "interrogatedb", NULL, -1, python_simple_funcs, NULL, NULL, NULL, NULL }; -#define INIT_FUNC PyObject *PyInit_dtoolconfig +#define INIT_FUNC PyObject *PyInit_interrogatedb #else -#define INIT_FUNC void initdtoolconfig +#define INIT_FUNC void initinterrogatedb #endif #ifdef _WIN32 extern "C" __declspec(dllexport) INIT_FUNC(); +#elif __GNUC__ >= 4 +extern "C" __attribute__((visibility("default"))) INIT_FUNC(); #else extern "C" INIT_FUNC(); #endif @@ -2497,7 +2499,6 @@ INIT_FUNC() { #if PY_MAJOR_VERSION >= 3 return PyModule_Create(&python_simple_module); #else - Py_InitModule("dtoolconfig", python_simple_funcs); + Py_InitModule("interrogatedb", python_simple_funcs); #endif } - diff --git a/dtool/src/dtoolbase/dtoolsymbols.h b/dtool/src/dtoolbase/dtoolsymbols.h index 02e976b936..cb4cd7993e 100644 --- a/dtool/src/dtoolbase/dtoolsymbols.h +++ b/dtool/src/dtoolbase/dtoolsymbols.h @@ -86,6 +86,14 @@ #define EXPTP_DTOOLCONFIG IMPORT_TEMPL #endif +#ifdef BUILDING_INTERROGATEDB + #define EXPCL_INTERROGATEDB EXPORT_CLASS + #define EXPTP_INTERROGATEDB EXPORT_TEMPL +#else + #define EXPCL_INTERROGATEDB IMPORT_CLASS + #define EXPTP_INTERROGATEDB IMPORT_TEMPL +#endif + #ifdef BUILDING_MISC #define EXPCL_MISC EXPORT_CLASS #define EXPTP_MISC EXPORT_TEMPL diff --git a/dtool/src/dtoolutil/p3dtoolutil_composite2.cxx b/dtool/src/dtoolutil/p3dtoolutil_composite2.cxx index 289ce8f1e9..2adf532173 100644 --- a/dtool/src/dtoolutil/p3dtoolutil_composite2.cxx +++ b/dtool/src/dtoolutil/p3dtoolutil_composite2.cxx @@ -8,5 +8,6 @@ #include "stringDecoder.cxx" #include "textEncoder.cxx" #include "unicodeLatinMap.cxx" +#include "vector_int.cxx" #include "vector_string.cxx" #include "win32ArgParser.cxx" diff --git a/dtool/src/interrogatedb/vector_int.cxx b/dtool/src/dtoolutil/vector_int.cxx similarity index 91% rename from dtool/src/interrogatedb/vector_int.cxx rename to dtool/src/dtoolutil/vector_int.cxx index 6e829fcd63..4ec1769281 100644 --- a/dtool/src/interrogatedb/vector_int.cxx +++ b/dtool/src/dtoolutil/vector_int.cxx @@ -14,8 +14,8 @@ #include "vector_int.h" -#define EXPCL EXPCL_DTOOLCONFIG -#define EXPTP EXPTP_DTOOLCONFIG +#define EXPCL EXPCL_DTOOL +#define EXPTP EXPTP_DTOOL #define TYPE int #define NAME vector_int diff --git a/dtool/src/interrogatedb/vector_int.h b/dtool/src/dtoolutil/vector_int.h similarity index 95% rename from dtool/src/interrogatedb/vector_int.h rename to dtool/src/dtoolutil/vector_int.h index 65ee50a4a5..af0a7dd981 100644 --- a/dtool/src/interrogatedb/vector_int.h +++ b/dtool/src/dtoolutil/vector_int.h @@ -26,8 +26,8 @@ // rather than defining the vector again. //////////////////////////////////////////////////////////////////// -#define EXPCL EXPCL_DTOOLCONFIG -#define EXPTP EXPTP_DTOOLCONFIG +#define EXPCL EXPCL_DTOOL +#define EXPTP EXPTP_DTOOL #define TYPE int #define NAME vector_int diff --git a/dtool/src/interrogatedb/config_interrogatedb.h b/dtool/src/interrogatedb/config_interrogatedb.h index e088787b9d..6dd0995532 100644 --- a/dtool/src/interrogatedb/config_interrogatedb.h +++ b/dtool/src/interrogatedb/config_interrogatedb.h @@ -19,7 +19,7 @@ #include "notifyCategoryProxy.h" #include "configVariableSearchPath.h" -NotifyCategoryDecl(interrogatedb, EXPCL_DTOOLCONFIG, EXPTP_DTOOLCONFIG); +NotifyCategoryDecl(interrogatedb, EXPCL_INTERROGATEDB, EXPTP_INTERROGATEDB); extern ConfigVariableSearchPath interrogatedb_path; diff --git a/dtool/src/interrogatedb/dtool_super_base.cxx b/dtool/src/interrogatedb/dtool_super_base.cxx index 84334cf4c8..7cdcd21221 100644 --- a/dtool/src/interrogatedb/dtool_super_base.cxx +++ b/dtool/src/interrogatedb/dtool_super_base.cxx @@ -30,7 +30,7 @@ PyMethodDef Dtool_Methods_DTOOL_SUPER_BASE[] = { { NULL, NULL } }; -EXPCL_DTOOLCONFIG void Dtool_PyModuleClassInit_DTOOL_SUPER_BASE(PyObject *module) { +EXPCL_INTERROGATEDB void Dtool_PyModuleClassInit_DTOOL_SUPER_BASE(PyObject *module) { static bool initdone = false; if (!initdone) { diff --git a/dtool/src/interrogatedb/extension.h b/dtool/src/interrogatedb/extension.h index 0d41ef2c60..57728f98bf 100644 --- a/dtool/src/interrogatedb/extension.h +++ b/dtool/src/interrogatedb/extension.h @@ -24,7 +24,7 @@ // be used from the extension method. //////////////////////////////////////////////////////////////////// template -class EXPCL_DTOOLCONFIG ExtensionBase { +class EXPCL_INTERROGATEDB ExtensionBase { public: T * _this; }; @@ -36,7 +36,7 @@ public: // a specialization of this class template. //////////////////////////////////////////////////////////////////// template -class EXPCL_DTOOLCONFIG Extension : public ExtensionBase { +class EXPCL_INTERROGATEDB Extension : public ExtensionBase { }; //////////////////////////////////////////////////////////////////// diff --git a/dtool/src/interrogatedb/indexRemapper.h b/dtool/src/interrogatedb/indexRemapper.h index da2efc023f..61aa67ccc5 100644 --- a/dtool/src/interrogatedb/indexRemapper.h +++ b/dtool/src/interrogatedb/indexRemapper.h @@ -30,7 +30,7 @@ // only reason it exists is because Microsoft can't // export STL map outside of the DLL. //////////////////////////////////////////////////////////////////// -class EXPCL_DTOOLCONFIG IndexRemapper { +class EXPCL_INTERROGATEDB IndexRemapper { public: IndexRemapper(); ~IndexRemapper(); diff --git a/dtool/src/interrogatedb/interrogateComponent.h b/dtool/src/interrogatedb/interrogateComponent.h index 6ad6bcd806..e1820806d3 100644 --- a/dtool/src/interrogatedb/interrogateComponent.h +++ b/dtool/src/interrogatedb/interrogateComponent.h @@ -30,7 +30,7 @@ class IndexRemapper; // interrogate database. This includes types, // functions, and function wrappers. //////////////////////////////////////////////////////////////////// -class EXPCL_DTOOLCONFIG InterrogateComponent { +class EXPCL_INTERROGATEDB InterrogateComponent { public: INLINE InterrogateComponent(InterrogateModuleDef *def = NULL); INLINE InterrogateComponent(const InterrogateComponent ©); diff --git a/dtool/src/interrogatedb/interrogateDatabase.h b/dtool/src/interrogatedb/interrogateDatabase.h index 8a6a313802..893fa23ba4 100644 --- a/dtool/src/interrogatedb/interrogateDatabase.h +++ b/dtool/src/interrogatedb/interrogateDatabase.h @@ -35,7 +35,7 @@ class IndexRemapper; // Description : This stores all of the interrogate data and handles // reading the data from a disk file when necessary. //////////////////////////////////////////////////////////////////// -class EXPCL_DTOOLCONFIG InterrogateDatabase { +class EXPCL_INTERROGATEDB InterrogateDatabase { private: InterrogateDatabase(); diff --git a/dtool/src/interrogatedb/interrogateElement.h b/dtool/src/interrogatedb/interrogateElement.h index 863e502545..52d4f25b28 100644 --- a/dtool/src/interrogatedb/interrogateElement.h +++ b/dtool/src/interrogatedb/interrogateElement.h @@ -26,7 +26,7 @@ class IndexRemapper; // Description : An internal representation of a data element, like a // data member or a global variable. //////////////////////////////////////////////////////////////////// -class EXPCL_DTOOLCONFIG InterrogateElement : public InterrogateComponent { +class EXPCL_INTERROGATEDB InterrogateElement : public InterrogateComponent { public: INLINE InterrogateElement(InterrogateModuleDef *def = NULL); INLINE InterrogateElement(const InterrogateElement ©); diff --git a/dtool/src/interrogatedb/interrogateFunction.h b/dtool/src/interrogatedb/interrogateFunction.h index 676eb53cf7..04132814f8 100644 --- a/dtool/src/interrogatedb/interrogateFunction.h +++ b/dtool/src/interrogatedb/interrogateFunction.h @@ -29,7 +29,7 @@ class CPPInstance; // Class : InterrogateFunction // Description : An internal representation of a function. //////////////////////////////////////////////////////////////////// -class EXPCL_DTOOLCONFIG InterrogateFunction : public InterrogateComponent { +class EXPCL_INTERROGATEDB InterrogateFunction : public InterrogateComponent { public: InterrogateFunction(InterrogateModuleDef *def = NULL); InterrogateFunction(const InterrogateFunction ©); diff --git a/dtool/src/interrogatedb/interrogateFunctionWrapper.h b/dtool/src/interrogatedb/interrogateFunctionWrapper.h index 4eeae4d600..282b989961 100644 --- a/dtool/src/interrogatedb/interrogateFunctionWrapper.h +++ b/dtool/src/interrogatedb/interrogateFunctionWrapper.h @@ -27,7 +27,7 @@ class IndexRemapper; // Class : InterrogateFunctionWrapper // Description : An internal representation of a callable function. //////////////////////////////////////////////////////////////////// -class EXPCL_DTOOLCONFIG InterrogateFunctionWrapper : public InterrogateComponent { +class EXPCL_INTERROGATEDB InterrogateFunctionWrapper : public InterrogateComponent { public: INLINE InterrogateFunctionWrapper(InterrogateModuleDef *def = NULL); INLINE InterrogateFunctionWrapper(const InterrogateFunctionWrapper ©); diff --git a/dtool/src/interrogatedb/interrogateMakeSeq.h b/dtool/src/interrogatedb/interrogateMakeSeq.h index 5ce472d4bf..bd991f71ca 100644 --- a/dtool/src/interrogatedb/interrogateMakeSeq.h +++ b/dtool/src/interrogatedb/interrogateMakeSeq.h @@ -26,7 +26,7 @@ class IndexRemapper; // Description : Represents a synthetic method created via the // MAKE_SEQ() macro. //////////////////////////////////////////////////////////////////// -class EXPCL_DTOOLCONFIG InterrogateMakeSeq : public InterrogateComponent { +class EXPCL_INTERROGATEDB InterrogateMakeSeq : public InterrogateComponent { public: INLINE InterrogateMakeSeq(InterrogateModuleDef *def = NULL); INLINE InterrogateMakeSeq(const InterrogateMakeSeq ©); diff --git a/dtool/src/interrogatedb/interrogateManifest.h b/dtool/src/interrogatedb/interrogateManifest.h index d6d5d00192..4011868953 100644 --- a/dtool/src/interrogatedb/interrogateManifest.h +++ b/dtool/src/interrogatedb/interrogateManifest.h @@ -25,7 +25,7 @@ class IndexRemapper; // Class : InterrogateManifest // Description : An internal representation of a manifest constant. //////////////////////////////////////////////////////////////////// -class EXPCL_DTOOLCONFIG InterrogateManifest : public InterrogateComponent { +class EXPCL_INTERROGATEDB InterrogateManifest : public InterrogateComponent { public: INLINE InterrogateManifest(InterrogateModuleDef *def = NULL); INLINE InterrogateManifest(const InterrogateManifest ©); diff --git a/dtool/src/interrogatedb/interrogateType.h b/dtool/src/interrogatedb/interrogateType.h index 365c2a2d40..5a6a88b311 100644 --- a/dtool/src/interrogatedb/interrogateType.h +++ b/dtool/src/interrogatedb/interrogateType.h @@ -29,7 +29,7 @@ class CPPScope; // Class : InterrogateType // Description : An internal representation of a type. //////////////////////////////////////////////////////////////////// -class EXPCL_DTOOLCONFIG InterrogateType : public InterrogateComponent { +class EXPCL_INTERROGATEDB InterrogateType : public InterrogateComponent { public: InterrogateType(InterrogateModuleDef *def = NULL); InterrogateType(const InterrogateType ©); diff --git a/dtool/src/interrogatedb/interrogate_interface.h b/dtool/src/interrogatedb/interrogate_interface.h index c1e615556f..9cbe879339 100644 --- a/dtool/src/interrogatedb/interrogate_interface.h +++ b/dtool/src/interrogatedb/interrogate_interface.h @@ -87,9 +87,9 @@ enum AtomicToken { AT_longlong = 8 }; -EXPCL_DTOOLCONFIG void interrogate_add_search_directory(const char *dirname); -EXPCL_DTOOLCONFIG void interrogate_add_search_path(const char *pathstring); -EXPCL_DTOOLCONFIG bool interrogate_error_flag(); +EXPCL_INTERROGATEDB void interrogate_add_search_directory(const char *dirname); +EXPCL_INTERROGATEDB void interrogate_add_search_path(const char *pathstring); +EXPCL_INTERROGATEDB bool interrogate_error_flag(); ////////////////////////////////////////////////////////////////////////// // @@ -107,23 +107,23 @@ EXPCL_DTOOLCONFIG bool interrogate_error_flag(); // (whatever type interrogate thinks it is), as returned by the getter // function given by interrogate_manifest_getter(). -EXPCL_DTOOLCONFIG int interrogate_number_of_manifests(); -EXPCL_DTOOLCONFIG ManifestIndex interrogate_get_manifest(int n); -EXPCL_DTOOLCONFIG ManifestIndex interrogate_get_manifest_by_name(const char *manifest_name); -EXPCL_DTOOLCONFIG const char *interrogate_manifest_name(ManifestIndex manifest); -EXPCL_DTOOLCONFIG const char *interrogate_manifest_definition(ManifestIndex manifest); -EXPCL_DTOOLCONFIG bool interrogate_manifest_has_type(ManifestIndex manifest); -EXPCL_DTOOLCONFIG TypeIndex interrogate_manifest_get_type(ManifestIndex manifest); -EXPCL_DTOOLCONFIG bool interrogate_manifest_has_getter(ManifestIndex manifest); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_manifest_getter(ManifestIndex manifest); +EXPCL_INTERROGATEDB int interrogate_number_of_manifests(); +EXPCL_INTERROGATEDB ManifestIndex interrogate_get_manifest(int n); +EXPCL_INTERROGATEDB ManifestIndex interrogate_get_manifest_by_name(const char *manifest_name); +EXPCL_INTERROGATEDB const char *interrogate_manifest_name(ManifestIndex manifest); +EXPCL_INTERROGATEDB const char *interrogate_manifest_definition(ManifestIndex manifest); +EXPCL_INTERROGATEDB bool interrogate_manifest_has_type(ManifestIndex manifest); +EXPCL_INTERROGATEDB TypeIndex interrogate_manifest_get_type(ManifestIndex manifest); +EXPCL_INTERROGATEDB bool interrogate_manifest_has_getter(ManifestIndex manifest); +EXPCL_INTERROGATEDB FunctionIndex interrogate_manifest_getter(ManifestIndex manifest); // An exception is made for manifest constants that have an integer // type value, since these are so common. The scripting language can // query these values directly, which saves having to generate a // wrapper function for each stupid little manifest. In this case, // there will be no getter function available. -EXPCL_DTOOLCONFIG bool interrogate_manifest_has_int_value(ManifestIndex manifest); -EXPCL_DTOOLCONFIG int interrogate_manifest_get_int_value(ManifestIndex manifest); +EXPCL_INTERROGATEDB bool interrogate_manifest_has_int_value(ManifestIndex manifest); +EXPCL_INTERROGATEDB int interrogate_manifest_get_int_value(ManifestIndex manifest); ////////////////////////////////////////////////////////////////////////// @@ -136,12 +136,12 @@ EXPCL_DTOOLCONFIG int interrogate_manifest_get_int_value(ManifestIndex manifest) // elements. Interrogate automatically generates a getter function // and, if possible, a setter function. -EXPCL_DTOOLCONFIG const char *interrogate_element_name(ElementIndex element); -EXPCL_DTOOLCONFIG const char *interrogate_element_scoped_name(ElementIndex element); -EXPCL_DTOOLCONFIG bool interrogate_element_has_comment(ElementIndex element); -EXPCL_DTOOLCONFIG const char *interrogate_element_comment(ElementIndex element); -EXPCL_DTOOLCONFIG ElementIndex interrogate_get_element_by_name(const char *element_name); -EXPCL_DTOOLCONFIG ElementIndex interrogate_get_element_by_scoped_name(const char *element_name); +EXPCL_INTERROGATEDB const char *interrogate_element_name(ElementIndex element); +EXPCL_INTERROGATEDB const char *interrogate_element_scoped_name(ElementIndex element); +EXPCL_INTERROGATEDB bool interrogate_element_has_comment(ElementIndex element); +EXPCL_INTERROGATEDB const char *interrogate_element_comment(ElementIndex element); +EXPCL_INTERROGATEDB ElementIndex interrogate_get_element_by_name(const char *element_name); +EXPCL_INTERROGATEDB ElementIndex interrogate_get_element_by_scoped_name(const char *element_name); // Be careful with this function. The element's bare type is not // likely to be directly useful to the scripting language. This is a @@ -151,12 +151,12 @@ EXPCL_DTOOLCONFIG ElementIndex interrogate_get_element_by_scoped_name(const char // scripting language can't handle directly, e.g. a Node, while the // getter will return (and the setter accept) a pointer to a Node, // which is what the scripting language actually works with. -EXPCL_DTOOLCONFIG TypeIndex interrogate_element_type(ElementIndex element); +EXPCL_INTERROGATEDB TypeIndex interrogate_element_type(ElementIndex element); -EXPCL_DTOOLCONFIG bool interrogate_element_has_getter(ElementIndex element); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_element_getter(ElementIndex element); -EXPCL_DTOOLCONFIG bool interrogate_element_has_setter(ElementIndex element); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_element_setter(ElementIndex element); +EXPCL_INTERROGATEDB bool interrogate_element_has_getter(ElementIndex element); +EXPCL_INTERROGATEDB FunctionIndex interrogate_element_getter(ElementIndex element); +EXPCL_INTERROGATEDB bool interrogate_element_has_setter(ElementIndex element); +EXPCL_INTERROGATEDB FunctionIndex interrogate_element_setter(ElementIndex element); ////////////////////////////////////////////////////////////////////////// // @@ -166,8 +166,8 @@ EXPCL_DTOOLCONFIG FunctionIndex interrogate_element_setter(ElementIndex element) // This is the list of global data elements. -EXPCL_DTOOLCONFIG int interrogate_number_of_globals(); -EXPCL_DTOOLCONFIG ElementIndex interrogate_get_global(int n); +EXPCL_INTERROGATEDB int interrogate_number_of_globals(); +EXPCL_INTERROGATEDB ElementIndex interrogate_get_global(int n); ////////////////////////////////////////////////////////////////////////// // @@ -183,16 +183,16 @@ EXPCL_DTOOLCONFIG ElementIndex interrogate_get_global(int n); // These are the global (nonmember) functions that appear outside of // any class definition. -EXPCL_DTOOLCONFIG int interrogate_number_of_global_functions(); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_get_global_function(int n); +EXPCL_INTERROGATEDB int interrogate_number_of_global_functions(); +EXPCL_INTERROGATEDB FunctionIndex interrogate_get_global_function(int n); // This can be used to traverse through *all* the functions known to // interrogate. It's usually not what you want, since this includes // global functions, class methods, and synthesized functions like // upcasts and downcasts. You probably want to use instead // interrogate_number_of_global_functions(), above. -EXPCL_DTOOLCONFIG int interrogate_number_of_functions(); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_get_function(int n); +EXPCL_INTERROGATEDB int interrogate_number_of_functions(); +EXPCL_INTERROGATEDB FunctionIndex interrogate_get_function(int n); // This is the function's name. It is not unique; it may be shared // between multiple different functions that have the same name but @@ -200,42 +200,42 @@ EXPCL_DTOOLCONFIG FunctionIndex interrogate_get_function(int n); // Two different classes might also have member functions that have // the same name, or the same name as a global function (but also see // the scoped_name, below). -EXPCL_DTOOLCONFIG const char *interrogate_function_name(FunctionIndex function); +EXPCL_INTERROGATEDB const char *interrogate_function_name(FunctionIndex function); // The scoped name is the function name prefixed with the name of the // class that includes the function, if the function is a class // method. If it is a global function, the scoped name is the same as // the name returned above. In the absence of C++ function // overloading, this name will be unique to each function. -EXPCL_DTOOLCONFIG const char *interrogate_function_scoped_name(FunctionIndex function); +EXPCL_INTERROGATEDB const char *interrogate_function_scoped_name(FunctionIndex function); // This returns the C++ comment written for the function, either in // the header file or in the .C file, or both. -EXPCL_DTOOLCONFIG bool interrogate_function_has_comment(FunctionIndex function); -EXPCL_DTOOLCONFIG const char *interrogate_function_comment(FunctionIndex function); +EXPCL_INTERROGATEDB bool interrogate_function_has_comment(FunctionIndex function); +EXPCL_INTERROGATEDB const char *interrogate_function_comment(FunctionIndex function); // This defines the function prototype as it appears in the C++ // source, useful primarily for documentation purposes. -EXPCL_DTOOLCONFIG const char *interrogate_function_prototype(FunctionIndex function); +EXPCL_INTERROGATEDB const char *interrogate_function_prototype(FunctionIndex function); // This can be used to determine the class that the function is a // method for, if the function is a class method. -EXPCL_DTOOLCONFIG bool interrogate_function_is_method(FunctionIndex function); -EXPCL_DTOOLCONFIG TypeIndex interrogate_function_class(FunctionIndex function); +EXPCL_INTERROGATEDB bool interrogate_function_is_method(FunctionIndex function); +EXPCL_INTERROGATEDB TypeIndex interrogate_function_class(FunctionIndex function); // This returns the module name reported for the function, if // available. -EXPCL_DTOOLCONFIG bool interrogate_function_has_module_name(FunctionIndex function); -EXPCL_DTOOLCONFIG const char *interrogate_function_module_name(FunctionIndex function); +EXPCL_INTERROGATEDB bool interrogate_function_has_module_name(FunctionIndex function); +EXPCL_INTERROGATEDB const char *interrogate_function_module_name(FunctionIndex function); // This returns the library name reported for the function, if // available. -EXPCL_DTOOLCONFIG bool interrogate_function_has_library_name(FunctionIndex function); -EXPCL_DTOOLCONFIG const char *interrogate_function_library_name(FunctionIndex function); +EXPCL_INTERROGATEDB bool interrogate_function_has_library_name(FunctionIndex function); +EXPCL_INTERROGATEDB const char *interrogate_function_library_name(FunctionIndex function); // This is true for virtual member functions. It's not likely that // this will be important to the scripting language. -EXPCL_DTOOLCONFIG bool interrogate_function_is_virtual(FunctionIndex function); +EXPCL_INTERROGATEDB bool interrogate_function_is_virtual(FunctionIndex function); // The actual callable function interface is defined via one or more @@ -246,11 +246,11 @@ EXPCL_DTOOLCONFIG bool interrogate_function_is_virtual(FunctionIndex function); // calling convention or the Python calling convention. The set of // wrappers that will actually be available depends on the parameters // passed to the interrogate command line. -EXPCL_DTOOLCONFIG int interrogate_function_number_of_c_wrappers(FunctionIndex function); -EXPCL_DTOOLCONFIG FunctionWrapperIndex interrogate_function_c_wrapper(FunctionIndex function, int n); +EXPCL_INTERROGATEDB int interrogate_function_number_of_c_wrappers(FunctionIndex function); +EXPCL_INTERROGATEDB FunctionWrapperIndex interrogate_function_c_wrapper(FunctionIndex function, int n); -EXPCL_DTOOLCONFIG int interrogate_function_number_of_python_wrappers(FunctionIndex function); -EXPCL_DTOOLCONFIG FunctionWrapperIndex interrogate_function_python_wrapper(FunctionIndex function, int n); +EXPCL_INTERROGATEDB int interrogate_function_number_of_python_wrappers(FunctionIndex function); +EXPCL_INTERROGATEDB FunctionWrapperIndex interrogate_function_python_wrapper(FunctionIndex function, int n); ////////////////////////////////////////////////////////////////////////// // @@ -273,17 +273,17 @@ EXPCL_DTOOLCONFIG FunctionWrapperIndex interrogate_function_python_wrapper(Funct // Don't confuse this with the unique_name, below. The two are // related, but not identical. -EXPCL_DTOOLCONFIG const char *interrogate_wrapper_name(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB const char *interrogate_wrapper_name(FunctionWrapperIndex wrapper); // This returns true if -fnames was given to interrogate, making the // wrapper function callable directly by its name. -EXPCL_DTOOLCONFIG bool interrogate_wrapper_is_callable_by_name(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB bool interrogate_wrapper_is_callable_by_name(FunctionWrapperIndex wrapper); // This returns the C++ comment written for the function wrapper, // usually from the .cpp file. There may be a different comment for // each overload of a given function. -EXPCL_DTOOLCONFIG bool interrogate_wrapper_has_comment(FunctionWrapperIndex wrapper); -EXPCL_DTOOLCONFIG const char *interrogate_wrapper_comment(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB bool interrogate_wrapper_has_comment(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB const char *interrogate_wrapper_comment(FunctionWrapperIndex wrapper); // Every function wrapper has zero or more parameters and may or may // not have a return value. Each parameter has a type and may or may @@ -293,8 +293,8 @@ EXPCL_DTOOLCONFIG const char *interrogate_wrapper_comment(FunctionWrapperIndex w // its first parameter, it is a static member function, also called a // class method.) -EXPCL_DTOOLCONFIG bool interrogate_wrapper_has_return_value(FunctionWrapperIndex wrapper); -EXPCL_DTOOLCONFIG TypeIndex interrogate_wrapper_return_type(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB bool interrogate_wrapper_has_return_value(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB TypeIndex interrogate_wrapper_return_type(FunctionWrapperIndex wrapper); // Sometimes interrogate must synthesize a wrapper that allocates its // return value from the free store. Other times (especially if @@ -309,15 +309,15 @@ EXPCL_DTOOLCONFIG TypeIndex interrogate_wrapper_return_type(FunctionWrapperIndex // that for the class). Otherwise, this function will return false, // and the scripting language should *not* call any destructor on this // value. -EXPCL_DTOOLCONFIG bool interrogate_wrapper_caller_manages_return_value(FunctionWrapperIndex wrapper); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_wrapper_return_value_destructor(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB bool interrogate_wrapper_caller_manages_return_value(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB FunctionIndex interrogate_wrapper_return_value_destructor(FunctionWrapperIndex wrapper); // These define the parameters of the function. -EXPCL_DTOOLCONFIG int interrogate_wrapper_number_of_parameters(FunctionWrapperIndex wrapper); -EXPCL_DTOOLCONFIG TypeIndex interrogate_wrapper_parameter_type(FunctionWrapperIndex wrapper, int n); -EXPCL_DTOOLCONFIG bool interrogate_wrapper_parameter_has_name(FunctionWrapperIndex wrapper, int n); -EXPCL_DTOOLCONFIG const char *interrogate_wrapper_parameter_name(FunctionWrapperIndex wrapper, int n); -EXPCL_DTOOLCONFIG bool interrogate_wrapper_parameter_is_this(FunctionWrapperIndex wrapper, int n); +EXPCL_INTERROGATEDB int interrogate_wrapper_number_of_parameters(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB TypeIndex interrogate_wrapper_parameter_type(FunctionWrapperIndex wrapper, int n); +EXPCL_INTERROGATEDB bool interrogate_wrapper_parameter_has_name(FunctionWrapperIndex wrapper, int n); +EXPCL_INTERROGATEDB const char *interrogate_wrapper_parameter_name(FunctionWrapperIndex wrapper, int n); +EXPCL_INTERROGATEDB bool interrogate_wrapper_parameter_is_this(FunctionWrapperIndex wrapper, int n); // This returns a pointer to a function that may be called to invoke // the function, if the -fptrs option to return function pointers was @@ -327,8 +327,8 @@ EXPCL_DTOOLCONFIG bool interrogate_wrapper_parameter_is_this(FunctionWrapperInde // These two functions may be called without forcing a load of the // complete interrogate database. -EXPCL_DTOOLCONFIG bool interrogate_wrapper_has_pointer(FunctionWrapperIndex wrapper); -EXPCL_DTOOLCONFIG void *interrogate_wrapper_pointer(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB bool interrogate_wrapper_has_pointer(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB void *interrogate_wrapper_pointer(FunctionWrapperIndex wrapper); // This function will return a name that is guaranteed to be unique to // this particular function wrapper, and that will (usually) be @@ -339,7 +339,7 @@ EXPCL_DTOOLCONFIG void *interrogate_wrapper_pointer(FunctionWrapperIndex wrapper // The unique name is an ugly hashed name, not safe for human // consumption. Its sole purpose is to provide some consistent way to // identify function wrappers between sessions. -EXPCL_DTOOLCONFIG const char *interrogate_wrapper_unique_name(FunctionWrapperIndex wrapper); +EXPCL_INTERROGATEDB const char *interrogate_wrapper_unique_name(FunctionWrapperIndex wrapper); // This function provides a reverse-lookup on the above unique name, // returning the wrapper index corresponding to the given name. It @@ -349,7 +349,7 @@ EXPCL_DTOOLCONFIG const char *interrogate_wrapper_unique_name(FunctionWrapperInd // This function may be called without forcing a load of the complete // interrogate database. -EXPCL_DTOOLCONFIG FunctionWrapperIndex interrogate_get_wrapper_by_unique_name(const char *unique_name); +EXPCL_INTERROGATEDB FunctionWrapperIndex interrogate_get_wrapper_by_unique_name(const char *unique_name); ////////////////////////////////////////////////////////////////////////// // @@ -364,14 +364,14 @@ EXPCL_DTOOLCONFIG FunctionWrapperIndex interrogate_get_wrapper_by_unique_name(co // get_things(). // The class of which the make_seq is a method. -EXPCL_DTOOLCONFIG TypeIndex interrogate_make_seq_class(MakeSeqIndex make_seq); +EXPCL_INTERROGATEDB TypeIndex interrogate_make_seq_class(MakeSeqIndex make_seq); // The name of the syntheized method, e.g. "get_things" -EXPCL_DTOOLCONFIG const char *interrogate_make_seq_seq_name(MakeSeqIndex make_seq); +EXPCL_INTERROGATEDB const char *interrogate_make_seq_seq_name(MakeSeqIndex make_seq); // The name of the real method that returns the length, e.g. "get_num_things" -EXPCL_DTOOLCONFIG const char *interrogate_make_seq_num_name(MakeSeqIndex make_seq); +EXPCL_INTERROGATEDB const char *interrogate_make_seq_num_name(MakeSeqIndex make_seq); // The name of the real method that returns the nth element, e.g. "get_thing" -EXPCL_DTOOLCONFIG const char *interrogate_make_seq_element_name(MakeSeqIndex make_seq); +EXPCL_INTERROGATEDB const char *interrogate_make_seq_element_name(MakeSeqIndex make_seq); ////////////////////////////////////////////////////////////////////////// @@ -393,16 +393,16 @@ EXPCL_DTOOLCONFIG const char *interrogate_make_seq_element_name(MakeSeqIndex mak // classes. These types are necessary to fully define all of the // function parameters, but need not themselves be wrapped. -EXPCL_DTOOLCONFIG int interrogate_number_of_global_types(); -EXPCL_DTOOLCONFIG TypeIndex interrogate_get_global_type(int n); -EXPCL_DTOOLCONFIG int interrogate_number_of_types(); -EXPCL_DTOOLCONFIG TypeIndex interrogate_get_type(int n); -EXPCL_DTOOLCONFIG TypeIndex interrogate_get_type_by_name(const char *type_name); -EXPCL_DTOOLCONFIG TypeIndex interrogate_get_type_by_scoped_name(const char *type_name); -EXPCL_DTOOLCONFIG TypeIndex interrogate_get_type_by_true_name(const char *type_name); -EXPCL_DTOOLCONFIG const char *interrogate_type_name(TypeIndex type); -EXPCL_DTOOLCONFIG const char *interrogate_type_scoped_name(TypeIndex type); -EXPCL_DTOOLCONFIG const char *interrogate_type_true_name(TypeIndex type); +EXPCL_INTERROGATEDB int interrogate_number_of_global_types(); +EXPCL_INTERROGATEDB TypeIndex interrogate_get_global_type(int n); +EXPCL_INTERROGATEDB int interrogate_number_of_types(); +EXPCL_INTERROGATEDB TypeIndex interrogate_get_type(int n); +EXPCL_INTERROGATEDB TypeIndex interrogate_get_type_by_name(const char *type_name); +EXPCL_INTERROGATEDB TypeIndex interrogate_get_type_by_scoped_name(const char *type_name); +EXPCL_INTERROGATEDB TypeIndex interrogate_get_type_by_true_name(const char *type_name); +EXPCL_INTERROGATEDB const char *interrogate_type_name(TypeIndex type); +EXPCL_INTERROGATEDB const char *interrogate_type_scoped_name(TypeIndex type); +EXPCL_INTERROGATEDB const char *interrogate_type_true_name(TypeIndex type); // A given type might be a nested type, meaning it is entirely defined // within (and scoped within) some different C++ class. In this case, @@ -410,32 +410,32 @@ EXPCL_DTOOLCONFIG const char *interrogate_type_true_name(TypeIndex type); // within the class, while the scoped_name() will return the // fully-qualified name of the type, and is_nested() and outer_class() // can be used to determine the class it is nested within. -EXPCL_DTOOLCONFIG bool interrogate_type_is_nested(TypeIndex type); -EXPCL_DTOOLCONFIG TypeIndex interrogate_type_outer_class(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_nested(TypeIndex type); +EXPCL_INTERROGATEDB TypeIndex interrogate_type_outer_class(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_has_comment(TypeIndex type); -EXPCL_DTOOLCONFIG const char *interrogate_type_comment(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_has_comment(TypeIndex type); +EXPCL_INTERROGATEDB const char *interrogate_type_comment(TypeIndex type); // This returns the module name reported for the type, if available. -EXPCL_DTOOLCONFIG bool interrogate_type_has_module_name(TypeIndex type); -EXPCL_DTOOLCONFIG const char *interrogate_type_module_name(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_has_module_name(TypeIndex type); +EXPCL_INTERROGATEDB const char *interrogate_type_module_name(TypeIndex type); // This returns the library name reported for the type, if available. -EXPCL_DTOOLCONFIG bool interrogate_type_has_library_name(TypeIndex type); -EXPCL_DTOOLCONFIG const char *interrogate_type_library_name(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_has_library_name(TypeIndex type); +EXPCL_INTERROGATEDB const char *interrogate_type_library_name(TypeIndex type); // If interrogate_type_is_atomic() returns true, the type is one of // the basic C types enumerated in AtomicToken, above. The type may // then be further modified by one or more of unsigned, signed, long, // longlong, or short. However, it will not be a pointer. -EXPCL_DTOOLCONFIG bool interrogate_type_is_atomic(TypeIndex type); -EXPCL_DTOOLCONFIG AtomicToken interrogate_type_atomic_token(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_is_unsigned(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_is_signed(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_is_long(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_is_longlong(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_is_short(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_atomic(TypeIndex type); +EXPCL_INTERROGATEDB AtomicToken interrogate_type_atomic_token(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_unsigned(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_signed(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_long(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_longlong(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_short(TypeIndex type); // If interrogate_type_is_wrapped() returns true, this is a composite // type "wrapped" around some simpler type, for instance a pointer to @@ -444,21 +444,21 @@ EXPCL_DTOOLCONFIG bool interrogate_type_is_short(TypeIndex type); // they use multiple wrappers. A const char pointer, for example, is // represented as a pointer wrapper around a const wrapper around an // atomic char.) -EXPCL_DTOOLCONFIG bool interrogate_type_is_wrapped(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_is_pointer(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_is_const(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_is_typedef(TypeIndex type); -EXPCL_DTOOLCONFIG TypeIndex interrogate_type_wrapped_type(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_wrapped(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_pointer(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_const(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_typedef(TypeIndex type); +EXPCL_INTERROGATEDB TypeIndex interrogate_type_wrapped_type(TypeIndex type); // If interrogate_type_is_enum() returns true, this is an enumerated // type, which means it may take any one of a number of named integer // values. -EXPCL_DTOOLCONFIG bool interrogate_type_is_enum(TypeIndex type); -EXPCL_DTOOLCONFIG int interrogate_type_number_of_enum_values(TypeIndex type); -EXPCL_DTOOLCONFIG const char *interrogate_type_enum_value_name(TypeIndex type, int n); -EXPCL_DTOOLCONFIG const char *interrogate_type_enum_value_scoped_name(TypeIndex type, int n); -EXPCL_DTOOLCONFIG const char *interrogate_type_enum_value_comment(TypeIndex type, int n); -EXPCL_DTOOLCONFIG int interrogate_type_enum_value(TypeIndex type, int n); +EXPCL_INTERROGATEDB bool interrogate_type_is_enum(TypeIndex type); +EXPCL_INTERROGATEDB int interrogate_type_number_of_enum_values(TypeIndex type); +EXPCL_INTERROGATEDB const char *interrogate_type_enum_value_name(TypeIndex type, int n); +EXPCL_INTERROGATEDB const char *interrogate_type_enum_value_scoped_name(TypeIndex type, int n); +EXPCL_INTERROGATEDB const char *interrogate_type_enum_value_comment(TypeIndex type, int n); +EXPCL_INTERROGATEDB int interrogate_type_enum_value(TypeIndex type, int n); // If none of the above is true, the type is some extension type. It // may be a struct, class, or union (and the distinction between these @@ -466,19 +466,19 @@ EXPCL_DTOOLCONFIG int interrogate_type_enum_value(TypeIndex type, int n); // any case, it may contain zero or more constructors, zero or one // destructor, zero or more member functions, and zero or more data // members; all of the remaining type functions may apply. -EXPCL_DTOOLCONFIG bool interrogate_type_is_struct(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_is_class(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_is_union(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_struct(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_class(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_union(TypeIndex type); // If is_fully_defined() returns false, this class/struct was a // forward reference, and we really don't know anything about it. (In // this case, it will appear to have no methods or members.) -EXPCL_DTOOLCONFIG bool interrogate_type_is_fully_defined(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_fully_defined(TypeIndex type); // If is_unpublished() returns false, the class/struct is unknown // because it was not marked to be published (or, in promiscuous mode, // it is a protected or private nested class). -EXPCL_DTOOLCONFIG bool interrogate_type_is_unpublished(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_is_unpublished(TypeIndex type); // Otherwise, especially if the type is a struct or class, we may have // a number of member functions, including zero or more constructors @@ -499,36 +499,36 @@ EXPCL_DTOOLCONFIG bool interrogate_type_is_unpublished(TypeIndex type); // same function index as the one returned by the ancestor class, and // interrogate_type_destructor_is_inherited() will return true for // this class. -EXPCL_DTOOLCONFIG int interrogate_type_number_of_constructors(TypeIndex type); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_type_get_constructor(TypeIndex type, int n); -EXPCL_DTOOLCONFIG bool interrogate_type_has_destructor(TypeIndex type); -EXPCL_DTOOLCONFIG bool interrogate_type_destructor_is_inherited(TypeIndex type); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_type_get_destructor(TypeIndex type); +EXPCL_INTERROGATEDB int interrogate_type_number_of_constructors(TypeIndex type); +EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_constructor(TypeIndex type, int n); +EXPCL_INTERROGATEDB bool interrogate_type_has_destructor(TypeIndex type); +EXPCL_INTERROGATEDB bool interrogate_type_destructor_is_inherited(TypeIndex type); +EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_destructor(TypeIndex type); // This is the set of exposed data elements in the struct or class. -EXPCL_DTOOLCONFIG int interrogate_type_number_of_elements(TypeIndex type); -EXPCL_DTOOLCONFIG ElementIndex interrogate_type_get_element(TypeIndex type, int n); +EXPCL_INTERROGATEDB int interrogate_type_number_of_elements(TypeIndex type); +EXPCL_INTERROGATEDB ElementIndex interrogate_type_get_element(TypeIndex type, int n); // This is the set of exposed member functions in the struct or class. -EXPCL_DTOOLCONFIG int interrogate_type_number_of_methods(TypeIndex type); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_type_get_method(TypeIndex type, int n); +EXPCL_INTERROGATEDB int interrogate_type_number_of_methods(TypeIndex type); +EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_method(TypeIndex type, int n); // This is the set of MAKE_SEQ wrappers in the struct or class. -EXPCL_DTOOLCONFIG int interrogate_type_number_of_make_seqs(TypeIndex type); -EXPCL_DTOOLCONFIG MakeSeqIndex interrogate_type_get_make_seq(TypeIndex type, int n); +EXPCL_INTERROGATEDB int interrogate_type_number_of_make_seqs(TypeIndex type); +EXPCL_INTERROGATEDB MakeSeqIndex interrogate_type_get_make_seq(TypeIndex type, int n); // A C++ class may also define a number of explicit cast operators, // which define how to convert an object of this type to an object of // some other type (the type can be inferred by the return type of the // cast function). This is not related to upcast and downcast, // defined below. -EXPCL_DTOOLCONFIG int interrogate_type_number_of_casts(TypeIndex type); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_type_get_cast(TypeIndex type, int n); +EXPCL_INTERROGATEDB int interrogate_type_number_of_casts(TypeIndex type); +EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_cast(TypeIndex type, int n); // A C++ class may inherit from zero or more base classes. This // defines the list of base classes for this particular type. -EXPCL_DTOOLCONFIG int interrogate_type_number_of_derivations(TypeIndex type); -EXPCL_DTOOLCONFIG TypeIndex interrogate_type_get_derivation(TypeIndex type, int n); +EXPCL_INTERROGATEDB int interrogate_type_number_of_derivations(TypeIndex type); +EXPCL_INTERROGATEDB TypeIndex interrogate_type_get_derivation(TypeIndex type, int n); // For each base class, we might need to define an explicit upcast or // downcast operation to convert the pointer to the derived class to @@ -544,8 +544,8 @@ EXPCL_DTOOLCONFIG TypeIndex interrogate_type_get_derivation(TypeIndex type, int // class. If this returns false, you may simply use the same pointer // as either a derived class pointer or a base class pointer without // any extra step. -EXPCL_DTOOLCONFIG bool interrogate_type_derivation_has_upcast(TypeIndex type, int n); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_type_get_upcast(TypeIndex type, int n); +EXPCL_INTERROGATEDB bool interrogate_type_derivation_has_upcast(TypeIndex type, int n); +EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_upcast(TypeIndex type, int n); // Although it is always possible to upcast a pointer to a base class, // it is not always possible to downcast from a base class to the @@ -555,14 +555,14 @@ EXPCL_DTOOLCONFIG FunctionIndex interrogate_type_get_upcast(TypeIndex type, int // way as upcasting. (Of course, it is the caller's responsibility to // guarantee that the pointer actually represents an object of the // type being downcast to.) -EXPCL_DTOOLCONFIG bool interrogate_type_derivation_downcast_is_impossible(TypeIndex type, int n); -EXPCL_DTOOLCONFIG bool interrogate_type_derivation_has_downcast(TypeIndex type, int n); -EXPCL_DTOOLCONFIG FunctionIndex interrogate_type_get_downcast(TypeIndex type, int n); +EXPCL_INTERROGATEDB bool interrogate_type_derivation_downcast_is_impossible(TypeIndex type, int n); +EXPCL_INTERROGATEDB bool interrogate_type_derivation_has_downcast(TypeIndex type, int n); +EXPCL_INTERROGATEDB FunctionIndex interrogate_type_get_downcast(TypeIndex type, int n); // A C++ class may also define any number of nested types--classes or // enums defined within the scope of this class. -EXPCL_DTOOLCONFIG int interrogate_type_number_of_nested_types(TypeIndex type); -EXPCL_DTOOLCONFIG TypeIndex interrogate_type_get_nested_type(TypeIndex type, int n); +EXPCL_INTERROGATEDB int interrogate_type_number_of_nested_types(TypeIndex type); +EXPCL_INTERROGATEDB TypeIndex interrogate_type_get_nested_type(TypeIndex type, int n); #ifdef __cplusplus } diff --git a/dtool/src/interrogatedb/interrogate_request.h b/dtool/src/interrogatedb/interrogate_request.h index 063b04f2ec..06d8bfb1a4 100644 --- a/dtool/src/interrogatedb/interrogate_request.h +++ b/dtool/src/interrogatedb/interrogate_request.h @@ -39,7 +39,7 @@ extern "C" { * data available, but doesn't allow matching the database information * up with any compiled-in function wrappers or anything. */ -EXPCL_DTOOLCONFIG void interrogate_request_database(const char *database_filename); +EXPCL_INTERROGATEDB void interrogate_request_database(const char *database_filename); @@ -74,7 +74,7 @@ typedef struct { * This includes all of the function pointers and/or unique names that * might be compiled in. */ -EXPCL_DTOOLCONFIG void interrogate_request_module(InterrogateModuleDef *def); +EXPCL_INTERROGATEDB void interrogate_request_module(InterrogateModuleDef *def); #ifdef __cplusplus } diff --git a/dtool/src/interrogatedb/p3interrogatedb_composite2.cxx b/dtool/src/interrogatedb/p3interrogatedb_composite2.cxx index e56075e2d0..c6b6c61362 100644 --- a/dtool/src/interrogatedb/p3interrogatedb_composite2.cxx +++ b/dtool/src/interrogatedb/p3interrogatedb_composite2.cxx @@ -5,7 +5,6 @@ #include "interrogate_interface.cxx" #include "interrogate_request.cxx" #include "py_panda.cxx" -#include "vector_int.cxx" diff --git a/dtool/src/interrogatedb/py_panda.cxx b/dtool/src/interrogatedb/py_panda.cxx index 755f0760e6..0278a84ce1 100644 --- a/dtool/src/interrogatedb/py_panda.cxx +++ b/dtool/src/interrogatedb/py_panda.cxx @@ -848,7 +848,7 @@ PyObject *map_deepcopy_to_copy(PyObject *self, PyObject *args) { // to whether the indicated value will fit. //////////////////////////////////////////////////////////////////// #if PY_MAJOR_VERSION < 3 -EXPCL_DTOOLCONFIG PyObject * +EXPCL_INTERROGATEDB PyObject * PyLongOrInt_FromUnsignedLong(unsigned long value) { if ((long)value < 0) { return PyLong_FromUnsignedLong(value); diff --git a/dtool/src/interrogatedb/py_panda.h b/dtool/src/interrogatedb/py_panda.h index 5a78786aa4..d7bd7b7ca5 100644 --- a/dtool/src/interrogatedb/py_panda.h +++ b/dtool/src/interrogatedb/py_panda.h @@ -187,7 +187,7 @@ struct Dtool_PyInstDef { //////////////////////////////////////////////////////////////////////// // A Offset Dictionary Defining How to read the Above Object.. //////////////////////////////////////////////////////////////////////// -extern EXPCL_DTOOLCONFIG PyMemberDef standard_type_members[]; +extern EXPCL_INTERROGATEDB PyMemberDef standard_type_members[]; //////////////////////////////////////////////////////////////////////// // The Class Definition Structor For a Dtool python type. @@ -281,7 +281,7 @@ static void Dtool_FreeInstance_##CLASS_NAME(PyObject *self) {\ //////////////////////////////////////////////////////////////////////// /// Simple Recognition Functions.. //////////////////////////////////////////////////////////////////////// -EXPCL_DTOOLCONFIG bool DtoolCanThisBeAPandaInstance(PyObject *self); +EXPCL_INTERROGATEDB bool DtoolCanThisBeAPandaInstance(PyObject *self); /////////////////////////////////////////////////////////////////////////////// // ** HACK ** allert.. @@ -291,15 +291,15 @@ EXPCL_DTOOLCONFIG bool DtoolCanThisBeAPandaInstance(PyObject *self); // /////////////////////////////////////////////////////////////////////////////// -EXPCL_DTOOLCONFIG void RegisterNamedClass(const string &name, Dtool_PyTypedObject &otype); -EXPCL_DTOOLCONFIG void RegisterRuntimeTypedClass(Dtool_PyTypedObject &otype); +EXPCL_INTERROGATEDB void RegisterNamedClass(const string &name, Dtool_PyTypedObject &otype); +EXPCL_INTERROGATEDB void RegisterRuntimeTypedClass(Dtool_PyTypedObject &otype); -EXPCL_DTOOLCONFIG Dtool_PyTypedObject *LookupNamedClass(const string &name); -EXPCL_DTOOLCONFIG Dtool_PyTypedObject *LookupRuntimeTypedClass(TypeHandle handle); +EXPCL_INTERROGATEDB Dtool_PyTypedObject *LookupNamedClass(const string &name); +EXPCL_INTERROGATEDB Dtool_PyTypedObject *LookupRuntimeTypedClass(TypeHandle handle); /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -EXPCL_DTOOLCONFIG Dtool_PyTypedObject *Dtool_RuntimeTypeDtoolType(int type); +EXPCL_INTERROGATEDB Dtool_PyTypedObject *Dtool_RuntimeTypeDtoolType(int type); //////////////////////////////////////////////////////////////////////// // Function : DTOOL_Call_ExtractThisPointerForType @@ -309,15 +309,15 @@ EXPCL_DTOOLCONFIG Dtool_PyTypedObject *Dtool_RuntimeTypeDtoolType(int type); // with these as the generated code depends on how this is set // up.. //////////////////////////////////////////////////////////////////////// -EXPCL_DTOOLCONFIG void DTOOL_Call_ExtractThisPointerForType(PyObject *self, Dtool_PyTypedObject *classdef, void **answer); +EXPCL_INTERROGATEDB void DTOOL_Call_ExtractThisPointerForType(PyObject *self, Dtool_PyTypedObject *classdef, void **answer); -EXPCL_DTOOLCONFIG void *DTOOL_Call_GetPointerThisClass(PyObject *self, Dtool_PyTypedObject *classdef, int param, const string &function_name, bool const_ok, bool report_errors); +EXPCL_INTERROGATEDB void *DTOOL_Call_GetPointerThisClass(PyObject *self, Dtool_PyTypedObject *classdef, int param, const string &function_name, bool const_ok, bool report_errors); -EXPCL_DTOOLCONFIG void *DTOOL_Call_GetPointerThis(PyObject *self); +EXPCL_INTERROGATEDB void *DTOOL_Call_GetPointerThis(PyObject *self); -EXPCL_DTOOLCONFIG bool Dtool_Call_ExtractThisPointer(PyObject *self, Dtool_PyTypedObject &classdef, void **answer); +EXPCL_INTERROGATEDB bool Dtool_Call_ExtractThisPointer(PyObject *self, Dtool_PyTypedObject &classdef, void **answer); -EXPCL_DTOOLCONFIG bool Dtool_Call_ExtractThisPointer_NonConst(PyObject *self, Dtool_PyTypedObject &classdef, +EXPCL_INTERROGATEDB bool Dtool_Call_ExtractThisPointer_NonConst(PyObject *self, Dtool_PyTypedObject &classdef, void **answer, const char *method_name); template INLINE bool DTOOL_Call_ExtractThisPointer(PyObject *self, T *&into) { @@ -338,15 +338,15 @@ template INLINE bool DTOOL_Call_ExtractThisPointer(PyObject *self, T *& // _PyErr_OCCURRED is an undocumented inline version of PyErr_Occurred. #define Dtool_CheckErrorOccurred() (_PyErr_OCCURRED() != NULL) #else -EXPCL_DTOOLCONFIG bool Dtool_CheckErrorOccurred(); +EXPCL_INTERROGATEDB bool Dtool_CheckErrorOccurred(); #endif -EXPCL_DTOOLCONFIG PyObject *Dtool_Raise_AssertionError(); -EXPCL_DTOOLCONFIG PyObject *Dtool_Raise_TypeError(const char *message); -EXPCL_DTOOLCONFIG PyObject *Dtool_Raise_ArgTypeError(PyObject *obj, int param, const char *function_name, const char *type_name); -EXPCL_DTOOLCONFIG PyObject *Dtool_Raise_AttributeError(PyObject *obj, const char *attribute); +EXPCL_INTERROGATEDB PyObject *Dtool_Raise_AssertionError(); +EXPCL_INTERROGATEDB PyObject *Dtool_Raise_TypeError(const char *message); +EXPCL_INTERROGATEDB PyObject *Dtool_Raise_ArgTypeError(PyObject *obj, int param, const char *function_name, const char *type_name); +EXPCL_INTERROGATEDB PyObject *Dtool_Raise_AttributeError(PyObject *obj, const char *attribute); -EXPCL_DTOOLCONFIG PyObject *_Dtool_Raise_BadArgumentsError(); +EXPCL_INTERROGATEDB PyObject *_Dtool_Raise_BadArgumentsError(); #ifdef NDEBUG // Define it to a function that just prints a generic message. #define Dtool_Raise_BadArgumentsError(x) _Dtool_Raise_BadArgumentsError() @@ -355,9 +355,9 @@ EXPCL_DTOOLCONFIG PyObject *_Dtool_Raise_BadArgumentsError(); #define Dtool_Raise_BadArgumentsError(x) Dtool_Raise_TypeError("Arguments must match:\n" x) #endif -EXPCL_DTOOLCONFIG PyObject *_Dtool_Return_None(); -EXPCL_DTOOLCONFIG PyObject *Dtool_Return_Bool(bool value); -EXPCL_DTOOLCONFIG PyObject *_Dtool_Return(PyObject *value); +EXPCL_INTERROGATEDB PyObject *_Dtool_Return_None(); +EXPCL_INTERROGATEDB PyObject *Dtool_Return_Bool(bool value); +EXPCL_INTERROGATEDB PyObject *_Dtool_Return(PyObject *value); #ifdef NDEBUG #define Dtool_Return_None() (_PyErr_OCCURRED() != NULL ? NULL : (Py_INCREF(Py_None), Py_None)) @@ -373,13 +373,13 @@ EXPCL_DTOOLCONFIG PyObject *_Dtool_Return(PyObject *value); // this function relies on the behavior of typed objects in the panda system. // //////////////////////////////////////////////////////////////////////// -EXPCL_DTOOLCONFIG PyObject *DTool_CreatePyInstanceTyped(void *local_this_in, Dtool_PyTypedObject &known_class_type, bool memory_rules, bool is_const, int RunTimeType); +EXPCL_INTERROGATEDB PyObject *DTool_CreatePyInstanceTyped(void *local_this_in, Dtool_PyTypedObject &known_class_type, bool memory_rules, bool is_const, int RunTimeType); //////////////////////////////////////////////////////////////////////// // DTool_CreatePyInstance .. wrapper function to finalize the existance of a general // dtool py instance.. //////////////////////////////////////////////////////////////////////// -EXPCL_DTOOLCONFIG PyObject *DTool_CreatePyInstance(void *local_this, Dtool_PyTypedObject &in_classdef, bool memory_rules, bool is_const); +EXPCL_INTERROGATEDB PyObject *DTool_CreatePyInstance(void *local_this, Dtool_PyTypedObject &in_classdef, bool memory_rules, bool is_const); // These template methods allow use when the Dtool_PyTypedObject is not known. // They require a get_class_type() to be defined for the class. @@ -450,7 +450,7 @@ Define_Dtool_Class(MODULE_NAME,CLASS_NAME,PUBLIC_NAME) /////////////////////////////////////////////////////////////////////////////// /// Th Finalizer for simple instances.. /////////////////////////////////////////////////////////////////////////////// -EXPCL_DTOOLCONFIG int DTool_PyInit_Finalize(PyObject *self, void *This, Dtool_PyTypedObject *type, bool memory_rules, bool is_const); +EXPCL_INTERROGATEDB int DTool_PyInit_Finalize(PyObject *self, void *This, Dtool_PyTypedObject *type, bool memory_rules, bool is_const); /////////////////////////////////////////////////////////////////////////////// /// A heler function to glu methed definition together .. that can not be done at @@ -459,7 +459,7 @@ EXPCL_DTOOLCONFIG int DTool_PyInit_Finalize(PyObject *self, void *This, Dtool_Py /////////////////////////////////////////////////////////////////////////////// typedef std::map MethodDefmap; -EXPCL_DTOOLCONFIG void Dtool_Accum_MethDefs(PyMethodDef in[], MethodDefmap &themap); +EXPCL_INTERROGATEDB void Dtool_Accum_MethDefs(PyMethodDef in[], MethodDefmap &themap); /////////////////////////////////////////////////////////////////////////////// //// We need a way to runtime merge compile units into a python "Module" .. this is done with the @@ -471,9 +471,9 @@ struct LibraryDef { /////////////////////////////////////////////////////////////////////////////// #if PY_MAJOR_VERSION >= 3 -EXPCL_DTOOLCONFIG PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], PyModuleDef *module_def); +EXPCL_INTERROGATEDB PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], PyModuleDef *module_def); #else -EXPCL_DTOOLCONFIG PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], const char *modulename); +EXPCL_INTERROGATEDB PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], const char *modulename); #endif /////////////////////////////////////////////////////////////////////////////// @@ -484,16 +484,16 @@ EXPCL_DTOOLCONFIG PyObject *Dtool_PyModuleInitHelper(LibraryDef *defs[], const c // Required to support fom historical inharatence in the for of "is this instance of".. // /////////////////////////////////////////////////////////////////////////////// -EXPCL_DTOOLCONFIG PyObject *Dtool_BorrowThisReference(PyObject *self, PyObject *args); +EXPCL_INTERROGATEDB PyObject *Dtool_BorrowThisReference(PyObject *self, PyObject *args); ////////////////////////////////////////////////////////////////////////////////////////////// // We do expose a dictionay for dtool classes .. this should be removed at some point.. ////////////////////////////////////////////////////////////////////////////////////////////// -EXPCL_DTOOLCONFIG PyObject *Dtool_AddToDictionary(PyObject *self1, PyObject *args); +EXPCL_INTERROGATEDB PyObject *Dtool_AddToDictionary(PyObject *self1, PyObject *args); /////////////////////////////////////////////////////////////////////////////////// -EXPCL_DTOOLCONFIG Py_hash_t DTOOL_PyObject_HashPointer(PyObject *obj); +EXPCL_INTERROGATEDB Py_hash_t DTOOL_PyObject_HashPointer(PyObject *obj); /* Compare v to w. Return -1 if v < w or exception (PyErr_Occurred() true in latter case). @@ -503,28 +503,28 @@ EXPCL_DTOOLCONFIG Py_hash_t DTOOL_PyObject_HashPointer(PyObject *obj); XXX of error. */ -EXPCL_DTOOLCONFIG int DTOOL_PyObject_ComparePointers(PyObject *v1, PyObject *v2); -EXPCL_DTOOLCONFIG int DTOOL_PyObject_Compare(PyObject *v1, PyObject *v2); +EXPCL_INTERROGATEDB int DTOOL_PyObject_ComparePointers(PyObject *v1, PyObject *v2); +EXPCL_INTERROGATEDB int DTOOL_PyObject_Compare(PyObject *v1, PyObject *v2); -EXPCL_DTOOLCONFIG PyObject *DTOOL_PyObject_RichCompare(PyObject *v1, PyObject *v2, int op); +EXPCL_INTERROGATEDB PyObject *DTOOL_PyObject_RichCompare(PyObject *v1, PyObject *v2, int op); -EXPCL_DTOOLCONFIG PyObject * +EXPCL_INTERROGATEDB PyObject * copy_from_make_copy(PyObject *self, PyObject *noargs); -EXPCL_DTOOLCONFIG PyObject * +EXPCL_INTERROGATEDB PyObject * copy_from_copy_constructor(PyObject *self, PyObject *noargs); -EXPCL_DTOOLCONFIG PyObject * +EXPCL_INTERROGATEDB PyObject * map_deepcopy_to_copy(PyObject *self, PyObject *args); #if PY_MAJOR_VERSION < 3 // In the Python 3 case, it is defined as a macro, at the beginning of this file. -EXPCL_DTOOLCONFIG PyObject * +EXPCL_INTERROGATEDB PyObject * PyLongOrInt_FromUnsignedLong(unsigned long value); #endif -EXPCL_DTOOLCONFIG extern struct Dtool_PyTypedObject Dtool_DTOOL_SUPER_BASE; -EXPCL_DTOOLCONFIG extern void Dtool_PyModuleClassInit_DTOOL_SUPER_BASE(PyObject *module); +EXPCL_INTERROGATEDB extern struct Dtool_PyTypedObject Dtool_DTOOL_SUPER_BASE; +EXPCL_INTERROGATEDB extern void Dtool_PyModuleClassInit_DTOOL_SUPER_BASE(PyObject *module); #define Dtool_Ptr_DTOOL_SUPER_BASE (&Dtool_DTOOL_SUPER_BASE) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index c434c97c89..25af974fcb 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2580,14 +2580,18 @@ if (PkgSkip("DIRECT")==0): if sys.platform == 'win32': core_so = GetOutputDir() + '/panda3d/core.pyd' direct_so = GetOutputDir() + '/panda3d/direct.pyd' + dtoolconfig_so = GetOutputDir() + '/panda3d/dtoolconfig.pyd' else: core_so = GetOutputDir() + '/panda3d/core.so' direct_so = GetOutputDir() + '/panda3d/direct.so' + dtoolconfig_so = GetOutputDir() + '/panda3d/dtoolconfig.so' if os.path.isfile(core_so): os.remove(core_so) if os.path.isfile(direct_so): os.remove(direct_so) +if os.path.isfile(dtoolconfig_so): + os.remove(dtoolconfig_so) # Write an appropriate panda3d/__init__.py p3d_init = """"Python bindings for the Panda3D libraries" @@ -3124,18 +3128,6 @@ TargetAdd('p3prc_composite2.obj', opts=OPTS, input='p3prc_composite2.cxx') OPTS=['DIR:dtool/src/dconfig', 'BUILDING:DTOOLCONFIG'] TargetAdd('p3dconfig_composite1.obj', opts=OPTS, input='p3dconfig_composite1.cxx') -# -# DIRECTORY: dtool/src/interrogatedb/ -# - -OPTS=['DIR:dtool/src/interrogatedb', 'BUILDING:DTOOLCONFIG'] -TargetAdd('p3interrogatedb_composite1.obj', opts=OPTS, input='p3interrogatedb_composite1.cxx') -TargetAdd('p3interrogatedb_composite2.obj', opts=OPTS, input='p3interrogatedb_composite2.cxx') -TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite1.obj') -TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite2.obj') -TargetAdd('libp3interrogatedb.dll', input='libp3dtool.dll') -TargetAdd('libp3interrogatedb.dll', opts=['PYTHON']) - # # DIRECTORY: dtool/metalibs/dtoolconfig/ # @@ -3149,14 +3141,32 @@ TargetAdd('libp3dtoolconfig.dll', input='p3prc_composite2.obj') TargetAdd('libp3dtoolconfig.dll', input='libp3dtool.dll') TargetAdd('libp3dtoolconfig.dll', opts=['ADVAPI', 'OPENSSL', 'WINGDI', 'WINUSER']) +# +# DIRECTORY: dtool/src/interrogatedb/ +# + +OPTS=['DIR:dtool/src/interrogatedb', 'BUILDING:INTERROGATEDB'] +TargetAdd('p3interrogatedb_composite1.obj', opts=OPTS, input='p3interrogatedb_composite1.cxx') +TargetAdd('p3interrogatedb_composite2.obj', opts=OPTS, input='p3interrogatedb_composite2.cxx') +TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite1.obj') +TargetAdd('libp3interrogatedb.dll', input='p3interrogatedb_composite2.obj') +TargetAdd('libp3interrogatedb.dll', input='libp3dtool.dll') +TargetAdd('libp3interrogatedb.dll', input='libp3dtoolconfig.dll') +TargetAdd('libp3interrogatedb.dll', opts=['PYTHON']) + if not PkgSkip("PYTHON"): + # This used to be called dtoolconfig.pyd, but it just contains the interrogatedb + # stuff, so it has been renamed appropriately. OPTS=['DIR:dtool/metalibs/dtoolconfig'] - TargetAdd('dtoolconfig_pydtool.obj', opts=OPTS, input="pydtool.cxx") - TargetAdd('dtoolconfig.pyd', input='dtoolconfig_pydtool.obj') - TargetAdd('dtoolconfig.pyd', input='libp3dtoolconfig.dll') - TargetAdd('dtoolconfig.pyd', input='libp3dtool.dll') - TargetAdd('dtoolconfig.pyd', input='libp3interrogatedb.dll') - TargetAdd('dtoolconfig.pyd', opts=['PYTHON']) + TargetAdd('interrogatedb_pydtool.obj', opts=OPTS, input="pydtool.cxx") + TargetAdd('interrogatedb.pyd', input='interrogatedb_pydtool.obj') + TargetAdd('interrogatedb.pyd', input='libp3dtool.dll') + TargetAdd('interrogatedb.pyd', input='libp3dtoolconfig.dll') + TargetAdd('interrogatedb.pyd', input='libp3interrogatedb.dll') + TargetAdd('interrogatedb.pyd', opts=['PYTHON']) + + # Make a stub file importing the new one for backward compatibility. + TargetAdd('panda3d/dtoolconfig.py', input='interrogatedb.pyd') # # DIRECTORY: dtool/src/pystub/