Not the final version of the GSOC proposal uploaded here. Few changes might be needed in the following draft, Feedbacks welcome till then.
Name
Pratik Pandurang Borhade
Contact
-
Blender.chat & Devtalk : PratikPB2125
-
Bug tracker : @PratikPB2123
-
Email – [email protected]
Synopsis
Several users have requested few features as well as proposed some improvements for existing tool options. Most of the code related to the Knife tool is under maintenance for a couple of years. Supplementing some user-requested features to the Knife tool makes it a good candidate for the GSOC project. Having fixed some bugs from the Modelling module, moderately familiar with the code.
Benefits
The project will add valuable features to the knife tool. The entire idea serves to make the Knife tool more powerful. Enhancements will make the tool more dynamic for artists. After the summer, artists can see the knife tool in a good position. Providing diversity in the tool will increase the strength of knife. Apart from tool improvement, I will be doing code clean-up.
Deliverable
- Feature to add shape cuts (rectangle, circle, etc)
- Undo feature
- Improvements for snapping angle
- Integrating measurements and providing scaling option for poly-line cut.
- Multi-object editing (T56948).
- User documentation, code cleanup.
(from artist’s and developer’s feedback so far, I noted some tasks which can be done during the program or after summer, one of them is to support pol-line cut for the object which has edges only)
Project Details
Most of the code I will work on during the summer belong to editmesh_knife.c
.
Shape cuts for Simple Geometry
Usage of the Knife project is time-consuming for simple Geometry shapes. Providing shape functions (Eg. rectangle, circle) will make the job more straightforward. Howard Trickey and Campbell Barton suggest providing a tool option instead of hotkeys, which would be handier. The way existing code works, step-by-step poly-cut needs to be mapped to get an exact shape cut. After a complete cut, call the function BM_face_split_edgenet_connect_islands
to join shape cut with boundary edges. Moreover, the function avoids the generation of loose edges.
Following enum name represents every shape.
enum{
KNF_SHAPE_POLY_LINE,
KNF_SHAPE_RECTANGLE,
KNF_SHAPE_CIRCLE,
}
Undo Feature
The feature will make it feasible to move one step back to the last vertex drawn. The stack data structure we can use here to hold all the drawn poly-edges in sequence. In my opinion, ListBase
could be a good option in that case, since we can store the address of the first and last member of the list. We may not use operator ED_OT_undo
for this feature so need to think for struct which can hold a list of all edges. Because the function
ed_undo_exec
will reference to null data when cut is confirmed or cancel.
With this feature, the user can step back to the previous vertex with ctrl + z
( Note: user can not undo with edit-> undo
because this UI option executes ed_undo_exec
function )
Snapping Angle Improvements
Cian Jinks is working on UI for the snapping angle ( D10853 ) as of now. So the project will concentrate to implement orientation options. The intention is to provide additional snapping options (Global and Object-relative). The code belongs to knife_snap_angle
function for the present snapping angle. Every orientation option requires different logic so will redesign the function.
A quite good vector calculation is expected for implementing snapping modes. With vector direction of Global X-axis and a knife vert, it is possible to draw a preview line parallel to Global X-axis(similar to other axes). With Geometry relative orientation enabled, an edge perpendicular to previous knife edge or boundary edge can be drawn.
Providing a dropdown as a tool option for mode switching.
Integrating Measurements
The task intends to measure the length of the current poly-edge cut. Besides, I have a plan to scale the poly-edge cut by number key input (identical to mesh resizing with number keys. Eg. Select default cube -> key S -> Number key 2
, This will scale the cube to 2 units).
Referring to Vector math, With one fixed vertex with direction and length of a vector, a line is possible to draw in 3D. Relating to the example, in our case fixed vertex is the previous knife vertex, the direction is direction vector of the current knife position and the previous knife vertex where length is number key input.
Multi-object editing
Refer the task T56948 . It supports drawing poly edge cut for more than one object in edit mode. Supporting this feature will lead to important changes in the workflow of the knife tool.
For multi-object editing, KnifeTool_OpData
will require a few changes to store the data of individual objects. I plan to add a new struct that will maintain the data (e.g. BMEditMesh
, kverts
, kedges
) per object. So that every object can have its array of data. Where common properties like only_select
, is_drag_hold
, etc. can be kept in KnifeTool_OpData
. This new structure will be a member variable of KnifeTool_OpData
(Similar to TransInfo
has a member variable of type TransDataContainer
is used to store data of multiple objects).
Project Schedule
Semester exams will be around mid-June otherwise no plans to interfere with the GSOC project. Till the community bonding period, I can utilize my time. I will look into the present code of the Knife tool, will do triaging and bug fixes on the tracker till then. As College is appearing online for the entire semester so I can pull extra time to collect more ideas for the tool improvements.
- Week 1: Adding tool options for shape cuts, working on a basic workflow for this feature
- Week 2-3: Writing actual code for individual shape cuts
- Week 3-4: Working on Undo feature.
- Week 4-5: Improvements for Snapping Angle.
- Week 6: Integrating measurement and scaling improvements for poly-line cut
- Week 7-8-9: In this period I will work on Multi-object editing for the knife tool.
- Week 10: User documentation, code cleanup.
Some tasks may take considerably more-less time than allotted but will complete the task in the same order. I am collecting more ideas from dev talk and RCS which I can take to work further after the program.
Bio
I am Pratik Pandurang Borhade, 2nd year engineering student at VIT, Mumbai (India). I have ample experience with C, C++. Noticed Blender software about a year ago when I was scrolling over the internet for 3D creation software. Using Blender to design meshes, animation, human rig, etc. Apart from Blender I did programming using Unity Game Engine, designed a few mobile applications using Android Studio.
I am contributing to Blender for the past 4-5 months. I do bug triaging in my spare time. As of now, I am a member of the Moderator’s group of Blender. Submitted a few patches. Some got accepted so far ( most from the Modeling module) :
• D10824 (clean-up in editmesh_knife.c
)
• D10763 (fix for mesh size)
• D10699 (fix for grid subdivision count)
• D10497 (selection of non-manifold edge loop)
• D10353 (fix for lattice resolution)
• D10239 (Normalizing weight paint for gradient tool)
Also submitted a couple of patches (D10702 , D10785) but they have not made it to land. So far, it was a pleasant experience for me to help blender. Not major contribution did as of now but it’s satisfying to help countless artists through programming. I will continue my contribution and triaging after the program as well.