mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 17:47:43 +00:00
Solve potential add-on install race condition
This commit is contained in:
@@ -190,6 +190,8 @@ void BlenderConnection::_blenderDied()
|
||||
BlenderLog.report(logvisor::Fatal, "Blender Exception");
|
||||
}
|
||||
|
||||
static std::atomic_bool BlenderFirstInit(false);
|
||||
|
||||
BlenderConnection::BlenderConnection(int verbosityLevel)
|
||||
{
|
||||
BlenderLog.report(logvisor::Info, "Establishing BlenderConnection...");
|
||||
@@ -207,16 +209,21 @@ BlenderConnection::BlenderConnection(int verbosityLevel)
|
||||
TMPDIR = (char*)"/tmp";
|
||||
m_startupBlend = TMPDIR;
|
||||
#endif
|
||||
|
||||
hecl::SystemString blenderShellPath(TMPDIR);
|
||||
blenderShellPath += _S("/hecl_blendershell.py");
|
||||
InstallBlendershell(blenderShellPath.c_str());
|
||||
|
||||
hecl::SystemString blenderAddonPath(TMPDIR);
|
||||
blenderAddonPath += _S("/hecl_blenderaddon.zip");
|
||||
InstallAddon(blenderAddonPath.c_str());
|
||||
|
||||
m_startupBlend += "/hecl_startup.blend";
|
||||
|
||||
bool FalseCmp = false;
|
||||
if (BlenderFirstInit.compare_exchange_strong(FalseCmp, true))
|
||||
{
|
||||
InstallBlendershell(blenderShellPath.c_str());
|
||||
InstallAddon(blenderAddonPath.c_str());
|
||||
InstallStartup(m_startupBlend.c_str());
|
||||
}
|
||||
|
||||
int installAttempt = 0;
|
||||
while (true)
|
||||
|
||||
@@ -231,6 +231,8 @@ static hecl::SystemString MakePathArgAbsolute(const hecl::SystemString& arg,
|
||||
void ToolPrintProgress(const hecl::SystemChar* message, const hecl::SystemChar* submessage,
|
||||
int lidx, float factor, int& lineIdx)
|
||||
{
|
||||
auto lk = logvisor::LockLog();
|
||||
|
||||
bool blocks = factor >= 0.0;
|
||||
factor = std::max(0.0f, std::min(1.0f, factor));
|
||||
int iFactor = factor * 100.0;
|
||||
|
||||
2
hecl/extern/boo
vendored
2
hecl/extern/boo
vendored
Submodule hecl/extern/boo updated: e92e6d7c4c...e45c3feef6
Reference in New Issue
Block a user