Age | Commit message (Collapse) | Author |
|
is years old, strange nobody noticed.
use float comparison from the "Ever Faster Float Comparisons" paper, tested with random values as well as random values converted to ints (where this existing code would fail).
|
|
This means adding the file "bpy.props.py" in the examples dir will automatically be used when generating docs, unused examples give warnings.
|
|
Examples.
euler = Euler(1, 2, 3)
euler.order = 'ZXY'
euler = matrix.to_euler('XZY')
Still missing rna support. this still wont give the right order, defaulting to XYZ.
eul = object.rotation_euler
|
|
|
|
instance), could crash blender.
- disallow setting swizzle's that have duplicate values: vec.xxx = [1,2,3]
- raise an error if the list setting a swizzle's longer.
- mathutils write callback was running on the wrong vector, which could crash blender.
|
|
- bpy.app moved into PyStructSequence (used by sys.float_info)
- added buildinfo into bpy.app.build_*
- bpy.ui removed (wasnt used)
- include external example files in Mathutils docs (only Mathutils and Vector are currently written)
- added support to auto document PyStructSequence's
- CMake had "'s inside all its strings.
|
|
access Matrix.is_negative
renamed Mathutils attribute wrapped -> is_wrapped
|
|
http://www.blender.org/documentation/250PythonDoc/Mathutils.html
* Vector.difference() needed normalized vectors
* bpy.DEUBG -> bpy.app.debug
|
|
quat = vec.difference(other)
also pedantic change with enum names.
|
|
getset'ers in docs)
- Mathutils.MidpointVecs --> vector.lerp(other, fac)
- Mathutils.AngleBetweenVecs --> vector.angle(other)
- Mathutils.ProjectVecs --> vector.project(other)
- Mathutils.DifferenceQuats --> quat.difference(other)
- Mathutils.Slerp --> quat.slerp(other, fac)
- Mathutils.Rand: removed, use pythons random module
- Mathutils.RotationMatrix(angle, size, axis_flag, axis) --> Mathutils.RotationMatrix(angle, size, axis); merge axis & axis_flag args
- Matrix.scalePart --> Matrix.scale_part
- Matrix.translationPart --> Matrix.translation_part
- Matrix.rotationPart --> Matrix.rotation_part
- toMatrix --> to_matrix
- toEuler --> to_euler
- toQuat --> to_quat
- Vector.toTrackQuat --> Vector.to_track_quat
|
|
* inline some more functions, from math_base and math_vector
* also made some changes to the way inline is done so it can
work for more than one file
* reflect_v3_v3v3 requires input vectors to be normalized now.
* added rgb_to_grayscale
* added zero_v4, copy_v4_v4, swap_v4_v4, is_one_v3
* added box_clip_bounds_m4 to clip a bounding box against a
projection matrix
|
|
|
|
|
|
Also added matrix.median_scale attribute to get the average scale from the matrix, use for scaling bone envalopes.
|
|
- the scripts path set in the user preferences or ~/.blender/scripts/ui (io, op, io etc..) will be used to load scripts.
- the default home dir part probably only works in *nix os's
- Added a missing sync callback to vector.toTuple()
|
|
number of decimal places.
- added Mathutils vector method, vec.asTuple(round), since this is tedious in python and fairly common task.
|
|
|
|
* Convert all code to use new functions.
* Branch maintainers may want to skip this commit, and run this
conversion script instead, if they use a lot of math functions
in new code:
http://www.pasteall.org/9052/python
|
|
|
|
strangely vector.c was skipped in last merge from trunk.
-----------------------------------
Mathutils fix: Vector.reflect
* correct function for reflection and moving it to arithb.c
|
|
MathUtil matrix type follows Blender convention of column
major storage. This means that the elements on one column
are contiguous in memory. Vectors are one dimensional
arrays that can be considered in row or in column but
the Blender convention is column so vector should only
be considered as row. This means that the only logical
multiplication operation between matrix and vector is
matrix * vector.
This convention is respected in all parts of MathUtil
except in matrix/matrix and matrix/vector multiplication
where the row major convention is assumed, which in the
and is equivalent to reversing the order of multiplication.
This is clearly a bug and must be corrected but the side
effect is that it will break all scripts using these
operations. Script writers who care about the correctness
of the matrix operations have already implemented work around:
1) change order of matrix/vector multiplication.
vec2 = vec1 * mat1
This must be changed to the normal order:
vec2 = mat1 * vec1
2) change order of matrix/matrix multiplication
(with matl a local transform in matw reference)
mat3 = matl * matw
This must be changed to the normal order:
mat3 = matw * matl
3) transpose before an after the multiplication
matl.transpose()
matw.transpose()
mat3 = matw * matl
mat3.transpose()
This must be changed to:
mat3 = matw * matl;
|
|
getValue() rather than setValue()
- added GPL header to bpy_interface.c from 2.4x's BPY_interface.c
- warning fixes
|
|
Directories intern/ and source/blender/ now compile warning
free again here with scons/gcc.
|
|
|
|
Monthly cleaning round to make it compile warning free.
Mostly it was const stuff (strings, Context), but also
a couple useful fixes, like wrong use of temp pointers.
Only Mathutils callback struct I left alone... design issue.
|
|
|
|
Added slice to PyRNA collections and arrays (py3 only).
eg.
some_verts = mesh.verts[0:10]
some_rna_array[4:-1] = [0,1,2,3]
Collections dont support assignment, when assigning slices, resizing the array isnt support like with python lists.
|
|
Mathutils support for subclassing Vector, Quat, Euler and Matrix types.
Removed C docstrings, prefer to make sure our epydocs are well maintained rather then duplicate, vague doc strings.
Will convert scripts to detect missing docs from the BGE.
|
|
|
|
for testing existing scripts.
Added conversion for BGE Quaternion WXYZ (Blender/C) -> XYZW (Moto C++).
BGE Python API now uses WXYZ following mathutils (break script warning).
|
|
* all mathutils types now have optional callbacks
* PyRNA returns mathutils quat and euler types automatically when they have the rotation subtype.
* PyRNA, reuse the BPy_StructRNA PyObject rather name making a new one for each function returned.
* use more arithb.c functions for Mathutils quaternion type (less inline cruft).
* BGE Mathutils integration mostly finished- KX_PyMath now converts to Mathutils types rather then lists.
* make all mathutils types share the same header so they can share a number of functions - dealloc, getWrapped, getOwner.
|
|
rather then a generic rna sequence of floats.
Any 3x3 or 4x4 rna matrix will automatically be returned as a Mathutils matrix.
This makes useful stuff like multiplying a vector location by an object matrix possible.
ob = bpy.data.scenes[0].objects[0]
print (ob.data.verts[0].co * ob.matrix)
Also added mathutils matrix types to the BGE GameObject.localOrientation, worldOrientation
* MT_Matrix3x3 added getValue3x3 and setValue3x3, assumed a 4x3 float array.
* KX_GameObject.cpp convenience functions NodeSetGlobalOrientation, NodeGetLocalOrientation, NodeGetLocalScaling, NodeGetLocalPosition.
* 2.5 python api now initializes modules BGL, Mathutils and Geometry
* modules py3 PyModuleDef's use PyModuleDef_HEAD_INIT, rather then {}, was making msvc fail to build.
* added macros for Vector_ReadCallback, Vector_WriteCallback etc. to check if the callback pointer is set before calling the function.
|
|
|
|
thin wrapping vectors which is crash prone.
in short, vectors can work as if they are thin wrapped but not crash blender if the original data is removed.
* RNA vector's return Mathutils vector types.
* BGE vectors for GameObject's localPosition, worldPosition, localPosition, localScale, worldScale, localInertia.
* Comment USE_MATHUTILS define to disable returning vectors.
Example...
* 2.49... *
loc = gameOb.worldPosition
loc[1] = 0
gameOb.worldPosition = loc
* With vectors... *
gameOb.worldPosition[1] = 0
* But this wont crash... *
loc = gameOb.worldPosition
gameOb.endObject()
loc[1] = 0 # will raise an error that the objects removed.
This breaks games which assume return values are lists.
Will add this to eulers, matrix and quaternion types later.
|
|
Updated Mathutils.Vector/Euler/Quaternion/Matrix so these are types rather then module methods, each type now has a tp_new function, matching python builtins float/int/str.
Also cleaned up float conversion and arg passing.
Changed buttons_objects.py...
if ob in groups.objects: # no longer works
if ob.name in groups.objects: # is the new syntax
...its more dict like and a lot faster (avoids python iterating over each item and comparing each, use a single rna lookup instead).
|
|
* removed coercing types which has been removed from py3.
* matrix uses getset's rather then getset items.
* removed deprecated functions.
|
|
* Mathutils, Geometry, BGL, Mostly working, some //XXX comments for things to fix with py3
python import override (bpy_internal_import.c) so you can import python internal scripts from the BGE and running blender normally.
|