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
Cuts starting in space work on last object hovered:
When two objects intersect the object to cut is based on the nearest mesh edge to the cut start:
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.
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.
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.
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’)
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
Orientation Snapping w/ Multi-Object Edit Mode
Takes the local orientation of the object the cut segment was started on:
Complex Meshes
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!
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!!!
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.
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.
I start by showing the speed on my computer of normal translation axis switching, then move on to the knife tool. I am choosing an axis, then immediately changing it to local, and you can see it takes some time.
And sorry I forgot I switched to a really old Nvidia card. My good graphics card broke.
I tried out the Knife Tool in Master last night before bed. Have to say, I am impressed! Lots of great quality of life changes if you ask me and it is honestly an excellent upgrade over the old one.
That said, there are a couple of things I think could be improved. For one, you can’t actually change any settings in the toolbars while in “Cut Mode”. Right now there are two states when you are either inside or outside of this mode, meaning that unless you cancel yourself out you can’t interact with anything in Blender. The mouse cursor icon definitely needs new icons which show when when the tool is active and inactive, since there are multiple times where I have been confused by how I can’t click on any tools in the left toolbar or change the Cut settings in the top toolbar (this affects other Blender panels like Preferences as well, which makes it impossible to get out of Cut Mode if you don’t press the right Cancel assigned button). I think clicking outside of the 3D Viewport should cancel Cut Mode regardless of what my Keymap looks like, since you can actually lock yourself out from using all of Blender if you potentially remove all Cancel actions in the Keymap (was customizing the tool and took notice of this while working on it).
My other critique is that pressing undo after removing all cuts except the source doesn’t cancel you out of Cut Mode. To me it doesn’t feel right that undo just stops working after undoing every cut. It would feel a lot better if everything went back to standard Edit Mode once reaching the beginning of the cut chain so the normal Undo started working. I tried changing this myself in the Keymap, but it only worked properly while using “Double Click”. That however came at the cost of ruining the new Undo system you made by cancelling all cuts if I tapped ctrl+Z too fast.
Btw, regarding the shift modifier snapping cuts to the mid point of an edge, is there a way to make a clean straight cut while only snapping the end point to the middle of an edge without affecting the other cuts? Don’t know if that is actually possible yet, so just wanted to ask. ^-^
This is due to the way Blender’s operators (and by extension, tools) work. With the way the knife tool is designed there is no easy way to fix this at the moment. To allow you to interact with the UI your current cut would have to be thrown away. A different icon is potentially an idea, but I am not even certain if that is possible either.
I agree that it should cancel you out and will change it.
This is not possible at the moment, however it could be added in the future.
Well, I would be content with just having the cut be thrown away as long as the rest of Blender becomes responsive. Being locked out from the rest of the program because of one tool just doesn’t feel right. Not to mention the potential of perma-locking yourself if you accidentally remove all Cancel commands in the Keymap. That said, you are the dev, so you know best here. I can only give my thoughts on the matter. ^^;