Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions getting fromComp positional info for a null control in a nested comp of a different resolution.

  • getting fromComp positional info for a null control in a nested comp of a different resolution.

    Posted by Benjamin Graham on September 20, 2010 at 2:50 pm

    Okay so here’s my situation. I’ve set up Ik on a character using duiks super awesome script. I set up Ik manually too using Dans expression (awesome site btw) but I’ve found duiks script simpler to use and setup. I’m nesting the character comp into a world comp which contains my scene and another character and any other things I need. I want to be able to have a bunch of nulls to animate with that match and drive the nulls in the character precomp. I’ve managed to connect things between the comps but the nulls in my world comp don’t line up because the world comp is a different resolution to the character scene. This is non negotiable as we will be doing the world comp at various arbitrary sizes. I need the character to work however the world scene is set up. But of course nulls (and everything else) works in comp space so I used fromComp which works better but is still out of alignment.

    Can anyone offer any advice on setting this up as I’m stumped. I come from a maya character setup background and honestly that made a whole lot more sense to me.

    Thanks in advance.

    Benjamin Graham replied 15 years, 10 months ago 2 Members · 13 Replies
  • 13 Replies
  • Chris Wright

    September 21, 2010 at 8:37 pm

    I’m a little confused what you are trying to do but to put the null into worldspace is this.

    L = thisComp.layer(“Null 1”);
    L.toWorld(L.anchorPoint)

    https://technicolorsoftware.hostzi.com/

  • Benjamin Graham

    September 23, 2010 at 1:19 pm

    Hi. This does exactly what I asked thanks. But the problems continue. I’m not even sure how to describe this but suffice to say puppet tools is tricky when it comes to scaling of any sort.

  • Chris Wright

    September 23, 2010 at 8:40 pm

    without a screen shot, I’m totally lost. Perhaps you are looking for a scaler that compares the comp size to the nulls and will rescale the null’s world value according to the width and height of the comp constantly changing. That could be either a simply .width and .height
    or could end up being a tricky transform such as comparing the length of the anchorpoint of the comp to the nulls. It all depends on me reading your mind, lol.

    C = thisComp.layer(“Null 1”);
    d = length(toWorld(anchorPoint),C.toWorld([0,0,0]));

    https://technicolorsoftware.hostzi.com/

  • Benjamin Graham

    September 27, 2010 at 12:44 pm

    Hi. Thanks so much for the advice. I’ll try and give a more detailed description of things. I spent most of Thursday fighting with this and am coming to the conclusion that it isn’t possible but if you still would like to apply your mind to it I’m including a script that might help describe the problem better.

    https://www.mediafire.com/file/ma79dih776pymvi/scale_test_anim.aep

    Sorry about the dodgy animation, and it’s a really simple little test scene because of obvious NDA issues. I promise the characters we’re working on are far better looking than this rather plain triangle.

    Basically what should be happening is that the geometry scales up but because of the way puppet tools works it simply stretches the geometry. But if you make the char comp a child of the master control you end up with double transformations.

    I even hooked up the position of the controls rather than the anchor point after zeroing those controls out in both comps then I hooked up the control solids to the character solids and deactivated the expressions on the character solids. I then unparented them in the control comp and scaled up the master control. The control solids followed and then I froze them again. And switched the “polarity” of the expressions so that the control comp was in charge again. This kind of works but as you move the controls it becomes obvious that it’s not a perfect 1 to 1 relationship. For failry obvious if tricky to explain reasons.

    Does this explain it better? If you have time to spare to look at this I’d really appreciate it. There’s a debate as to whether we should be looking at toonboom which seems really cool but doesn’t seem to offer anything I can’t do in AE with a little bit of ingenuity. The one swing vote would be something like puppet tools. For character work it really is great, and it’s just this scaling issue thats holding me back.

    Benjamin.

  • Chris Wright

    September 27, 2010 at 10:12 pm

    ok, I figured it out, the anchorpoints you use have to be a little outside the actual shape or exactly right on it so that the scale will work correctly. If you don’t put the anchorpoints just outside/on the shape, the first 1% (2 frames) of the scale animation will look exponential. Look at my example animation to see what I mean. But the 99% rest works perfect.

    slider = effect(“Slider Control”)(“Slider”);
    first = comp(“controlComp”).layer(“Right_corner_CTRL”);
    l=first.toWorld(first.anchorPoint);
    second = comp(“controlComp”).layer(“Left_corner_CTRL”);
    s=second.toWorld(second.anchorPoint);

    v = length(l,s);

    [slider-v,slider-v]

    ae cs4 aep.
    https://www.megaupload.com/?d=D5SQK333

    https://technicolorsoftware.hostzi.com/

  • Chris Wright

    September 28, 2010 at 1:17 am

    oops, I don’t think that works. What I think you want is scaling the precomp’s anchorpoint but still having the corner controls line up precisely?

    https://technicolorsoftware.hostzi.com/

  • Benjamin Graham

    September 28, 2010 at 8:55 am

    Hi Chris.

    Yup just opened your file and yeah I’m afraid I think we missed each other. I’m not great at explaining these sorts of things but yes what should happen is the precomp should scale up as the master control is scaled and the triangle should fit exactly to it’s control points without losing volume, if the controls are merely stretched apart that loss of volume is correct and to be expected but when you scale the master control it should scale up the precomp to match the new positions of the control points. Like I said earlier, its actually pretty hard to explain.

  • Chris Wright

    September 29, 2010 at 6:29 am

    I was afraid to mess up my project because it’s late and i’m tired but I’m 99% sure this works, so my code isn’t streamlined, or plug’n play.

    I got the 500 from the half size of my 1000×1000 test comp and the 600 by a temporary look at the worldsize put in corner position
    s=thisComp.layer(“characterComp”).transform.scale
    toWorld(s)

    here’s the position code of the corners that each have completely customizable anchorpoints so you can put them anywhere and they still scale correctly. You can later streamline the code by replacing 500=half the comp size and 600=worldsize of scale.

    an = thisComp.layer(“check”).transform.anchorPoint;
    b = thisComp.layer(“characterComp”).transform.scale;
    c = thisComp.layer(“characterComp”).transform.scale[0];
    x = toWorld(b);
    t1=linear(c,0,100,500+an[0],600);
    t2=linear(c,0,100,500+an[1],600);
    [t1,t2];

    here’s my test aep project that has a ram preview
    ae cs3 aep
    https://www.mediafire.com/?66mkxmn1e1pdcs5

    https://technicolorsoftware.hostzi.com/

  • Chris Wright

    September 29, 2010 at 7:12 pm

    Ok, this will now automatically work in any composition size. Apparently 600:100 is a ratio that works for all comp to world sizes, interesting…

    Btw, I need to know if you need this in a script form, because, obviously, if you are moving the control points, around, they can’t be controlled by the same code. I’ll ask Dan or repost this question.
    The best thing I can think of is use your input position as my input anchorpoint. I’ll see what I can come up with.

    cw = thisComp.width /2
    ch = thisComp.height/2

    an = thisComp.layer(“check”).transform.anchorPoint;
    b = thisComp.layer(“characterComp”).transform.scale;
    c = thisComp.layer(“characterComp”).transform.scale[0];

    x=toWorld(b);

    t1=linear(c,0,100,cw+an[0],600);
    t2=linear(c,0,100,ch+an[1],600);
    [t1,t2];

    https://technicolorsoftware.hostzi.com/

  • Chris Wright

    September 29, 2010 at 7:50 pm

    also, if you put this in the anchorpoints, then if you change the final comp’s size, all the points will stay exactly in the same place.

    an = thisComp.layer(“check”).transform.anchorPoint;
    cw = thisComp.width /2;
    ch = thisComp.height/2;

    [an[0]-cw, an[1]-ch];

    https://technicolorsoftware.hostzi.com/

Page 1 of 2

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