Hi esoteric software team!
We recently updated our Photoshop to Spine script to the latest version [7.21], to fix some issues we had with skins. But since updating, the time it takes to export has grown substantially. It used to take around 5-10 minutes to export our Photoshop file and it now takes more than 50 minutes, which makes it difficult to do quick iterations.
I've tracked it down to be the trim code changed in version [7.19]. The new activeDocument.trim() methods are much slower than the old crop methods. Looking at the commit name and the comments added, it seems that the change was due to layer bounds not being tight when using layer styles.
This change totally makes sense, but looking through the Photoshop scripting API it seems that layer also has another bounds property, which might fix this. Layers have a property named boundsNoEffects, which sounds like it might fix the problem. Though I'm not sure, since we haven't experienced any problems with trimming in our setup. Or maybe I don't understand the whole situation, since I'm not to familiar with Photoshop. I guess you have a test setup, which you can try this solution on.
As a temporary fix to speed up our setup, we've reverted the trim code to use crop and changing this line in the Layer class.
From this:
var bounds = this.get("bounds", "ObjectValue");
To this:
var bounds = this.get("boundsNoEffects", "ObjectValue");
I hope this could help speed up trimming again 🙂
Kind regards,
Jonathan - Programmer at Triple Topping Games