Skip to content

Instantly share code, notes, and snippets.

@justintaylor-dev
Last active July 17, 2019 03:41
Show Gist options
  • Save justintaylor-dev/fe3f21ccbd60175e5d1fc9f865bc73a9 to your computer and use it in GitHub Desktop.
Save justintaylor-dev/fe3f21ccbd60175e5d1fc9f865bc73a9 to your computer and use it in GitHub Desktop.
Reset Position to 0 #code_aeft
// Resets All Position Values to 0
app.beginUndoGroup('Reset 0');
var selectedLayers = app.project.activeItem.selectedLayers;
for (var i = 0; i < selectedLayers.length; i++) {
var layer = selectedLayers[i];
var is3D = layer.threeDLayer;
if(layer.transform.position.canSetExpression){
layer.transform.position.setValue([0,0,0]);
}else{
layer.transform.xPosition.setValue(0);
layer.transform.yPosition.setValue(0);
if(is3D)
layer.transform.zPosition.setValue(0);
}
if(layer.transform.rotation && layer.transform.rotation.canSetExpression){
layer.transform.rotation.setValue(0);
}else{
layer.transform.xRotation.setValue(0);
layer.transform.yRotation.setValue(0);
if(layer.transform.zRotation.canSetExpression)
layer.transform.zRotation.setValue(0);
}
if(is3D)
layer.transform.orientation.setValue([0,0,0]);
layer.transform.scale.setValue([100,100]);
}
app.endUndoGroup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment