Commit Graph

36 Commits

Author SHA1 Message Date
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
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
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
018fa1540e whitespace edits, make formatting for functions consustent at least within the file. 2011-09-28 05:53:40 +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
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
8cc307b4f2 PyC_ExceptionBuffer is now threadsafe, used for converting exceptions into reports. 2011-09-03 06:46:31 +00:00
d5984b2d50 fix [#27683] Blender hangs when baking a particle system when a driver is present 2011-07-09 17:41:39 +00:00
7cbc4c0dd7 IDProperty python module update
- add support for IDProp array slicing, but not resizing.
- rename array attribute type to typecode and use chars 'f', 'd', 'i' which match pythons array module. (was using int's which only have a meaning internally).
- rename function 'convert_to_pyobject' to 'to_dict' and 'to_list' for IDProp group and array types respectively.
- remove 'len' array attribute, calling len(array) is fine.
2011-06-17 05:45:46 +00:00
9dda11e0f1 correction for windows. 2011-04-18 10:18:35 +00:00
0814cdf54e fix [#26951] blenderplayer and runtimes will not load
blenderplayer wasn't finding bundled python, eg: ./2.57/python/lib
2011-04-18 08:27:50 +00:00
a21f46b6d4 new function RNA_warning(), replaces printf with function which may be called via python.
Now this gives the line number of the scripts thats running, eg:

uiItemFullO: unknown operator 'some.operator'
/c/bin/2.56/scripts/startup/bl_ui/space_view3d_toolbar.py:73
2011-03-25 04:36:10 +00:00
cadc1218c8 C, style changes (mostly white space edits), no functional change. 2011-03-19 11:12:48 +00:00
471c0c1afb py-api utf8/filepaths:
in function PyC_UnicodeAsByte(), replace code copied from python with PyUnicode_EncodeFSDefault(), new in py3.2.
2011-03-08 01:28:10 +00:00
cfd9d6d190 Drop support for python 3.1.
for building py3.2 on *nix see:
  http://wiki.blender.org/index.php?title=Dev:2.5/Doc/Building_Blender/Linux/Troubleshooting#Python

also fixed possible buffer overrun with getting the fake filepath for a blender textblock.
2011-03-07 11:53:40 +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
8186ba15ab last commit used py3.2 function, inline for py3.1 2011-02-22 08:29:25 +00:00
1e120098fc pyapi, use direct access to the frame rather then python attributes. 2011-02-22 07:57:18 +00:00
6524d27462 py api was raising SystemError exception incorrectly, this is intended for internal interpreter problems.
Replace most with RuntimeError.
2011-02-18 06:04:05 +00:00
72bc3f22b7 python api renaming and added headers for some files which didnt have one, no functionality change. 2011-02-14 04:15:25 +00:00
ffe7bde02c correct fix for bug #23871, __main__ module was being overwritten in nested functions, so on returning from calling operators the __main__ module could be cleared and imported modules turn into None
calling
  bpy.ops.wm.read_factory_settings()
... would clear a scripts namespace if running directly, not in a module.


Fix by backing up and restoring the __main__ module.

Also found BKE_reportf wasnt printing all reports in background mode as BKE_report() was doing.
2011-02-01 12:37:53 +00:00
0362d19f2d Pythons path functions - os.walk(). os.path.exists(). etc support bytes for paths as well as strings, support this with blender/rna too.
- bpy.data.*.load() functions were only accepting UTF-8 paths.
- rna functions/properties now accept byte values rather then strings for file paths.
- bpy.path.resolve_ncase now supports byte objects.
2011-02-01 04:24:47 +00:00
f0951e86ee fix for PyC_LineSpit() finding the current line of the frame's code object. 2010-12-23 00:19:34 +00:00
260687d9b1 use PyUnicode_DecodeFSDefault rather then PyUnicode_DecodeUTF8(str, strlen(str), "surrogateescape"), for converting non utf8 names.
this is needed because some UTF8 names didnt resolve on windows when using surrogateescape'd strings.

This meant you couldn't export to models some directories on windows.
2010-12-05 09:20:18 +00:00
263830f000 Enabled GCC -Wwrite-strings warning for CMake and replaced many 'char's for 'const char's,.
Only one functional change where Transform orientations passed "" to BIF_createTransformOrientation() which could then have the value written into.
2010-12-03 17:05:21 +00:00
874ffaca7b typo in function prefix. 2010-10-03 23:29:43 +00:00
1615c9e435 python/c utility function for debugging, see http://wiki.blender.org/index.php/Dev:Doc/Debugging/PyFromC 2010-09-19 14:02:45 +00:00
db7a4e530e move namespace creation function into py_capi_utils.c, to be used in more general cases, not just the blender/rna api. 2010-09-18 15:30:03 +00:00
1c4b6ff334 SVN maintenance. 2010-09-01 19:39:37 +00:00
39cb1432d8 bugfix [#23285] Exporters not available whel using special characters in path name
- ID properties now suopport non utf-8 strings for their values but not their keys.
- moved utility functions into py_capi_utils.c from bpy_utils and bpy_rna.
- import/export paths have to be printed with repr() or %r, so non utf-8 chars are escaped.
2010-09-01 14:13:48 +00:00