[CTRL]+S to also save external textures

If I edit textures (in blender cycles) with texture paint and use [ctrl]+s, the default beaviour is that Blender does NOT save the works done at all; which is pretty counter intuitive.

The closest thing I found to the thing I want is the reply to this:

but the addon script doesn’t work to me… any solution?

are your textures created inside blender? (not initially loaded from the harddrive)

If so the script will fail to work, because blender doesn’t know where to save the file nor with which format or name…
you can change the script from CoDEmanX to fix this:

import bpy

fileext='.png'
filepath=bpy.data.filepath.rsplit('/',1)[0] + '/' # for linux and mac
#filepath=bpy.data.filepath.rsplit('\\', 1)[0] + '\\' #for windows

def save_external_images(dummy):
    for img in bpy.data.images:
        if img.source=='FILE':
            img.save()
        elif img.source=='GENERATED':
            img.filepath=filepath + img.name + fileext
            img.save()


Ok, thanks… seems to work now.

In case of google-landing people I’ll put the working add-on script here, I had to make very slight changes (filepath variable gave error), but it did worked for me now.

bl_info = {
    "name": "Auto-save external images",
    "author": "CoDEmanX , Secrop",
    "version": (1, 1),
    "blender": (2, 67, 0),
    "location": "",
    "description": "Save image datablocks on saving .blend",
    "warning": "Works on external images only!",
    "wiki_url": "",
    "category": "System"}


import bpy


def save_images_external(dummy):
    fileext='.png'
    #filepath=bpy.data.filepath.rsplit('\\', 1)[0] + '\\' #for windows
    filepath=bpy.data.filepath.rsplit('/',1)[0] + '/' # for linux and mac
    for img in bpy.data.images:
        if img.source=='FILE':
            img.save()
        elif img.source=='GENERATED':
            img.filepath=filepath + img.name + fileext
            img.save()

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


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


if __name__ == "__main__":
    register()


Hopefully will come handy to others too.

Well… looks like it did worked for me only once: probably I’ve just messed my blender configuration by now.

In the end I’ve settled with a different approach:
in preference > input: I’ve removed the binding key for [ctrl]+s
and then made two new binding keys with [ctrl]+s in the section [Screen] > [Screen Global]

image.save_dirty
image.save_mainfile

Now, pressing [ctrl]+s result into save the blend file and all the images.