Commit Graph

159 Commits

Author SHA1 Message Date
6570159929 Cleanup: update clang-format so PyObject_HEAD indents properly 2021-06-24 17:12:04 +10:00
4b9ff3cd42 Cleanup: comment blocks, trailing space in comments 2021-06-24 15:59:34 +10:00
41f2ea4045 Fix incorrect BLI_snprintf usage
Event though in practice this wasn't causing problems as the fixed size
buffers are generally large enough not to truncate text.

Using the result from `snprint` or `BLI_snprintf` to step over a fixed
size buffer allows for buffer overruns as the returned value is the size
needed to copy the entire string, not the number of bytes copied.

Building strings using this convention with multiple calls:

    ofs += BLI_snprintf(str + ofs, str_len_max - ofs);

.. caused the size argument to become negative,
wrapping it to a large value when cast to the unsigned argument.
2021-05-27 17:59:21 +10:00
8a26fec6ea Cleanup: use const casts in mathutils API 2021-05-18 14:16:34 +10:00
a86e815dd8 Mathutils: add a Matrix.LocRotScale constructor for combining channels.
Combining location, rotation and scale channels into a matrix is
a standard task, so while it is easily accomplished by constructing
and multiplying 3 matrices, having a standard utility allows for
more clear code.

The new constructor builds a 4x4 matrix from separate location,
rotation and scale values. Rotation can be represented as a 3x3
Matrix, Quaternion or Euler value, while the other two inputs
are vectors. Unneeded inputs can be replaced with None.

Differential Revision: https://developer.blender.org/D11264
2021-05-17 19:12:40 +03:00
3f47df577d Cleanup: use new BLI_assert_unreachable macro 2021-03-24 12:38:08 +11:00
dae445d94a Fix T85573: Building with Python 3.10a5 fails
Replace deprecated _PyUnicode_AsString{AndSize} usage.

T83626 still needs to be resolved before 3.10 is usable.
2021-02-13 23:09:55 +11:00
f11f7ce08e Cleanup: use ELEM macro (>2 args) 2020-11-06 12:54:19 +11:00
2caa6dd7f8 Cleanup: clang-format 2020-10-01 14:29:45 +02:00
4c3047a9cd API Docs: Use raises field list syntax
See 
https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#info-field-lists
2020-09-29 15:07:41 -04:00
f5e55c3337 Cleanup: use bool instead of int in various places 2020-09-02 19:10:40 +02:00
efa7aaa97f Cleanup: use const variables where possible in the Python API 2020-08-20 16:10:13 +10:00
3d48d99647 Cleanup: Python, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return`
rule in the `source/blender/python` module.

No functional changes.
2020-08-07 13:38:07 +02:00
fa7ace2215 PyAPI: support element multiplication for vector, matrix, quaternions
This was disabled during 2.8x for smooth porting of 2.7x scripts,

Now '@' is used for matrix multiplication,
support '*' to multiple vector elements.

See T56276.
2020-07-14 22:52:50 +10:00
56d0df51a3 Python: support building again version 3.9 (unreleased)
Resolves T78089, no functional changes.
2020-06-22 14:55:36 +10:00
a2c4e5d222 Cleanup: clang-format 2020-06-17 16:07:26 +02:00
Tobias Heinke
24d77e7db7 API docs: mathutils leaked markup
Reviewed By: Blendify

Differential Revision: https://developer.blender.org/D8021
2020-06-14 19:15:05 -04:00
2d1cce8331 Cleanup: make format after SortedIncludes change 2020-03-19 09:33:58 +01:00
2a6df7dfe5 Cleanup: use named unsigned types in the Python API 2020-02-20 15:40:05 +11:00
1e3ffd1f87 mathutils: support for to_2x2 as well as non-square matrices 2020-02-20 15:17:22 +11:00
Tiago Chaves
bc86eb1780 mathutils: support Vector.rotate for 2D vectors 2020-02-20 13:58:46 +11:00
9a9f39e466 Cleanup: remove redundant 'char *' casts 2019-12-20 10:42:57 +11:00
36b6fb5cd6 Cleanup: warnings building with Python 3.8 2019-10-16 14:44:36 +11:00
2425401a59 Cleanup: spelling 2019-08-04 12:51:44 +10:00
ec1c9e3258 Python API: add a Matrix.Diagonal constructor to mathutils.
For some reason there seems to be no way to do the very simple and
obvious task of converting a scale vector to a matrix via mathutils.
The Matrix.Scale constructor does something complicated instead.

Reviewers: brecht, campbellbarton

Differential Revision: https://developer.blender.org/D4893
2019-05-19 15:03:27 +03:00
778542fd8f Cleanup: comments (long lines) in python 2019-04-29 20:01:10 +10:00
e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
dbc058301b Cleanup: trailing commas 2019-04-16 16:40:47 +02:00
25ec4b437f Cleanup: style, use braces for the Python API 2019-03-30 07:14:28 +11:00
a38313c3bd Cleanup: style, array wrapping
Add trailing comma for clang-format.
2019-03-25 09:02:04 +11:00
35b78d9807 Cleanup: indentation, wrapping
Mostly functions wrapping args, not confirming to our style guide.
2019-03-15 09:54:30 +11:00
de13d0a80c doxygen: add newline after \file
While \file doesn't need an argument, it can't have another doxy
command after it.
2019-02-18 08:22:12 +11:00
eef4077f18 Cleanup: remove redundant doxygen \file argument
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
2019-02-06 15:45:22 +11:00
744f633986 Cleanup: trailing commas
Needed for clan-format not to wrap onto one line.
2019-02-03 14:59:11 +11:00
65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
8a61ea7296 Cleanup: add trailing commas
Prevents clang-format merging into a single line.
2019-01-19 13:58:35 +11:00
d46d8e831c Merge branch 'master' into blender2.8 2018-12-19 10:28:26 +11:00
5c3953010d Cleanup: spelling 2018-12-19 10:18:15 +11:00
4b545d1bbf Fix T58975: "@=" operator silently fails
D4083 by @artfunkel
2018-12-16 09:49:00 +11:00
49490e5cfb Merge branch 'master' into blender2.8 2018-12-12 13:02:09 +11:00
e757c4a3be Cleanup: use colon separator after parameter
Helps separate variable names from descriptive text.
Was already used in some parts of the code,
double space and dashes were used elsewhere.
2018-12-12 12:50:58 +11:00
a43ebc63fa Merge branch 'master' into blender2.8
Conflicts:
	source/blender/blenkernel/intern/collision.c
2018-09-03 17:44:36 +02:00
4da2acae3a Spelling fixes in comments and descriptions, patch by luzpaz.
Differential Revision: https://developer.blender.org/D3668
2018-09-03 16:55:01 +02:00
7eaf00bfb0 Cleanup: style 2018-08-22 10:10:12 +10:00
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
a69f985f40 PyAPI: move deep-copy args check to py_capi_utils 2018-06-26 09:31:57 +02:00
2aa0bde3dc mathutils: replace interp w/ blend when standalone 2018-03-18 05:08:12 +01:00
7b3e441bcf Improved docstring of mathutils.Matrix.lerp() 2018-01-18 09:58:14 +01:00
9811150952 Improve docstring for mathutils.Matrix.decompose() 2018-01-18 09:38:01 +01:00
1cc4033df8 PyAPI: expose matrix parsing function 2017-08-19 21:36:50 +10:00