Pārlūkot izejas kodu

restore support for maya 4.5

David Rose 22 gadi atpakaļ
vecāks
revīzija
3c96d94596

+ 2 - 0
dtool/Config.pp

@@ -418,6 +418,8 @@
 // be set before invoking Maya.
 #define MAYA_LICENSE_FILE
 #defer HAVE_MAYA $[isdir $[MAYA_LOCATION]/include/maya]
+// Define this if your version of Maya is earlier than 5.0 (e.g. Maya 4.5).
+#define MAYA_PRE_5_0
 
 // In the same fashion as mayaegg converter above, set softimage to egg converter as well
 #define SOFTIMAGE_LOCATION /c/Softimage/sdk_18sp2/SDK_1.8SP2/SAAPHIRE

+ 1 - 0
dtool/LocalSetup.pp

@@ -30,6 +30,7 @@ $[cdefine COMPILE_IN_DEFAULT_FONT]
 
 /* Define if we have Maya available. */
 $[cdefine HAVE_MAYA]
+$[cdefine MAYA_PRE_5_0]
 
 /* Define if we have SoftImage available. */
 $[cdefine HAVE_SOFTIMAGE]

+ 5 - 5
pandatool/src/maya/post_maya_include.h

@@ -19,8 +19,8 @@
 // This header file works in conjunction with pre_maya_include.h; it
 // cleans up some of the definitions that it left open.
 
-// This header is no longer necessary owing to the existence of
-// REQUIRE_IOSTREAM in Maya5.0.  We'll keep it around for now in case
-// we ever need it again.
-
-
+// Remove the symbols defined from pre_maya_include.h.
+#ifndef MAYA_PRE_5_0
+#undef ostream
+#undef istream
+#endif  // MAYA_PRE_5_0

+ 27 - 0
pandatool/src/maya/pre_maya_include.h

@@ -27,6 +27,31 @@
 #define _BOOL 1
 #endif
 
+#ifdef MAYA_PRE_5_0
+// Old versions of Maya, before version 5.0, used <iosteam.h>
+// etc. instead of the new <iostream> headers.  This requires some
+// workarounds to make this work compatibly with Panda, which uses the
+// new headers.
+
+// In windows, the antiquated headers define completely unrelated (and
+// incompatible) classes from those declared in the new headers.  On
+// the other hand, in gcc the antiquated headers seem to be references
+// to the new template classes, so under gcc we also have to declare
+// typedefs to make this work.
+#ifdef __GNUC__
+#ifndef PRE_MAYA_INCLUDE_H
+#define PRE_MAYA_INCLUDE_H
+#include <iostream.h>
+typedef ostream maya_ostream;
+typedef istream maya_istream;
+#endif
+#endif  // __GNUC__
+
+#define ostream maya_ostream
+#define istream maya_istream
+
+#else  // MAYA_PRE_5_0
+
 // In Maya 5.0, the headers seem to provide the manifest
 // REQUIRE_IOSTREAM, which forces it to use the new <iostream> headers
 // instead of the old <iostream.h> headers.  It also says this is for
@@ -36,3 +61,5 @@
 #define REQUIRE_IOSTREAM
 #endif  // HAVE_IOSTREAM
 
+#endif  // MAYA_PRE_5_0
+