View Full Version : Change Hardware Texturing Channel using Mel
beetz15s 11-30-2009, 08:26 PM I'm trying to figure out the mel to set a shaders hardware texture channel.
|
|
beetz15s
11-30-2009, 08:41 PM
global proc AEhardwareTextureChannelCB( string $attrTokens,
string $messagePlug )
{
// Get the material info node.
string $info = getMaterialInfo($messagePlug);
if ($info == "")
return;
string $channelMenuName = getChannelMenuNameFromMaterialPlug($messagePlug);
// Disconnect the current texture from materialInfo
//
disconnectInfoTexture($info);
// Get the channel to now display.
//
int $index = `optionMenuGrp -q -select $channelMenuName`;
if ($index > 1) {
string $material = getPlugNode($messagePlug);
string $channelAttrs[];
tokenize($attrTokens, " ", $channelAttrs);
string $attr = $channelAttrs[$index - 2];
// If the attribute is not found in the provided tokens,
// assume that it is set to 'Combined'. (bake the whole shader
// as if it was a texture)
//
if ($attr == "")
{
// In order to display all textures at once, we need to
// hook up the materialInfo node in a non-standard way:
// the "texture[0]" attribute is set to the shader (as opposed
// to a standard texture), and the texturePlug is set
// to the outColor of the shader.
//
connectAttr -f ($material+".message") ($info+".texture[0]");
}
else
{
string $materialPlug = ($material+"."+$attr);
string $texturePlug = getTexturePlugFromMaterial($materialPlug);
// Is a texture connected on this channel ?
//
if ($texturePlug != "") {
// Connect up the new texture to materialInfo.
//
string $node = getPlugNode($texturePlug);
if (size(`listConnections $node`) > 1) {
// It may be ambiguous for materialInfo to figure out which
// channel to display (for example, if a file texture is
// hooked up to both color and bump on a material). We
// make a connection to the "textureChannel" to specify
// which plug should be used.
//
connectAttr $texturePlug ($info+".textureChannel");
}
// Now let materialInfo do its thing
//
connectAttr ($node+".message") ($info+".texture[0]");
}
}
updateQualityMenu( $attrTokens, $messagePlug );
}
}
beetz15s
12-01-2009, 03:53 AM
Script editor echo all commands these two lines of code when you change hardware texture from none to incandescence.
I'm trying to figure out the mel to set a shaders hardware texture channel.
AEhardwareTextureChannelCB "color transparency ambientColor incandescence normalCamera diffuse translucence" lambert2.message;
AEhardwareTextureChangedCB "color transparency ambientColor incandescence normalCamera diffuse translucence" lambert2.message;
beetz15s
12-01-2009, 01:48 PM
any help? please
beetz15s
12-01-2009, 04:50 PM
http://www.creativecrash.com/forums/search?search=AEhardwareTextureChannelCB+&type=&x=19&y=17
same problem
beetz15s
12-01-2009, 07:48 PM
Hopefully someone could give some answers to the problem
beetz15s
12-02-2009, 03:10 AM
ANSWER
connectAttr ($file + ".msg") ($matInfo[0] + ".t") -na
CGTalk Moderation
12-02-2009, 03:10 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.