M-Cleaner

preview_01_670x335

Blender add-on for automatically finding and removing duplicates of materials from the scene.
When you add objects from previously saved blend-files, external libraries, various asset- and kitbash- sets to the scene, your scene filled with a large number of identical materials. With dozens of them in complex scenes. “M-Cleaner” finds the equal materials in the scene and removes duplicates, reassigning the single unique material to the objects.

Add-on web page

For more information please visit

Add-on functionality:

  • Just press the “Clear materials” button
  • M-Cleaner will automatically clear your scene of duplicates
  • If the “Remove unused” checkbox is on, duplicates will be removed from the scene immediately. If this checkbox is off, duplicates will remain in the scene with 0 users and will be deleted using regular Blender tools during the scene saving.

Demonstration video:

Current add-on version:
1.3.2.

Location and call:

“3D Viewport” window – N-panel – the “M-Cleaner” tab

Blender versions:
2.8x, 2.9x

preview_02_670x335

4 Likes

Updated to v.1.1.0.

  • Added “Merge by name” function (destructive !)

I tried “Clear Materials” and I get an error:

"AttributeError: ‘NoneType’ object has no attribute ‘nodes’

This happens in both 2.81 and 2.82. I think it’s file specific but I’m not entirely sure where the problem may lie. I’ve even deleted everything but one mesh out of the file and it still throws the same error.

Maybe the error is because this mesh is linked to the scene from another blend-file. I will fix add-on to skip such meshes.
Can you attach a blend-file that cause a problem?

I got similar error too due to Curves Nodes in my materials ;
“AttributeError: ‘CurveMap’ object has no attribute ‘extend’”
I replaced them by Color Ramps and it finally worked.

I forgot to mention that, also, the Dot Strokes material with the Grease Pencil prevent from clearing the materials.
DotStrokes
If you delete it it’ll works.

Are these Greese Pencil materials?

No, those were normal materials.

Can you attach a problem file? I will try to find a bug.

Here I uploaded a scene with these materials I had troubles.
I might say, my fault, I was using M-Cleaner 1.1.0… I installed the last version and all is good, no bugs!
Anyway, here it is for your curiosity :blush:
M-CLeaner_BuggedNodes.blend (910.8 KB)

1.1.0 problems
Curve nodes (RGB Curves) - material
Dots Stroke - material
BezierCurve - object

Thank you for the file! With it, I found and fixed another problem with CurveMapping nodes. I updated the add-on to v.1.3.1. Please download the last version.

I’ve been desperately needing something like this.
Does this take care of the JPG’s and PNG’s (Roughness, Normal, Specular, etc.) that also get duplicated and renamed with a .000 suffix, when appending a new material?

Thanks.

No, It can’t be guarantee equivalent because two images with the same name can have different content.

1 Like

Oh! Neat! I won’t miss any updates therefore! XD

Updated to v. 1.3.2.

  • Fixed bug with node groups without node trees
1 Like