GSoC 2021: Knife Tool Improvements: Weekly Reports

Week of July 12th - 18th

This week I worked on a lot of small quality of life improvements and bug fixes relating to the features I have implement so far.

Notes

  • Undo
    • Fixed visible distance and angle measurements being broken after an undo operation
    • Fixed bug with undo when cuts were created with cut-through enabled
      • Previously some cut segments would not be deleted
    • Dragged cuts are now entirely undone, as opposed to segment by segment as it was before
    • Fixed bug where cut segments drawn along mesh edges could not be undone
      • Removed the ability to create cut segments between mesh vertices as this was redundant in practice
  • Depth Testing Toggle
    • Pressing ‘V’ will now enable “Depth Testing”
    • This hides any cut segments which are blocked from view by objects in the scene
  • Midpoint Snapping
    • Moved midpoint snapping to ‘SHIFT’ keys default
    • Moved ignore snapping to ‘CTRL’ keys by default
    • This solves problems relating to undo outlined in last week’s report

Next week I plan to implement snapping to a given distance and add support for multi-object edit mode to the knife tool.

Media

Undo working with cut-through:
week6_1

Undo with drag cutting:
week6_2

Undo with cuts drawn along mesh edges:
week6_3

Toggling on and off Depth Testing:
week6_4

22 Likes

Great improvement, I have a suggestion, can you implement this feature from “PolyQuilt”?

Knife

12 Likes

I like the idea of having configurable snapping increments along an edge as you show. However, I am not sure if there is enough free time in my project schedule to add this feature. If you submit it as a feature request to rightclickselect maybe I or someone else in the future will be willing to spend some time to implement it.

12 Likes

Thank you, I submitted this idea 1 year ago ( Right-Click Select — Blender Community).

3 Likes

THis would be Frikkin Osom! <3 +1

Week of July 19th - 25th

This week I almost solely worked on multi-object edit mode support for the knife tool. It proved more challenging than I initially expected and I spent a lot of time trying various ideas for implementing it. In the end, I found a solution I was happy with and have committed it to the soc-2021-knife-tools branch.

Notes

  • Multi-Object Edit Mode
    • Added support to the Knife Tool
    • Cuts can be made on all object’s while using the knife tool in multi-object edit mode
    • A cut which starts on a given object can only cut/interact with that object’s mesh
    • A cut which starts in space can only cut/interact with the object that was last hovered by the mouse before starting the cut
      • I feel it would be better to be based on the nearest object to the mouse while cutting, but a short attempt at implementing this showed it would take large changes to make work

Next week I am going to add multi-object edit mode support to the knife project tool and an edge removal mode for the knife tool.

Media

week7_1

Cuts starting in space work on last object hovered:
week7_2

When two objects intersect the object to cut is based on the nearest mesh edge to the cut start:
week7_3

24 Likes

Why not allow cutting on all selected objects ?

5 Likes

I realise it would be miles better to be able to cut on multiple selected objects with one cut and I am unhappy that it does not. I should have clarified why it only works on each object seperately in the report, so I will do here.

Mainly, it is a limitation of the way the knife tool is already designed. Without going into too much technical details (unless that is preferred?), to have a semi working version of the knife tool in multi-object edit mode completed within a week I had to implement it this way. I believe the way the knife tool currently works would have to be massively changed to allow cutting of all objects with each cut (a similar problem is this) and I am not familar with the areas of blender’s codebase that would make this work.

I am sorry I could not deliver a better version where all objects could be cut simultaneously. I hope at least I was able to lay a foundation for someone with more experience and more time than me to come in and rework the necessary things to make the knife tool work in such a way.

16 Likes

Oh don’t be so apologetic, it’s nice as it is already. Thanks for the explanation, yes it is super interesting !

4 Likes

Week of July 26th - August 1st

After receiving feedback on last week’s report and discussing further with my mentor we have decided to make some changes to the plan for the remaining two weeks of the GSOC coding period.

Test Build

I will now be releasing a build of my branch soc-2021-knife-tools each week for everyone to help test by searching for bugs and provide feedback on the features I have implemented.

Please share any feedback you may have on my feedback thread. I will work on fixing any bugs found or making any suggested improvements over the next few weeks, alongside the plan discussed below.

New Plan

Based on feedback from last week, I am going to spend the rest of the GSOC period focusing on re-implementing a better version of multi-object edit mode support. The goal is to allow cutting across multiple objects in the scene and making cuts from one object to another. This will require a complex re-write of large parts of the Knife Tool code but should make it possible to implement much more useful features in the future as well.

The plan to implement edge removal mode has been abandoned as it seemed a rather niche feature now that undo is implemented. It also became clear that multi-object edit mode support for the knife project tool already exists in that you can use multiple objects for projection. There is no way to differentiate between objects being projected onto and being used for projection and so this feature is not necessary.

29 Likes

Final Report

The GSOC coding period has officially come to an end as of this week and I have posted my final report over on the wiki. I apologise for the lack of a report last week, I spent the entire week working on a foundation for better multi-object edit mode and decided it was best to wait for more feedback about the build that I posted before making a report.

This report contains a list of various bug fixes and additions I have made as a result of feedback about last week’s build as well as a new build for testing. I will also discuss the plan going forward.

End of Coding Period

Now that the official coding period has come to an end I will no longer be implementing any new features. My plan now is to spend some more time fixing any further bugs / minor improvements given as feedback about the latest build. I am going away on holidays this upcoming week and so will be slow to respond until after I return.

I will also discuss further with my mentor about continuing work on a better multi-object edit mode as well as beginning the process of merging my changes into master.

New Build

The new build of my branch soc-2021-knife-tools is now available on: Blender Builds - blender.org

Patch notes since the previous build are outlined below and once again I would appreciate it if you shared any feedback you may have about this latest build on my feedback thread.

Notes

  • Angle Snapping Improvements
    • “Local Angle Snapping” renamed to “Relative Angle Snapping”
    • Relative Angle Snapping now works with existing mesh edges
    • Fixed bug where it did not work with rotated objects
      • Caused by custom knife BVH code
    • Input snapping increment multiple times via number keys
      • Cannot input numbers with decimal point, this can be done with the value exposed in knife tool settings
    • Use alternate edges for Relative Angle Snapping
      • Current edge is highlighted in yellow
      • Press ‘R’ to cycle between edges
      • Angle measurement’s are always drawn to currently selected edge
  • New Knife Tool Settings
    • Select between default angle snapping modes of None, Screen or Relative
    • Select between default measurement modes of None, Both, Distance or Angle
  • General Improvements
    • Depth checking mode renamed to “X-ray”
      • Press ‘V’ to activate
      • ON/OFF make more sense now
  • Better Multi-Object Edit Mode
    • New custom Knife BVH is in use
    • Lays the foundation for cutting across multiple objects in multi-object edit mode
      • Not yet implemented

Media

Alternate edges for relative angle snapping (cycling through edges using ‘R’)
week8_1

week8_4

New tool settings
week8_2

week8_3

week8_5

37 Likes

congratulations! Great to see the improvements in your reports

3 Likes

Great! It seems, “Relative” term snapped perfectly.

4 Likes

Project Update

Merge

I am super happy to announce my Knife Tool Improvements Project has now officially been merged into master! ⚙ D12600 GSOC 2021 Knife Tool Improvements Project

Over the coming weeks I will be focusing on responding to and fixing various bug reports that come in. If you find a bug with any of the changes detailed within this thread then please submit a ticket on developer.blender.org and tag me as a reviewer (otherwise tag the project as modelling). The latest build of master can be downloaded under “Alpha” on Blender Builds - blender.org.

Better Multi-Object Edit Mode

A variety of changes and bug fixes have been made ahead of merging into master. The largest change has been the addition of a better multi-object edit mode. It was clear from user feedback that my previous implementation was unsatisfactory and so I set out to make it work as expected.

Demonstration
demonstration

Orientation Snapping w/ Multi-Object Edit Mode
Takes the local orientation of the object the cut segment was started on:
orientation_snapping

Complex Meshes
complex

Notes

The one change I did not manage to complete is in regards to relative angle snapping. As it is in master, relative angle snapping is still limited to the existence of an adjacent face to the relative edge which is being used. This is not the greatest implementation and will need to be updated in the future, but as it is it does still allow for making more precise cuts.

There are also still some minor visual bugs with orientation snapping which will be fixed soon.

Wrap Up

Lastly, I just wanted to say I have had an amazing time working on Blender and thank everyone for their support. Seeing the things people create with Blender is one of the best parts and I intend to continue doing what I can for Blender when I find time!

50 Likes

Thanks for all of your amazing work, let’s also not forget undo improvements, that is a long-awaited lifesaver! Kudos to you for managing to implement everything in time for 3.0!!!

10 Likes

Just… thank you man…

4 Likes

Congrats ! thanks for this amazing contribution !

2 Likes

Thank you so much for your work. I tried everything out in master today, and the changes are perfect!
I have a question though


It would be nice if the axes for the knife tool could be changed in the keymap section in preferences.
I usually change my Y axis to “C”, so overall it is “ZXC”, as they are all beside each other. Just a small preference of mine, and I would love to be able to do that for the knife tool as well. Would this be possible?

As well, I would like to add that snapping to an axis on my computer seems to be quite sluggish, there is a palpable lag when switching between them. Is this operation running on the CPU or GPU? I am running an AMD Ryzen 7 2700x 3.70GHz, but a very old terrible Radeon card atm moment.

4 Likes

Thank you! I will see what I can do about the things you have reported.

1 Like

XYZ axis locking is now exposed in the knife modal keymap.

With regards to axis locking feeling sluggish, I have no such problems on my computer, would you be able to share a video/gif showing what you mean? I will try see if I can use a low power computer to test it out soon.

5 Likes