Cannot get ops to work for graph editor.

Hello,

You’ll need to talk to me like a baby, as I’m brand-new to Python and relatively new to coding.

I’m trying to control the graph editor from Python script.

I see in Blender, at the top of the screen, in the area that reports my code, something like this: bpy.ops.graph.select_all_toggle(invert=False) and other such things. But when I type these codes exactly into the Python editor, I get context errors. For instance:

>>>bpy.ops.graph.copy()
Traceback (most recent call last):
File “<blender_console>”, line 1, in <module>
File “/Applications/Blender/blender.app/Contents/MacOS/2.64/scripts/modules/bpy/ops.py”, line 188, in call
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.graph.copy.poll() failed, context is incorrect

In fact, a whole page of things I am supposed to be able to do to control the graph editor give the same error.

http://www.blender.org/documentation/blender_python_api_2_66_4/bpy.ops.graph.html

On the other hand, when I run something like “>>> bpy.ops.object.delete()”, that ops works perfectly.

One page I ran across says I have to “register” my ops, but I don’t know what that means or how to do it. Will this solve the problem?

Thank you so much for sharing your help and your expertise!

  • ianalexh

Cool - thanks!

Too bad we have to switch over to the Graph Editor for Blender to understand it… this might be something I’ll pass on to the developers…

Anyway, it works for now, so thanks a bunch!

  • ianalexh

this is due to the fundamental design concept of blender, nothing the will be fixed. You either need to change area.type or use an override. In this case, i would recommend the override.