mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
*** empty log message ***
This commit is contained in:
parent
010cfe3e2b
commit
e7cd96bf9d
@ -1,7 +1,7 @@
|
|||||||
"""Actor module: contains the Actor class"""
|
"""Actor module: contains the Actor class"""
|
||||||
|
|
||||||
from direct.showbase.PandaObject import *
|
from direct.showbase.PandaObject import *
|
||||||
from pandac import LODNode
|
from pandac.PandaModules import LODNode
|
||||||
import types
|
import types
|
||||||
|
|
||||||
class Actor(PandaObject, NodePath):
|
class Actor(PandaObject, NodePath):
|
||||||
@ -355,7 +355,7 @@ class Actor(PandaObject, NodePath):
|
|||||||
If one is not supplied as an argument, make one
|
If one is not supplied as an argument, make one
|
||||||
"""
|
"""
|
||||||
if (node == None):
|
if (node == None):
|
||||||
lod = LODNode.LODNode("lod")
|
lod = LODNode("lod")
|
||||||
self.__LODNode = self.__geomNode.attachNewNode(lod)
|
self.__LODNode = self.__geomNode.attachNewNode(lod)
|
||||||
else:
|
else:
|
||||||
self.__LODNode = self.__geomNode.attachNewNode(node)
|
self.__LODNode = self.__geomNode.attachNewNode(node)
|
||||||
@ -504,9 +504,8 @@ class Actor(PandaObject, NodePath):
|
|||||||
It used to be legal to let the animName default to the
|
It used to be legal to let the animName default to the
|
||||||
currently-playing anim, but this was confusing and could lead
|
currently-playing anim, but this was confusing and could lead
|
||||||
to the wrong anim's play rate getting set. Better to insist
|
to the wrong anim's play rate getting set. Better to insist
|
||||||
on this parameter.
|
on this parameter.
|
||||||
|
NOTE: sets play rate on all LODs"""
|
||||||
NOTE: sets play rate on all LODs"""
|
|
||||||
for control in self.getAnimControls(animName, partName):
|
for control in self.getAnimControls(animName, partName):
|
||||||
control.setPlayRate(rate)
|
control.setPlayRate(rate)
|
||||||
|
|
||||||
|
@ -39,3 +39,5 @@ class DistributedActor(DistributedNode.DistributedNode, Actor.Actor):
|
|||||||
Actor.Actor.delete(self)
|
Actor.Actor.delete(self)
|
||||||
|
|
||||||
|
|
||||||
|
def loop(self, animName, restart=1, partName=None,fromFrame=None, toFrame=None):
|
||||||
|
return Actor.Actor.loop(self,animName,restart,partName,fromFrame,toFrame);
|
||||||
|
@ -523,7 +523,7 @@ class GravityWalker(DirectObject.DirectObject):
|
|||||||
# rotMat is the rotation matrix corresponding to
|
# rotMat is the rotation matrix corresponding to
|
||||||
# our previous heading.
|
# our previous heading.
|
||||||
rotMat=Mat3.rotateMatNormaxis(self.avatarNodePath.getH(), Vec3.up())
|
rotMat=Mat3.rotateMatNormaxis(self.avatarNodePath.getH(), Vec3.up())
|
||||||
step=rotMat.xform(self.vel) + (self.priorParent * dt)
|
step=(self.priorParent * dt) + rotMat.xform(self.vel)
|
||||||
self.avatarNodePath.setFluidPos(Point3(
|
self.avatarNodePath.setFluidPos(Point3(
|
||||||
self.avatarNodePath.getPos()+step))
|
self.avatarNodePath.getPos()+step))
|
||||||
if 0:
|
if 0:
|
||||||
|
@ -18,7 +18,7 @@ from direct.showbase.ShowBaseGlobal import *
|
|||||||
|
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from direct.showbase import DirectObject
|
from direct.showbase import DirectObject
|
||||||
from pandac import PhysicsManager
|
from pandac.PandaModules import PhysicsManager
|
||||||
import math
|
import math
|
||||||
|
|
||||||
#import LineStream
|
#import LineStream
|
||||||
|
@ -17,7 +17,7 @@ animations based on control events.
|
|||||||
from direct.showbase.ShowBaseGlobal import *
|
from direct.showbase.ShowBaseGlobal import *
|
||||||
|
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from pandac import PhysicsManager
|
from pandac.PandaModules import PhysicsManager
|
||||||
import math
|
import math
|
||||||
|
|
||||||
import PhysicsWalker
|
import PhysicsWalker
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from direct.showbase.PandaObject import *
|
from direct.showbase.PandaObject import *
|
||||||
from direct.directtools.DirectGeometry import *
|
from direct.directtools.DirectGeometry import *
|
||||||
|
|
||||||
from pandac import NodePath
|
from pandac.PandaModules import NodePath
|
||||||
|
|
||||||
class Mopath(PandaObject):
|
class Mopath(PandaObject):
|
||||||
|
|
||||||
|
@ -411,6 +411,8 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
return distObj
|
return distObj
|
||||||
|
|
||||||
def generateWithRequiredOtherFields(self, dclass, doId, di, parentId = None, zoneId = None):
|
def generateWithRequiredOtherFields(self, dclass, doId, di, parentId = None, zoneId = None):
|
||||||
|
print "---------------------------"
|
||||||
|
print doId
|
||||||
if self.doId2do.has_key(doId):
|
if self.doId2do.has_key(doId):
|
||||||
# ...it is in our dictionary.
|
# ...it is in our dictionary.
|
||||||
# Just update it.
|
# Just update it.
|
||||||
|
@ -152,7 +152,6 @@ class ConnectionRepository(DoInterestManager, CConnectionRepository):
|
|||||||
if classDef == None:
|
if classDef == None:
|
||||||
className = dclass.getName()
|
className = dclass.getName()
|
||||||
classDef = dcImports.get(className)
|
classDef = dcImports.get(className)
|
||||||
|
|
||||||
if classDef is None:
|
if classDef is None:
|
||||||
self.notify.info("No class definition for %s." % (className))
|
self.notify.info("No class definition for %s." % (className))
|
||||||
else:
|
else:
|
||||||
@ -161,11 +160,15 @@ class ConnectionRepository(DoInterestManager, CConnectionRepository):
|
|||||||
self.notify.error("Module %s does not define class %s." % (className, className))
|
self.notify.error("Module %s does not define class %s." % (className, className))
|
||||||
classDef = getattr(classDef, className)
|
classDef = getattr(classDef, className)
|
||||||
|
|
||||||
if type(classDef) not in (types.ClassType, types.TypeType):
|
# rhh this seems to fail with new system not sure why ?
|
||||||
self.notify.error("Symbol %s is not a class name." % (className))
|
#print "---classname " +className
|
||||||
else:
|
#print type(classDef)
|
||||||
dclass.setClassDef(classDef)
|
#print types.ClassType
|
||||||
|
#if type(classDef) != types.ClassType:
|
||||||
|
# self.notify.error("Symbol %s is not a class name." % (className))
|
||||||
|
#else:
|
||||||
|
# dclass.setClassDef(classDef)
|
||||||
|
dclass.setClassDef(classDef)
|
||||||
self.dclassesByName[className] = dclass
|
self.dclassesByName[className] = dclass
|
||||||
if number >= 0:
|
if number >= 0:
|
||||||
self.dclassesByNumber[number] = dclass
|
self.dclassesByNumber[number] = dclass
|
||||||
|
@ -23,36 +23,36 @@ class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
|
|||||||
|
|
||||||
# These have their FFI functions exposed for efficiency
|
# These have their FFI functions exposed for efficiency
|
||||||
def setSmH(self, h, t):
|
def setSmH(self, h, t):
|
||||||
self.private__overloaded_setH_ptrNodePath_float(h)
|
self.setH(h)
|
||||||
|
|
||||||
def setSmZ(self, z, t):
|
def setSmZ(self, z, t):
|
||||||
self.private__overloaded_setZ_ptrNodePath_float(z)
|
self.setZ(z)
|
||||||
|
|
||||||
def setSmXY(self, x, y, t):
|
def setSmXY(self, x, y, t):
|
||||||
self.private__overloaded_setX_ptrNodePath_float(x)
|
self.setX(x)
|
||||||
self.private__overloaded_setY_ptrNodePath_float(y)
|
self.setY(y)
|
||||||
|
|
||||||
def setSmXZ(self, x, z, t):
|
def setSmXZ(self, x, z, t):
|
||||||
self.private__overloaded_setX_ptrNodePath_float(x)
|
self.setX(x)
|
||||||
self.private__overloaded_setZ_ptrNodePath_float(z)
|
self.setZ(z)
|
||||||
|
|
||||||
def setSmPos(self, x, y, z, t):
|
def setSmPos(self, x, y, z, t):
|
||||||
self.private__overloaded_setPos_ptrNodePath_float_float_float(x,y,z)
|
self.setPos(x,y,z)
|
||||||
|
|
||||||
def setSmHpr(self, h, p, r, t):
|
def setSmHpr(self, h, p, r, t):
|
||||||
self.private__overloaded_setHpr_ptrNodePath_float_float_float(h,p,r)
|
self.setHpr(h,p,r)
|
||||||
|
|
||||||
def setSmXYH(self, x, y, h, t):
|
def setSmXYH(self, x, y, h, t):
|
||||||
self.private__overloaded_setX_ptrNodePath_float(x)
|
self.setX(x)
|
||||||
self.private__overloaded_setY_ptrNodePath_float(y)
|
self.setY(y)
|
||||||
self.private__overloaded_setH_ptrNodePath_float(h)
|
self.setH(h)
|
||||||
|
|
||||||
def setSmXYZH(self, x, y, z, h, t):
|
def setSmXYZH(self, x, y, z, h, t):
|
||||||
self.private__overloaded_setPos_ptrNodePath_float_float_float(x,y,z)
|
self.setPos(x,y,z)
|
||||||
self.private__overloaded_setH_ptrNodePath_float(h)
|
self.setH(h)
|
||||||
|
|
||||||
def setSmPosHpr(self, x, y, z, h, p, r, t):
|
def setSmPosHpr(self, x, y, z, h, p, r, t):
|
||||||
self.private__overloaded_setPosHpr_ptrNodePath_float_float_float_float_float_float(x,y,z,h,p,r)
|
self.setPosHpr(x,y,z,h,p,r)
|
||||||
|
|
||||||
def clearSmoothing(self, bogus = None):
|
def clearSmoothing(self, bogus = None):
|
||||||
pass
|
pass
|
||||||
@ -60,16 +60,16 @@ class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
|
|||||||
|
|
||||||
# Do we use these on the AIx?
|
# Do we use these on the AIx?
|
||||||
def setComponentX(self, x):
|
def setComponentX(self, x):
|
||||||
self.private__overloaded_setX_ptrNodePath_float(x)
|
self.setX(x)
|
||||||
def setComponentY(self, y):
|
def setComponentY(self, y):
|
||||||
self.private__overloaded_setY_ptrNodePath_float(y)
|
self.setY(y)
|
||||||
def setComponentZ(self, z):
|
def setComponentZ(self, z):
|
||||||
self.private__overloaded_setZ_ptrNodePath_float(z)
|
self.setZ(z)
|
||||||
def setComponentH(self, h):
|
def setComponentH(self, h):
|
||||||
self.private__overloaded_setH_ptrNodePath_float(h)
|
self.setH(h)
|
||||||
def setComponentP(self, p):
|
def setComponentP(self, p):
|
||||||
self.private__overloaded_setP_ptrNodePath_float(p)
|
self.setP(p)
|
||||||
def setComponentR(self, r):
|
def setComponentR(self, r):
|
||||||
self.private__overloaded_setR_ptrNodePath_float(r)
|
self.setR(r)
|
||||||
def setComponentT(self, t):
|
def setComponentT(self, t):
|
||||||
pass
|
pass
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
# Import the type numbers
|
# Import the type numbers
|
||||||
from pandac.DCSubatomicType import *
|
|
||||||
|
|
||||||
class PyDatagram(Datagram):
|
class PyDatagram(Datagram):
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
# Import the type numbers
|
# Import the type numbers
|
||||||
from pandac.DCSubatomicType import *
|
|
||||||
|
|
||||||
class PyDatagramIterator(DatagramIterator):
|
class PyDatagramIterator(DatagramIterator):
|
||||||
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
from PandaModules import *
|
@ -1,4 +1,4 @@
|
|||||||
try:
|
try:
|
||||||
from libpiratesModules import *
|
from libpirates import *
|
||||||
except ImportError , e:
|
except ImportError , e:
|
||||||
print " ** Warning * Failed to load -->", e
|
print " ** Warning * Failed to load -->", e
|
||||||
|
@ -9,7 +9,8 @@ from IndirectInterval import *
|
|||||||
from MopathInterval import *
|
from MopathInterval import *
|
||||||
from ParticleInterval import *
|
from ParticleInterval import *
|
||||||
from SoundInterval import *
|
from SoundInterval import *
|
||||||
from pandac.WaitInterval import *
|
#from pandac.WaitInterval import *
|
||||||
|
from pandac.PandaModules import *
|
||||||
from ProjectileInterval import *
|
from ProjectileInterval import *
|
||||||
from MetaInterval import *
|
from MetaInterval import *
|
||||||
from IntervalManager import *
|
from IntervalManager import *
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from pandac.PandaModules import *
|
from pandac.PandaModules import *
|
||||||
|
from pandac import PandaModules
|
||||||
from direct.directnotify.DirectNotifyGlobal import *
|
from direct.directnotify.DirectNotifyGlobal import *
|
||||||
from direct.showbase import EventManager
|
from direct.showbase import EventManager
|
||||||
import Interval
|
import Interval
|
||||||
@ -12,33 +13,51 @@ class IntervalManager(CIntervalManager):
|
|||||||
# the Python extensions is to add support for Python-based
|
# the Python extensions is to add support for Python-based
|
||||||
# intervals (like MetaIntervals).
|
# intervals (like MetaIntervals).
|
||||||
|
|
||||||
def __init__(self, globalPtr = 0):
|
if PandaModules.__dict__.has_key("Dtool_PyNavtiveInterface"):
|
||||||
# Pass globalPtr == 1 to the constructor to trick it into
|
def __init__(self, globalPtr = 0):
|
||||||
# "constructing" a Python wrapper around the global
|
# Pass globalPtr == 1 to the constructor to trick it into
|
||||||
# CIntervalManager object.
|
# "constructing" a Python wrapper around the global
|
||||||
|
# CIntervalManager object.
|
||||||
if globalPtr:
|
##self.cObj = CIntervalManager.getGlobalPtr()
|
||||||
#CIntervalManager.__init__(self, None)
|
##Dtool_BarrowThisRefrence(self,self.cObj)
|
||||||
cObj = CIntervalManager.getGlobalPtr()
|
##self.dd = self
|
||||||
self.this = cObj.this
|
if globalPtr:
|
||||||
self.userManagesMemory = 0
|
self.cObj = CIntervalManager.getGlobalPtr()
|
||||||
|
Dtool_BarrowThisRefrence(self,self.cObj)
|
||||||
else:
|
self.dd = self
|
||||||
CIntervalManager.__init__(self)
|
else:
|
||||||
|
CIntervalManager.__init__(self)
|
||||||
# Set up a custom event queue for handling C++ events from
|
self.eventQueue = EventQueue()
|
||||||
# intervals.
|
self.MyEventmanager = EventManager.EventManager(self.eventQueue)
|
||||||
self.eventQueue = EventQueue()
|
self.setEventQueue(self.eventQueue)
|
||||||
self.eventManager = EventManager.EventManager(self.eventQueue)
|
self.ivals = []
|
||||||
self.setEventQueue(self.eventQueue)
|
self.removedIvals = {}
|
||||||
|
else: ## the old interface
|
||||||
self.ivals = []
|
def __init__(self, globalPtr = 0):
|
||||||
self.removedIvals = {}
|
# Pass globalPtr == 1 to the constructor to trick it into
|
||||||
|
# "constructing" a Python wrapper around the global
|
||||||
|
# CIntervalManager object.
|
||||||
|
if globalPtr:
|
||||||
|
#CIntervalManager.__init__(self, None)
|
||||||
|
cObj = CIntervalManager.getGlobalPtr()
|
||||||
|
self.this = cObj.this
|
||||||
|
self.userManagesMemory = 0
|
||||||
|
else:
|
||||||
|
CIntervalManager.__init__(self)
|
||||||
|
# Set up a custom event queue for handling C++ events from
|
||||||
|
# intervals.
|
||||||
|
self.eventQueue = EventQueue()
|
||||||
|
self.MyEventmanager = EventManager.EventManager(self.eventQueue)
|
||||||
|
self.setEventQueue(self.eventQueue)
|
||||||
|
self.ivals = []
|
||||||
|
self.removedIvals = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def addInterval(self, interval):
|
def addInterval(self, interval):
|
||||||
index = self.addCInterval(interval, 1)
|
index = self.addCInterval(interval, 1)
|
||||||
self.__storeInterval(interval, index)
|
self.__storeInterval(interval, index)
|
||||||
|
|
||||||
def removeInterval(self, interval):
|
def removeInterval(self, interval):
|
||||||
index = self.findCInterval(interval.getName())
|
index = self.findCInterval(interval.getName())
|
||||||
if index >= 0:
|
if index >= 0:
|
||||||
@ -54,8 +73,7 @@ class IntervalManager(CIntervalManager):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def finishIntervalsMatching(self, pattern):
|
def finishIntervalsMatching(self, pattern):
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
maxIndex = self.getMaxIndex()
|
maxIndex = self.getMaxIndex()
|
||||||
for index in range(maxIndex):
|
for index in range(maxIndex):
|
||||||
ival = self.getCInterval(index)
|
ival = self.getCInterval(index)
|
||||||
@ -77,7 +95,6 @@ class IntervalManager(CIntervalManager):
|
|||||||
def step(self):
|
def step(self):
|
||||||
# This method should be called once per frame to perform all
|
# This method should be called once per frame to perform all
|
||||||
# of the per-frame processing on the active intervals.
|
# of the per-frame processing on the active intervals.
|
||||||
|
|
||||||
# Call C++ step, then do the Python stuff.
|
# Call C++ step, then do the Python stuff.
|
||||||
CIntervalManager.step(self)
|
CIntervalManager.step(self)
|
||||||
self.__doPythonCallbacks()
|
self.__doPythonCallbacks()
|
||||||
@ -86,7 +103,6 @@ class IntervalManager(CIntervalManager):
|
|||||||
# This method should be called during an emergency cleanup
|
# This method should be called during an emergency cleanup
|
||||||
# operation, to automatically pause or finish all active
|
# operation, to automatically pause or finish all active
|
||||||
# intervals tagged with autoPause or autoFinish set true.
|
# intervals tagged with autoPause or autoFinish set true.
|
||||||
|
|
||||||
# Call C++ interrupt, then do the Python stuff.
|
# Call C++ interrupt, then do the Python stuff.
|
||||||
CIntervalManager.interrupt(self)
|
CIntervalManager.interrupt(self)
|
||||||
self.__doPythonCallbacks()
|
self.__doPythonCallbacks()
|
||||||
@ -94,7 +110,6 @@ class IntervalManager(CIntervalManager):
|
|||||||
def __doPythonCallbacks(self):
|
def __doPythonCallbacks(self):
|
||||||
# This method does all of the required Python post-processing
|
# This method does all of the required Python post-processing
|
||||||
# after performing some C++-level action.
|
# after performing some C++-level action.
|
||||||
|
|
||||||
# It is important to call all of the python callbacks on the
|
# It is important to call all of the python callbacks on the
|
||||||
# just-removed intervals before we call any of the callbacks
|
# just-removed intervals before we call any of the callbacks
|
||||||
# on the still-running intervals.
|
# on the still-running intervals.
|
||||||
@ -118,7 +133,7 @@ class IntervalManager(CIntervalManager):
|
|||||||
# C++. We use a custom event queue so we can service all of
|
# C++. We use a custom event queue so we can service all of
|
||||||
# these immediately, rather than waiting for the global event
|
# these immediately, rather than waiting for the global event
|
||||||
# queue to be serviced (which might not be till next frame).
|
# queue to be serviced (which might not be till next frame).
|
||||||
self.eventManager.doEvents()
|
self.MyEventmanager.doEvents()
|
||||||
|
|
||||||
|
|
||||||
def __storeInterval(self, interval, index):
|
def __storeInterval(self, interval, index):
|
||||||
@ -127,8 +142,9 @@ class IntervalManager(CIntervalManager):
|
|||||||
assert(self.ivals[index] == None or self.ivals[index] == interval)
|
assert(self.ivals[index] == None or self.ivals[index] == interval)
|
||||||
self.ivals[index] = interval
|
self.ivals[index] = interval
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return self.__str__()
|
#def __repr__(self):
|
||||||
|
# return self.__str__()
|
||||||
|
|
||||||
# The global IntervalManager object.
|
# The global IntervalManager object.
|
||||||
ivalMgr = IntervalManager(1)
|
ivalMgr = IntervalManager(1)
|
||||||
|
@ -325,6 +325,7 @@ class MetaInterval(CMetaInterval):
|
|||||||
# with all of their associated Python callbacks:
|
# with all of their associated Python callbacks:
|
||||||
|
|
||||||
def setManager(self, manager):
|
def setManager(self, manager):
|
||||||
|
rogerroger
|
||||||
self.__manager = manager
|
self.__manager = manager
|
||||||
CMetaInterval.setManager(self, manager)
|
CMetaInterval.setManager(self, manager)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ from pandac.PandaModules import *
|
|||||||
from direct.showbase.DirectObject import *
|
from direct.showbase.DirectObject import *
|
||||||
from direct.showbase.PhysicsManagerGlobal import *
|
from direct.showbase.PhysicsManagerGlobal import *
|
||||||
|
|
||||||
from pandac import ForceNode
|
#from pandac import ForceNode
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ class ForceGroup(DirectObject):
|
|||||||
else:
|
else:
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
self.node = ForceNode.ForceNode(self.name)
|
self.node = ForceNode(self.name)
|
||||||
self.nodePath = NodePath(self.node)
|
self.nodePath = NodePath(self.node)
|
||||||
self.fEnabled = 0
|
self.fEnabled = 0
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""ParticleManagerGlobal module: contains the global particle system manager"""
|
"""ParticleManagerGlobal module: contains the global particle system manager"""
|
||||||
from pandac import ParticleSystemManager
|
from pandac.PandaModules import ParticleSystemManager
|
||||||
|
|
||||||
particleMgr = ParticleSystemManager.ParticleSystemManager()
|
particleMgr = ParticleSystemManager()
|
||||||
|
@ -2,33 +2,36 @@ from pandac.PandaModules import *
|
|||||||
from ParticleManagerGlobal import *
|
from ParticleManagerGlobal import *
|
||||||
from direct.showbase.PhysicsManagerGlobal import *
|
from direct.showbase.PhysicsManagerGlobal import *
|
||||||
|
|
||||||
from pandac import ParticleSystem
|
from pandac.PandaModules import ParticleSystem
|
||||||
from pandac import BaseParticleFactory
|
from pandac.PandaModules import BaseParticleFactory
|
||||||
from pandac import PointParticleFactory
|
from pandac.PandaModules import PointParticleFactory
|
||||||
from pandac import ZSpinParticleFactory
|
from pandac.PandaModules import ZSpinParticleFactory
|
||||||
#import OrientedParticleFactory
|
#import OrientedParticleFactory
|
||||||
from pandac import BaseParticleRenderer
|
from pandac.PandaModules import BaseParticleRenderer
|
||||||
from pandac import PointParticleRenderer
|
from pandac.PandaModules import PointParticleRenderer
|
||||||
from pandac import LineParticleRenderer
|
from pandac.PandaModules import LineParticleRenderer
|
||||||
from pandac import GeomParticleRenderer
|
from pandac.PandaModules import GeomParticleRenderer
|
||||||
from pandac import SparkleParticleRenderer
|
from pandac.PandaModules import SparkleParticleRenderer
|
||||||
from pandac import SpriteParticleRenderer
|
#from pandac.PandaModules import SpriteParticleRenderer
|
||||||
from pandac import BaseParticleEmitter
|
from pandac.PandaModules import BaseParticleEmitter
|
||||||
from pandac import BoxEmitter
|
from pandac.PandaModules import BoxEmitter
|
||||||
from pandac import DiscEmitter
|
from pandac.PandaModules import DiscEmitter
|
||||||
from pandac import LineEmitter
|
from pandac.PandaModules import LineEmitter
|
||||||
from pandac import PointEmitter
|
from pandac.PandaModules import PointEmitter
|
||||||
from pandac import RectangleEmitter
|
from pandac.PandaModules import RectangleEmitter
|
||||||
from pandac import RingEmitter
|
from pandac.PandaModules import RingEmitter
|
||||||
from pandac import SphereSurfaceEmitter
|
from pandac.PandaModules import SphereSurfaceEmitter
|
||||||
from pandac import SphereVolumeEmitter
|
from pandac.PandaModules import SphereVolumeEmitter
|
||||||
from pandac import TangentRingEmitter
|
from pandac.PandaModules import TangentRingEmitter
|
||||||
|
|
||||||
|
import SpriteParticleRendererExt
|
||||||
|
|
||||||
import string
|
import string
|
||||||
import os
|
import os
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
class Particles(ParticleSystem.ParticleSystem):
|
class Particles(ParticleSystem):
|
||||||
|
|
||||||
notify = DirectNotifyGlobal.directNotify.newCategory('Particles')
|
notify = DirectNotifyGlobal.directNotify.newCategory('Particles')
|
||||||
id = 1
|
id = 1
|
||||||
@ -39,7 +42,7 @@ class Particles(ParticleSystem.ParticleSystem):
|
|||||||
Particles.id += 1
|
Particles.id += 1
|
||||||
else:
|
else:
|
||||||
self.name = name
|
self.name = name
|
||||||
ParticleSystem.ParticleSystem.__init__(self, poolSize)
|
ParticleSystem.__init__(self, poolSize)
|
||||||
# self.setBirthRate(0.02)
|
# self.setBirthRate(0.02)
|
||||||
# self.setLitterSize(10)
|
# self.setLitterSize(10)
|
||||||
# self.setLitterSpread(0)
|
# self.setLitterSpread(0)
|
||||||
@ -102,16 +105,16 @@ class Particles(ParticleSystem.ParticleSystem):
|
|||||||
self.factory = None
|
self.factory = None
|
||||||
self.factoryType = type
|
self.factoryType = type
|
||||||
if (type == "PointParticleFactory"):
|
if (type == "PointParticleFactory"):
|
||||||
self.factory = PointParticleFactory.PointParticleFactory()
|
self.factory = PointParticleFactory()
|
||||||
elif (type == "ZSpinParticleFactory"):
|
elif (type == "ZSpinParticleFactory"):
|
||||||
self.factory = ZSpinParticleFactory.ZSpinParticleFactory()
|
self.factory = ZSpinParticleFactory()
|
||||||
elif (type == "OrientedParticleFactory"):
|
elif (type == "OrientedParticleFactory"):
|
||||||
self.factory = OrientedParticleFactory.OrientedParticleFactory()
|
self.factory = OrientedParticleFactory()
|
||||||
else:
|
else:
|
||||||
print "unknown factory type: %s" % type
|
print "unknown factory type: %s" % type
|
||||||
return None
|
return None
|
||||||
self.factory.setLifespanBase(0.5)
|
self.factory.setLifespanBase(0.5)
|
||||||
ParticleSystem.ParticleSystem.setFactory(self, self.factory)
|
ParticleSystem.setFactory(self, self.factory)
|
||||||
|
|
||||||
def setRenderer(self, type):
|
def setRenderer(self, type):
|
||||||
if (self.rendererType == type):
|
if (self.rendererType == type):
|
||||||
@ -120,12 +123,12 @@ class Particles(ParticleSystem.ParticleSystem):
|
|||||||
self.renderer = None
|
self.renderer = None
|
||||||
self.rendererType = type
|
self.rendererType = type
|
||||||
if (type == "PointParticleRenderer"):
|
if (type == "PointParticleRenderer"):
|
||||||
self.renderer = PointParticleRenderer.PointParticleRenderer()
|
self.renderer = PointParticleRenderer()
|
||||||
self.renderer.setPointSize(1.0)
|
self.renderer.setPointSize(1.0)
|
||||||
elif (type == "LineParticleRenderer"):
|
elif (type == "LineParticleRenderer"):
|
||||||
self.renderer = LineParticleRenderer.LineParticleRenderer()
|
self.renderer = LineParticleRenderer()
|
||||||
elif (type == "GeomParticleRenderer"):
|
elif (type == "GeomParticleRenderer"):
|
||||||
self.renderer = GeomParticleRenderer.GeomParticleRenderer()
|
self.renderer = GeomParticleRenderer()
|
||||||
# This was moved here because we do not want to download
|
# This was moved here because we do not want to download
|
||||||
# the direct tools with toontown.
|
# the direct tools with toontown.
|
||||||
if __dev__:
|
if __dev__:
|
||||||
@ -134,11 +137,11 @@ class Particles(ParticleSystem.ParticleSystem):
|
|||||||
bbox = DirectSelection.DirectBoundingBox(npath)
|
bbox = DirectSelection.DirectBoundingBox(npath)
|
||||||
self.renderer.setGeomNode(bbox.lines.node())
|
self.renderer.setGeomNode(bbox.lines.node())
|
||||||
elif (type == "SparkleParticleRenderer"):
|
elif (type == "SparkleParticleRenderer"):
|
||||||
self.renderer = SparkleParticleRenderer.SparkleParticleRenderer()
|
self.renderer = SparkleParticleRenderer()
|
||||||
elif (type == "SpriteParticleRenderer"):
|
elif (type == "SpriteParticleRenderer"):
|
||||||
self.renderer = SpriteParticleRenderer.SpriteParticleRenderer()
|
self.renderer = SpriteParticleRendererExt.SpriteParticleRendererExt()
|
||||||
if (self.renderer.getSourceType() ==
|
if (self.renderer.getSourceType() ==
|
||||||
SpriteParticleRenderer.SpriteParticleRenderer.STTexture):
|
SpriteParticleRendererExt.SpriteParticleRendererExt.STTexture):
|
||||||
# Use current default texture
|
# Use current default texture
|
||||||
# See sourceTextureName SpriteParticleRenderer-extensions.py
|
# See sourceTextureName SpriteParticleRenderer-extensions.py
|
||||||
self.renderer.setTextureFromFile()
|
self.renderer.setTextureFromFile()
|
||||||
@ -149,7 +152,7 @@ class Particles(ParticleSystem.ParticleSystem):
|
|||||||
else:
|
else:
|
||||||
print "unknown renderer type: %s" % type
|
print "unknown renderer type: %s" % type
|
||||||
return None
|
return None
|
||||||
ParticleSystem.ParticleSystem.setRenderer(self, self.renderer)
|
ParticleSystem.setRenderer(self, self.renderer)
|
||||||
|
|
||||||
def setEmitter(self, type):
|
def setEmitter(self, type):
|
||||||
"""setEmitter(type)"""
|
"""setEmitter(type)"""
|
||||||
@ -159,28 +162,28 @@ class Particles(ParticleSystem.ParticleSystem):
|
|||||||
self.emitter = None
|
self.emitter = None
|
||||||
self.emitterType = type
|
self.emitterType = type
|
||||||
if (type == "BoxEmitter"):
|
if (type == "BoxEmitter"):
|
||||||
self.emitter = BoxEmitter.BoxEmitter()
|
self.emitter = BoxEmitter()
|
||||||
elif (type == "DiscEmitter"):
|
elif (type == "DiscEmitter"):
|
||||||
self.emitter = DiscEmitter.DiscEmitter()
|
self.emitter = DiscEmitter()
|
||||||
elif (type == "LineEmitter"):
|
elif (type == "LineEmitter"):
|
||||||
self.emitter = LineEmitter.LineEmitter()
|
self.emitter = LineEmitter()
|
||||||
elif (type == "PointEmitter"):
|
elif (type == "PointEmitter"):
|
||||||
self.emitter = PointEmitter.PointEmitter()
|
self.emitter = PointEmitter()
|
||||||
elif (type == "RectangleEmitter"):
|
elif (type == "RectangleEmitter"):
|
||||||
self.emitter = RectangleEmitter.RectangleEmitter()
|
self.emitter = RectangleEmitter()
|
||||||
elif (type == "RingEmitter"):
|
elif (type == "RingEmitter"):
|
||||||
self.emitter = RingEmitter.RingEmitter()
|
self.emitter = RingEmitter()
|
||||||
elif (type == "SphereSurfaceEmitter"):
|
elif (type == "SphereSurfaceEmitter"):
|
||||||
self.emitter = SphereSurfaceEmitter.SphereSurfaceEmitter()
|
self.emitter = SphereSurfaceEmitter()
|
||||||
elif (type == "SphereVolumeEmitter"):
|
elif (type == "SphereVolumeEmitter"):
|
||||||
self.emitter = SphereVolumeEmitter.SphereVolumeEmitter()
|
self.emitter = SphereVolumeEmitter()
|
||||||
self.emitter.setRadius(1.0)
|
self.emitter.setRadius(1.0)
|
||||||
elif (type == "TangentRingEmitter"):
|
elif (type == "TangentRingEmitter"):
|
||||||
self.emitter = TangentRingEmitter.TangentRingEmitter()
|
self.emitter = TangentRingEmitter()
|
||||||
else:
|
else:
|
||||||
print "unknown emitter type: %s" % type
|
print "unknown emitter type: %s" % type
|
||||||
return None
|
return None
|
||||||
ParticleSystem.ParticleSystem.setEmitter(self, self.emitter)
|
ParticleSystem.setEmitter(self, self.emitter)
|
||||||
|
|
||||||
def addForce(self, force):
|
def addForce(self, force):
|
||||||
if (force.isLinear()):
|
if (force.isLinear()):
|
||||||
@ -344,7 +347,7 @@ class Particles(ParticleSystem.ParticleSystem):
|
|||||||
elif (self.rendererType == "SpriteParticleRenderer"):
|
elif (self.rendererType == "SpriteParticleRenderer"):
|
||||||
file.write('# Sprite parameters\n')
|
file.write('# Sprite parameters\n')
|
||||||
if (self.renderer.getSourceType() ==
|
if (self.renderer.getSourceType() ==
|
||||||
SpriteParticleRenderer.SpriteParticleRenderer.STTexture):
|
SpriteParticleRendererExt.SpriteParticleRendererExt.STTexture):
|
||||||
tex = self.renderer.getTexture()
|
tex = self.renderer.getTexture()
|
||||||
file.write(targ + '.renderer.setTexture(loader.loadTexture(\'' + tex.getName() + '\'))\n')
|
file.write(targ + '.renderer.setTexture(loader.loadTexture(\'' + tex.getName() + '\'))\n')
|
||||||
else:
|
else:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""PhysicsManagerGlobal module: contains the global physics manager"""
|
"""PhysicsManagerGlobal module: contains the global physics manager"""
|
||||||
from pandac import PhysicsManager
|
from pandac.PandaModules import PhysicsManager
|
||||||
|
|
||||||
physicsMgr = PhysicsManager.PhysicsManager()
|
physicsMgr = PhysicsManager()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""RandomNumGen module: contains the RandomNumGen class"""
|
"""RandomNumGen module: contains the RandomNumGen class"""
|
||||||
|
|
||||||
from direct.directnotify import DirectNotifyGlobal
|
from direct.directnotify import DirectNotifyGlobal
|
||||||
from pandac import Mersenne
|
from pandac.PandaModules import Mersenne
|
||||||
|
|
||||||
def randHash(num):
|
def randHash(num):
|
||||||
""" this returns a random 16-bit integer, given a seed integer.
|
""" this returns a random 16-bit integer, given a seed integer.
|
||||||
|
@ -16,7 +16,8 @@ from EventManagerGlobal import *
|
|||||||
from PythonUtil import *
|
from PythonUtil import *
|
||||||
from direct.particles.ParticleManagerGlobal import *
|
from direct.particles.ParticleManagerGlobal import *
|
||||||
from PhysicsManagerGlobal import *
|
from PhysicsManagerGlobal import *
|
||||||
from direct.interval.IntervalManager import ivalMgr
|
#from direct.interval.IntervalManager import ivalMgr
|
||||||
|
from direct.interval import IntervalManager
|
||||||
from InputStateGlobal import inputState
|
from InputStateGlobal import inputState
|
||||||
|
|
||||||
from direct.task import Task
|
from direct.task import Task
|
||||||
@ -99,7 +100,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
|
|
||||||
# If the aspect ratio is 0 or None, it means to infer the
|
# If the aspect ratio is 0 or None, it means to infer the
|
||||||
# aspect ratio from the window size.
|
# aspect ratio from the window size.
|
||||||
self.aspectRatio = ConfigVariableDouble('aspect-ratio', 0)
|
self.aspectRatio = ConfigVariableDouble('aspect-ratio', 0).getValue()
|
||||||
|
|
||||||
self.windowType = self.config.GetString('window-type', 'onscreen')
|
self.windowType = self.config.GetString('window-type', 'onscreen')
|
||||||
self.requireWindow = self.config.GetBool('require-window', 1)
|
self.requireWindow = self.config.GetBool('require-window', 1)
|
||||||
@ -1145,7 +1146,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
|
|
||||||
def ivalLoop(self, state):
|
def ivalLoop(self, state):
|
||||||
# Execute all intervals in the global ivalMgr.
|
# Execute all intervals in the global ivalMgr.
|
||||||
ivalMgr.step()
|
IntervalManager.ivalMgr.step()
|
||||||
return Task.cont
|
return Task.cont
|
||||||
|
|
||||||
def shadowCollisionLoop(self, state):
|
def shadowCollisionLoop(self, state):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user