Skip to content

Commit

Permalink
Reset inputs on successful pack/unpack
Browse files Browse the repository at this point in the history
  • Loading branch information
dvsku committed Aug 31, 2024
1 parent 46e8722 commit 50348fe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions source/src/systems/dt_sys_evp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ dt_sys_evp::dt_sys_evp(dt_app& app)
m_app.systems.core.errors = result.message;
}

if (result.status == libevp::evp_result::status::ok) {
switch (m_current_work) {
case work_type::packing: packing_inputs.reset(); break;
case work_type::unpacking: unpacking_inputs.reset(); break;

default: break;
}
}

m_current_work = work_type::none;

m_app.systems.core.work_context.stop_working(success);
m_app.systems.core.work_context.set_progress(0.0f);
};
Expand All @@ -58,6 +69,7 @@ void dt_sys_evp::pack() {
m_app.systems.core.errors = "";

m_app.systems.core.work_context.start_working();
m_current_work = work_type::packing;
m_evp.pack_async(inputs, packing_inputs.output, &m_evp_context);
}

Expand All @@ -80,6 +92,7 @@ void dt_sys_evp::unpack() {
m_app.systems.core.errors = "";

m_app.systems.core.work_context.start_working();
m_current_work = work_type::unpacking;
m_evp.unpack_async(inputs, unpacking_inputs.output, &m_evp_context);
}

Expand Down
8 changes: 8 additions & 0 deletions source/src/systems/dt_sys_evp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@ namespace dvsku_toolkit {
void set_pack_files();
void set_unpack_files();

private:
enum class work_type : uint8_t {
none,
packing,
unpacking
};

private:
libevp::evp m_evp;
libevp::evp_context m_evp_context;
work_type m_current_work = work_type::none;

private:
std::vector<std::filesystem::path> get_pack_files();
Expand Down

0 comments on commit 50348fe

Please sign in to comment.