Changed curve active point from pointer to index. Allows curve active point to be saved to file and retained between modes for free. Also some small optimisations by removing pointer look up code.
- Made active point access functions into BKE API calls.
- Fixes operators where curve de-selection resulted in unsel-active point.
- Split curve delete into 2 functions
Increase the maximum allowed amount of points in a spline from currently 32,767 (short) to 2,147,483,647 (int).
Change variables that get assigned the value from pntsu/pntsv to int type all over the codebase.
Change function parameters that previously passed the count as short to int type as well.
(because https://developer.blender.org/T38191)
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D212
Made the system around splines order a bit smarter, so
crating a segment between two splines wouldn't switch
direction if splines are selected in a way that they're
"co-linear".
It is possible to make things even smarter using active
point and so, but that i'd consider a TODO.
There were several issues with how bounding box and texture space
are calculated:
- This was done at the same time as applying modifiers, meaning if
several objects are sharing the same curve datablock, bounding
box and texture space will be calculated multiple times.
Further, allocating bounding box wasn't safe for threading.
- Bounding box and texture space were evaluated after pre-tessellation
modifiers are applied. This means Curve-level data is actually
depends on object data, and it's really bad because different
objects could have different modifiers and this leads to
conflicts (curve's data depends on object evaluation order)
and doesn't behave in a predictable way.
This commit moves bounding box and texture space evaluation from
modifier stack to own utility functions, just like it's was done
for meshes.
This makes curve objects update thread-safe, but gives some
limitations as well. Namely, with such approach it's not so
clear how to preserve the same behavior of texture space:
before this change texture space and bounding box would match
beveled curve as accurate as possible.
Old behavior was nice for quick texturing -- in most cases you
didn't need to modify texture space at all. But texture space
was depending on render/preview settings which could easily lead
to situations, when final result would be far different from
preview one.
Now we're using CV points coordinates and their radius to approximate
the bounding box. This doesn't give the same exact texture space,
but it helps a lot keeping texture space in a nice predictable way.
We could make approximation smarter in the future, but fir now
added operator to match texture space to fully tessellated curve
called "Match Texture Space".
Review link:
https://codereview.appspot.com/15410043/
Brief description:
http://wiki.blender.org/index.php/User:Nazg-gul/GSoC-2013/Results#Curve_Texture_Space
* deselect all no longer leaves an active point
* the most recently added spline becomes the active one
* on successful duplicate/delete the active point and active spline are reset
Added surface support to recent curve split operator, completing quick hack todo
Updated nurbs separate operator to make use of new split logic, completing tools todo
Added 'Delete segment' option to surfaces and improved surface duplication, used for split/separate
- rename curve delete operator vertices enum to match mesh delete operator.
- add missing NULL checks to view3d_lock_poll() to prevent crashes when called outside a view3d.
- remove delete-all option (users can just select all and delete as with all other modes).
- remove CALLOC_STRUCT_N macro.
- CURVE_OT_delete define a dynamic enum rather then a custom invoke menu function.
- add support for using the active point's orientation.
- add support for creating new custom orientations from curves.
- fix error where only the last selected curve handle was taken into account for manipulator orientations.
Issue goes back to 2.4x days at least (but very much likely the
issue is even older). It's caused by subdivision code was starting
to iterate points from previous one, which shifted all the points
by one.
Reshuffled code so now iteration starts from first spline point.
Thanks to Campbell for review and tests! :)
Used slightly different approach from what was discussed with Campbell,
and the reason of this is slightly better support of curve point animation
re-mapping.
There're actually some limitations which better be discussed bewfore 'b':
- If there're no point animation, spline separation goes just fine.
- If there're animated points in the curve, blender will preserve
animation for currently editing curve. But, since new curve created
by Separate operator shares the same AnimData, it'll be animatied
in a weird way.
So not sure whether it's better to preserve animation for current spline
but require switching animationdata for new spline or resetting animation
for current curve's animation data.