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
2019-11-21Bones: implement a new Aligned Inherit Scale mode.Alexander Gavrilov
Implement one more way of inheriting scale from the parent bone, as an addition to the choices introduced in D5588. This new mode inherits parent scale as if the parent and child were not rotated relative to each other, always applying parent X scale to child X scale and so forth. It is quite natural for connected bone chains with coherent roll, like limbs or tentacles, falling roughly between Average and Fix Shear in how closely the parent scaling is followed. Currently this can be achieved by using Inherit Scale: None plus a Copy Scale with Offset from parent on the child; however, this is cumbersome, and loses the distinction between true local and inherited scale in the child's Local space. This new mode also matches how the Before/After Original mix modes work in the Copy Transforms constraint. On the technical side this mode requires adding a right side scale matrix multiplication into the Local<->Pose conversion, in addition to the existing two left side matrices used for location and orientation. Differential Revision: https://developer.blender.org/D6099
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-25Cleanup: redundant struct declarationsCampbell Barton
2019-08-23Armature: add BKE_armature_transformCampbell Barton
ED_armature_transform uses edit-mode conversion which re-creates bones. Needed for efficiently transforming object-data in object-mode.
2019-08-23Cleanup: const args, naming, doxy groups, clang-formatCampbell Barton
2019-07-26Fix T67507: Set origin on armature moves incorrectly parented objectsSergey Sharybin
Need to copy changes from original armature to evaluated one prior to BKE_pose_where_is(), otherwise the pose matrix in pose channels will not be correct. Can not use dependency graph update here, since we must not re-evaluate possible dependencies of the changed armature. Reviewers: brecht Reviewed By: brecht Maniphest Tasks: T67507 Differential Revision: https://developer.blender.org/D5331
2019-07-17Fix T59713: Armature layer dots not updated on changesmano-wii
`layer_used` runtime data, which controls the drawing of dots in the UI was not getting refreshed properly. This used to happen in the drawing code, but was no longer working for reasons explained in: {rB2b09062defa093a243b5fe64b099accb07b440a3} The solution was to update each layer manually in the operators: * ARMATURE_OT_bone_primitive_add * ARMATURE_OT_delete * ARMATURE_OT_dissolve * ARMATURE_OT_fill * ARMATURE_OT_merge * ARMATURE_OT_separate * ARMATURE_OT_bone_layers * POSE_OT_bone_layers Differential Revision: https://developer.blender.org/D5281
2019-05-14Armature: implement universal hash table lookup of Bone objects by name.Alexander Gavrilov
Since drivers on Bone properties are really supposed to be stored in Armature data and access bones via its bones[] collection, this lookup path should work efficiently. Mass lookup of bones by name was already done through hashes, but they were built temporarily every time that was needed. This simply replaces it with a common hash table computed immediately after file load, copy, or Edit to Object mode switch.
2019-05-01BKE_pchan: add BKE_pchan_rot_to_mat3Campbell Barton
Useful to get the un-scaled rotation from a pose channel.
2019-04-23Cleanup: rename the curveInX etc bbone DNA fields to curve_in_x etc.Alexander Gavrilov
2019-04-23B-Bones: split the Scale In/Out properties into X and Y values.Alexander Gavrilov
As far as I can tell, there is no technical reason why the B-Bone segment thickness scaling can't be separated into two axes. The only downside is the increase in complexity of the B-Bone settings, but this is inevitable due to the increase in flexibility. Updating the file is somewhat complicated though, because F-Curves and drivers have to be duplicated and updated to the new names. Reviewers: campbellbarton Subscribers: icappiello, jpbouza Differential Revision: https://developer.blender.org/D4716
2019-04-18Armature: remove remains of the object-level deformation data cache.Alexander Gavrilov
Now that B-Bone shape data is kept in bPoseChannel_Runtime, the armature level cache only holds one quaternion value per bone. It can also be moved to runtime, and the structure removed. This has an additional effect that, as far as I can tell, now the Armature modifier can run as soon as all of the bones it actually needs are done, thus making T59848 a purely depsgraph level problem.
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-14Depsgraph: fix hard CTD on dependency cycles through POSE_INIT.Alexander Gavrilov
As reported in T63582, it can cause chan_array to be not ready. To reliably avoid crashing, the only easy way seems to be to create the index during COW -- maybe @sergey has a better idea.
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-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-02Cleanup: remove author/date info from doxy headersCampbell Barton
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-28Cleanup: sort forward declarations of enum & structCampbell Barton
Done using: source/tools/utils_maintenance/c_sort_blocks.py
2018-12-20Cleanup: namingCampbell Barton
2018-12-11RNA: provide access to bone parent transform math from Python.Alexander Gavrilov
Applying the effect of bone parent is much more complicated than simple matrix multiplication because of the various flags like Inherit Scale. Thus it is reasonable to provide access to this math from Python for complicated rest pose related manipulations. The simple case of this is handled by Object.convert_space, so the new method is only needed for complex tasks. Differential Revision: https://developer.blender.org/D4053
2018-12-10Cleanup: Variable namingSergey Sharybin
2018-12-02Merge branch 'master' into blender2.8Campbell Barton
2018-12-02Cleanup: BKE b-bone API namingCampbell Barton
Use BKE_pchan_bbone prefix.
2018-11-27RNA: expose access to B-Bone shape data from Python.Alexander Gavrilov
B-Bone shape is a non-trivial computation, so access to the results would be useful for Python scripts working with B-Bones, e.g. rig generation. This exposes both final segment matrices, and the tangent vectors computed from the custom handle bones. Since the handle tangents use the axis+roll orientation math of edit bones, add matrix conversion static methods to Bone. Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D3983
2018-11-23Depsgraph: add a new operation node for computing B-Bone segments.Alexander Gavrilov
Computing the shape of a B-Bone is a quite expensive operation, and there are multiple constraints that can access this information in a variety of useful ways. This means computing the shape once per bone and saving it is good for performance. Since the shape may depend on the position of up to two other bones, often in a "cyclic" manner, this computation has to be a separate node with its own dependencies. Reviewers: sergey Differential Revision: https://developer.blender.org/D3975
2018-11-22Cleanup: Use proper module prefix in function namesSergey Sharybin
2018-11-20Speedup rigs with multiple objects deformed by bbonesSergey Sharybin
Previously each of the objects which has armature modifier will request deformation matricies from bbones. Thing is, all those deformations are the same and do not depend on object which is being modified. What's even worse is that this calculation is not cheap. This change makes it so bbones deformation is calculated once and stored in the armature object. After this armature modifiers simply use it. With a rigs we've got here dependency graph evaluation time goes down from 0.02 sec to 0.012 sec. Possible further optimization is to make bbone deformation calculated at the time when bone is calculated. This will avoid an extra threaded loop over all bones.
2018-11-07Depsgraph: Ensure dependency cycle does not clear runtime memorySergey Sharybin
If there was a dependency cycle involved, it was possible that pchan array will be freed before all bones are evaluated. Now clear is done in a dedicated node, which is never a part of dependency cycle.
2018-11-05Cleanup: use boolCampbell Barton
2018-10-31Allow changing B-Bone custom handle references from Pose Mode.Alexander Gavrilov
@jpbouza was rather upset these were made read-only, and unlike parents, it's not that hard to allow changing these Bone fields: all is needed is to carefully refresh the matching fields in the relevant bPoseChannel objects and properly tag update. Reviewers: brecht Differential Revision: https://developer.blender.org/D3870
2018-10-05Add and use a utility for computing B-Bone roll from custom handles.Alexander Gavrilov
This also fixes a stability problem with the start handle due to an incorrect matrix multiplication order.
2018-10-04Fix T56268: display the correct rest shape for B-Bones in Edit Mode.Alexander Gavrilov
The rest shape of B-Bones is actually affected by custom handles or the default connected parent/child mechanism. Ignoring these effects thus leads to the edit mode shape being different from the actual rest pose. This splits the b_bone_spline_setup function that is used to compute the correct rest and pose shape from pose channels into two parts, and applies the data structure independent half to edit mode. In order to access the custom handle settings in Edit Mode, they are moved to Bone and EditBone, while the bPoseChannel fields are downgraded in status to a cache for performance. Also, instead of flags, introduce an enum to specify the handle operation modes, so that new ones could be added later. Reviewers: aligorith, brecht Differential Revision: https://developer.blender.org/D3588
2018-09-24Merge branch 'master' into blender2.8Brecht Van Lommel
2018-09-24Spelling fixes in comments and descriptions, patch by luzpaz.Brecht Van Lommel
Differential Revision: https://developer.blender.org/D3719
2018-08-13Fix dependency graph for constraints depending on B-Bone shape.Alexander Gavrilov
Some constraints have an option to take the final bezier shape of the target B-Bone into account. This shape usually depends on two other bones in addition to the target itself, so the graph should include the relevant dependencies. Reviewers: sergey Differential Revision: https://developer.blender.org/D3591
2018-07-31Fix T56170: Fake dependency cycle in new depsgraph + interleaved armature ↵Sergey Sharybin
update + proxy Make proxy copy result more atomic operation.
2018-07-31Respect ID user count when creating pose on object copySergey Sharybin
This solves wrong user counter of custom shape when duplicating bone few times and then undoing all the duplications.
2018-07-20Fix T55973: [2.8] Crash when 'apply pose as rest pose' when bone scale is 0,0,0.Bastien Montagne
`BKE_pose_rebuild()` should (ideally) always trigger a rebuild of the depsgraph, since it can add or remove posechannels. This function now takes a Main parameter to ensure that related depsgraphes are tagged as dirty (kept it optional, for some corner cases). We should also probably double-check calls to that function, think in theory it should only be called from depsgraph itself? But for now...
2018-06-29Merge branch 'master' into blender2.8Campbell Barton
2018-06-29Cleanup: trailing newlinesCampbell Barton
2018-06-17Merge branch 'master' into blender2.8Campbell Barton
2018-06-17Cleanup: trailing space for blenkernelCampbell Barton
2018-05-08Cleanup: whitespace, duplicate includesCampbell Barton
2018-05-03Depsgraph: Make sure evaluated pose channels are pointing to evaluated bonesSergey Sharybin
2018-04-30Cleanup: Move FOREACH_PCHAN_*_IN_OBJECT_*() macros to BKE_armature.hJoshua Leung
This reduces the number of headers we need to import (and/or dependencies on the order of them), as these depend on PBONE_VISIBLE(), which is already in BKE_armature.h
2018-04-16Depsgraph: remove EvaluationContext, pass Depsgraph instead.Brecht Van Lommel
The depsgraph was always created within a fixed evaluation context. Passing both risks the depsgraph and evaluation context not matching, and it complicates the Python API where we'd have to expose both which is not so easy to understand. This also removes the global evaluation context in main, which assumed there to be a single active scene and view layer. Differential Revision: https://developer.blender.org/D3152
2018-04-04Merge branch 'master' into blender2.8Sergey Sharybin
2018-04-04Depsgraph: Only bind ID-data and indices to depsgraph callbacksSergey Sharybin
This is a part of copy-on-write sanitization, to avoid all the checks which were attempting to keep sub-data pointers intact. Point is: ID pointers never change for CoW datablocks, but nested data pointers might change when updating existing copy. Solution: Only bind ID data pointers and index of sub-data. This will make CoW datablock 7update function was easier in 2.8. In master we were only using pose channel pointers in callbacks, this is exactly what this commit addresses. A linear lookup array is created on pose evaluation init and is thrown away afterwards. One thing we might consider doing is to keep indexed array of poses, similar to chanhash. Reviewers: campbellbarton Reviewed By: campbellbarton Subscribers: dfelinto Differential Revision: https://developer.blender.org/D3124