Commit Graph

466 Commits

Author SHA1 Message Date
8cf1184c04 bad spelling; 'indicies' --> 'indices' 2011-01-18 01:58:19 +00:00
35e68e9785 - bpy.data.lamps.new() now takes a type argument since lamp type also sets class type this avoids needing to use ugly lamp.type_recast() after changing type.
- default vertex color layer name was UTTex when added from python.
2011-01-11 02:30:01 +00:00
00b8c9e7ea rename BKE_assert() --> BLI_assert(). 2011-01-09 15:12:08 +00:00
c9f353956c use PySequence_Size() rather then PySequence_Length(), this is only kept in python for backwards compatibility. 2011-01-09 14:53:18 +00:00
02aab4977f quiet zombie python class warning. bug remains but its not useful to print out so many errors when this wont be fixed for a while. 2011-01-09 11:54:12 +00:00
89c9aaaa25 remove references to BKE_utildefines where its not needed.
- move GS() define into DNA_ID.h
- add BLI_utildefines as an automatic include with makesrna generated files.
2011-01-07 19:18:31 +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
0f2089afa1 py/rna api speedup for collection slicing in all cases, rather then having an exception for [:].
- avoid looping over the entire collection unless a negative index is used.
- dont use the get index function for building the slice list, instead loop over the collection until the stop value.
2011-01-07 05:33:30 +00:00
68b931b03f py/rna optimizations, will help for faster exporting.
Speedup for getting collection indices, avoid getting the collection length unless a negative index is given. This avoids a loop over the entire collection in many cases.

Speedup for getting collection slices by detecting collection[:] and internally calling collection.values(), this gives a big speedup with some collections because each slice item would loop over the list until that index was found.

Rough test with 336 objects.
- getting index of listbase collection ~ 5.0x faster
- getting index of array collection ~ 1.15x faster

- getting slices of listbase collections ~ 34.0x faster
- getting slices of array collections ~ 1.5x faster
2011-01-06 04:01:06 +00:00
978bc0d8ac fix for py/rna mesh.materials[:] where empty materials exist, would raise a runtime exception.
problem was there was no way to tell the difference between getting an empty item from a collection or the item not being found.
2011-01-05 14:49:08 +00:00
96b646c68d edits for BPY_extern.h functions, no functional changes
- remove unused code.
- BPY_run_python_script() split in 2, BPY_filepath_exec, BPY_text_exec
- renamed funcs.
2011-01-05 02:08:54 +00:00
6b82aa8d01 fix for crash when some classes didnt register properly (this included loading sintel.blend). 2011-01-03 18:15:15 +00:00
f101e59e09 python api: rna array slices now return tuples rather then lists (fits with recent change made to mathutils).
minor improvements/cleanup to exporters.
2011-01-02 09:54:44 +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
71da1e96d1 Drivers Code Cleanups and UI Tweaks:
- Adding drivers from the UI (not from py-scripts though) will now
automatically add a "Transform Channel" driver variable to the newly
created drivers. This makes setting up drivers a bit more convenient
for the most commonly used case.

- Drivers now report their errors using the Reports system instead of
writing these directly to the console.

- Clarified some comments to be more insightful about the "why's" of
some design decisions, and related formatting/cleanup tweaks
- Reduced scope of "path" vars to just the scope they're required in

- Removed some unused defines from a failed experiment in the original
Keying Sets code ("templates" and "template flags") which was
superseeded by the more flexible + nicer "Builtin KeyingSets"
2010-12-28 05:45:15 +00:00
35fa581403 BKE_assert(), only prints the error unless cmake define WITH_ASSERT_ABORT is enabled and it will call abort().
made this option advanced so people don't enable along with other features.
2010-12-15 10:22:26 +00:00
6ef85af300 exceptions in registering properties were not properly handled, allowing a single error stop the main module registration loop.
worst case 1 script error could load blender without a UI.
2010-12-13 07:54:35 +00:00
de159a67aa - internal py/rna ifdef's USE_MATHUTILS was mixed up,
- updated tooltip for vertex group mirror.
2010-12-09 06:08:19 +00:00
23a49334ed fix for own change r33524, at the moment the context always has to be valid, noted with XXX.
reported by Doug Hammond.
2010-12-08 03:25:31 +00:00
612936954a minor internal python api change - pass the context rather then getting from BPy_GetContext() again. 2010-12-07 06:47:40 +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
47ca7a5f39 disallow setting RNA attributes while drawing, this is bad practice so enforcing here has the benifit of making sure people are not manipulating blender scene data in a drawing panel for eg.
This is ifdef'd and may be disabled later on, or only enabled in debug mode.

This applies to setting any RNA value that has an ID and is not a screen or window-manager datablock.

Some addons break this rule and need fixing but from my tests blender UI scripts are ok.
2010-12-04 06:25:36 +00:00
263830f000 Enabled GCC -Wwrite-strings warning for CMake and replaced many 'char's for 'const char's,.
Only one functional change where Transform orientations passed "" to BIF_createTransformOrientation() which could then have the value written into.
2010-12-03 17:05:21 +00:00
34ea1cf0b2 minor changes to the python api.
- pep8 script was giving an error on non utf8 scons source files.
- use PyList_SET_ITEM macro when list type is ensured.
- all mathutils types use subtypes to create new types when available.
- use defines MAT3_UNITY, MAT4_UNITY to initialize unit matrices.
2010-11-28 06:03:30 +00:00
96dafef228 minor edits to exception formatting (remove ... or \n from suffix) 2010-11-23 16:45:17 +00:00
ce2295999e use zero initializers instead of memset(), also change PointerRNA_NULL from an extern into a define. 2010-11-23 08:44:21 +00:00
7b16d7496d - report python script errors to blender report system, or through operators reports (when using operator callbacks).
- when python operators fail to execute they were returning RUNNING_MODAL, now return CANCELLED

now when an operator fails it gives an error popup as well as a message in the terminal.
2010-11-20 16:39:15 +00:00
f713761039 Keyframing Operators: Improved Error Messages
* Keyframing operators now use the reports system for displaying all its error messages. 
- The benefit of this is that users no longer need to check the console for error messages if keyframing fails.
- Unfortunately, reports are not currently viewable in any space/view in Blender, so...

* Added a temporary operator (UI_OT_reports_to_textblock), which can be accessed in the UI from the button which appears in place of the icon when more than one report exists. This dumps the current list of reports to a textblock "Recent Reports", from which they can be viewed. 

This isn't really nice, but at least we now have a way to view these again, which makes debugging some things a pain.

* Bugfix #24606 - when trying to add keyframes to F-Curves with F-Modifiers already which alter the curve significantly enough that the keyframes will have no effect, there are now warnings which aim to alleviate any confusion.
2010-11-17 12:02:36 +00:00
29605fc06d Added function RNA_property_update_check() to check if an update call is needed,
Simple python benchmark shows this to be about 3x faster in the case where an update isn't needed.

This also speeds up rna function argument parsing, since each arg in a function call did 2 string lookups on the context which were never needed.
2010-10-25 21:57:45 +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
4a385adbf3 python api:
- bpy.app.debug can now be set, removed bpy.data.debug (since this is not blendfile data)
- added bpy.app.tempdir, this is needed because the userpref temp dir isn't always set, $TEMP may be used instead and scripts need temp dir access.
2010-10-12 23:47:43 +00:00
8408997c84 remove some unused code and reduced the scope if some vars (no functional change). 2010-10-05 21:22:33 +00:00
874ffaca7b typo in function prefix. 2010-10-03 23:29:43 +00:00
05884e09be - rna bugfix where ints were not clamped and would overflow, now raise an error and print valid range.
- fixed WM_OT_context_cycle_int was causing problems with int overflow, now it cycles properly.
- rename QUOTE macro to STRINGIFY_ARG, and added STRINGIFY, which is used more often since it gives the value as a string.
2010-10-03 01:44:00 +00:00
5158684256 bugfix [#24014] Operator UI not shown in the order defined 2010-09-27 02:52:12 +00:00
47628dfab6 missing include from own commit r32117 2010-09-26 13:53:32 +00:00
d305a64b69 py/rna keyframe functions can now key longer paths if called from an ID block.
eg, bpy.context.object.keyframe_insert("soft_body.plastic")
2010-09-25 10:11:36 +00:00
e90ad1d9ba Annoying hack to pretend that an operator and its properties are the same, when passing an operator to an rna function argument which accepts 'AnyType', then pass the properties instead.
This means we can do operator drawing without passing self.properties as an argument.

while this check if quite specific, if this gives problems later on we should probably change operators not to try to mix an operator and its properties, it looks nice to a scripter but internally is not easy to manage.
2010-09-24 03:48:26 +00:00
5c99f3886e fix for python refcounting leak, RNA_path_resolve_full now unsets the index if its not last. 2010-09-24 03:24:15 +00:00
2b9a73ff98 - py/rna's path_resolve function was ignoring the index eg: obj.path_resolve("location[1]")
- corrected comment from previous commit
2010-09-23 02:12:33 +00:00
e546d7666b minor changes needed for the next commit.
- BKE_add_image_extension now sets the extension rather then appending. (no more image.jpg.tga)
- py/rna functions which have no return value now raise an error if a non-None value is returned.
- added back the red-alert flag so buttons can have a red highlight if somethings wrong.
2010-09-17 05:58:06 +00:00
5559a0d52e rewrote python IDProperty metaclass in C, this was a quick hack to get it working.
The reason this didnt work is all sibclasses of pythons type() or PyType_Type in C, have to have their size set to sizeof(PyHeapTypeObject) rather then sizeof(PyTypeObject) as you might expect.
This is strange since its not a heap-class (defined in pythons runtime), but a static C type, so Im not sure about this, and cant find any documentation but it seems to work ok.
2010-09-10 14:54:50 +00:00
f9367c4c4d definition/syntax edits for operators and rna (no functional changes) 2010-09-09 17:36:54 +00:00
9bdb7b5ffa fix crash for calling setattr with a non-string attribute and warning. 2010-09-09 13:58:38 +00:00
45cf7633fe remove class methods for defining properties
eg: bpy.types.Scene.BoolProperty()
2010-09-09 06:29:44 +00:00
ced3f3ad15 - fix for using ['prop'] in RNA api
- fix for testing without USE_PY_METACLASS defined.
2010-09-09 06:06:37 +00:00
f4be9a6393 support for defining rna class properties as class attributes
eg:
 bpy.types.Scene.myprop = BoolProperty()
 
note, this uses an ugly python metaclass, this should be replaced with a C implimentation which is included but commented out, causing crashes in pythons GC which gives no hint as to where the bug comes from.
2010-09-09 05:37:22 +00:00
128bd96c01 py/rna internals
- rna internal deferred properties now store the functions as PyObjects rather then C function pointers
- Property functions now allow the first non keyword argument to be a class.
2010-09-08 10:43:36 +00:00
ae0d99291f bugfix [#23656] Problems retrieving properties from inside runtime-created PointerProperties
Setting the classes __dict__ member directly didnt update the types slots (python internal type stuff used with subclassing), so class.bl_rna was returning an incorrect value.

Set the value using typical python setattr command.
2010-09-07 08:10:19 +00:00
ad0a176a22 - new subclass for ID-Property based collections - this way add/remove/move functions will only be shown for types that support it.
- moved array attributes into array properties - saves 8 bytes per allocated non-array property.
2010-09-02 06:35:00 +00:00