tracker data

I can get the active tracker like this:

 bpy.data.movieclips.['clipname'].tracking.tracks.active

or

bpy.data.movieclips['clip_name'].tracking.tracks["track"].select_anchor = True

Is it possible to get its position?

Or set its position and then keyframe it?

From the docs:

template_marker(data, property, clip_user, track, compact=False)Item. A widget to control single marker settings.
[TABLE=“class: docutils field-list”]
[TR=“class: field-odd field”]
[TH=“class: field-name, bgcolor: #EEDDEE, align: left”]Parameters:[/TH]

  • data (AnyType, (never None)) – Data from which to take property
  • property (string, (never None)) – Identifier of property in data
  • compact (boolean, (optional)) – Use more compact layout

[/TR]
[/TABLE]

This is what displays the widget in the panel with the heading: ‘Marker’

But how do you set these values from Python?

:confused:Looks like that thread is adding new markers… is that what you really wanted?

I’m just getting into some serious python so I treated this as a learning experience and spent a couple hours trying figure out how to move a selected marker at the current frame… (yeah, it took me that long… no worries, I picked up alot of useful info along the way :yes:)

anyway, just in case, here’s what I came up with:

import bpy

curframe = bpy.context.scene.frame_current

###################################################
#  if you are making addon for the clip editor,   #
#  you can use top and comment out bottom         #
###################################################
#clip = bpy.context.space_data.clip              # will not work in text editor
clip = bpy.data.movieclips['P1010123.MP4']       # use your clip name here
###################################################

size = clip.size
marker =clip.tracking.tracks.active.markers
for m in marker:
    if (m.frame == curframe):
        break

print ("frame %d  selected marker location x: %6.3f (pixel %6.3f)" % (curframe, m.co[0], m.co[0] * size[0]))
print ("frame %d  selected marker location y: %6.3f (pixel %6.3f)" % (curframe, m.co[1], m.co[1] * size[1]))

moveto_x = 1050 # new x location in pixels
moveto_y = 700  # new y location in pixels

m.co.__setitem__(0, moveto_x / size[0])
m.co.__setitem__(1, moveto_y / size[1])

print ("frame %d  selected marker new location x: %6.3f (pixel %6.3f)" % (curframe, m.co[0], m.co[0] * size[0]))
print ("frame %d  selected marker new location y: %6.3f (pixel %6.3f)" % (curframe, m.co[1], m.co[1] * size[1]))