Commit Graph

102 Commits

Author SHA1 Message Date
d52a811052 minor bpy api edits
- strict check for rna properties
- formatting edits (120 line width)
- use PyDoc_STRVAR macros for getset docstrings
2011-11-26 15:18:30 +00:00
2b939904ab documentation - brief descriptions for bpy api files. 2011-11-05 08:21:12 +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
2bd9519e39 BLI_ghash.h was including BLI_blenlib.h, remove from ghash header and include in each file 2011-10-20 13:50:24 +00:00
276e5f7095 formatting edits & remove debug print. 2011-10-13 01:29:08 +00:00
f7737153e6 filter RNA classes for translation (removes over 1300 lines from messages.txt)
- omit operators tagged as INTERNAL
- omit classes  for internal use: Event, Context, Property, Function, Window.
2011-10-05 03:39:22 +00:00
566da26173 file-selector: when converting operator arguments to the file selector, wasnt making paths absolute (abs paths are made relative when converting the other way). 2011-08-26 01:32:07 +00:00
9436769cd4 error when a python operator gave an incorrect return value was near useless, re-raise a more comprehensive error which includes the operator name. 2011-08-25 17:54:30 +00:00
a7663cc377 use ghash for operator and menu types, was doing string lookup in the operator list (containing over 1000 items) for each button draw.
gives small speedup for UI drawing and overall startup time.
2011-08-11 06:06:17 +00:00
3a82a690ab ifdef out support for for python owning and freeing BPy_StructRNA because this is only used for doc generation and it makes _every_ blender/python instance 4 bytes bigger - vertex/bezier point/object/scene/group etc. 2011-08-05 16:29:38 +00:00
e5e6f91856 fix [#28114] Render Crash
existing check for driver to use GIL was not thread safe and could cause, details in the report.

This bug was caused by a check to avoid hanging, a fix for [#27683] that worked in 2.4x because the UI didn't use python to draw while rendering.

Apply a different fix for [#27683], when calling an operator, call PyEval_SaveThread(), then PyEval_RestoreThread() so the GIL can be aquired by threads started by the operator - in this case bake starting a thread that evaluates drivers.
2011-08-04 01:56:36 +00:00
89a166d0de remove some duplicate declarations 2011-05-10 14:48:06 +00:00
f86565c90e whitespace edits for bpy api, split some really long lines. 2011-04-30 13:58:31 +00:00
2299d674f4 operators called from python were not getting their reports back into python errors.
eg:
- console calls operator
- operator calls report
- report went into header rather them back into the console as an error.
2011-03-22 02:38:39 +00:00
790e47768a fix for crash when running WM_OT_read_factory_settings() from a script and then importing. 2011-03-20 07:23:17 +00:00
cadc1218c8 C, style changes (mostly white space edits), no functional change. 2011-03-19 11:12:48 +00:00
90d42e114c py/rna: BPy_reports_to_error() now takes the exception type as an argument and returns -1 as an error value 2011-03-12 15:18:08 +00:00
e2304a4dbb move anim functions out of bpy_rna.c, its getting too big. 2011-03-02 04:51:43 +00:00
Nathan Letwory
5a760e22fc doxygen: blender/python tagged. 2011-02-27 20:10:08 +00:00
d17df68c24 - clear some warnings
- rename layout.operator_enums -> operator_enum (since we have operator_menu_enum, only called in 4 places)
2011-02-18 06:07:41 +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
b17bbf9d95 fix for 2 segfaults running in background mode.
- operators which reload G.main would crash blender if called from python and then accessed bpy.data.*
- WM_read_homefile_exec was setting the contexts Scene to NULL as a signal for the event system, this didnt work in background mode, crashing when property update functions expected scene to be set.
2011-02-01 02:54:29 +00:00
11d61383fa workaround [#25845] Empty UI panels
- now writing to RNA is disabled when inside render() call.
- disallow calling operators when writes are disabled.

Rendering runs in a thread so running operators from the thread is not safe unless rendering becomes a blocking operator again.
2011-02-01 00:32:50 +00:00
8f21a43535 split BKE_utildefines.h, now it only has blender specific defines like GS() MAKE_ID, FILE_MAXDIR, moved the generic defines to BLI_utildefines.h.
no functional changes.
2011-01-07 18:36:47 +00:00
cdefce51f5 update python api with changes from Joshua's commit r33917. translate reports into python errors. 2010-12-31 05:40:30 +00:00
d624d1cbdd pass along the context to extension functions, this was already being done in all cases except for the render engine.
this allows python to NULL its internal context while scripts are not running.
2010-12-07 04:12:15 +00:00
96dafef228 minor edits to exception formatting (remove ... or \n from suffix) 2010-11-23 16:45:17 +00:00
ee1d2adc16 partial fix for [#23532]
- Python calling operators didn't run WM_operator_properties_sanitize() so enum functions called from python were given a NULL context.
- PROP_ENUM_NO_CONTEXT and PROP_NEVER_NULL used the same value in the enum (possible conflict).
2010-11-23 12:05:35 +00:00
c34275bcab better exception check for calling operators. non dict/None values were being treated as None. 2010-11-07 04:46:50 +00:00
64ff9d6de4 fix to allow [#24009] to be fixed.
WM_operator_poll() could fail in cases WM_operator_name_call() would succeed because calling the operator would setup the context before calling poll.
this would result in python raising an invalid error or menu items being greyed out.

now python can also check with an operator context:
  bpy.ops.object.editmode_toggle.poll('INVOKE_SCREEN')
2010-11-04 12:59:03 +00:00
ced06081b8 use PyImport_ExtendInittab for py module initialization rather then adding to sys.modules directly, no functional change. 2010-10-29 22:59:39 +00:00
be32cf8b32 UNUSED() macro so -Wunused-parameter can be used with GCC without so many warnings.
applied to python api and exotic.c, removed some args being passed down which were not needed.

keyword args for new mathutils types were being ignored when they should raise an error.
2010-10-13 23:25:08 +00:00
d6c8b41144 added CTX_wm_operator_poll_msg_get/set so failing poll functions can set messages when poll fails, at the moment only python uses this but theres nothing python specific.
only added 1 message to a poll function, so messages still need to be set in many more places to be useful.
2010-09-27 12:21:23 +00:00
f9367c4c4d definition/syntax edits for operators and rna (no functional changes) 2010-09-09 17:36:54 +00:00
7532bc2325 poll function for py api operator access
eg:
 if bpy.ops.object.mode_set.poll():
     ...
2010-09-01 11:16:11 +00:00
04f619d8af - PyLineSpit() - used to print the filename and line number for internal errors now works when executing class functions in a module.
- replaced PySys_GetObject("modules") with PyImport_GetModuleDict()
- use defaults for keymap import/export rather then setting the same value every time from the UI scripts.
2010-08-14 05:33:20 +00:00
f35efbc95a - remove WM_operatortype_exists since its almost the same as WM_operatortype_find
- hopefully fix reported problem with MSVC.
2010-08-13 14:42:45 +00:00
431db9d478 remove unused includes 2010-03-14 16:06:43 +00:00
c7662c1cf7 Calling operators from Python with non-default context was broken (need to assign to the right variable). 2010-02-12 21:40:46 +00:00
081c1205a3 correct fsf address 2010-02-12 13:34:04 +00:00
c2b2ccde45 fix for python not being able to call operators with a executuon context. 2010-02-10 11:10:38 +00:00
586af8ca47 Properties for macro operator call in python.
Dicts are converted to operator properties like this:

bpy.ops.armature.extrude_forked(TRANSFORM_OT_translate={"value":(2,0,1)})

Note that this doesn't work quite well if one operator is twice in the same macro, but that's a problem at the RNA level too. I'll have to deal with that eventually.
2010-01-26 20:43:27 +00:00
c91a0f8adf make exception a bit nicer (since wiki docs dont make much sense how it was before) 2010-01-25 18:09:46 +00:00
2f6a158d21 when python calls an operator, return a set from the operator flag, this matches the set that python operators themselves return. eg.
{'MODAL'} or... {'FINISHED'}
2010-01-23 01:02:53 +00:00
453945e9e3 remove python api cruft from custom operator registration 2009-12-30 22:51:44 +00:00
b00cddeb66 Macro registration using the normal rna registration methods (like operators).
bpy.types.register(MacroClass)

instead of

bpy.ops.add_macro(MacroClass)

The rest is unchanged.

Also remove some now unused code for the old registration methods (there's still some remaining).
2009-12-30 22:14:32 +00:00
bbe13e7823 * register operators like other classes
* operators now return sets (converted into flags)
* can't remove bpy_operator_wrap.c since macro's still use the custom register funcs
2009-12-24 19:50:43 +00:00
4dd3e6c360 support for registering operators using the same internal rna api as panels, menus, headers & render engines since there was a fair bit of duplicate functionality.
will remove the old system and update scripts next.
2009-12-24 16:10:26 +00:00