Copy link to clipboard
Copied
hey guys
When I applyPreset() through script code, add a priest to the text layer several times
var csInterface = new CSInterface();
csInterface.evalScript('test()');
function test() {
var textLayer = app.project.activeItem.selectedLayers[0];
var myMarker = new MarkerValue("In", "");
textLayer.Marker.setValueAtTime(1, myMarker)
textLayer.applyPreset(new File("C:\\Users\\I Do It\\AppData\\Roaming\\Adobe\\CEP\\extensions\\MyExtension\\In\\Fade Blur with Scale.ffx"));
var myMarkers = new MarkerValue("Out", "");
textLayer.Marker.setValueAtTime(2, myMarkers)
textLayer.applyPreset(new File("C:\\Users\\I Do It\\AppData\\Roaming\\Adobe\\CEP\\extensions\\MyExtension\\Out\\Fade Blur with Scale.ffx"));
}
this Pic
Why Two Out FFX Created !!!
Whats my Problem ?????
Tnx
1 Correct answer
I had to get a little bit fancy to solve this bizarre problem. Essentially what I added, is a variable that represents how many effects there should be. Every time you run this bit of code, you know there should be 2 additional effects applied. So I made a function to remove any of the extra effects! Let me know if you have any questions, but I tested this with your .ffx files and it works like a charm! (Don't forget to change the File locations)
var textLayer = app.project.activeItem.selectedLa
...
Copy link to clipboard
Copied
There is no problem. You are applying the preset twice, are you not? You seem to be under the mistaken impression that presets have an intrinsic temporal logic beyond the keyframes they were saved with, which isn't the case. You simply cannot apply the same preset twice and hope it will respond to your in- and out-point code. If you need such functionality, you have to create it inside the script to produce additional keyframes once the presets have been applied. You need to brush up on how presets actually work.
Mylenium
Copy link to clipboard
Copied
Tnx for your reply
Me Added 2 preset in code but applying 3 preset ! onec IN Twice Out !
And if Once Again Repeat This Code , We Have This Result !!!
whats the Problem ?
Copy link to clipboard
Copied
I think the first reply misunderstands the question and is being a bit passive aggressive.
There are two possible problems I see that could be happening here. Either
1) One of the presets you are applying has 2 effects built into it
2) There is some code somewhere else in your extension that is causing this to happen
Your code suggests you are writing an extension, but your screenshot a script. Perhaps there is some more extension code that is causing this?
Copy link to clipboard
Copied
Tnx My Bro
Yes It is A Big Extension But We Have Problem Whit presetApply() Now And For Show This Problem Only Need To Run Up Code in Script Editor AE And Run !
Download My FFX From This Link
Tnx For Attention
Copy link to clipboard
Copied
Hmmm this is a really strange error. I tried applying multiple ffx of my own and can't get the same problem. It seems that when you only apply 1 of the IN or OUT presets, it only applies one instance of the effect. But if you apply two in any order, it will always apply a duplicate to the second. It's beyond me why it is doing this, but there are plenty of workarounds for it that will add minimal time to the processing speed of your extension.
After you've applied both presets, you can simply run this line of code to remove the duplicate effect.
textLayer.effect("Visual Text Animator_OUT 2").remove();
Copy link to clipboard
Copied
Thanks for your expert response my Bro
However, there has to be a better solution
Due to the code you have submitted, our work in the image below becomes even harder whit very preset !
What do you think is the next solution?
Copy link to clipboard
Copied
I had to get a little bit fancy to solve this bizarre problem. Essentially what I added, is a variable that represents how many effects there should be. Every time you run this bit of code, you know there should be 2 additional effects applied. So I made a function to remove any of the extra effects! Let me know if you have any questions, but I tested this with your .ffx files and it works like a charm! (Don't forget to change the File locations)
var textLayer = app.project.activeItem.selectedLayers[0];
var requiredEffects = textLayer.Effects.numProperties+2;
// how many effects we know there should be
var myMarker = new MarkerValue("In", "");
textLayer.Marker.setValueAtTime(1, myMarker)
textLayer.applyPreset(File("G:/Downloads/MyExtension/MyExtension/In/Fade Blur with Scale.ffx"));
var myMarkers = new MarkerValue("Out", "");
textLayer.Marker.setValueAtTime(2, myMarkers)
textLayer.applyPreset(File("G:/Downloads/MyExtension/MyExtension/Out/Fade Blur with Scale.ffx"));
removeExtraEffects(textLayer, requiredEffects);
function removeExtraEffects(layer, numEffects) {
for(var i = layer.Effects.numProperties; i > numEffects; i--) {
layer.effect(i).remove();
}
}
Copy link to clipboard
Copied
Tnx my bro for your little bit fancy 🙂
There must be a right solution to this strange problem
I thank you for the trick you have solved
Tnx A lot
Copy link to clipboard
Copied
the applyPreset() seems to apply ( number of selected layers ) of time.
you need to unselect all layers , and reselect the layer that you want to apply the preset to before the applyPreset() line.
Copy link to clipboard
Copied
DAN gave a solution to this annoying behaviour 10 years ago.

