explicit import paths

This commit is contained in:
David Rose 2004-06-01 19:31:48 +00:00
parent f919dc99ab
commit b1db93fb87
194 changed files with 1003 additions and 567 deletions

45
direct/__init__.py Normal file
View File

@ -0,0 +1,45 @@
"""This file defines the path to the Python files within this package.
There are two cases:
(1) This is a source tree being run interactively by a developer, in
which case the Python files are found in package/src/*/*.py. This
case also breaks down into two sub-cases: (1a) we are using the
ctattach tools, in which case we should look for the files in the
actual source directory according to the ctattach variables, or
(1b) we are not using the ctattach tools, in which case the files
are right where we expect them to be.
(2) This is an installed tree being run by an end-user, in which case
the Python files are found in package/*/*.py. In this case, this
file doesn't really need to be installed; an empty __init__.py
file to define the package would serve just as well. But the file
is crafted so that it will do no harm if it is installed.
"""
package = 'DIRECT'
import os
if os.getenv('CTPROJS'):
# Ok, this is case (1a): we are using the ctattach tools, are
# therefore will expect to find the source files in
# $(package)/src/*/*.py. Completely replace the search path with
# this path.
tree = os.getenv(package)
if not tree:
raise StandardError, 'CTPROJS is defined, but $%s is not defined!' % (package)
__path__[0] = os.path.join(tree, 'src')
else:
# We are not using the ctattach tools.
srcDir = os.path.join(__path__[0], 'src')
if os.path.isdir(srcDir):
# The source directory exists; therefore, we are in case (1b).
__path__[0] = srcDir
else:
# The source directory does not exist, so we must be in case
# (2). Leave well enough alone.
pass

View File

@ -1,7 +1,7 @@
"""Actor module: contains the Actor class"""
from PandaObject import *
import LODNode
from direct.showbase.PandaObject import *
from pandac import LODNode
import types
class Actor(PandaObject, NodePath):
@ -935,8 +935,8 @@ class Actor(PandaObject, NodePath):
# actions
def animPanel(self):
import TkGlobal
import AnimPanel
from direct.showbase import TkGlobal
from direct.tkpanels import AnimPanel
return AnimPanel.AnimPanel(self)
def stop(self, animName=None, partName=None):
@ -1369,6 +1369,6 @@ class Actor(PandaObject, NodePath):
[other.__animControlDict[lodName][partName][animName][0], None]
def actorInterval(self, *args, **kw):
import ActorInterval
from direct.interval import ActorInterval
return ActorInterval.ActorInterval(self, *args, **kw)

View File

@ -1,6 +1,6 @@
"""DistributedActor module: contains the DistributedActor class"""
import DistributedNode
from direct.distributed import DistributedNode
import Actor
class DistributedActor(DistributedNode.DistributedNode, Actor.Actor):

View File

View File

@ -1,11 +1,11 @@
"""ClusterClient: Master for mutli-piping or PC clusters. """
from PandaModules import *
from pandac.PandaModules import *
from ClusterMsgs import *
from ClusterConfig import *
import DirectNotifyGlobal
import DirectObject
import Task
from direct.directnotify import DirectNotifyGlobal
from direct.showbase import DirectObject
from direct.task import Task
import os
class ClusterClient(DirectObject.DirectObject):

View File

@ -1,4 +1,4 @@
from PandaObject import *
from direct.showbase.PandaObject import *
from ClusterClient import *
import string

View File

@ -3,9 +3,9 @@
# This module is intended to supply routines and dataformats common to
# both ClusterClient and ClusterServer.
from PandaModules import *
from PyDatagram import PyDatagram
from PyDatagramIterator import PyDatagramIterator
from pandac.PandaModules import *
from direct.distributed.PyDatagram import PyDatagram
from direct.distributed.PyDatagramIterator import PyDatagramIterator
import time
#these are the types of messages that are currently supported.

View File

@ -1,9 +1,9 @@
from PandaModules import *
from pandac.PandaModules import *
from ClusterMsgs import *
from MsgTypes import *
import DirectNotifyGlobal
import DirectObject
import Task
from direct.distributed.MsgTypes import *
from direct.directnotify import DirectNotifyGlobal
from direct.showbase import DirectObject
from direct.task import Task
# NOTE: This assumes the following variables are set via bootstrap command line
# arguments on server startup:

View File

View File

@ -19,7 +19,6 @@
#include "dcField.h"
#include "hashGenerator.h"
#include "dcmsgtypes.h"
#include "notify.h"
////////////////////////////////////////////////////////////////////
// Function: DCField::get_number

View File

@ -85,6 +85,8 @@ dc_cleanup_parser() {
%type <u.dclass> dclass_name
%type <u.atomic> atomic_name
%type <u.subatomic> type_token
%type <str> import_identifier
%type <str> slash_identifier
%%
@ -120,12 +122,28 @@ dclass_name:
}
;
slash_identifier:
IDENTIFIER
| slash_identifier '/' IDENTIFIER
{
$$ = $1 + string("/") + $3;
}
;
import_identifier:
slash_identifier
| import_identifier '.' slash_identifier
{
$$ = $1 + string(".") + $3;
}
;
import:
KW_IMPORT IDENTIFIER
KW_IMPORT import_identifier
{
dc_file->add_import_module($2);
}
| KW_FROM IDENTIFIER KW_IMPORT
| KW_FROM import_identifier KW_IMPORT
{
dc_file->add_import_module($2);
}
@ -141,11 +159,11 @@ import_symbol_list_or_star:
;
import_symbol_list:
IDENTIFIER
slash_identifier
{
dc_file->add_import_symbol($1);
}
| import_symbol_list ',' IDENTIFIER
| import_symbol_list ',' slash_identifier
{
dc_file->add_import_symbol($3);
}

View File

@ -1,4 +1,4 @@
print 'DirectStart: Starting the game.'
import ShowBase
from direct.showbase import ShowBase
ShowBase.ShowBase()

View File

View File

@ -1,7 +1,7 @@
""" Class used to create and control vrpn devices """
from DirectObject import *
from PandaModules import *
from direct.showbase.DirectObject import *
from pandac.PandaModules import *
ANALOG_MIN = -0.95
ANALOG_MAX = 0.95

View File

@ -1,9 +1,9 @@
""" Class used to create and control radamec device """
from math import *
from PandaObject import *
from direct.showbase.PandaObject import *
from DirectDeviceManager import *
import DirectNotifyGlobal
from direct.directnotify import DirectNotifyGlobal
"""
TODO:

View File

@ -1,9 +1,9 @@
""" Class used to create and control joybox device """
from PandaObject import *
from direct.showbase.PandaObject import *
from DirectDeviceManager import *
from DirectUtil import *
import OnscreenText
import Task
from direct.directtools.DirectUtil import *
from direct.gui import OnscreenText
from direct.task import Task
"""
TODO:

View File

@ -1,9 +1,9 @@
""" Class used to create and control radamec device """
from math import *
from PandaObject import *
from direct.showbase.PandaObject import *
from DirectDeviceManager import *
import DirectNotifyGlobal
from direct.directnotify import DirectNotifyGlobal
"""

View File

View File

@ -102,5 +102,5 @@ class DirectNotify:
self.setDconfigLevel(categoryName)
def popupControls(self, tl = None):
import NotifyPanel
from direct.tkpanels import NotifyPanel
NotifyPanel.NotifyPanel(self, tl)

View File

@ -2,7 +2,7 @@
for the programmer/user"""
from LoggerGlobal import *
import PythonUtil
from direct.showbase import PythonUtil
import time
class Notifier:
@ -41,7 +41,7 @@ class Notifier:
delta = int(round(delta))
Notifier.serverDelta = delta + time.timezone - timezone
import NotifyCategory
from pandac import NotifyCategory
NotifyCategory.NotifyCategory.setServerDelta(self.serverDelta)
self.info("Notify clock adjusted by %s (and timezone adjusted by %s hours) to synchronize with server." % (PythonUtil.formatElapsedSeconds(delta), (time.timezone - timezone) / 3600))
@ -71,7 +71,7 @@ class Notifier:
# Severity funcs
def setSeverity(self, severity):
import NotifySeverity
from pandac import NotifySeverity
if severity >= NotifySeverity.NSError:
self.setWarning(0)
self.setInfo(0)
@ -90,7 +90,7 @@ class Notifier:
self.setDebug(1)
def getSeverity(self):
import NotifySeverity
from pandac import NotifySeverity
if self.getDebug():
return NotifySeverity.NSDebug
elif self.getInfo():

View File

View File

View File

@ -1,8 +1,8 @@
from PandaObject import *
from direct.showbase.PandaObject import *
from DirectUtil import *
from DirectGeometry import *
from DirectGlobals import *
import Task
from direct.task import Task
CAM_MOVE_DURATION = 1.2
COA_MARKER_SF = 0.0075

View File

@ -1,5 +1,5 @@
from PandaModules import *
from PandaObject import *
from pandac.PandaModules import *
from direct.showbase.PandaObject import *
from DirectGlobals import *
from DirectUtil import *
import math

View File

@ -1,4 +1,4 @@
from PandaModules import Vec3, Point3
from pandac.PandaModules import Vec3, Point3
UNPICKABLE = ['x-disc-visible', 'y-disc-visible', 'z-disc-visible',
'GridBack', 'unpickable']

View File

@ -1,4 +1,4 @@
from PandaObject import *
from direct.showbase.PandaObject import *
from DirectUtil import *
from DirectGeometry import *

View File

@ -1,4 +1,4 @@
from PandaObject import *
from direct.showbase.PandaObject import *
from string import lower
class DirectLight(NodePath):

View File

@ -1,8 +1,8 @@
from PandaObject import *
from direct.showbase.PandaObject import *
from DirectGlobals import *
from DirectUtil import *
from DirectGeometry import *
import Task
from direct.task import Task
class DirectManipulationControl(PandaObject):
def __init__(self):

View File

@ -1,4 +1,4 @@
from PandaObject import *
from direct.showbase.PandaObject import *
from DirectGlobals import *
from DirectUtil import *
from DirectGeometry import *

View File

@ -1,4 +1,4 @@
from PandaObject import *
from direct.showbase.PandaObject import *
from DirectGlobals import *
from DirectUtil import*
from DirectCameraControl import *
@ -7,15 +7,15 @@ from DirectSelection import *
from DirectGrid import *
from DirectGeometry import *
from DirectLights import *
from ClusterClient import *
from ClusterServer import *
import Placer
import Slider
import SceneGraphExplorer
import OnscreenText
from direct.cluster.ClusterClient import *
from direct.cluster.ClusterServer import *
from direct.tkpanels import Placer
from direct.tkwidgets import Slider
from direct.tkwidgets import SceneGraphExplorer
from direct.gui import OnscreenText
import types
import string
import Loader
from direct.showbase import Loader
class DirectSession(PandaObject):
@ -84,20 +84,20 @@ class DirectSession(PandaObject):
self.radamec = None
self.fastrak = []
if base.config.GetBool('want-vrpn', 0):
import DirectDeviceManager
from direct.directdevices import DirectDeviceManager
self.deviceManager = DirectDeviceManager.DirectDeviceManager()
# Automatically create any devices specified in config file
joybox = base.config.GetString('vrpn-joybox-device', '')
radamec = base.config.GetString('vrpn-radamec-device', '')
fastrak = base.config.GetString('vrpn-fastrak-device', '')
if joybox:
import DirectJoybox
from direct.directdevices import DirectJoybox
self.joybox = DirectJoybox.DirectJoybox(joybox)
if radamec:
import DirectRadamec
from direct.directdevices import DirectRadamec
self.radamec = DirectRadamec.DirectRadamec(radamec)
if fastrak:
import DirectFastrak
from direct.directdevices import DirectFastrak
# parse string into format device:N where N is the sensor name
fastrak = string.split(fastrak)
for i in range(len(fastrak))[1:]:
@ -170,8 +170,8 @@ class DirectSession(PandaObject):
]
if base.wantTk:
import TkGlobal
import DirectSessionPanel
from direct.showbase import TkGlobal
from direct.tkpanels import DirectSessionPanel
self.panel = DirectSessionPanel.DirectSessionPanel(parent = tkroot)
try:
# Has the clusterMode been set externally (i.e. via the

View File

@ -1,4 +1,4 @@
from PandaObject import *
from direct.showbase.PandaObject import *
from DirectGlobals import *
# Routines to adjust values

View File

View File

@ -1,7 +1,7 @@
"""DistributedLargeBlobSender module: contains the DistributedLargeBlobSender class"""
import DistributedObject
import DirectNotifyGlobal
from direct.distributed import DistributedObject
from direct.directnotify import DirectNotifyGlobal
import LargeBlobSenderConsts
class DistributedLargeBlobSender(DistributedObject.DistributedObject):

View File

@ -1,7 +1,7 @@
"""DistributedLargeBlobSenderAI module: contains the DistributedLargeBlobSenderAI class"""
import DistributedObjectAI
import DirectNotifyGlobal
from direct.distributed import DistributedObjectAI
from direct.directnotify import DirectNotifyGlobal
import LargeBlobSenderConsts
class DistributedLargeBlobSenderAI(DistributedObjectAI.DistributedObjectAI):

View File

@ -1,7 +1,7 @@
from PandaObject import *
from DirectGeometry import *
from direct.showbase.PandaObject import *
from direct.directtools.DirectGeometry import *
import NodePath
from pandac import NodePath
class Mopath(PandaObject):

View File

View File

@ -1,6 +1,6 @@
"""CRCache module: contains the CRCache class"""
import DirectNotifyGlobal
from direct.directnotify import DirectNotifyGlobal
import DistributedObject
class CRCache:
@ -86,7 +86,7 @@ class CRCache:
def checkCache(self):
# For debugging; this verifies that the cache is sensible and
# returns true if so.
from PandaModules import NodePath
from pandac.PandaModules import NodePath
for obj in self.dict.values():
if isinstance(obj, NodePath):
assert(not obj.isEmpty() and obj.getTopNode() != render.node())

View File

@ -1,12 +1,12 @@
"""ClientRepository module: contains the ClientRepository class"""
from PandaModules import *
from pandac.PandaModules import *
from MsgTypes import *
import Task
import DirectNotifyGlobal
from direct.task import Task
from direct.directnotify import DirectNotifyGlobal
import CRCache
import ConnectionRepository
import PythonUtil
from direct.showbase import PythonUtil
import ParentMgr
import RelatedObjectMgr
import time

View File

@ -1,9 +1,9 @@
# ClockDelta provides the ability to use clock synchronization for
# distributed objects
from PandaModules import *
import DirectNotifyGlobal
import DirectObject
from pandac.PandaModules import *
from direct.directnotify import DirectNotifyGlobal
from direct.showbase import DirectObject
import math
# The following two parameters, NetworkTimeBits and

View File

@ -1,11 +1,12 @@
from PandaModules import *
import Task
import DirectNotifyGlobal
import DirectObject
from pandac.PandaModules import *
from direct.task import Task
from direct.directnotify import DirectNotifyGlobal
from direct.showbase import DirectObject
from PyDatagram import PyDatagram
from PyDatagramIterator import PyDatagramIterator
import types
import imp
class ConnectionRepository(DirectObject.DirectObject, CConnectionRepository):
"""
@ -52,6 +53,10 @@ class ConnectionRepository(DirectObject.DirectObject, CConnectionRepository):
self.recorder = None
# This is the string that is appended to symbols read from the
# DC file. The AIRepository will redefine this to 'AI'.
self.dcSuffix = ''
def readDCFile(self, dcFileNames = None):
""" Reads in the dc files listed in dcFileNames, or if
@ -79,43 +84,33 @@ class ConnectionRepository(DirectObject.DirectObject, CConnectionRepository):
# Now import all of the modules required by the DC file.
for n in range(dcFile.getNumImportModules()):
moduleName = dcFile.getImportModule(n)
moduleName = self.mangleDCName(moduleName)
module = __import__(moduleName, globals(), locals())
# Maybe the module name is represented as "moduleName/AI".
suffix = moduleName.split('/')
moduleName = suffix[0]
if self.dcSuffix and self.dcSuffix in suffix[1:]:
moduleName += self.dcSuffix
if dcFile.getNumImportSymbols(n) > 0:
# "from moduleName import symbolName, symbolName, ..."
# Copy just the named symbols into the dictionary.
importSymbols = []
for i in range(dcFile.getNumImportSymbols(n)):
symbolName = dcFile.getImportSymbol(n, i)
if symbolName == '*':
# Get all symbols.
dcImports.update(module.__dict__)
else:
mangledName = self.mangleName(symbolName)
gotAny = 0
if hasattr(module, symbolName):
dcImports[symbolName] = getattr(module, symbolName)
gotAny = 1
if hasattr(module, mangledName):
dcImports[mangledName] = getattr(module, mangledName)
gotAny = 1
if not gotAny:
self.notify.error("Symbol %s not found in module %s." % (
symbolName, moduleName))
else:
# "import moduleName"
# Copy the module itself into the dictionary.
dcImports[moduleName] = module
# Maybe the symbol name is represented as "symbolName/AI".
suffix = symbolName.split('/')
symbolName = suffix[0]
if self.dcSuffix and self.dcSuffix in suffix[1:]:
symbolName += self.dcSuffix
importSymbols.append(symbolName)
self.importModule(dcImports, moduleName, importSymbols)
# Now get the class definition for the classes named in the DC
# file.
for i in range(dcFile.getNumClasses()):
dclass = dcFile.getClass(i)
number = dclass.getNumber()
className = dclass.getName()
className = self.mangleDCName(className)
className = dclass.getName() + self.dcSuffix
# Does the class have a definition defined in the newly
# imported namespace?
@ -136,14 +131,38 @@ class ConnectionRepository(DirectObject.DirectObject, CConnectionRepository):
self.dclassesByName[className] = dclass
self.dclassesByNumber[number] = dclass
def mangleDCName(self, name):
""" This is provided as a hook so that derived classes
(e.g. the AIRepository) can rename symbols from the .dc file
according to the conventions associated with this particular
repository (e.g., an AIRepository appends 'AI' to class and
module names)."""
def importModule(self, dcImports, moduleName, importSymbols):
""" Imports the indicated moduleName and all of its symbols
into the current namespace. This more-or-less reimplements
the Python import command. """
return name
module = __import__(moduleName, globals(), locals(), importSymbols)
if importSymbols:
# "from moduleName import symbolName, symbolName, ..."
# Copy just the named symbols into the dictionary.
if importSymbols == ['*']:
# "from moduleName import *"
if hasattr(module, "__all__"):
importSymbols = module.__all__
else:
importSymbols = module.__dict__.keys()
for symbolName in importSymbols:
if hasattr(module, symbolName):
dcImports[symbolName] = getattr(module, symbolName)
else:
raise StandardError, 'Symbol %s not defined in module %s.' % (symbolName, moduleName)
else:
# "import moduleName"
# Copy the root module name into the dictionary.
# Follow the dotted chain down to the actual module.
components = moduleName.split('.')
dcImports[components[0]] = module
def connect(self, serverList,
successCallback = None, successArgs = [],

View File

@ -1,9 +1,9 @@
"""DistributedNode module: contains the DistributedNode class"""
from ShowBaseGlobal import *
from PandaModules import NodePath
from direct.showbase.ShowBaseGlobal import *
from pandac.PandaModules import NodePath
import DistributedObject
import Task
from direct.task import Task
import types
class DistributedNode(DistributedObject.DistributedObject, NodePath):

View File

@ -1,6 +1,6 @@
from AIBaseGlobal import *
from PandaModules import NodePath
import DistributedObjectAI
from otp.ai.AIBaseGlobal import *
from pandac.PandaModules import NodePath
from direct.distributed import DistributedObjectAI
class DistributedNodeAI(DistributedObjectAI.DistributedObjectAI, NodePath):
def __init__(self, air, name=None):

View File

@ -1,7 +1,7 @@
"""DistributedObject module: contains the DistributedObject class"""
from PandaObject import *
from DirectNotifyGlobal import *
from direct.showbase.PandaObject import *
from direct.directnotify.DirectNotifyGlobal import *
from PyDatagram import PyDatagram
from PyDatagramIterator import PyDatagramIterator

View File

@ -0,0 +1,272 @@
"""DistributedObjectAI module: contains the DistributedObjectAI class"""
from direct.directnotify.DirectNotifyGlobal import *
from direct.showbase import PythonUtil
from direct.showbase import DirectObject
from pandac.PandaModules import *
from PyDatagram import PyDatagram
from PyDatagramIterator import PyDatagramIterator
class DistributedObjectAI(DirectObject.DirectObject):
"""Distributed Object class:"""
notify = directNotify.newCategory("DistributedObjectAI")
def __init__(self, air):
try:
self.DistributedObjectAI_initialized
except:
self.DistributedObjectAI_initialized = 1
# Record the repository
self.air = air
# Record our distributed class
className = self.__class__.__name__
self.dclass = self.air.dclassesByName[className]
# init doId pre-allocated flag
self.__preallocDoId = 0
# These are used to implement beginBarrier().
self.__nextBarrierContext = 0
self.__barriers = {}
# Uncomment if you want to debug DO leaks
#def __del__(self):
# """
# For debugging purposes, this just prints out what got deleted
# """
# print ("Destructing: " + self.__class__.__name__)
def delete(self):
"""
Inheritors should redefine this to take appropriate action on delete
Note that this may be called multiple times if a class inherits
from DistributedObjectAI more than once.
"""
# prevent this code from executing multiple times
if self.air is not None:
# self.doId may not exist. The __dict__ syntax works around that.
assert(self.notify.debug('delete(): %s' % (self.__dict__.get("doId"))))
# Clean up all the pending barriers.
for barrier in self.__barriers.values():
barrier.cleanup()
self.__barriers = {}
if not hasattr(self, "doNotDeallocateChannel"):
if self.air:
self.air.deallocateChannel(self.doId)
self.air = None
del self.zoneId
def isDeleted(self):
"""
Returns true if the object has been deleted,
or if it is brand new and hasn't yet been generated.
"""
return (self.air == None)
def isGenerated(self):
"""
Returns true if the object has been generated
"""
return hasattr(self, 'zoneId')
def getDoId(self):
"""
Return the distributed object id
"""
return self.doId
def preAllocateDoId(self):
"""
objects that need to have a doId before they are generated
can call this to pre-allocate a doId for the object
"""
assert not self.__preallocDoId
self.doId = self.air.allocateChannel()
self.__preallocDoId = 1
def updateRequiredFields(self, dclass, di):
dclass.receiveUpdateBroadcastRequired(self, di)
def updateAllRequiredFields(self, dclass, di):
dclass.receiveUpdateAllRequired(self, di)
def updateRequiredOtherFields(self, dclass, di):
dclass.receiveUpdateBroadcastRequired(self, di)
dclass.receiveUpdateOther(self, di)
def updateAllRequiredOtherFields(self, dclass, di):
dclass.receiveUpdateAllRequired(self, di)
dclass.receiveUpdateOther(self, di)
def getZoneChangeEvent(self):
return 'DOChangeZone-%s' % self.doId
def handleZoneChange(self, newZoneId, oldZoneId):
assert oldZoneId == self.zoneId
self.zoneId = newZoneId
self.air.changeDOZoneInTables(self, newZoneId, oldZoneId)
messenger.send(self.getZoneChangeEvent(), [newZoneId, oldZoneId])
def sendUpdate(self, fieldName, args = []):
if self.air:
self.air.sendUpdate(self, fieldName, args)
def sendUpdateToAvatarId(self, avId, fieldName, args):
channelId = avId + 1
self.sendUpdateToChannel(channelId, fieldName, args)
def sendUpdateToChannel(self, channelId, fieldName, args):
if self.air:
self.air.sendUpdateToChannel(self, channelId, fieldName, args)
def generateWithRequired(self, zoneId, optionalFields=[]):
# have we already allocated a doId?
if self.__preallocDoId:
self.__preallocDoId = 0
return self.generateWithRequiredAndId(
self.doId, zoneId, optionalFields)
# The repository is the one that really does the work
self.air.generateWithRequired(self, zoneId, optionalFields)
self.zoneId = zoneId
self.generate()
# this is a special generate used for estates, or anything else that
# needs to have a hard coded doId as assigned by the server
def generateWithRequiredAndId(self, doId, zoneId, optionalFields=[]):
# have we already allocated a doId?
if self.__preallocDoId:
self.__preallocDoId = 0
assert doId == self.doId
# The repository is the one that really does the work
self.air.generateWithRequiredAndId(self, doId, zoneId, optionalFields)
self.zoneId = zoneId
self.generate()
def generate(self):
# Inheritors should put functions that require self.zoneId or
# other networked info in this function.
assert(self.notify.debug('generate(): %s' % (self.doId)))
pass
def sendGenerateWithRequired(self, repository, zoneId, optionalFields=[]):
# Make the dclass do the hard work
dg = self.dclass.aiFormatGenerate(self, self.doId, zoneId,
repository.districtId,
repository.ourChannel,
optionalFields)
repository.send(dg)
self.zoneId = zoneId
def initFromServerResponse(self, valDict):
# This is a special method used for estates, etc., which get
# their fields set from the database indirectly by way of the
# AI. The input parameter is a dictionary of field names to
# datagrams that describes the initial field values from the
# database.
assert(self.notify.debug("initFromServerResponse(%s)" % (valDict.keys(),)))
dclass = self.dclass
for key, value in valDict.items():
# Update the field
dclass.directUpdate(self, key, value)
def requestDelete(self):
if not self.air:
doId = "none"
if hasattr(self, "doId"):
doId = self.doId
self.notify.warning("Tried to delete a %s (doId %s) that is already deleted" % (self.__class__, doId))
return
self.air.requestDelete(self)
def taskName(self, taskString):
return (taskString + "-" + str(self.getDoId()))
def uniqueName(self, idString):
return (idString + "-" + str(self.getDoId()))
def validate(self, avId, bool, msg):
if not bool:
self.air.writeServerEvent('suspicious', avId, msg)
self.notify.warning('validate error: avId: %s -- %s' % (avId, msg))
return bool
def beginBarrier(self, name, avIds, timeout, callback):
# Begins waiting for a set of avatars. When all avatars in
# the list have reported back in or the callback has expired,
# calls the indicated callback with the list of toons that
# made it through. There may be multiple barriers waiting
# simultaneously on different lists of avatars, although they
# should have different names.
from toontown.ai import ToonBarrier
context = self.__nextBarrierContext
# We assume the context number is passed as a uint16.
self.__nextBarrierContext = (self.__nextBarrierContext + 1) & 0xffff
assert(self.notify.debug('beginBarrier(%s, %s, %s, %s)' % (context, name, avIds, timeout)))
if avIds:
barrier = ToonBarrier.ToonBarrier(
self.uniqueName(name), avIds, timeout,
doneFunc = PythonUtil.Functor(self.__barrierCallback, context, callback))
self.__barriers[context] = barrier
# Send the context number to each involved client.
self.sendUpdate("setBarrierData", [self.__getBarrierData()])
else:
# No avatars; just call the callback immediately.
callback(avIds)
return context
def __getBarrierData(self):
# Returns the barrier data formatted as a blob for sending to
# the clients. This lists all of the current outstanding
# barriers and the avIds waiting for them.
dg = PyDatagram()
for context, barrier in self.__barriers.items():
toons = barrier.pendingToons
if toons:
dg.addUint16(context)
dg.addUint16(len(toons))
for avId in toons:
dg.addUint32(avId)
return dg.getMessage()
def ignoreBarrier(self, context):
# Aborts a previously-set barrier. The context is the return
# value from the previous call to beginBarrier().
barrier = self.__barriers.get(context)
if barrier:
barrier.cleanup()
del self.__barriers[context]
def setBarrierReady(self, context):
# Generated by the clients to check in after a beginBarrier()
# call.
avId = self.air.msgSender
assert(self.notify.debug('setBarrierReady(%s, %s)' % (context, avId)))
barrier = self.__barriers.get(context)
if barrier == None:
# This may be None if a client was slow and missed an
# earlier timeout. Too bad.
return
barrier.clear(avId)
def __barrierCallback(self, context, callback, avIds):
assert(self.notify.debug('barrierCallback(%s, %s)' % (context, avIds)))
# The callback that is generated when a barrier is completed.
barrier = self.__barriers.get(context)
if barrier:
barrier.cleanup()
del self.__barriers[context]
callback(avIds)
else:
self.notify.warning("Unexpected completion from barrier %s" % (context))

View File

@ -1,10 +1,10 @@
"""DistributedSmoothNode module: contains the DistributedSmoothNode class"""
from PandaModules import *
from pandac.PandaModules import *
from ClockDelta import *
import DistributedNode
import DistributedSmoothNodeBase
import Task
from direct.task import Task
# This number defines our tolerance for out-of-sync telemetry packets.
# If a packet appears to have originated from more than MaxFuture

View File

@ -1,4 +1,4 @@
from AIBaseGlobal import *
from otp.ai.AIBaseGlobal import *
import DistributedNodeAI
import DistributedSmoothNodeBase

View File

@ -1,7 +1,7 @@
"""DistributedSmoothNodeBase module: contains the DistributedSmoothNodeBase class"""
from ClockDelta import *
import Task
from direct.task import Task
class DistributedSmoothNodeBase:
"""common base class for DistributedSmoothNode and DistributedSmoothNodeAI

View File

@ -1,6 +1,6 @@
"""ParentMgr module: contains the ParentMgr class"""
import DirectNotifyGlobal
from direct.directnotify import DirectNotifyGlobal
class ParentMgr:
# This is now used on the AI as well.

View File

@ -3,9 +3,9 @@
# 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 PandaModules import *
from pandac.PandaModules import *
# Import the type numbers
from DCSubatomicType import *
from pandac.DCSubatomicType import *
class PyDatagram(Datagram):

View File

@ -3,9 +3,9 @@
# 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 PandaModules import *
from pandac.PandaModules import *
# Import the type numbers
from DCSubatomicType import *
from pandac.DCSubatomicType import *
class PyDatagramIterator(DatagramIterator):

View File

@ -1,8 +1,8 @@
"""RelatedObjectMgr module: contains the RelatedObjectMgr class"""
from ShowBaseGlobal import *
import DirectObject
import DirectNotifyGlobal
from direct.showbase.ShowBaseGlobal import *
from direct.showbase import DirectObject
from direct.directnotify import DirectNotifyGlobal
class RelatedObjectMgr(DirectObject.DirectObject):
"""

View File

View File

@ -153,7 +153,9 @@ check_datagram() {
#ifdef HAVE_PYTHON
case CLIENT_OBJECT_UPDATE_FIELD:
case STATESERVER_OBJECT_UPDATE_FIELD:
handle_update_field();
if (!handle_update_field()) {
return false;
}
break;
#endif // HAVE_PYTHON
@ -363,16 +365,18 @@ do_check_datagram() {
// Description: Directly handles an update message on a field.
// Python never touches the datagram; it just gets its
// distributed method called with the appropriate
// parameters.
// parameters. Returns true if everything is ok, false
// if there was an error processing the field's update
// method.
////////////////////////////////////////////////////////////////////
void CConnectionRepository::
bool CConnectionRepository::
handle_update_field() {
#ifdef HAVE_PYTHON
int do_id = _di.get_uint32();
if (_python_repository != (PyObject *)NULL) {
PyObject *doId2do =
PyObject_GetAttrString(_python_repository, "doId2do");
nassertv(doId2do != NULL);
nassertr(doId2do != NULL, false);
PyObject *doId = PyInt_FromLong(do_id);
PyObject *distobj = PyDict_GetItem(doId2do, doId);
@ -381,11 +385,11 @@ handle_update_field() {
if (distobj != NULL) {
PyObject *dclass_obj = PyObject_GetAttrString(distobj, "dclass");
nassertv(dclass_obj != NULL);
nassertr(dclass_obj != NULL, false);
PyObject *dclass_this = PyObject_GetAttrString(dclass_obj, "this");
Py_DECREF(dclass_obj);
nassertv(dclass_this != NULL);
nassertr(dclass_this != NULL, false);
DCClass *dclass = (DCClass *)PyInt_AsLong(dclass_this);
Py_DECREF(dclass_this);
@ -397,7 +401,13 @@ handle_update_field() {
Py_INCREF(distobj);
dclass->receive_update(distobj, _di);
Py_DECREF(distobj);
if (PyErr_Occurred()) {
return false;
}
}
}
#endif // HAVE_PYTHON
return true;
}

View File

@ -97,7 +97,7 @@ PUBLISHED:
private:
bool do_check_datagram();
void handle_update_field();
bool handle_update_field();
#ifdef HAVE_PYTHON
PyObject *_python_repository;

View File

@ -4,7 +4,7 @@
of the CInterval class
"""
from DirectNotifyGlobal import directNotify
from direct.directnotify.DirectNotifyGlobal import directNotify
notify = directNotify.newCategory("Interval")
def setT(self, t):
@ -41,9 +41,9 @@
"""
Popup control panel for interval.
"""
from TkGlobal import Toplevel, Frame, Button, LEFT, X, Pmw
from direct.showbase.TkGlobal import Toplevel, Frame, Button, LEFT, X, Pmw
import math
import EntryScale
from direct.tkwidgets import EntryScale
if tl == None:
tl = Toplevel()
tl.title('Interval Controls')

View File

@ -15,14 +15,14 @@
"""
if not name:
name = self.getUrl().cStr()
import Task
from direct.task import Task
task = Task.Task(self.doTask)
task.callback = callback
task.callbackArgs = extraArgs
return taskMgr.add(task, name)
def doTask(self, task):
import Task
from direct.task import Task
if self.run():
return Task.cont
if task.callback:

View File

@ -13,7 +13,7 @@
node parented within the render2d hierarchy.
"""
import Point3
from pandac import Point3
# Get the relative transform to the node.
mat = np.getMat(render2d)

View File

@ -105,7 +105,7 @@
return [self]
def getTightBounds(self):
import Point3
from pandac import Point3
v1 = Point3.Point3(0)
v2 = Point3.Point3(0)
self.calcTightBounds(v1,v2)
@ -277,9 +277,9 @@
# 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
import Task
import LerpBlendHelpers
from TaskManagerGlobal import taskMgr
from direct.task import Task
from direct.showbase import LerpBlendHelpers
from direct.task.TaskManagerGlobal import taskMgr
# upon death remove the functorFunc
def lerpUponDeath(task):
@ -295,9 +295,9 @@
# make the task function
def lerpTaskFunc(task):
from Lerp import Lerp
from ClockObject import ClockObject
from Task import Task, cont, done
from pandac.Lerp import Lerp
from pandac.ClockObject import ClockObject
from direct.task.Task import Task, cont, done
if task.init == 1:
# make the lerp
functor = task.functorFunc()
@ -333,8 +333,8 @@
"""_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"""
import AutonomousLerp
import LerpBlendHelpers
from pandac import AutonomousLerp
from direct.showbase import LerpBlendHelpers
# make a lerp that lives in C++ land
functor = functorFunc()
lerp = AutonomousLerp.AutonomousLerp(functor, time,
@ -368,7 +368,7 @@
string="noBlend", string=none, string=none)
"""
def functorFunc(self = self, r = r, g = g, b = b, a = a):
import ColorLerpFunctor
from pandac import ColorLerpFunctor
# just end rgba values, use current color rgba values for start
startColor = self.getColor()
functor = ColorLerpFunctor.ColorLerpFunctor(
@ -392,7 +392,7 @@
"""
def functorFunc(self = self, sr = sr, sg = sg, sb = sb, sa = sa,
er = er, eg = eg, eb = eb, ea = ea):
import ColorLerpFunctor
from pandac import ColorLerpFunctor
# start and end rgba values
functor = ColorLerpFunctor.ColorLerpFunctor(self, sr, sg, sb, sa,
er, eg, eb, ea)
@ -411,7 +411,7 @@
string=none)
"""
def functorFunc(self = self, endColor = endColor):
import ColorLerpFunctor
from pandac import ColorLerpFunctor
# just end vec4, use current color for start
startColor = self.getColor()
functor = ColorLerpFunctor.ColorLerpFunctor(
@ -432,7 +432,7 @@
"""
def functorFunc(self = self, startColor = startColor,
endColor = endColor):
import ColorLerpFunctor
from pandac import ColorLerpFunctor
# start color and end vec
functor = ColorLerpFunctor.ColorLerpFunctor(
self, startColor, endColor)
@ -471,7 +471,7 @@
string="noBlend", string=none, string=none)
"""
def functorFunc(self = self, r = r, g = g, b = b, a = a):
import ColorScaleLerpFunctor
from pandac import ColorScaleLerpFunctor
# just end rgba values, use current color rgba values for start
startColor = self.getColor()
functor = ColorScaleLerpFunctor.ColorScaleLerpFunctor(
@ -495,7 +495,7 @@
"""
def functorFunc(self = self, sr = sr, sg = sg, sb = sb, sa = sa,
er = er, eg = eg, eb = eb, ea = ea):
import ColorScaleLerpFunctor
from pandac import ColorScaleLerpFunctor
# start and end rgba values
functor = ColorScaleLerpFunctor.ColorScaleLerpFunctor(self, sr, sg, sb, sa,
er, eg, eb, ea)
@ -514,7 +514,7 @@
string=none)
"""
def functorFunc(self = self, endColor = endColor):
import ColorScaleLerpFunctor
from pandac import ColorScaleLerpFunctor
# just end vec4, use current color for start
startColor = self.getColor()
functor = ColorScaleLerpFunctor.ColorScaleLerpFunctor(
@ -535,7 +535,7 @@
"""
def functorFunc(self = self, startColor = startColor,
endColor = endColor):
import ColorScaleLerpFunctor
from pandac import ColorScaleLerpFunctor
# start color and end vec
functor = ColorScaleLerpFunctor.ColorScaleLerpFunctor(
self, startColor, endColor)
@ -573,7 +573,7 @@
"""
def functorFunc(self = self, h = h, p = p, r = r,
other = other, shortest=shortest):
import HprLerpFunctor
from pandac import HprLerpFunctor
# it's individual hpr components
if (other != None):
# lerp wrt other
@ -609,7 +609,7 @@
"""
def functorFunc(self = self, hpr = hpr,
other = other, shortest=shortest):
import HprLerpFunctor
from pandac import HprLerpFunctor
# it's a vbase3 hpr
if (other != None):
# lerp wrt other
@ -654,7 +654,7 @@
Perform a pos lerp with three floats as the end point
"""
def functorFunc(self = self, x = x, y = y, z = z, other = other):
import PosLerpFunctor
from pandac import PosLerpFunctor
if (other != None):
# lerp wrt other
startPos = self.getPos(other)
@ -681,7 +681,7 @@
Perform a pos lerp with a Point3 as the end point
"""
def functorFunc(self = self, pos = pos, other = other):
import PosLerpFunctor
from pandac import PosLerpFunctor
if (other != None):
#lerp wrt other
functor = PosLerpFunctor.PosLerpFunctor(
@ -721,7 +721,7 @@
"""
def functorFunc(self = self, pos = pos, hpr = hpr,
other = other, shortest=shortest):
import PosHprLerpFunctor
from pandac import PosHprLerpFunctor
if (other != None):
# lerp wrt other
startPos = self.getPos(other)
@ -755,7 +755,7 @@
"""
def functorFunc(self = self, x = x, y = y, z = z,
h = h, p = p, r = r, other = other, shortest=shortest):
import PosHprLerpFunctor
from pandac import PosHprLerpFunctor
if (other != None):
# lerp wrt other
startPos = self.getPos(other)
@ -797,7 +797,7 @@
"""
def functorFunc(self = self, pos = pos, hpr = hpr,
scale = scale, other = other, shortest=shortest):
import PosHprScaleLerpFunctor
from pandac import PosHprScaleLerpFunctor
if (other != None):
# lerp wrt other
startPos = self.getPos(other)
@ -850,7 +850,7 @@
string=none, NodePath=None)
"""
def functorFunc(self = self, scale = scale, other = other):
import ScaleLerpFunctor
from pandac import ScaleLerpFunctor
if (other != None):
# lerp wrt other
functor = ScaleLerpFunctor.ScaleLerpFunctor(self,
@ -875,7 +875,7 @@
string=none, string=none, NodePath=None)
"""
def functorFunc(self = self, sx = sx, sy = sy, sz = sz, other = other):
import ScaleLerpFunctor
from pandac import ScaleLerpFunctor
if (other != None):
# lerp wrt other
startScale = self.getScale(other)
@ -901,17 +901,17 @@
def place(self):
base.startDirect(fWantTk = 1)
import Placer
from direct.tkpanels import Placer
return Placer.place(self)
def explore(self):
base.startDirect(fWantTk = 1)
import SceneGraphExplorer
from direct.tkwidgets import SceneGraphExplorer
return SceneGraphExplorer.explore(self)
def rgbPanel(self, cb = None):
base.startTk()
import Slider
from direct.tkwidgets import Slider
return Slider.rgbPanel(self, cb)
def select(self):
@ -949,48 +949,48 @@
np.hide()
def posInterval(self, *args, **kw):
import LerpInterval
from direct.interval import LerpInterval
return LerpInterval.LerpPosInterval(self, *args, **kw)
def hprInterval(self, *args, **kw):
import LerpInterval
from direct.interval import LerpInterval
return LerpInterval.LerpHprInterval(self, *args, **kw)
def scaleInterval(self, *args, **kw):
import LerpInterval
from direct.interval import LerpInterval
return LerpInterval.LerpScaleInterval(self, *args, **kw)
def shearInterval(self, *args, **kw):
import LerpInterval
from direct.interval import LerpInterval
return LerpInterval.LerpShearInterval(self, *args, **kw)
def posHprInterval(self, *args, **kw):
import LerpInterval
from direct.interval import LerpInterval
return LerpInterval.LerpPosHprInterval(self, *args, **kw)
def hprScaleInterval(self, *args, **kw):
import LerpInterval
from direct.interval import LerpInterval
return LerpInterval.LerpHprScaleInterval(self, *args, **kw)
def posHprScaleInterval(self, *args, **kw):
import LerpInterval
from direct.interval import LerpInterval
return LerpInterval.LerpPosHprScaleInterval(self, *args, **kw)
def posHprScaleShearInterval(self, *args, **kw):
import LerpInterval
from direct.interval import LerpInterval
return LerpInterval.LerpPosHprScaleShearInterval(self, *args, **kw)
def colorInterval(self, *args, **kw):
import LerpInterval
from direct.interval import LerpInterval
return LerpInterval.LerpColorInterval(self, *args, **kw)
def colorScaleInterval(self, *args, **kw):
import LerpInterval
from direct.interval import LerpInterval
return LerpInterval.LerpColorScaleInterval(self, *args, **kw)
def attachCollisionSphere(self, name, cx,cy,cz,r, fromCollide, intoCollide):
import CollisionSphere
import CollisionNode
from pandac import CollisionSphere
from pandac import CollisionNode
coll = CollisionSphere.CollisionSphere(cx,cy,cz,r)
collNode = CollisionNode.CollisionNode(name)
collNode.addSolid(coll)
@ -1000,8 +1000,8 @@
return collNodePath
def attachCollisionSegment(self, name, ax,ay,az, bx,by,bz, fromCollide, intoCollide):
import CollisionSegment
import CollisionNode
from pandac import CollisionSegment
from pandac import CollisionNode
coll = CollisionSegment.CollisionSegment(ax,ay,az, bx,by,bz)
collNode = CollisionNode.CollisionNode(name)
collNode.addSolid(coll)
@ -1011,8 +1011,8 @@
return collNodePath
def attachCollisionRay(self, name, ox,oy,oz, dx,dy,dz, fromCollide, intoCollide):
import CollisionRay
import CollisionNode
from pandac import CollisionRay
from pandac import CollisionNode
coll = CollisionRay.CollisionRay(ox,oy,oz, dx,dy,dz)
collNode = CollisionNode.CollisionNode(name)
collNode.addSolid(coll)

View File

@ -16,7 +16,7 @@
return npList
def getTightBounds(self):
import Point3
from pandac import Point3
if self.getNumPaths() == 0:
return (Point3.Point3(0), Point3.Point3(0))

View File

View File

@ -1,6 +1,6 @@
# create a DirectNotify category for FFI modules
from DirectNotifyGlobal import *
from direct.directnotify.DirectNotifyGlobal import *
notify = directNotify.newCategory("FFI")
# This is the name of the file that the importing code will be stored

View File

@ -19,7 +19,7 @@ DowncastMap = {}
# The type map is used for upcasting and downcasting through
# the panda inheritance chain
def registerInTypeMap(pythonClass):
import TypedObject
from pandac import TypedObject
if issubclass(pythonClass, TypedObject.TypedObject):
typeIndex = pythonClass.getClassType().getIndex()
WrapperClassMap[typeIndex] = pythonClass
@ -191,7 +191,7 @@ class FFIExternalObject:
# We create a LineStream for the output function to write to, then we extract
# the string out of it and return it as our str
try:
import LineStream
from pandac import LineStream
lineStream = LineStream.LineStream()
self.output(lineStream)
baseRepr = lineStream.getLine()
@ -210,7 +210,7 @@ class FFIExternalObject:
# Lots of Panda classes have an write or output function defined that takes an Ostream
# We create a LineStream for the write or output function to write to, then we extract
# the string out of it and return it as our repr
import LineStream
from pandac import LineStream
lineStream = LineStream.LineStream()
try:
# First try the write function, that is the better one

View File

@ -13,7 +13,7 @@ import FFISpecs
import FFIRename
import FFIConstants
import FFIOverload
from PythonUtil import *
from direct.showbase.PythonUtil import *
# FFIConstants.notify.setDebug(1)
FFIConstants.notify.info('Importing interrogate library: ' + FFIConstants.InterrogateModuleName)
@ -155,7 +155,7 @@ def outputImportFileImports(file, typeList, CModuleName):
file.write('\n')
file.write('# Put the classes in the wrapper class map\n')
file.write('from FFIExternalObject import registerInTypeMap\n')
file.write('from direct.ffi.FFIExternalObject import registerInTypeMap\n')
file.write('\n')
for moduleName in moduleList:
file.write('registerInTypeMap(' + moduleName + ')\n')
@ -718,6 +718,12 @@ class FFIInterrogateDatabase:
file.write('from ' + CModuleName + 'Modules import *\n')
file.close()
# Generate an empty __init__.py to make the directory a Python
# package.
init = os.path.join(codeDir, '__init__.py')
file = open(init, 'w')
file.close()
# Commented out based upon assumption that squeeze will do the compile
#FFIConstants.notify.info( 'Compiling code...')
#compileall.compile_dir(codeDir)

View File

@ -1,4 +1,4 @@
from PythonUtil import *
from direct.showbase.PythonUtil import *
from types import *
import string
import FFIConstants

View File

@ -4,7 +4,7 @@ import FFITypes
import FFIOverload
import string
from PythonUtil import *
from direct.showbase.PythonUtil import *
augmentedAssignments = ['__iadd__', '__isub__', '__imul__', '__idiv__',
'__ior__', '__iand__', '__ixor__',

View File

@ -15,7 +15,7 @@ import FFIConstants
import FFIOverload
from PythonUtil import *
from direct.showbase.PythonUtil import *
TypedObjectDescriptor = None
@ -639,7 +639,7 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
indent(file, 0, 'import ' + moduleName + '\n')
indent(file, 0, 'import ' + moduleName + 'Downcasts\n')
indent(file, 0, '\n')
indent(file, 0, 'import FFIExternalObject\n')
indent(file, 0, 'from direct.ffi import FFIExternalObject\n')
def outputImportsRecursively(self, parent, file, nesting):

View File

View File

@ -57,7 +57,7 @@ if [ "$DIRECT" == "" ]; then
fi
fi
pyDir=$DIRECT/lib/py
pyDir=$DIRECT/lib/pandac
extDir=$DIRECT/src/extensions
pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py
@ -90,13 +90,13 @@ elif [ "$buildType" = "win-publish" ]; then
elif [ "$buildType" = "install" ]; then
# Use relative paths; as installed on a machine without ctattach etc.
pyDir=$install_dir/lib/py
pyDir=$install_dir/pandac
ppython=$install_dir/bin/ppython
pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py
$ppython -d $install_dir/bin/generatePythonCode -O -v -d $pyDir -e $DIRECT/src/extensions -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
elif [ "$buildType" = "release" ]; then
# Use relative paths; as installed on a machine without ctattach etc.
pyDir=$install_dir/lib/py
pyDir=$install_dir/pandac
ppython=$install_dir/bin/ppython
pSqueezer=$DIRECT/src/showbase/pandaSqueezer.py
$ppython $install_dir/bin/generatePythonCode -v -d $pyDir -e $DIRECT/src/extensions -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect $extra_genPyCode_libs || exit
@ -107,8 +107,9 @@ fi
if [ "$fSqueeze" = "squeezeMe" ]; then
echo SQUEEZING PandaModules
rm -f $pyDir/PandaModules.py* || exit
rm -f $pyDir/PandaModules.py* $pyDir/__init__.py || exit
$ppython $ppythonOptimizeFlag $pSqueezer $optimizeFlag -d $pyDir || exit
touch $pyDir/__init__.py || exit
else
# renaming PandaModulesUnsqueezed.py to PandaModules.py
cd $pyDir || exit

View File

@ -4,7 +4,7 @@
import getopt
import sys
import os
import FFIConstants
from direct.ffi import FFIConstants
# Define a help string for the user
helpString ="""
@ -117,7 +117,7 @@ else:
FFIConstants.CodeModuleNameList = codeLibs
# Ok, now we can start generating code
import FFIInterrogateDatabase
from direct.ffi import FFIInterrogateDatabase
db = FFIInterrogateDatabase.FFIInterrogateDatabase()
db.generateCode(outputDir, extensionsDir)

View File

@ -5,7 +5,7 @@ existing code. New code should use the FSM module instead.
"""
from DirectObject import *
from direct.showbase.DirectObject import *
import types
class ClassicFSM(DirectObject):
@ -348,7 +348,7 @@ class ClassicFSM(DirectObject):
return 0
def view(self):
import FSMInspector
from direct.tkpanels import FSMInspector
FSMInspector.FSMInspector(self)

View File

@ -2,8 +2,8 @@
previously called FSM.py (now called ClassicFSM.py).
"""
import DirectObject
import DirectNotifyGlobal
from direct.showbase import DirectObject
from direct.directnotify import DirectNotifyGlobal
import types
import string

View File

@ -1,10 +1,10 @@
import DirectNotifyGlobal
from direct.directnotify import DirectNotifyGlobal
#import DistributedObject
import ClassicFSM
import State
import Task
from direct.task import Task
class FourState:

View File

@ -1,10 +1,10 @@
import DirectNotifyGlobal
from direct.directnotify import DirectNotifyGlobal
#import DistributedObjectAI
import ClassicFSM
import State
import Task
from direct.task import Task
class FourStateAI:

View File

@ -1,6 +1,6 @@
import FSM
from PandaModules import *
import Task
from pandac.PandaModules import *
from direct.task import Task
import string

View File

@ -1,7 +1,7 @@
"""State module: contains State class"""
from DirectObject import *
from direct.showbase.DirectObject import *
import types
# This gets set by a dconfig variable in ShowBase.py

View File

@ -1,9 +1,9 @@
"""StateData module: contains StateData class"""
from DirectObject import *
from direct.showbase.DirectObject import *
import DirectNotifyGlobal
from direct.directnotify import DirectNotifyGlobal
class StateData(DirectObject):
"""

View File

View File

@ -2,11 +2,11 @@ from DirectGuiGlobals import *
from OnscreenText import *
from OnscreenGeom import *
from OnscreenImage import *
from DirectUtil import ROUND_TO
import PandaObject
import Task
from direct.directtools.DirectUtil import ROUND_TO
from direct.showbase import PandaObject
from direct.task import Task
import string
import ShowBase
from direct.showbase import ShowBase
"""
Base class for all Direct Gui items. Handles composite widgets and

View File

@ -2,7 +2,7 @@
Global definitions used by Direct Gui Classes and handy constants
that can be used during widget construction
"""
from PandaModules import *
from pandac.PandaModules import *
# USEFUL GUI CONSTANTS
# Constant used to indicate that an option can only be set by a call

View File

@ -1,4 +1,4 @@
from ShowBaseGlobal import *
from direct.showbase.ShowBaseGlobal import *
from DirectGui import *
from whrandom import *

View File

@ -1,6 +1,6 @@
from DirectFrame import *
from DirectButton import *
import Task
from direct.task import Task
import types
class DirectScrolledList(DirectFrame):

View File

@ -1,6 +1,6 @@
"""OnscreenGeom module: contains the OnscreenGeom class"""
from PandaObject import *
from direct.showbase.PandaObject import *
import types
class OnscreenGeom(PandaObject, NodePath):

View File

@ -1,6 +1,6 @@
"""OnscreenImage module: contains the OnscreenImage class"""
from PandaObject import *
from direct.showbase.PandaObject import *
import types
class OnscreenImage(PandaObject, NodePath):

View File

@ -1,6 +1,6 @@
"""OnscreenText module: contains the OnscreenText class"""
from PandaObject import *
from direct.showbase.PandaObject import *
import DirectGuiGlobals
import types

View File

View File

@ -1,10 +1,10 @@
"""ActorInterval module: contains the ActorInterval class"""
from PandaModules import *
from DirectNotifyGlobal import *
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
import Interval
import math
import LerpBlendHelpers
from direct.showbase import LerpBlendHelpers
class ActorInterval(Interval.Interval):

View File

@ -1,8 +1,8 @@
"""FunctionInterval module: contains the FunctionInterval class"""
from PandaModules import *
from MessengerGlobal import *
from DirectNotifyGlobal import *
from pandac.PandaModules import *
from direct.showbase.MessengerGlobal import *
from direct.directnotify.DirectNotifyGlobal import *
import Interval
import types
@ -381,7 +381,7 @@ t2.play()
smiley = loader.loadModel('models/misc/smiley')
import Actor
from direct.actor import Actor
donald = Actor.Actor()
donald.loadModel("phase_6/models/char/donald-wheel-1000")
donald.loadAnims({"steer":"phase_6/models/char/donald-wheel-wheel"})

View File

@ -1,9 +1,9 @@
"""IndirectInterval module: contains the IndirectInterval class"""
from PandaModules import *
from DirectNotifyGlobal import *
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
import Interval
import LerpBlendHelpers
from direct.showbase import LerpBlendHelpers
class IndirectInterval(Interval.Interval):
"""

View File

@ -1,9 +1,9 @@
"""Interval module: contains the Interval class"""
from DirectObject import *
from PandaModules import *
import Task
import PythonUtil
from direct.showbase.DirectObject import *
from pandac.PandaModules import *
from direct.task import Task
from direct.showbase import PythonUtil
import math
class Interval(DirectObject):
@ -342,7 +342,7 @@ class Interval(DirectObject):
def __spawnTask(self):
# Spawn task
import Task
from direct.task import Task
self.__removeTask()
taskName = self.getName() + '-play'
task = Task.Task(self.__playTask)
@ -360,7 +360,7 @@ class Interval(DirectObject):
taskMgr.remove(task)
def __playTask(self, task):
import Task
from direct.task import Task
again = self.stepPlay()
self.privPostEvent()
if again:
@ -372,12 +372,12 @@ class Interval(DirectObject):
"""
Popup control panel for interval.
"""
import TkGlobal
from direct.showbase import TkGlobal
import math
# I moved this here because Toontown does not ship Tk
from Tkinter import Toplevel, Frame, Button, LEFT, X
import Pmw
import EntryScale
from direct.tkwidgets import EntryScale
if tl == None:
tl = Toplevel()
tl.title('Interval Controls')

View File

@ -9,7 +9,7 @@ from IndirectInterval import *
from MopathInterval import *
from ParticleInterval import *
from SoundInterval import *
from WaitInterval import *
from pandac.WaitInterval import *
from ProjectileInterval import *
from MetaInterval import *
from IntervalManager import *

View File

@ -1,6 +1,6 @@
from PandaModules import *
from DirectNotifyGlobal import *
import EventManager
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
from direct.showbase import EventManager
import Interval
import types
import fnmatch

View File

@ -1,9 +1,9 @@
from PandaModules import *
from ShowBaseGlobal import *
from pandac.PandaModules import *
from direct.showbase.ShowBaseGlobal import *
from IntervalGlobal import *
from Actor import *
from direct.actor.Actor import *
import Mopath
from direct.directutil import Mopath
boat = loader.loadModel('models/misc/smiley')
boat.reparentTo(render)

View File

@ -1,9 +1,9 @@
"""LerpInterval module: contains the LerpInterval class"""
from PandaModules import *
from DirectNotifyGlobal import *
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
import Interval
import LerpBlendHelpers
from direct.showbase import LerpBlendHelpers
#
# Most of the intervals defined in this module--the group up here at

View File

@ -1,8 +1,8 @@
from PandaModules import *
from DirectNotifyGlobal import *
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
from IntervalManager import ivalMgr
import Interval
import Task
from direct.task import Task
import types
PREVIOUS_END = CMetaInterval.RSPreviousEnd

View File

@ -1,8 +1,8 @@
"""MopathInterval module: contains the MopathInterval class"""
import LerpInterval
from PandaModules import *
from DirectNotifyGlobal import *
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
# import Mopath

View File

@ -1,10 +1,10 @@
"""ParticleInterval module: contains the ParticleInterval class"""
from PandaModules import *
from DirectNotifyGlobal import *
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
import Interval
import ParticleEffect
from direct.particles import ParticleEffect
class ParticleInterval(Interval.Interval):
# Name counter

View File

@ -1,10 +1,10 @@
"""ProjectileInterval module: contains the ProjectileInterval class"""
from DirectObject import *
from PandaModules import *
from direct.showbase.DirectObject import *
from pandac.PandaModules import *
from Interval import Interval
from PythonUtil import lerp
import PythonUtil
from direct.showbase.PythonUtil import lerp
from direct.showbase import PythonUtil
class ProjectileInterval(Interval):
"""ProjectileInterval class: moves a nodepath through the trajectory

View File

@ -1,7 +1,7 @@
"""SoundInterval module: contains the SoundInterval class"""
from PandaModules import *
from DirectNotifyGlobal import *
from pandac.PandaModules import *
from direct.directnotify.DirectNotifyGlobal import *
import Interval
class SoundInterval(Interval.Interval):

View File

View File

@ -1,4 +1,4 @@
from IntervalGlobal import *
from direct.interval.IntervalGlobal import *
import BasicEntities
import random

Some files were not shown because too many files have changed in this diff Show More