My thought with only passing the size is that Photoshop would leave everything else as is. I tested the new size only function you gave me but updated it to also get and set the units too in addition to the size. Thanks for explaining about it not needing to be nested. This works and Photoshop will update the size but leave everything else as is. However, when the bug occurs, it still ignors the size it is being given. So while the function works, the ug still occurs.
So it seems maybe giving it the entire descriptor may be the answer. However, I can’t get that to do anything. I can get the descriptor into a variable. The descriptor has all of the values and I can see those values are correct. However, the set function does nothing at all. This is the set function I am using.
I tried using this as is without even replacing the text too. I tried just getting the descriptor from one layer, selecting another layer, and then setting it to the descriptor with this function. that doesn’t do anything. The descriptor get works fine and everything is there.
function setTextKey(textKey){
return {
"_obj": "set",
"_target": [
{
"_ref": "textLayer",
"_enum": "ordinal",
"_value": "targetEnum"
}
],
"to": textKey
}
}
Anyway, thanks for trying to help.
However, I have another work-around I am just going to implement until Adobe fixes it. The only time the bug happens is for the first text layer where the text is replaced after opening the document. After that it will only happen is the text is replaced consecutive times (which my plugin doesn’t do).
So the work around is to have the plugin add a temp text layer to the top of the document after it is opened. Then plugin will replace the text in the temp layer and delete the layer. This way, the bug will only happen on the temp later but not all of the other layers that get the text replaced.
This is a clunky workaround but hopefully it is only temporary. It only adds 0.2 seconds to the processing so I can live with that. I just don’t have time to waste a bunch of hours on this so my clunky workaround will just have to be good enough for now.
I really can’t wait for the UPX DOM to be released. It shouldn’t be this difficult just to replace text in a layer. With extendscript it was one line of code. No surgery of complicated descriptors was needed to just replace the text string.
Extendscript is this to do the same thing.
app.activeDocument.activeLayer.textItem.contents="New Text";