2
$\begingroup$

I am trying to get proxy timecodes rendered for the blender nle via the python API. However once I call bpy.ops.clip.rebuild_proxy() or bpy.ops.sequencer.rebuild_proxy() instantly get the error RuntimeError: Operator bpy.ops.clip.rebuild_proxy.poll() failed, context is incorrect I have tried tracking down the function in C but I cannot find anything that helps point towards the root cause, or how to properly call rebuild_proxy()

$\endgroup$
1

1 Answer 1

1
$\begingroup$

So it sounds like the problem is that the wrong part of the interface ('Area') is active at the moment you're calling ops.clip.rebuild_proxy() or sequencer.rebuild_proxy().

I'm working on an add-on that will allow me to add a movie strip, draw waveforms, and start a 50% proxy build all with a single action. I found that I had to iterate through the areas and override the context to rebuild proxy for a specific clip. Here's what worked for me:

ctx = bpy.context.copy()
for area in bpy.context.screen.areas:
    if area.type == 'CLIP_EDITOR':
        ctx['area'] = area
        bpy.ops.clip.rebuild_proxy()
$\endgroup$
4
  • 2
    $\begingroup$ Did you not have to pass the ctx to the operator? bpy.ops.clip.rebuild_proxy(ctx) $\endgroup$
    – satishgoda
    Commented Jul 21, 2017 at 23:04
  • $\begingroup$ No according to docs: docs.blender.org/api/blender_python_api_current/… $\endgroup$
    – antono
    Commented Oct 12, 2017 at 20:58
  • 2
    $\begingroup$ The docs only document the name-based parameters. If you want the operator to use that context object ctx, you have to pass it as first parameter. Having a copy of the context laying around in memory somewhere is not enough. $\endgroup$
    – dr. Sybren
    Commented Jan 13, 2018 at 12:15
  • $\begingroup$ Worked for me exactly as posted. $\endgroup$
    – MitchellTR
    Commented Jan 15, 2018 at 21:02

You must log in to answer this question.

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