Commit Graph

81 Commits

Author SHA1 Message Date
Campbell Barton
232f19f0c2 PyAPI: Matrix.invert(ed): accept an optional fallback argument
This avoids try/except when its possible the matrix has no inverse.
2014-04-29 20:12:07 +10:00
Campbell Barton
409fb4da0c Code cleanup: remove redundant matrix initialization 2014-04-29 18:13:20 +10:00
Campbell Barton
7199e2288f Code cleanup: use sqrtf when input and output are float 2014-03-28 14:53:37 +11:00
Campbell Barton
63ccb26303 Code Cleanup: spelling 2014-01-17 17:35:03 +11:00
Campbell Barton
da6bc87b57 Fix T38138: incorrect API docs 2014-01-09 21:49:11 +11:00
Campbell Barton
3e49787b01 Python API: give a better error message when creating a Matrix fails 2013-11-29 09:48:42 +11:00
Campbell Barton
ab8d88ac18 add angle_to_mat2 utility function. 2013-09-10 20:45:47 +00:00
Campbell Barton
7db1d6556d code cleanup: add break statements in switch ()'s, (even at the last case). 2013-07-21 08:16:37 +00:00
Campbell Barton
418011907c remove nan copyrights from code added since blender become opensource (copy paste errors), also remove BKE_script.h 2013-07-02 10:14:59 +00:00
Campbell Barton
f9f7070336 add STREQ macro (commonly used macro like CLAMP, MAX2, STRINGIFY). Use for some areas of the python api, bmesh. 2013-03-10 06:18:03 +00:00
Campbell Barton
dc7a138830 correct bad comment 2012-12-16 10:28:52 +00:00
Campbell Barton
950fb66c38 replace TypeError with Value error for matrix operations where the type is right but it can't succeed because of a property of the instance (normally the wrong col/row size). 2012-12-16 04:10:57 +00:00
Campbell Barton
1886ae38b4 add Matrix.normalized(), handy for transforming normals. 2012-12-16 04:05:16 +00:00
Campbell Barton
adf7bfa8bb ifdef out dynstr so mathutils can be compiled as an external module again. 2012-12-08 01:16:59 +00:00
Campbell Barton
004f8d78ed default to Python3.3 on Linux for SCons and CMake, warn when building with python 3.2x or older.
also remove casts to keep Python3.2 warning quiet.
2012-11-05 13:48:42 +00:00
Campbell Barton
fae6c35ca7 code cleanup: quiet -Wdouble-promotion, disabled this warnings for a few files since its done throughout the code in some places. 2012-11-04 07:18:29 +00:00
Campbell Barton
e8a70d4b90 fix for crash in python matrix utility functions .inverted/adjugated/transposed if the matrix has a read callback and fails.
also replace DM_get_poly_data_layer with dm->getPolyDataArray() since this is the convention in subsurf code and the functions now added.
2012-10-31 03:21:13 +00:00
Campbell Barton
dbb40e805d py api: add mathutils.Matrix adjugate(d) methods, also add adjoint_m2_m2() to BLI_math_matrix 2012-10-29 03:36:55 +00:00
Campbell Barton
9fc95bd7ee use min/max inline functions where MIN2/MAX2 were doing type conversion. 2012-10-27 11:18:54 +00:00
Campbell Barton
fec81d9b56 use min_ max_ functions in more places.
also fix minor error in MOD decimate when the modifier did nothing the reported face count would be wrong.
2012-10-23 16:21:55 +00:00
Campbell Barton
c56a911cd9 style cleanup: comments 2012-10-20 20:20:02 +00:00
Campbell Barton
aa49ca25d5 incorrect spelling in comments 2012-09-26 20:05:38 +00:00
Campbell Barton
71d1b09708 minor code cleanup 2012-08-25 12:55:14 +00:00
Campbell Barton
32cf7fcdb1 code cleanup: spelling 2012-07-16 23:23:33 +00:00
Campbell Barton
84bf3e48c0 style cleanup: use c style comments in C code 2012-07-06 23:56:59 +00:00
Campbell Barton
81a509fa40 fix error in node template and quiet warning. 2012-07-03 21:03:39 +00:00
Campbell Barton
112162e09e code cleanup: header cleanup 2012-04-30 14:24:11 +00:00
Campbell Barton
6520aa97a9 add 'idprop' module so we can document idprop.types.*, currently doc generator has no access to ID Property types. 2012-04-15 14:54:15 +00:00
Sergey Sharybin
b07f9446c7 Hopefully last change to matrix orthogonal check, touches Py API only
- is_orthogonal now checks matrix in the same way as it's defined
  by linear algebra, meaning that it'll use is_orhonormal C check
- Added is_orthogonal_axis_vectors to check if vectors which defines
  axises are orthogonal
2012-04-02 12:36:00 +00:00
Sergey Sharybin
26b0255049 Fix for is_orthogonal check which in fact was checking for orthonormal matrix.
Separated it into two functions so now it'll be clear if check happens for
orthonormal or just orthogonal.
2012-04-01 00:14:41 +00:00
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
11d12d945e style cleanup: python api 2012-03-26 06:55:09 +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
2fbb5ce833 bmesh py api: more comprehensive intro page, also fix some spelling errors. 2012-03-13 06:22:43 +00:00
Campbell Barton
3590076193 style cleanup - comment formatting 2012-03-03 20:36:09 +00:00
Campbell Barton
1fbd91b8a1 typo cleanup, no functional changes. 2012-02-24 06:44:04 +00:00
Campbell Barton
5a42ff381c correct 2 sphinx warnings. 2012-02-08 16:36: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
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
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