Create Puppet Pin on existing mesh via scripting
Copy link to clipboard
Copied
Does anyone know how to create a puppet pin via scripting?
When I do something like this :
var puppet_pin = puppet_layer.effect.property('ADBE FreePin3').property('ADBE FreePin3 ARAP Group').property('ADBE FreePin3 Mesh Group').property('ADBE FreePin3 Mesh Atom').property('ADBE FreePin3 PosPins').addProperty('ADBE FreePin3 PosPin Atom');
puppet_pin.property('ADBE FreePin3 PosPin Position').setValue([500,500]);
A pin is created but it is greyed out and does nothing. I notice that the 'ADBE FreePin3 PosPin Atom' property contains two other properties, but they seem to be read-only.
Any way to get around this?
Thank you!
Copy link to clipboard
Copied
I had looked into scripting Puppet pins awhile back and found that it's not really possible. I wanted to create pins in locations of a series of 2D track points and have the track data move each assigned pin.
I spent the last couple of hours trying again via your method, and while you can add properties in the pin group, I think they are just empty property shells. If you try adding a pin in the normal fashion you'll see that each new pin gets created on top of the previous in the property hierarchy, and is named "Puppet Pin incrementedValue". Adding via script creates a property below and with a generic "Pin incrementedValue" name. Nothing actually appears in the viewer representing that "pin" either. I've found no way of activating said pin to where it is viewable in the viewer and editable in the timeline. I believe this may be a false positive when adding these "Pin" properties.
I did scrub the property list to see what is in there and got this.
Legend: IndexNumber Name MatchName
(1) Puppet ADBE FreePin3
(1) On Transparent ADBE FreePin3 On Transparent
(2) arap ADBE FreePin3 ARAP Group //HIDDEN
(1) Auto-traced Shapes ADBE FreePin3 Outlines
(2) Mesh ADBE FreePin3 Mesh Group //HIDDEN
(1) Mesh 1 ADBE FreePin3 Mesh Atom
(1) Mesh ADBE FreePin3 Mesh //HIDDEN
(2) Triangles ADBE FreePin3 Mesh Tri Count
(3) Expansion ADBE FreePin3 Mesh Expansion
(4) Deform ADBE FreePin3 PosPins
(1) Puppet Pin 1 ADBE FreePin3 PosPin Atom
(1) Vertex Offset ADBE FreePin3 PosPin Vtx Offset //HIDDEN
(2) Vertex Index ADBE FreePin3 PosPin Vtx Index //HIDDEN
(3) Position ADBE FreePin3 PosPin Position
(5) Overlap ADBE FreePin3 HghtPins //HIDDEN
(6) Stiffness ADBE FreePin3 StarchPins //HIDDEN
Maybe Todd or Jeff might have more info on this, but I'm pretty sure Puppet Pins are not scriptable yet.

Copy link to clipboard
Copied
As far as I know,it's not possible too.
I create a layer and use pin tool to add 10 pins on it ,then I stored its infomation in xml-based data and generate a new layer and pins automatically.After that,I find two things: 1.my new Puppet effect does not have property Auto-traced Shapes.its propertyValueType is NO_VALUE while canAddProperty("ADBE FreePin3 Outlines") returns false. 2.my 10 pins are created but they are not greyed out ,just like a normal property.Of couse,because the hidden properties can't be set value,their Vertex Offset are all [0,0] and Vertex Index are all -1.
Even if they are not hidden,I still do not agree with creating pins by scripts,because you can't simply calculate the values of Vertex Offset and Vertex Index.For example,these values of my one pin might be [759,250.875] and 4294967295 or [-16.2098515372168,10.0212980126843] and 102.Maybe there can be a way to calculate them ourselvs, but it must be a hard work except that they are automatically generated by after effects just like using the Pin Tool to add a pin.
Copy link to clipboard
Copied
This ability would be useful for this case:
1. Create a puppet mesh and series of pins the normal way, with the GUI.
2. Link each pin to a corresponding null layer via expressions.
3. Later, change the artwork that the puppet is using, which makes the mesh broken and unusable.
4. Remake the puppet mesh, with the new artwork, but preserving the same pin locations, based on the nulls from the previous mesh.
That last step is where creating pins by scripting would be useful. I understand it would be complicated, because it has to also create the vert stuff. It seems to me this is a limitation of the "addProperty" method, which takes no arguments. Because when creating a Puppet Pin, the location of the pin has to be known at the time of its creation, not afterwards.
This seems like a strange workflow I know - but it would be very useful in the case of character animation, when you may need to adjust the artwork after the character has been rigged.

