I'm trying to use id_remap on some materials, but Blender crashes when I try to use the operator. I've tried many different ways to invoke it. Right now I have:

area = bpy.context.area

old_type = area.type

area.type = 'OUTLINER'

bpy.ops.outliner.id_remap(id_type='MATERIAL', old_id='material_2', new_id='material_SM_2')

area.type = old_type

What's the correct way to use this operator?

Thank you!

  • $\begingroup$ Do you get any error message before Blender crashes? If so, what is it? And if not, copy the path of your Blender directory (where blender.exe is located), open a command prompt (type cmd in the search bar), then type "cd " (without the quotation marks) and paste the path, then hit enter. Finally type blender.exe and hit enter. Now the command prompt will stay open and you can see the error message after the crash. This method works on Windows. $\endgroup$
    – palkonimo
    Jan 14, 2019 at 20:16

1 Answer 1


The following should work with Blender 2.7x.

import bpy

def AssembleOverride(atype, rtype):
    for oWindow in bpy.context.window_manager.windows:
        oScreen = oWindow.screen
        for oArea in oScreen.areas:
            if oArea.type == atype:
                for oRegion in oArea.regions:
                    if oRegion.type == rtype:
                        oContextOverride = {
                                'window': oWindow,
                                'screen': oScreen,
                                'area': oArea,
                                'region': oRegion,
                                'scene': bpy.context.scene,
                                'edit_object': bpy.context.edit_object,
                                'active_object': bpy.context.active_object,
                                'selected_objects': bpy.context.selected_objects
                        print("-AssembleOverride() created override context: ", oContextOverride)
                        return oContextOverride
    raise Exception("ERROR: AssembleOverride()")
atype = 'OUTLINER'
rtype = 'WINDOW'

override = AssembleOverride(atype, rtype)
# old_id and  new_id must be pre-existing or operator will fail

You must log in to answer this question.

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