Skip to main content
contact@fabrice-agro.com
Known Participant
January 10, 2024
Answered

Effects d'un dans essentials graphique

  • January 10, 2024
  • 1 reply
  • 265 views

Bonsoir,

Connaissez vous un moyen de mettre tous les effects settings d'un layer vers essential graphique de manière automatique avec un script ?

Merci

This topic has been closed for replies.
Correct answer Airweb_AE

Add_Effects_to_EGP.jsx

 

 

(function (thisObj) {
    buildUI(thisObj);

    function buildUI(thisObj) {
        var palette = new Window("palette", "Add Effects to EGP", undefined, {
            resizeable: true
        });
        palette.orientation = "column";
        palette.alignChildren = ["center", "top"];
        palette.spacing = 10;
        palette.margins = 10;

        var button1 = palette.add("button");
        button1.text = "ADD FX TO EGP";

        palette.show();

        button1.onClick = function () {
            var proj = app.project;
            var thisComp = proj.activeItem;
            if (thisComp.selectedLayers.length) {
                var selectedLayer = thisComp.selectedLayers[0];
                app.beginUndoGroup("egp");
                 addPropstoEGP(selectedLayer, thisComp);
                app.endUndoGroup();
            } else {
                alert('select a layer')
            }
        }

        function addPropstoEGP(layer, thisComp) {
            thisComp.openInEssentialGraphics();
            app.executeCommand(2012);
            for (var i = 1; i <= layer.Effects.numProperties; i++) {
                var canAddProp = layer.effect(i).property(1).canAddToMotionGraphicsTemplate(thisComp);
                if (canAddProp) {
                    layer.effect(i).property(1).addToMotionGraphicsTemplateAs(thisComp, layer.effect(i).name);
                }
            }
            thisComp.motionGraphicsTemplateName = thisComp.name;
        }

    }
})(this);

 

 

 

1 reply

Airweb_AECorrect answer
Legend
January 11, 2024

Add_Effects_to_EGP.jsx

 

 

(function (thisObj) {
    buildUI(thisObj);

    function buildUI(thisObj) {
        var palette = new Window("palette", "Add Effects to EGP", undefined, {
            resizeable: true
        });
        palette.orientation = "column";
        palette.alignChildren = ["center", "top"];
        palette.spacing = 10;
        palette.margins = 10;

        var button1 = palette.add("button");
        button1.text = "ADD FX TO EGP";

        palette.show();

        button1.onClick = function () {
            var proj = app.project;
            var thisComp = proj.activeItem;
            if (thisComp.selectedLayers.length) {
                var selectedLayer = thisComp.selectedLayers[0];
                app.beginUndoGroup("egp");
                 addPropstoEGP(selectedLayer, thisComp);
                app.endUndoGroup();
            } else {
                alert('select a layer')
            }
        }

        function addPropstoEGP(layer, thisComp) {
            thisComp.openInEssentialGraphics();
            app.executeCommand(2012);
            for (var i = 1; i <= layer.Effects.numProperties; i++) {
                var canAddProp = layer.effect(i).property(1).canAddToMotionGraphicsTemplate(thisComp);
                if (canAddProp) {
                    layer.effect(i).property(1).addToMotionGraphicsTemplateAs(thisComp, layer.effect(i).name);
                }
            }
            thisComp.motionGraphicsTemplateName = thisComp.name;
        }

    }
})(this);

 

 

 

contact@fabrice-agro.com
Known Participant
January 11, 2024

GENIAL ! MERCI BEAUCOUP ! Ca va me faciliter la vie sur une projet, merci Airweb