Commit Graph

34 Commits

Author SHA1 Message Date
5300ba0ba5 Merge branch 'master' into blender2.8 2018-07-31 17:03:28 +10:00
21f61cbe73 BLF: replace global aa pref w/ monochrome flag
Now disabling anti-aliasing doesn't impact sequencer, render stamp etc.
2018-07-31 16:57:05 +10:00
3584810fdd Python/BLF: add blf.color(r, g, b, a) method.
This is needed now that glColor() no longer works.
2018-06-21 13:37:02 +02:00
5b64301834 Merge branch 'master' into blender2.8 2018-06-04 09:06:14 +02:00
7719c11006 Cleanup: strip trailing space in Python module 2018-06-04 08:54:40 +02:00
a8dc3f4596 BLF: make blurry text an optional (disabled) feature
While trying to simplify text drawing, noticed no Blender code uses the blur feature. Hopefully scripts don't use it!
2016-10-15 19:40:41 -04:00
c12e1a09ec BLF: use float vector passing color args 2016-04-22 20:02:41 +10:00
f2341f8296 BLF: initial word-wrap support
- Adds support for word wrapping to Blender's BLF font library.
- Splits lines when width limit is reached or on explicit \n newlines.

Details:

- Word wrapping is used when `BLF_WORD_WRAP` flag is enabled.
- There is a single loop to handle line wrapping,
  this runs callback, passing in a substring,
  this way we can avoid code-duplication for all word-wrapped
  versions of functions... OR... avoid having to add support
  for word-wrapping directly into each function.
- The `ResultBLF` struct was added to be able to get the number
  of wrapped lines, when calling otherwise unrelated functions
  such as `BLF_draw/BLF_width/BLF_boundbox`,
  which can be passed as the last argument to `BLF_*_ex()` functions.
- The `ResultBLF` struct is used to store the result of drawing
  (currently only the number of lines wrapped, and the width).
2015-09-18 20:43:52 +10:00
3ce4a58aa9 Cleanup: duplicate includes 2015-06-18 06:32:01 +10:00
9fd569a654 PyAPI: add utilities PyTuple_SET_ITEMS, Py_INCREF_RET
Setting all values of a tuple is such a common operation that it deserves its own macro.
Also added Py_INCREF_RET to avoid confusing use of comma operator.
2015-01-06 19:09:11 +11:00
e73d0f57a3 Code cleanup: use 'const' for arrays (python) 2014-04-27 00:25:15 +10:00
1815225faa Blender Font (BLF): add length argument to string width/height functions
This also fixes a crash editing buttons longer then UI_MAX_DRAW_STR
2013-12-02 21:10:07 +11:00
70d3d1aca6 style cleanup: py/capi 2012-03-16 21:39:56 +00:00
e5647ea196 py operators - don't use the screen as an operators ID anymore, screen's don't store operator instances and operator functions have access to the context if they need the current screen.
also add some more py api file descriptions.
2011-11-05 08:40:07 +00:00
4a04f72069 remove $Id: tags after discussion on the mailign list: http://markmail.org/message/fp7ozcywxum3ar7n 2011-10-23 17:52:20 +00:00
280684c35d remove blf.gettext, add blf.unload(font) 2011-09-21 16:06:47 +00:00
f5bb22d088 have blf.gettext even when internationalization is disabled (just passes through). 2011-09-20 15:11:17 +00:00
bba54a051a i18n: fake_gettext is no longer needed for python 2011-09-20 08:38:16 +00:00
6d125e159d i18n: code clean-up
- Move all translation-related declarations to BLF_translation.h
- Reverted some changes to match trunk svn rev40365
2011-09-20 07:39:25 +00:00
0e421f429a modify the python gettext function to pass through the original string when no translation is done, this means the cached info such as byte representation and hash will be kept. 2011-09-20 02:25:57 +00:00
0eda51f2ea Fixing issues with i18n stuff:
- Make gettext stuff draw-time. so switching between languages
  can happens without restart now.
- Added option to translate visible interface (menus, buttons, labels)
  and tooltips. Now it's possible to have english UI and localized tooltips.
- Clean-up sources, do not use gettext stuff for things which can be
  collected with RNA.
- Fix issues with windows 64bit and ru_RU locale on my desktop
  (it was codepage issue).
- Added operator "Get Messages" which generates new text block with
  with all strings collected from RNA.
- Changed script for updating blender.pot so now it appends
  messages collected from rna to automatically gathered messages.
  To update .pot you have to re-generate messages.txt using "Get Messages"
  operator and then run update_pot script.
- Clean up old translation stuff which wasn't used and most probably
  wouldn't be used.
- Return back "International Fonts" option, so if it's disabled, no
  gettext lookups happens on draw.
- Merged read_homefile function back. No need in splitting it.

TODO:
- Custom fonts and font size.
  Current font isn't nice at least for russian locale, it's
  difficult to read it.
- Put references to messages.txt so gettext can merge translation when
  name/description of some property changes.
2011-09-15 13:20:18 +00:00
Xiao Xiangquan
5b91a783cf fix for windows locale setting 2011-08-31 07:31:02 +00:00
Xiao Xiangquan
3a8c7be9e4 code clear, insert blf_gettext.c to blf.c 2011-08-12 13:43:21 +00:00
Xiao Xiangquan
9a2f36b50f handle SpaceType and UserPref popups 2011-06-20 10:07:46 +00:00
Xiao Xiangquan
0fc21dde4e Add BLF_gettext(msgid) for C, and blf.gettext(msgid) for Python. 2011-05-30 11:03:16 +00:00
15289c6048 use PyDoc_STRVAR macro, so its possible to build without docstrings. 2011-05-24 16:05:51 +00:00
Nathan Letwory
5a760e22fc doxygen: blender/python tagged. 2011-02-27 20:10:08 +00:00
Nathan Letwory
5b607701a7 doxygen: prevent GPL license block from being parsed as doxygen comment. 2011-02-23 10:52:22 +00:00
0955c664aa fix for warnings from Sparse static source code checker, mostly BKE/BLI and python functions.
- use NULL rather then 0 where possible (makes code & function calls more readable IMHO).
- set static variables and functions (exposed some unused vars/funcs).
- use func(void) rather then func() for definitions.
2011-02-13 10:52:18 +00:00
89c9aaaa25 remove references to BKE_utildefines where its not needed.
- move GS() define into DNA_ID.h
- add BLI_utildefines as an automatic include with makesrna generated files.
2011-01-07 19:18:31 +00:00
8f21a43535 split BKE_utildefines.h, now it only has blender specific defines like GS() MAKE_ID, FILE_MAXDIR, moved the generic defines to BLI_utildefines.h.
no functional changes.
2011-01-07 18:36:47 +00:00
b4081bfc7b patch [#25027] formatting mathutils.geometry module docs for sphinx
from Luka Bonavita

See:
http://www.blender.org/documentation/250PythonDoc/mathutils.geometry.html
2010-12-10 00:20:32 +00:00
545cc4803e Change the BLF_aspect function to handle 3d text.
This is need to properly handle 3d text (dalai work on GE), before
the BLF_aspect only take one argument, and the result was a call to:
	glScalef(aspect, aspect, 1.0)

Now the three value are store in the font (x, y and z) and also
need to be enable using BLF_enable(BLF_ASPECT).

By default all the code that don't have BLF_ASPECT enable work with
a scale of 1.0 (so nothing change to the current UI).

I also remove all the call of BLF_aspect(fontid, 1.0) found in
the editors, because is disable by default, so no need any more.

Campbell the only thing to check is the python api, right now
I modify the api to from:
	BLF_aspect(fontid, aspect)
to:
	BLF_aspect(fontid, aspect, aspect, 1.0)

This is to avoid break the api, but now you need add the BLF_ASPECT
option to the function py_blf_enable and in some point change
py_blf_aspect to take 3 arguments.
2010-12-09 22:27:55 +00:00
Dalai Felinto
f1c4688e25 renaming blf_api.h to blf_py_api.h
In windows this was producing Linking dependence errors because we have BLF_api.h in the /blenfont/ and blf_api.h in /python/generic/. It doesn't produces crash out of the box but I was trying to link both "api" files to the same project (Ketjsi folder). For the linking order was determining what header to use. A workaround is to "include" the file using some ../../ relative folder. But renaming it is less error prone.

Probably Ketsji folder shouldn't link to BLF_api.h anyways, but this is something I will look better later before another commit. In the mean time it's not a good idea to have 2 api files with the same name (for non case-sensitive systems).
2010-12-09 17:31:42 +00:00