Commit Graph

95 Commits

Author SHA1 Message Date
Campbell Barton f35e9f047a Merge branch 'master' into blender2.8 2018-09-19 12:14:36 +10:00
Campbell Barton bb3ec3ebaf BLI_utildefines: rename pointer conversion macros
Terms get/set don't make much sense when casting values.

Name macros so the conversion is obvious,
use common prefix for easier completion.

- GET_INT_FROM_POINTER  -> POINTER_AS_INT
- SET_INT_IN_POINTER    -> POINTER_FROM_INT
- GET_UINT_FROM_POINTER -> POINTER_AS_UINT
- SET_UINT_IN_POINTER   -> POINTER_FROM_UINT
2018-09-19 12:12:21 +10:00
Campbell Barton 0ddf3e110e Cleanup: comment blocks 2018-09-02 18:51:31 +10:00
Campbell Barton ae57383648 Cleanup: comment blocks 2018-09-02 18:28:27 +10:00
Campbell Barton 7eaf00bfb0 Cleanup: style 2018-08-22 10:10:12 +10:00
Andrew Hale aa5a96430e Python: Add support for @ infix operator matrix multiplication
This differential revision implements the code for T56276

Reviewers: campbellbarton

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D3587
2018-08-10 15:18:00 +02:00
Campbell Barton fe8d8aa27e Fix Vector.project crash w/ >4 length vectors 2018-07-27 17:41:20 +10:00
Campbell Barton a69f985f40 PyAPI: move deep-copy args check to py_capi_utils 2018-06-26 09:31:57 +02:00
Campbell Barton 0c82a6fec8 Cleanup: unused define 2017-09-22 07:23:03 +10:00
Campbell Barton 30d8829780 Docs: mathutils docstrings 2017-09-09 11:02:26 +10:00
Campbell Barton 90eb93791f Cleanup: mathutils vector comments
Use doxy markup & correct outdated info.
2017-09-09 10:50:40 +10:00
Campbell Barton 3930e46e37 Correct last commit 2017-09-09 10:15:16 +10:00
Campbell Barton 002cc6aef3 Cleanup: Simplify SWIZZLE macro
- Use indices instead of character args.
- Use numbered macros instead of variadic args.

Parsing using rtags used over 11gb of memory. While this should be
resolved upstream (report as #1053), the extra complexity didn't give
any real advantage.
2017-09-09 10:10:05 +10:00
Campbell Barton 46cf33bf01 PyAPI: Make use of PyC_LongAs... API
Avoids setting exceptions inline,
also use Matrix_ParseAny for bmesh.ops.

Some inline exceptions are kept because they show useful details.
2017-08-20 15:49:10 +10:00
Campbell Barton 81f4bc1665 Cleanup: reduce Vector_getseters size using macros 2016-07-31 20:43:52 +10:00
Campbell Barton 4e500101a7 Cleanup: quiet -Wcomma, cast to void where needed 2016-03-05 09:16:12 +11:00
Campbell Barton de356415ae Correct comments & some explanation from last commit 2016-01-21 11:03:37 +11:00
Campbell Barton a1164ce271 Remove errors for unsupported math operations 2016-01-21 10:30:17 +11: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
Campbell Barton ce85aef0d9 mathutils: remove redundant read callback 2015-02-15 13:46:47 +11:00
Campbell Barton 4feb77cf03 mathutils: avoid extra alloc for Vector.lerp 2015-02-15 13:46:47 +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 79ba5e52dd Revert "mathutils: let Vector.normalize() return the original length."
Please discuss changes to core mathutils functions first.

Changes like this should be considered and applied to all areas of the API (or not at all).
Missed quaternion, matrix normalize for eg.
2015-01-30 02:12:07 +11:00
Sybren A. Stüvel 6912fe132f mathutils: let Vector.normalize() return the original length.
The length has to be calculated for normalization anyway, and it is already
returned by normalize_vn(vec, size).
2015-01-29 15:29:01 +01: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
Tamito Kajiyama 8d3bfef538 Extended mathutils.Vector.orthogonal() to accept a 2D vector.
Reviewer: Campbell Barton

Differential revision: https://developer.blender.org/D668
2014-07-23 23:10:03 +09:00
Campbell Barton dc847607b6 Change Vector.slerp to accept nonunit vectors 2014-04-18 20:49:39 +10:00
Campbell Barton 55f83e36cc Py API: Vector.slerp(). also added interp_v3_v3v3_slerp(_safe) functions 2014-03-31 13:28:37 +11:00
Campbell Barton 6aa75d3b2c Fix for error in normalize_vn_vn(), add len_squared_vn 2014-03-31 11:19:32 +11:00
Campbell Barton a47137a2db Python API: add Vector.orthogonal() method 2014-03-18 00:39:46 +11:00
Campbell Barton 06b6cd8345 PyAPI: mathutils.Vector.cross now works for 2d vectors (returns a float)
also fixed crash when running on large vectors (raises exception now)
2014-02-05 23:36:30 +11:00
Campbell Barton bd697dd4d7 Fix T38402: invalid message for bad type assignments (Quat, Vector) 2014-01-30 16:45:20 +11:00
Campbell Barton a5c35fb27f Code cleanup: use booleans where appropriate 2014-01-28 04:00:04 +11:00
Campbell Barton da6bc87b57 Fix T38138: incorrect API docs 2014-01-09 21:49:11 +11:00
Campbell Barton b6db417ee4 code cleanup: use const's for vector args. 2013-10-12 02:19:37 +00:00
Campbell Barton 1576565932 minor changes needed for building standalone mathutils. 2013-09-14 00:30:56 +00:00
Campbell Barton f3654ce6b6 fix incorrect docs [#36518] Vector.rotate() does not return value as documented 2013-08-20 08:41:34 +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
Thomas Dinges 858ff6b696 Fix for [#34898] Typo in error message of mathutils.Vector
* Also fixed some more cases of "more then" -> "more than".
2013-04-07 15:09:06 +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 cf6994b910 code cleanup: spelling,
also initialize bmesh-bevel settings struct to zero to avoid possible uninitialized memory later.
2012-11-12 07:33:01 +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 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 77f0be7fec support unary positive operators for vectors (same as numpy), so you can do 'vector_a = +vector_b', this makes a copy. 2012-08-27 13:40:19 +00:00