GSoC 2021: Curve Improvements: Weekly Reports

Hello everyone! This thread would be dedicated for posting the weekly reports regarding my progress with this project. The proposal can be found here.

There is also a thread dedicated to feedback so please post your feedback there. It would really help me to improve this project.

Progress (until June 7th)

I worked on the project during the past couple of months (I had some free time :slight_smile: ) and I have working implementations (more or less) of the two features I planned (see proposal). Note that it’s far from complete and has a lot of room for improvement. Especially the bevel tool which has a significant amount of work to be done from the side of UI.

8 Likes

Week 1 (June 7th to June 13th)

  • Created a design task: ⚓ T88957 New Curve Edit Tool
  • Created a branch: soc-2021-curves
  • Started working on improving new curve edit tool.
  • Minor refactoring of the existing implementation of the curve edit tool.
  • Renamed the tool in the implementation as Curve Pen. The name may or may not change in the future, but for now, I will refer to the tool as Curve Pen.
  • Began working on a more efficient way of identifying the location of the cut on the curve.

Here’s a small demo of the Curve Pen that I made for the design task.
curve-edit-tool-demo

Plan for next week

  • Complete the implementation of the more efficient method mentioned above.
  • Refactor the code by breaking up into smaller functions.
  • Try using modal keymaps instead of hard coded key bindings.
18 Likes

Week 2 (June 14th to June 20th)

  • Implemented a more efficient method to identify the location of a cut.
  • Refactored to move methods out of the modal method such that it’s more understandable.
  • Added modal map support.
  • Addressed several build warnings and style guide issues.
  • Fixed a bug where moving the mouse fast while dragging a control point makes the cursor lose track of the control point.

Plan for next week

  • Begin working on shape preserving cuts.
  • Further refactoring.
13 Likes

Week 3 (June 21st to June 27th)

  • Added support for shape preserving cuts (See gif below).
  • Fixed bug where cuts don’t work on cyclic curves.
  • Fixed bug where pressing shift while moving a control point turns its handle to free.
  • Fixed bug where a cut near vect handles alters shape.
  • Fixed bug where points were added in relative coordinates instead of global coordinates.
  • Cleanup: Refactoring and commenting

curve-pen-shape-preserving

Plans for next week

  • Look into any other improvements to the tool (e.g.: completing open curves to form cyclic curves)
  • Get started with the second tool (bevel like rounding of curves).
26 Likes

Week 4 (June 28th to July 4th)

  • Some discussing took place regarding the shortcut for closing curves. There are several options for this but none of them seem optimal. It would be helpful to hear any thoughts regarding the following options or any other suggestions for a shortcut. Please post them in the feedback forum):
    • Ctrl + click and drag from one end point to the other: The issue with this is that both deleting a point and making a cut on the curve are assigned to Ctrl+Click.
    • Click end point consecutively to close the loop: The issue with this is that selecting a point is also set to left click. So if someone wishes to select an end point after another they would either have to select something else or deselect before selecting which isn’t too bad but it’s not too intuitive.
  • There was also a bit of discussing on what could be done for the problem of functionality being re
  • In a previous discussion it was decided to implement the “bevel-like rounding of curve corners” tool as a geometry node. Furthermore, it would be named as Curve Fillet. Accordingly, I would be following this design task for the implementation.
  • Started working on the Curve Fillet node. Took some time to familiarize myself with the geometry nodes code and the C++ curve data structures. Currently working on the implementation.

Couldn’t get a lot done during the last week due to exams. Hoping to catch up this week.

Plan for next week

  • Continue to work on the Curve Fillet node.
10 Likes

Hi Dilith, my name is Peter Pienkowski; I’m the technical director from Elliott Animation in Toronto, Canada. We are also working on curve tool improvements, similar to yours. I’d like to offer you to take a look at what we are doing and approaching our development. You might be interested in the curve cutting tools we have.

8 Likes

Hi, Peter. Thanks a lot for the offer! I think it would be very helpful to have a look at what you’re working on. Could you direct me to where I need to look? Thanks!

Hi Dilith, could you please email me at petersworkaddress@gmail.com I would like to send you some footage of what we have, and if anything catches your interest, we can take it from there.

1 Like

Week 5 (July 5th to July 11th)

For the entirety of this week I worked on the Curve Fillet node. So far, the following is the design for the node (Pay no attention to the names of the fields; they’ll probably change :slight_smile: ).

  • Mode can be one of 2 values:
    • Adaptive: This enables the Angle field. In this mode, the number of points per segment is automatically adjusted based on the angle formed by the corner.
    • User Defined: This enables the Count field. In this mode, the user can specify the number of points per corner and all fillets would have the same count.
  • Radius Mode can be one of 2 values:
    • Float: This enables the Radius field. This can be used to define the radius of the fillet formed. The float shall be used by all corners.
    • Attribute: This enables the Radii field. This can be used to specify the distribution of radii for the entire curve.
  • Currently, I am using the curve’s built-in radius attribute to create a custom attribute (because I had an issue where built-in attributes weren’t detected) which defines the fillet radius for each vertex (see gif below). Ideally, an independent attribute should be definable using which the fillet radius can be defined for each vertex.
  • At the moment, the implementation only supports addition of a single vertex but it should be able to support the addition of multiple vertices before long.

demo1

There is a minor issue (mathematically) where the ends of the created arc aren’t parallel to the adjacent sides (See bottom right vertex in the gif above). However, this should be a fairly straight forward fix.

Plan for next week

  • Fix the incorrect arc issue and issue with inability to accept built-in attributes directly.
  • Work on creating fillets with higher resolution arcs.
22 Likes

Week 6 (July 12th to July 18th)

  • Fixed previous week’s issues.
  • Added support to fillet Poly splines (See gif).
  • Added support for circular arcs with multiple points: both adaptive and user defined (demonstrated in the gif using Poly splines because it’s easier to notice the difference).

2021-07-19-08-28-12

As seen on the gif and in the image below, there can be situations where the specified radius cannot be fitted on to the given corner (note in the image that the radius is 1.380 while the height is only 1). The solution for this should be decided on. An option is to clamp the radius before it exceeds the maximum radius. Other suggestions are appreciated.

Plans for next week

  • Look into handling Bezier curves of auto and align types (currently, the result makes sense only for vector and free types) and NURBS curves.
  • Decide on what to do regarding radii that are too large.
  • Test Curve Pen tool and ensure functionalities work consistently.
25 Likes

Week 7 (July 19th to July 25th)

  • Added functionality for handling Auto and Align type handles (it may undergo further changes so I won’t post a video yet)
  • Searched on how NURBS curves can be filleted. The implementation isn’t trivial so currently it’s handled similar to Poly splines (which doesn’t give an exact circular arc). Eventually, it should support exact circular arcs, but with the time constraints, it may be looked into after the summer.
  • Tested Curve Pen and increased threshold for curve cut and vertex delete.

Plan for next week

  • Look into what changes need to be made to handle auto and align handles in the curve fillet tool.
  • Look into implementing additional features for the curve pen tool suggested by users. One such functionality I’ll be looking into would be to alter the curve by dragging the curve itself rather than using its control points.
26 Likes

Week 8 (July 26th to August 1st)

  • Added functionality to close a spline by selecting two end points consecutively. Note that this would mean that, in order to select an end point while the other endpoint is selected, the user has to select a different point prior to selecting the endpoint. (See first gif)
  • Added functionality to alter a segment by clicking and dragging on the spline. (See first gif)
  • Added a checkbox to limit the radius in the curve fillet node in case overlapping is undesirable. (See second gif. In it, I increase the float radius. Notice that the radius is skewed towards the larger angle when the radius increases a lot. This is because the smaller angle would reach its limit faster than the larger angle. I’ll be looking into this the coming week.)

pen_cycle_move

fillet_overlap

Plan for next week

  • Look into the limit radius behavior.
  • Begin submitting patches for code review.
23 Likes

Week 9 (August 2nd to August 8th)

  • Added support for Poly and NURBS curves in Curve Pen. All functionality works similar to Bezier splines without the handle interactions. For making a cut on a NURBS spline, the poly-like lines need to be Ctrl clicked instead of the spline itself.
    curve-pen-NURBS

  • Fixed the issue with limit radius behavior. The shape of a segment after hitting its limit would be dependent on the ratio between the radii of the adjacent control points. The control point with the larger radius would get a larger portion of the segment.

  • Submitted patches for the Curve Pen (⚙ D12155 Curves: Curve Pen) and Curve Fillet Node (⚙ D12115 Geometry Nodes: Add curve fillet node).

  • Created an Experimental Build for the Curve Pen (found in Blender Builds - blender.org under branch name: soc-2021-curves). Note that it currently doesn’t build on Mac due to a bug in the master branch. I’ll update this post once its ready. For now, it should work fine for Windows and Linux.

Plan for the next week

  • Make changes according to code reviews on the patches.
  • Further testing.
25 Likes

3 posts were merged into an existing topic: GSoC 2021: Curve Improvements: Feedback

Week 10 (August 9th to August 15th)

  • Most of this week was spent on improving the curve fillet node code based on feedback on the revision. However, most of these changes shouldn’t affect the overall behavior of the tool.
  • Made vertex dissolve as the default behavior of delete vertex in curve pen.
  • Fixed bug where cuts cannot be made near control points due to cut distance not scaling with zoom level.
  • Other refactoring of the curve pen code.

It’s officially the end of the coding period but there are still some improvements left to be made, mainly to improve the code quality based on feedback on the revisions. So that’s the main plan for the next week and likely a few weeks following the next. I’ll post updates here or the feedback forum if anything new happens. Hopefully, I’ll be able get these . Additionally, I hope that people would get a chance to test out the builds (both available at Blender Builds - blender.org under the names: soc-2021-curves for the curve pen and soc-2021-curve-fillet for the curve fillet node) and provide feedback on what needs to be improved and whether there are any bugs/issues. I likely won’t be making any large changes in the upcoming weeks but I’ll definitely try to fix any bugs that may be encountered. Thanks for all the support so far!

19 Likes

Nice job! Do you have any estimate when this functionality will land in the Blender Master?

Thank you! I think the curve fillet node might be merged fairly soon. I’m hoping within one or two weeks. The curve pen tool still has a fair bit to go. Not sure how long that’ll take since the focus was mostly on the curve fillet node so far (although there were a few improvements for the curve pen tool which I’ll summarize the next time I post). Hopefully, that too wouldn’t take too long :slight_smile:.

9 Likes

Thanks for the great work! :slight_smile:

2 Likes