• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
2

P: Can’t get background layer information with last beta

Explorer ,
Jul 24, 2023 Jul 24, 2023

Copy link to clipboard

Copied

Hi,

 

After last update of beta version: Adobe Photoshop: 24.7.0 20230718.m.2245 afb5f03 x64

I can't get information about background layer (previous build works fine).

I'm using a Automation plugin in macOS.

 

This is a code sniped:

 

	SPErr error = kSPNoError;
	
	PIActionDescriptor result = NULL;
	PIActionReference reference = NULL;

	// BACKGROUND
	error = sPSActionReference->Make(&reference);
	if (error) goto returnError;
	
	error = sPSActionReference->PutProperty(reference, classBackgroundLayer, keyBackground);
	if (error) goto returnError;
	
	error = sPSActionReference->PutEnumerated(reference, classDocument,  typeOrdinal, enumTarget);
	if (error) goto returnError;
	
	sPSActionControl->Get(&result, reference);
	if (result != NULL)
		{
			hasKey = false;
			
			// Name
			error = sPSActionDescriptor->HasKey(result, keyName, &hasKey);
			if (error) goto returnError;
			if (hasKey)
				{
					memset(&data, 0, sizeof(data));
					
					// Name
					ASZString ztitle = NULL;
					error = sPSActionDescriptor->GetZString(result, keyName, &ztitle);
					if (error) goto returnError;
					
					if (!ASZString2CString(ztitle, data.name, sizeof(data.name)))
						error =  kBadParameterErr;
					
					if (ztitle)
						sASZString->Release(ztitle);					
					if (error) goto returnError;
					
					// Index
					error = sPSActionDescriptor->GetInteger(result, keyItemIndex, &data.index);
					if (error) goto returnError;
					
					// Background
					data.background = true;
					
					// Visible
					error = sPSActionDescriptor->GetBoolean(result,  keyVisible, &data.visible);
					if (error) goto returnError;
					
					// ID
					error = sPSActionDescriptor->GetInteger(result,  keyLayerID, &data.ID);
					if (error) goto returnError;
					
					// Selected
					data.selected = false;
					
					// Kind
					data.kind = kLayerKind_PixelSheet;
					
                    // Bounds
                    data.empty = false;

					// Data
					data.data = NULL;
				}
		}

 

 

 

Bug Fixed
TOPICS
Desktop-macOS

Views

820

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Jul 25, 2023 Jul 25, 2023

The workaround is to NOT ask for classBackgroundLayer but get all the layer IDs via targetLayersIDs on the classDocument and then ask for the layer information via a reference with that id and with a property of “background” or no property to get them all. We are looking into a fix.

Votes

Translate

Translate

correct answers 2 Pinned Replies

Adobe Employee , Jul 25, 2023 Jul 25, 2023

Thank you @David_Storm we will have the team look into this.

 

Status Acknowledged

Votes

Translate

Translate
Adobe Employee , Jul 26, 2023 Jul 26, 2023

Glad this works for you @David_Storm 

 

Status Fixed

Votes

Translate

Translate
6 Comments
Adobe Employee ,
Jul 25, 2023 Jul 25, 2023

Copy link to clipboard

Copied

Thank you @David_Storm we will have the team look into this.

 

Status Acknowledged

Votes

Translate

Translate

Report

Report
Jul 25, 2023 Jul 25, 2023

Copy link to clipboard

Copied

The workaround is to NOT ask for classBackgroundLayer but get all the layer IDs via targetLayersIDs on the classDocument and then ask for the layer information via a reference with that id and with a property of “background” or no property to get them all. We are looking into a fix.

Votes

Translate

Translate

Report

Report
Explorer ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

Hi @Tom Ruark 

Using targetLayersIDs and layer information by ID I can get the background information.

Thanks.

Votes

Translate

Translate

Report

Report
Adobe Employee ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

Glad this works for you @David_Storm 

 

Status Fixed

Votes

Translate

Translate

Report

Report
Jul 30, 2023 Jul 30, 2023

Copy link to clipboard

Copied

Another workaround is to NOT ask for all the keys but for a single key. If you first do this

error = sPSActionReference->PutProperty(reference, classProperty, keyBackground); before the other PutProperty it will work. It only fails if you as for ALL keys. In your *Release* code you should NOT ask for all keys as that can be very expensive! Ask for them one at a time even if you have many keys to get. It WILL BE faster.

Votes

Translate

Translate

Report

Report
Explorer ,
Jul 30, 2023 Jul 30, 2023

Copy link to clipboard

Copied

LATEST

I will consider the suggestion. Thanks @Tom Ruark 

Votes

Translate

Translate

Report

Report