Commit Graph

178 Commits

Author SHA1 Message Date
Bastien Montagne
fca515838e Cleanup: strcmp/strncmp -> STREQ/STREQLEN (in boolean usage).
Makes usage of those funcs much more clear, we even had mixed '!strcmp(foo, bar)'
and 'strcmp(foo, bar) == 0' in several places...
2015-01-26 16:59:24 +01:00
Campbell Barton
7d9760d962 Text3d: assert for <0 len text
also add operator to test blacklist
2014-09-10 23:12:11 +10:00
Campbell Barton
3ad9027648 Text3D: fixes to selection
- clamp selection on entering editmode (Python may have changed).
- BKE_vfont_select_get no longer succeeds with an empty selection
  this caused many operators to go ahead and operate on zero size array.
2014-09-10 23:00:24 +10:00
Campbell Barton
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
Campbell Barton
8b0729a731 3D Text: replace multiple float arrays with struct (much easier to understand) 2014-05-16 07:54:54 +10:00
Campbell Barton
4725941f23 Fix for cursor location with xoffset & flush alignment 2014-05-15 21:59:16 +10:00
Campbell Barton
c742a4b62b Code cleanup: remove '\r' check for 3d text, its removed on load even on windows 2014-05-15 18:06:27 +10:00
Campbell Barton
e5b8d84613 Fix T40204: x-offset textbox failed with center/justify/flush 2014-05-15 17:43:27 +10:00
Campbell Barton
ac9eaf9c91 Fix for right aligned text ignoring xoffset 2014-05-15 17:09:46 +10:00
Campbell Barton
c7ab68f1c4 Fixes for font underline
- underline faces had flipped winding by default.
- BKE_vfont_to_curve_ex disallowed 0 underline height (annoying when sliding value)
- disallow negative underline height since it flips underline direction (just change position + height)
2014-05-15 16:04:08 +10:00
Campbell Barton
7c51638292 Fix T40180: Space between letters adds space after last letter 2014-05-15 15:43:59 +10:00
Campbell Barton
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
Campbell Barton
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
Campbell Barton
d900f5be55 Code cleanup: use bools where possible 2014-02-03 19:35:44 +11:00
Sergey Sharybin
1b3fdc4309 Followup for 1728c1e: we don't need to replace flags at all
Replacing the flags isn't thread safe and could lead to bi troubles.
Such things are to be handled by the dependency graph.
2014-01-20 16:10:34 +06:00
Campbell Barton
1728c1e284 Fix for flag not being restored in BKE_vfont_to_curve_ex 2014-01-20 10:44:11 +11:00
Campbell Barton
63ccb26303 Code Cleanup: spelling 2014-01-17 17:35:03 +11:00
Tom Edwards
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
Sergey Sharybin
f86fbc4ea3 Remove direct displist creation from BKE_vfont_to_curve_ex()
This goes back to ancient era again and such a call isn't
safe for threading and really DAG is to make it sure display
list for dependencies is always there.
2014-01-13 15:57:51 +06:00
Campbell Barton
b174e7b0b8 Fix for error in own recent commit 2014-01-08 00:57:58 +11:00
Campbell Barton
2328f94e1d Text3d: underline offset on curved path wasnt working right 2014-01-07 23:04:47 +11:00
Campbell Barton
54ebaad377 Text3d: Add support for underline characters with text-on-path 2014-01-07 20:19:20 +11:00
Campbell Barton
4a372102c7 Text3d: move text selection boxes from Curve to EditFont struct
resolves T38079
2014-01-07 17:12:24 +11:00
Campbell Barton
5ff0d465ee Text3d: minor edits to the API, remove BKE_vfont_to_curve_nubase_ex 2014-01-06 01:49:21 +11:00
Campbell Barton
3b024d63fe Text3d: fix font family feature for unicode and correct tooltip 2014-01-06 01:37:19 +11:00
Sergey Sharybin
a2bf25e8ff Fix crash when having multiple text objects sharing the same curve datablock
Issue was caused by BKE_vfont_to_curve() modifying curve->nurbs list which
gave threading issues.

Now added BKE_vfont_to_curve_nubase() which operates on a given nurbs list
base which is local in do_makeDispListCurveTypes().

By the looks of it it wouldn't give speed regression because previously it
also was creating nurbs for every font object sharing the same curve data.
2014-01-05 17:26:13 +06:00
Campbell Barton
99d050f88b Text3d: selection in editmode now follows rotated text along path 2014-01-05 22:20:33 +11:00
Campbell Barton
42bd5d7c80 Text3d: fix for smallcaps modifying the original text input in editmode.
Oversight in own recent commit to avoid allocating a new wchar_t array.
2014-01-05 21:15:25 +11:00
Campbell Barton
3eb818e53a Text3d: smallcaps wasnt working properly for text-on-path 2014-01-05 21:15:25 +11:00
Campbell Barton
4eed4b3bcd Text3d: remove sepchar, old feature which no longer has any UI access. 2014-01-05 21:15:24 +11:00
Campbell Barton
e20f357cc2 Text3d: error in own recent fix for thread safety 2014-01-05 21:15:24 +11:00
Campbell Barton
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
Campbell Barton
a5cb2229ab Text3d: avoid converting utf8 to wchar_t in editmode 2014-01-03 14:20:35 +11:00
Campbell Barton
748b800eba Text3d: add assert's to check the selection and length are valid 2013-12-29 23:16:02 +11:00
Sergey Sharybin
3b08ee8996 Follow up to the previous commit: vfont_get_data is to use the same RW lock 2013-12-29 17:07:38 +06:00
Sergey Sharybin
df5631216a Fix T37980: Multiple font objects sharing an external font gives problems
Solved by adding RW lock to BKE_vfont_to_curve.

So now all the threads are allowed to read chars from ghash,
but they'll be locked as soon as one thread would need to load
more chars from font to the ghash.
2013-12-29 16:44:07 +06:00
Campbell Barton
1aa62605cd Fix for text3d issue, \n was attempting to find a character too 2013-12-28 19:34:50 +11:00
Campbell Barton
1a91b8bd5d Fix for 3d fonts loading the character of the string terminator.
also remove redundant call to wcslen and ensure FT_Init_FreeType runs
once the font loads.
2013-12-28 19:06:45 +11:00
Campbell Barton
961d0409c8 3D Text: use ghash for character lookups 2013-12-28 17:40:13 +11:00
Campbell Barton
c80c1c6f5c add copy_v4_fl4, replace QUATSET macro. 2013-10-22 03:31:21 +00:00
Sergey Sharybin
26c34fc29f Merge remained parts of r57520: use use_render argument rather than G.is_rendering 2013-08-19 11:04:32 +00:00
Sergey Sharybin
59dfb05c72 Make fonts safe(r) for threading
Getting vfont data wasn't safe for threading, because it
was modifying font data which is in bmain and could be
shared by multiple objects.

For now made it so getting vfont uses critical section,
meaning vfont->data is initializing from inside a locked
mutex.

--
svn merge -r58168:58169 ^/branches/soc-2013-depsgraph_mt
2013-08-19 10:02:18 +00:00
Sergey Sharybin
527ddb0a5b Move bevel list and path from Curve to Object datablock
I know this is not so much nice to have this guys hanging
around in a general Object datablock and ideally they better
be wrapped around into a structure like DerivedMesh or
something like this. But this is pure runtime only stuff and
we could re-wrap them around later.

Main purpose of this is making curves more thread safe,
so no separate threads will ever start freeing the same path
or the same bevel list.

It also makes sense because path and bevel shall include
deformation coming from modifiers which are applying on
pre-tesselation point and different objects could have
different set of modifiers. This used to be really confusing
in the past and now data which depends on object is stored
in an object, making things clear for understanding even.

This doesn't make curve code fully thread-safe due to
pre-tesselation modifiers still modifies actual nurbs and
lock is still needed in makeDispListsCurveTypes, but this
change makes usage of paths safe for threading.

Once modifiers will stop modifying actual nurbs, curves
will be fully safe for threading.

Actually, this commit also contains wrapping runtime curve
members into own structure

This allows easier assignment on file loading, keeps curve-
specific runtime data grouped and saves couple of bytes in
Object for non-curve types.

--
svn merge -r57938:57939 ^/branches/soc-2013-depsgraph_mt
svn merge -r57957:57958^/branches/soc-2013-depsgraph_mt
2013-08-19 09:25:24 +00:00
Campbell Barton
2b6f35d686 fix for error in string copy
- BLI_strncpy_wchar_from_utf8 wasn't NULL terminating the destination string, caused uninitialized memory use in BPY_python_start().
- BLI_strncpy_wchar_as_utf8 could write one byte past the buffer bounds.
2013-07-15 05:09:06 +00:00
Campbell Barton
f9f7070336 add STREQ macro (commonly used macro like CLAMP, MAX2, STRINGIFY). Use for some areas of the python api, bmesh. 2013-03-10 06:18:03 +00:00
Campbell Barton
221a383366 use 'bool' for BLI_/BKE_ functions. 2013-03-09 05:35:49 +00:00
Campbell Barton
ddddb7bab1 code cleanup: favor braces when blocks have mixed brace use. 2013-03-09 03:46:30 +00:00
Campbell Barton
384948908a patch [#34103] path_util_split_dirstring.patch, path_util_split_dirstring_2.patch, path_util_split_dirstring_3.patch
from Lawrence D'Oliveiro (ldo)

Get rid of BLI_splitdirstring, replace with calls to BLI_split_dirfile, BLI_split_dir_part and BLI_split_file_part as appropriate.
2013-03-05 06:26:10 +00:00
Campbell Barton
c93e127e7a code cleanup: style and replace (float)sin, (float)cos with sinf, cosf 2013-01-12 14:28:23 +00:00
Campbell Barton
f70d2c65d8 rename api functions...
- minf, maxf, mini, maxi --> min_ff, max_ff, min_ii, max_ii
2012-10-23 13:28:22 +00:00