Skip to content

Grids with unit management

Grum 999 requested to merge grum/krita:grum999/grids_and_guides_unit into master

Hi

Following this topic on KA:
https://krita-artists.org/t/is-there-a-way-to-create-a-grid-in-measurements-other-than-pixels/96558/2

I've implemented possibility to provide measures in unit other than pixels (mm, pt, in, ...)

image

Notes

  • Currently still in WIP as I need to finalize and test the Python API
  • The current committed change will compile and run, but there's bugs on KisDoubleParseUnitSpinBox
    • User experience is better with MR !2199 (merged) (which fix bugs) taken in account first
  • The implementation store in Krita document the value + unit
    • Concerning old Krita document, as there's no unit stored in file opening a Krita document created with an older version of Krita will consider the unit is pixels (so no problem to open an old document)
    • Concerning new Krita document, as there's unit stored in file (as floating values), opening a document on an older version of Krita will not work
      (to be more precise, the document will open, but grid properties won't be taken in account)
  • Python API are updated to let grid unit management being possible

Test Plan

  • Create a document (@300dpi gives better precision in unit conversion with pixels, but any other value can be used)
  • Setup a grid
  • Play with units: change from one to another one, conversion should be Ok
  • Change resolution of document while grid is active with different units (pixels, mm, inches, pt, ...) and ensure grid size is still correct
  • Ensure when grids and rulers are visible and use the same unit, grid and rulers are aligned
  • For Python API, file plugins/extensions/pykrita/manual_tests/documents_gridsconfig_test_script.py has been updated

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.
  • Does the patch add a user-visible feature? If yes, is there a documentation MR ready for it at Krita Documentation Repository?

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 Grum 999

Merge request reports

Loading