Multi-Object-Mode: Edit Curve Tools
Open, NormalPublic

Description

Select Menu:

Curve Menu:

  • CURVE_OT_dissolve_verts
  • CURVE_OT_delete
  • CURVE_OT_spin
  • CURVE_OT_extrude_move
  • CURVE_OT_duplicate_move
  • CURVE_OT_split
  • CURVE_OT_separate
  • CURVE_OT_make_segment
  • CURVE_OT_cyclic_toggle
  • CURVE_OT_normals_make_consistent
  • CURVE_OT_handle_type_set
  • CURVE_OT_tilt_clear
  • CURVE_OT_switch_direction
  • CURVE_OT_subdivide rB17aef80207bcff8bfb58e4da890b7f1310318a4c
  • CURVE_OT_decimate
  • CURVE_OT_hide
  • CURVE_OT_reveal
  • CURVE_OT_hide

Details

Differential Revisions
D3437: Multi-Object-Mode: Edit Curve Tools - CURVE_OT_separate
D3435: Multi-Object-Mode: Edit Curve Tools - CURVE_OT_duplicate_move
D3436: Multi-Object-Mode: Edit Curve Tools - CURVE_OT_split
D3434: Multi-Object-Mode: Edit Curve Tools - CURVE_OT_extrude_move
D3427: Multi-Object-Mode: Edit Curve Tools: CURVE_OT_reveal
D3426: Multi-Object-Mode: Edit Curve Tools: CURVE_OT_hide
D3382: T54643-Multi-Object-Mode: Edit Curve Tools: CURVE_OT_subdivide
D3407: T54643-Multi-Object-Mode: Edit Curve Tools: CURVE_OT_select_nth
D3409: T54643-Multi-Object-Mode: Edit Curve Tools: CURVE_OT_select_linked
D3412: Multi-Object-Mode: Edit Curve Tools - Add test for selected elements
D3309: Multi-Object-Mode : Edit Curve Tools add support for CURVE_OT_decimate
D3277: Multi-Object-Mode: Edit Curve Tools add support for Select More
D3275: Multi-Object-Mode: Edit Curve Tools add support for Select Previous
D3274: Multi-Object-Mode: Edit Curve Tools add support for Select Next
D3272: Multi-Object-Mode: Edit Curve Tools add support for (De)select Last
D3271: Multi-Object-Mode: Edit Curve Tools add support for (De)select First
D3270: Multi-Object-Mode: Edit Curve Tools add support for Select Similar
D3263: Multi-Object-Mode: Edit Curve Tools add support for Select Linked All
D3262: Multi-Object-Mode: Edit Curve Tools add support for Checker Deselect
D3258: Multi-Object-Editing : Add layer utility macros to edit curve select
D3259: Multi-Object-Mode: Add support for Curves (De)select All
D3260: Multi-Object-Mode: Edit Curve Tools add support for Select Random
D3278: Multi-Object-Mode: Edit Curve Tools add support for Select Less
D3282: Multi-Object-Mode: Edit Curve Tools add support for Delete
D3286: Multi-Object-Mode: Edit Curve Tools add support for Split
D3281: Multi-Object-Mode: Edit Curve Tools add support for Dissolve Vertices
D3288: Multi-Object-Mode: Edit Curve Tools add support for Subdivide
D3287: Multi-Object-Mode: Edit Curve Tools add support for Switch Direction
Type
Bug
Campbell Barton (campbellbarton) triaged this task as Normal priority.

When in edit mode I'm not able to select multiple control points. I have to do the following as a work around.

  1. In Object Mode select a Bezier Curve
  2. Switch to Edit Mode and select the Control Points
  3. Switch back to Object Mode and select another Bezier Curve
  4. Switch to Edit Model and select the Control Points
  5. Switch back to Object Mode and Select both Bezier Curves
  6. Switch back to Edit Mode and perform the operators.

The expected behavior

  1. Select the Bezier Curves
  2. Switch to Edit Mode
  3. Select Control Points from any Bezier Curve selected

Default colors make it hard to distinguish between selected and none selected Control Points

Default

Versus one with more contrast

@Guy Boicey (stealthtech)

The patches overall are fine, but we need to skip the for loop when there is no selected elements. There is no equivalent of totvertsel/edge/face in curves. You need to add this (as its own patch), so we can proceed with the other patches? It should be straight forward.

@Dalai Felinto (dfelinto)

It should be straight forward but it is not, which is because I'm a noob at this.

First question what would justify that this would need to be a separate patch? Would I update my existing patches? How do I do this? I'm lost on this one. I was working on some other pieces of code and lost my updates and I don't want that to happen again. On a side note, the YouTube video which lead me here was awesome, great job. If there was one that covered end to end on how to actually do these patches, with git and diffing and branching would be great. The documentation is good otherwise I would not have gotten this far, but a video like a picture says thousands more words than words themselves. Teaching by example is great and your video did some of that, just some parts where left out. This could also be part of this as well how to make an update to a patch after being submitted.

Before I dive into making all sorts of code changes I want to share my thoughts and my direction. I see that most functions do something similar to this:

ListBase *editnurb = object_editcurve_get(obedit);
Nurb *nu;
for (nu = editnurb->first; nu; nu = nu->next)

My thoughts are that this could be the basis for the test. Now what would that test would be I don't know? Is it testing if editnurb is NULL? Is it to test if editnurb->first exist? Or do we go deeper than this and add something similar to tot...sel?

How do you test if two vertices are selected for such functions as subdivide?

And my last question, which I think I know the answer which is performance. Why was there no test before Multi-Object-Mode and why does there need to be one now? I'm guessing performance, you don't want to do a loop on N objects if you don't have to where as before Multi-Object-Mode there was only one.

I think I might have found something would this work? I applied it to a few operations with some test output and looks to skip curves that have no selected control points.

if(!ED_curve_nurb_select_check((Curve *)obedit->data, object_editcurve_get(obedit)->first)) {
    continue;
}

In some function you can use declared varialbes for example in the curve_dissolve_exec

for (uint ob_index = 0; ob_index < objects_len; ob_index++)
{
    Object *obedit = objects[ob_index];
    Curve *cu = (Curve *)obedit->data;
    ListBase *editnurb = object_editcurve_get(obedit);
    if(!ED_curve_nurb_select_check(cu, editnurb->first)) {
        continue;
    }

    .
    .
    .

And for operations that require more than one I could use ED_curve_nurb_select_count?

For example subdivided_exec

if(!ED_curve_nurb_select_count((Curve *)obedit->data, object_editcurve_get(obedit)->first) < 2) {
    continue;
}

Same here in MetaBall
https://developer.blender.org/T54649

i am waiting @Dalai Felinto (dfelinto) to clarify what he means..
because i am thinking we need to implement somthing like tot...sel....

To use ED_curve_nurb_select_check and ED_curve_nurb_select_count don't you need to cycle through the Nurbs to know if any of it is selected?
e.g.: for (i = 0, nu = editnurb->first; nu; i++, nu = nu->next) ?

This is where an util like what @Campbell Barton (campbellbarton) did for metaballs can be handy.

First question what would justify that this would need to be a separate patch?

We try to have git commits as atomic as possible. That said it is ok if it is part of one of the patches, but afterwards you still need to update the remaining patches to use it.

@Dalai Felinto (dfelinto) is there a way to get the count in the style that @Campbell Barton (campbellbarton) did with the metaballs without cycling through the Nurbs? (Checking the f1 at each point)

@Dalai Felinto (dfelinto) you are correct we need a function that iterates through editnurb for a given Curve and check if any are selected. I wrapped the body of ED_curve_nurb_select_check with a loop for (const Nurb *nu = cu->editnurb->nurbs.first; nu; nu = nu->next). Other parts of ED_curve_nurb_select_check depend on the Curve so I figure pass in the Curve instead of editnurb.

I followed the naming conventions and locations like the ones for metaballs, created bool BKE_curve_is_any_nurbs_selected(const Curve *cu) located in /blender/source/blender/blenkernel/intern/curve.c. I figure those things along with the place of the code is trivial and if needs to change someone else can do that.

If this is acceptable then I will make changes to the function to skip if not selected elements.

https://developer.blender.org/D3412