Last active
July 17, 2019 03:28
-
-
Save justintaylor-dev/22e08f36325c84e615169b4c354ba7f8 to your computer and use it in GitHub Desktop.
Reset PSR #code_aeft
This file contains 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 Position, Scale, and Rotation on selected 2D or 3D Layers | |
app.beginUndoGroup('Reset PSR'); | |
var selectedLayers = app.project.activeItem.selectedLayers; | |
for (var i = 0; i < selectedLayers.length; i++) { | |
var layer = selectedLayers[i]; | |
var center = [Math.round(app.project.activeItem.width / 2), Math.round(app.project.activeItem.height / 2), 0] | |
var is3D = layer.threeDLayer; | |
if(layer.transform.position.canSetExpression){ | |
layer.transform.position.setValue(center); | |
}else{ | |
layer.transform.xPosition.setValue(center[0]); | |
layer.transform.yPosition.setValue(center[1]); | |
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