Commit Graph

93 Commits

Author SHA1 Message Date
Campbell Barton 89b83f0060 patch to add __deepcopy__ to mathutils types, this is no different to __copy__, except some py utilities expect __deepcopy__ to exist, so better have them. 2012-03-30 11:35:58 +00:00
Campbell Barton 7f1e9b8c41 bmesh py api:
added access to deform weights, access to weights acts like a python dict so you can do...

  print(group in dvert)
  dvert[group] = 0.5
  print(dvert[group])
  del dvert[group]
  print(dvert.items())
2012-03-27 10:30:10 +00:00
Campbell Barton 11d12d945e style cleanup: python api 2012-03-26 06:55:09 +00:00
Campbell Barton 5935ff3aaa fix for Quaternion.to_axis_angle() returning a zero axis vector. 2012-03-20 23:37:54 +00:00
Campbell Barton 303cecf139 spelling cleanup: tesselate -> tessellate (last of these found) 2012-03-20 22:56:26 +00:00
Campbell Barton 4f19c1a995 spelling cleanup 2012-03-18 07:38:51 +00:00
Campbell Barton 05612c0419 code cleanup: not all mathutils callback creation functions tool unsigned char for type & subtype args. 2012-03-17 22:31:57 +00:00
Campbell Barton 02f707e9da minor mathutils code cleanup - use mathutils callbacks as unsigned chars everywhere. 2012-03-17 10:46:02 +00:00
Campbell Barton 70d3d1aca6 style cleanup: py/capi 2012-03-16 21:39:56 +00:00
Campbell Barton c2d93e8d4a comment cleanup 2012-03-14 22:39:56 +00:00
Campbell Barton ee9a00948b mathutils py api:
Vector.angle_signed(other)
  for 2D vectors to get the clockwise angle between them.

  in BLI math its called - angle_signed_v2v2()

shorthand for...

  atan2f((v1[1] * v2[0]) - (v1[0] * v2[1]), dot_v2v2(v1, v2))

also corrects compile error in last commit.
2012-03-14 06:14:15 +00:00
Campbell Barton 2fbb5ce833 bmesh py api: more comprehensive intro page, also fix some spelling errors. 2012-03-13 06:22:43 +00:00
Campbell Barton 8646bb4464 workaround [#30480] Knife tool flicker
the problem was numeric precision when in ortho mode the start/end points for the view vector would be 2000 apart which caused trouble for the intersection test.
2012-03-13 01:11:08 +00:00
Campbell Barton 89a963fb7f style cleanup: comment blocks 2012-03-09 18:28:30 +00:00
Campbell Barton 3590076193 style cleanup - comment formatting 2012-03-03 20:36:09 +00:00
Campbell Barton c62a462997 use LIKELY/UNLIKELY macros for operations that run a lot. 2012-02-26 23:59:08 +00:00
Campbell Barton 6ca7d82932 code cleanup: white space, spelling & ';;' end of lines. 2012-02-25 16:04:03 +00:00
Campbell Barton 1fbd91b8a1 typo cleanup, no functional changes. 2012-02-24 06:44:04 +00:00
Campbell Barton 2b7ca2304a unify include guard defines, __$FILENAME__
without the underscores these clogged up the namespace for autocompleation which was annoying.
2012-02-17 18:59:41 +00:00
Campbell Barton b81bfd86b4 use ValueError when vector/matrix multiplications sizes are not supported, was using TypeError for mat*vec and ValueError for vec*mat. 2012-02-11 14:27:36 +00:00
Campbell Barton 5a42ff381c correct 2 sphinx warnings. 2012-02-08 16:36:04 +00:00
Campbell Barton 1f74789d12 Correct mathutils documentation, also correct some python spelling errors and add makefile target check_spelling 2012-02-08 04:37:37 +00:00
Andrew Hale 5a221dd0de Fix for possible memory leak on creation of a vector using Vector.Range.
It was possible to allocate an array of size<2 which would then raise an error on vector creation without freeing.

Fix to ensure the behaviour of Vector.Range was the same as for builtin range() function. When specifying 3 arguments, the step argument wasn't being used to correctly calculate the vector size.

Minor formatting edits for error messages.
2012-02-02 01:07:04 +00:00
Andrew Hale 40f1686f47 Fixes to Python matrices str function.
1) The width of columns was incorrectly determined on windows, fixed by increasing the size of the dummy buf.
2) Added additional brackets to string for consistent formatting
2012-02-01 01:42:36 +00:00
Campbell Barton 54dc5f1654 apply back changes made since moving this file. 2012-01-31 05:02:24 +00:00
Campbell Barton 427cde6f16 svn cp \
https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/python/generic/noise_py_api.c@r42248 \
 https://svn.blender.org/svnroot/bf-blender/trunk/blender/source/blender/python/mathutils/mathutils_noise.c
2012-01-31 04:59:57 +00:00
Campbell Barton b42feff554 previous move lost history on this file, restoring next commit. 2012-01-31 04:58:06 +00:00
Andrew Hale e634cb2607 Add the .Identity() classmethod to mathutils matrices. This allows the user
to create an identity matrix of a specific size without having to specify
all the values in the matrix and then use the .identity() method.
2012-01-24 01:56:44 +00:00
Campbell Barton 3123ad12a3 middle mouse jump scrolling for text window. 2012-01-16 10:48:52 +00:00
Andrew Hale 3cad3521a9 Change function for nb_invert so that ~matrix returns the inverted matrix rather than inverting inplace. 2012-01-16 09:01:11 +00:00
Campbell Barton f0e3c3c68f fixes to mathutils from Andew Hale
- docstring edits
- normalize ignores W axis as its supposed to.
2012-01-03 14:34:41 +00:00
Campbell Barton 9a37e2682d slice and iterator access for matrix.col/row so you can do...
a, b = mat.col[0:2]

  and...

  for a in mat.col: ...
2012-01-02 09:04:37 +00:00
Campbell Barton 5c8c1a7358 PyAPI - remove Matrix.row_size / col_size. these were rather awkwardly named, but its more clear to use len().
mat.col_size --> len(mat.row)
mat.row_size --> len(mat.col)
2011-12-30 06:43:17 +00:00
Campbell Barton f48fb385ea formatting edits & minor corrections 2011-12-26 00:42:35 +00:00
Campbell Barton 986e62f3b6 fix for a bug in mathutils when a vector was accessing a matrix and the matrix size increased, future access too the vector would write past the allocated bounds. now raise an exception. 2011-12-26 00:05:41 +00:00
Campbell Barton 67effc8aef use docstrings for mathutils getset's, also some formatting edits, no functional changes. 2011-12-25 11:36:26 +00:00
Campbell Barton f3ac865cc0 picky formatting of mathutils 2011-12-24 13:26:30 +00:00
Campbell Barton 2a80368005 mathtils, convenience attributes added 'row' and 'col', this makes the row/col swap a lot easier to deal with, since
now you can still use column access

previously...
  mat[2] = 1, 2, 3

needed to be converted into...
  mat[0][2] = 1
  mat[1][2] = 2
  mat[2][2] = 3

but with column access you can do...
  mat.col[2] = 1, 2, 3


Having 'row' attribute is a bit redundant since direct indexing on a matrix uses row but included for completeness.
2011-12-24 07:03:19 +00:00
Campbell Barton 28a5549ecf fix for error with matrix access and negative indices with recent row/col swap. 2011-12-24 06:13:58 +00:00
Campbell Barton b42497b460 mathutils get/set function rename + minor changes to matrix functions (no functional changes) 2011-12-24 04:58:01 +00:00
Campbell Barton 89db50a712 patch [#29534] Change Matrix Representation and Access in Python to Conform with Standard Notation
from Andrew Hale

Scripts which access matrix row/columns directly and scripts that create new matrices with elements defined will need updating.


For more info see...

* Guide for updating scripts
  http://wiki.blender.org/index.php/User:TrumanBlending/Matrix_Indexing

* Discussion thread
  http://markmail.org/message/4bpqpxkcvq4wjyfu
2011-12-22 01:05:03 +00:00
Campbell Barton 26f69488ca Matrix.translation wrapper vector, continent accessing to matrix[3][0:3].
this is a part of patch 29534, being applied separately

from patch [#29534] Change Matrix Representation and Access in Python to Conform with Standard Notation
by Andrew Hale (trumanblending)
2011-12-21 23:12:16 +00:00
Campbell Barton 840dfcd56d cleanup and some fixes to mathutils by Andrew Hale
* 1. Resize 4x4, code was ridiculously complex (cleanup only)
* 2. matrix * matrix checking for compatibility wasn't working right (bug in last release)
* 3. fix for result size for matrix * vector if matrix is 4x4 and vector size 3 (bug in recent patch)
* 4. fix for result size vector * matrix if matrix is 4x4 and vector size 3 (bug in recent patch)
2011-12-21 21:21:27 +00:00
Campbell Barton 01de7c2979 fix for mathutils mat*vec for non sqyare matrices by Andrew Hale 2011-12-21 11:36:28 +00:00
Campbell Barton ea88a0bec5 recent commit missed swapping args for MATRIX_ITEM in mathutils_Vector.c, breaking matrix*vector. 2011-12-20 11:37:55 +00:00
Campbell Barton 436295026a patch [#29662] Modifications to Mathutils Vectors for Consistency with Commit 42752
from Andrew Hale
2011-12-20 05:48:35 +00:00
Campbell Barton a8ed803b66 rename internal matrix struct member vars to avoid confusion
Matrix.contigPtr --> matrix
Matrix.row_size --> num_col
Matrix.col_size --> num_row
2011-12-20 04:11:23 +00:00
Campbell Barton 3d8ee28750 __str__ functions for other mathutils types 2011-12-20 03:37:55 +00:00
Campbell Barton 553cf289a7 patch [#29651] Add a __str__ Method to Matutils Matrices so print(matrix) Shows Columns as Columns
from Andrew Hale

converted from python string formatting to using BLI_dynstr
2011-12-20 02:54:25 +00:00
Campbell Barton 53f88b231a corrections to some comments 2011-12-19 05:23:52 +00:00