Browse Source

Fixed a bug I introduced last night

Josh Yelon 18 years ago
parent
commit
2ffa5786de
2 changed files with 23 additions and 16 deletions
  1. 21 14
      pandatool/src/maya/mayaShader.cxx
  2. 2 2
      pandatool/src/maya/mayaShaderColorDef.h

+ 21 - 14
pandatool/src/maya/mayaShader.cxx

@@ -284,27 +284,34 @@ bind_uvsets(MayaFileToUVSetMap &map) {
 void MayaShader::
 calculate_pairings() {
 
+  if (_legacy_mode) {
+    return;
+  }
+  
   for (size_t i=0; i<_all_maps.size(); i++) {
     _all_maps[i]->_opposite = 0;
   }
   
-  for (size_t i=0; i<_color_maps.size(); i++) {
-    if ((_color_maps[i]->_blend_type == MayaShaderColorDef::BT_modulate)||
-        (_color_maps[i]->_blend_type == MayaShaderColorDef::BT_unspecified)) {
-      for (size_t j=0; j<_trans_maps.size(); j++) {
-        try_pair(_color_maps[i], _trans_maps[j], true);
+  for (int retry=0; retry<2; retry++) {
+    bool perfect=(retry==0);
+    for (size_t i=0; i<_color_maps.size(); i++) {
+      if ((_color_maps[i]->_blend_type == MayaShaderColorDef::BT_modulate)||
+          (_color_maps[i]->_blend_type == MayaShaderColorDef::BT_unspecified)) {
+        for (size_t j=0; j<_trans_maps.size(); j++) {
+          try_pair(_color_maps[i], _trans_maps[j], perfect);
+        }
       }
     }
-  }
-  for (size_t i=0; i<_normal_maps.size(); i++) {
-    for (size_t j=0; j<_gloss_maps.size(); j++) {
-      try_pair(_normal_maps[i], _gloss_maps[j], true);
+    for (size_t i=0; i<_normal_maps.size(); i++) {
+      for (size_t j=0; j<_gloss_maps.size(); j++) {
+        try_pair(_normal_maps[i], _gloss_maps[j], perfect);
+      }
     }
-  }
-  if (_trans_maps.size() == 0) {
-    for (size_t i=0; i<_color_maps.size(); i++) {
-      for (size_t j=0; j<_glow_maps.size(); j++) {
-        try_pair(_color_maps[i], _glow_maps[j], true);
+    if (_trans_maps.size() == 0) {
+      for (size_t i=0; i<_color_maps.size(); i++) {
+        for (size_t j=0; j<_glow_maps.size(); j++) {
+          try_pair(_color_maps[i], _glow_maps[j], perfect);
+        }
       }
     }
   }

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

@@ -129,8 +129,8 @@ private:
   friend class MayaShader;
 
 
-  // Deprecated Fields - these fields are only used by the
-  // deprecated codepath.  These fields are deprecated for the
+  // Legacy Fields - these fields are only used by the
+  // legacy codepath.  These fields are deprecated for the
   // following reasons:
   //
   // * has_texture is redundant --- if there's no