- 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.
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
- 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"
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.
- 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.
- 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.
* 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.
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.
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.
- 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.
- 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.
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.
- 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.
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.
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.
- 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.
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.