This may be a two-fold question, but I think I got an answer on the first:
In order to keep the strain of running an "detect updates" function, as low as possible, I would like to make it as streamlined as possible. But there doesn't seem to be an equivalent to ex. "bpy.data.movieclips.is_updated" (for the motion tracker clip) for the sequencer?https://docs.blender.org/api/blender_python_api_2_76_0/bpy.types.BlendData.html
So I guess the only way is to compare the currently active strip's data with the data of a previous active strip, on scene updates, but how do I do that?
import bpy
from bpy.app.handlers import persistent
global oldStrip
oldStrip = bpy.context.scene.sequence_editor.active_strip
@persistent
def sequencer_update(context):
#if bpy.data.movieclips.is_updated: # Updates on tracker file updates. No sequencer .is_updated function?
activeStrip = bpy.context.scene.sequence_editor.active_strip
print("Active strip: "+str(activeStrip.name))
""" # if oldStrip != activeStrip: #
if oldStrip.name = activeStrip.name:
if oldStrip.frame_final_start == activeStrip.frame_final_start and oldStrip.frame_final_end == activeStrip.frame_final_end: print("Strip not moved, maybe a rename or other property changes?")
if oldStrip.frame_final_start != activeStrip.frame_final_start and oldStrip.frame_final_end != activeStrip.frame_final_end: print("Entire strip moved")
if oldStrip.frame_final_start != activeStrip.frame_final_start and oldStrip.frame_final_end == activeStrip.frame_final_end: print("Start handle moved")
if oldStrip.frame_final_start == activeStrip.frame_final_start and oldStrip.frame_final_end != activeStrip.frame_final_end: print("End handle moved")
oldStrip=activeStrip
else:
print("New strip selected") """
oldStrip=activeStrip
#Register
def register():
handlers = bpy.app.handlers.scene_update_pre
for handler in handlers:
if ("sequencer_update" in str(handler)):
handlers.remove(handler)
handlers.append(sequencer_update)
def unregister():
handlers = bpy.app.handlers.scene_update_pre
for handler in handlers:
if ("sequencer_update" in str(handler)):
handlers.remove(handler)
#Unregister operators
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()
#unregister()