瀏覽代碼

it seems maya can give polygons without any shadermake install! so this takes care of the null shader pointer situation

Asad M. Zaman 21 年之前
父節點
當前提交
ff642fe771
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      pandatool/src/mayaegg/mayaToEggConverter.cxx

+ 4 - 2
pandatool/src/mayaegg/mayaToEggConverter.cxx

@@ -1671,6 +1671,7 @@ make_polyset(MayaNodeDesc *node_desc, const MDagPath &dag_path,
     int index = pi.index();
     int index = pi.index();
     nassertv(index >= 0 && index < (int)poly_shader_indices.length());
     nassertv(index >= 0 && index < (int)poly_shader_indices.length());
     int shader_index = poly_shader_indices[index];
     int shader_index = poly_shader_indices[index];
+
     if (shader_index != -1) {
     if (shader_index != -1) {
       nassertv(shader_index >= 0 && shader_index < (int)shaders.length());
       nassertv(shader_index >= 0 && shader_index < (int)shaders.length());
       MObject engine = shaders[shader_index];
       MObject engine = shaders[shader_index];
@@ -1681,13 +1682,14 @@ make_polyset(MayaNodeDesc *node_desc, const MDagPath &dag_path,
       shader = default_shader;
       shader = default_shader;
     }
     }
 
 
+    const MayaShaderColorDef *color_def = NULL;
+
     // And apply the shader properties to the polygon.
     // And apply the shader properties to the polygon.
     if (shader != (MayaShader *)NULL) {
     if (shader != (MayaShader *)NULL) {
       set_shader_attributes(*egg_poly, *shader, &pi);
       set_shader_attributes(*egg_poly, *shader, &pi);
+      color_def = shader->get_color_def();
     }
     }
 
 
-    const MayaShaderColorDef *color_def = shader->get_color_def();
-
     // Should we extract the color from the vertices?  Normally, in
     // Should we extract the color from the vertices?  Normally, in
     // Maya a texture completely replaces the vertex color, so we
     // Maya a texture completely replaces the vertex color, so we
     // should ignore the vertex color if we have a texture.
     // should ignore the vertex color if we have a texture.