I'm writing a script for scaling in the movie clip editor. I need a way to check if there are two trackers selected, or if there are not. Is there something in the API to check how many trackers are in the bundle?

  • $\begingroup$ Yes, there is a 'select' attribute. Iterate through the trackers and check if this is 'true' or 'false'. $\endgroup$ – p2or Nov 14 '15 at 0:42
import bpy

context = bpy.context

# choose from data
tracks = bpy.data.movieclips["clip_name"].tracking.objects

# choose from context
tracks = context.scene.active_clip.tracking.objects 

# selected camera tracks
selected_camera_tracks = [t for t in tracks['Camera'].tracks if t.select]

# selected object_tracks
selected_object_tracks = [t for t in tracks['Object'].tracks if t.select]

# toggle selected object tracks
for t in tracks['Object'].tracks:
    t.select = not t.select
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.