1.我们先来获取layerID需要的时间
var r = new ActionReference();
var d = new ActionDescriptor();
//r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("layerID"));
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(charIDToTypeID('null'), r);
var options = executeAction(charIDToTypeID( "getd" ), d, DialogModes.NO);
var layerID= options.getInteger(stringIDToTypeID("layerID"));

单位是微秒(µs),这里大概0.012s.那么如何提高速度呢,那就是限制getd获取的范围。加上要获取的属性。
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("layerID"));

putProperty只能设置一次,设置多个是不生效的。
本文介绍了一种通过限制获取范围和指定所需属性来提高layerID获取速度的方法。通过具体代码示例展示了如何使用ActionDescriptor和ActionReference来精确控制获取过程。
1446

被折叠的 条评论
为什么被折叠?



