Commit Graph

110 Commits

Author SHA1 Message Date
Campbell Barton
1cc4033df8 PyAPI: expose matrix parsing function 2017-08-19 21:36:50 +10:00
Brecht Van Lommel
98df7d778f Fix T51287: Matrix.lerp fails w/ shear
Use interp_m4_m4m4 (wraps Eigen),
`MATH_STANDALONE` will need to be updated to support this.
2017-05-26 17:02:27 +10:00
Campbell Barton
81e584ed17 CMake: Use GCC7's -Wimplicit-fallthrough=5
Use to avoid accidental missing break statements,
use ATTR_FALLTHROUGH to suppress.
2017-05-20 14:01:03 +10:00
Sybren A. Stüvel
349cafac52 Matrix.decompose(): changed terminology, "location" → "translation"
Matrix.decompose() should either return "location, orientation, size" or
"translation, rotation, scale". Since there are constructors for the former,
I've replaced "location" in the documentation with "translation".

The code is still the same, I just changed the documentation.
2017-04-21 15:51:35 +02:00
Aaron Carlisle
c7a4f96f88 Pydoc: Change Wikipedia links and grammar in mathutils matrix code 2017-03-22 14:54:22 -04:00
Aaron Carlisle
cf9a6b416c API: Fix Links
Self-explanatory. to find broken links run `sphinx-build -b linkcheck sphinx-in sphinx-out`

Reviewers: mont29

Tags: #bf_blender, #python, #infrastructure:_websites

Differential Revision: https://developer.blender.org/D2297
2016-10-25 17:34:01 +02:00
Brecht Van Lommel
4ff0126e89 C99 is now the C standard for all our C code.
The main new feature is mixed variable declarations and code, which can help
reduce uninitialized variables or accidental variable reuse.

Due to incomplete C99 support in VS 2013, variable length arrays are not
supported, BLI_array_alloca must still be used. The header <tgmath.h> is also
not supported.

Differential Revision: https://developer.blender.org/D1631
2015-11-22 22:31:22 +01:00
Campbell Barton
fbca69c69a BLI_math: add mat3_normalized_to_* functions
Many uses of matrices for rotation keep them normalized,
so no need to normalize each time.
2015-10-24 07:02:51 +11:00
Campbell Barton
339915a962 Optimize PySequence_Fast usage
Access arrays directly, avoiding type-check every time.
2015-07-29 10:49:35 +10:00
Campbell Barton
96f08bf9a8 Fix leaks in mathutils PySequence_Fast usage 2015-07-29 10:49:35 +10:00
Campbell Barton
31cb14f5de Cleanup: check exact error w/ mathutils functions 2015-07-29 10:49:34 +10:00
Campbell Barton
f727df6076 Doc: correct rst syntax
also remove some API docs from example
2015-05-12 18:23:29 +10:00
Campbell Barton
e5e73ccc90 Math Lib: rename fill_*, to copy_*
matching convention for fixed length api, eg: copy_v3_fl
2015-05-05 17:08:29 +10:00
Campbell Barton
f682129d62 PyAPI: clarify fallback docstring 2015-03-06 19:02:57 +11:00
Campbell Barton
c439d14a9a missed this second last commit 2015-02-15 14:11:05 +11:00
Campbell Barton
fa2f7c69ac mathutils: Implement __hash__() functions
- all mathutils types
- only works on frozen data (so vectors can be used in sets/dict keys)
- uses same method as CPython, (matches hashing a tuple)

D1104 by @juicyfruit with own modifications
2015-02-15 14:02:08 +11:00
Campbell Barton
a9d979c8ef mathutils: add freeze() method, is_frozen attr
This allows you to make any mathutils object immutable.
2015-02-15 14:01:59 +11:00
Sybren A. Stüvel
baa8b63111 Documentation: updated mathutils documentation
Added descriptions of the constructors, and improved the module-level
documentation.
2015-02-01 18:16:12 +01:00
Campbell Barton
9fd569a654 PyAPI: add utilities PyTuple_SET_ITEMS, Py_INCREF_RET
Setting all values of a tuple is such a common operation that it deserves its own macro.
Also added Py_INCREF_RET to avoid confusing use of comma operator.
2015-01-06 19:09:11 +11:00
Campbell Barton
8106a6b75d mathutils: refactor instantiation
remove 'type' argument, very few mathutils objects are wrapped,
add new function for creating wrapped objects.

also fixes unlikely memory leak if the data-array can't be allocated.
2015-01-04 17:43:57 +11:00
Campbell Barton
e182d43d3e cleanup: avoid ref-counting None for a new matrix 2014-12-28 15:13:01 +11:00
Tamito Kajiyama
27b58f0eb2 Fix mathutils docstring typos. 2014-12-19 00:43:41 +09:00
Bastien Montagne
9c81833430 Fix T42885: We still had a few wrong doc in mathutils about methods returning
instance of self while actually returning None...
2014-12-13 14:07:46 +01:00
Campbell Barton
4e732b9860 Fix building as Python module (manpage-generation) 2014-09-08 11:22:40 +10:00
Bastien Montagne
e44c49d89d Py Mathutils: add invert_safe() and inverted_safe() to Matrix.
Those two mimic our BLI invert_m4_m4_safe - they add a small offset to diagonal values,
in case org matrix is degenerated, and if still non-invertible, return identity matrix.

Org patch by me, final enhanced version by ideasman42, many thanks!
2014-09-06 14:58:38 +02:00
Campbell Barton
671f75a12a Math Lib: Add copy_m2_m2, unit_m2, zero_m2 2014-09-06 11:29:27 +10:00
Campbell Barton
92a380d0b2 Minor changes for standalone mathutils 2014-05-17 12:06:29 +10:00
Campbell Barton
c034a252bb Code cleanup: quiet warnings 2014-04-29 22:37:44 +10:00
Campbell Barton
94bf67b78e Error in last commit 2014-04-29 20:41:28 +10:00
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