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()
Asked
Active
Viewed 206 times
2
Asher
- 121
- 1
-
1related: http://blender.stackexchange.com/questions/6101/poll-failed-context-incorrect-example-bpy-ops-view3d-background-image-add – p2or Oct 07 '16 at 22:57
1 Answers
1
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()
MitchellTR
- 11
- 2
-
2Did you not have to pass the ctx to the operator? bpy.ops.clip.rebuild_proxy(ctx) – satishgoda Jul 21 '17 at 23:04
-
No according to docs: https://docs.blender.org/api/blender_python_api_current/bpy.ops.sequencer.html#bpy.ops.sequencer.rebuild_proxy – antono Oct 12 '17 at 20:58
-
2The 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. – dr. Sybren Jan 13 '18 at 12:15 -