Skip to content

Commit

Permalink
Merge pull request #1443 from ziqidong/zeno-727
Browse files Browse the repository at this point in the history
fix: lock when reset temp cache dir
  • Loading branch information
legobadman authored Sep 25, 2023
2 parents 5e67819 + 207b496 commit f299db6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 4 additions & 3 deletions ui/zenoedit/cache/zcachemgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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");
Expand Down
7 changes: 6 additions & 1 deletion ui/zenoedit/viewport/optixviewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<bool>("output_aov") : false;
bool exr = zeno::getSession().userData().has("output_exr") ? zeno::getSession().userData().get2<bool>("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)
Expand Down

0 comments on commit f299db6

Please sign in to comment.