Skip to main content
Inspiring
November 11, 2022
Answered

Can I parent my layer to another layer by script with the same effect like Shift + Pickwheep?

  • November 11, 2022
  • 2 replies
  • 282 views
 var layersList = app.project.activeItem.selectedLayers;
 for (i=0;i<layersList.length/2;i=i+1){
     layersList[i].setParentWithJump(layersList[i+(layersList.length)/2]);
 }

I have a working script, but the layers that oarent do not fit into their parents' places, as it would if I used Shift + Peekwheep in the after

Is there any method to do smtn like Shift + Pickwheep? 

This topic has been closed for replies.
Correct answer Dan Ebberts

I don't think there's a built-in function for that, but I think you could create your own without too much trouble, depending on what assumptions you can make (no 3D, no keyframes, etc.):

function shiftParent(parentLayer, childLayer){
	childLayer.property("Rotation").setValue(parentLayer.property("Rotation").value);
	childLayer.property("Scale").setValue(parentLayer.property("Scale").value);
	childLayer.property("Position").setValue(parentLayer.property("Position").value);
	childLayer.parent = parentLayer;
}

2 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
November 11, 2022

I don't think there's a built-in function for that, but I think you could create your own without too much trouble, depending on what assumptions you can make (no 3D, no keyframes, etc.):

function shiftParent(parentLayer, childLayer){
	childLayer.property("Rotation").setValue(parentLayer.property("Rotation").value);
	childLayer.property("Scale").setValue(parentLayer.property("Scale").value);
	childLayer.property("Position").setValue(parentLayer.property("Position").value);
	childLayer.parent = parentLayer;
}
MoistoffAuthor
Inspiring
November 11, 2022

Thanks a lot!!! I am incredibly admired by your knowledge and skills in this matter! 

Mylenium
Legend
November 11, 2022

The normal parent does this, so I'm not sure what you are asking.

 

Mylenium