TRACKING / PYTHON QUEST? Add markers in clip editor and putting in path information

Using operators I can add multiple markers and change frames. I can’t put in the position for that marker in the next frame. (CODE ENCLOSED)

I am writing a translator/import to use the marker track data from another application and then have Blender do all the solving. Any suggestions or pointers would be greatly appreciated.

As Blenderguru says Things Blender Users Say “I don’t know what I am doing”

import bpy

bpy.context.area.type = ‘CLIP_EDITOR’

bpy.ops.clip.change_frame(frame=1)
bpy.ops.clip.add_marker_move(CLIP_OT_add_marker={“location”:(.5, .5)}, TRANSFORM_OT_translate={“value”:(0, 0, 0)})
bpy.ops.clip.change_frame(frame=2)
***ERROR***bpy.ops.clip.add_marker_move(TRANSFORM_OT_translate={“value”:(.5, 0, 0)})
bpy.ops.clip.change_frame(frame=1)

bpy.ops.clip.add_marker_move(CLIP_OT_add_marker={“location”:(.25, .25)}, TRANSFORM_OT_translate={“value”:(0, 0, 0)})

works fine here:

import bpy

bpy.context.area.type = 'CLIP_EDITOR'




bpy.ops.clip.change_frame(frame=1)
bpy.ops.clip.add_marker_move(CLIP_OT_add_marker={"location":(.5, .5)}, TRANSFORM_OT_translate={"value":(0, 0, 0)})
bpy.ops.clip.change_frame(frame=2)
bpy.ops.clip.add_marker_move(TRANSFORM_OT_translate={"value":(.5, 0, 0)})
bpy.ops.clip.change_frame(frame=1)


bpy.ops.clip.add_marker_move(CLIP_OT_add_marker={"location":(.25, .25)}, TRANSFORM_OT_translate={"value":(0, 0, 0)})

Note that the clip editor needs to have the movieclip set!

bpy.context.space_data.clip = bpy.data.movieclips[0] # taking the first clip

You can avoid operators and it’s less hassle with low-level api though:

clip = bpy.data.movieclips[0]

mt1 = clip.tracking.tracks.new("MotionTrack1", frame=123) # New motion track adds a single marker as well, ...
mt1.markers[0].co = (12, 34) # ... thus we can access this marker (markers[0]) instantly.

mt2 = clip.tracking.tracks.new("MotionTrack2", frame=45)
mt2.markers[0].co = (65, 43)

Dunno why you can add extra markers to a motion track, 'cause if you click “Add marker and move” in Blender, it creates additional motion tracks with ONE marker each… Anyway, here’s the code line to add more markers:

markers.insert_frame(frame, co=(x, y)) 

Thanks for your help this is exactly what I need. I am trying to use Voodoo and Icarus to image track and Blender to solve. Blender does the best job solving and Voodoo/Icarus does best job image tracking.

I got an error with my attempt.

import bpy

bpy.context.area.type = ‘CLIP_EDITOR’

bpy.context.space_data.clip = bpy.data.movieclips[0]

clip = bpy.data.movieclips[0]
mt1 = clip.tracking.tracks.new(“MotionTrack1”, frame=1)
mt1.markers[0]=(234,344)
mt1.markers[0].insert_frame(2,co=(234,345))

Error bpy_prop_collection has no object new

import bpy

bpy.context.area.type = ‘CLIP_EDITOR’

clip = bpy.data.movieclips[0]

mt1 = clip.tracking.tracks.new(“MotionTrack1”, frame=123)
mt1.markers.insert_frame(1,co=(.5,.5))
mt1.markers.insert_frame(2,co=(.51,.5))
mt1.markers.insert_frame(3,co=(.52,.5))
mt1.markers.insert_frame(4,co=(.53,.5))
mt1.markers.insert_frame(5,co=(.54,.5))
mt1.markers.insert_frame(6,co=(.55,.5))