Commit Graph

312 Commits

Author SHA1 Message Date
bc9e66f083 Revert fix for T38594, caused T40186 (just accept limitation for now) 2014-05-27 21:29:52 +10:00
d84af360ca EditCurve: Replace -1 with CU_ACT_NONE define 2014-05-26 09:37:04 +10:00
eaf815f14a Fix for curve having invalid active vertex after setting type
also allow passing NULL vertex to BKE_curve_nurb_vert_active_set
2014-05-26 09:35:32 +10:00
be980b9f7d 3D Text: Change textbox placement to ignore font scale
Logic here was very stupid, texboxes would have their initial
locations scaled by font size but not their width/height.

Now its possible to change font size while keeping the textbox layout.

Other fixes

- tab character didn't work properly with textboxes.
- memory leak when VFontData was missing.
2014-05-16 10:32:29 +10:00
dc03a5ebe3 FCurve: handle calculation was measuring new handle lengths and not using for new ratio 2014-05-14 13:10:45 +10:00
4875a665cc Fix T40176: Curve Functions broken in several addons
Regression since 94e5e2f.

Handbook example about what happens when you use copy-paste
and don't test code after you did a cleanup.
2014-05-13 16:39:51 +02:00
ea6671a630 Fix for aligned handles in masking and curve objects
The issue has been introduced in 0985bb4, made it so curves and masks
stick to old behavior.

FCurves are still flaky, namely, grabbing both handles selected would
change the length of one of the handles which is not nice imo.
2014-05-03 21:58:02 +02:00
4ca67869cc Code cleanup: remove unused includes
Opted to keep includes if they are used indirectly (even if removing is possible).
2014-05-01 04:47:51 +10:00
1ef06abc5e Fix T39947: Aligned handle behaviour problem in graph editor
Error in recent change to handle behavior
2014-04-30 02:43:55 +10:00
94e5e2f5d8 Code cleanup: simplify reallocs using MEM_recalloc 2014-04-29 07:50:25 +10:00
4de62241e4 Fix for typo in comment 2014-04-28 17:16:09 +12:00
0985bb483d Fix T38594: Incorrect behaviour when editing aligned handles in curve editor
With the right handle selected, the movement of the left handle appears constrained
to the frame it is currently on, leading to unpredictable and wild overshoots of the
bezier curve. There appears to be little benefit in doing so.

The effect of this patch is that makes it so that instead of trying (initially) to
maintain the same distance between the two handles and then overshooting randomly
later, the handles now try to keep the same distance from each other (i.e. similar
doing a rotation around the keyframe) at all times. While this means that it isn't
possible to set up assymetric handles (i.e. where ease in to the key is less than the
ease out for example) using aligned handles (it's still possible using free; it's just
a lot more work to keep them aligned), the benefits of removing of the random blips and jumps
when things jump outweight the losses.


Patch by Brecht
2014-04-28 17:15:23 +12:00
a2c107aef1 Code cleanup: use 'const' for arrays (blenkernel) 2014-04-27 00:25:15 +10:00
a3f5e6c76f Fix T39266: Weird Skin modifier shutdown
Fix wrong quat being calculated for curve's path.
Also avoid some divisions by zero.

Happened in cases when all the curve points have the same coord.
2014-04-11 17:56:08 +06:00
1e6d2b1dbf Code cleanup: remove paranoid NULL check 2014-04-08 07:46:28 +10:00
c61eb64f06 Fix T39635: Crash convening curve to mesh 2014-04-08 07:41:38 +10:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
0782187979 Code cleanup: BKE_nurbList_handles_set used some strange logic 2014-03-30 15:04:20 +11:00
1f58bfb8be Code cleanup: de-duplicate cotangent weight function & add arg sizes 2014-03-30 11:08:33 +11:00
1af69b6df3 Implement asymmetric and free handles type for masks
Summary:
The title actually says it all, it's just possible to
have independent free handles for mask splines. Also
it's now possible to have aligned handles displayed
as independent handles.

Required changes in quite a few places, but they're
rather straightforward.

From user perspective there's one really visible change
which is removed Handle Type menu from the panel. With
asymmetric handles it's not clear which handle type to
display there. So now the only way to change handle type
is via V-key menu.

Rewrote normal evaluation function to make it deal
with new type of handles we support. Now it works in
the following way:

- Offset the original spline by maximal weight
- Calculate vector between corresponding U positions
  on offset and original spline
- Normalize this vector.

Seems to be giving more adequate results and doesn't
tend to self-intersect as much as old behavior used to,

There're still some changes which needed to be done, but
which are planned for further patch:

- Support colors and handle size via themes.
- Make handles color-coded, just the same as done for
  regular bezier splines in 3D viewport.

Additional changes to make roto workflow even better:
- Use circles to draw handles
- Support AA for handles
- Change click-create-drag to change curvature of the
  spline instead of adjusting point position.

Reviewers: campbellbarton

CC: sebastian_k, hype, cronk

Differential Revision: http://developer.blender.org/D121
2014-03-28 17:54:38 +06:00
Lukas Treyer
97cb76a45d Bevel Factor Mapping
Bevel Factor Mapping allows to control the relation between bevel factors
(number between 0 and 1) and the rendered start and end point of a beveled
spline.

There are three options: "Resolution", "Segments", "Spline". "Resolution"
option maps bevel factors as it was done < 2.71, "Spline" and "Segments"
are new.

* "Resolution“: Map the bevel factor to the number of subdivisions of a
  spline (U resolution).
* "Segments“: Map the bevel factor to the length of a segment and to the
  number of subdivisions of a segment.
* "Spline": Map the bevel factor to the length of a spline.

Reviewers: yakca, sergey, campbellbarton

CC: sanne

Differential Revision: https://developer.blender.org/D294
2014-03-28 16:44:33 +06:00
7199e2288f Code cleanup: use sqrtf when input and output are float 2014-03-28 14:53:37 +11:00
27e86ed832 Code cleanup: use bools 2014-03-20 22:56:28 +11:00
2097e621ed Code cleanup: use r_ prefix for return args 2014-03-16 03:26:23 +11:00
4cfd14644b 3D Text: textbox selection while in editmode
D395 from Henrik Aarnio with some improvements.
2014-03-11 17:16:08 +11:00
b839fb9bb7 Fix T38985: Setting endpoint_u property while creating spline in Python gives strange behavior 2014-03-07 14:05:38 +06:00
13ea967cce Code cleanup: correct abs use and quiet warnings 2014-03-01 14:26:18 +11:00
f29dadc5ea Code cleanup: comment unused code in calchandleNurb_intern
Also remove outdated comments.
2014-03-01 12:58:52 +11:00
ba08031783 Fix T38817: FCurve autoclamp error
Animating large values with auto handles didn't work well,
(large variations on the Y axis would shrink handles).
2014-02-28 12:11:09 +11:00
4622fc418e Fix T38863: FCurve auto-clamp allows handle to move past X bounds
F-Curves with large Y axis had strange behavior where the handles could
stretch out on the X axis rather then clamping as they do at smaller sizes.
2014-02-27 17:15:49 +11:00
55fe91abf3 Code cleanup: curves calculation was using offsets confusingly
also avoid calculating handle length when align isn't used.
2014-02-27 17:03:35 +11:00
572a199a24 Fix for off-by-one error switching nurbs direction 2014-02-20 20:11:03 +11:00
1a4b718582 Fix crash on file load with linked groups and curve bevel.
This isn't a proper fix, curve_cache should not be NULL, but it makes it
possible to open the file at least.
2014-02-17 22:02:44 +01:00
54dd355cc8 Fix T38562: Wrong curve tilt after Switch Direction 2014-02-14 14:58:52 +06:00
b3afbcab8f ListBase API: add utility api funcs for clearing and checking empty 2014-02-08 06:24:05 +11:00
d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
Kevin Mackay
fbc7ab30ff Curves: save active point to file
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
2014-01-27 15:21:04 +11:00
Simon Repp
6cd132b29c Increase maximum allowed amount of points for Splines in both U and V directions
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
2014-01-19 00:22:04 +06:00
1f2136b329 Python/Depsgraph: bpy.data.*.is_updated now detects add/remove of any datablock.
Previously this only worked for some datablocks relevant to rendering, now it
can be used to detect if any type of datablock was added or removed (but not
yet to detect if it was modified, we need many more depsgraph tags for that).

Most of the changes are some function parameter changes, the important parts
are the DAG_id_type_tag calls.

Reviewed By: sergey, brecht

Differential Revision: https://developer.blender.org/D195
2014-01-15 16:47:53 +01:00
b5592d86d6 Remove direct displist creation from bevel code
BKE_curve_bevel_make() is only used from object_handle_update()
friends and never called directly. This means if there's no
display list ready for the bevel object it's something wrong
happened with DAG.

In fact, this check goes back to ancient era and from tests
it appears this check is no longer needed.
2014-01-13 15:57:50 +06:00
4a372102c7 Text3d: move text selection boxes from Curve to EditFont struct
resolves T38079
2014-01-07 17:12:24 +11:00
15bc30f4ee Text3d: store number of characters and utf8 length separately
EditFont's use of Curve.len was very confusing, in editmode it
represented the number of characters, in object mode the number of
bytes. add Curve.len_wchar and keep track of both.

Also don't convert the editmode text into utf8 on every keystroke.
Now this is done on exiting editmode or save - to match most other
object types.

This also fixes curves 'body_format' being reported with an invalid size.
2014-01-03 17:08:23 +11:00
2b3fc4dea7 Fix for BKE_nurb_handles_autocalc using 2d tests on 3d data 2013-12-28 17:29:58 +11:00
c456cd94b2 Curve Handle Recalculate (Ctrl+N)
T37799 Patch from Simon Repp
with added option to recalculate handle lengths.
2013-12-14 02:53:19 +11:00
3a370ec6ec Move curve's boundbox and texspace calculation out of modifier stack
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
2013-12-11 16:32:41 +06:00
cc55913798 Fix T37225: UV map for closed curves incorrectly generated
Summary:
Curve ORCO was not calculating properly for cyclic 2D curves.

- Needed to split vertices for blender internal renderer.
  Otherwise it's not possible to map last face to a proper
  texture location.

- Needed to tweak curve->mesh conversion to respect cyclic
  flag along U direction.

- Removed check for orcodm in curve.c:add_orco_dm since
  this code is only called if there're enabled constructive
  modifiers on the curve.

Reviewers: brecht

Maniphest Tasks: T37225

Differential Revision: http://developer.blender.org/D45
2013-11-26 03:02:13 +06:00
63caaa2b12 Code Cleanup: rename vars for detecting change to be more consistent
rename change/is_change/is_changed/modified -> changed
also use bools over int/short/char and once accidental float.
2013-11-26 06:39:14 +11:00
d232486b40 Fix T37543: Multiline 3D Text saved in edit mode breaks on load 2013-11-21 04:32:28 +11:00
0af52adac0 Code Cleanup: remove unused members for editfont (3D text) 2013-11-21 04:16:41 +11:00
Kevin Mackay
299812f28d Made active point and active spline behaviour more predictable on curves/surfaces:
* 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
2013-11-05 23:37:09 +00:00