Search found 320 matches

by Dan Ebberts
November 6th, 2011, 12:11 pm
Forum: Scripts Discussion
Topic: looking for all keyframes
Replies: 4
Views: 9891

Re: looking for all keyframes

>... it's just a matter of traversing through the layer's properties (and properties of properties), looking for numKeys ...

That's pretty much it. Keep in mind that you won't be able to access the data for any property that has "custom" data.

Dan
by Dan Ebberts
November 3rd, 2011, 8:04 pm
Forum: Expression Discussion
Topic: Car Wheels Moving Backwards
Replies: 3
Views: 10449

Re: Car Wheels Moving Backwards

Just add a minus sign in front of the expression to get it to rotate the other way:

-thisComp.layer("Bug Control End").transform.position[0]


Dan
by Dan Ebberts
November 3rd, 2011, 6:26 am
Forum: Expressions Tutorials
Topic: Use sampleImage() to create a color picker
Replies: 8
Views: 106924

Re: Use sampleImage() to create a color picker

I think that would be like this (not tested):

target = thisComp.layer("Color_gradient");
target.sampleImage(target.fromWorld(toWorld(anchorPoint)), [0.5,0.5], true, time)


Dan
by Dan Ebberts
October 31st, 2011, 8:21 pm
Forum: Script requests
Topic: All Solos off
Replies: 9
Views: 17602

Re: All Solos off

Like this: // turn off solo on all layers { var myComp; app.beginUndoGroup("Turn Off All Solos"); for (var i = 1; i <= app.project.numItems; i++){ if (app.project.item(i) instanceof CompItem){ myComp = app.project.item(i); for (var j = 1; j <= myComp.numLayers; j++){ if (myComp.layer(j).so...
by Dan Ebberts
October 31st, 2011, 1:12 pm
Forum: Script requests
Topic: All Solos off
Replies: 9
Views: 17602

Re: All Solos off

Ah yes, good catch. Try this version: // turn off solo on all layers { var myComp; for (var i = 1; i <= app.project.numItems; i++){ if (app.project.item(i) instanceof CompItem){ myComp = app.project.item(i); for (var j = 1; j <= myComp.numLayers; j++){ if (myComp.layer(j).solo) myComp.layer(j).solo ...
by Dan Ebberts
October 31st, 2011, 11:50 am
Forum: Script requests
Topic: All Solos off
Replies: 9
Views: 17602

Re: All Solos off

This should do it: // turn off solo on all layers { var myComp; for (var i = 1; i <= app.project.numItems; i++){ if (app.project.item(i) instanceof CompItem){ myComp = app.project.item(i); for (var j = 1; j <= myComp.numLayers; j++){ myComp.layer(j).solo = false; } } } } Dan
by Dan Ebberts
October 24th, 2011, 10:04 am
Forum: Expressions Library
Topic: Current Comp to Text Layer Source
Replies: 5
Views: 30063

Re: Current Comp to Text Layer Source

If I were doing it, I would restrict the slider values to legal layer indices like this: firstLayer = Math.min(Math.max(Math.round(effect("First Layer")("Slider")),1),thisComp.numLayers); lastLayer = Math.min(Math.max(Math.round(effect("Last Layer")("Slider"))...
by Dan Ebberts
October 20th, 2011, 9:54 am
Forum: Expressions Library
Topic: Current Comp to Text Layer Source
Replies: 5
Views: 30063

Re: Current Comp to Text Layer Source

I don't understand the first part of your question. If you have multiple layers active at the same time, the one at the top of the layer stack is the one that will be visible. Don't you want the info for that one? To restrict the range you just need to change: for (i = 1; i <= thisComp.numLayers; i+...
by Dan Ebberts
October 19th, 2011, 2:36 pm
Forum: Expression Discussion
Topic: including external text file in an expression
Replies: 6
Views: 19618

Re: including external text file in an expression

If I understand what you're asking, you just need to separate the text lines in your file with backslash+r, like this:

"Text Line 1\rText Line 2\rText Line 3"


Dan
by Dan Ebberts
October 19th, 2011, 1:21 pm
Forum: Expression Discussion
Topic: including external text file in an expression
Replies: 6
Views: 19618

Re: including external text file in an expression

Try it this way:

$.evalFile("/c/Expressions/text.txt");

I tried it with a text.txt file containing this:

"test"

and it seems to work fine.


Dan
by Dan Ebberts
August 23rd, 2011, 11:31 am
Forum: Expression Discussion
Topic: Can I check if a layer has an effect?
Replies: 2
Views: 10019

Re: Can I check if a layer has an effect?

Here's an example that should count the layers with the checkbox:

Code: Select all

n = 0;
for (i = 1; i <= thisComp.numLayers; i++){
  if (i == index) continue; // skip myself
  try{
    thisComp.layer(i).effect("isObject")("Checkbox");
  }catch (e){
    continue;
  }
  n++;
}
n
Dan
by Dan Ebberts
August 15th, 2011, 9:46 pm
Forum: Scripts Discussion
Topic: Check OS system?
Replies: 2
Views: 7243

Re: Check OS system?

Something like this should work:

var isWindows = $.os.indexOf("Windows") != -1;

Dan
by Dan Ebberts
August 4th, 2011, 9:11 am
Forum: Scripts Discussion
Topic: Option (Alt) replace method
Replies: 2
Views: 7805

Re: Option (Alt) replace method

I think you're going to have to do it the long way. That is, get the usedIn array for the comp you want to replace, and for each comp in that array, go through all the layers looking for layers whose source is the comp to be replaced--then do a replaceSource() , pointing those layers to the new comp...
by Dan Ebberts
July 17th, 2011, 5:06 pm
Forum: Expression Discussion
Topic: Pseudo object 'awareness' expression
Replies: 2
Views: 9404

Re: Pseudo object 'awareness' expression

Try this with all the layers but the left-most. It assumes the left-to-right order of the layers corresponds to a top-to-bottom order in the layer stack. If the left-most layer isn't Layer 1, you'll need to edit the first line. Also, it won't work right if the anchor points aren't centered on x. fir...
by Dan Ebberts
May 9th, 2011, 12:47 pm
Forum: Expression Discussion
Topic: global random number / duration?
Replies: 1
Views: 7726

Re: global random number / duration?

Put your random duration calculation in a Slider Control and have all your other expressions reference that.


Dan