Keyfast
Script
Free

Reset Properties

By Jack Vaughan
Updated 11/1/2025

About

Resets the currently SELECTED attributes on the SELECTED layers back to their defaults. Example: if Rotation is selected and set to -90, it will be reset to its default. If Position is selected and non-zero, it will be reset to 0/0, etc.

Code

// Reset Properties.js
// Resets the currently SELECTED attributes on the SELECTED layers back to their defaults.
// Example: if Rotation is selected and set to -90, it will be reset to its default.
// If Position is selected and non-zero, it will be reset to 0/0, etc.
console.info("Reset Properties: starting…");
function getSelectedLayers() {
try {
var sel = api.getSelection();
return Array.isArray(sel) ? sel : [];
} catch (e) {
return [];
}
}
function getSelectedAttributePaths() {
// api.getSelectedAttributes() should return an array of attribute paths currently selected in the UI
try {
var attrs = api.getSelectedAttributes();
if (!attrs) return [];
if (Array.isArray(attrs)) return attrs.filter(function(a){ return typeof a === "string" && a.length > 0; });
// If some versions return an object/map, collect keys
var out = [];
for (var k in attrs) { if (attrs.hasOwnProperty(k) && typeof k === "string" && k.length > 0) out.push(k); }
return out;
} catch (e) {
return [];
}
}
var layers = getSelectedLayers();
if (!layers.length) {
console.warn("No layers selected. Select one or more layers and the attributes to reset.");
} else {
var selectedAttrs = getSelectedAttributePaths();
if (!selectedAttrs.length) {
// Fallback: reset common transform attributes that are NOT at defaults