import bpy
from bpy.app.handlers import persistent
@persistent
def oldStrip(scene):
oldStrip = bpy.context.scene.sequence_editor.active_strip
oldStrip(bpy.context.scene.sequence_editor.active_strip)
def sequencer_update(context):
#if bpy.data.movieclips.is_updated: # Updates on tracker file updates, but no sequencer .is_updated function?
# alternative but how to use a global in blenderoldStrip
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")
bpy.context.scene.frame_set(sequence.frame_final_start) # move time cursor
if oldStrip.frame_final_start == activeStrip.frame_final_start and oldStrip.frame_final_end != activeStrip.frame_final_end:
print("End handle moved")
bpy.context.scene.frame_set(sequence.frame_final_start)# move time cursor
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()