DistributedActor.py 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. """DistributedActor module: contains the DistributedActor class"""
  2. from direct.distributed import DistributedNode
  3. import Actor
  4. class DistributedActor(DistributedNode.DistributedNode, Actor.Actor):
  5. """Distributed Actor class:"""
  6. def __init__(self, cr):
  7. try:
  8. self.DistributedActor_initialized
  9. except:
  10. self.DistributedActor_initialized = 1
  11. DistributedNode.DistributedNode.__init__(self, cr)
  12. # Since actors are probably fairly heavyweight, we'd
  13. # rather cache them than delete them if possible.
  14. self.setCacheable(1)
  15. def disable(self):
  16. # remove all anims, on all parts and all lods
  17. if (not self.isEmpty()):
  18. Actor.Actor.unloadAnims(self, None, None, None)
  19. DistributedNode.DistributedNode.disable(self)
  20. def delete(self):
  21. try:
  22. self.DistributedActor_deleted
  23. except:
  24. self.DistributedActor_deleted = 1
  25. DistributedNode.DistributedNode.delete(self)
  26. Actor.Actor.delete(self)