From ff3224f7d0cbe0ce24cc64e43ff8df086846367a Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 4 Aug 2020 14:50:41 +0200 Subject: [PATCH] Added reset_stages() to ThreadPoolJob. --- thread_pool_job.cpp | 7 +++++++ thread_pool_job.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/thread_pool_job.cpp b/thread_pool_job.cpp index 5fde81d..eb983ed 100644 --- a/thread_pool_job.cpp +++ b/thread_pool_job.cpp @@ -69,6 +69,11 @@ void ThreadPoolJob::set_stage(const int value) { _stage = value; } +void ThreadPoolJob::reset_stages() { + _current_run_stage = 0; + _stage = 0; +} + Variant ThreadPoolJob::get_object() const { return _object; } @@ -165,6 +170,8 @@ void ThreadPoolJob::_bind_methods() { ClassDB::bind_method(D_METHOD("set_stage", "value"), &ThreadPoolJob::set_stage); ADD_PROPERTY(PropertyInfo(Variant::INT, "stage"), "set_stage", "get_stage"); + ClassDB::bind_method(D_METHOD("reset_stages"), &ThreadPoolJob::reset_stages); + ClassDB::bind_method(D_METHOD("get_current_execution_time"), &ThreadPoolJob::get_current_execution_time); ClassDB::bind_method(D_METHOD("should_do", "just_check"), &ThreadPoolJob::should_do, DEFVAL(false)); diff --git a/thread_pool_job.h b/thread_pool_job.h index 3bb1b33..3b461d8 100644 --- a/thread_pool_job.h +++ b/thread_pool_job.h @@ -52,6 +52,8 @@ class ThreadPoolJob : public Reference { int get_stage() const; void set_stage(const int value); + void reset_stages(); + Variant get_object() const; void set_object(const Variant &value);