6
$\begingroup$

How can I set the F button for materials and textures to be always on, even when I create a new material?

I don't know Python and I don't have time to learn it, but I have found that there is a property use_fake_user that must be set True for materials.

The reason for asking is that I sometimes loose my unassigned materials when I play with multiple objects and multiple material nodes created on the fly.

$\endgroup$
5
$\begingroup$

You can use an app handler to set use_fake_user to True right before saving. The following addon does it for materials and textures:

bl_info = {
    "name": "Save unused Materials and Textures",
    "author": "CoDEmanX",
    "version": (1, 0, 0),
    "blender": (2, 63, 0),
    "location": "(none)",
    "description": "Enable fake user to rescue unused materials / textures automatically before saving",
    "warning": "Make sure this addon is enabled by default!",
    "category": "Material"}


import bpy
from bpy.app.handlers import persistent
from itertools import chain

@persistent
def enable_fakeuser(scene):
    for datablock in chain(bpy.data.materials, bpy.data.textures):
        datablock.use_fake_user = True


def register():
    bpy.app.handlers.save_pre.append(enable_fakeuser)


def unregister():
    bpy.app.handlers.save_pre.remove(enable_fakeuser)


if __name__ == "__main__":
    register()

Make sure this addon is really enabled (best make it enabled by default and do that whenever you update Blender).

$\endgroup$
  • 1
    $\begingroup$ Yes! I'd buy you a beer if you were in Bucharest :) $\endgroup$ – user3444 May 11 '14 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.