Multi-Object-Mode: Edit Curve Tools #54648

Closed
opened 2018-04-16 12:58:16 +02:00 by Campbell Barton · 19 comments

Select Menu:

Curve Menu:

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) 2959e4c72c
## Select Menu: - ~~CURVE_OT_select_all~~ 170dd30881 - ~~CURVE_OT_select_random~~ 4e14437cb0 - ~~CURVE_OT_select_nth~~ 47afabbb42 - ~~CURVE_OT_select_linked~~ 647232f7f1 - ~~CURVE_OT_select_similar~~ 4e9911663a - ~~CURVE_OT_de_select_first~~ 9d9d44dbcb - ~~CURVE_OT_de_select_last~~ df613a52e6 - ~~CURVE_OT_select_next~~ 95150b8414 - ~~CURVE_OT_select_previous~~ 95150b8414 - ~~CURVE_OT_select_more~~ 45aa812fb3 - ~~CURVE_OT_select_less~~ 45aa812fb3 ## Curve Menu: - ~~CURVE_OT_dissolve_verts~~ d7c6013d01 - ~~CURVE_OT_delete~~ 0973ea5132 - ~~CURVE_OT_spin~~258ad21cf2 - ~~CURVE_OT_extrude_move~~ 993f4d4827 - ~~CURVE_OT_duplicate_move~~ b9d5888728 - ~~CURVE_OT_split~~ e9980e5a75 - ~~CURVE_OT_separate~~ 4135c7786e - ~~CURVE_OT_make_segment~~ 3335618489 - ~~CURVE_OT_cyclic_toggle~~ 93b99306d8 - ~~CURVE_OT_normals_make_consistent~~ 500ebf7348 - ~~CURVE_OT_handle_type_set~~ 3d4fd6ce1e - ~~CURVE_OT_tilt_clear~~ 14344de261 - ~~CURVE_OT_switch_direction~~ 3e55b3c6d0 - ~~CURVE_OT_subdivide~~ 17aef80207 - ~~CURVE_OT_decimate~~ bafd1b6d92 - ~~CURVE_OT_hide~~ 597d0ce93c - ~~CURVE_OT_reveal~~ b5a18c1aac ## 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`)~~ 2959e4c72c
Campbell Barton self-assigned this 2018-04-16 12:58:16 +02:00
Author
Owner

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Added subscriber: @stealthtech

Added subscriber: @stealthtech

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

  • In Object Mode select a Bezier Curve
  • Switch to Edit Mode and select the Control Points
  • Switch back to Object Mode and select another Bezier Curve
  • Switch to Edit Model and select the Control Points
  • Switch back to Object Mode and Select both Bezier Curves
  • Switch back to Edit Mode and perform the operators.

The expected behavior

  • Select the Bezier Curves
  • Switch to Edit Mode

Select Control Points from any Bezier Curve selected

When in edit mode I'm not able to select multiple control points. I have to do the following as a work around. - In Object Mode select a Bezier Curve - Switch to Edit Mode and select the Control Points - Switch back to Object Mode and select another Bezier Curve - Switch to Edit Model and select the Control Points - Switch back to Object Mode and Select both Bezier Curves - Switch back to Edit Mode and perform the operators. The expected behavior - Select the Bezier Curves - Switch to Edit Mode # Select Control Points from any Bezier Curve selected

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

Default
DefaultColors.PNG

Versus one with more contrast

ChangedColor.PNG

Default colors make it hard to distinguish between selected and none selected Control Points Default ![DefaultColors.PNG](https://archive.blender.org/developer/F3308477/DefaultColors.PNG) Versus one with more contrast ![ChangedColor.PNG](https://archive.blender.org/developer/F3308482/ChangedColor.PNG)

Added subscriber: @dfelinto

Added subscriber: @dfelinto

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

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

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

@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;
}
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; } ```

Added subscriber: @semaphore

Added subscriber: @semaphore

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

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

Same here in MetaBall https://developer.blender.org/T54649 i am waiting @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 @ideasman42 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.

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

Added subscriber: @DGriffin

Added subscriber: @DGriffin

This comment was removed by @DGriffin

*This comment was removed by @DGriffin*

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

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

@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

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

Added subscriber: @zazizizou

Added subscriber: @zazizizou

Added subscriber: @DuarteRamos

Added subscriber: @DuarteRamos

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

All operators addressed, thanks everyone for the contributions.

All operators addressed, thanks everyone for the contributions.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#54648
No description provided.