-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathToggle Blurs.sketchplugin
30 lines (28 loc) · 1.05 KB
/
Toggle Blurs.sketchplugin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Toggle Blurs
/*
Background blurs are *really* CPU-intensive. But if you have no choice and need
to use them on your designs, this Plugin will let you toggle them on and off
to speed up rendering. You can toggle them off for regular work, and toggle
them on for exporting.
*/
var doc = context.document,
command = context.command,
pages = doc.pages(),
pluginKey = "com.bomberstudios.toggleBlur"
// Traverse all pages
for (var i = 0; i < [pages count]; i++) {
var currentPage = [pages objectAtIndex:i]
var all_layers = [currentPage children]
for (var j = 0; j < [all_layers count]; j++) {
var current_layer = [all_layers objectAtIndex:j]
if(current_layer.style != undefined){
if ([command valueForKey:pluginKey onLayer:current_layer] == true) {
[command setValue:false forKey:pluginKey onLayer:current_layer]
current_layer.style().blur().setIsEnabled(false)
} else {
[command setValue:true forKey:pluginKey onLayer:current_layer]
current_layer.style().blur().setIsEnabled(false)
}
}
}
}