Explorar el Código

Finally fix those darn Maya crashes

rdb hace 15 años
padre
commit
124942a13b

+ 1 - 1
dtool/src/dtoolutil/executionEnvironment.cxx

@@ -229,7 +229,7 @@ ns_get_environment_variable(const string &var) const {
   } else if (var == "MAIN_DIR") {
   } else if (var == "MAIN_DIR") {
 #ifdef HAVE_PYTHON
 #ifdef HAVE_PYTHON
     // If we're running from Python code, read out sys.argv.
     // If we're running from Python code, read out sys.argv.
-    if (Py_IsInitialized()) {
+    if (!ns_has_environment_variable("PANDA_INCOMPATIBLE_PYTHON") && Py_IsInitialized()) {
       PyObject* obj = PySys_GetObject((char*) "argv");
       PyObject* obj = PySys_GetObject((char*) "argv");
       if (obj) {
       if (obj) {
         Filename main_dir = Filename::from_os_specific(PyString_AsString(PyList_GetItem(obj, 0)));
         Filename main_dir = Filename::from_os_specific(PyString_AsString(PyList_GetItem(obj, 0)));

+ 5 - 0
pandatool/src/mayaprogs/mayaWrapper.cxx

@@ -320,6 +320,11 @@ int main(int argc, char **argv)
   _putenv(env1);
   _putenv(env1);
   _putenv(env2);
   _putenv(env2);
 #endif // _WIN32
 #endif // _WIN32
+
+  // When this is set, Panda3D will try not to use any functions from the
+  // CPython API.  This is necessary because Maya links with its own copy
+  // of Python, which may be incompatible with ours.
+  _putenv("PANDA_INCOMPATIBLE_PYTHON=1");
   
   
 #ifdef _WIN32
 #ifdef _WIN32
   STARTUPINFO si; PROCESS_INFORMATION pi;
   STARTUPINFO si; PROCESS_INFORMATION pi;

+ 5 - 0
pandatool/src/mayaprogs/mayapath.cxx

@@ -157,6 +157,11 @@ main(int argc, char *argv[]) {
 
 
 #endif // IS_OSX
 #endif // IS_OSX
 
 
+  // When this is set, Panda3D will try not to use any functions from the
+  // CPython API.  This is necessary because Maya links with its own copy
+  // of Python, which may be incompatible with ours.
+  putenv("PANDA_INCOMPATIBLE_PYTHON=1");
+
   // Now that we have set up the environment variables properly, chain
   // Now that we have set up the environment variables properly, chain
   // to the actual maya2egg_bin (or whichever) executable.
   // to the actual maya2egg_bin (or whichever) executable.