Curves: Add cursor snapping support #104967

Merged
Falk David merged 2 commits from filedescriptor/blender:curves-cursor-snapping into main 2023-02-21 11:04:52 +01:00
2 changed files with 5 additions and 3 deletions
Showing only changes of commit bd91650e21 - Show all commits

View File

@ -5,6 +5,8 @@
#include "BLI_task.hh"
#include "DNA_object_types.h"
#include "ED_curves.h"
#include "ED_transverts.h"
@ -23,8 +25,8 @@ void transverts_from_curves_positions_create(bke::CurvesGeometry &curves, TransV
threading::parallel_for(selection.index_range(), 1024, [&](const IndexRange selection_range) {
for (const int point_i : selection_range) {
Review

Just tv.loc = positions[selection[point_i]]; worked okay for me.

Just `tv.loc = positions[selection[point_i]];` worked okay for me.
TransVert &tv = tvs->transverts[point_i];
Review

Might be better to use SELECT for now, since that's how the other object types do it

Might be better to use `SELECT` for now, since that's how the other object types do it
tv.loc = reinterpret_cast<float *>(&positions[selection[point_i]]);
tv.flag = true;
tv.loc = positions[selection[point_i]];
tv.flag = SELECT;
copy_v3_v3(tv.oldloc, tv.loc);
}
});

View File

@ -65,7 +65,7 @@ void ensure_surface_deformation_node_exists(bContext &C, Object &curves_ob);
/**
* Allocate an array of `TransVert` for cursor/selection snapping (See
* `ED_transverts_create_from_obedit` in `view3d_snap.c`).
* Note: the `TransVert` elements in \a tvs are expected to write to the positions of \a curves.
* \note: the `TransVert` elements in \a tvs are expected to write to the positions of \a curves.
Review

* Note: -> * \note:

`* Note:` -> `* \note:`
*/
void transverts_from_curves_positions_create(bke::CurvesGeometry &curves, TransVertStore *tvs);