Here's some MEL which should be enough to test the attribute-paint vertex indices. It doesn't paint offsets, just direct values to scale and rotate. I tested it on very messy mesh, with a lot of booleans and deleted components, and it seems to hold ok.
If you get it working with python, feel free to post it here as another answer ;) Meanwhile I'll add a MEL tag.
To use it, select a mesh and type paintedLocators();
Then use Modify->Paint Attributes Tool
// a proc to place a locator at every vertex
global proc string[] makeLocatorsAtVertices(string $shape) {
string $locators[];
string $vts[] = `ls -flatten ($shape+".vtx[*]")`;
for ($v in $vts) {
float $p[] = `pointPosition -w $v`;
string $locs[] = `spaceLocator`;
setAttr ($locs[0] + ".t") $p[0] $p[1] $p[2];
$locators[`size $locators`] = $locs[0] ;
}
return $locators;
}
global proc paintedLocators() {
string $sel[] = `ls -sl -dag -leaf -type "mesh"`;
string $shape = $sel[0];
string $locs[] = makeLocatorsAtVertices($shape);
int $n = size($locs);
// Make paintable scale and rotate attributes - data type will be multi-float
// Connect paintable attribute elements to the locator at the matching array position.
// Set scale default value to 1
for ($att in {"rx","ry","rz","sx","sy","sz"}) {
int $isScaleAtt = (substring($a,1,1) == "s");
addAttr -ln ("feather_"+$att) -im 1 -m -at "float" $shape;
makePaintable -at "multiFloat" "mesh" ("feather_"+$att) ;
for ($i=0;$i<$n;$i++){
connectAttr -f ($shape + ".feather_"+$att+"["+$i+"]") ($locs[$i] + "."+$att) ;
if ($isScaleAtt) setAttr ($shape + ".feather_"+$att+"["+$i+"]") 1.0;
}
}
select $shape;
}
One more thing
I got some errors at first. There were some lines in an installed maya script that were failing. If you get "procedure not found" errors when you try to select the attribute in the paint attributes tool, comment out the lines in artAttrCreateMenuItems.mel as follows:
change Line 190: to:
} else if ( $paintableNodeType == "mesh") {
and comment out lines 200 - 205
// if ( $currTool != "artClothPaint" )
// {
// artClothPaintToolScript( 4 );
// } else {
// clothPaintToolOn();
// }
and re source it
By:
Julian Mann
[ Admin ]