GSoC 2021: Curve Improvements: Feedback

Hello everyone! This thread would be dedicated for feedback on the features I will be implementing during the summer. Here’s a link to my proposal.

The design task for the curve edit tool: ⚓ T88957 New Curve Edit Tool
Branch: soc-2021-curves

You can find my weekly reports here where I would be posting my weekly progress.

I would really appreciate all your support in improving this project :slight_smile:

21 Likes

Awesome! I use Flexi Bezier Addon now, which can work well, but it will be awesome to have more built in functions like this!

I also use an addon to let me insert a new Spline Knot/Point into a curve, as you move the mouse over the segments, which is also handy.

4 Likes

Really looking forward to this one! The tool to bevel will save so much time it’s unspeakable lol.

All the best~

3 Likes

Yep. The Flexi Bezier Addon is quite useful. The plan (for now) is for something a little less feature packed but it can grow. Hopefully, it will :slight_smile:

I haven’t seen the other addon you linked. It does seem quite handy. The implementation I’m working on does have the functionality to make a cut but it doesn’t maintain the exact curvature as well as the tool. It’ll likely be worth investing some time on it. Thanks for the link!

4 Likes

Haha, Good to know! And thanks :slight_smile:

1 Like

The design task for the curve edit tool: https://developer.blender.org/T88957

6 Likes

I haven’t follow it so close, I apologize if this was commented already.
I watched this video: https://developer.blender.org/T88957 and I noticed that when you add an intermediate point the curve changes the shape and I think that shouldn’t happen, the handles of that point should be aligned so the curve shape stays intact.

5 Likes

Hello @dilithjay, thanks a lot for putting your effort into this feature, can’t say how much I’m happy this is finally worked on!

I don’t want to give too much feedback without trying the tool first, so here are some thoughts based on the proposal video:

1- Did you consider the idea of having this tool not (only) inside the edit mode but in the object mode toolbar? Even though the tool adds way more immediacy in creating a curve, having it in edit mode means that we would still need to add a bezier curve from the add menu first, enter edit mode, delete it and then use the tool to create the curve we want. Like the newly added “add object tool”, it could be present both in object and edit mode with the same functionalities.

2- I’m not a big fan of the pen icon, for some reason I find it distracting and “less accurate.” I think the edit mode cross icon would fit better with this tool.

3- Still regarding icons, I think it would be good to have more depending on the functionality: one for simply adding a control point, one for making a “cut”, one for removing a point, one for closing a curve, and maybe also one for grabbing control points/handles (I think this would also benefit your idea of having fewer modifier keys to press for the different functionalities).

Probably I’ve already said too much, I admit I’m quite excited about this proposal and can’t wait to try it firsthand!! Thanks!

5 Likes

I agree. The reason it’s as it is is simply because it was easy to get something working upon which improvements can be made. Definitely will be working on that pretty soon. Thanks for the comment!

2 Likes

My pleasure :slight_smile:

  1. I quite like the idea. But, if it’s to work similar to the “add object tool”, I’m guessing only the creation of the curve would be possible while in object mode. I feel like that could/should be a separate tool in itself since I don’t think edits (like in the features I’m proposing) would be made in object mode.

  2. I completely agree that the pen icon is not suitable for this tool. TBH, I didn’t really pay much attention to how it looks (You may have noticed that even the icon on the toolbar is exactly that of the draw curve tool). Just wanted to get something working :-). But I’ll definitely be paying attention to the UI at some point.

  3. I quite like this one too. I think it’ll be a good addition to the tool. Will keep in mind.

Thanks a lot for all the suggestions. And it’s not too much at all. Please keep them coming. The more the better :-).

2 Likes

Yes I meant exactly that, “same functionalities” wasn’t appropriate, I also think any other edit that is not the creation of the curve should be in edit mode.

2 Likes

Right. That makes sense. But like I said, it might be more appropriate as a separate tool since, unlike the “add object tool”, there won’t be much shared functionality between edit mode and object mode. Either way, I wouldn’t mind taking a shot at it depending on whether the others think it’s necessary. For now, I think I’ll stick to the plan on this.

2 Likes

Already nice work… and regarding the comment about “preserving shape of curve” This patch might help you rB8b72d9cc1530 Good luck :slight_smile:

3 Likes

Wow, this might be exactly what I needed. Thanks a lot! I’ll take a look.

2 Likes

Great, really nice to see some improvements to the curve tool. :slight_smile: Thanks for your work.

I am very interested to see a new snap mode for edges. Currently only curve vertices are supported.

Actually I have tried something like this in my script, about create fake snap helpers with mesh objects. But this is a monkey patch, it would be far better if true snapping could be provided out of the box. So many lines of code to do this which is boring.


class SnapUtils:
    def generate_fromcurves():
        '''a selected curve is converted to mesh object'''

        # active object must be a curve
        if not bpy.context.active_object.type == 'CURVE':
            return 'Active object must be a curve'

        # objects selected in object context - all have to be curves
        if True in [x.type != 'CURVE' for x in bpy.context.selected_objects]:
            return 'All selected objects must be curves'

        # remove snap helper if exists
        if bpy.data.objects.get('zzzSnapHelper'):
            bpy.data.objects.remove(bpy.data.objects.get('zzzSnapHelper'), do_unlink=True)

        # remember to restore context
        # (if in edit curve context - remember the state - switch to object context)
        rescon_wasineditmode = False
        rescon_activeobject = bpy.context.active_object
        if bpy.context.mode == 'EDIT_CURVE':
            rescon_wasineditmode = True
            bpy.ops.object.editmode_toggle()

        # duplicate active object
        # (in object mode - selected curve objects are duplicated - joined together if many)
        bpy.ops.object.duplicate()
        if len(bpy.context.selected_objects) > 1:
            bpy.ops.object.join()
        
        # curve resolution
        # (resolution of selected curve must be changed - eg: 3 mesh vertices == 4 curve points)
        snapres = bpy.context.scene.patchmodelingtool.snap_resolution - 1 # reduce one
        bpy.context.object.data.resolution_u = snapres

        # convert to mesh
        bpy.ops.object.convert(target='MESH')
        bpy.context.active_object.name = 'zzzSnapHelper'
        # go to edit mesh mode and remove edges (perhaps will be used later)
        # bpy.ops.object.editmode_toggle()
        # bpy.ops.mesh.select_all(action='TOGGLE')
        # bpy.ops.mesh.delete(type='EDGE_FACE')
        # bpy.ops.object.editmode_toggle()
        # now as in object mode deactivate selection
        bpy.context.active_object.hide_select = True

        # restore context
        # (select previous object - make it active)
        bpy.ops.object.select_pattern(pattern=rescon_activeobject.name, extend=False)
        bpy.context.scene.objects.active = rescon_activeobject
        # (switch back to edit mode - if previously were in edit mode)
        if rescon_wasineditmode:
            bpy.ops.object.editmode_toggle()

    def generate_0():
        mesh  = bpy.data.meshes.new("mesh")             # add a new mesh
        obj   = bpy.data.objects.new("MyObject", mesh)  # add a new object using the mesh
        scene = bpy.context.scene
        scene.objects.link(obj)     # put the object into the scene
        scene.objects.active = obj  # set as the active object in the scene
        obj.select = True           # select object
        mesh = bpy.context.object.data
        bm = bmesh.new()
        # add 1000 random vertices
        for i in range(5000):
            v = (random.random(), random.random(), random.random())
            bm.verts.new(v)
        # make the bmesh the object's mesh
        bm.to_mesh(mesh)
        bm.free()  # always do this when finished

These days I thought of a totally new way of doing the snapping, as a modal operator, and all points right from the memory, no need for any actual temp objects. But anyways… :smile:

Let me know if you have something in mind for future work. I would be interested to see.

3 Likes

First of all, apologies for the late reply. Had a bit of a busy day today.
Correct me if I’m wrong, but if I understood correctly, the suggestion is to allow vertices of a curve to snap onto the actual curve as well instead of just the vertices. That seems quite useful and doable.
I don’t want to promise any features that’s not on the proposal, at least for the summer. But I’m taking note of all these suggestions in case I have time left. In the meantime if you get a chance to work on this further, the contributions are always welcome :slight_smile:
Either way, thanks a lot for the suggestion and the code snippet. It’ll be helpful in case I decide to work on this :-).

2 Likes

Yeah, as for example you can snap only on the “real” curve vertices, those generated on preview not count. However by converting the curve into a mesh fixes the problem, since all mesh vertices are snappable.

I will keep you informed if I come up with something.

Right. Got it.
Yeah, do let me know.

I’m not sure if I understood what the project is about, but I hope that it allows to trace the contours with reference images much easier and less tedious than this:

Good luck with the project.

1 Like

Yes! That’s a good example of where the new curve edit tool would be very helpful. Thanks for the comment!

1 Like