Skip to main content
Kogi18
Inspiring
April 29, 2022

P: SmartObject Relink to affects all same path instances instead of just the selected layer instance

  • April 29, 2022
  • 6 replies
  • 12218 views

Issue: Relinking single linked SmartObject relinks all SmartObjects with same path

  • Photoshop version: noticed on current latest 24.0.1 but also present on other versions
  • OS: macOS 12.6.1 - Monterey


Steps to reproduce:

  1.  Create 2 SmartObject layers with File > Place Linked ... using the same target image (or create one such layer and duplicate it)
  2.  Select 1 of the linked layers
  3.  Relink it by using the Layer > Smart Objects > Relink to File ... and chose another image to replace it

 

Expected result: Just the selected layer's link being updated, while the "duplicate" remains linked to old image reference.


Actual result: Both layers are linked to same new image reference

 

Since the whole Layer menu location implies that we are operating on a single layer it is weird, that it modifies all layers with same referenced path. This is causing issues when we are creating overviews with linked files and updating them over time. Currently we need to delete the old layers and create new links and then redo the whole transfomring for the overview.

 

Saw similar posts of other users ... that still have no answer:

6 replies

Get Busy!
New Participant
June 11, 2024

Crazy that this is still an annoying issue and hasn't been fixed, InDesign has had a simple solution for re-linking a single instance of a linked file forever. Why can't this same approach by adopted in Photoshop?

Stephen Marsh
Community Expert
March 21, 2024

The New Smart Object via Copy command only applies to embedded smart objects. There is no way to break the relationship between an original and a copy for a linked file. It makes logical sense as this is a linked file. 

 

The command originated before linked smart objects were available. One could argue that it needs to be renamed to include the word embedded, i.e. New Embedded Smart Object via Copy – to clarify the intended use now that there are both linked and embedded options.

 

I created a script to help automate the process of creating a New Linked Smart Object via Copy:

 

/*
New Linked Smart Object via Copy.jsx
v1.1 - 27th January 2024, Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/why-is-new-smart-object-via-copy-greyed-out-for-linked-smart-objects/td-p/14371680
*/

#target photoshop

// Smart object action manager properties
var ref = new ActionReference();
ref.putProperty(charIDToTypeID("Prpr"), stringIDToTypeID("smartObject"));
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var so = executeActionGet(ref).getObjectValue(stringIDToTypeID("smartObject"));

// Conditional check for the active layer being a linked smart object
if (so.getBoolean(stringIDToTypeID("linked"))) {
    // Single history stage undo
    activeDocument.suspendHistory("New Linked Smart Object via Copy.jsx", "main()");
}


function main() {

    // Doc path, name and extension variables
    var thePath = so.getPath(stringIDToTypeID("link")).fullName.replace(/(^.+\/)(.*)/, '$1');
    var theName = so.getString(stringIDToTypeID("fileReference")).replace(/\.[^\.]+$/, '');
    var theExt = so.getString(stringIDToTypeID("fileReference")).replace(/(.+)(\.[^\.]+$)/, '$2');

    // Duplicate the linked file adding copy to the name
    var theCopy = new File(thePath + theName + " copy" + theExt);
    if (!theCopy.exists) {
        new File(thePath + theName + theExt).copy(thePath + theName + " copy" + theExt);
    } else {
        throw alert('File "' + thePath + theName + theExt + '" exists, script cancelled!');
        //throw null;
    }

    // Set the reference to the original doc name
    var origDocName = activeDocument.name;

    // Dupe the smart object layer to a new temp doc
    function s2t(s) {
        return app.stringIDToTypeID(s);
    }
    var descriptor = new ActionDescriptor();
    var reference = new ActionReference();
    var reference2 = new ActionReference();
    reference.putClass(s2t("document"));
    descriptor.putReference(s2t("null"), reference);
    descriptor.putString(s2t("name"), "tempDoc");
    reference2.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
    descriptor.putReference(s2t("using"), reference2);
    descriptor.putString(s2t("layerName"), activeDocument.activeLayer.name);
    executeAction(s2t("make"), descriptor, DialogModes.NO);

    // Relink to the duplicated file copy
    var idplacedLayerRelinkToFile = stringIDToTypeID("placedLayerRelinkToFile");
    var desc15 = new ActionDescriptor();
    var idnull = stringIDToTypeID("null");
    desc15.putPath(idnull, new File(thePath + theName + " copy" + theExt));
    executeAction(idplacedLayerRelinkToFile, desc15, DialogModes.NO);

    // Dupe the relinked temp doc layer back to the original doc
    function s2t(s) {
        return app.stringIDToTypeID(s);
    }
    var descriptor = new ActionDescriptor();
    var reference3 = new ActionReference();
    var reference4 = new ActionReference();
    reference3.putEnumerated(s2t("layer"), s2t("ordinal"), s2t("targetEnum"));
    descriptor.putReference(s2t("null"), reference3);
    reference4.putName(s2t("document"), origDocName);
    descriptor.putReference(s2t("to"), reference4);
    descriptor.putString(s2t("name"), activeDocument.activeLayer.name);
    executeAction(s2t("duplicate"), descriptor, DialogModes.NO);
    activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

J. Million
Participating Frequently
March 21, 2024

Best solution. Can't believe this is still an issue in 2024 when I can follow it back to 2015 and beyond. Why is there no option to make a linked asset "unique"? Usual Adobe madness.

New Participant
May 19, 2023

This was the only workaround that solved it for me - thank you! 

trashcaneron
Inspiring
May 19, 2022

In my Photoshop document, I have two layers, both linked to the same file. If I modify that linked file, it updates both layers in Photoshop. Good!

 

Now I need to duplicate both of those layers and link the two new layers to a different file. If I duplicate those linked files, and try to relink, it relinks all four of those layers. 

 

If I convert that original linked layer to an embedded layer, it still treats it as the same source for all four. 

 

Any ideas beyond just creating a new file for each instance of this thing? 

Brainiac
May 19, 2022

Instead of duplicating the Smart Object layer, use the "New Smart Object Via Copy" command. That breaks the link to the original smart object for it to act on its own.

trashcaneron
Inspiring
May 19, 2022

You can not use "New Smart Object Via Copy" if your layer is a linked layer. 

So I would need to do the following

  1. Convert my first two layers to Embedded
  2. Duplicate those two layers via "New Smart Object Via Copy"
  3. Relink the original two layers to the file outside of photoshop
  4. Relink the two new layers to their linked file

 

Unless there's another way? 

Known Participant
April 29, 2022

I have placed a linked image in the PSD.

 

It's duplicated a few times in the doc. 

 

I only want to relink 1 instance of it to another image.

 

But when relinking, it changes all the instances.

 

What's the trick?

Conrad_C
Community Expert
April 29, 2022

Instead of duplicating it as a layer normally, choose New > Smart Objects > New Layer via Copy. That creates a copy that is not connected to other Smart Objects.

New Participant
October 5, 2022

This worked so simple. Shukran