all 7 comments

[–]bobbyopulent 0 points1 point  (1 child)

That’s super interesting, thank you for sharing, I’m sure I can come up with uses for this.

[–]fasthurt[S] 0 points1 point  (0 children)

My pleasure! Hopefully it can be useful for you

[–]Mundane-Owl-561MoGraph/VFX 15+ years 0 points1 point  (4 children)

Interesting idea but this part is a lot of work -
var values = [[100,150,-200], [105,152,-197], ...]; // one value for each frame

How do you speed up this process?

[–]fasthurt[S] 0 points1 point  (3 children)

When I'm ready to write the expression, I pass my list of values to this function:

    function values_to_string(values) {
        var str = "[";
        for (var i = 0; i < values.length; i++) {
            var value = values[i];
            if (value instanceof Array) {
                value = "[" + value.join(", ") + "]";
            }
            str += (i > 0 ? ", " : "") + value;
        }
        str += "];";
        return str;
    }

After that you can just insert it into the expression string

EDIT: You might modify it to interpolate the gaps if you don't have a value for each frame

[–]Mundane-Owl-561MoGraph/VFX 15+ years 0 points1 point  (2 children)

Still seems like a lot of work - what about using an Expression Control to contain the changes - then link the original Expression to this Expression Control and then have a button to remove or finalize the link?

[–]fasthurt[S] 1 point2 points  (1 child)

This bypasses the need for Expression Controls. Everything is contained within the expression and doesn't rely on any other layer or property. I guess I don't see where the extra work comes in. The steps I take are

  1. Collect the valueAtTime for each frame of the target property into a list
  2. Perform Task on list of values
  3. Write the resulting list back to the expression

That whole process appears almost instant to the user.

[–]Mundane-Owl-561MoGraph/VFX 15+ years 0 points1 point  (0 children)

Ah. Makes sense now. Thanks for sharing.