[Testing/feedback needed] New Bezier Mesh transform mode

I’ve just finished the patch that implement a mesh transformation mode for the transform tool. It allows creating a mesh of multiple. I would really like you to test that and give some feedback. Just click the rightmost icon in the tool and play with it.

The main two questions I have:

  1. Is the algorithm itself looks sane? Does it create an expected result?
  2. Do the shortcuts look sane?

Merge request: https://invent.kde.org/graphics/krita/-/merge_requests/574

Prebuilt packages

Windows x64 ZIP:

Linux Appimage:

Supported actions

  1. Node or control point move: Click + drag
  2. Locked control point move: Shift + Click + drag
  3. Segment move: Click + drag on a segment of the mesh
  4. Locked segment move: Shift + Click + drag on a segment of the mesh
  5. Free patch deform: Shift + Click + drag on empty area inside the mesh
  6. Split mesh or Move/Delete split:
    • Ctrl+Alt+click+drag on a border segment to split the mesh
    • Ctrl+Alt+click+drag on a node to change the split
    • Ctrl+Alt+click+drag away a node to remove the split
  7. Select multiple nodes: Ctrl + click on a node or control or segment
  8. Move selection or mesh: Click + drag on empty area inside the mesh
  9. Rotate selection or mesh: Click + drag on empty area outside the mesh
  10. Scale selection or mesh: Ctrl + click + drag on empty area outside the mesh

Test Plan

  1. Test all action using the Transform Tool
  2. Check Ctrl+Z works when modifying the mesh
  3. Add a transform mask with Mesh transformation
    1. Check it renders correctly
    2. Check painting on a layer works
    3. Check changing mask visibility works
    4. Check Move Tool works fine with both layer and mask
    5. Check saving/loading the mask into a file
12 Likes

@mel This was your feature request as far as I remember. :slight_smile:

2 Likes

Thank you for this @dkazakov
Thank you @mel for requesting it.

  1. It looks sane and feels good to use.
  2. The shortcuts look sane but I’ll never be able to remember them. This is inevitable, especially for me.
    (But see Supported Actions Observations - 7.)

I’ve tried with limited simple testing and have the following observations:

Supported Actions Observations: They work except for the following:

Actions 2. and 4: These refer to locked control points and locked segments.
I don’t know how they get locked so I couldn’t test those.

Action 7: Selecting multiple nodes by Ctrl+click does select multiple nodes but if you try to Click+drag one of them, all other nodes become deselected and only the Click+dragged node moves.
(The Edit Shapes tool has a different operation where Shift+click is used to select multiple nodes and then Click+drag does move all the nodes.)

Test Plan Observations:

1: See above

2: It works

3.1: It renders correctly

3.2: Painting on a layer works but the rendering is blank when this is done.
I had to turn the transform layer off, paint on the paint layer and then turn the transform mask back on.
I suppose this is to be expected.

3.3: It works

3.4: Using the Move Tool results in loss of transformed content but not loss of original content if the Move caused the transformed content to go off-canvas.
Turning layers on/off and Saving/re-Opening have no effect on this.
I’ll try to test that in more detail later with other operations.

Here is an example of paint layer content as described above:

And here is the resulting transformed content:

3.5: Saving to a file and then re-Opening the file works ok.

Hi, @AhabGreybeard!

Thank you for such quick testing! :slight_smile:

We might need a better name for it. It might also be called as “symmetric” or “orthogonal” or “rigid”. Though neither of them are technically correct :slight_smile:

The meaning of the locked mode is, when changing one control all other controls are rotated to keep the angles between them intact. Here are two images illustrating the effect


“unlocked” mode, no Shift pressed

“locked” mode, Shift is pressed

Okay, I’ll fix that.

That is the thing that almost makes me cry :cry: I tried to align the shortcuts with the shortcuts in Warp and Cage Transform modes. For some reason we use different shortcuts there. Ideally, we should make these shortcuts consistent with the ones in Shape Editing and Shape Selection tools. Though I’m not sure how people would accept that. And such change might block this feature from getting into Krita 4.5 (or not?).

You should just wait for a couple of seconds for update to happen. There is an explicit three seconds delay for non-affine transformation to start rendering.

I think it tries to move the layer below the mask, which pushes it away from under the mesh. I’ll check what can be done with that (though I have a feeling it is not a regression).

1 Like

As a matter of fact, it is actually a superset of what i suggested, and it is totally awesome! I’ll try to test it as soon as possible :slight_smile:

EDIT: tested. I’m totally sold it XD

Works well, looks very useful. I haven’t tested it throughly but the first impression is extremely positive. The edition of the control points is just as intuitive as it needs, though i’d suggest the “locked” mode was the default, and the shift drag was for the non locked mode, but that’s just a matter of personal preference, i guess. Adding additional rows and columns works as fine, though i haven’t got to remove one of the rows, but it has been a very shallow test.

I think it would be enough to have just a pair of spinners in the widget and set the row/columns count there, but adding them on variable places on the mesh is just brilliant,

As for the results i got, they were just as I was expecting them to be, the utility is intuitive and produces predictable results. Actually, i learned you could add transformation masks, that’s crazy! :smiley:

So far, great. Great job! :smiley:

Thank you for the explanation of ‘locked’, I now understand it.
Maybe call it ‘synchronised move’ or something?

The common convention for selecting multiple items is Ctrl+click and I was surprised and confused when I found that the Select Shapes tool and the Edit Shapes tool both use Shift+click, with Ctrl+click doing nothing special.

The Layers docker uses Ctrl+click and/or Shift+click.
The Cage transform uses Ctrl+click but you have to grab a segment, not a node after that. The Warp Transform is the same.

For Select Shapes and Edit Shapes tools, Ctrl+click has no special action.
If the Select Shapes tool and the Edit Shapes tool also used Ctrl+click in addition to Shift+click then that would give uniformity and not force existing users to change what they’ve already learned if they wanted to carry on using Shift+click for those.

It’s almost 100% perfect already :slight_smile:

Hi guys, thank you @dkazakov for the patch! It runs smoothly, undo works just fine and the tool is very powerful.

Other than this usability/consistency notice that Ahab already said, this tool is insanely powerful and will open a few doors for image warping.

1 Like

Hi, @AhabGreybeard!

Selecting multiple nodes by Ctrl+click does select multiple nodes but if you try to Click+drag one of them, all other nodes become deselected and only the Click+dragged node moves.

Could you please clarify me a bit, what should be an expected behavior for these actions? I think it should work like that:

  1. Ctrl+Click selects multiple points. No dragging is possible when Ctrl is pressed (questionable)
  2. When multiple nodes are selected, normal click+drag on a node/control moves this node/control only. Not the entire selection.
  3. When multiple nodes are selected, click+drag on an empty space in the mesh starts dragging of a selection
  4. When no nodes are selected (only one is selected), ctrl+click on an empty space in the mesh drags entire mesh.

Does it look correct/sane? Or I should change that somehow?

Hi @dkazakov ,

My concern was the difference from the general behaviour with the Edit Shapes tool when it comes to selecting and manipulating nodes. I realise the Bezier Mesh Transform is a new tool and may need to have its own rules and behaviour but commonality of control method is important.
Personally, I’d be happy if the Edit Shapes tool was altered to make it behave the same as the Bezier Mesh Transform tool, where they have common actions.

For your points numbered above, I have the following comments and also make comparisons with the behaviour of the Edit Shapes tool where I think it’s of significance or interest:

  1. I agree about Ctrl+click selecting multiple points and it already does that.

For the Edit Shapes tool when multiple nodes are selected:
Shift+Click+drag on a selected node will deselect that node and drag the other nodes which are still selected.
Shift+Click_drag on a not-selected node will add that node to the selected set and move all nodes.

  1. I’m confused about this.
    Do you mean normal click-drag on a selected node or on a not-selected node?
    For a selected node, I think that all nodes should be moved, which seems obvious.

For a not-selected node, the behaviour of the Edit Shapes tool is to select that node and deselect any other selected nodes and then only move that click-dragged node.

I think it would be reasonable and logical to move the click+dragged not-selected node alone without affecting any already selected nodes.

  1. I agree and it already does this.

  2. I agree and it already does that.

Extra Note:
As a result of changing the Canvas Input settings in the Change Primary Setting group (I changed Shift + Left Button to Ctrl + Left Button) the ‘locked’ point/segment movement no longer happens with Shift+Click+drag.
Is such a change supposed to have an effect on a transform tool action?

Hi, @AhabGreybeard!

I think I have fixed you complaint about the ctrl+click behavior, please check if it works as expected:

Now draging multiselected node will drag entire selection. Though dragging the control handle of a multiselected node will just move the handle, not the selection. I hope it looks sane.

After I’ve done this change, I have a weird concern. Now we have two ways of moving multiselection:

  1. Drag using one of the selected nodes
  2. Drag using empty space inside the mesh

I feel a bit uncomfortable because of this duplication. Does it looks okay for you? Should we probably reassign Shift+patch-click gesture and make it without click? Or just keep it as it is?

PS:

Yes, the shortcuts are actually linked to global canvas actions, not specific modifiers. That is general to all Tool Transform modes.

This is something I always wanted that never existed in a nondestructive manner in FOSS (unless there exists something I don’t know of), thank you for this work. I will use it for sure.

2 Likes

Hi @dkazakov , you’ve been working hard on this so thank you :slight_smile:

It all now works as expected (in my opinion).

It’s not a ‘problem’ as I see it and dragging the empty space is easier than grabbing and dragging a selected node, where you might accidentally click outside the node.

I also note that rotation works with multiple selected nodes.

Special Note:

I’ve had crashes with your first version and with the latest version but I haven’t been able to reliably reproduce them.

The only entry in the log is:

Krita Version: 4.4.1-alpha (git ba9a155), Qt version compiled: 5.12.9, loaded: 5.12.9. Process ID: 6417


09 Nov 2020 20:54:34 +0000: Style: fusion. Available styles: Windows, Fusion

09 Nov 2020 20:55:08 +0000: Created image “Unnamed”, 2048 * 2048 pixels, 100 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 2

KRITA DID NOT CLOSE CORRECTLY

I’ll run it from the terninal a few times and try to get more information

It seems to be associated with using the Edit Shapes tool on a vector layer, which I’ve been doing for comparison of control methods, then going back to a paint layer and using the Bezier Mesh Transform and selecting nodes or adding a segment.
It’s one of those annoying crashes and I’ll let you know as soon as I find anything useful or significant.

Hi, @AhabGreybeard!

Thank you for your testing! I have built you a special package that could help catching that crash. It has debugging symbols, so just run it under gdb and it will give you a backtrace in case of a crash

DBG-DK3: https://yadi.sk/d/IZLD1GMkSt35Pw

Hi @dkazakov thank you for making that build.

I’m aware of the debugger but I’ve never used it or taken much notice of it.
Do I need to run this with any particular command line options or any additional utilities installed?

In the meantime, with all three builds you’ve given so far, I get terminal output showing ‘Indirect leak’ as repeated blocks of similar text. This is after I Quit krita when I’ve been using the Bezier Transform tool on a paint layer and the Edit Shapes tool on a vector layer; as I mentioned in a previous post.

Here is a sample of the terminal output:
https://www.dropbox.com/s/3ety1it3u5rno3t/Terminal-Output-Indirect-Leak.txt?dl=1

Half way through typing this, I’ve had a crash when running from the terminal with the same ‘method’ as before.
Here is the terminal output:
https://www.dropbox.com/s/psnm1pxu7v54zkz/Bezier-crash-Terminal-Output.txt?dl=1

Further note:
I still get loss of transformed content, as described before, which happens when I use the Move tool on the Transform Mask in such a way as to move the image off-canvas, finalise the move and then move the content back on-canvas.

After a restart I’ve just tried using the Move tool on the paint layer to move the painted content off-canvas and it crashed
Here is the terminal output:
https://www.dropbox.com/s/0o5n9mgm1eyw1ji/Bezier-Move-crash-Terminal-Output.txt?dl=1

Good Luck! :slight_smile:

gdb ./krita-xxx.appimage
run

# when Krita crashes, you will see a message in the terminal. Then type
thread apply all bt

# paste the full output to me 

Oh, that is perfectly fine. I’m sorry for that :slight_smile: The package has been done from my local build that has ASAN memory sanitizer enabled, so it will generate a lot of extra debugging in the end.

To avoid that you can run my package with with command line:

ASAN_OPTIONS=detect_leaks=0 ./krita-xxx.appimage

Or just export the variable for the entire terminal session:

export ASAN_OPTIONS=detect_leaks=0

After that is done, Krita started from this terminal session will not detect any leaks anymore.

And thank you for the two attached backtraces, they look very useful! I’ll check them :slight_smile:

Hi, @AhabGreybeard!

I checked this backtrace and cannot understand how it can happen. And I cannot reproduce that either :frowning:

If you manage to reproduce that, try record a video to give me some hint…

Hi @dkazakov

I’ll be able to look at it tomorrow and I have OBS Studio so I’ll try to get a video as well.

It’s very irregular and I have problems repeating it.

Does the Move crash look more understandable?

No, it was just a regular multithreading-related crash when two threads tried to write into the same area… Did you use happen to use transform masks there?

Yes, that was part of Test Plan: 4. Check Move Tool works fine with both layer and mask.
That was the only time it crashed when doing anything involving a Transform Mask and Move actions.

For the other crash, after the first time it happened, I had to try again four or five times to get a crash.

I’ve just run it it under gdb with no problems and I’ll keep trying that.

Something puzzling me is that after doing:
gdb ./krita-4.4.1-alpha-6c22d54-x86_64-dbg-dk3.appimage

It starts ok and then says:
Reading symbols from ./krita-4.4.1-alpha-6c22d54-x86_64-dbg-dk3.appimage…(no debugging symbols found)…done.

I thought that package did have debugging symbols?