From: "TIM THIESSEN" Received: from resqmta-po-11v.sys.comcast.net ([96.114.154.170] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 6446597 for ae-list@media-motion.tv; Sun, 06 May 2018 23:41:03 +0200 Received: from resomta-po-09v.sys.comcast.net ([96.114.154.233]) by resqmta-po-11v.sys.comcast.net with ESMTP id FQn8fUSO9JA8JFRUwfJT7z; Sun, 06 May 2018 21:47:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20161114; t=1525643234; bh=m1tv1Ki1lId6gK+kmvJMutHVuOy5pdkiazPCj4xN/tY=; h=Received:Received:Date:From:Reply-To:To:Message-ID:Subject: MIME-Version:Content-Type; b=ZbQrz9AWPDT/k8xAsynu8rJC20NcBVChf4/4+S/grIE0BX2D2X1Gi8c1MtjroWO5h yrc1cMPO/MveZKnubuhug50nuz+EZ46woxxk8DgWutmOkdhUBwmZeqxIw2H0GmgG9h NRwoPZGB3D7/5tu0+82A8VFuCfGC7lQoJh2sUe4tiXnvW1gFiozAy/Q5CufxRvtu// 0UKRsINcURMXXmpSYjvh4VNiPVLNmn5nisZ0EfnKVbD+YG9TwyBmMszUfrv/wCgkEv dzXVyzBYXkwHXRD2O6NbKk1UdkEsEt8BghYgLYBUVbPqy1BKyLUt6LZUiKBTH64hHx mph6OJDqD/WNg== Received: from oxapp-hoc-48o.email.comcast.net ([96.118.241.125]) by resomta-po-09v.sys.comcast.net with ESMTPS id FRUwfwP23WV5jFRUwfTHNe; Sun, 06 May 2018 21:47:14 +0000 Date: Sun, 6 May 2018 14:47:13 -0700 (PDT) Reply-To: TIM THIESSEN To: After Effects Mail List Message-ID: <73036567.1092511.1525643234171@connect.xfinity.com> In-Reply-To: References: Subject: Re: [AE] scripting help - applying a preset only once MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1092510_1995106756.1525643234160" X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.4-Rev12 X-Originating-IP: ::ffff:24.21.84.163 X-Originating-Client: open-xchange-appsuite X-CMAE-Envelope: MS4wfFkQxPHTz9cwIh1Jichi5mx5HLpi5VccRNaIyOZqzJebTNqJIRcEbkWSIrFl+rJdn3YOAADeT1tnB2LH0t83D3/w5d19lOjkD2BZBdiAZdVXbL4kq59K 3myYpSoyrudl+mGYu/gP9/By5oDdYubMlZLRopL8mFlGTf2Kb/j7SynM3a75x8Cy8ljnaFSmLMrL82epro/wDuKsIBCMiJEzfVk= ------=_Part_1092510_1995106756.1525643234160 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ah that makes more sense thanks > On May 6, 2018 at 2:35 PM Lloyd Alvarez wrote: > > That was meant to say "not something you can check for" > > On Sun, May 6, 2018 at 5:32 PM Lloyd Alvarez wrote: > > > > Hi Tim > > > > The preset is but something you can check for. You need to check for what the preset applies whether is keyframes or expressions you would check if that exists. > > > > Lloyd > > > > On Sun, May 6, 2018 at 5:16 PM TIM THIESSEN wrote: > > > > > > > > > > Ok I have a script that applies an expression to a single property (position for example) and a preset to that layer - I only want to have that preset applied once and only once - because no matter how many times the preset to the layer the expressions are only going to look at the first one. I'm using the try-catch method to check that the effect is applied and if it that throws an error it will apply the preset. And for the most part it works great, the one time it breaks is if you have several properties selected - it applies the same amount of presets as selected properties. Ever other instance of using this script works - and since it is applying the expression to the position property it shouldn't matter if you have the properties selected or not. I'm not even checking if you do have any properties selected. The snippet of code is: > > > > > > > > > if(BOUNCrType == "Position"){ > > > if(positionFFX.exists == 0){ //this check to see if the preset exists > > > positionFFX = getFFXfile("BOUNCr_position.ffx", "(BOUNCr_assets)", BOUNCr_position_ffx); > > > } > > > for (var i = 0; i < numSelected; i++){ > > > try{ > > > selLayers[i].property("Effects").property("BOUNCr_Position").value != null; //I tried the == 1 but AE kept throwing an error > > > }catch(err){ > > > selLayers[i].applyPreset(positionFFX); //this applies the preset to the layer if and only if it doesn't exist > > > } > > > if(selLayers[i].property("Transform").property("Position").dimensionsSeparated){ > > > selLayers[i].property("Transform").property("X Position").expression = posExpress; > > > selLayers[i].property("Transform").property("Y Position").expression = posExpress; > > > if(selLayers[i].threeDLayer){ > > > selLayers[i].property("Transform").property("Z Position").expression = posExpress; > > > } > > > }else{ > > > selLayers[i].property("Transform").property("Position").expression = posExpress; > > > } > > > } > > > } > > > > > > > > > sorry for the formatting the funny thing this more for almost every instance, it just fails when you have multiple properties selected it instantly adds multiple instances of the preset. I'm trying to think of a solution, like checking to see if properties are selected and then deselecting them (I don't know if that is possible - maybe throwing an alert is going to be the only solution) Any thoughts - this one is got me pickled, I wish there was an .exists properties for effects. > > > > > > > > > Thanks, > > > > > > Tim T > > > > > > > > -- > > Cheers, Lloyd > > > > > -- > Cheers, Lloyd > ------=_Part_1092510_1995106756.1525643234160 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

ah that makes more sense


thanks

On May 6, 2018 at 2:35 PM Lloyd Alvarez <AE-List@media-motion.tv> = wrote:

That was meant to say "not something you can ch= eck for"

<= div>On Sun, May 6, 2018 at 5:32 PM Lloyd Alvarez <AE-List@media-motion.tv> wrote:
Hi Tim

The preset is but something you can check for. You need to ch= eck for what the preset applies whether is keyframes or expressions you wou= ld check if that exists. 

Lloyd

On Sun,= May 6, 2018 at 5:16 PM TIM THIESSEN <AE-List@media-motio= n.tv> wrote:

Ok= I have a script that applies an expression to a single property (position = for example) and a preset to that layer - I only want to have that preset a= pplied once and only once - because no matter how many times the preset to = the layer the expressions are only going to look at the first one. I'm = using the try-catch method to check that the effect is applied and if it th= at throws an error it will apply the preset. And for the most part it works= great, the one time it breaks is if you have several properties selected -= it applies the same amount of presets as selected properties. Ever ot= her instance of using this script works - and since it is applying the expr= ession to the position property it shouldn't matter if you have the pro= perties selected or not. I'm not even checking if you do have any prope= rties selected. The snippet of code is:


if(BOUNCrType =3D=3D "Position"){
if(positionFFX.= exists =3D=3D 0){ //this check to see = if the preset exists
positionFFX =3D getFFXfile("BOUNCr_posi= tion.ffx", "(BOUNCr_assets)", BOUNCr_position_ffx);
}
f= or (var i =3D 0; i < numSelected; i++){
try{
selLayers[i].prope= rty("Effects").property("BOUNCr_Position").value !=3D null;= //I tried the =3D=3D 1 but AE kept throwin= g an error
}catch(err){
selLayers[i].applyPreset(positionFFX= ); //this applies the preset to the layer i= f and only if it doesn't exist
}
if(selLayers[i].propert= y("Transform").property("Position").dimensionsSeparated){ selLayers[i].property("Transform").property("X Position"= ).expression =3D posExpress;
selLayers[i].property("Transform")= .property("Y Position").expression =3D posExpress;
if(selLayers= [i].threeDLayer){
selLayers[i].property("Transform").property(&= #34;Z Position").expression =3D posExpress;
}
}else{
selLay= ers[i].property("Transform").property("Position").expressio= n =3D posExpress;
}
}
}


sorry for the formatting the funny thing this more for almost ev= ery instance, it just fails when you have multiple properties selected it i= nstantly adds multiple instances of the preset. I'm trying to think of = a solution, like checking to see if properties are selected and then desele= cting them (I don't know if that is possible - maybe throwing an alert = is going to be the only solution) Any thoughts - this one is got me pickled= , I wish there was an .exists properties for effects.


Thanks,

Tim T

<= /blockquote>
--
Cheers, Lloyd
--
<= div dir=3D"ltr" class=3D"ox-5617f0bfae-gmail_signature">Cheers, Lloyd= =20 ------=_Part_1092510_1995106756.1525643234160--