Panda3D

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

## Public Member Functions
| __init__ (self, cr)
| abortAllRequests (self)
| abortRequest (self, tuple)
| destroy (self)
| requestObjects (self, doIdList, allCallback=None, eachCallback=None, timeout=None, timeoutCallback=None)
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
| cr = cr
dict | pendingObjects = {}

## Static Public Attributes
int | doLaterSequence = 1
| notify = DirectNotifyGlobal.directNotify.newCategory('RelatedObjectMgr')
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

## Additional Inherited Members
Protected Member Functions inherited from DirectObject
| _addTask (self, task)
| _clearTask (self, task)
Protected Attributes inherited from DirectObject
dict | _taskList = {}

## Detailed Description

    This class manages a relationship between DistributedObjects that
    know about each other, and are expected to be generated together.
    Ideally, we should be able to guarantee the ordering of the
    generate calls, but there are certain cases in which the objects
    may not be generated in the correct order as defined by the
    toon.dc file.

    To handle cases like these robustly, it is necessary for each
    object to deal with the possibility that its companion object has
    not yet been generated.  This may mean deferring some operations
    until the expected companion object has been generated.

    This class helps manage that process.  To use it, an object should
    register its desire to be associated with the other object's doId.
    When the other object is generated (or immediately, if the object
    already exists), the associated callback will be called.  There is
    also a timeout callback in case the object never appears.

## Constructor & Destructor Documentation

## ◆ __init__()

__init__ | ( |  | self,
|  |  | cr )

## Member Function Documentation

## ◆ abortAllRequests()

abortAllRequests | ( |  | self | ) |

    Call this method to abruptly abort all pending requests, but
    leave the RelatedObjectMgr in a state for accepting more
    requests.

## ◆ abortRequest()

abortRequest | ( |  | self,
|  |  | tuple )

    Aborts a previous request.  The parameter is the return value
    from a previous call to requestObjects().  The pending request
    is removed from the queue and no further callbacks will be called.

    See Also: requestObjects()

## ◆ destroy()

destroy | ( |  | self | ) |

## ◆ requestObjects()

requestObjects | ( |  | self,
|  |  | doIdList,
|  |  | allCallback = None,
|  |  | eachCallback = None,
|  |  | timeout = None,
|  |  | timeoutCallback = None )

    Requests a callback to be called when the objects in the
    doIdList are generated.  The allCallback will be called only
    when all the objects have been generated (and it receives a
    list of objects, in the order given in doIdList).  The
    eachCallback is called as each object is generated, and
    receives only the object itself.

    If the objects already exist, the appropriate callback is
    called immediately.

    If all of the objects are not generated within the indicated
    timeout time, the timeoutCallback is called instead, with the
    original doIdList as the parameter.  If the timeoutCallback is
    None, then allCallback is called on timeout, with the list of
    objects that have been generated so far, and None for objects
    that have not been generated.

    If any element of doIdList is None or 0, it is ignored, and
    None is passed in its place in the object list passed to the
    callback.

    The return value may be saved and passed to a future call to
    abortRequest(), in order to abort a pending request before the
    timeout expires.

    Actually, you should be careful to call abortRequest() if you
    have made a call to requestObjects() that has not been resolved.
    To find examples, do a search for abortRequest() to find out
    how other code is using it.  A common idiom is to store the
    result from requestObjects() and call abortRequest() if delete()
    or destroy() is called on the requesting object.

    See Also: abortRequest()

## Member Data Documentation

## ◆ cr

cr = cr

## ◆ doLaterSequence

int doLaterSequence = 1
| static

## ◆ notify

notify = DirectNotifyGlobal.directNotify.newCategory('RelatedObjectMgr')
| static

## ◆ pendingObjects

dict pendingObjects = {}