Commit Graph

3055 Commits

Author SHA1 Message Date
19efa4301a fix crash from report [#25746] Adding keyframes to nested custom properties (IDProperties) of a bone causes segfault
though keyframing still doesn't work, it gives an error instead.
also use const char * in more parts of the py/rna api.
2011-02-01 23:53:54 +00:00
1c2bb084ac partial revert for r34590, exclude render() from enabling the read-only state.
will re-open [#25845] and assign to Brecht.
2011-02-01 20:38:24 +00:00
ffe7bde02c correct fix for bug #23871, __main__ module was being overwritten in nested functions, so on returning from calling operators the __main__ module could be cleared and imported modules turn into None
calling
  bpy.ops.wm.read_factory_settings()
... would clear a scripts namespace if running directly, not in a module.


Fix by backing up and restoring the __main__ module.

Also found BKE_reportf wasnt printing all reports in background mode as BKE_report() was doing.
2011-02-01 12:37:53 +00:00
549b190566 own fix for bug #23871 (r33277), crashes when running multiple operators in a batch script with a double free.
Cant see why this happens but this different fix doesn't crash so using it instead.
2011-02-01 09:02:49 +00:00
0362d19f2d Pythons path functions - os.walk(). os.path.exists(). etc support bytes for paths as well as strings, support this with blender/rna too.
- bpy.data.*.load() functions were only accepting UTF-8 paths.
- rna functions/properties now accept byte values rather then strings for file paths.
- bpy.path.resolve_ncase now supports byte objects.
2011-02-01 04:24:47 +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
89c617a116 remove nan-makefiles 2011-01-30 15:29:22 +00:00
45fc590835 internal changes, script writers won't notice.
disable getattr metaclass forwarding attributes from the python class, eg:
  bpy.types.Scene.foo != bpy.types.Scene.bl_rna.properties['foo']

... This was convenient but too tricky to properly maintain with attribute assignment and attributes defined within the class.
avoid doubles in dir() by converting to a set and then back to a list.
2011-01-27 06:48:14 +00:00
dc30caab61 fix for crash when assigning unsupported type to collection properties. 2011-01-26 12:44:09 +00:00
d8539d8801 small internal cleanup, have matrix.scale_part() use same method to extract the scale as matrix.decompose() 2011-01-25 16:32:41 +00:00
1bd0db59f4 use cmake defined names for jpeg, png, zlib and python libs, building on *nix with non-standard libjpeg/png/zlib locations was broken.
in the case of python this makes it easier to move to find_package(PythonLibs) when 3.x is supported.
2011-01-25 14:43:13 +00:00
57289044ca improve unregister error check not to loop over parent classes properties (would check the same property multiple times) 2011-01-25 07:31:11 +00:00
c0e74f9dce fix [#25748] Addons register parameters/functions more than once
- values were added to both the classes __dict__ as well as the internal StructRNA.
- made properties available from the type since this is where the python api assigns them:
>>> bpy.types.Scene.frame_start
<bpy_struct, IntProperty("frame_start")>
- rename RNA_struct_type_properties() -> RNA_struct_type_properties(), added RNA_struct_type_find_property()
2011-01-25 06:54:57 +00:00
27cb6218a3 fix [#25778] Memoryblock Data from SCR: end corrupt
+ other minor changes.
2011-01-25 01:51:28 +00:00
c0f161f811 fix [#25776] Crash when operator's bl_idname has more than one dot 2011-01-24 05:15:14 +00:00
daa09a4a60 Raise an exception when registering classes with ID names which are too long. (related to bug ), found while looking into bug [#25776]. 2011-01-24 03:38:34 +00:00
552b36733b bugfix + minor mathutils.Vector edits.
- multiplying a 2D vector by a 3x3 or 4x4 matrix would use un-initialized memory, now throw an exception.
- use more variable length array BLI_math functions.
2011-01-23 08:37:34 +00:00
262a33cbe4 change mathutils.Matrix.Shear() for 3x3 or 4x4 matrices
The plane which defined the shear had the factor applied to each axis equally.
This meant that the shear for any 3x3 or 4x4 matrix would be diagonal on the positive values of each axis.
Only being able to create diagonal shear matrices seems stupid, now take a pair of floats for the shear factor corresponding to the plane axis values, so its possible to shear on only one axis of the plane.
2011-01-21 03:18:01 +00:00
d7c6ddd7e9 correct spelling 2011-01-21 02:32:58 +00:00
022511d5ad [#25732] Incorrect shear matrix in XY plane
fix included by Lawrence D'Oliveiro (ldo)
2011-01-21 02:27:04 +00:00
161cbed9b5 new command line option '--factory-startup' to skip reading startup.blend. useful for testing with a predictable environment.
also commented python benchmark prints on exit, can enable when profiling later.
2011-01-19 09:13:24 +00:00
3b0c2accc6 support building with python3.2 2011-01-18 21:39:50 +00:00
08dc18fda0 rename fcurve.keyframe_points.add() --> insert()
add new add function which allocates a number of points instead.
2011-01-18 11:27:52 +00:00
2431e8e045 bgl.Buffer()
- invalid dimension type could be passed without raising an error.
 - negative dimensions could crash blender, now they raise errors.
 - zero length dimension arg was not detected.
 - floating point lengths were accepted, now only allow ints.

 also comment unused vars.
2011-01-18 03:49:28 +00:00
8cf1184c04 bad spelling; 'indicies' --> 'indices' 2011-01-18 01:58:19 +00:00
86baf7c937 option for the path iterator to loop over packed files so their dir separator can be switched on file load. 2011-01-18 00:10:11 +00:00
5b3bf80dd8 detect mathutils types with mathutils_array_parse(), was using PySequence_Fast(), converting into a tuple every time then back to a float array.
gives approx 6x speedup with eg mathutils.Vector(some_vector).
2011-01-16 11:26:01 +00:00
ba96f02d4a use fast sequence functions for python's bpy.props.EnumProperty() arg parsing. 2011-01-16 10:36:27 +00:00
4dd92a988a Defining bpy.props.EnumProperty(... , options={'ENUM_FLAG'}) wasnt working right with default values. 2011-01-16 10:08:20 +00:00
86bbab7de5 remove/comment unused defines. 2011-01-15 16:14:57 +00:00
c8df192de6 misc python api improvements
- rna array parsing was using PySequence_Size() in a loop, this can  be slow to run so only call once.
- assigning a single value to a multi-dimensional array was missing type check.
- improve exception messages for rna array type errors.
- simplify vector slice assignment by using mathutils_array_parse(...)
2011-01-13 21:44:18 +00:00
665648a40b bugfix [#25578] assigning to multi-dimensional arrays fails 2011-01-13 16:00:14 +00:00
8227b3d463 remove/comment unused vars
also removed unnecessary NULL checks (where the pointer was used later without checking).
2011-01-13 04:53:55 +00:00
ca3d4052de py/mathutils fix for eternal loop with Matrix.Rotation().
rotation range clamping used a while loop which would run forever when the value was so big subtracting a full revolution didnt change the value.

Solve by using fmod() and double precision angle.
2011-01-11 09:41:26 +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
0660078b8b mathutils matrix initialization now matches other mathutils types.
(should have made this change along with the others).
Matrix([1, 2],  [3, 4]) --> Matrix(([1, 2], [3, 4]))
This is so adding initialization args works right.

Also simplify initialization code (re-use slice assignment).
2011-01-09 14:30:16 +00:00
a825df946a use PySequence_Fast for matrix slice assignment to speed up assignment. 2011-01-09 12:38:22 +00:00
2f24124e97 py matrix api
- bugfix for printing matrices (row/col mixup)
- replace cumbersome loop sequence parsing with calls to mathutils_array_parse
2011-01-09 12:09:54 +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
d31ebbe666 cleanup for mathutils multiplication functions, a little faster in some cases, raise more informative exceptions. 2011-01-09 09:16:04 +00:00
ca89269c22 Remove py mathutils Euler.unique() method
- this just toggled between different rotations, I can't find any references to this as a common operation to have with eulers.
- wasn't working at all nobody noticed, not used by any blender scripts/addons either.
2011-01-09 07:46:26 +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
0db684be3c incorrectly documented return type 2011-01-07 06:39:48 +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