Page MenuHome

Fix T80135: Duplicate doesn't preserve active spline
ClosedPublic

Authored by Campbell Barton (campbellbarton) on Aug 27 2020, 2:54 AM.

Details

Summary

Checks to preserve the active spline on duplication required an active vertex too.

Now having no active vertex doesn't prevent duplicate from keeping the spline active.

Diff Detail

Repository
rB Blender
Branch
TEMP-T80135-FIX (branched from master)
Build Status
Buildable 9838
Build 9838: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested review of this revision.Aug 27 2020, 2:54 AM
Campbell Barton (campbellbarton) retitled this revision from Fix T80135 to Fix T80135: Duplicate doesn't preserve active spline.Aug 27 2020, 2:58 AM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)

I'm not sure I understand the problem described in the report, but I can confirm that the duplicate spline does not become active.

The original code complicates a lot and unnecessarily.
For example, when executing calc_duplicate_actvert, the value of cu->actnu is temporarily an index greater than the number of splines.
This index only becomes valid after calling BLI_addtail(newnurb, newnu) and BLI_movelisttolist(...).

Also the purpose of calc_duplicate_actvert is just to check if the index of the active vert is within a range calculated outside the function.

And, in the other function separate_exec, this calculated value for cu->actnu is completely ignored and replaced.

The code would be much simpler if the active vertex and active Nurb were referenced and BKE_curve_nurb_vert_active_set was called right after BLI_movelisttolist.

But that would be more code cleanup than fixing, so for a quick fix I believe this patch is valid.

This revision is now accepted and ready to land.Aug 27 2020, 3:59 PM