Last active
July 17, 2019 03:41
-
-
Save justintaylor-dev/fe3f21ccbd60175e5d1fc9f865bc73a9 to your computer and use it in GitHub Desktop.
Reset Position to 0 #code_aeft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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