Page MenuHome

Curves: Port set type node to new data-block
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Apr 27 2022, 12:50 AM.

Details

Summary

This commit ports the "Set Spline Type" node to the new curves data-block.
Performance should be improved in similar ways to the other refactors from
the conversion task (T95443). The refactor has a few other explicit goals as well:

  • Don't count on initialization of attribute arrays when they are first allocated
  • Avoid copying the entire data-block when possible
  • Make decisions about which attributes to copy when changing curves more obvious
  • Use higher-level methods to copy data between curve points
  • Optimize for the common cases of single types and full selections
  • Process selected curves of the same types in the same loop

NURBS conversion changes are written by Piotr Makal (@Piotr Makal (pmakal)), thanks!

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)
  • Cleanup, fixes, merge some changes into master

There is still an issue with NURBS to Bezier conversion

Jacques Lucke (JacquesLucke) requested changes to this revision.May 4 2022, 4:46 PM

General structure seems fine, but there is still needs some more work.

source/blender/blenkernel/BKE_curves.hh
451

same size -> have the same number of control points

source/blender/blenkernel/intern/curves_geometry.cc
1326

Store name in new variable. That can make debugging simpler.

1363

Looks like this might not be taking src_curve_selection into account properly. Maybe iterate through src_curve_selection.slice(range) instead.

1379

Also doesn't use curve_selection correctly.

source/blender/blenloader/intern/versioning_300.c
2766

Incomplete comment.

source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc
87–144

src.index_range()

88

Add a comment for why this is doing what it's doing.

277–280

Comment style.
The inline keyword does not ensure that this function is inlined. Not sure how inlining this would help with virtual arrays, it most likely does not.

283

Some comment explaining the code below would be useful.

316

Add a comment saying that in this case it doesn't matter what the source type is. Also the curves input is not used anymore.

330

Why are curve attributes ignored here?

350–354

Split this function up or add some high level comments within the function which say what happens where.

396

Converting catmull rom to bezier doesn't seem to work correctly for me currently. I'd expect the conversion to not change the shape of the curve.

664

Yeah, probably fine to not have this. Also doesn't seem critical enough to justify using AllSpanOrSingle.

This revision now requires changes to proceed.May 4 2022, 4:46 PM

Further refactoring and cleanup

Hans Goudey (HooglyBoogly) planned changes to this revision.May 10 2022, 5:43 PM

This still needs the proper Catmull Rom to Bezier conversion which is still on my other computer. Also the NURBS to Bezier conversion is slightly broken unfortunately.

Hans Goudey (HooglyBoogly) planned changes to this revision.May 12 2022, 12:14 PM
  • Fixes
  • Proper Catmull Rom -> Bezier support
Hans Goudey (HooglyBoogly) planned changes to this revision.May 16 2022, 9:48 AM
Hans Goudey (HooglyBoogly) marked 14 inline comments as done.May 19 2022, 6:16 PM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc
283

Yes, that would be nice, I find it confusing myself though, the logic came from D13546.

Hans Goudey (HooglyBoogly) marked an inline comment as done.
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)

Lots of cleanup, all the logic is much closer. Review comments corrected. I'm still noticing issues with some conversions though.

Hans Goudey (HooglyBoogly) planned changes to this revision.May 19 2022, 6:18 PM
Piotr Makal (pmakal) commandeered this revision.Jun 1 2022, 9:37 PM

Hey guys, with a permission from @Hans Goudey (HooglyBoogly) I want to jump in and tackle NURBS to Bezier conversion.

Piotr Makal (pmakal) edited the summary of this revision. (Show Details)

This update fixes NURBS to Bezier conversion. Bringing back behavior provided with the D13546 patch. Bare in mind that this fix/conversion still doesn't address the changes to Bezier knots mode introduced with D13891. This is not a trivial thing to handle and unfortunately currently I don't have enough time to look at it. For such cases conversion will happen but will not be ideal.

source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc
331–336

This code was suggested by @Hans Goudey (HooglyBoogly), so nurbs_weight attribute will not forced assigned to converted curve. While it works, it also makes position attribute to be omitted, although I haven't seen any side-effects of this.

436

While this line is not strictly necessary, because lines 306-311 make nurbs_weight attribute to have zero value either way, by adding it I wanted to underline my intentions.

Thanks a lot for the updates @Piotr Makal (pmakal), the NURBS to Bezier conversion looks good now, and passes the tests!

Hans Goudey (HooglyBoogly) retitled this revision from Curves: Port set type node to new data-block (WIP) to Curves: Port set type node to new data-block.
Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)
Hans Goudey (HooglyBoogly) set the repository for this revision to rB Blender.
  • Merge master

That doesn't seem to work as expected yet:

source/blender/blenloader/intern/versioning_300.c
3025

That code may have to be moved down.

source/blender/nodes/geometry/nodes/node_geo_curve_spline_type.cc
56

point size -> number of points

107

A comment would be good. Also use 1.0f instead of 1.0.

Hans Goudey (HooglyBoogly) marked 2 inline comments as done.

Come cleanups/improvements to conversion to NURBS

This revision was not accepted when it landed; it landed in state Needs Review.Jun 8 2022, 3:38 PM
This revision was automatically updated to reflect the committed changes.