I had to import many FBX files (exported from 3d max) and save them as a blender files and just now realized that all the files also imported custom properties for every objects material.

enter image description here

I could delete it manually but since its a ton of files with tons of materials i'd prefer to do this by script. However I can't seem to get it to work.

I checked the python code for the custom property and was hoping I could remove it with this line:

bpy.ops.wm.properties_remove(data_path="material", property="�L��")

But that sadly didn't work. It doesn't understand the "property". I would like the script to be able to run thru all materials in the scene and then delete this (or if possible ANY) custom property for each material.


1 Answer 1


You can delete all custom properties on all the materials in the file with this snippet :

import bpy

for mat in bpy.data.materials:  # Iterate over all materials
    props = [*mat.keys()]  # Retrieve custom props names
    for prop in props:
        del mat[prop]

Note * is the iterator unpacking operator.

  • $\begingroup$ Fantastic, this works like a charm, thank you. But what is the difference with props in mat.keys and wm.properties? Do they access different custom properties? $\endgroup$ Commented Feb 8, 2022 at 1:30
  • 1
    $\begingroup$ bpy.ops.wm.properties_remove is an operator. Long story short, this is a construct that is supposed to be used only in the UI when clicking on a button, it is very high level and has a lot of shortcomings, for example it forces a UI redraw everytime it is called. So you really should be using lower-level API whenever you can. mat.keys lets you directly get all the custom properties names in a sweep. You can access custom properties with mat["prop"] for instance like it was a python dictionary $\endgroup$
    – Gorgious
    Commented Feb 8, 2022 at 6:20
  • $\begingroup$ Thank you for the explanation :) $\endgroup$ Commented Feb 13, 2022 at 23:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .