Skip to main content
deleted 32 characters in body
Source Link
tintwotin
  • 2.5k
  • 10
  • 24
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()
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 blender
        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")    
    
#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()
import bpy 
from bpy.app.handlers import persistent

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? 
    
        global oldStrip
        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()
Code updated to reflect the suggestion
Source Link
tintwotin
  • 2.5k
  • 10
  • 24
import bpy 
from bpy.app.handlers import persistent

global@persistent
def oldStrip(scene):
    oldStrip = bpy.context.scene.sequence_editor.active_strip
    
@persistentoldStrip(bpy.context.scene.sequence_editor.active_strip)    
 
def sequencer_update(context):
    #if bpy.data.movieclips.is_updated: # Updates on tracker file updates., Nobut no sequencer .is_updated function? 
    
        # alternative but how to use a global in blender
        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") 
    
         oldStrip=activeStrip        bpy.context.scene.frame_set(sequence.frame_final_start)# move time cursor                        
            else:
        print("New strip selected") """    
   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()

#unregisterunregister()
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()
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 blender
        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")    
    
#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()
deleted 43 characters in body
Source Link
tintwotin
  • 2.5k
  • 10
  • 24

This may be a two-fold question, but I think I got an answer on the first part, which then leads to the second part:

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?

This may be a two-fold question, but I think I got an answer on the first part, which then leads to the second part:

So I guess the only way is to compare the currently active strip's data with the data of a previous active strip, but how do I do that?

This may be a two-fold question, but I think I got an answer on the first:

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?

deleted 2 characters in body
Source Link
tintwotin
  • 2.5k
  • 10
  • 24
Loading
deleted 2 characters in body
Source Link
tintwotin
  • 2.5k
  • 10
  • 24
Loading
Source Link
tintwotin
  • 2.5k
  • 10
  • 24
Loading