Query whether partial UVs are selected

{
	int $flattenListNum = size(`ls -sl -fl`);
	int $UVCount =  `polyEvaluate -uvcoord`;
	if  ($flattenListNum < $UVCount){
		print "works";
	}
	else{
	print "failed";	
	}

}

This code is suppose to be able to see if User made partial uvs selection.

but this error comes up when i run it

Cannot convert data of type int[] to type int

found the solution to the problem after some more testing. But its very annoying that polyEvaluate -uvcoord results in an int array instead of just being a int. Anyhow here the working code.

{
	int $flattenListNum = size(`ls -sl -fl`);
	int $UVCount[] =  `polyEvaluate -uvcoord`;
	if  ($flattenListNum < $UVCount[0]){
		print "works";
	}
	else{
	print "failed";	
	}

}

Since this code is part of this procedure I thought i’d ask here.

global proc string getNormalizeType(){
    string $objSel[] = `ls -sl -o`; //get objects only
    float $UVBBox[] = `polyEvaluate -bc2`;
    global string $normalizeType;
    int $flattenListNum = size(`ls -sl -fl`);
    int $UVCount[] =  `polyEvaluate -uvcoord`;
	
    if (`size $objSel` == 0){
        warning "No objects selected";
    }
    
    if (`size $objSel` == 1 && $flattenListNum = $UVCount[0]){
        NormalizeUVTile 0;
        print "Single Object Selected";
 
    }
    
    if (`size $objSel` > 1 && $flattenListNum = $UVCount[0]){
        NormalizeUVTile 1;
        print "Multiple Object selected";
    }  
    
    if ($flattenListNum < $UVCount[0]){
       NormalizeUVTile 2;
       print "Partial UVs selected";
    }   
     
    return $normalizeType;

    }

with partial uvs selected on multiple objects, the code should print “Partial UVs selected”

but instead it prints multiple objects selected and then Partial UVs right after. I dont understand why this condition would ring true if (`size $objSel` > 1 && $flattenListNum = $UVCount[0])

Can Someone help please?

Think you’re assigning value to $flattenListNum and not making a check. single = vs ==

$MyVar = 12;

if ( 1 == 1 && $MyVar = 21 ) {
    print $MyVar;
};
21
1 Like

ah silly me. that part works now. thanks robberyman