0

Trying to interpolate using bpy.ops.gpencil.interpolate() and bpy.ops.gpencil.interpolate_sequence() which need a context override so I tried this code:

import bpy
from bpy import context

for window in context.window_manager.windows: screen = window.screen for area in screen.areas: if area.type == 'VIEW_3D': with context.temp_override(window=window, area=area): bpy.ops.gpencil.interpolate_sequence() break

Results in a crash. Maybe it's not possible to do interpolation this way?

Harry McKenzie
  • 10,995
  • 8
  • 23
  • 51
  • Hello and welcome. see this link for more information on how to use context properly https://blender.stackexchange.com/questions/6101/poll-failed-context-incorrect-example-bpy-ops-view3d-background-image-add/270716#270716 – Harry McKenzie Dec 17 '22 at 06:33
  • Thanks! I couldn't get the override to work, so a workaround is to run the code as an addon, then I don't need to override the context. – ungivenNed Dec 21 '22 at 08:39

0 Answers0