About
Changes the material color of selected layers to white. Useful for quickly resetting layer materials or creating high-contrast compositions.
Code
// Cavalry Script: Change Selected Layers to White (Updated)// This script changes the material color of selected layers to white// Uses the working api.getSelection() methodconsole.info("Changing selected layers to white...");// Get selected layers using the working APIvar selectedLayers = api.getSelection();if (selectedLayers.length === 0) {console.warn("No layers are selected. Please select some layers first.");} else {console.info("Processing " + selectedLayers.length + " selected layer(s)...");var processedCount = 0;// Loop through each selected layerfor (var i = 0; i < selectedLayers.length; i++) {var layerId = selectedLayers[i];var layerName = api.getNiceName(layerId);try {// Check if the layer has a material attributevar hasMaterial = api.hasAttribute(layerId, "material");if (hasMaterial) {// Set the material color to white using RGBA values (255,255,255,255)api.set(layerId, {"material.materialColor.r": 255, // Red: 255"material.materialColor.g": 255, // Green: 255"material.materialColor.b": 255, // Blue: 255"material.materialColor.a": 255 // Alpha: 255 (fully opaque)});console.log("✓ Changed material color to white for: " + layerName);processedCount++;} else {console.warn("⚠ Layer '" + layerName + "' doesn't have a material attribute");}