I’ve been trying to set up a scene for motion tracking using a python script from command line.
My code involves simple.blend file, which is a pre-saved blank scene with default motion tracking workspace, and setup.py script. I run this from the cli as: blender simple.blend --python setup.py
The sequence is successfully loaded and then I need to link this sequence to MovieClip and prepare clip editor for tracking. But in UI I still see nothing has changed (I can only see in dropdown menu imported jpeg sequence)
My code (setup.py) to setup MovieClip for motion tracking:
bpy.ops.clip.open(directory=...) # load a sequence file
for area in bpy.context.screen.areas:
if area.type == 'CLIP_EDITOR':
override = bpy.context.copy()
override['space_data'] = area.spaces.active
override['region'] = area.regions[-1]
override['area'] = area
override['space_data'].clip = bpy.data.movieclips[0]
bpy.ops.clip.view_all(override, fit_view=True)
break
After that script when I print out a value of space_data.clip
I get a correct value of movieclips[0]
(jpeg sequence imported after startup). Could someone please point out to me what I’m doing wrong ?