Photoshop CS6 layerTime changes on file save in addition to when a layer changes

  • 1
  • Problem
  • Updated 5 years ago
I'm attempting to use the per-layer change times mentioned in http://blogs.adobe.com/jnack/2008/10/... shop.html. My understanding from that post is that the layer time will be updated whenever a layer is changed, which would be very helpful for a tool I'm writing.

The sample code at the end of the article contains the following jsx to access the layer change times:

function getLayerChangedDate(){
var metadataStrID = stringIDToTypeID("metadata");
var ref = new ActionReference();
ref.putProperty(charIDToTypeID('Prpr'), metadataStrID);
ref.putEnumerated(charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), char IDToTypeID('Trgt'));
var desc = executeActionGet(ref);

if (desc.hasKey(metadataStrID)){
var descMetadata = desc.getObjectValue( metadataStrID );
var timeInSeconds = descMetadata.getDouble(stringIDToTypeID("layerTime"));
var d = new Date();
d.setTime(timeInSeconds*1000.0);
return d.toLocaleString();
}
}

I have a psd with two layers in it, each containing a single color rectangle. When I first open the psd if I run the above function from the ExtendScript Toolkit, they both have the same layerTime. If I change the color on one layer, its layerTime updates to the current time and the other layer's layerTime stays at the original time. All good. If I save the file, they remain correct as long as I don't close the file.

However, if I reopen the file after saving, the layerTime for both layers changes to the time at which I saved the file. As far as I can tell, the layer change time extracted by the above code always updates to the file save time, even if a layer doesn't change when saving or if it changed well before saving. Am I misunderstanding what layerTime is for, or is it broken?
Photo of Charles Groves

Charles Groves

  • 3 Posts
  • 0 Reply Likes

Posted 5 years ago

  • 1
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 769 Reply Likes
Which exact version are you using?

Are you using the current builds (13.0.3 and 13.1.1)?
Photo of Charles Groves

Charles Groves

  • 3 Posts
  • 0 Reply Likes
I was running 13.0. I just updated to 13.1.1, but the behavior seems the same. layerTime reflects the last modified time of the layer as long as the file is open, but it changes to the time of saving the file when it's reopened.
Photo of Chris Cox

Chris Cox

  • 20280 Posts
  • 769 Reply Likes
OK, we'll have to research this after the holidays.
Photo of Charles Groves

Charles Groves

  • 3 Posts
  • 0 Reply Likes
I first asked about this on the Adobe forums at http://forums.adobe.com/message/4958107 before raising it here as a possible bug. Based on more investigation there, it looks like the "update layerTime on disk but not in memory" behavior only occurs if I change some document-wide setting while not changing the layer. In my initial tests, I was changing the foreground color. The sequence was something like:

1. Get an initial layer changed time
2. Change the foreground color to change an unrelated layer's color
3. Check that the time for the layer from 1 hasn't changed
4. Save
5. Check that the time for the layer from 1 hasn't changed
6. Close and reopen the document
7. Check that the time for the layer from 1 updated to the time of the save

Doing some more testing now, I can cause the layerTime to be updated on save with switching the tool I'm using in addition to switching the foreground color. I'm guessing any document-wide change causes the layerTime to be changed in the psd but not in memory.