I have already did a dummy test and all the rest of my code works. The only thing that fails is calling bpy.ops.anim.keyframe_insert_menu(type = 'LocRotScale')
, which is what appears if you press I and doing it manually. The error I am getting is:
File "D:\Blender\2.79\scripts\modules\bpy\ops.py", line 189, in call ret = op_call(self.idname_py(), None, kw) TypeError: Converting py args to operator properties: enum "location" not found in ('Location', 'Rotation', 'Scaling', 'BUILTIN_KSI_LocRot', 'LocRotScale', 'BUILTIN_KSI_LocScale', 'BUILTIN_KSI_RotScale', 'BUILTIN_KSI_DeltaLocation', 'BUILTIN_KSI_DeltaRotation', 'BUILTIN_KSI_DeltaScal)
The idea of my script is simple, there are 8 coordinates in a list that I want to loop through and apply each coordinate to a cube.
Pseudo code would be:
- Frame_set the current frame on the timeline so starting frame would be at 0
- I would take the coordinate[i] in the list and apply it to the cube
- I would then key the location of the cube for animation
- update the current_frame by =+ 4 each time. S0 frame 0, 4, 8... would be the keyframes.
All other steps works, if I comment out step number 3 I would see my cube moving from 1 location to the other, I just need to know how to key each location for animation!
My code is below:
current_frame = 0
for i in range( 0, len( selected_loc ) ): # selcted_loc contains 8 xyz vectors
bpy.data.scenes["Scene"].frame_set( current_frame )
moving_object.location = selected_loc[i] #moving_object is just a cube
#bpy.ops.anim.keyframe_insert_menu(type = 'location') #line that fails
current_frame += 4