Is there a way to know if an object has any faces with no material?

Is there a way to know if an object has any faces with no material?

Craig_Lamorte
Advocate Advocate
759 Views
1 Reply
Message 1 of 2

Is there a way to know if an object has any faces with no material?

Craig_Lamorte
Advocate
Advocate

Hi,

 

I am looking for any command or anyway in python script that I can figure out if any faces on a mesh have no material attached.  I'm talking about when maya displays green because nothing, not even lambert1 is assigned to that face.  I wrote a script that can check if an entire mesh has no material attached, that was easy, but that will not catch if a material is assigned to any faces of that mesh, and others do not have any materials assigned.

 

Thanks

0 Likes
760 Views
1 Reply
Reply (1)
Message 2 of 2

trs_andre
Collaborator
Collaborator

Hi

 

After selecting all the faces, maybe something like this? (Sorry it is in MEL, you can convert it to Python though)

 

//After selecting the faces

string $materialList[];
string $faceList[];
$faceList = `ls -fl -sl`;

select -cl;

for($face in $faceList) {
    select $face;
    hyperShade -smn "";
    $materialList = `ls -sl`;
    if(!strcmp($materialList[0],""))
        print($face + ": There is no material in this face\n");
}

 

André Moreira

Game Developer / Technical Artist

LinkedIn