[Bf-blender-cvs] [4ffac9f] fluid-mantaflow: possible fix for running manta python calls under windows
Sebastián Barschkis
noreply at git.blender.org
Thu Jul 14 23:54:47 CEST 2016
Commit: 4ffac9faf19c510bc5ae0b11e6a84b2fcc701bf4
Author: Sebastián Barschkis
Date: Thu Jul 14 23:52:49 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB4ffac9faf19c510bc5ae0b11e6a84b2fcc701bf4
possible fix for running manta python calls under windows
===================================================================
M intern/mantaflow/intern/SMOKE.cpp
===================================================================
diff --git a/intern/mantaflow/intern/SMOKE.cpp b/intern/mantaflow/intern/SMOKE.cpp
index ec91756..058532e 100644
--- a/intern/mantaflow/intern/SMOKE.cpp
+++ b/intern/mantaflow/intern/SMOKE.cpp
@@ -413,7 +413,19 @@ void SMOKE::runPythonString(std::vector<std::string> commands)
PyGILState_STATE gilstate = PyGILState_Ensure();
for (std::vector<std::string>::iterator it = commands.begin(); it != commands.end(); ++it) {
std::string command = *it;
+
+#ifdef WIN32
+ // special treatment for windows when running python code
+ size_t cmdLength = command.length();
+ char* buffer = new char[cmdLength+1];
+ memcpy(buffer, command.data(), cmdLength);
+
+ buffer[cmdLength] = '\0';
+ PyRun_SimpleString(buffer);
+ delete[] buffer;
+#else
PyRun_SimpleString(command.c_str());
+#endif
}
PyGILState_Release(gilstate);
}
More information about the Bf-blender-cvs
mailing list