Panda3D
Loading...
Searching...
No Matches
DistributedSmoothNode Class Reference
Inheritance diagram for DistributedSmoothNode:
DistributedNode DistributedSmoothNodeBase DistributedObject DistributedObjectBase DirectObject

Public Member Functions

 __init__ (self, cr)
 
 activateSmoothing (self, smoothing, prediction)
 
 clearSmoothing (self, bogus=None)
 
 d_returnResync (self, avId, timestampB, serverTime, uncertainty)
 
 d_setParent (self, parentToken)
 
 d_suggestResync (self, avId, timestampA, timestampB, serverTime, uncertainty)
 Monitor clock sync ###.
 
 delete (self)
 
 disable (self)
 
 doSmoothTask (self, task)
 
 forceToTruePosition (self)
 
 generate (self)
 
 getComponentH (self)
 
 getComponentL (self)
 
 getComponentP (self)
 
 getComponentR (self)
 
 getComponentT (self)
 
 getComponentX (self)
 
 getComponentY (self)
 
 getComponentZ (self)
 
 getSmoothWrtReparents (self)
 
 peerToPeerResync (self, avId, timestamp, serverTime, uncertainty)
 
 reloadPosition (self)
 
 returnResync (self, avId, timestampB, serverTimeSec, serverTimeUSec, uncertainty)
 
 setComponentH (self, h)
 
 setComponentL (self, l)
 
 setComponentP (self, p)
 
 setComponentR (self, r)
 
 setComponentT (self, timestamp)
 
 setComponentTLive (self, timestamp)
 
 setComponentX (self, x)
 component set pos and hpr functions ###
 
 setComponentY (self, y)
 
 setComponentZ (self, z)
 
 setSmH (self, h, timestamp=None)
 
 setSmHpr (self, h, p, r, timestamp=None)
 
 setSmoothWrtReparents (self, flag)
 
 setSmPos (self, x, y, z, timestamp=None)
 
 setSmPosHpr (self, x, y, z, h, p, r, timestamp=None)
 
 setSmPosHprL (self, l, x, y, z, h, p, r, timestamp=None)
 
 setSmStop (self, timestamp=None)
 
 setSmXY (self, x, y, timestamp=None)
 
 setSmXYH (self, x, y, h, timestamp)
 
 setSmXYZH (self, x, y, z, h, timestamp=None)
 
 setSmXZ (self, x, z, timestamp=None)
 
 setSmZ (self, z, timestamp=None)
 
 smoothPosition (self)
 Methods to handle computing and updating of the smoothed position.
 
 startSmooth (self)
 
 stopSmooth (self)
 
 suggestResync (self, avId, timestampA, timestampB, serverTimeSec, serverTimeUSec, uncertainty)
 
 wantsSmoothing (self)
 
 wrtReparentTo (self, parent)
 
- Public Member Functions inherited from DistributedNode
 __init__ (self, cr)
 
 __cmp__ (self, other)
 
 b_setParent (self, parentToken)
 setParent ###
 
 d_setH (self, h)
 
 d_setHpr (self, h, p, r)
 
 d_setP (self, p)
 
 d_setPos (self, x, y, z)
 
 d_setPosHpr (self, x, y, z, h, p, r)
 
 d_setR (self, r)
 
 d_setX (self, x)
 set pos and hpr functions #######
 
 d_setXY (self, x, y)
 
 d_setXYH (self, x, y, h)
 
 d_setXYZH (self, x, y, z, h)
 
 d_setXZ (self, x, z)
 
 d_setY (self, y)
 
 d_setZ (self, z)
 
 do_setParent (self, parentToken)
 
 setLocation (self, parentId, zoneId, teleport=0)
 
 setParent (self, parentToken)
 
 setParentStr (self, parentTokenStr)
 
 setXY (self, x, y)
 
 setXYH (self, x, y, h)
 
 setXYZH (self, x, y, z, h)
 
 setXZ (self, x, z)
 
- Public Member Functions inherited from DistributedObject
 __init__ (self, cr)
 
 addInterest (self, zoneId, note="", event=None)
 
 announceGenerate (self)
 
 b_setLocation (self, parentId, zoneId)
 
 d_setLocation (self, parentId, zoneId)
 
 deleteOrDelay (self)
 
 disableAndAnnounce (self)
 
 disableAnnounceAndDelete (self)
 
 doCallbackContext (self, context, args)
 
 doneBarrier (self, name=None)
 
 execCommand (self, string, mwMgrId, avId, zoneId)
 
 flushCachedData (self, name)
 
 generateInit (self)
 
 getAutoInterests (self)
 
 getBarrierData (self)
 
 getCacheable (self)
 
 getCachedData (self, name)
 
 getCallback (self, context)
 
 getCallbackArgs (self, context)
 
 getCallbackContext (self, callback, extraArgs=[])
 
 getCurrentContexts (self)
 
 getDelayDeleteCount (self)
 
 getDelayDeleteEvent (self)
 
 getDisableEvent (self)
 
 getDoId (self)
 
 getLocation (self)
 
 getNeverDisable (self)
 
 getParentObj (self)
 
 hasCachedData (self, name)
 
 isDisabled (self)
 
 isGenerated (self)
 
 isGridParent (self)
 
 isLocal (self)
 
 postGenerateMessage (self)
 
 removeInterest (self, handle, event=None)
 
 sendDeleteMsg (self)
 
 sendDisableMsg (self)
 
 sendUpdate (self, fieldName, args=[], sendToId=None)
 
 setBarrierData (self, data)
 
 setCacheable (self, bool)
 
 setCachedData (self, name, data)
 
 setNeverDisable (self, bool)
 
 status (self, indent=0)
 
 taskName (self, taskString)
 
 uniqueName (self, idString)
 
 updateAllRequiredFields (self, dclass, di)
 
 updateRequiredFields (self, dclass, di)
 
 updateRequiredOtherFields (self, dclass, di)
 
- Public Member Functions inherited from DistributedObjectBase
 __init__ (self, cr)
 
 handleChildArrive (self, childObj, zoneId)
 
 handleChildArriveZone (self, childObj, zoneId)
 
 handleChildLeave (self, childObj, zoneId)
 
 handleChildLeaveZone (self, childObj, zoneId)
 
 handleQueryObjectChildrenLocalDone (self, context)
 
 hasParentingRules (self)
 
- Public Member Functions inherited from DirectObject
 __init__ (self)
 
 accept (self, event, method, extraArgs=[])
 
 acceptOnce (self, event, method, extraArgs=[])
 
 addTask (self, *args, **kwargs)
 
 detectLeaks (self)
 
 doMethodLater (self, *args, **kwargs)
 
 getAllAccepting (self)
 
 ignore (self, event)
 
 ignoreAll (self)
 
 isAccepting (self, event)
 
 isIgnoring (self, event)
 
 removeAllTasks (self)
 
 removeTask (self, taskOrName)
 
- Public Member Functions inherited from DistributedSmoothNodeBase
 __init__ (self)
 
 b_clearSmoothing (self)
 
 d_clearSmoothing (self)
 
 getPosHprBroadcastPeriod (self)
 
 getPosHprBroadcastTaskName (self)
 posHprBroadcast ###
 
 posHprBroadcastStarted (self)
 
 sendCurrentPosition (self)
 
 setPosHprBroadcastPeriod (self, period)
 
 startPosHprBroadcast (self, period=.2, stagger=0, type=None)
 
 stopPosHprBroadcast (self)
 
 wantSmoothPosBroadcastTask (self)
 

Public Attributes

int DistributedSmoothNode_initialized = 1
 
 doSmoothTask
 
int lastSuggestResync = 0
 
bool localControl = False
 
 smoother = SmoothMover()
 
int smoothStarted = 0
 
bool stopped = False
 
- Public Attributes inherited from DistributedNode
int DistributedNode_deleted = 1
 
int DistributedNode_initialized = 1
 
int gotStringParentToken = 0
 
 gridParent = None
 
 this
 
- Public Attributes inherited from DistributedObject
 activeState = ESNew
 
 autoInterests = autoInterests
 
 cacheable = ESGenerated:
 
 dclass = None
 
 destroyDoStackTrace
 
int DistributedObject_deleted = 1
 
int DistributedObject_initialized = 1
 
- Public Attributes inherited from DistributedObjectBase
 cr = cr
 
 doId
 
int parentId = None
 
 zoneId = None
 
- Public Attributes inherited from DistributedSmoothNodeBase
 broadcastType = type
 
 cnode = CDistributedSmoothNodeBase()
 
 d_broadcastPosHpr = None
 
 dclass = self.getPosHprBroadcastTaskName()
 
 doId
 

Protected Member Functions

 _checkResume (self, timestamp)
 
- Protected Member Functions inherited from DistributedObject
 _deactivateDO (self)
 
 _destroyDO (self)
 
 _retrieveCachedData (self)
 
- Protected Member Functions inherited from DirectObject
 _addTask (self, task)
 
 _clearTask (self, task)
 
- Protected Member Functions inherited from DistributedSmoothNodeBase
 _posHprBroadcast (self, task=DummyTask)
 

Protected Attributes

bool _smoothWrtReparents = False
 
- Protected Attributes inherited from DistributedObject
 _cachedData = self.cr.doDataCache.popCachedData(self.doId)
 
int _delayDeleted = 0
 
bool _delayDeleteForceAllow = False
 
dict _token2delayDeleteName = {}
 
- Protected Attributes inherited from DirectObject
dict _taskList = {}
 
- Protected Attributes inherited from DistributedSmoothNodeBase
 _posHprBroadcast = randFloat(period)
 

Additional Inherited Members

- Static Public Attributes inherited from DistributedObject
int neverDisable = 0
 
- Static Public Attributes inherited from DistributedObjectBase
 notify = directNotify.newCategory("DistributedObjectBase")
 
- Static Public Attributes inherited from DirectObject
 accept_once = acceptOnce
 
 add_task = addTask
 
 detect_leaks = detectLeaks
 
 do_method_later = doMethodLater
 
 get_all_accepting = getAllAccepting
 
 ignore_all = ignoreAll
 
 is_accepting = isAccepting
 
 is_ignoring = isIgnoring
 
 remove_all_tasks = removeAllTasks
 
 remove_task = removeTask
 
- Static Public Attributes inherited from DistributedSmoothNodeBase
 BroadcastTypes = Enum('FULL, XYH, XY')
 

Detailed Description

This specializes DistributedNode to add functionality to smooth
motion over time, via the SmoothMover C++ object defined in
DIRECT.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
cr )

Member Function Documentation

◆ _checkResume()

_checkResume ( self,
timestamp )
protected
Determine if we were previously stopped and now need to
resume movement by making sure any old stored positions
reflect the node's current position

◆ activateSmoothing()

activateSmoothing ( self,
smoothing,
prediction )
Enables or disables the smoothing of other avatars' motion.
This used to be a global flag, but now it is specific to each
avatar instance.  However, see globalActivateSmoothing() in
this module.

If smoothing is off, no kind of smoothing will be performed,
regardless of the setting of prediction.

This is not necessarily predictive smoothing; if predictive
smoothing is off, avatars will be lagged by a certain factor
to achieve smooth motion.  Otherwise, if predictive smoothing
is on, avatars will be drawn as nearly as possible in their
current position, by extrapolating from old position reports.

This assumes you have a client repository that knows its
localAvatarDoId -- stored in self.cr.localAvatarDoId

◆ clearSmoothing()

clearSmoothing ( self,
bogus = None )

◆ d_returnResync()

d_returnResync ( self,
avId,
timestampB,
serverTime,
uncertainty )

◆ d_setParent()

d_setParent ( self,
parentToken )

Reimplemented from DistributedNode.

◆ d_suggestResync()

d_suggestResync ( self,
avId,
timestampA,
timestampB,
serverTime,
uncertainty )

Monitor clock sync ###.

◆ delete()

delete ( self)
Inheritors should redefine this to take appropriate action on delete

Reimplemented from DistributedNode.

◆ disable()

disable ( self)
Inheritors should redefine this to take appropriate action on disable

Reimplemented from DistributedNode.

◆ doSmoothTask()

doSmoothTask ( self,
task )

◆ forceToTruePosition()

forceToTruePosition ( self)
This forces the node to reposition itself to its latest known
position.  This may result in a pop as the node skips the last
of its lerp points.

◆ generate()

generate ( self)
Inheritors should redefine this to take appropriate action on generate

Reimplemented from DistributedNode.

◆ getComponentH()

getComponentH ( self)

◆ getComponentL()

getComponentL ( self)

◆ getComponentP()

getComponentP ( self)

◆ getComponentR()

getComponentR ( self)

◆ getComponentT()

getComponentT ( self)

◆ getComponentX()

getComponentX ( self)

◆ getComponentY()

getComponentY ( self)

◆ getComponentZ()

getComponentZ ( self)

◆ getSmoothWrtReparents()

getSmoothWrtReparents ( self)

◆ peerToPeerResync()

peerToPeerResync ( self,
avId,
timestamp,
serverTime,
uncertainty )

◆ reloadPosition()

reloadPosition ( self)
This function re-reads the position from the node itself and
clears any old position reports for the node.  This should be
used whenever show code bangs on the node position and expects
it to stick.

◆ returnResync()

returnResync ( self,
avId,
timestampB,
serverTimeSec,
serverTimeUSec,
uncertainty )
A reply sent by a client whom we recently sent suggestResync
to, this reports the client's new delta information so we can
adjust our clock as well.

◆ setComponentH()

setComponentH ( self,
h )

◆ setComponentL()

setComponentL ( self,
l )

◆ setComponentP()

setComponentP ( self,
p )

◆ setComponentR()

setComponentR ( self,
r )

◆ setComponentT()

setComponentT ( self,
timestamp )

◆ setComponentTLive()

setComponentTLive ( self,
timestamp )

◆ setComponentX()

setComponentX ( self,
x )

component set pos and hpr functions ###

These are the component functions that are invoked remotely by the above composite functions.

◆ setComponentY()

setComponentY ( self,
y )

◆ setComponentZ()

setComponentZ ( self,
z )

◆ setSmH()

setSmH ( self,
h,
timestamp = None )

◆ setSmHpr()

setSmHpr ( self,
h,
p,
r,
timestamp = None )

◆ setSmoothWrtReparents()

setSmoothWrtReparents ( self,
flag )

◆ setSmPos()

setSmPos ( self,
x,
y,
z,
timestamp = None )

◆ setSmPosHpr()

setSmPosHpr ( self,
x,
y,
z,
h,
p,
r,
timestamp = None )

◆ setSmPosHprL()

setSmPosHprL ( self,
l,
x,
y,
z,
h,
p,
r,
timestamp = None )

◆ setSmStop()

setSmStop ( self,
timestamp = None )

◆ setSmXY()

setSmXY ( self,
x,
y,
timestamp = None )

◆ setSmXYH()

setSmXYH ( self,
x,
y,
h,
timestamp )

◆ setSmXYZH()

setSmXYZH ( self,
x,
y,
z,
h,
timestamp = None )

◆ setSmXZ()

setSmXZ ( self,
x,
z,
timestamp = None )

◆ setSmZ()

setSmZ ( self,
z,
timestamp = None )

◆ smoothPosition()

smoothPosition ( self)

Methods to handle computing and updating of the smoothed position.

This function updates the position of the node to its computed
smoothed position.  This may be overridden by a derived class
to specialize the behavior.

◆ startSmooth()

startSmooth ( self)
This function starts the task that ensures the node is
positioned correctly every frame.  However, while the task is
running, you won't be able to lerp the node or directly
position it.

◆ stopSmooth()

stopSmooth ( self)
This function stops the task spawned by startSmooth(), and
allows show code to move the node around directly.

◆ suggestResync()

suggestResync ( self,
avId,
timestampA,
timestampB,
serverTimeSec,
serverTimeUSec,
uncertainty )
This message is sent from one client to another when the other
client receives a timestamp from this client that is so far
out of date as to suggest that one or both clients needs to
resynchronize their clock information.

◆ wantsSmoothing()

wantsSmoothing ( self)

◆ wrtReparentTo()

wrtReparentTo ( self,
parent )

Member Data Documentation

◆ _smoothWrtReparents

bool _smoothWrtReparents = False
protected

◆ DistributedSmoothNode_initialized

int DistributedSmoothNode_initialized = 1

◆ doSmoothTask

doSmoothTask

◆ lastSuggestResync

int lastSuggestResync = 0

◆ localControl

bool localControl = False

◆ smoother

smoother = SmoothMover()

◆ smoothStarted

int smoothStarted = 0

◆ stopped

stopped = False