Maniphest T54648

Multi-Object-Mode: Edit Curve Tools
Closed, Resolved

Assigned To
Campbell Barton (campbellbarton)
Authored By
Campbell Barton (campbellbarton)
Apr 16 2018, 12:58 PM
Tags
  • Code Quest
Subscribers
Campbell Barton (campbellbarton)
Dalai Felinto (dfelinto)
Daniel Griffin (dgriffin91)
Duarte Farrajota Ramos (duarteframos)
Guy Boicey (stealthtech)
Habib Gahbiche (zazizizou)
Nick Milios (semaphore)

Description

Select Menu:

  • CURVE_OT_select_all rB170dd30881db57adda39d890499e2510fcaced82
  • CURVE_OT_select_random rB4e14437cb0ab4beb3a4d4206ac0330a311cbb4c7
  • CURVE_OT_select_nth rB47afabbb429d0fa67c858eb5031818122d37745c
  • CURVE_OT_select_linked rB647232f7f16c9fa623a3cde92e4dfa9073c141cc
  • CURVE_OT_select_similar rB4e9911663a22766f6751d33ae84c1ebcc1fae559
  • CURVE_OT_de_select_first rB9d9d44dbcb18aa1e08fee2119b2ea434189f78bd
  • CURVE_OT_de_select_last rBdf613a52e66676e514fa3241533780cdcc636a9a
  • CURVE_OT_select_next rB95150b8414c119b4acb8f26fd19e800e5c42e4a0
  • CURVE_OT_select_previous rB95150b8414c119b4acb8f26fd19e800e5c42e4a0
  • CURVE_OT_select_more rB45aa812fb385b9f7e1ca2f62f1477d21dcedc4af
  • CURVE_OT_select_less rB45aa812fb385b9f7e1ca2f62f1477d21dcedc4af

Curve Menu:

  • CURVE_OT_dissolve_verts rBd7c6013d01ee12da5c04be3dc38d3d4fd726a0b5
  • CURVE_OT_delete rB0973ea51325ef27ca9c6ed305fd4f3c4ec1184c9
  • CURVE_OT_spinrB258ad21cf2b3f388ac4316f3d7867eae3e93c36b
  • CURVE_OT_extrude_move rB993f4d48279118c8355a7e1d802effddbe240d80
  • CURVE_OT_duplicate_move rBb9d58887282470244b906bf5a582390169129f3d
  • CURVE_OT_split rBe9980e5a75e160bb038456b8cb09804f19bea00c
  • CURVE_OT_separate rB4135c7786e479737a26b9ad2ebce90cee31566ff
  • CURVE_OT_make_segment rB3335618489ac2db30e95a7b4904b82df645df7a7
  • CURVE_OT_cyclic_toggle rB93b99306d837ff99c1127be21dc022ad92aec77c
  • CURVE_OT_normals_make_consistent rB500ebf7348bbc9307537fa51b1600f18be83d134
  • CURVE_OT_handle_type_set rB3d4fd6ce1e3e8cde28dbc3de86dd8c002d8b2f16
  • CURVE_OT_tilt_clear rB14344de261597613c76049660de0758a5fe8b813
  • CURVE_OT_switch_direction rB3e55b3c6d0335173567ee32644f83ec06f8d5fdd
  • CURVE_OT_subdivide rB17aef80207bcff8bfb58e4da890b7f1310318a4c
  • CURVE_OT_decimate rBbafd1b6d926ac0f9694fba29ac9f826b4ac39d42
  • CURVE_OT_hide rB597d0ce93c40c5be8871842c40821e7811c3a13a
  • CURVE_OT_reveal rBb5a18c1aacd333046479809a6cd66adfb1410d7e

Other:

  • CURVE_OT_draw (Doesn't de-select all other selected objects, need to refactor ED_curve_select_all & ED_curve_deselect_all, see: ED_pose_deselect_all_multi) rB2959e4c72c1c021fca53887ab902a98789b98f42

Revisions and Commits

Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
rB Blender
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Closed
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned
Abandoned

Related Objects

StatusSubtypeAssignedTask
ConfirmedTO DONone
ResolvedCampbell Barton (campbellbarton)

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Campbell Barton (campbellbarton) updated the task description.Apr 16 2018, 2:13 PM
Campbell Barton (campbellbarton) updated the task description.
Campbell Barton (campbellbarton) updated the task description.
Guy Boicey (stealthtech) added a subscriber: Guy Boicey (stealthtech).May 9 2018, 3:15 AM

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
Guy Boicey (stealthtech) added a comment.May 9 2018, 3:21 AM

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

Default

Versus one with more contrast

Dalai Felinto (dfelinto) added a subscriber: Dalai Felinto (dfelinto).May 11 2018, 12:51 PM

@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.

Guy Boicey (stealthtech) added a comment.May 11 2018, 9:05 PM

@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.

Guy Boicey (stealthtech) added a comment.May 11 2018, 9:44 PM

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;
}
Nick Milios (semaphore) added a subscriber: Nick Milios (semaphore).EditedMay 11 2018, 11:09 PM

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....

Dalai Felinto (dfelinto) added a comment.May 13 2018, 1:28 PM

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.

Daniel Griffin (dgriffin91) added a subscriber: Daniel Griffin (dgriffin91).May 17 2018, 6:17 AM
This comment was removed by Daniel Griffin (dgriffin91).
Daniel Griffin (dgriffin91) added a comment.May 17 2018, 8:15 AM

@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)

Campbell Barton (campbellbarton) updated the task description.May 17 2018, 5:11 PM
Guy Boicey (stealthtech) added a comment.EditedMay 20 2018, 6:19 AM

@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

Campbell Barton (campbellbarton) updated the task description.May 22 2018, 8:32 AM
Campbell Barton (campbellbarton) updated the task description.May 23 2018, 7:37 AM
Campbell Barton (campbellbarton) updated the task description.May 23 2018, 7:46 AM
Habib Gahbiche (zazizizou) added a subscriber: Habib Gahbiche (zazizizou).Oct 28 2018, 4:13 PM
Duarte Farrajota Ramos (duarteframos) added a subscriber: Duarte Farrajota Ramos (duarteframos).Oct 29 2018, 1:42 AM
Habib Gahbiche (zazizizou) added a revision: D3859: Multi-Object EditMode: CURVE_OT_delete.Oct 29 2018, 6:17 PM
Dalai Felinto (dfelinto) updated the task description.Oct 30 2018, 7:41 PM
Dalai Felinto (dfelinto) updated the task description.Oct 30 2018, 8:57 PM
Dalai Felinto (dfelinto) updated the task description.Oct 30 2018, 9:09 PM
Dalai Felinto (dfelinto) updated the task description.Oct 30 2018, 9:40 PM
Dalai Felinto (dfelinto) updated the task description.Oct 30 2018, 9:59 PM
Dalai Felinto (dfelinto) updated the task description.Oct 30 2018, 10:34 PM
Dalai Felinto (dfelinto) updated the task description.Oct 30 2018, 11:00 PM
Campbell Barton (campbellbarton) updated the task description.Oct 31 2018, 5:48 AM
Dalai Felinto (dfelinto) updated the task description.Oct 31 2018, 12:25 PM
Habib Gahbiche (zazizizou) added a revision: D3872: Edit Curve Tools CURVE_OT_hide.Oct 31 2018, 10:56 PM
Habib Gahbiche (zazizizou) added a revision: D3873: Multi-Object EditMode: CURVE_OT_reveal.Oct 31 2018, 11:09 PM
Habib Gahbiche (zazizizou) added a revision: D3876: Edit Curve Tools CURVE_OT_tilt_clear.Nov 1 2018, 12:30 PM
Habib Gahbiche (zazizizou) added a revision: D3875: Edit Curve Tools CURVE_OT_handle_type_set.
Habib Gahbiche (zazizizou) added a revision: D3882: Edit Curve Tools CURVE_OT_cyclic_toggle.Nov 1 2018, 2:33 PM
Habib Gahbiche (zazizizou) added a revision: D3887: Edit Curve Tools CURVE_OT_draw.Nov 1 2018, 9:04 PM
Campbell Barton (campbellbarton) updated the task description.Nov 1 2018, 10:28 PM
Campbell Barton (campbellbarton) updated the task description.Nov 1 2018, 10:34 PM
Habib Gahbiche (zazizizou) added a revision: D3888: Edit Curve Tools CURVE_OT_separate.Nov 1 2018, 10:49 PM
Dalai Felinto (dfelinto) updated the task description.Nov 2 2018, 4:22 PM
Dalai Felinto (dfelinto) updated the task description.Nov 2 2018, 6:15 PM
Dalai Felinto (dfelinto) changed the task status from Unknown Status to Resolved.Nov 7 2018, 1:59 AM
Dalai Felinto (dfelinto) updated the task description.

All operators addressed, thanks everyone for the contributions.