mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
added turnOn() and turnOff() to smooth the world switch process
This commit is contained in:
parent
dab0454ca0
commit
84925eed14
@ -6,6 +6,7 @@ from direct.distributed.DistributedNode import DistributedNode
|
|||||||
from direct.task import Task
|
from direct.task import Task
|
||||||
from direct.gui import DirectGuiGlobals
|
from direct.gui import DirectGuiGlobals
|
||||||
from direct.showbase.EventGroup import EventGroup
|
from direct.showbase.EventGroup import EventGroup
|
||||||
|
from direct.showbase.PythonUtil import report
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
# For grid drawing
|
# For grid drawing
|
||||||
@ -71,6 +72,7 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
|||||||
def getCenterPos(self):
|
def getCenterPos(self):
|
||||||
return self.centerPos
|
return self.centerPos
|
||||||
|
|
||||||
|
@report(types = ['frameCount', 'avLocation'], dConfigParam = 'want-connector-report')
|
||||||
def startProcessVisibility(self, avatar):
|
def startProcessVisibility(self, avatar):
|
||||||
assert not self.cr._noNewInterests
|
assert not self.cr._noNewInterests
|
||||||
if self.cr.noNewInterests():
|
if self.cr.noNewInterests():
|
||||||
@ -87,6 +89,7 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
|||||||
taskMgr.add(
|
taskMgr.add(
|
||||||
self.processVisibility, self.taskName("processVisibility"))
|
self.processVisibility, self.taskName("processVisibility"))
|
||||||
|
|
||||||
|
@report(types = ['frameCount', 'avLocation'], dConfigParam = 'want-connector-report')
|
||||||
def stopProcessVisibility(self, clearAll=False, event=None):
|
def stopProcessVisibility(self, clearAll=False, event=None):
|
||||||
self.ignore(self.cr.StopVisibilityEvent)
|
self.ignore(self.cr.StopVisibilityEvent)
|
||||||
taskMgr.remove(self.taskName("processVisibility"))
|
taskMgr.remove(self.taskName("processVisibility"))
|
||||||
@ -178,10 +181,10 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
|||||||
self.handleAvatarZoneChange(self.visAvatar, zoneId)
|
self.handleAvatarZoneChange(self.visAvatar, zoneId)
|
||||||
return Task.cont
|
return Task.cont
|
||||||
|
|
||||||
# Take an avatar (or other object) from somewhere in the world and
|
# Update our location based on our avatar's position on the grid
|
||||||
# wrtReparent him to the grid.
|
# Assumes our position is correct, relative to the grid
|
||||||
def addObjectToGrid(self, av):
|
def addObjectToGrid(self, av):
|
||||||
self.notify.debug("addObjectToGrid %s" % av)
|
assert self.notify.debug("addObjectToGrid %s" % av)
|
||||||
# Get our pos relative to the island grid
|
# Get our pos relative to the island grid
|
||||||
pos = av.getPos(self)
|
pos = av.getPos(self)
|
||||||
# Figure out what zone in that island grid
|
# Figure out what zone in that island grid
|
||||||
@ -190,7 +193,7 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
|||||||
self.handleAvatarZoneChange(av, zoneId)
|
self.handleAvatarZoneChange(av, zoneId)
|
||||||
|
|
||||||
def removeObjectFromGrid(self, av):
|
def removeObjectFromGrid(self, av):
|
||||||
self.notify.debug("removeObjectFromGrid %s" % av)
|
assert self.notify.debug("removeObjectFromGrid %s" % av)
|
||||||
# TODO: WHAT LOCATION SHOULD WE SET THIS TO?
|
# TODO: WHAT LOCATION SHOULD WE SET THIS TO?
|
||||||
#av.reparentTo(hidden)
|
#av.reparentTo(hidden)
|
||||||
if (av.getParent().compareTo(self) == 0):
|
if (av.getParent().compareTo(self) == 0):
|
||||||
@ -213,6 +216,13 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
|||||||
av.b_setLocation(self.doId, zoneId)
|
av.b_setLocation(self.doId, zoneId)
|
||||||
|
|
||||||
|
|
||||||
|
def turnOff(self):
|
||||||
|
self.stopProcessVisibility()
|
||||||
|
|
||||||
|
def turnOn(self, av = None):
|
||||||
|
if av:
|
||||||
|
self.startProcessVisibility(av)
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
# Visualization Tools
|
# Visualization Tools
|
||||||
##################################################
|
##################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user