31
$\begingroup$

For example, in inkscape you can double click to add a new control vertex:

enter image description here

Is there a way to do that in Blender?

The closest thing I have found so far is CtrlLMB, but it just adds an unconnected vertex under the cursor.

Is there a way to add a connected vertex at a specific point along the curve, preferably without deforming the curve?

$\endgroup$
  • 1
    $\begingroup$ You can choose two points, press w and then subdivide. That will create a new connected point in between two segments. $\endgroup$ – user1853 Apr 22 '14 at 22:23
  • 1
    $\begingroup$ @cegaton Yes, but it's not very fast (it requires selecting two vertices first). Is there a faster way? $\endgroup$ – gandalf3 Apr 22 '14 at 22:47
  • 1
    $\begingroup$ I have written a bezier splitting functions and could hack it into a modal operator. Do you still need it? $\endgroup$ – Leander Jul 6 '19 at 19:06
  • $\begingroup$ @Leander I would still be very interested in a working implementation, yes. I don't need it right now though, so don't worry about hacking it together if you don't want to ;) $\endgroup$ – gandalf3 Jul 7 '19 at 4:33
  • 1
    $\begingroup$ I'm ok doing this, it just something I can do to contribute to the open source project. $\endgroup$ – Leander Jul 7 '19 at 15:58
39
+500
$\begingroup$

You can script this functionality with python and install it as an addon.
I have created such a script. Many thanks to Andrew Yang, who updated it to work with Blender 2.8x

Curve Edit Tools

Github download link

To use the addon, press I in the edit mode of a curve. You'll be prompted into a modal operation where you can slide a new control point along the curve.

addon in action

The original answer is below, it doesn't cover all the features of the current addon, even the point sampling will be replaced soon. The revision history shows the old addon for 2.7x.


The first step is to import some moduls.

  • bpy Interaction with Blenders data and operations
  • bgl Blenders OpenGl wrapper
  • blf Module for font drawing
  • numpy as np Matrix handling, used for mathematical vector operations
  • mathutils Use to create the mathutils.Vector

Create a Bezier class

A cubic bezier is a very simple mathematical construct.

It needs four points.

0: first control point. 1: first handle (right_handle) 2: second handle (left_handle of second point) 3: second control point

formula

The Casteljau algorithm illustrates how points on the curve are found. The formula takes a t in [0; 1].

casteljaus algorithm

To split the curve at a specific t, we can use the method from this answer. Since we use numpy, we can use the points as points.

class CubicBezier(object):
    def __init__(self, points):
        self.points = np.array(points).astype(np.float32)

    def at(self, t):
        pt =  1 *        (1 - t)**3 * self.points[0]
        pt += 3 * t**1 * (1 - t)**2 * self.points[1]
        pt += 3 * t**2 * (1 - t)**1 * self.points[2]
        pt += 1 * t**3              * self.points[3]
        return pt

    def split(self, t):
        p1, p2, p3, p4 = self.points
        
        p12 = (p2-p1)*t+p1
        p23 = (p3-p2)*t+p2
        p34 = (p4-p3)*t+p3
        p123 = (p23-p12)*t+p12
        p234 = (p34-p23)*t+p23
        p1234 = (p234-p123)*t+p123

        return [p1,p12,p123,p1234,p234,p34,p4]

Next, we need to sample the point closest to the mouse position. Using this algorithm, pick discrete samples and convert them into the 2d region
closest distance

Thats basically everything from the maths side, now just wrap it in a modal operator.

Here is an example of a modal operator drawing in the 3D View.

| improve this answer | |
$\endgroup$
  • 3
    $\begingroup$ Wow, works like a charm, and a fantastic example of how to write a modal operator! Thanks! Have a "second upvote" :) $\endgroup$ – gandalf3 Jul 10 '19 at 19:43
  • 2
    $\begingroup$ Should be much more UV! Thanks @Leander. $\endgroup$ – lemon Jul 10 '19 at 19:48
  • 1
    $\begingroup$ Bookmarked. Exemplary. So much to learn from just one answer. $\endgroup$ – Robin Betts Jul 11 '19 at 22:33
  • $\begingroup$ @gandalf3 The influx of imaginary internet points has motivated me to improve the addon. I have now incorporated your main point: not having to select anything, before the insert. The selection of the splines is now more complex and has its settings in the user prefs. Comment, if there are segments of code, which I should explain. I admit, the code is not at all well documented or easy to read. $\endgroup$ – Leander Jul 14 '19 at 16:41
  • $\begingroup$ @Leander Fantastic, that speeds up the workflow a lot, thanks :D $\endgroup$ – gandalf3 Jul 15 '19 at 1:44
18
$\begingroup$

According to the Blender documentation for Bezier curves and NURBS curves there is no way to add a new point between two existing points without using the subdivide mechanism (selecting two or more points on the curve, W, Subdivide.

I too wish that there were. Perhaps sometime in the future.

| improve this answer | |
$\endgroup$
0
$\begingroup$

With the last vector in the curve selected, press E for Extrude.

Blender will produce a new vector and attach itself to the cursor. You can move the new vector and left-click to place it.

| improve this answer | |
$\endgroup$
  • 5
    $\begingroup$ Pressing E on a control vertex that is already connected to two other cotrol vertices, will result in a disconnected vertex. Not quite what the OP is asking. $\endgroup$ – user1853 Jul 6 '19 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.