Campbell Barton
d022794cad
Cleanup: rename checks for Python struct strings
...
Using 'format' prefix made this read as if t was for string formatting.
Use 'PyC_StructFmt' prefix instead since these values are compatible
with formatting from Python's 'struct' module.
2018-10-08 08:37:32 +11:00
mano-wii
af7967b010
CPython: py_capi_utils: format char utilities do not need to be inline.
2018-10-07 12:22:17 -03:00
Campbell Barton
63658ae76d
Cleanup: redundant include
2018-09-26 10:55:22 +10:00
Brecht Van Lommel
a4f2ebc78d
Spelling fixes in comments and descriptions, patch by luzpaz.
...
Differential Revision: https://developer.blender.org/D3700
2018-09-19 18:18:05 +02:00
Campbell Barton
7ff1750218
PyAPI: add optional imports to expression eval API
...
Avoids having to use `__import__` to access modules.
2018-09-03 12:43:43 +10:00
Campbell Barton
0ddf3e110e
Cleanup: comment blocks
2018-09-02 18:51:31 +10:00
Campbell Barton
98800aa4e0
C/Python API: Add PyC_RunString_AsIntPtr
...
Utility to get an int or pointer from a Python expression.
2018-08-31 14:21:32 +10:00
Campbell Barton
ddee0931b8
RNA: use bool for boolean RNA types
...
We were using int's for bool arguments in BKE,
just to avoid having wrapper functions.
2018-07-01 15:57:59 +02:00
Campbell Barton
a69f985f40
PyAPI: move deep-copy args check to py_capi_utils
2018-06-26 09:31:57 +02:00
Campbell Barton
7719c11006
Cleanup: strip trailing space in Python module
2018-06-04 08:54:40 +02:00
Campbell Barton
31f2a6755d
PyAPI: Add PyC_Tuple_Pack_F64 utility
2018-04-02 19:48:34 +02:00
Campbell Barton
017c731cf3
Logging: use for Python API
...
Adds categories "bpy.context" & "bpy.rna"
2018-04-02 13:13:57 +02:00
Campbell Barton
0b325ba201
PyAPI: PyC_Err_PrintWithFunc utility function
...
Move function error printing utility into py_capi_utils.
2017-11-29 13:41:10 +11:00
Campbell Barton
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
Campbell Barton
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
Campbell Barton
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
Campbell Barton
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
Campbell Barton
d863b5182e
Cleanup: use return args last and 'r_' prefix.
2017-03-18 09:39:36 +11:00
Campbell Barton
2dfc954c4a
PyAPI: Add PyC_UnicodeAsByteAndSize
...
Read the string length from Python directly when assigning id-properties
2016-07-31 16:52:44 +10:00
Campbell Barton
c885cea7bb
Cleanup: spelling
2016-07-16 17:48:57 +10:00
Campbell Barton
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
Brecht Van Lommel
21fddf7d1c
C99/C++11: replace deprecated finite() by isfinite().
2016-05-17 21:39:16 +02:00
Campbell Barton
0ffc603553
Cleanup: Py API naming
...
Use BPY_execute_* prefix for all Python execution commands
2015-12-31 21:20:41 +11:00
Campbell Barton
41a2b97c30
Minor changes needed for standalone mathutils
2015-12-07 11:09:00 +11:00
Campbell Barton
d7d1fc5c74
Cleanup: use correct name in prints
2015-11-25 23:54:39 +11:00
Campbell Barton
00afa02528
PyAPI: remove workaround for Py3.4 bug
2015-11-25 21:54:02 +11:00
Campbell Barton
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
Campbell Barton
365d8ceac0
Workaround for linking Python on win32
2015-09-23 23:20:15 +10:00
Campbell Barton
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
Campbell Barton
6844b02a71
Fix for building w/ Python3.6
2015-09-19 17:49:38 +10:00
Campbell Barton
42d65ef5cc
Add bool parser for PyArg_ParseTuple
...
Use for mathutils.bvhtree
2015-08-03 20:00:16 +10:00
Campbell Barton
339915a962
Optimize PySequence_Fast usage
...
Access arrays directly, avoiding type-check every time.
2015-07-29 10:49:35 +10:00
Campbell Barton
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
Campbell Barton
3ce4a58aa9
Cleanup: duplicate includes
2015-06-18 06:32:01 +10:00
Campbell Barton
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
Campbell Barton
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
Campbell Barton
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
Campbell Barton
9f05588b68
Python: remove redundant casts
2014-07-01 14:10:59 +10:00
Bastien Montagne
87930eb7c2
Hopefully fix compilation with old MSVC2008/WIN32...
2014-06-18 10:32:25 +02:00
Bastien Montagne
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
Campbell Barton
f2a0062042
Use ARRAY_SIZE to replace (sizeof(a) / sizeof(*a))
2014-06-17 02:47:57 +10:00
Tamito Kajiyama
f325ddb0d7
Fix Python fails to execute text-blocks including non-mbcs chars (T35176, D595)
2014-06-16 15:29:25 +10:00
Campbell Barton
b96d531bc9
Python: move to version 3.4x on all platforms
2014-04-30 23:19:16 +10:00
Campbell Barton
3d9b4159a4
PyC_RunQuicky: Print filename when its missing
2014-04-29 02:55:59 +10:00
Campbell Barton
e73d0f57a3
Code cleanup: use 'const' for arrays (python)
2014-04-27 00:25:15 +10:00
Campbell Barton
90efa345c2
Python API: utility function for filling a tuple with a single value.
2014-01-06 16:46:00 +11:00
Campbell Barton
6d5024828b
add local _PyLong_AsInt() needed for python older then 3.3.2
2013-10-17 09:58:36 +00:00
Campbell Barton
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
Campbell Barton
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
Campbell Barton
1bf5832dfb
code cleanup: warnings and use stdbool for bpy* funcs.
2013-01-07 05:26:12 +00:00