23 AsyncTaskSequence(
const std::string &name) :
34 ~AsyncTaskSequence() {
35 set_current_task(
nullptr,
true);
45 bool AsyncTaskSequence::
55 AsyncTask::DoneStatus AsyncTaskSequence::
63 set_current_task(
nullptr,
true);
68 if (_repeat_count > 0) {
71 if (_repeat_count != 0) {
78 set_current_task(task,
true);
79 nassertr(_current_task !=
nullptr, DS_exit);
81 DoneStatus result = _current_task->do_task();
87 double now = _manager->_clock->get_frame_time();
88 _current_task->_start_time = now + _current_task->_delay;
90 _delay = _current_task->_delay;
91 _has_delay = _current_task->_has_delay;
93 if (result == DS_pause) {
115 nassertr(
false, DS_exit);
126 void AsyncTaskSequence::
128 AsyncTask::upon_birth(manager);
130 set_current_task(
nullptr,
true);
147 void AsyncTaskSequence::
149 AsyncTask::upon_death(manager, clean_exit);
150 set_current_task(
nullptr, clean_exit);
156 void AsyncTaskSequence::
157 set_current_task(
AsyncTask *task,
bool clean_exit) {
158 if (_current_task == task) {
162 if (_current_task !=
nullptr) {
163 nassertv(_current_task->_state == S_active_nested);
164 nassertv(_current_task->_manager == _manager || _manager ==
nullptr);
165 _current_task->_state = S_inactive;
166 _current_task->_manager =
nullptr;
167 _current_task->upon_death(_manager, clean_exit);
170 _current_task = task;
172 if (_current_task !=
nullptr) {
173 nassertv(_current_task->_state == S_inactive);
174 nassertv(_current_task->_manager ==
nullptr);
175 _current_task->upon_birth(_manager);
176 nassertv(_current_task->_state == S_inactive);
177 nassertv(_current_task->_manager ==
nullptr);
178 _current_task->_manager = _manager;
179 _current_task->_state = S_active_nested;
181 double now = _manager->_clock->get_frame_time();
182 task->_start_time = now;
183 task->_start_frame = _manager->_clock->get_frame_count();
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_task
Returns the nth AsyncTask in the collection.
A class to manage a loose queue of isolated tasks, which can be performed either synchronously (in th...
This class represents a concrete task performed by an AsyncManager.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_num_tasks
Returns the number of AsyncTasks in the collection.