https://bugs.kde.org/show_bug.cgi?id=529157

            Bug ID: 529157
           Summary: Clone brush: allow adjusting the source/target offset
                    without re-picking the source point
    Classification: Applications
           Product: krita
      Version First 5.3.4.1
       Reported In:
          Platform: Other
                OS: Other
            Status: REPORTED
          Severity: wishlist
          Priority: NOR
         Component: Brush engines
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Feature request for the Clone brush engine (observed on Krita 5.3.4.1 on
Windows 11,
but the limitation is in the current master code as well).

--- Actual behaviour -------------------------------------------------------

The clone brush can only *re-pick* the source point (Ctrl+click, see
KisDuplicateOpSettings::mousePressEvent). The offset between source and
destination is therefore decided when the stroke starts and cannot be
adjusted afterwards: changing the vector means re-picking the source, which
also loses the previously chosen source point.

--- Use case (the reason this hurts) ---------------------------------------

Extending a straight, rectilinear element: a cable, a wall edge, a horizon,
a seam between two textures. To continue such an element the displacement
vector must be *strictly parallel* to the element being extended - and on the
first try it almost never is. The error only becomes visible once paint has
been laid down.

Current workflow, repeated several times per edge:

  1. paint a few pixels
  2. see that the clone is drifting slightly off the line
  3. Ctrl+Z
  4. Ctrl+click a source point one pixel away
  5. paint again

Each round costs a full source re-pick, and there is no way to nudge the
relationship by one pixel while keeping the same source content.

--- Expected behaviour -----------------------------------------------------

Be able to adjust the source/target offset of an established clone without
re-picking the source point, at 1 px precision, ideally without leaving the
canvas.

--- Prior art --------------------------------------------------------------

* Photoshop's Clone Stamp: Alt+Shift+arrow keys nudge the source one pixel per
  tap, Alt+Shift with , . and [ ] rotate and scale it, and Alt+Shift also
  shows a translucent overlay of the source so the alignment can be judged
  *before* painting. The Clone Source panel exposes the same values
  numerically (X/Y offset, rotation, width/height). Krita already draws the
  second circle, so the preview exists - only the nudging of the vector is
  missing.
* Nuke's clone: pressing Ctrl again re-engages the source/target relationship
  so it can be dragged and adjusted continuously instead of resetting it.

--- Technical notes (source read on master, same logic in 5.3.x) -----------

* plugins/paintops/defaultpaintops/duplicate/kis_duplicateop_settings.cpp,
  KisDuplicateOpSettings::mousePressEvent(): with Qt::ControlModifier it sets
  m_position = click position and m_isOffsetNotUptodate = true. The offset is
  then derived at the first dab of the next stroke as
  m_offset = info.pos() - m_position - i.e. the vector is a side effect of
  where the stroke starts, and is never editable afterwards.

* plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp, sampling:
      if (moveSourcePoint) srcPoint = dstRect.topLeft() - offset;
      else                srcPoint = position() - hotSpot;
  The second branch is a *constant* sampling point, which is why unchecking
  "Source point move" makes the brush repeat the same pixels like a pattern
  brush rather than keeping a clone offset (related: bug 478064).

* The offset already exists as m_offset and is even persisted: "OffsetX" /
  "OffsetY" attributes in KisDuplicateOpSettings::fromXML()/toXML(). But
  wdgduplicateop.ui exposes no widget for it - only Healing, Correct
  perspective (disabled), Source point move, Source point reset before a new
  stroke, Clone From All Visible Layers.

* The brush outline already renders the offset correctly
  (KisDuplicateOpSettings::brushOutline() translates the second circle by
  m_offset), so any change to m_offset would be visible immediately.

--- Suggested implementation, cheapest first -------------------------------

1. Expose m_offset as two numeric fields (Offset X / Offset Y) in the clone
   engine's "Painting mode" section, editable and scrubbable. Everything
   needed already exists (storage, serialization, outline); this is a UI-only
   change plus honouring the value instead of recomputing it at stroke start.

2. Add a nudge shortcut while the Clone brush is active (e.g. Alt+Shift+arrow
   keys) that updates m_offset by one pixel and refreshes the outline. This
   alone would remove the undo/re-pick loop described above.

3. Optionally, a modifier-drag mode that re-derives m_offset continuously
   from the pointer (the Nuke behaviour).

1 or 2 alone would already solve the use case.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to