Campbell Barton
4da4943b5c
formatting changes for python mathutils module.
2011-07-14 01:25:05 +00:00
Campbell Barton
15289c6048
use PyDoc_STRVAR macro, so its possible to build without docstrings.
2011-05-24 16:05:51 +00:00
Campbell Barton
9c8f1e2ef4
imbuf, mathutils & readfile: floats were being implicitly promoted to doubles, adjust to use floats.
2011-03-27 17:12:59 +00:00
Campbell Barton
cadc1218c8
C, style changes (mostly white space edits), no functional change.
2011-03-19 11:12:48 +00:00
Campbell Barton
e8174fb3cd
move mathutils api changelog into wiki.
2011-03-14 05:03:53 +00:00
Campbell Barton
57436f3013
fix for own error made r35267.
2011-03-03 08:01:11 +00:00
Campbell Barton
b535c738d9
further reading, need to untrack tracked PyObjects before clearing their trackable vars.
2011-03-03 06:14:55 +00:00
Campbell Barton
7348a50d79
change return values from mathutils callbacks to match pythons (-1 is error), so error macro's can be used in both.
2011-02-28 18:42:41 +00:00
Nathan Letwory
5a760e22fc
doxygen: blender/python tagged.
2011-02-27 20:10:08 +00:00
Campbell Barton
fbd9364944
revert part of own commit r35117 which modified mathutils initialization functions, found this could be done in a better way which doesnt have to deal with partly initialize instances being freed.
2011-02-24 05:46:57 +00:00
Campbell Barton
b1639dc118
support pythons cyclic garbage collector for mathutils types.
2011-02-24 04:58:51 +00:00
Campbell Barton
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
Campbell Barton
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
Campbell Barton
0955c664aa
fix for warnings from Sparse static source code checker, mostly BKE/BLI and python functions.
...
- use NULL rather then 0 where possible (makes code & function calls more readable IMHO).
- set static variables and functions (exposed some unused vars/funcs).
- use func(void) rather then func() for definitions.
2011-02-13 10:52:18 +00:00
Campbell Barton
81a00cf2eb
use static functions rather then defines for internal matrix__apply_to_copy() and similar.
...
+ other minor internal changes.
2011-02-09 09:20:17 +00:00
Campbell Barton
998198a041
mathutils rotate functions for Euler/Quaternion/Matrix/Vector types.
...
each accept Euler/Quaternion/Matrix types.
eg:
Euler.rotate(Quaternion(axis, angle))
Vector.rotate(Euler((pi/2, 0, 0)))
matrix.resize_4x4() and euler.make_compatible() were still returning an instance of themselves, now return None.
2011-02-05 09:57:02 +00:00
Campbell Barton
dd08305e75
Rename python mathutils functions and split in-place methods from those that return new values.
...
http://wiki.blender.org/index.php/Dev:2.5/Source/Python/Mathutils
This completes the changes proposed.
This will break scripts (fixing coming up next), for full list of changes see mathutils.c comments.
2011-02-05 06:14:50 +00:00
Campbell Barton
2ef93b1d92
swap Matrix.Shear(...) arguments so matrix size is the second argument, matching other constructors.
2011-02-04 09:41:59 +00:00
Campbell Barton
feed9c3d1f
mathutils.Matrix.OrthoProjection(plane, size, axis), merged axis and plane args. since axis was only allowed when plane was 'R'.
...
This was already done with Matrix.Rotation().
2011-02-04 09:35:20 +00:00
Campbell Barton
4be9583894
small mathutils changes.
...
- fix for returning empty slices (was returning list rather then tuple).
- report invalid type when mathutils_array_parse_fast() fails.
2011-02-04 03:39:06 +00:00
Campbell Barton
36786c18d7
PyAPI: coerce mathutils values. (vectors, quats, eulers) as proposed here:
...
http://wiki.blender.org/index.php/Dev:2.5/Source/Python/Mathutils#Coerce_Method_Arguments
2011-02-04 03:06:23 +00:00
Campbell Barton
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
Campbell Barton
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
Campbell Barton
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
Campbell Barton
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
Campbell Barton
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
Campbell Barton
129b6190ed
geometry module
...
- rename functions from camel case.
- added docs for undocumented methods.
- minor functional changes with exceptions and accepting 3d/4d vectors where it makes no difference.
Renamed:
- geometry.Intersect -> intersect_ray_tri
- geometry.ClosestPointOnLine -> intersect_point_line
- geometry.PointInTriangle2D -> intersect_point_tri_2d
- geometry.PointInQuad2D -> intersect_point_quad_2d
- geometry.LineIntersect -> intersect_line_line
- geometry.LineIntersect2D -> intersect_line_line_2d
- geometry.BezierInterp -> interpolate_bezier
- geometry.TriangleArea -> area_tri
- geometry.QuadNormal, TriangleNormal -> normal
- geometry.PolyFill -> tesselate_polygon
- geometry.BoxPack2D -> box_pack_2d
- geometry.BarycentricTransform -> barycentric_transform
2011-01-02 02:11:38 +00:00
Campbell Barton
6b677a2616
own recent commit broke this python import:
...
from mathutils.geometry import PolyFill
I couldn't find a way for python's inittab to do this so just inserting mathutils.geometry into sys.modules manually.
2010-10-31 13:17:39 +00:00
Campbell Barton
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
Campbell Barton
3264ced377
move geometry python module into mathutils.geometry, since it provides utility functions using mathutils types.
2010-10-25 22:44:01 +00:00
Campbell Barton
1807beabf5
- UNUSED macro wasn't throwing an error with GCC if a var become used.
...
- made interface, windowmanager, readfile build without unused warnings.
- re-arranged CMake's source/blender build order so less changed libs are build later, eg: IK, avi
2010-10-16 02:40:31 +00:00
Campbell Barton
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
Campbell Barton
96aa1f9cd5
moved mathutils Euler.rotate(angle, axis) --> Euler.rotate_axis(axis, angle)
...
since it can only rotate about a single axis dont confuse with vector.rotate() which takes an axis vector.
2010-09-29 08:07:58 +00:00
Campbell Barton
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
Campbell Barton
556b615cf8
mathutils module methods only contained matrix constructors, move these to matrix class methods since this is acceptable in python. eg: dict.fromkeys() and groups them more logically.
...
mathutils.RotationMatrix -> mathutils.Matrix.Rotation
mathutils.ScaleMatrix -> mathutils.Matrix.Scale
mathutils.ShearMatrix -> mathutils.Matrix.Shear
mathutils.TranslationMatrix -> mathutils.Matrix.Translation
mathutils.OrthoProjectionMatrix -> mathutils.Matrix.OrthoProjection
2010-08-11 16:40:36 +00:00
Luca Bonavita
9fe2b252c4
== docs ==
...
Changing " **type** " into "\n\n:type: " in Mathutils, to have like "type: float" in its own line.
2010-08-08 16:22:29 +00:00
Campbell Barton
c04850ec06
python mathutils change
...
quat * quat was returning the dot product (a float), rather then the cross product.
Use BLI_math's mul_qt_qtqt() function.
2010-08-02 00:08:01 +00:00
Campbell Barton
fd31436897
spelling correction: alredy --> already
2010-07-17 18:08:14 +00:00
Martin Poirier
5ed7699e85
mathutils.RotationMatrix
...
Angles are in radians. Doc and example should reflect reality
2010-06-23 02:42:39 +00:00
Campbell Barton
374d3a6685
bugfix [ #21748 ] KX_Object scaling property not "writing" vector access .:. e.g. obj.scaling[2] = 2.0
...
- made worldspace readonly
- mathutils 'set' callbacks can now set their own error
2010-06-14 01:41:43 +00:00
Campbell Barton
124c55fcc3
remove redundant argument from mathutils callbacks
2010-04-27 19:21:36 +00:00
Campbell Barton
6bb55fd93e
py/rna, euler objects order is now wrapped correctly...
...
eg:
eul = bpy.context.object.rotation_euler
eul.order = 'XZY' # will update the objects setting.
2010-04-26 21:04:42 +00:00
Campbell Barton
873d4a3f05
py api
...
- mathutils.Color.hsv attribute. eg. material.diffuse_color.hsv = 0.2, 0.8, 0.4
- Vector/Euler/Quaternion/Color now only take a single seq arg.
- internal function for parsing arrays. (cleanup messy internal list/vector/tuple/seq parsing)
- didnt update rigify yet.
2010-04-25 19:27:59 +00:00
Campbell Barton
67cfc427ee
PyAPI
...
- added new mathutils.Color() type, use with rna so we can do for eg:
material.diffuse_color.r = 1.0
# also has hsv access
material.diffuse_color.s = 0.6
- made Mathutils and Geometry module names lowercase.
2010-04-11 14:22:27 +00:00
Campbell Barton
fe9a22a018
py api file rename
...
- prefix mathutils api.
- 2 blf.c files (annoying for debugging)
- py api docs ignore keying sets as with operators.
2010-04-11 12:05:27 +00:00