[Macro] Add marker to the start of each selected clip.

Discussion about: tracktion.com
Post Reply New Topic
RELATED
PRODUCTS

Post

Who knew you could insert clips that are markers!
Even though no arguments pop up for this function. (maybe it is a bug)
I tried changing the clip to marker and to my surprise it works!

Code: Select all

var clip = Tracktion.insertClip ('midi');//doesn't show arguments when right-clicking the midi string
var clip = Tracktion.insertClip ('marker');//change it to marker!
Here is the macro for adding markers to the start of each clip!, maybe I can add the feature where if the clip has a color, it will place a colored marker?

Code: Select all

addMarkerToClipStart ();
function addMarkerToClipStart (){//clips
    /**
        Name:Add Marker To The Clip's Start
        Description:The current selected clips get a marker at each beginning.
        Author:Andrew Cheung
        Version:V1
    **/
    //Tip: Don't Select None Without keeping a focusable object or there will be a freeze state.
    var curPos = Tracktion.getPosition ('cursor');
    var markInPos = Tracktion.getPosition ('markIn');
    var markOutPos = Tracktion.getPosition ('markOut');
    var curClips = Tracktion.getSelectedEditElements ('clip');
    //insert code here
    for (i = 0; i < curClips.length; i++){
        Tracktion.selectItem ('none');        
        Tracktion.addObjectsToSelection (curClips[i]);
        Tracktion.markAroundSelected();//get current selected
        Tracktion.jumpToMarkIn();
        Tracktion.insertClip ('marker');  
    }

    //code end
    Tracktion.selectItem ('none');
    Tracktion.addObjectsToSelection (curClips);//if you select some stuff and haven't deleted any clips use this to default
    Tracktion.setPosition ('cursor', curPos);
    Tracktion.setPosition ('markIn', markInPos);
    Tracktion.setPosition ('markOut', markOutPos);
}
For code that slaps markers at the end of clips see here
https://github.com/OSBooter/Tracktion-W ... tionscript

Post Reply

Return to “Tracktion”