Compositor backdrop?

Okay, I’ll keep it simple.

What is ‘the best way’ of activating the backdrop function in the compositor with a python script?



The best way I know:

for area in bpy.context.screen.areas:
    if area.type == 'NODE_EDITOR':
        for space in area.spaces:
            if space.type == 'NODE_EDITOR':
                space.show_backdrop = True

hmm, I’ve seen a similar way of doing it like this:

import bpy

for area in bpy.context.screen.areas:
    if area.type == 'DOPESHEET_EDITOR':
        space_data =
    space_data = None

if space_data is not None:

found here by CoDEmanX:

But, the solution that you and he suggested only works if the space I wanna reach is opened on your screen somewhere. I actually found a better solution recently, which is this:

area = bpy.context.area
old_area = area.type
area.type = 'NODE_EDITOR'
space_data =
space_data.show_backdrop = True
area.type = old_area

found here also by CoDEmanX:

Had no idea you could set the active area that easy. This does work well, but can you access a certain space (like the node editor) without actually changing the space in blender? Because that would be even better than this. And, I wonder, how come you can access other functions in the node editor without actually being in that space but not the backdrop function?

Thanks for your reply anyways! :slight_smile:

I would think because of the different data paths. Since the backdrop is part of the space, that space would have to exist somewhere. I’m just assuming though.

Agree, thought so too, anyone know?