ignoring outAlpha connection in layered texture

This commit is contained in:
Asad M. Zaman 2005-03-25 02:13:41 +00:00
parent bd820acd49
commit 867b37b73a
2 changed files with 14 additions and 6 deletions

View File

@ -331,8 +331,14 @@ read_surface_color(MayaShader *shader, MObject color, bool trans) {
for (size_t j=0; j<pla.length(); ++j) { for (size_t j=0; j<pla.length(); ++j) {
//maya_cat.debug() << pl.name() << " is(pl) " << pl.node().apiTypeStr() << endl; //maya_cat.debug() << pl.name() << " is(pl) " << pl.node().apiTypeStr() << endl;
//maya_cat.debug() << pla[j].name() << " is(pla) " << pla[j].node().apiTypeStr() << endl; //maya_cat.debug() << pla[j].name() << " is(pla) " << pla[j].node().apiTypeStr() << endl;
string pla_name = pla[j].name().asChar();
// sometimes, by default, maya gives a outAlpha on subsequent plugs, ignore that
if (pla_name.find("outAlpha") != -1) {
maya_cat.debug() << pl.name() << " ignoring: " << pla_name << endl;
continue;
}
if (!first) { if (!first) {
maya_cat.debug() << pl.name() << "next:connectedTo: " << pla[j].name() << endl; maya_cat.debug() << pl.name() << " next:connectedTo: " << pla_name << endl;
MayaShaderColorDef *color_p = new MayaShaderColorDef; MayaShaderColorDef *color_p = new MayaShaderColorDef;
color_p->read_surface_color(shader, pla[j].node()); color_p->read_surface_color(shader, pla[j].node());
color_p->_texture_name.assign(pla[j].name().asChar()); color_p->_texture_name.assign(pla[j].name().asChar());
@ -342,7 +348,7 @@ read_surface_color(MayaShader *shader, MObject color, bool trans) {
maya_cat.debug() << "uv_name : " << color_p->_texture_name << endl; maya_cat.debug() << "uv_name : " << color_p->_texture_name << endl;
} }
else { else {
maya_cat.debug() << pl.name() << " first:connectedTo: " << pla[j].name() << endl; maya_cat.debug() << pl.name() << " first:connectedTo: " << pla_name << endl;
read_surface_color(shader, pla[j].node()); read_surface_color(shader, pla[j].node());
_texture_name.assign(pla[j].name().asChar()); _texture_name.assign(pla[j].name().asChar());
int loc = _texture_name.find('.',0); int loc = _texture_name.find('.',0);
@ -356,7 +362,7 @@ read_surface_color(MayaShader *shader, MObject color, bool trans) {
MPlug pl_temp = pla[j]; MPlug pl_temp = pla[j];
MPlugArray pla_temp; MPlugArray pla_temp;
pl_temp.connectedTo(pla_temp, true, false); pl_temp.connectedTo(pla_temp, true, false);
maya_cat.debug() << pl_temp.name() << "connectedTo:" << pla_temp.length() << " plugs\n"; maya_cat.debug() << pl_temp.name() << " connectedTo:" << pla_temp.length() << " plugs\n";
} }
/* /*
string blah; string blah;

View File

@ -2283,15 +2283,17 @@ set_shader_attributes(EggPrimitive &primitive, const MayaShader &shader, const M
// if multi-textured, first texture in maya is on top, so // if multi-textured, first texture in maya is on top, so
if (shader._color.size() > 1) { if (shader._color.size() > 1) {
// last shader on the list is the base one, which should always pick up the alpha
// from the texture file. But the top textures may have to strip the alpha
if (i!=shader._color.size()-1) { if (i!=shader._color.size()-1) {
// read the _alpha_is_luminance to figure out env_type // read the _alpha_is_luminance to figure out env_type
if (!shader._alpha_is_luminance) if (!shader._alpha_is_luminance)
tex.set_env_type(EggTexture::ET_decal); tex.set_env_type(EggTexture::ET_decal);
// multitexture modulate mode may specify, desired alpha on/off
if (!color_def->_alpha_is_luminance)
tex.set_alpha_mode(EggRenderMode::AM_off); // Force alpha to be 'off'
} }
if (color_def->_alpha_is_luminance) { if (color_def->_alpha_is_luminance) {
// multitexture modulate mode may specify, desired alpha on/off
if (color_def->_alpha_is_luminance)
tex.set_alpha_mode(EggRenderMode::AM_off); // Force alpha to be 'off'
} }
} }
} else { // trans_def._has_texture } else { // trans_def._has_texture