Snippet/starter function

Issue #24 resolved
Rune Gangsø created an issue

I notice that when I write short snippets that it often starts with something like this:

var comp = aeq.getActiveComp()
if ( comp === null ) {
    return alert( 'No Comp selected' )
}

var layers = comp.selectedLayers
if ( !layers.length ) {
    var applyToAll = confirm( 'No layers selected, apply to all?', false )
    if ( applyToAll ) {
        layers = aeq.getLayers( comp )
    } else {
        return
    }
}

aeq.undoGroup( 'Undo Group Name', main, [ layers ] )

I think it would be nice to have a function that does all that for you. Something like:

aeq.snippet.selectedOrAllLayers( 'Undo Group Name', function( layers ) {} )

I'm wondering if that is a good solution for it, or if there something else that can be done?

Comments (2)

  1. Log in to comment