2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-06-07 01:53:29 +00:00

Connection: Amend clang-format discrepancies

This commit is contained in:
Lioncash 2019-08-21 19:16:46 -04:00
parent ac4858b857
commit d00cb36fc2

View File

@ -339,8 +339,8 @@ Connection::Connection(int verbosityLevel) {
} }
} }
std::wstring cmdLine = fmt::format(fmt(L" --background -P \"{}\" -- {} {} {} \"{}\""), std::wstring cmdLine = fmt::format(fmt(L" --background -P \"{}\" -- {} {} {} \"{}\""), blenderShellPath,
blenderShellPath, uintptr_t(writehandle), uintptr_t(readhandle), verbosityLevel, blenderAddonPath); uintptr_t(writehandle), uintptr_t(readhandle), verbosityLevel, blenderAddonPath);
STARTUPINFO sinfo = {sizeof(STARTUPINFO)}; STARTUPINFO sinfo = {sizeof(STARTUPINFO)};
HANDLE nulHandle = CreateFileW(L"nul", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &sattrs, OPEN_EXISTING, HANDLE nulHandle = CreateFileW(L"nul", GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &sattrs, OPEN_EXISTING,
@ -355,8 +355,8 @@ Connection::Connection(int verbosityLevel) {
sinfo.hStdOutput = consoleOutWrite; sinfo.hStdOutput = consoleOutWrite;
} }
if (!CreateProcessW(blenderBin, const_cast<wchar_t*>(cmdLine.c_str()), NULL, NULL, TRUE, if (!CreateProcessW(blenderBin, const_cast<wchar_t*>(cmdLine.c_str()), NULL, NULL, TRUE, NORMAL_PRIORITY_CLASS,
NORMAL_PRIORITY_CLASS, NULL, NULL, &sinfo, &m_pinfo)) { NULL, NULL, &sinfo, &m_pinfo)) {
LPWSTR messageBuffer = nullptr; LPWSTR messageBuffer = nullptr;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL); GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL);
@ -420,8 +420,8 @@ Connection::Connection(int verbosityLevel) {
/* Try user-specified blender first */ /* Try user-specified blender first */
if (blenderBin) { if (blenderBin) {
execlp(blenderBin, blenderBin, "--background", "-P", blenderShellPath.c_str(), "--", execlp(blenderBin, blenderBin, "--background", "-P", blenderShellPath.c_str(), "--", readfds.c_str(),
readfds.c_str(), writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), NULL); writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), NULL);
if (errno != ENOENT) { if (errno != ENOENT) {
errbuf = fmt::format(fmt("NOLAUNCH {}"), strerror(errno)); errbuf = fmt::format(fmt("NOLAUNCH {}"), strerror(errno));
_writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]); _writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]);
@ -438,8 +438,8 @@ Connection::Connection(int verbosityLevel) {
steamBlender += "/blender"; steamBlender += "/blender";
#endif #endif
blenderBin = steamBlender.c_str(); blenderBin = steamBlender.c_str();
execlp(blenderBin, blenderBin, "--background", "-P", blenderShellPath.c_str(), "--", execlp(blenderBin, blenderBin, "--background", "-P", blenderShellPath.c_str(), "--", readfds.c_str(),
readfds.c_str(), writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), NULL); writefds.c_str(), vLevel.c_str(), blenderAddonPath.c_str(), NULL);
if (errno != ENOENT) { if (errno != ENOENT) {
errbuf = fmt::format(fmt("NOLAUNCH {}"), strerror(errno)); errbuf = fmt::format(fmt("NOLAUNCH {}"), strerror(errno));
_writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]); _writeStr(errbuf.c_str(), errbuf.size(), m_readpipe[1]);
@ -470,8 +470,8 @@ Connection::Connection(int verbosityLevel) {
m_errPath = hecl::SystemString(TMPDIR) + m_errPath = hecl::SystemString(TMPDIR) +
fmt::format(fmt(_SYS_STR("/hecl_{:016X}.derp")), (unsigned long long)m_pinfo.dwProcessId); fmt::format(fmt(_SYS_STR("/hecl_{:016X}.derp")), (unsigned long long)m_pinfo.dwProcessId);
#else #else
m_errPath = m_errPath = hecl::SystemString(TMPDIR) +
hecl::SystemString(TMPDIR) + fmt::format(fmt(_SYS_STR("/hecl_{:016X}.derp")), (unsigned long long)m_blenderProc); fmt::format(fmt(_SYS_STR("/hecl_{:016X}.derp")), (unsigned long long)m_blenderProc);
#endif #endif
hecl::Unlink(m_errPath.c_str()); hecl::Unlink(m_errPath.c_str());
@ -652,8 +652,7 @@ void PyOutStream::close() {
} }
void PyOutStream::linkBlend(const char* target, const char* objName, bool link) { void PyOutStream::linkBlend(const char* target, const char* objName, bool link) {
format(fmt( format(fmt("if '{}' not in bpy.data.scenes:\n"
"if '{}' not in bpy.data.scenes:\n"
" with bpy.data.libraries.load('''{}''', link={}, relative=True) as (data_from, data_to):\n" " with bpy.data.libraries.load('''{}''', link={}, relative=True) as (data_from, data_to):\n"
" data_to.scenes = data_from.scenes\n" " data_to.scenes = data_from.scenes\n"
" obj_scene = None\n" " obj_scene = None\n"
@ -675,8 +674,7 @@ void PyOutStream::linkBlend(const char* target, const char* objName, bool link)
void PyOutStream::linkBackground(const char* target, const char* sceneName) { void PyOutStream::linkBackground(const char* target, const char* sceneName) {
if (!sceneName) { if (!sceneName) {
format(fmt( format(fmt("with bpy.data.libraries.load('''{}''', link=True, relative=True) as (data_from, data_to):\n"
"with bpy.data.libraries.load('''{}''', link=True, relative=True) as (data_from, data_to):\n"
" data_to.scenes = data_from.scenes\n" " data_to.scenes = data_from.scenes\n"
"obj_scene = None\n" "obj_scene = None\n"
"for scene in data_to.scenes:\n" "for scene in data_to.scenes:\n"
@ -688,8 +686,7 @@ void PyOutStream::linkBackground(const char* target, const char* sceneName) {
"bpy.context.scene.background_set = obj_scene\n"), "bpy.context.scene.background_set = obj_scene\n"),
target, target); target, target);
} else { } else {
format(fmt( format(fmt("if '{}' not in bpy.data.scenes:\n"
"if '{}' not in bpy.data.scenes:\n"
" with bpy.data.libraries.load('''{}''', link=True, relative=True) as (data_from, data_to):\n" " with bpy.data.libraries.load('''{}''', link=True, relative=True) as (data_from, data_to):\n"
" data_to.scenes = data_from.scenes\n" " data_to.scenes = data_from.scenes\n"
" obj_scene = None\n" " obj_scene = None\n"
@ -708,8 +705,7 @@ void PyOutStream::linkBackground(const char* target, const char* sceneName) {
void PyOutStream::AABBToBMesh(const atVec3f& min, const atVec3f& max) { void PyOutStream::AABBToBMesh(const atVec3f& min, const atVec3f& max) {
athena::simd_floats minf(min.simd); athena::simd_floats minf(min.simd);
athena::simd_floats maxf(max.simd); athena::simd_floats maxf(max.simd);
format(fmt( format(fmt("bm = bmesh.new()\n"
"bm = bmesh.new()\n"
"bm.verts.new(({},{},{}))\n" "bm.verts.new(({},{},{}))\n"
"bm.verts.new(({},{},{}))\n" "bm.verts.new(({},{},{}))\n"
"bm.verts.new(({},{},{}))\n" "bm.verts.new(({},{},{}))\n"
@ -1459,8 +1455,9 @@ Action::Action(Connection& conn) {
subtypeAABBs.back().first.read(conn); subtypeAABBs.back().first.read(conn);
subtypeAABBs.back().second.read(conn); subtypeAABBs.back().second.read(conn);
// printf("AABB %s %d (%f %f %f) (%f %f %f)\n", name.c_str(), i, // printf("AABB %s %d (%f %f %f) (%f %f %f)\n", name.c_str(), i,
// float(subtypeAABBs.back().first.val.simd[0]), float(subtypeAABBs.back().first.val.simd[1]), float(subtypeAABBs.back().first.val.simd[2]), // float(subtypeAABBs.back().first.val.simd[0]), float(subtypeAABBs.back().first.val.simd[1]),
// float(subtypeAABBs.back().second.val.simd[0]), float(subtypeAABBs.back().second.val.simd[1]), float(subtypeAABBs.back().second.val.simd[2])); // float(subtypeAABBs.back().first.val.simd[2]), float(subtypeAABBs.back().second.val.simd[0]),
// float(subtypeAABBs.back().second.val.simd[1]), float(subtypeAABBs.back().second.val.simd[2]));
} }
} }