浏览代码

Add support for Maya 2018

rdb 7 年之前
父节点
当前提交
be19411cf8

+ 2 - 1
makepanda/makepandacore.py

@@ -102,7 +102,8 @@ MAYAVERSIONINFO = [("MAYA6",   "6.0"),
                    ("MAYA2015","2015"),
                    ("MAYA2015","2015"),
                    ("MAYA2016","2016"),
                    ("MAYA2016","2016"),
                    ("MAYA20165","2016.5"),
                    ("MAYA20165","2016.5"),
-                   ("MAYA2017","2017")
+                   ("MAYA2017","2017"),
+                   ("MAYA2018","2018"),
 ]
 ]
 
 
 MAXVERSIONINFO = [("MAX6", "SOFTWARE\\Autodesk\\3DSMAX\\6.0", "installdir", "maxsdk\\cssdk\\include"),
 MAXVERSIONINFO = [("MAX6", "SOFTWARE\\Autodesk\\3DSMAX\\6.0", "installdir", "maxsdk\\cssdk\\include"),

+ 0 - 1
pandatool/src/maya/mayaShader.h

@@ -21,7 +21,6 @@
 #include "lmatrix.h"
 #include "lmatrix.h"
 #include "namable.h"
 #include "namable.h"
 
 
-class MObject;
 
 
 /**
 /**
  * Corresponds to a single "shader" in Maya.  This extracts out all the
  * Corresponds to a single "shader" in Maya.  This extracts out all the

+ 11 - 5
pandatool/src/maya/mayaShaderColorDef.cxx

@@ -367,15 +367,17 @@ find_textures_legacy(MayaShader *shader, MObject color, bool trans) {
       if (li > -1) {
       if (li > -1) {
         // found a blend mode
         // found a blend mode
         if (maya_cat.is_spam()) {
         if (maya_cat.is_spam()) {
+          MString name = inputsPlug.name();
           maya_cat.spam() << "*** Start doIt... ***" << endl;
           maya_cat.spam() << "*** Start doIt... ***" << endl;
-          maya_cat.spam() << "inputsPlug Name: " << inputsPlug.name() << endl;
+          maya_cat.spam() << "inputsPlug Name: " << name.asChar() << endl;
         }
         }
         status = blendModePlug.selectAncestorLogicalIndex(li,inputsPlug);
         status = blendModePlug.selectAncestorLogicalIndex(li,inputsPlug);
         blendModePlug.getValue(blendValue);
         blendModePlug.getValue(blendValue);
 
 
         if (maya_cat.is_spam()) {
         if (maya_cat.is_spam()) {
+          MString name = blendModePlug.name();
           maya_cat.spam()
           maya_cat.spam()
-            << blendModePlug.name() << ": has value " << blendValue << endl;
+            << name.asChar() << ": has value " << blendValue << endl;
         }
         }
 
 
         MFnEnumAttribute blendModeEnum(blendModePlug);
         MFnEnumAttribute blendModeEnum(blendModePlug);
@@ -397,9 +399,13 @@ find_textures_legacy(MayaShader *shader, MObject color, bool trans) {
           bt = BT_add;
           bt = BT_add;
           break;
           break;
         }
         }
-        maya_cat.info() << layered_fn.name() << ": blendMode used " << blendName << endl;
-        if (maya_cat.is_spam()) {
-          maya_cat.spam() << "*** END doIt... ***" << endl;
+
+        if (maya_cat.is_info()) {
+          MString name = layered_fn.name();
+          maya_cat.info() << name.asChar() << ": blendMode used " << blendName.asChar() << endl;
+          if (maya_cat.is_spam()) {
+            maya_cat.spam() << "*** END doIt... ***" << endl;
+          }
         }
         }
 
 
         // advance to the next plug, because that is where the shader info are
         // advance to the next plug, because that is where the shader info are

+ 0 - 2
pandatool/src/maya/mayaShaderColorDef.h

@@ -21,8 +21,6 @@
 #include "pmap.h"
 #include "pmap.h"
 #include "pvector.h"
 #include "pvector.h"
 
 
-class MObject;
-class MPlug;
 class MayaShader;
 class MayaShader;
 class MayaShaderColorDef;
 class MayaShaderColorDef;
 typedef pvector<MayaShaderColorDef *> MayaShaderColorList;
 typedef pvector<MayaShaderColorDef *> MayaShaderColorList;

+ 0 - 1
pandatool/src/maya/mayaShaders.h

@@ -21,7 +21,6 @@
 #include "mayaShaderColorDef.h"
 #include "mayaShaderColorDef.h"
 
 
 class MayaShader;
 class MayaShader;
-class MObject;
 
 
 /**
 /**
  * Collects the set of MayaShaders that have been encountered so far.
  * Collects the set of MayaShaders that have been encountered so far.

+ 0 - 1
pandatool/src/maya/maya_funcs.h

@@ -28,7 +28,6 @@
 #include <maya/MVector.h>
 #include <maya/MVector.h>
 #include "post_maya_include.h"
 #include "post_maya_include.h"
 
 
-class MObject;
 
 
 bool
 bool
 get_maya_plug(MObject &node, const std::string &attribute_name, MPlug &plug);
 get_maya_plug(MObject &node, const std::string &attribute_name, MPlug &plug);

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

@@ -43,4 +43,21 @@
 #if MAYA_API_VERSION < 201600
 #if MAYA_API_VERSION < 201600
 #include <maya/OpenMayaMac.h>
 #include <maya/OpenMayaMac.h>
 #endif
 #endif
+#else
+// This defines MAYA_API_VERSION
+#include <maya/MTypes.h>
+#endif
+
+#if MAYA_API_VERSION >= 20180000
+#include <maya/MApiNamespace.h>
+#else
+class MObject;
+class MDagPath;
+class MFloatArray;
+class MFnDagNode;
+class MFnMesh;
+class MFnNurbsCurve;
+class MFnNurbsSurface;
+class MPlug;
+class MPointArray;
 #endif
 #endif

+ 11 - 6
pandatool/src/mayaegg/mayaToEggConverter.cxx

@@ -838,12 +838,14 @@ process_model_node(MayaNodeDesc *node_desc) {
       // Extract some interesting Camera data
       // Extract some interesting Camera data
       if (mayaegg_cat.is_spam()) {
       if (mayaegg_cat.is_spam()) {
         MPoint eyePoint = camera.eyePoint(MSpace::kWorld);
         MPoint eyePoint = camera.eyePoint(MSpace::kWorld);
+        MVector upDirection = camera.upDirection(MSpace::kWorld);
+        MVector viewDirection = camera.viewDirection(MSpace::kWorld);
         mayaegg_cat.spam() << "  eyePoint: " << eyePoint.x << " "
         mayaegg_cat.spam() << "  eyePoint: " << eyePoint.x << " "
                            << eyePoint.y << " " << eyePoint.z << endl;
                            << eyePoint.y << " " << eyePoint.z << endl;
-        mayaegg_cat.spam() << "  upDirection: "
-                           << camera.upDirection(MSpace::kWorld) << endl;
-        mayaegg_cat.spam() << "  viewDirection: "
-                           << camera.viewDirection(MSpace::kWorld) << endl;
+        mayaegg_cat.spam() << "  upDirection: " << upDirection.x << " "
+                           << upDirection.y << " " << upDirection.z << endl;
+        mayaegg_cat.spam() << "  viewDirection: " << viewDirection.x << " "
+                           << viewDirection.y << " " << viewDirection.z << endl;
         mayaegg_cat.spam() << "  aspectRatio: " << camera.aspectRatio() << endl;
         mayaegg_cat.spam() << "  aspectRatio: " << camera.aspectRatio() << endl;
         mayaegg_cat.spam() << "  horizontalFilmAperture: "
         mayaegg_cat.spam() << "  horizontalFilmAperture: "
                            << camera.horizontalFilmAperture() << endl;
                            << camera.horizontalFilmAperture() << endl;
@@ -922,9 +924,12 @@ process_model_node(MayaNodeDesc *node_desc) {
       mayaegg_cat.error() << "light extraction failed" << endl;
       mayaegg_cat.error() << "light extraction failed" << endl;
       return false;
       return false;
     }
     }
-    mayaegg_cat.info() << "-- Light found -- tranlations in cm, rotations in rads\n";
 
 
-    mayaegg_cat.info() << "\"" << dag_path.partialPathName() << "\" : \n";
+    if (mayaegg_cat.is_info()) {
+      MString name = dag_path.partialPathName();
+      mayaegg_cat.info() << "-- Light found -- tranlations in cm, rotations in rads\n";
+      mayaegg_cat.info() << "\"" << name.asChar() << "\" : \n";
+    }
 
 
     // Get the translationrotationscale data
     // Get the translationrotationscale data
     MObject transformNode = dag_path.transform(&status);
     MObject transformNode = dag_path.transform(&status);

+ 0 - 9
pandatool/src/mayaegg/mayaToEggConverter.h

@@ -42,15 +42,6 @@ class EggPrimitive;
 class EggXfmSAnim;
 class EggXfmSAnim;
 class MayaShaderColorDef;
 class MayaShaderColorDef;
 
 
-class MObject;
-class MDagPath;
-class MFnDagNode;
-class MFnNurbsSurface;
-class MFnNurbsCurve;
-class MFnMesh;
-class MPointArray;
-class MFloatArray;
-
 /**
 /**
  * This class supervises the construction of an EggData structure from a
  * This class supervises the construction of an EggData structure from a
  * single Maya file, or from the data already in the global Maya model space.
  * single Maya file, or from the data already in the global Maya model space.

+ 2 - 1
pandatool/src/mayaprogs/mayaCopy.cxx

@@ -16,7 +16,6 @@
 #include "mayaCopy.h"
 #include "mayaCopy.h"
 #include "config_maya.h"
 #include "config_maya.h"
 #include "cvsSourceDirectory.h"
 #include "cvsSourceDirectory.h"
-#include "mayaShader.h"
 #include "dcast.h"
 #include "dcast.h"
 
 
 #include "pre_maya_include.h"
 #include "pre_maya_include.h"
@@ -32,6 +31,8 @@
 #include <maya/MIntArray.h>
 #include <maya/MIntArray.h>
 #include "post_maya_include.h"
 #include "post_maya_include.h"
 
 
+#include "mayaShader.h"
+
 using std::endl;
 using std::endl;
 using std::string;
 using std::string;
 
 

+ 6 - 2
pandatool/src/mayaprogs/mayaCopy.h

@@ -17,15 +17,19 @@
 #include "pandatoolbase.h"
 #include "pandatoolbase.h"
 #include "cvsCopy.h"
 #include "cvsCopy.h"
 #include "mayaApi.h"
 #include "mayaApi.h"
-#include "mayaShaders.h"
 #include "dSearchPath.h"
 #include "dSearchPath.h"
 #include "pointerTo.h"
 #include "pointerTo.h"
 
 
 #include "pset.h"
 #include "pset.h"
 
 
+#include "pre_maya_include.h"
+#include <maya/MObject.h>
+#include "post_maya_include.h"
+
+#include "mayaShaders.h"
+
 class MayaShader;
 class MayaShader;
 class MayaShaderColorDef;
 class MayaShaderColorDef;
-class MDagPath;
 
 
 /**
 /**
  * A program to copy Maya .mb files into the cvs tree.
  * A program to copy Maya .mb files into the cvs tree.

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

@@ -105,6 +105,7 @@ struct MayaVerInfo maya_versions[] = {
   { "MAYA2016", "2016"},
   { "MAYA2016", "2016"},
   { "MAYA20165", "2016.5"},
   { "MAYA20165", "2016.5"},
   { "MAYA2017", "2017"},
   { "MAYA2017", "2017"},
+  { "MAYA2018", "2018"},
   { 0, 0 },
   { 0, 0 },
 };
 };