diff --git a/pandatool/src/maya/mayaShaderColorDef.cxx b/pandatool/src/maya/mayaShaderColorDef.cxx index d37034b4b1..d87e888129 100644 --- a/pandatool/src/maya/mayaShaderColorDef.cxx +++ b/pandatool/src/maya/mayaShaderColorDef.cxx @@ -60,6 +60,7 @@ MayaShaderColorDef() { _wrap_v = true; _has_alpha_channel = false; + _keep_alpha = false; _blend_type = BT_unspecified; @@ -102,6 +103,7 @@ MayaShaderColorDef(MayaShaderColorDef ©) { _blend_type = copy._blend_type; _has_alpha_channel = copy._has_alpha_channel; + _keep_alpha = copy._keep_alpha; _repeat_uv = copy._repeat_uv; _offset = copy._offset; @@ -336,13 +338,11 @@ read_surface_color(MayaShader *shader, MObject color, bool trans) { } else if (color.hasFn(MFn::kLayeredTexture)) { maya_cat.debug() << "Found layered texture" << endl; - MFnDependencyNode layered_fn(color); - - MPlugArray color_pa; - layered_fn.getConnections(color_pa); - int blendValue; MStatus status; + MPlugArray color_pa; + MFnDependencyNode layered_fn(color); + layered_fn.getConnections(color_pa); MPlug inputsPlug = layered_fn.findPlug("inputs", &status); MPlug blendModePlug = layered_fn.findPlug("blendMode", &status); @@ -377,6 +377,8 @@ read_surface_color(MayaShader *shader, MObject color, bool trans) { break; case 6: bt = BT_modulate; + get_bool_attribute(color, "keepAlpha", _keep_alpha); + maya_cat.info() << "keepAlpha: " << _keep_alpha << endl; break; case 4: bt = BT_add; diff --git a/pandatool/src/maya/mayaShaderColorDef.h b/pandatool/src/maya/mayaShaderColorDef.h index 0813255ff3..07fc6518bb 100755 --- a/pandatool/src/maya/mayaShaderColorDef.h +++ b/pandatool/src/maya/mayaShaderColorDef.h @@ -96,6 +96,7 @@ public: bool _wrap_v; bool _has_alpha_channel; + bool _keep_alpha; LVector2f _repeat_uv; LVector2f _offset; diff --git a/pandatool/src/mayaegg/mayaToEggConverter.cxx b/pandatool/src/mayaegg/mayaToEggConverter.cxx index 73a5402f1c..cfde03af4d 100644 --- a/pandatool/src/mayaegg/mayaToEggConverter.cxx +++ b/pandatool/src/mayaegg/mayaToEggConverter.cxx @@ -2326,8 +2326,10 @@ set_shader_attributes(EggPrimitive &primitive, const MayaShader &shader, if ((EggTexture::EnvType)color_def->_blend_type == EggTexture::ET_modulate) { // read the _has_alpha_cahnnel to figure out rgb or rgba //if (!color_def->_has_alpha_channel) { - //Maya's multiply is slightly different than panda's. Hence we are dropping the alpha. - is_rgb = true; // modulate forces the alpha to be ignored + // Maya's multiply is slightly different than panda's. Unless, _keep_alpha is set, + // we are dropping the alpha. + if (!color_def->_keep_alpha) + is_rgb = true; // modulate forces the alpha to be ignored //} } }