Commit Graph

443 Commits

Author SHA1 Message Date
Campbell Barton 43c478a36a Py API: refactor py text compiling into its own function 2014-02-14 22:03:09 +11:00
Campbell Barton a5c35fb27f Code cleanup: use booleans where appropriate 2014-01-28 04:00:04 +11: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 0a5e00e8e8 Code Cleanup: style 2013-12-24 05:04:29 +11:00
Sergey Sharybin 3cc7978f19 Move python threading stuff to own file in bf_python_ext
This way blender player can easily use BPY_thread_save/restore.
Not so much important for master branch, but crucial to solve
linking issues in threaded depsgraph branch.
2013-12-23 23:14:10 +06:00
Campbell Barton 1815225faa Blender Font (BLF): add length argument to string width/height functions
This also fixes a crash editing buttons longer then UI_MAX_DRAW_STR
2013-12-02 21:10:07 +11:00
Campbell Barton 85bbef0f4e python api internals: no need to set the stop-iter exception string. 2013-11-17 15:09:57 +11:00
Campbell Barton bbade535fb fix for crash when deleting from an id property, with a non-string key. 2013-11-08 08:46:43 +00: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 d3a89fc9b7 add typechecks when assigning id-property arrays from python (overflows and errors weren't detected)
reduce/simplify exceptions more.
2013-10-17 03:18:21 +00:00
Campbell Barton a619de52cf simplify & improve error handling for id-property python-api. 2013-10-17 02:57:59 +00:00
Campbell Barton f5660a05b1 fix [#37105] Long int IDproperties produces errors at weird spots. 2013-10-17 02:36:33 +00:00
Campbell Barton 089d0ad8f9 add IDP_FreeFromGroup(), replaces IDP_RemFromGroup(), IDP_FreeProperty(), MEM_freeN(). 2013-10-16 05:29:28 +00:00
Campbell Barton d6b21df2e6 correct include guards and add checks in check_style_c.py for them. 2013-09-19 23:17:52 +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 14ab39c5e0 minor improvements
- calc normals only check flag when needed.
- keymap, dont get name unless its needed.
- keymap, avoid property lookup.
- idprop debug print, include pointer, helpful for troubleshooting.
2013-07-09 00:13:17 +00:00
Campbell Barton 418011907c remove nan copyrights from code added since blender become opensource (copy paste errors), also remove BKE_script.h 2013-07-02 10:14:59 +00:00
Campbell Barton 225c5fee6b move BLO_sys_types.h -> BLI_sys_types.h (it had nothing todo with loading)
remove MEM_sys_types.h which was a duplicate.
2013-05-28 19:35:26 +00:00
Campbell Barton 16b82845ee code cleanup: add 'const' to headers to quiet msvc warnings, also remove (char *) casts that aren't needed now we're on Python3.3 2013-03-17 18:30:31 +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 ddddb7bab1 code cleanup: favor braces when blocks have mixed brace use. 2013-03-09 03:46:30 +00:00
Campbell Barton 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
Campbell Barton 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
Campbell Barton c80db5878b some fixes for building blender as a python module again (wip, more work needed). 2013-02-06 13:07:45 +00:00
Campbell Barton e24443b79a style cleanup 2013-01-09 03:30:15 +00:00
Campbell Barton 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
Campbell Barton 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
Campbell Barton 1a7638fa94 add id property clear function (matching the same python function for dicts/lists) 2013-01-02 23:10:14 +00:00
Campbell Barton 857df8065f style cleanup 2012-12-28 14:19:05 +00:00
Campbell Barton 9d0334bc74 add missing bgl and gpu api docstrings (found using docstring completeness checker) 2012-11-22 05:15:52 +00:00
Campbell Barton 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
Campbell Barton b867f9f17e style cleanup: comments & spelling 2012-11-18 01:22:31 +00:00
Campbell Barton 2bb174cfa4 style cleanup: indentation 2012-11-09 09:33:28 +00:00
Campbell Barton 41bfb62b0f was trying to make py import follow pythons own code more but broke py32 compat. this should fix 2012-11-06 13:29:00 +00:00
Campbell Barton 92bb31c10e fix for imp.reload() with Python3.3, function was recursively calling its self. 2012-11-06 11:43:19 +00:00
Campbell Barton 004f8d78ed default to Python3.3 on Linux for SCons and CMake, warn when building with python 3.2x or older.
also remove casts to keep Python3.2 warning quiet.
2012-11-05 13:48:42 +00:00
Campbell Barton 9b948717b0 code cleanup: float <> double conversion. 2012-11-03 18:23:30 +00:00
Campbell Barton 25591e958d style cleanup: tabs & whitespace 2012-11-03 15:35:03 +00:00
Campbell Barton 1bcadda46b fix [#30910] Problems: Add Shortcut(s) for "Ctrl Tab" menu
comparing keymaps was too sloppy or too strict, now sloppy keymap comparison works by setting all the operator
properties to their default values if they are not already set, then compare this with the keymap item (ignoring values missing from either one).

... this way any non default keymap setting wont match with an operator menu item which doesnt set this operator at all (a problem sighted in this bug report).


developer notes:
- IDP_EqualsProperties_ex() function adds an argument to treat missing members of either group to act as if there is a match.
- WM_operator_properties_default() function to reset RNA values to their defaults.
- add IDP_spit(), debug only function to print out ID properties.
2012-10-31 20:29:32 +00:00
Campbell Barton c7fbeded4c add IDP_MergeGroup(dst, src, overwrite) function,
like PyDict_Merge()
2012-10-31 19:07:25 +00:00
Campbell Barton f3ece5a108 style cleanup: trailing tabs & expand some non prefix tabs into spaces. 2012-10-21 05:46:41 +00:00
Campbell Barton 8437980b81 optimization for PyObject -> ID-property sequence conversion, use PySequence_Fast. 2012-10-12 03:59:50 +00:00
Campbell Barton f97dfdf227 quiet clang static checker warning by returning an error for invalid situation getting an IDProp mapping from a PyObject.
also print the path installed to when installing an addon.
2012-10-12 03:24:47 +00:00
Campbell Barton 97d4fb4161 code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo too. 2012-10-09 13:36:42 +00:00
Campbell Barton 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
Campbell Barton 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
Campbell Barton 589ada7f0c code cleanup: correct spelling 2012-09-28 06:45:20 +00:00
Campbell Barton a9f10b6bc2 style cleanup 2012-09-08 06:40:03 +00:00
Campbell Barton 3804b2d2ba fix [#31856] movieclips.load(filepath=None) or value crash Blender
workaround for python bug/inconsistency
2012-09-04 05:36:07 +00:00