Commit Graph

3965 Commits

Author SHA1 Message Date
0d0291f6e1 code cleanup: incorrect sized array args, remove some redundant code. 2013-03-17 10:26:23 +00:00
284e59d608 Add the possibility to define the translation context for py rna classes (operators, panels and menus).
Thanks to Campell and Brecht for the reviews!
2013-03-15 14:32:29 +00:00
0807c976f4 code cleanup: rename BKE_mesh_to_curve_ex --> BKE_mesh_to_curve_nurblist,
also correct odd indentation.
2013-03-15 10:48:48 +00:00
660be3da39 use gcc warning -Wredundant-decls, exposes some odd/duplicate declarations which have been removed. 2013-03-11 20:27:38 +00:00
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
7d585ed475 patch [#34103] check_for_dupid.patch
from Lawrence D'Oliveiro (ldo)

- more comments
- more uses of bool type
- define symbol for length of in_use array in check_for_dupid
2013-03-10 05:46:24 +00:00
ddddb7bab1 code cleanup: favor braces when blocks have mixed brace use. 2013-03-09 03:46:30 +00:00
dfa8540cdf use bool for rna funcs. 2013-03-07 02:44:55 +00:00
53b7bc8f1f Change !BLI_ghashIterator_isDone to BLI_ghashIterator_notDone. It is
always used in that context so we can at least avoid reverting it twice
:p.
2013-03-06 20:55:04 +00:00
f44b54d2a7 patch [#34103]
from Lawrence D'Oliveiro (ldo)

More use of bool type, necessitating adding inclusion of BLI_utildefines.h, or moving it up in the inclusion order if it was already included, in various places
- storage.c: make some variables only used in bli_builddir local to that
- storage.c: BLI_file_descriptor_size should allow 0 as a valid file descriptor
- path_util.c: make pointers to non-reentrant storage returned from folder routines const, necessitating making variables holding these returned pointers const elsewhere as well
- path_util.c: BLI_string_to_utf8 closes iconv context in case of conversion error
-  blf_lang.c: fill_locales routine now has its own "languages" local variable to construct paths (was stealing internal storage belonging to BLI_get_folder before)
2013-03-05 03:17:46 +00:00
0d5b028d43 patch [#34103] use boolean in path functions and add comments.
path_util_1.patch from Lawrence D'Oliveiro (ldo)
2013-03-04 19:27:51 +00:00
013a176c52 patch [#34103] use booleans for extensions testing.
bli_testextensie.patch - from Lawrence D'Oliveiro (ldo)
2013-03-04 18:36:37 +00:00
0ac07404ba style cleanup: braces with multi-line statements, also add some comments. 2013-03-01 14:47:06 +00:00
a62eeb9d8f fix [#34423] Foreach_get crash for any non existant attribute
also improve exception messages.
2013-02-26 00:31:36 +00:00
7f1ae2497b fix [#34275] Text autocomplete cuts words with accents or special characters
autocomplete is now unicode aware, using python api's checks for now. eventually we should have our own.
2013-02-19 16:13:41 +00:00
1a620ac9c3 bpy.props.RemoveProperty() py api docs were still incorrect. 2013-02-19 15:21:12 +00:00
6550fb8452 bpy.props.RemoveProperty() had incorrect docstring. 2013-02-19 02:48:14 +00:00
098e4234b1 minor change to own recent commit with transform fcurve centers and some style edits and typo corrections. 2013-02-19 02:30:02 +00:00
c6b3e0f8e4 style cleanup 2013-02-14 23:49:30 +00:00
43f4f807d9 Fix physics' name not translated in main physics panel (reported on bf-translations ML).
This also revealed another bug, as you could not explicitely set default context to text_ctxt UI func parameter (None is not accpeted by RNA string props), so I had to change default context from py POV to "*" instead of None.

Anyway, that physics UI translation remains weak, as the trick used here (helper func) prevents message extractor script to directly find them. Currently it works because specified labels are also defined elsewhere, but it would be nice to have some kind of "translation markers" in py code too (similar to our N_/CTX_N_ C macros, unfortunately python does not have preprocessing ;) )...
2013-02-13 11:52:01 +00:00
0ec23efbf2 bmesh operators exceptions were not cleared after raising as a python exception.
also clear before calling the operator.
2013-02-13 04:55:05 +00:00
42feb45c5f report [#33731] Fastorigin addon crashes on mesh.update()
add a warning when python leaves the modified mesh without calling bmesh.update_edit_mesh()s.
this doesn't fix the crash but points to the likely cause.
2013-02-12 11:04:52 +00:00
d0f4a2396b Actually, UI scripts should not use directly pgettext, but rather the iface or tooltip variants. Added those to bpy.app.translations, and used pgettext_iface.
(Did not add those when I created that module, because I did not thought we would actually need them in usual UI code, but turned out I was wrong).

Also made some optimizations in those py gettext funcs, when i18n is disabled at build time, no need to do pyobject -> cstring -> pyobject conversions!.
2013-02-10 10:29:38 +00:00
95b28a65f3 Cleanup: happily remove no-more-used PY_TRANSLATE RNA prop flag, and related code (just realized that flag value was wrong, probably own typo in a previous commit :/ ).
That "trick" was nice when introduced, but it became kind of a pita since we added translation contexts...
2013-02-08 15:16:57 +00:00
8d47c2a208 fix for regression in bpy-api, python context passed to operators couldn't override collections. 2013-02-07 04:04:12 +00:00
296444e1dc style cleanup: some warnigs & spelling. 2013-02-06 14:02:19 +00:00
12ef1b63e2 fix for building blender as a python module,
changes to internal import behavior of py3.3 broke it.
2013-02-06 13:14:11 +00:00
c80db5878b some fixes for building blender as a python module again (wip, more work needed). 2013-02-06 13:07:45 +00:00
ec97183876 add python api docstring for 'bpy.types.Operator.bl_property' 2013-02-05 05:09:19 +00:00
a8601a5702 fix [#34113] operator_menu_enum() - Tooltip not showing descriptions
Python wasn't able to set 'OperatorType.prop', which is used by uiButGetStrInfo().

add 'bl_property' to python operators which is assigned to OperatorType.prop when registering.

(api docs coming next)
2013-02-05 04:41:11 +00:00
4528405597 add BM_edge_is_contiguous(), check for python api. 2013-02-04 10:14:31 +00:00
6fca85780b style cleanup: also correct doc example for 'foreach_get/set' 2013-02-02 00:34:34 +00:00
2a71e4e4f0 make WITH_HEADLESS build again. 2013-02-01 08:24:18 +00:00
69585591d6 Correct fix for r54164, the testcase I was using worked but different edge slide examples didn't.
Edge slide needed to check for concave ngons too.

add BM_loop_is_convex() and expose to python too.
2013-01-29 03:25:47 +00:00
Lukas Toenne
c8d29c1af8 Fix for RNA FUNC_REGISTER/FUNC_REGISTER_OPTIONAL flags: The test in bpy validation of classes actually always passed for mandatory functions. This only worked since they all use fallback default implementations internally. 2013-01-28 12:17:49 +00:00
f44b7868c5 add mathutils function to intersect 2 circles. Converted to C from a python script by Alex Fraser. 2013-01-28 11:52:17 +00:00
f2a1a795cf Fix [#33997] Units Scale in Metric mode displays wrong face area.
Also now display nice "area" units (maybe using "length" units was a perf matter, but anyway, you can't have more than a few tens of values displayed at a time, after that they become unreadable). Easy to undo anyway if we really want to keep ugly "10m" as area display!
2013-01-25 21:21:38 +00:00
7803b51b42 Fixed for strict compiler flags 2013-01-24 13:43:37 +00:00
6146110270 Final memory fix for bpy.app.translations (not really a leak, but unfreed memory at end of program - I thought addons were unregistered at quit time...). 2013-01-24 11:38:17 +00:00
327b17b26f Fix #31338: python enum properties can now specify icons for items, in the following
order: (identifier, name, description, icon, unique number)

This also works without the icon still, for compatibility.
2013-01-23 21:55:11 +00:00
bb14b390e5 Fix own stupid memory leak in new py i18n code (forgot to free temp keys when searching messages in GHash cache!).
Thanks to PerfectionCat for finding this.
2013-01-23 07:59:07 +00:00
63edcf785e Fix for build with scons whithout i18n support.
This should not be needed, I really see no reason for this linking error, but I'd rather use this hack than wasting more time over this issue. When will we get rid of this "two build systems to maintain" time-wasting situation?
2013-01-22 14:55:34 +00:00
3406bafc59 comments for RNA_def_property_ui_range() and clamp some out-of-range values. 2013-01-22 11:23:05 +00:00
4c0ebedc66 On second thought, exposes bpy.app.translations also when built without i18n support, this will avoid the need for py scripts to test for its presence everywhere! 2013-01-21 15:10:22 +00:00
e0063bd74f Print warnings when invalid py dict/key/value is found in translations data (do not error here, this is not critical and can be ignored/skiped, and it would break translations for other addons as well). 2013-01-21 12:01:47 +00:00
57221e13ee Expose locale_explode in bpy.app.translations, will be handy in i18n manipulation scripts/addons. 2013-01-21 10:57:24 +00:00
3aa499f3f7 I18n fix: "" context is not the same as NULL context!
This bug did not appear earlier because the "" default context was actually never used, always NULL context was passed instead. But bpy.app.translations uses "" as default context in its keys (simplifies the hash/comp functions of internal py messages cache)...

So now, Blender prefers NULL (None in python) as default context value, but understands also "" as such.
2013-01-21 10:52:34 +00:00
d05f46c12d minor changes to _build_translations_cache(), remove unneeded NULL checks and use slightly different funcs for getting strings. 2013-01-21 02:40:36 +00:00
38cee985bb code cleanup: style & warnings. 2013-01-21 02:30:40 +00:00
cef730d969 Python i18n API. Many thanks to Campbell and Brecht for the reviews and suggestions!
This commit adds:
* A new bpy.app.translations module giving some info about locales/translation stuff (current active locale, all locales currently known by blender, all translation contexts currently defined, etc.).

* The ability for addons to feature translations, using the (un)register functions of above module.

* Also cleans up "translate py string when storing into RNA prop" by removing "PROP_TRANSLATE" string's subtype, and adding a PROP_STRING_PY_TRANSLATE flag instead (this way it is no more exposed to python...).

Addon translations work with py dictionaries: each addon features a dict {lang: {(context, message): translation, ...}, ...}, which is registered when the addon is enabled (and unregistered when disabled). 

Then, when a key (context, message) is not found in regular mo catalog, a cache dict for current locale is built from all registered addon translations, and key is searched in it.

Note: currently addons writers have to do all the work by hand, will add something (probably extend "edit translation" addon) to automate messages extraction from addons soon(ish)! To get a look to expected behavior from addons, have a look at render_copy_settings/__init__.py and render_copy_settings/translations.py (rather stupid example currently, but...). Once we have a complete process, I'll also update relevant wiki pages.
2013-01-20 17:29:07 +00:00