question with taskMgr

Hi.
I’m tying to do some ‘strange’ stuff with taskMgr and I’m starting to wonder if it’s possible or if I’m just doing it wrong.

The goal is to have two states in the program, with each their own task.

I would like to do something like:

task_list = taskMgr.getTasks()
[ taskMgr.remove(task.name) for task in task_list]
//every task is paused/stop,...

//...other part of the program...

[ taskMgr.add(task, task.name) for task in task_list]
//and everything restart

But If I do that, when I restart the task, it is discarded immediately After a little investigation, I found that task.isremoved() is True, which is probably why that doesn’t work.

I don’t see a way to pause the task.
They do have a pause method, but that seems to return me an another task ? I’m not sure that I understand how that work.

Do you know a way to do that ?

Sounds like you’re using Panda3D 1.5.x or earlier. Have you tried it with 1.6.x? The task manager with that version was completely rewritten. I don’t honestly know whether the new task manager supports re-adding of removed Task objects either, though–it wasn’t part of the original design spec.

David

Yeah, I’m still on 1.5.4.
I will try 1.6.2 immediately on this point
thank

I have not used, or even read much of the panda manual on this subject, but I know from my “day job”…

This sounds like a perfect match for a finite state machine, and I see that Panda supports FSM functions. Maybe do a bit of researching in that area?

thank for the idea tutunkommon, but the scale of the project I’m in is much bigger.
I’m talking about 2-3 application, that work already, to work in a different tab in the same application. With only the tab active having task working.

The whole nearly work now, The task is one of the last thing that I need

For the record, I do believe the problem described in the OP is solved in 1.6.x.

David