Photoshop 24.7.0: C++-SDK: Background-layer available returns false if there is only a background-la
In my plugin I have code which checks whether a background layer is available:
#include <PIActions.h>
#include <PISuites.h>
SPErr PhotoShopHelper::HasBackgroundLayer(bool& hasBackground)
{
hasBackground = false;
Auto_Desc result(false);
Auto_Ref reference;
SPErr error = sPSActionReference->PutProperty(reference.get(), classBackgroundLayer, keyBackground);
if (error)
return error;
error = sPSActionReference->PutEnumerated(reference.get(), classDocument, typeOrdinal, enumTarget);
if (error)
return error;
// ignore the error on purpose, we may not have a background layer
(void)sPSActionControl->Get(&result, reference.get());
if (result.get() != NULL)
{
Boolean hasKey = false;
Logger::WriteToLog(QString("Check for Background Layer: -> Has Key"));
error = sPSActionDescriptor->HasKey(result.get(), keyName, &hasKey);
if (error)
{
return error;
}
if (hasKey)
{
hasBackground = true;
}
}
return error;
}
Until Version 24.6, The HasKey returned true if there is a background-layer available.
In Version 24.7, it will return true only if there is another layer (or more) available. If there is only a background-layer, it will return false.
Expectaition would be that it will return true in all cases a Background-layer is availabe (as before 24.7)
