Skip to content

Commit 80738ce

Browse files
committed
Improve performences
1 parent 5bc1230 commit 80738ce

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/explode_shape_layer.jsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
// Get the elements of the original shape layer
2323
var contents = layer.property("Contents");
24+
var n_layers = [];
2425

2526
// Browse through contents array
2627
for(var i = contents.numProperties; i > 0; i--) {
@@ -34,6 +35,10 @@
3435
// Duplicate the original layer and rename with property name
3536
var n_layer = comp.layers.addShape();
3637
n_layer.name = o_prop.name;
38+
n_layer.enabled = false;
39+
40+
n_layers.push(n_layer);
41+
3742
copyLayerTransform(layer, n_layer);
3843

3944
// Get the elements of the new layer
@@ -45,6 +50,10 @@
4550

4651
}
4752

53+
for(var i = 0; i < n_layers.length; i++) {
54+
n_layers[i].enabled = true;
55+
}
56+
4857
}
4958

5059
function insertPropertyToContents(prop, contents, prefix) {
@@ -195,7 +204,14 @@ function createUI(thisObj) {
195204
myPanel.bounds.height = 40;
196205

197206
btn.onClick = function() {
207+
208+
var t_start = new Date().getTime();
209+
198210
explodeLayer( app.project.activeItem.selectedLayers );
211+
212+
var t_end = new Date().getTime();
213+
consLog('Execution time : ' + (t_end - t_start) + 'ms');
214+
199215
}
200216

201217
return myPanel;
@@ -206,7 +222,7 @@ function consLog(text) { if (configs.log) $.writeln(text); }
206222

207223
var configs = {
208224
title: 'Explode layer tool',
209-
log : false,
225+
log : true,
210226
};
211227

212228
var myToolsPanel = createUI(this);

0 commit comments

Comments
 (0)