its not a command! its a proc
whatIs artSetToolAndSelectAttr;
// Result: Mel procedure found in: ...../maya7/scripts/others/artAttrCreateMenuItems.mel //
(note this only works once artAttrCreateMenuItems.mel is loaderd oviously)
and teh procedure itselff reads:
CODE
global proc artSetToolAndSelectAttr(
string $artCommand,
string $attribute
)
//
// Description:
// Set a new tool if require and select an initial attribute.
//
{
source "artAttrCallback.mel";
global string $artSelectObject;
string $currentContext = currentCtx
;
string $currTool = contextInfo -c $currentContext
;
// bug 222358
// select the object if it is not already selected by the user
if( size($artSelectObject) > 0 )
{
select -r ($artSelectObject);
$artSelectObject = "";
}
// Check if we are in the right tool.
string $buf[];
tokenize( $attribute, ".", $buf );
if ( size($buf) < 3 )
return;
string $paintableNodeType = $buf[0];
string $paintableNodeName = $buf[1];
string $paintableAttribute = $buf[2];
// we use the following strings to search and remove "Weights" string appended to
// cloth attribute names.
string $searchString = "Weights";
string $replace = "";
if ( $paintableNodeType == "skinCluster" ) {
// Check if this is skin paint weight tool.
if ( $currTool != "artAttrSkin" ) {
// Set the Skin Paint Weight tool.
artAttrSkinToolScript( 4 );
}
}else if ($paintableNodeType == "blendShape") {
// Check if this is blendShape paint weight tool.
if ( $currTool != "artAttrBlendShape" ) {
// Set the Skin Paint Weight tool.
artAttrBlendShapeToolScript( 4 );
}
}else if ( $paintableNodeType == "mesh" &&
($paintableAttribute == "vertexColorRGB" || $paintableAttribute == "vertexFaceColorRGB" ) ) {
// Check if this is paint vertex color tool.
if ( $currTool != "artAttrColorPerVertex" ) {
if ( $paintableAttribute == "vertexColorRGB" ) {
// Set the Paint Vertex Color itool.
artAttrColorPerVertexToolScript( 5 );
} else {
artAttrColorPerVertexToolScript( 6 );
}
}
} else if ( $paintableNodeType == "mesh" &&
isValidAttrName( substitute $searchString $paintableAttribute $replace
) ) {
// retrieve the attribute name
string $attrNameUI = substitute $searchString $paintableAttribute $replace
;
//set it as the selected attribute for painting in the cloth paint tool
optionVar -stringValue cpPaintPropAttrG $attrNameUI;
//if we are in some other tool go to cloth paint tool.
// if we are in the tool, just change the paint attribute
if ( $currTool != "artClothPaint" )
{
artClothPaintToolScript( 4 );
} else {
clothPaintToolOn();
}
} else {
// You can only paint weights for polyReduce on a mesh node
// upstream of the polyReduce node. This is because painting weights
// on the mesh being reduced changes the topology and scrambles the
// painted vertices.
// So, here, we march up stream from the reduce node until
// a valid mesh is found, and set that as the mesh being painted.
//
// The recommended way for you to use paint weights is to invoke the
// command with the replaceOriginal flag off (or the Keep Original
// option checked).
//
if ( $paintableNodeType == "polyReduce" ) {
// get all upstream nodes
//
string $upstreamNodes[] = listHistory $paintableNodeName
;
int $i = 0;
string $node = "";
int $found = false;
// march through upstream nodes looking for a valid mesh
//
for ($node in $upstreamNodes ) {
string $nodeType = nodeType $node
;
// only poly meshes are valid for polyReduce
//
if ( $nodeType == "mesh" ) {
int $isVisible = getAttr( $node + ".visibility" )
;
int $isIntermediate = getAttr( $node + ".intermediateObject" )
;
int $isTemplated = getAttr( $node + ".template" )
;
// the node must be visible and not intermediate
//
if ( $isVisible && !$isIntermediate ) {
// Un-template an otherwise valid node (so we can select it)
//
if ( $isTemplated ) {
setAttr( $node + ".template", false );
warning($paintableNodeName + " can not accept templated nodes as input. Un-templating " + $node + "." );
}
$found = true;
break;
}
}
}
// No valid upstream meshes.
//
if ( !$found ) {
string $errorMsg = "Can't paint weights on the reduced mesh.\n";
$errorMsg += "// Turn Keep Original on in the Reduce options and";
$errorMsg += " paint weights on the original.";
error( $errorMsg );
return;
} else {
// found a valid mesh. Pick it as the mesh being painted.
//
select $node;
}
}
if ( $currTool != "artAttr" ) {
// Set the general Attribue Paint Tool.
artAttrToolScript( 4, "" );
}
}
// Set the selected attribute as paintable.
artAttrSelected( $artCommand, $attribute );
}