Skip to main content
Participant
March 21, 2019
Answered

Shortcut to remove all filters in Animate

  • March 21, 2019
  • 1 reply
  • 1087 views

I'm trying to speed up my workflow in adobe animate. One common task that I need to perform often (while converting old flash files into html5) is removing all filters from the properties of an object. My current method is to scrub through the timeline looking for an object with a drop shadow, blur, or other filter. I click on the object. I go to the properties window. I click the drop-down arrow under filters, and I select the "remove all" option. This wouldn't be too bad if I had to do it once or twice, but I need to perform this action dozens and dozens of times everyday. I need to build some kind shortcut to make this process faster. It would be nice if I could reduce my number of mouse clicks. It would be even better if I could batch this process somehow. I checked the keyboard shortcuts menu, but I don't see anything about removing filters. Please help me speed up this repetitive task.

This topic has been closed for replies.
Correct answer ClayUUID

Thanks for pointing me in the right direction. I never worked in jsfl before today, but I can tell it will be worthwhile for me to invest some time into this sort of scripting. Bear with me here please... Would it be something like... fl.getDocumentDOM().removeAllFilters() to remove all the filters from a currently selected item? I'm not sure how I would go about finding any elements with filters. Would you please point me towards some sample jsfl files that perform similar tasks?


Not extensively tested, but this seems to work. Copy and paste everything below into a text file with a .jsfl extension. Then just double-click to run against your currently loaded FLA, or copy into Animate's commands folder to make accessible from the Commands menu.

// Remove all filters

// globals

var _dom = fl.getDocumentDOM();

var _totalFixes = 0;

var _whiteList = "movie clip,graphic,button";

// script entry point

function main() {

    scanLibrary();

    scanTimeline(_dom.getTimeline());

    fl.trace("Filters removed: " + _totalFixes);

}

// scan every symbol in the library

scanLibrary = function() {

    var i, item;

    var domItems = _dom.library.items;

    for (i = 0; i < domItems.length; i++) {

        item = domItems;

        if (_whiteList.indexOf(item.itemType) !== -1) {

            scanTimeline(item.timeline);

        }

    }

}

// scan every symbol in a timeline

scanTimeline = function(timeline) {

    var layer, frames, element, member;

    var layerSet, frameSet, elementSet, memberSet;

    layerSet = timeline.layers;

    for (layer in layerSet) {

        frameSet = layerSet[layer].frames;

        for (frame in frameSet) {

            elementSet = frameSet[frame].elements;

            for (element in elementSet) {

                changeSomething(elementSet[element]);

                memberSet = elementSet[element].members;

                if (memberSet != undefined) {

                    for (member in memberSet) {

                        changeSomething(memberSet[member]);

                    }

                }

            }

        }

    }

}

// do something to a symbol

changeSomething = function(item) {

    if (item.filters) {

        _totalFixes++;

        item.filters = [];

    }

}

// run script

main();

1 reply

kglad
Community Expert
Community Expert
March 21, 2019

you can use jsfl to automate the task so you'd need 0 mouse clicks.

Participant
March 21, 2019

That's kind of vague. would you care to elaborate?

kglad
Community Expert
Community Expert
March 21, 2019

loop through all the timelines>layers>frames>elements to find elements with filters and then assign them all an empty filters array.  or just assign every non-shape an empty filters array.