Copy link to clipboard
Copied
I need it as a part of an action and couldn't fine a way . I know I can make linked embedded and then do unrelated copy by "new via copy" but how can I make it keeping the original linked ?
2 Correct answers
Let's say you have a Smart Object (SO) in the primary image document cosisting of two or more layers.
If we need to edit that SO we double click it's thumbnail which opens it in a new window.
The normal procedure is to make any changes in that new window, and save it (Ctrl s)
We return to the primary document window and see that the SO, and all copies of it, have been updated.
But let's say we would like to use one o f the SO layers outside of the SO. We double click to open it in its new
...
// if active layer is linked smart object create embedded duplicate;
// 2023, use at your own risk;
if (app.documents.length > 0) {
var myDocument = activeDocument;
var theLayer = myDocument.activeLayer;
if (isLinkedSmartObject() == true) {
var theDup = myDocument.duplicate("temporal", false);
embedLinked ();
theDup.activeLayer.duplicate(theLayer, ElementPlacement.PLACEBEFORE);
theDup.close(SaveOptions.DONOTSAVECHANGES)
};
};
////// embed li
...
Explore related tutorials & articles
Copy link to clipboard
Copied
1. Copy/Dupe the linked layer to a new layer
2. Convert to Smart Object (The link becomes embedded)
I know that it isn't obvious to Convert a Smart Object to a Smart Object... Linked SO's were added to Photoshop after embedded was first introduced, so the legacy "Convert to Smart Object" command could arguably be renamed to "Convert to Embedded Smart Object" to clarify what it actually does. Now that there are both embedded and linked, I think that the naming should be clear.
It takes more work to automate the conversion of an embedded SO to a linked SO.
You could rasterize the duped layer (linked) Smart Object, then Convert to a Smart Object, but that is an unnecessary extra step.
Copy link to clipboard
Copied
Unfortunatlly this is not working for an action I want to create. I need an action that makes and updates a copy of smart object linked file to reveal the linked file alpha channel as black and white looking smart object of same transforms. To use it then for group clipping instead of manually copy-pasting alphas in layer masks
I can do it with embedded copy and "apply" command . But when this embedded copy have another smart object inside the apply command doesn't see alpha channels from original file. It's doable when I do original (linked) smart object embedded and another one by"via Copy" .
So perhaps I need a script that could relink back the first original one. Wonder if it could be possible if each linked smart object would have some related file path and file name in its layer name. Something like /render/scene001.png so the script could find and re-link it back to that file.
Copy link to clipboard
Copied
I don’t understand what you are trying to describe.
Please provide a packaged file (or at least screenshots including the pertinent Panels) to illustrate.
Copy link to clipboard
Copied
Well, you didn't mention any of that up front. What I proposed did what you originally requested.
As for the updated info, I'm having problems visualising exactly what you're trying to achieve. Screenshots and sample files are often useful to illustrate.
Copy link to clipboard
Copied
Smart Object instances don’t »see« alpha channels in a Smart Object anyway, so I don’t understand the OP’s intention, either.
Copy link to clipboard
Copied
Here is a file representing what I want to achive. I first want to create an action that would dublicate selected linked smart object and turn it into alpha 1 of the file linked . And another action to one click update that alpha copy if original linked file has been updated .
I have just found that in Photoshop beta I can use sbsar from Substanance Designer that can do it as a Procedural Filter . But it's slow as hell and crushy.
Copy link to clipboard
Copied
Please provide a package!
Copy link to clipboard
Copied
here is a link to 7z archive
Copy link to clipboard
Copied
Thanks.
But @Stephen Marsh ’s original advice seems to apply.
Duplicate the SO (ctrl-J), Convert to Smart Object, open the Smart Object, embed the Linked SO, open it and make the changes (however you translated the alpha channel to RGB), save, close, save, close.
edit: All those steps should record in an Action.
Copy link to clipboard
Copied
c.pfaffenbichler Yeah , @Stephen_A_Marsh ’s original advice sort of works and and can be recorded in an action. The main problem is having a smart object inside another smart object . The purpose of SOs is to keep original image pixel resolution available in case you upscale something . But once you created another smart object (parent) with linked SO (child) inside that new SO (parent) has a pixel size of its current state. And if later you upscale it you get a weird thing of low res SO (parent) upscaled while it still keeps Hires child source inside but no way to transfer those pixels to update parent one .
The purpose of all this is to have stored alphas from resource files accessible for masking/clipping groups. I tried to use sbsar in beta that reveals any necessary channel from any linked image but it works slow as hell. And so far I see only way is to make linked SO embedded first, copy it by via copy and do re-link the original one back to source file.
Trying to task chatGPT for that but it makes some not working piles of code 😞
Finally, after research the issue, chatGPT told me Photoshop scripts just can't relink file automatically . only save . So looks like it's a deadend.
Copy link to clipboard
Copied
Well, it seems Chat GPT provided you with incorrect information.
If you are willing to create an actual Script the approach seems fairly straightforward: Duplicate the image (Image > Duplicate), embedd the Linked Smart Object, do whatever to that SO, transfer it to the original image and close the temporal duplicate without saving.
Copy link to clipboard
Copied
// if active layer is linked smart object create embedded duplicate;
// 2023, use at your own risk;
if (app.documents.length > 0) {
var myDocument = activeDocument;
var theLayer = myDocument.activeLayer;
if (isLinkedSmartObject() == true) {
var theDup = myDocument.duplicate("temporal", false);
embedLinked ();
theDup.activeLayer.duplicate(theLayer, ElementPlacement.PLACEBEFORE);
theDup.close(SaveOptions.DONOTSAVECHANGES)
};
};
////// embed linked smart object //////
function embedLinked () {
try {
executeAction( stringIDToTypeID( "placedLayerConvertToEmbedded" ), undefined, DialogModes.NO )
} catch (e) {}
};
////// active layer is linked smart object //////
function isLinkedSmartObject () {
try {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var layerDesc = executeActionGet(ref);
var soDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObject'));
isLinked = soDesc.getBoolean(stringIDToTypeID("linked"));
if (isLinked == true) {return true}
else {return false}
} catch (e) {return false}
};
Copy link to clipboard
Copied
c.pfaffenbichler Thank you a lot. I wasted 3 hours today trying to make chatGPT write me something like that. You script works perfectly.
Copy link to clipboard
Copied
There have been a few threads by people who had problems with code for Photoshop created by ChatGPT; I suspect the volume of Photoshop-specific Scripts that has been »ingested« by the GPT may be too small to provide meaningful results for this very specifc environment/DOM (Photoshop).
Sometimes the code seemed to contain a mishmash of Illustrator- and/or Indesign-DOM-elements which are meaningless in Photoshop’s DOM.
Copy link to clipboard
Copied
Agree. I managed to get a few simple scripts working from GPT but my enthuiasm about it is fading evry next try since. It makes a total mess while saying Sure and proudly reporting the job is done 🙂 My guess it's not a time when AI would replace all of us yet .
Copy link to clipboard
Copied
Always worth remembering that when you open a Smart Object in a new window to edit, you can Duplicate some or all of its component layers back to the original document. Leastways you can with 25.3.1 25.4 beta is broken regards that feature. You can duplicate to a New Doc, but not to another open doc.
Copy link to clipboard
Copied
Trevor.Dennis . Could you exaplain how please? I'v never seen it.
Copy link to clipboard
Copied
Let's say you have a Smart Object (SO) in the primary image document cosisting of two or more layers.
If we need to edit that SO we double click it's thumbnail which opens it in a new window.
The normal procedure is to make any changes in that new window, and save it (Ctrl s)
We return to the primary document window and see that the SO, and all copies of it, have been updated.
But let's say we would like to use one o f the SO layers outside of the SO. We double click to open it in its new window expanded with all its component layers. We select the layer we need, and drag it to the primary ddocument's tab, which pastes just that layer.
As always there are different ways of achieving the same thing.
We can select an SO layer, right click and choose, New Smart Object via copy.
It's still the exact same SO with all its component layers, but if we double click and edit it, those changes won't be reflected in the original SO or copies of it. If you simply used Ctrl J to copy an SO and edit it, those changes _would_ be reflected in the original and all copies.
I'd count it as one of those Photoshop gotchas like Caps Lock reducing the Brush cursor to a point, or Displacement Maps not working if Backward Compatability is not set to Always. Some would argue that the Development Team are doing their best to expand the list of Photoshop Gotchas with Save as to JPG not being available unless you tick a cunningly hidden checkbox in Preferences, or wonder why the gradient tool has suddenly got complicated, or WTF can't I see the contents of layer masks because there's an icon obscurring two thirds of the mask thumbnail...
Copy link to clipboard
Copied
Thanks Trevor
Copy link to clipboard
Copied
Are you familiar with the use of Layer Comps in Smart Objects?

