0
$\begingroup$

If I try to invoke the bpy.ops.outliner.liboverride_troubleshoot_operation(...) from a script I get an improper context error, although I've set_select(True) the armature that is linked.

I'm wondering if that is because troubleshoot is trying to verify that it is being invoked from the outliner, making it impossible to call from a script?

I am trying to call this from a script, because I have a linked armature that always has misplaced bones when the blend file is loaded, making it impossible to render from command line without the re-sync.

$\endgroup$

1 Answer 1

0
$\begingroup$

I submitted a bug report and was given the following code that works:

import bpy
from bpy import context

for window in bpy.context.window_manager.windows:
    screen = window.screen

    for area in screen.areas:
        if area.type == 'OUTLINER':
            with context.temp_override(window=window, area=area):
                bpy.ops.outliner.liboverride_troubleshoot_operation( type='OVERRIDE_LIBRARY_RESYNC_HIERARCHY', selection_set='SELECTED')
            break;
$\endgroup$

You must log in to answer this question.

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