How to assign a Fake User to a material with Python?

Hi again

I would like to now how to make a material persist even when it is not linked to any objects. In the UI it is done by pressing the ‘F’ button next to the material name, thereby creating a ‘Fake User’. How can I accomplish the same thing using Blender Python?

Thanks in advance!

This is new, ideasman added this a few days ago, so you would need CVS, grab it from here if you don’t want to compile yourself

import Blender as B

mat = B.Material.Get ("Material")

mat.fakeUser = 1 # True
#mat.fakeUser = 0 # False

# This is the way you find out stuff
print dir (mat)
print type (mat.fakeUser)

Cool! He seems to be adding just the things I need at the moment I need them! I just got the December build in order to get the .copy() function, that Ideasman told me about in another thread, but I will get the newer one now.
Thanks a lot!