I'm trying to piece together a script that will take a selected list of grease pencil objects and convert them to curves, one frame at a time. I'm calling upon the operator to convert the Grease Pencil object, but it's giving me a call back error.
import bpy
##LOOP AND OFFSET THROUGH OBJECTS
# Get the current frame number
frame = bpy.context.scene.frame_current
start_frame = bpy.context.scene.frame_start
# Loop through all selected objects
for obj in bpy.context.selected_objects:
# Move forward one frame
bpy.context.scene.frame_set(frame + 0)
#Convert Grease Pencil to Curve
bpy.ops.gpencil.convert(type='CURVE', timing_mode='LINEAR', use_timing_data=False)
# Set the object's render visibility property false
obj.hide_render = True
# Insert a keyframe on the render visibility property
obj.keyframe_insert(data_path="hide_render", frame=frame -1 )
# Set the object's render visibility property false
obj.hide_render = False
# Insert a keyframe on the render visibility property
obj.keyframe_insert(data_path="hide_render", frame=frame + 0)
# Set the object's render visibility property false
obj.hide_render = True
# Insert a keyframe on the render visibility property
obj.keyframe_insert(data_path="hide_render", frame=frame + 1)
# Increment the current frame number
frame += 1