0b325ba201
PyAPI: PyC_Err_PrintWithFunc utility function
...
Move function error printing utility into py_capi_utils.
2017-11-29 13:41:10 +11:00
691ed21842
PyAPI: replace PyC_FromArray with typed functions
...
This was meant to be generic but introduced possible type errors
and unnecessary complication.
Replace with typed PyC_Tuple_PackArray_* functions.
Also add PyC_Tuple_Pack_* macro which replaces some uses of
Py_BuildValue, with the advantage of not having to parse a string.
2017-08-22 18:10:57 +10:00
a10a7f42de
PyAPI: Integer conversion functions
...
Python's C-API doesn't provide functions to get
int's at specific integer sizes.
Leaving the caller to check for overflow,
which ended up being ignored in practice.
Add API functions that convert int/uint 8/16/32/64, also bool.
Raising overflow exception for unsupported ranges.
2017-08-20 15:39:08 +10:00
3d1e5bca88
PyAPI: don't use deprecated PyModule_GetFilename
...
Allows compiling with newer Python versions.
Also add missing decref when compiling as a py-module.
2017-07-17 12:53:55 +10:00
e392bb4937
PyAPI: add BPY_execute_string_as_string
...
Utility to execute a string and get the resulting string,
matching BPY_execute_string_as_number.
Not used just yet but generally useful function.
2017-03-18 12:19:03 +11:00
d863b5182e
Cleanup: use return args last and 'r_' prefix.
2017-03-18 09:39:36 +11:00
2dfc954c4a
PyAPI: Add PyC_UnicodeAsByteAndSize
...
Read the string length from Python directly when assigning id-properties
2016-07-31 16:52:44 +10:00
c885cea7bb
Cleanup: spelling
2016-07-16 17:48:57 +10:00
f5e020a7a6
PyAPI: fix memory leaks in dictionary assignment
...
Thanks to Kévin Dietrich for spotting driver leak,
checked other uses of PyDict_SetItem and found more.
2016-07-14 17:30:52 +10:00
21fddf7d1c
C99/C++11: replace deprecated finite() by isfinite().
2016-05-17 21:39:16 +02:00
0ffc603553
Cleanup: Py API naming
...
Use BPY_execute_* prefix for all Python execution commands
2015-12-31 21:20:41 +11:00
41a2b97c30
Minor changes needed for standalone mathutils
2015-12-07 11:09:00 +11:00
d7d1fc5c74
Cleanup: use correct name in prints
2015-11-25 23:54:39 +11:00
00afa02528
PyAPI: remove workaround for Py3.4 bug
2015-11-25 21:54:02 +11:00
4aad17c622
Use PyThreadState_GetDict, avoid Python internals
...
Works around problems caused by exposing Py internals (Py_BUILD_CORE).
- Build error with GCC, Py3.6 & OpenMP
- Linking error on MSVC
2015-09-26 12:02:17 +10:00
365d8ceac0
Workaround for linking Python on win32
2015-09-23 23:20:15 +10:00
7b9bd5b546
Recent change for Py3.6 compat caused fatal-error
...
Revert back to old method, and define Py_BUILD_CORE to expose internals.
2015-09-21 23:08:18 +10:00
6844b02a71
Fix for building w/ Python3.6
2015-09-19 17:49:38 +10:00
42d65ef5cc
Add bool parser for PyArg_ParseTuple
...
Use for mathutils.bvhtree
2015-08-03 20:00:16 +10:00
339915a962
Optimize PySequence_Fast usage
...
Access arrays directly, avoiding type-check every time.
2015-07-29 10:49:35 +10:00
d226a4ba6d
Fix leak in PyC_AsArray
...
Would only happen when the list-length was an unexpected size.
Also add PyC_AsArray_FAST
2015-07-29 10:49:34 +10:00
3ce4a58aa9
Cleanup: duplicate includes
2015-06-18 06:32:01 +10:00
29aae4db38
UI: errors in buttons now show in info report
...
Mistakes in button expressions were previously only printed to the console.
2015-05-18 10:02:29 +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
43fa4baa6c
Refactor: BLI_path_util (part 2)
...
Use BKE_appdir/tempdir naming prefix for functions extracted from BLI_path_util
2014-11-23 18:55:52 +01:00
9f05588b68
Python: remove redundant casts
2014-07-01 14:10:59 +10:00
87930eb7c2
Hopefully fix compilation with old MSVC2008/WIN32...
2014-06-18 10:32:25 +02:00
f94b87bbb8
New python API for units handling.
...
Exposes all supported unit systems & types, and to_value()/to_string() functions.
Reviewed and enhanced by CampbellBarton, many thanks!
Differential Revision: https://developer.blender.org/D416
2014-06-17 16:03:40 +02:00
f2a0062042
Use ARRAY_SIZE to replace (sizeof(a) / sizeof(*a))
2014-06-17 02:47:57 +10:00
f325ddb0d7
Fix Python fails to execute text-blocks including non-mbcs chars (T35176, D595)
2014-06-16 15:29:25 +10:00
b96d531bc9
Python: move to version 3.4x on all platforms
2014-04-30 23:19:16 +10:00
3d9b4159a4
PyC_RunQuicky: Print filename when its missing
2014-04-29 02:55:59 +10:00
e73d0f57a3
Code cleanup: use 'const' for arrays (python)
2014-04-27 00:25:15 +10:00
90efa345c2
Python API: utility function for filling a tuple with a single value.
2014-01-06 16:46:00 +11:00
6d5024828b
add local _PyLong_AsInt() needed for python older then 3.3.2
2013-10-17 09:58:36 +00:00
4dd7d4110a
replace macro PYC_INTERPRETER_ACTIVE for PyC_IsInterpreterActive() function call,
...
(indirectly referenced Python define of ~30 lines, most were optimized out but still caused some code bloat).
2013-09-18 23:21:24 +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
1bf5832dfb
code cleanup: warnings and use stdbool for bpy* funcs.
2013-01-07 05:26:12 +00:00
Lukas Toenne
e8b415bdb4
This patch adds support in bpy.props for getter/setter callback functions. We already have update callbacks, but generic get/set functions can come in handy in some cases where the functionality is too complex to use a single value.
...
The current C callback functions are too simple allow a straightforward implementation, in particular they don't receive the PropertyRNA pointer itself as an argument, which means the callback cannot directly access the PropertyRNA's py_data pointers which store the python function objects. For this reason a second runtime variant of these callbacks has been added. It is only used for runtime callbacks and not in makesrna, but otherwise works the same way.
2013-01-05 14:56:37 +00:00
9dbe85c17e
expose common extensions for image/movie/audio types, since python scripts had to do this internally.
...
- bpy.path.extensions_image
- bpy.path.extensions_movie
- bpy.path.extensions_audio
eg:
if os.path.splitext(filename)[1].lower() in bpy.path.extensions_image:
... we have an image ...
2013-01-04 03:47:37 +00:00
3fd388fb06
py api cleanup, replace use...
...
- PyLong_FromSsize_t --> PyLong_FromLong
- PyLong_AsSsize_t --> PyLong_AsLong
In all places except for those where python api expects PySsize_t (index lookups mainly).
- use PyBool_FromLong in a few areas of the BGE.
- fix incorrect assumption in the BGE that PySequence_Check() means PySequence_Fast_ functions can be used.
2012-11-21 02:28:36 +00:00
2bb174cfa4
style cleanup: indentation
2012-11-09 09:33:28 +00:00
f3ece5a108
style cleanup: trailing tabs & expand some non prefix tabs into spaces.
2012-10-21 05:46:41 +00:00
b26ccf0aff
toggle cut through in the knife tool now refreshes (before you had to wave the mouse about to see the result).
...
also remove print from last commit.
2012-10-06 03:34:52 +00:00
6a164c7f72
fix [ #32779 ] Bmesh module: assigning to bm.select_mode crashes Blender if bmesh is empty
...
was missing set typecheck
2012-10-06 03:33:11 +00:00
589ada7f0c
code cleanup: correct spelling
2012-09-28 06:45:20 +00:00
3804b2d2ba
fix [ #31856 ] movieclips.load(filepath=None) or value crash Blender
...
workaround for python bug/inconsistency
2012-09-04 05:36:07 +00:00
c43583a23a
fix for own crash caused by curve refactor, now curve tables are initialized once when the tree is initialized.
...
thanks to Antony Riakiotakis for providing a fix, though this works a little different.
2012-08-28 10:02:10 +00:00
4bc46b18d1
handy function for getting a python stacktrace while debugging in gdb
2012-07-19 09:55:49 +00:00
32cf7fcdb1
code cleanup: spelling
2012-07-16 23:23:33 +00:00