Skip to content

Draft: Fix psd layer info for single layers

Not writing the layer info when only having more than two children for the root layer causes loss of data if the first child is a layer group. Additionally, other layer properties such as name and opacity and more do not get saved.

Removing this conditional check ensures the layers are always saved.

BUG:473699 BUG:417829

Test Plan

  1. Create new document, rename the single default layer, for example to "color"
  2. Ensure said layer has no opacity.
  3. Save as psd file
  4. Close document
  5. Reopen document
  6. Layer name keeps the new name, in this example "color".

Same applies for creating a layer group and creating several layers inside of it that without this fix would be merged into a single "Background" layer.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

I did run the plugins/impex/psd/tests/kis_psd_test tests, and they supposedly ran all successfully, but given I saw the following warning I doubt they actually ran successfully on my local machine:

QWARN  : KisPSDTest::testSavingAllFormats() krita.general: Environment variable "KRITA_UNITTESTS_DATA_DIR" is not set
QWARN  : KisPSDTest::testSavingAllFormats() External folder is not present, skipping...
PASS   : KisPSDTest::testSavingAllFormats()

Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.

Edited by Stuben

Merge request reports