I'm trying to get a python based audio visualisation script to work in blender via command line interface. Here's the code myscript.py
When I run the following in blender 2.66 on Ubuntu 14.04
blender -b -noaudio -P myscript.py
I get the following error
File "/home/random9/myscript.py", line 66, in <module>
bpy.ops.anim.keyframe_insert_menu(type='Scaling')
File "/usr/share/blender/2.79/scripts/modules/bpy/ops.py", line 189, in __call__
ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.anim.keyframe_insert_menu.poll() failed,
context is incorrect
in [line number 66]
bpy.ops.anim.keyframe_insert_menu(type='Scaling')
How do I resolve this error?
I've been going through the python scripting docs and it suggests that I should be able to figure out what context an operator needs simply by seeing how it’s used in Blender and thinking about what it does.
Any help is appreciated.
context.object.keyframe_insert("scale", group="Scale")– batFINGER Oct 16 '17 at 10:56context.object.keyframe_insert("scale", group="Scale")– batFINGER Apr 23 '19 at 08:33bpy.ops.anim.keyframe_insert_menu(type='BUILTIN_KSI_VisualLocRotScale')withobj.keyframe_insert('location', group='Location'); obj.keyframe_insert('scale', group='Scale'); obj.keyframe_insert('rotation_quaternion', group='Rotation'), and everything works fine! – robit Apr 24 '19 at 02:10