Get Transforms from component selection

global proc string[] getTransform(string $inShape[]) {
    string $transform[];
    for ($node in $inShape) {
        if ( "transform" != `nodeType $node` ) {
            // If given node is already a transform, just pass on through
            string $parents[] = `listRelatives -fullPath -parent $node`;
            appendStringArray($transform, $parents, size($parents));
    return $transform;

global proc getTransformsFromComponent(){
    string $outShapes[] = `ls -selection -objectsOnly`;
    print $outShapes;


problem im running into is that i get nothing returned even tho i passed the shape names into the getTransform proc. Any ideas?

What im trying to achieve is to get the top transform node from users component selection. for example when user select some uvs. I want to return the meshes transform name. This is part of a bigger script that gets faces from transform nodes without having to select the faces itself.


sorry i forgot to mention where i got the getTransform code from.


solved the problem. found something interesting along the way with polyListComponentConversion. if you specify the component with a wildcard .map[*] and convert to face it will actually give you all the faces instead of returning .f[*]. This is quite handy because you dont have to select all the faces and use polyInfo to get the faces.

    string $selOBJs[] = `ls -selection -objectsOnly`;
    string $plylistConOBJs[];
    for($i = 0; $i < size($selOBJs); $i++){
    $plylistConOBJs[$i] = ($selOBJs[$i] + ".map[*]");
    print $plylistConOBJs;
    string $convertedList[] = `polyListComponentConversion -fuv -tf $plylistConOBJs`;
    print $convertedList;


this script will return faceslist of the objects when only a few uvs are selected.