Maya 2020.1 and MLdeleteUnused issue with SurfaceShader1

Maya 2020.1 and MLdeleteUnused issue with SurfaceShader1

Craig_Lamorte
Advocate Advocate
2,237 Views
3 Replies
Message 1 of 4

Maya 2020.1 and MLdeleteUnused issue with SurfaceShader1

Craig_Lamorte
Advocate
Advocate

Hi,

 

I have discovered on when I run

mel.eval("MLdeleteUnused();")

in maya 2020.1 that this error is thrown

 

// Error: line 0: Non-deletable node 'standardSurface1' cannot be deleted. // 

And sometimes it will crash maya as well.  Looks like standSurface1 is a new default shader in maya.  Looks like it was never added to ignore that material during the MLdeleteUnused command.  Is this a bug or am i missing something?

 

0 Likes
2,238 Views
3 Replies
Replies (3)
Message 2 of 4

Craig_Lamorte
Advocate
Advocate

anyone have a resolution to this.  Can't seem to figure how to get around this, it breaks all of our tools that use the delete unused materials function.

0 Likes
Message 3 of 4

lanh.hong
Alumni
Alumni

Hi Craig.Lamorte,

 

This is a known bug in Maya 2020. There will be a fix in an upcoming update or release. 

 

In the meantime, the way to fix this is to add a few lines of code to the MLdeleteUnused.mel file to get a list of default materials and skip deleting them. I've attached the updated MLdeleteUnused.mel file here so you can just replace the old file with this one. The file can be found in C:\Program Files\Autodesk\Maya2020\scripts\others\ .

 

Regards,

Lanh


Lanh Hong
Developer Technical Services
Autodesk Developer Network



Message 4 of 4

seandunderdaleBAKA7
Enthusiast
Enthusiast

Did this get fixed? Im on Maya 2022.3 and am getting

// Error: line 0: Non-deletable node 'standardSurface1' cannot be deleted. Im trying to do "delete unused nodes" option in the hypershade

0 Likes