Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions AE still reading a commented-out expression

  • AE still reading a commented-out expression

    Posted by Joe Laude on July 14, 2009 at 7:22 pm

    This is bizarre. I’ve written an expression, and first I commented out a few lines, then tried to comment out the whole thing. However I try these comments, AE is parsing the expression and finding errors in the portions that are commented out. Strangely enough, when I leave everything uncommented, no error.

    Now before you think that I’ve just commented out some vital part of the expression and causing the error, I know it absolutely does not need the part I commented out. And it’s still doing this when I comment out the entire expression, either with “//” tags, or “/* … */” tags.

    Anyone else run into a situation where AE ignores these remark tags?

    Filip Vandueren replied 16 years, 10 months ago 4 Members · 16 Replies
  • 16 Replies
  • Dan Ebberts

    July 14, 2009 at 7:25 pm

    I’ve never seen that. Post the commented out expression and I’ll play around with it and see if I get the same results. What kind of error messages are you getting?

    Dan

  • Joe Laude

    July 14, 2009 at 7:55 pm

    The commented out version:

    /* p=comp(“Pre-comp 2”).layer(“MovingPlate”).transform.position;
    x=p[0]+transform.position[0];
    y=p[1]+transform.position[1];
    [x,y]; */

    Gives this error: “Undefined value used in expression. Could be an out of range array subscript? Expression disabled. Error occurred at line 0.”

    And commenting each line with “//” tags gives this error: “No matching closing brace found. Expression disabled. Error occurred at line 1.”

    Removing all comment tags gives no error at all, and the expression works.

    When I add “[p[0],p[1]];” after the first line, and comment out the last 3 lines with “//” tags, I also get the “No matching closing brace found” error, but then completely deleting those 3 lines, again, works fine.

    Does that make sense to you? The expressions work, so it’s not like I’m stuck. I’m just kind of baffled by this strange behavior.

  • Dan Ebberts

    July 14, 2009 at 8:07 pm

    I think it’s that if you have any text at all in the expression, AE expects the expression to evaluate to something valid for that property. So commenting out an entire expression won’t work. In your case, there has to be enough of the expression to evaluate to a valid position value.

    That’s my theory. 🙂

    Dan

  • Todd Kopriva

    July 14, 2009 at 8:51 pm

    Dan’s theory is an excellent one. I’m going to verify it now.

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    putting the ‘T’ back in ‘RTFM’ : After Effects Help on the Web
    ———————————————————————————————————

  • Filip Vandueren

    July 14, 2009 at 9:04 pm

    I concur, I think I’ve had the same problem once.
    Try adding “value;” at the end.

  • Todd Kopriva

    July 14, 2009 at 9:09 pm

    Yep. Dan is right.

    Rather than commenting out the expression, you should disable it with the button for this purpose.

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    putting the ‘T’ back in ‘RTFM’ : After Effects Help on the Web
    ———————————————————————————————————

  • Joe Laude

    July 14, 2009 at 9:48 pm

    It doesn’t seem like it should work that way, though. I was commenting out part of the script to make sure the other part was actually working properly without deleting it, not just to “turn off” the expression. I know about the button, I would have used that. It’s that it’s still reading what’s inside the comment tags, and furthermore, it’s reading errors where there are none.

    I guess it doesn’t totally defeat the purpose of the comment tags, since you can still write notes for yourself and others, but don’t people use this method all the time? Commenting-out lines of code in order to use portions without deleting the rest? Why doesn’t AE just ignore anything inside comment tags?

    Not a big deal, I’m just curious if maybe there’s a reason it is this way.

  • Todd Kopriva

    July 14, 2009 at 9:55 pm

    Oh, I thought that you were only having this problem when you were commenting out the entire expression.

    When you create an expression and enable it, you are stating that the value of the property is whatever the expression evaluates to. If you comment out the whole expression, then the expression evaluates to… well… nothing (an undefined value).

    If you only comment out a piece of the expression and don’t leave behind any code that evaluates to a value, then you’ll get a similar problem.

    Yes, people comment out code all the time, but you also have to expect that if you comment out code and don’t leave behind anything that functions (or, in the case of an expression, evaluates to a value), then you’re going to get an error.

    ———————————————————————————————————
    Todd Kopriva, Adobe Systems Incorporated
    putting the ‘T’ back in ‘RTFM’ : After Effects Help on the Web
    ———————————————————————————————————

  • Joe Laude

    July 14, 2009 at 11:10 pm

    Maybe I’m not be getting the problem across. If you follow what I was saying before, the code worked without the commented part. That’s what was weird. I wasn’t commenting out a vital portion–the expression worked perfectly with the commented out part completely deleted from the expression, so it worked.

    I was trying to leave that part to check that the first half of my expression was pulling the right values from the pre-comp. It was, but I had to actually cut the following portions of the expression to check, and then paste them back in, where a comment would have worked.

  • Dan Ebberts

    July 14, 2009 at 11:11 pm

    >It’s that it’s still reading what’s inside the comment tags, and furthermore, it’s reading errors where there are none.

    I’m still not conviced that’s what’s actually happening. I haven’t been able to generate the “No matching closing brace found” error. I think this is the expression you described as generating that error, but it works fine for me:

    p=comp(“Pre-comp 2”).layer(“MovingPlate”).transform.position;
    [p[0],p[1]];
    //x=p[0]+transform.position[0];
    //y=p[1]+transform.position[1];
    //[x,y];

    Dan

Page 1 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy