From 207b49623a481fa0acc7931f572c723d2ca56653 Mon Sep 17 00:00:00 2001 From: ziqidong Date: Mon, 25 Sep 2023 18:03:44 +0800 Subject: [PATCH] fix: lock when reset temp cache dir --- ui/zenoedit/cache/zcachemgr.cpp | 7 ++++--- ui/zenoedit/viewport/optixviewport.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ui/zenoedit/cache/zcachemgr.cpp b/ui/zenoedit/cache/zcachemgr.cpp index 7de1b5f552..6ace6dd943 100644 --- a/ui/zenoedit/cache/zcachemgr.cpp +++ b/ui/zenoedit/cache/zcachemgr.cpp @@ -16,9 +16,9 @@ bool ZCacheMgr::initCacheDir(bool bTempDir, QDir dirCacheRoot, bool bAutoCleanCa if (!m_isNew && (m_cacheOpt == Opt_RunLightCameraMaterial || m_cacheOpt == Opt_AlwaysOn)) { return true; } - if (!bTempDir && bAutoCleanCache && - m_cacheOpt != Opt_RunLightCameraMaterial && - m_cacheOpt != Opt_AlwaysOn) + if ((bTempDir || bAutoCleanCache) && + m_cacheOpt != Opt_RunLightCameraMaterial && + m_cacheOpt != Opt_AlwaysOn) { cleanCacheDir(); } @@ -27,6 +27,7 @@ bool ZCacheMgr::initCacheDir(bool bTempDir, QDir dirCacheRoot, bool bAutoCleanCa if (m_bTempDir) { m_spTmpCacheDir.reset(new QTemporaryDir); m_spTmpCacheDir->setAutoRemove(true); + lastRunCachePath = QDir(m_spTmpCacheDir->path()); m_isNew = false; } else { QString tempDirPath = QDateTime::currentDateTime().toString("yyyy-MM-dd hh-mm-ss"); diff --git a/ui/zenoedit/viewport/optixviewport.cpp b/ui/zenoedit/viewport/optixviewport.cpp index e3dddb4cc9..fa6ba8d7d5 100644 --- a/ui/zenoedit/viewport/optixviewport.cpp +++ b/ui/zenoedit/viewport/optixviewport.cpp @@ -218,14 +218,19 @@ void OptixWorker::recordVideo(VideoRecInfo recInfo) void OptixWorker::screenShoot(QString path, QString type, int resx, int resy) { bool aov = zeno::getSession().userData().has("output_aov") ? zeno::getSession().userData().get2("output_aov") : false; + bool exr = zeno::getSession().userData().has("output_exr") ? zeno::getSession().userData().get2("output_exr") : false; + zeno::scope_exit sp([=]() { + zeno::getSession().userData().set2("output_aov", aov); + zeno::getSession().userData().set2("output_exr", exr); + }); zeno::getSession().userData().set2("output_aov", false); + zeno::getSession().userData().set2("output_exr", false); auto [x, y] = m_zenoVis->getSession()->get_window_size(); if (!m_zenoVis->getSession()->is_lock_window()) resx = x, resy = y; m_zenoVis->getSession()->set_window_size(resx, resy); m_zenoVis->getSession()->do_screenshot(path.toStdString(), type.toStdString(), true); m_zenoVis->getSession()->set_window_size(x, y); - zeno::getSession().userData().set2("output_aov", aov); } bool OptixWorker::recordFrame_impl(VideoRecInfo recInfo, int frame)