Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PythonTask Class Reference

This class exists to allow association of a Python function with the AsyncTaskManager. More...

Inheritance diagram for PythonTask:
AsyncTask AsyncTaskBase TypedReferenceCount Namable TypedObject ReferenceCount MemoryBase MemoryBase MemoryBase

Public Member Functions

int __clear__ ()
 
int __delattr__ (object attr)
 
object __getattr__ (object attr)
 
 __init__ (object function, str name)
 
int __setattr__ (object attr, object v)
 
int __traverse__ (Visitproc visit, void arg)
 
object getArgs ()
 
object getDelay ()
 Returns the delay time if set, None otherwise. See AsyncTask::has_delay() and AsyncTask::get_delay(). More...
 
object getFunction ()
 
object getOwner ()
 
object getUponDeath ()
 
 operator new (size_t size)
 
 setArgs (object args, bool append_task)
 
 setDelay (object delay)
 If None is passed, calls clear_delay, otherwise sets the delay time. See AsyncTask::set_delay() and AsyncTask::clear_delay(). More...
 
 setFunction (object function)
 
 setOwner (object owner)
 
 setUponDeath (object upon_death)
 
- Public Member Functions inherited from AsyncTask
 clearDelay ()
 Removes any delay specified for the task. The next time the task is added to the queue, it will run immediately. This does not affect the task's wake time if it has already been added to the queue. More...
 
 clearName ()
 Resets the task's name to empty. More...
 
double getAverageDt ()
 Returns the average amount of time elapsed during each of the task's previous run cycles, in seconds. More...
 
double getDelay ()
 Returns the delay value that has been set via set_delay, if any. More...
 
str getDoneEvent ()
 Returns the event name that will be triggered when the task finishes. See set_done_event(). More...
 
double getDt ()
 Returns the amount of time elapsed during the task's previous run cycle, in seconds. More...
 
int getElapsedFrames ()
 Returns the number of frames that have elapsed since the task was started, according to the task manager's clock. More...
 
double getElapsedTime ()
 Returns the amount of time that has elapsed since the task was started, according to the task manager's clock. More...
 
AsyncTaskManager getManager ()
 Returns the AsyncTaskManager that this task is active on. This will be NULL if the state is S_inactive. More...
 
double getMaxDt ()
 Returns the maximum amount of time elapsed during any one of the task's previous run cycles, in seconds. More...
 
str getNamePrefix ()
 Returns the initial part of the name, up to but not including any trailing digits following a hyphen or underscore. More...
 
int getPriority ()
 Returns the task's current priority value. See set_priority(). More...
 
object getPythonObject ()
 Returns the Python object that was specified to set_python_object(), if any, or None if no object was specified. More...
 
int getSort ()
 Returns the task's current sort value. See set_sort(). More...
 
int getStartFrame ()
 Returns the frame number at which the task was started, according to the task manager's clock. More...
 
double getStartTime ()
 Returns the time at which the task was started, according to the task manager's clock. More...
 
AsyncTask::State getState ()
 Returns the current state of the task. More...
 
str getTaskChain ()
 Returns the AsyncTaskChain on which this task will be running. Each task chain runs tasks independently of the others. More...
 
AtomicAdjust::Integer getTaskId ()
 Returns a number guaranteed to be unique for each different AsyncTask object in the universe. More...
 
double getWakeTime ()
 If this task has been added to an AsyncTaskManager with a delay in effect, this returns the time at which the task is expected to awaken. It has no meaning if the task has not yet been added to a queue, or if there was no delay in effect at the time the task was added. More...
 
bool hasDelay ()
 Returns true if a delay has been set for this task via set_delay(), or false otherwise. More...
 
bool isAlive ()
 Returns true if the task is currently active or sleeping on some task chain, meaning that it will be executed in its turn, or false if it is not active. If the task has recently been removed while it is in the middle of execution, this will return false, because the task will not run again once it finishes. More...
 
 output (Ostream out)
 
 recalcWakeTime ()
 If the task is currently sleeping on a task chain, this resets its wake time to the current time. More...
 
 remove ()
 Removes the task from its active manager, if any, and makes the state S_inactive (or possible S_servicing_removed). This is a no-op if the state is already S_inactive. More...
 
 setDelay (double delay)
 Specifies the amount of time, in seconds, by which this task will be delayed after it has been added to the AsyncTaskManager. At least the specified amount of time (and possibly more) will elapse before the task begins. More...
 
 setDoneEvent (str done_event)
 Sets the event name that will be triggered when the task finishes. This should only be called before the task has been started, or after it has finished and before it is about to be restarted (i.e. when get_state() returns S_inactive). More...
 
 setName (str name)
 
 setPriority (int priority)
 Specifies a priority value for this task. In general, tasks with a higher priority value are executed before tasks with a lower priority value (but only for tasks with the same sort value). More...
 
 setPythonObject (object python_object)
 Specifies an arbitrary Python object that will be piggybacked on the task object. More...
 
 setSort (int sort)
 Specifies a sort value for this task. Within a given AsyncTaskManager, all of the tasks with a given sort value are guaranteed to be completed before any tasks with a higher sort value are begun. More...
 
 setTaskChain (str chain_name)
 Specifies the AsyncTaskChain on which this task will be running. Each task chain runs tasks independently of the others. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 Derived classes should override this function to return get_class_type(). More...
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise. More...
 
bool unref ()
 Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete(). More...
 
- Public Member Functions inherited from Namable
 __init__ (const Namable copy)
 
 __init__ (str initial_name)
 
 clearName ()
 Resets the Namable's name to empty. More...
 
str getName ()
 
bool hasName ()
 Returns true if the Namable has a nonempty name set, false if the name is empty. More...
 
Namable operator= (const Namable other)
 
 output (Ostream out)
 Outputs the Namable. This function simply writes the name to the output stream; most Namable derivatives will probably redefine this. More...
 
 setName (str name)
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from AsyncTask
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from AsyncTaskBase
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from Namable
static TypeHandle getClassType ()
 

Public Attributes

object __dict__
 This is a special variable to hold the instance dictionary in which custom variables may be stored. More...
 
object delay_time
 The delay value that has been set on this task, if any, or None. More...
 
int frame
 The number of frames that have elapsed since the task was started, according to the task manager's clock. More...
 
AtomicAdjust::Integer id
 This is a number guaranteed to be unique for each different AsyncTask object in the universe. More...
 
 name
 The name of this task. More...
 
double time
 The amount of seconds that have elapsed since the task was started, according to the task manager's clock. More...
 
double wake_time
 If this task has been added to an AsyncTaskManager with a delay in effect, this contains the time at which the task is expected to awaken. It has no meaning of the task has not yet been added to a queue, or if there was no delay in effect at the time the task was added. More...
 

Additional Inherited Members

- Public Types inherited from AsyncTask
enum  DoneStatus {
  DS_done = 0, DS_cont = 1, DS_again = 2, DS_pickup = 3,
  DS_exit = 4, DS_pause = 5, DS_interrupt = 6
}
 
enum  State {
  S_inactive = 0, S_active = 1, S_servicing = 2, S_servicing_removed = 3,
  S_sleeping = 4, S_active_nested = 5
}
 

Detailed Description

This class exists to allow association of a Python function with the AsyncTaskManager.

Member Function Documentation

◆ __clear__()

int __clear__ ( )

◆ __delattr__()

int __delattr__ ( object  attr)

◆ __getattr__()

object __getattr__ ( object  attr)

◆ __init__()

__init__ ( object  function,
str  name 
)

◆ __setattr__()

int __setattr__ ( object  attr,
object  v 
)

◆ __traverse__()

int __traverse__ ( Visitproc  visit,
void  arg 
)

◆ getArgs()

object getArgs ( )

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getDelay()

object getDelay ( )

Returns the delay time if set, None otherwise. See AsyncTask::has_delay() and AsyncTask::get_delay().

◆ getFunction()

object getFunction ( )

◆ getOwner()

object getOwner ( )

◆ getUponDeath()

object getUponDeath ( )

◆ operator new()

operator new ( size_t  size)

◆ setArgs()

setArgs ( object  args,
bool  append_task 
)

◆ setDelay()

setDelay ( object  delay)

If None is passed, calls clear_delay, otherwise sets the delay time. See AsyncTask::set_delay() and AsyncTask::clear_delay().

◆ setFunction()

setFunction ( object  function)

◆ setOwner()

setOwner ( object  owner)

◆ setUponDeath()

setUponDeath ( object  upon_death)

Member Data Documentation

◆ __dict__

object __dict__

This is a special variable to hold the instance dictionary in which custom variables may be stored.

◆ delay_time

object delay_time

The delay value that has been set on this task, if any, or None.

◆ frame

int frame

The number of frames that have elapsed since the task was started, according to the task manager's clock.

◆ id

AtomicAdjust::Integer id

This is a number guaranteed to be unique for each different AsyncTask object in the universe.

◆ name

name

The name of this task.

◆ time

double time

The amount of seconds that have elapsed since the task was started, according to the task manager's clock.

◆ wake_time

double wake_time

If this task has been added to an AsyncTaskManager with a delay in effect, this contains the time at which the task is expected to awaken. It has no meaning of the task has not yet been added to a queue, or if there was no delay in effect at the time the task was added.

If the task's status is not S_sleeping, this contains 0.0.