Commit Graph

79 Commits

Author SHA1 Message Date
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
fc5df9d634 Reverting changes made in r48030 by Campbell's request 2012-06-18 13:46:57 +00:00
35b3736b16 Fix #31856: movieclips.load(filepath=None) or value crash Blender
Disallow running PyUnicode_EncodeFSDefault for None type which seems
to be an issue on Windows.
2012-06-18 12:34:19 +00:00
dfc19a1ff7 BGE patch #28476: Character object physics type
===============================================
This patch adds a new "Character" BGE physics type which uses Bullet's btKinematicCharacter for simulation instead of full-blown dynamics. It is appropiate for (player-controlled) characters, for which the other physics types often result unexpected results (bouncing off walls, sliding etc.) and for which simple kinematics offers much more precision.

"Character" can be chosen like any other physics type in the "Physics" section of the properties window. Current settings for tweaking are "Step Height" (to make the object automatically climb small steps if it collides with them), "Fall Speed" (the maximum speed that the object can have when falling) and "Jump Speed", which is currently not used.

See http://projects.blender.org/tracker/?func=detail&atid=127&aid=28476&group_id=9
for sample blends and a discussion on the patch: how to use it and what influences the behavior of the character object.

Known problem: there is a crash if the "compound" option is set in the physics panel of the Character object.
2012-05-28 21:36:29 +00:00
2f5173887e disable overwriting the PYTHONPATH for windows - reported as [#31506] 2012-05-19 10:10:49 +00:00
11d12d945e style cleanup: python api 2012-03-26 06:55:09 +00:00
81d8f17843 style cleanup: pep8, indentation 2012-03-24 07:36:32 +00:00
5a90ea77bc style cleanup: follow style guide for formatting of if/for/while loops, and else if's 2012-03-24 06:24:53 +00:00
b56d2f9766 fix [#30623] user-defined render presets bug
this report exposed multiple bugs in blender when using a non utf8 compatible home directory.

- bpy.utils.script_paths() would crash when homedir wasn't utf8 (reported bug)
- PyC_DefaultNameSpace() - would raise an error when running when __file__ was non utf8.
- preset filepath property was not set to accept non utf8.
- bpy.paths.display_name would raise an error on non utf8 paths, (used for preset draw)
2012-03-21 22:29:49 +00:00
4f19c1a995 spelling cleanup 2012-03-18 07:38:51 +00:00
70d3d1aca6 style cleanup: py/capi 2012-03-16 21:39:56 +00:00
89a963fb7f style cleanup: comment blocks 2012-03-09 18:28:30 +00:00
4f7bdc59d3 style cleanup: spelling.
also remove large, duplicate comments from sunsky.h
2012-03-09 00:41:09 +00:00
1531e3677a bmesh py api
* add BLI_rfindlink for reverse index lookup (used so bm.select_history[-1] doesn't have to loop the entire list twice).
* add bm.select_history.active so you can get the last selected item or None without having to check seq length.
2012-03-03 22:07:58 +00:00
3590076193 style cleanup - comment formatting 2012-03-03 20:36:09 +00:00
3fc2fbc333 style cleanup, use { on newline after function definition.
spelling 'impliment' -> 'implement'
2012-02-25 16:49:59 +00:00
3788adb8cb utility functions to convert between flags / sets, without depending on RNA API. 2012-02-22 09:15:46 +00:00
c4e7cc3287 fix for leak in gpu.export_shader(), wasnt freeing the function.
also change the bmesh iterator so its possible to initialize without stepping.
2012-02-20 22:04:29 +00:00
4acab3eb33 Code Cleanup: line length and use Py_ssize_t for PyC_AsArray utility function. 2012-02-05 02:04:26 +00:00
9c9099a805 formatting edits in py api, no functional changes 2011-12-18 08:50:06 +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
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