FORUMS: list search recent posts

# can you parent puppet pins to each other?

FAQ   •   VIEW ALL
 can you parent puppet pins to each other? on Dec 8, 2017 at 1:29:24 pm

Hi all,

I'm just wondering if it's possible to parent puppet warp pins (that are on the same mesh) to each other, so when one moves, the others move the same amount in relation to each other.

I am using a tracker to move a puppet pin by parenting the pin to a null object and then pasting the keyframes from the tracker to the null. But if I want several other puppet pins to move in relation to the parented pin, then I have to make nulls for each of them and then parent the new nulls to the null that's keyframed from the tracker. So I was thinking it would be simpler to just parent the pins to each other, but can't figure out how.

any puppet masters out there with any suggestions?

 Re: can you parent puppet pins to each other?on Dec 8, 2017 at 3:53:01 pm

I'm no puppet or expression wizard so maybe someone has an easier/more elegant way to do this, but I'd think if you figure the difference in distance between your parented pin and the other pins at the initial "rest" pose, you could add a simple expression to maintain that distance. So let's say Pin 1 is parented to your null and has a position of [800,300] and you want Pin 2 to maintain its position to A and it has a position of [700,200]. So 2 is 100 pixels away from 1 in both X and Y (just to keep the math easy).

Set an expression in the pin Position of 2. Set a variable for the X value and pickwhip to Pin 1's X value, resulting in something like
pupX=effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 1").position[0];

Do the same for Y:
pupY=effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 1").position[1];

Now you have your two variables, pupX and pupY that equal X and Y of Pin 1 and you know you want Pin 2 to always be 100 less than that, so a final line of
[pupX-100,pupY-100]
should maintain that distance no matter where Pin 1 goes.

---
It is easier to destroy than to create.
More fun, too.

 Re: can you parent puppet pins to each other?on Dec 8, 2017 at 7:29:17 pm

I'm certainly not a Master but I think you're on the right track. There's probably a way with expressions, but then what happens when you want to start & stop doing that in order to move the pins separately?

I happened across this just last night though:

http://www.mtmograph.com/motion/

Drag down to about min. 38:20 where he describes the Pin & Closing tool. If nothing else, it's a one-click solution to what you're already doing, but maybe it'll give you some ideas

 Re: can you parent puppet pins to each other?on Dec 9, 2017 at 2:52:36 pm

Doing it with an expression was the kind of thing I was thinking about, I just know absolutely zero about the code used in expressions - so I'm just starting to learn some of the basics.
But I recon, it should be possible to make that final line do the calculation of pin 2 X axis = pin 1 X axis value + (pin 1 X axis value minus pin 2 X axis value). And then do the same for the Y axis, so I don't have to get the calculator out at all.

I'll post up the result that works when I've had a good play with it and figured it out.

Another possibility, I've been trying, is to use the starch tool to stiffen up the area the pin effects (instead of using several pins and trying to link them with an expression) - but this is only works in some situations.

As for what to do if I want to have the pins move separately, further down the timeline - I haven't tried yet but I think the answer to that could be to split the layer at the point you want the change and then delete or change the expressions.

I had a quick look at that video you suggested, Mark, and it looks like another really good workaround to the problem and definitely a time saver worth investing in as it's relatively cheap.

 Re: can you parent puppet pins to each other?on Dec 9, 2017 at 4:05:26 pm

With expressions, you could then convert to keyframes then edit or delete those as needed. I understand expressions enough to work with them, but being mildly dyslexic isn't a good thing with something that's unforgiving where syntax is critical. Fortunately, learning how to use the quikwhip and the expression builder isn't too daunting.

Use of the Starch tool or even Hold keys perhaps if you go the null route would certainly be a good "see if that does it" approach.

I'm planning to snag Motion2 as well soon. Didn't know about it before as it's not listed on aescripts.com.

 Re: can you parent puppet pins to each other?on Dec 11, 2017 at 3:23:30 pm

No calculator required. Just a little pickwhipping. Okay, one tiny bit of calculator. Again, this will simply keep Pin 2 the same distance from Pin 1 no matter where Pin 1 goes. For this example, we'll make Pin 1 the pin you're animating and Pin 2 the pin that's following Pin 1.

At the start of your comp (or wherever the base "rest" pose is; before you've animated any pins), twirl down the Position property for both pins and calculate the difference in position in both X and Y. Simple addition/subtraction: if Pin 1 is [800,500] and Pin 2 is [700,700] your difference is -100X and +200Y. Then Opt/Alt=click the Position property for Pin 2 and type:
pupX=

Then pickwhip to the X parameter of Pin 1's Position property, which should give you something similar to this:
pupX=effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 1").position[0];

You'll need to add the semicolon to the end. This creates a variable called pupX and sets it to be equal to the X value of Pin 1's Position at every frame. Do the same with the Y position and a second variable:
pupY=effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 1").position[1];

You now have two variables, each matching the value of one parameter of Pin 1's Position. If you just set them as the position for Pin 2, Pin 2 would exactly match Pin 1 wherever it went:
[pupX,pupY]
this just says Pin 2 X position = pupX = Pin1 X position and Pin 2 Y position = pupY = Pin1 Y position

Now you just need to adjust those numbers by the difference you noted earlier:
[pupX-100, pupY+200]
this says the same thing but subtracts 100 from Pin 1's X value and adds 200 to Pin 1's Y value, then sets them as Pin 2's X and Y value

So, final code:
pupX=effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 1").position[0];
pupY=effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 1").position[1];
[pupX-100, pupY+200]

Sadly you can't just copy/paste this code as your layer names and value differences won't be the same. I wasn't aware you needed to move Pin 2 independently of Pin 1 at various times. I thought you just needed Pin 2 (3,4, etc.) to maintain relative difference to Pin 1 throughout its move. If you need variable on/off animation control, pretty sure that's possible but will take someone smarter than me.

---
It is easier to destroy than to create.
More fun, too.

 Re: can you parent puppet pins to each other?on Dec 12, 2017 at 3:02:07 pm

I have tried that code and it certainly works but I am now trying to streamline it by doing away with the calculating so that it is a faster method than assigning nulls to each pin. Unfortunately, I just don't know enough about how to code yet to make it work but what I figure is something like this:
pup1X=effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 1").position[0];
pup1Y=effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 1").position[1];
pup2X=effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 2").position[0];
pup2Y= effect("Puppet").arap.mesh("Mesh 1").deform("Puppet Pin 2").position[1];
pupRelativeX=Math(pup1X + (pup1X - pup2X);
pupRelativeY=Math(pup1Y + (pup1Y - pup2Y);
[pupRelativeX,pupRelativeY];

Where pup1X is puppet pin 1 X axis, pup2X is puppet pin 2 X axis - and similar for the Y axis.

Then I made up pupRelativeX - which should take the value of each axis of each pin and do the calculating and assign the output to pupRelativeX etc

And finally, it should give the pin coordinates relative to the first pin.

But it doesn't work and I'm just guessing looking at other coding as to what to write. Can't find any tutorials which explain how I'm supposed to arrange mathematical equations correctly.