Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
DistancePhasedNode Class Reference
Inheritance diagram for DistancePhasedNode:

## Public Member Functions
| __init__ (self, name, phaseParamMap={}, autoCleanup=True, enterPrefix='enter', exitPrefix='exit', phaseCollideMask=BitMask32.allOn(), fromCollideNode=None)
| __del__ (self)
| __repr__ (self)
| __str__ (self)
| cleanup (self)
| reset (self)
| setPhase (self, aPhase)
| setPhaseCollideMask (self, mask)
Public Member Functions inherited from PhasedObject
| __init__ (self, aliasMap={})
| __repr__ (self)
| __str__ (self)
| getAliasPhase (self, alias)
| getPhase (self)
| getPhaseAlias (self, phase)
| setAlias (self, phase, alias)
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 Attributes
| autoCleanup = autoCleanup
| cTrav = base.cTrav
| enterPrefix = enterPrefix
| exitPrefix = exitPrefix
| fromCollideNode = fromCollideNode
| phaseCollideMask = phaseCollideMask
| phaseParamList
| phaseParamMap = phaseParamMap
Public Attributes inherited from PhasedObject
dict | aliasPhaseMap = {}
int | phase = -1
dict | phaseAliasMap = {}

## Protected Attributes
list | _colSpheres = []
Protected Attributes inherited from DirectObject
dict | _taskList = {}

## Additional Inherited Members
Static Public Attributes inherited from PhasedObject
| notify = directNotify.newCategory("PhasedObject")
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
Protected Member Functions inherited from DirectObject
| _addTask (self, task)
| _clearTask (self, task)

## Detailed Description

    This class defines a PhasedObject,NodePath object that will handle
    the phasing of an object in the scene graph according to its
    distance from some other collider object(such as an avatar).

    Since it's a NodePath, you can parent it to another object in the
    scene graph, or even inherit from this class to get its functionality.

    What you will need to define to use this class:

     - The distances at which you want the phases to load/unload
     - Whether you want the object to clean itself up or not when
       exitting the largest distance sphere
     - What the load/unload functions are
     - What sort of events to listen for when a collision occurs
     - (Optional) A collision bitmask for the phase collision spheres
     - (Optional) A 'from' collision node to collide into our 'into' spheres

    You specify the distances and function names by the phaseParamMap
    parameter to `__init__()`.  For example::

        phaseParamMap = {'Alias': distance, ...}
        ...
        def loadPhaseAlias(self):
            pass
        def unloadPhaseAlias(self):
            pass

    If the 'fromCollideNode' is supplied, we will set up our own
    traverser and only traverse below this node.  It will send out
    events of the form '<enterPrefix>%in' and '<exitPrefix>%in' in
    order to match the main collision traverser's patterns.  Note
    that this will only be used after a reset or phase change in
    order to fully transition to the correct phase in a single pass.
    Most of the time, it will be reacting to events from the main
    collision traverser.

    IMPORTANT:

        The following only applies when ``autoCleanup is True``:
        If you unload the last phase, by either calling `cleanup()` or
        by exiting the last phase's distance, you will need to
        explicitly call `reset()` to get the distance phasing to work
        again. This was done so if either this node or the collider is
        removed from the scene graph (e.g. avatar teleport), the phased
        object will clean itself up automatically.

## Constructor & Destructor Documentation

## ◆ __init__()

__init__ | ( |  | self,
|  |  | name,
|  |  | phaseParamMap = {},
|  |  | autoCleanup = True,
|  |  | enterPrefix = 'enter',
|  |  | exitPrefix = 'exit',
|  |  | phaseCollideMask = BitMask32.allOn(),
|  |  | fromCollideNode = None )

## ◆ __del__()

__del__ | ( |  | self | ) |

## Member Function Documentation

## ◆ __repr__()

__repr__ | ( |  | self | ) |

## ◆ __str__()

__str__ | ( |  | self | ) |

## ◆ cleanup()

cleanup | ( |  | self | ) |

    Disables all collisions.
    Ignores all owned event listeners.
    Unloads all unloaded phases.

Reimplemented from PhasedObject.

## ◆ reset()

reset | ( |  | self | ) |

    Unloads all loaded phases and puts the phase node
    in the startup state is if it had just been initialized.

## ◆ setPhase()

setPhase | ( |  | self,
|  |  | aPhase )

    See PhasedObject.setPhase()

Reimplemented from PhasedObject.

Reimplemented in BufferedDistancePhasedNode.

## ◆ setPhaseCollideMask()

setPhaseCollideMask | ( |  | self,
|  |  | mask )

    Sets the intoCollideMasks for our collision spheres.

## Member Data Documentation

## ◆ _colSpheres

_colSpheres = []
| protected

## ◆ autoCleanup

autoCleanup = autoCleanup

## ◆ cTrav

cTrav = base.cTrav

## ◆ enterPrefix

enterPrefix = enterPrefix

## ◆ exitPrefix

exitPrefix = exitPrefix

## ◆ fromCollideNode

fromCollideNode = fromCollideNode

## ◆ phaseCollideMask

phaseCollideMask = phaseCollideMask

## ◆ phaseParamList

phaseParamList

Initial value:
= sorted(list(phaseParamMap.items()),
key = lambda x: x[1],
reverse = True)

## ◆ phaseParamMap

phaseParamMap = phaseParamMap