Commit Graph

359 Commits

Author SHA1 Message Date
4acab3eb33 Code Cleanup: line length and use Py_ssize_t for PyC_AsArray utility function. 2012-02-05 02:04:26 +00:00
51bada696f Longer names support for all ID and other object names
This commit extends limit of ID and objects to 64 (it means 63 meaning
characters and 1 for zero-terminator). CustomData layers names are also
extended.
Changed DNA structures and all places where length constants were hardcoded.

All names which are "generating" from ID block should be limited by MAX_ID_NAME-2,
all non-id names now has got own define called MAX_NAME which should be used all
over for non-id names to make further name migration stuff easier.

All name fields in DNA now have comment with constant which corresponds to
hardcoded numeric value which should make it easier to further update this
limits or even switch to non-hardcoded values in DNA.

Special thanks to Campbell who helped figuring out some issues and helped a lot
in finding all cases where hardcoded valued were still used in code.

Both of forwards and backwards compatibility is stored with blender versions newer
than January 5, 2011. Older versions had issue with placing null-terminator to
DNA strings on file load which will lead to some unpredictable behavior or even
crashes.
2012-01-11 08:51:06 +00:00
e17fd46c71 formatting edits only to use more consisted style 2011-12-26 12:26:11 +00:00
b21a0f4fa1 formatting edits 120 line length 2011-12-24 02:37:42 +00:00
b59d8c6ba3 fix for own mistake [#29031] Importing BGL Can Crash the BGE and Blender
was adding the Buffer type to the module without increffing
2011-12-23 05:42:06 +00:00
9c9099a805 formatting edits in py api, no functional changes 2011-12-18 08:50:06 +00:00
53d14a78b5 missed removing these files 2011-11-29 10:34:23 +00:00
f95d7c9e66 patch [#29421] Python Noise Module Updates
from Andrew Hale (trumanblending)

Tracker description
*******************

The current python noise module included with Blender has yet to be updated to the new Py API. This patch does so, with the following major points:

- The noise module has now been moved to a submodule of mathutils, it can be accessed by mathutils.noise. It was moved from it's own module as it will now return mathutils types and also have greater visibility to the user.
- All functions which return vectors will now return mathutils.Vector types to be consistent with the rest of the API. Previously (x, y, z) tuples were returned.
- A different implementation of random_unit_vector is now used, this allows 2D, 3D and 4D vectors to be returned. Previously only 3D was possible.
- Some function names have been changed to remove ambiguities and make naming consistent within the module. noise.vector is now noise.noise_vector and noise.vl_vector is now noise.variable_lacunarity
- Doc strings have been updated to be compatible with auto docs.
- Code style and internal naming has been changed to match the conventions in other mathutils code.

Thanks,
Andrew
2011-11-29 10:28:52 +00:00
3db309ee50 fix for own error with id props when adding byte strings 2011-11-26 17:22:11 +00:00
676c2924d9 fix [#29319] bus error with python with link_append and {}
patch from Emil Brink
2011-11-22 14:05:08 +00:00
4924abaad6 replace fabs with fabsf where both input and output are floats. 2011-11-19 01:10:05 +00:00
4de917326b de-duplicate some idproperty py api code, also improve some exception messages. 2011-11-15 10:19:44 +00:00
d4d80ee0a1 rename IDProp.c/h to idprop_py_api, since it was same name as BKE idprop.c with case changed. 2011-11-15 09:28:15 +00:00
8623935aa8 pass a pointer to IDP_New's IDPropertyTemplate rather then a copy. 2011-11-15 09:22:52 +00:00
2ab1732613 support for non-null terminated byte strings in id properties (as a subtype of IDP_STRING types) 2011-11-15 09:12:10 +00:00
e84c0980a3 correct indentation and some whitespace edits (no functional changes) 2011-11-11 13:09:14 +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
62f2218554 macro formatting & remve some unused code. 2011-11-05 05:44:52 +00:00
665f602f15 python string conversion
- use _PyUnicode_AsStringAndSize where possible
- use %R for PyErr_Format(...) rather then running repr on the object explicitly 
- use const char
2011-11-03 14:09:18 +00:00
9905094f5d fix own error r41191 getting id property string lengths. 2011-10-31 01:50:04 +00:00
699030ceb6 use const for readonly strings and set some functions to static 2011-10-27 14:41:26 +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
ebe63b664b py api - added PyC_UnicodeFromByteAndSize() to match PyUnicode_FromStringAndSize()
also made RNA_property_string_get_alloc() return the length of the new string to avoid having to run strlen on it after.
2011-10-22 10:49:35 +00:00
8d6a554d75 - add BLI_string_utf8.h for unicode functions.
- move font.c unicode functions into string_utf8.c and rename to fit with other BLI_string funcs.
2011-10-20 09:47:05 +00:00
445279524a debug build option WITH_PYTHON_UI_INFO, so you can right click and edit the python source for UI layout directly. 2011-10-20 00:48:00 +00:00
276e5f7095 formatting edits & remove debug print. 2011-10-13 01:29:08 +00:00
21eb8b92a0 use newly added ID_BLEND_PATH() in more places. 2011-10-08 11:11:54 +00:00
018fa1540e whitespace edits, make formatting for functions consustent at least within the file. 2011-09-28 05:53:40 +00:00
928e2784c6 py api
- use Py_ssize_t when dealing with python sequence sizes
- dont call PySequence_Size(py_b) in a loop (its slow).
- use faster sequence/float parsing in aud.Factory.filter
2011-09-27 05:28:06 +00:00
d98bcb8a77 fix for py/rna api bug:
PyC_UnicodeAsByte(), used for getting python strings as bytes wasnt clearning utf-8 conversion errors.
  this would raise an error when getting an operators filepath.
2011-09-27 04:07:48 +00:00
58587a3881 replace strncpy with BLI_strncpy, in some cases strncpy was being misused since it doesnt ensure \0 termination.
also dont call CTX_data_scene() twice when checking for function arguments.
2011-09-26 18:51:10 +00:00
0bc5fef976 correct fix for armature selection, also remove international define from generic python C funcs. 2011-09-22 02:33:58 +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
8dbc7a3ba3 Merging r40345 through r40365 from trunk into soc-2011-garlic 2011-09-19 15:47:05 +00:00
9478167493 remove Buffer.list, deprecated before 2.59 release. 2011-09-19 11:55:45 +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
30293dc2ca svn merge -r39834:40222 https://svn.blender.org/svnroot/bf-blender/trunk/blender 2011-09-15 13:02:37 +00:00
264c63ef03 New C/Py api utility function PyC_Err_Format_Prefix() which raises an error with the existing error as a suffix.
Use this to raise errors when assigning a string property fails even though the value to assign *is* a string.


Before:
  TypeError: bpy_struct: item.attr= val: Object.name expected a string type, not str


After:
  TypeError: bpy_struct: item.attr= val: Object.name error assigning string, UnicodeEncodeError('utf-8' codec can't encode character '\udce9' in position 23: surrogates not allowed)
2011-09-15 10:43:55 +00:00
5a900be4d6 attempt to have a threadsafe version of PyC_ExceptionBuffer didnt work with UI script errors, reverting r39886. 2011-09-08 02:14:24 +00:00
9161d3ce4b use Py_ssize_t rather than int when dealing with list sizes (original patch from Fedora but applied changes elsewhere too), also replace PyList_Size with PyList_GET_SIZE where typechecking is already done. 2011-09-06 23:46:20 +00:00
8cc307b4f2 PyC_ExceptionBuffer is now threadsafe, used for converting exceptions into reports. 2011-09-03 06:46:31 +00:00
Xiao Xiangquan
981f7fcd0d merge with trunk r39834 2011-09-01 15:08:32 +00:00
00143a3d55 spaces -> tabs (configure you're editors right!) 2011-09-01 01:48:50 +00:00
Xiao Xiangquan
5b91a783cf fix for windows locale setting 2011-08-31 07:31:02 +00:00
f8ec017900 floats were being promoted to doubles in quite a few cases (using gcc's -Wdouble-promotion), went over render module and use float constants, gives small but consistent speedup - approx 3%. 2011-08-20 17:39:13 +00:00
Xiao Xiangquan
3a8c7be9e4 code clear, insert blf_gettext.c to blf.c 2011-08-12 13:43:21 +00:00