Warp Transform reset problem

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

tyr

Warp Transform reset problem

Post by tyr »

Hey everyone,
I'm having a problem with reseting the smart object, Warp specifically.
I took Warp Transform AM code and used warp style "warpNone" and it works in most cases, but sometimes the smart object just disappears.
Here's my function and .psd attached.
The psd has two copies of the smart object, when I use this code on the top one it disappears, the same code on the bottom one — Warp resets (but image flies away a bit)


Does anyone know what's going on or is there a working solution to reset warp transform?

r.psd.zip (104.4 KiB) Downloaded 51 times

Code: Select all(function () {

   doc = activeDocument
   var l = doc.activeLayer;
   var b = l.bounds;

   var desc = new ActionDescriptor();
   var ref1 = new ActionReference();
   ref1.putEnumerated(c2t("Lyr "), c2t("Ordn"), c2t("Trgt"));
   desc.putReference(c2t("null"), ref1);
   desc.putEnumerated(c2t("FTcs"), c2t("QCSt"), c2t("Qcsa"));
   var idwarp = stringIDToTypeID("warp");
   var desc3 = new ActionDescriptor();
   desc3.putEnumerated(s2t("warpStyle"), s2t("warpStyle"), s2t("warpNone"));
   desc.putObject(s2t("warp"), s2t("warp"), desc3);
   desc.putEnumerated(c2t("Intr"), c2t("Intp"), c2t("Bcbc"));
   executeAction(c2t("Trnf"), desc, DialogModes.NO);

   function c2t(c) {
      return charIDToTypeID(c)
   }

   function s2t(c) {
      return stringIDToTypeID(c)
   }
}
)()