Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-09-11Cleanup: spelling, correct commentsCampbell Barton
2020-09-04Cleanup: Clang-Tidy readability-inconsistent-declaration-parameter-name fixSebastian Parborg
No functional changes
2020-08-25BLI_math_matrix: add invert_m4_m4_safe_ortho (m3 version too)Campbell Barton
Unlike invert_m4_m4_safe, this calculates zeroed axes. Useful when we need to use the inverse of an objects matrix, keeping the valid axis, only filling in the zeroed ones.
2020-07-13Clang Tidy: enable readability-non-const-parameter warningJacques Lucke
Clang Tidy reported a couple of false positives. I disabled those `NOLINTNEXTLINE`. Differential Revision: https://developer.blender.org/D8199
2020-06-25Cleanup: spellingCampbell Barton
2020-06-18Allow interpolation of matrices with negative scale / axis flipsSybren A. Stüvel
The matrix interpolation function `interp_m3_m3m3()` decomposes the matrices into rotation and scale matrices, converts the rotation matrices to quaternions, SLERPs the quaternions, and converts the result back to a matrix. Since quaternions cannot represent axis flips, this results in interpolation problems like described in T77154. Our interpolation function is based on "Matrix Animation and Polar Decomposition", by Ken Shoemake & Tom Duff. The paper states that it produces invalid results when there is an axis flip in the rotation matrix (or negative determinant, or negative scale, those all indicate the same thing). Their solution is to multiply the rotation matrix with `-I`, where `I` is the identity matrix. This is the same as element-wise multiplication with `-1.0f`. My proposed solution is to not only do that with the rotation matrix `R`, but also with the scale matrix `S`. This ensures that the decomposition of `A = R * S` remains valid, while also making it possible to conver the rotation component to a quaternion. There is still an issue when interpolating between matrices with different determinant. As the determinant represents the change in volume when that matrix is applied to an object, interpolating between a negative and a positive matrix will have to go through a zero determinant. In this case the volume collapses to zero. I don't see this as a big issue, though, as without this patch Blender would also produce invalid results anyway. Reviewed By: brecht, sergey Differential Revision: https://developer.blender.org/D8048
2020-03-19Cleanup: `make format` after SortedIncludes changeDalai Felinto
2020-02-20BLI_math: add 2x2 matrix utilitiesTiago Chaves
2020-02-20Cleanup: rename mul_m2v2 to mul_m2_v2Campbell Barton
Matches mul_m3_v3
2020-02-15Modifiers: Add option to directly specify a 2D transform for UVWarpLukas Stockner
Currently the only option is to warp based on the transform of other objects, which is inconvenient if you want to e.g. control it through a driver - you need to set up a dummy object and go through that, which is clunky and should be unneccessary. Reviewed By: brecht Differential Revision: https://developer.blender.org/D6690
2019-12-24Action Constraint: introduce a mix mode setting.Alexander Gavrilov
Currently the action channels are applied after the existing transformation, as if the action controlled a child of the bone. This is not very natural, but more importantly, the transform tools are not designed to work conveniently with an additional 'pseudo-child' transformation, resulting in effects like an unexpected pivot location. Implementing a Before mode that integrates the action channels as if applied to a parent allows using the special transform tool code intended for dealing with such constraints. Note that in either mode, Action constraints should be added in reverse order, putting a new constraint before the existing ones that the Action was keyframed to work together. In order to implement the option, extract a utility from the Copy Transform constraint code for combining transforms with special anti-shear scale handling that matches the Aligned Inherit Scale mode. The Before mode also requires switching the constraint to the Local owner space, while the After mode can still use the World space for efficiency as before. Since the constraint doesn't have an Owner space option in the UI, this has to be handled in an RNA setter. For full backward compatibility, the original simple matrix multiplication mode is preserved as the third option, but it is not recommended due to creating shear. Differential Revision: https://developer.blender.org/D6297
2019-11-24Cleanup: doxygen commentsCampbell Barton
Also correct some outdated symbol references, add missing 'name' commands.
2019-10-22BLI_math: support MATH_STANDALONE without EigenCampbell Barton
2019-09-30Cleanup: spellingCampbell Barton
2019-09-06Copy Rotation: implement new mixing modes that actually work.Alexander Gavrilov
Upon close inspection, the way the Offset mode works in the Copy Rotation constraint makes no sense, and in fact, destroys the rotation of its owner unless either it's single axis, or the order is set specifically to `ZYX Euler`. Since it can't simply be changed because of backward compatibility concerns, replace the checkbox with a dropdown that provides a set of new modes that actually make sense. Specifically, add a mode that simply adds Euler components together, and two options that use matrix multiplication in different order. The Python use_offset property is replaced with compatibility stubs. Reviewers: brecht Differential Revision: https://developer.blender.org/D5640
2019-09-04Armature: add Inherit Scale options to remove shear or average the scale.Alexander Gavrilov
As an inherent property of matrix-based transformation math, non- uniform scaling of a parent bone induces shear into the transform matrix of any rotated child. Such matrices cannot be cleanly decomposed into a combination of location/rotation/scale, which causes issues for rigging and animation tools. Blender bones have options to exclude rotation and/or scale from the inherited transformation, but don't have any support for removing the often undesired shear component. That goal requires replacing simple parenting with a combination of multiple bones and constraints. The same is true about the goal of inheriting some scale, but completely avoiding shear. This patch replaces the old Inherit Scale checkbox with a enum that supports multiple options: * Full: inherit all effects of scale, like with enabled Inherit Scale. * Fix Shear: removes shear from the final inherited transformation. The cleanup math is specifically designed to preserve the main axis of the bone, its length and total volume, and minimally affect roll on average. It however will not prevent reappearance of shear due to local rotation of the child or its children. * Average: inherit uniform scale that represents the parent volume. This is the simplest foolproof solution that will inherit some scale without ever causing shear. * None: completely remove scale and shear. * None (Legacy): old disabled Inherit Scale checkbox. This mode does not handle parent shear in any way, so the child is likely to end up having both scale and shear. It is retained for backward compatibility. Since many rigging-related addons access the use_inherit_scale property from Python, it is retained as a backward compatibility stub that provides the old functionality. As a side effect of reworking the code, this also fixes a matrix multiplication order bug in the Inherit Rotation code, which caused the parent local scale to be applied in world space. In rigger opinion this option is useless in production rigs, so this fix should not be a problem. Reviewers: brecht Differential Revision: https://developer.blender.org/D5588
2019-08-26Cleanup: use BLI_assertCampbell Barton
2019-08-20Cleanup: comparison warningCampbell Barton
2019-08-20BLI: double version of some math functions.YimingWu
2019-06-12Cleanup: spelling in commentsCampbell Barton
2019-05-31Cleanup: style, use braces in source/Campbell Barton
Automated using clang-tidy.
2019-05-08Cleanup: unused var, doxy syntax for math_matrix.cCampbell Barton
2019-05-07Fix T57767: Pivot point broken after scaling to 0 in a dimensionPhilipp Oeser
matrix inversion was changed in rB01c75c3765eb from own code to EIGEN for performance reasons. EIGEN would return a zero matrix on failure (resulting in the pivot always being at the object origin). This brings back the "old" matrix inversion code (which has the benifit of providing a partial solution which makes the local transform center appear correct) Reviewers: campbellbarton Maniphest Tasks: T57767 Differential Revision: https://developer.blender.org/D4804
2019-05-06Drivers: add an Average Scale option to the Transform Channel driver vars.Alexander Gavrilov
Unlike location and rotation, there is a meaningful definition of overall/average scaling via the total change in the volume. This adds an option to retrieve that via a single driver variable, instead of having to use three and an expression. Using the determinant to compute the volume scaling also allows detecting flipping due to negative scale - this is impossible to do via the three variable approach. The volume_scale functions are added purely for code readability: 'volume scale factor' is easier to understand than determinant. Differential Revision: https://developer.blender.org/D4803
2019-04-21Cleanup: comments (long lines) in blenlibCampbell Barton
2019-04-17ClangFormat: apply to source, most of internCampbell Barton
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-14Complete the set of matrix multiplication functions.Alexander Gavrilov
Also, mul_m3_m3m4 was named incorrectly.
2019-04-14Cleanup: doxy commentsCampbell Barton
Use doxy references to function and enums, also correct some names which became out of sync.
2019-04-13Fix T37500: implement Bendy bone segment deformation interpolation.Alexander Gavrilov
Previously B-Bone deformation mapped every vertex to just one B-Bone segment. This results in abrupt transformation differences between the sides of each threshold plane, reducing the quality of B-Bone deformation and making the use of shape keys impractical. This commit replaces this approach with a linear blend between the two closest segment transformations, effectively representing the B-Bone as two weight-blended plain bones for each vertex. In order to distribute the interpolation more evenly along the bone, segment matrices for deformation are now computed at points between the segments and at the ends of the B-Bone. The computation also uses the true tangents of the Bezier curve for the orientation. The nodes at the end of the bone require some special handling to deal with zero-length Bezier handles caused by a zero ease value. The Copy Transforms constraint now also smoothly interpolates rotation and scaling along the bone shape when enabled. The initial version of the patch was submitted by @Sam200. Differential Revision: https://developer.blender.org/D4635
2019-04-09Cleanup: spellingCampbell Barton
2019-03-27Cleanup: style, use braces for blenlibCampbell Barton
2019-02-18doxygen: add newline after \fileCampbell Barton
While \file doesn't need an argument, it can't have another doxy command after it.
2019-02-06Cleanup: remove redundant doxygen \file argumentCampbell Barton
Move \ingroup onto same line to be more compact and make it clear the file is in the group.
2019-02-01Cleanup: remove redundant, invalid info from headersCampbell Barton
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-01-18Math: Make it possible to use vector for both input and outputSergey Sharybin
Avoids nasty code all over where such math is required, and compilers can easily deal with such situation. Don't prefer questionable micro-optimization which comes with a cost of nasty actual logic code.
2019-01-15Cleanup: comment line length (blenlib)Campbell Barton
Prevents clang-format wrapping text before comments.
2018-11-14Merge branch 'master' into blender2.8Campbell Barton
2018-11-14Cleanup: comment block tabsCampbell Barton
2018-10-28BLI: Add comment about to orthogonalize_m3/4Clément Foucault
2018-06-01Cleanup: whitespaceCampbell Barton
2018-06-01Math: optimizations for 4x4x matrix inverse, multiplications.Brecht Van Lommel
In some heavy rigs matrix inverse can be 10% of computation time. This reduces it to 2% by using Eigen's optimized 4x4 matrix inverse and SSE matrix multiplication.
2017-11-14BLI: sync changes from 2.8Campbell Barton
2017-09-05Merge branch 'master' into blender2.8Campbell Barton
2017-09-05Cleanup: use constCampbell Barton
Also use assert w/ rotate_m4.
2017-08-04BLI_math: use const args for mul_m#_seriesCampbell Barton
2017-06-19Merge branch 'master' into blender2.8Campbell Barton
2017-06-19Cleanup: doxygen commentsCampbell Barton
Also remove duplicate & mismatching comments from grease-pencil header. Keep comments close to implementation to avoid getting out of sync.
2017-04-26BLI_math: add helper function to extract XY 2D scale from a 4D matrix.Bastien Montagne
2016-12-01Merge branch 'master' into blender2.8Lukas Tönne
2016-11-25Math Lib: avoid temp array for rotate_m4Campbell Barton
No need to have temp array storage, avoid 2x loops.