diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-07-15 20:39:02 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-06 10:56:08 +0300 |
commit | 798cdaeeb6927cb9ca42597fa23845eac04c02b2 (patch) | |
tree | 92e444a0a2268d891cdd90f56299ccb8f1c1bf3b /source/blender/blenloader | |
parent | a817613be5ab1545b000e9173a8d3079aaaefa01 (diff) |
Implement an Armature constraint that mimics the modifier.
The main use one can imagine for this is adding tweak controls to
parts of a model that are already deformed by multiple other major
bones. It is natural to expect such locations to deform as if the
tweaks aren't there by default; however currently there is no easy
way to make a bone follow multiple other bones.
This adds a new constraint that implements the math behind the Armature
modifier, with support for explicit weights, bone envelopes, and dual
quaternion blending. It can also access bones from multiple armatures
at the same time (mainly because it's easier to code it that way.)
This also fixes dquat_to_mat4, which wasn't used anywhere before.
Differential Revision: https://developer.blender.org/D3664
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 8 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 12 |
2 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 4a2a0b3efe2..530a4c8dfb8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3501,6 +3501,14 @@ static void direct_link_constraints(FileData *fd, ListBase *lb) IDP_DirectLinkGroup_OrFree(&data->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd); break; } + case CONSTRAINT_TYPE_ARMATURE: + { + bArmatureConstraint *data= con->data; + + link_list(fd, &data->targets); + + break; + } case CONSTRAINT_TYPE_SPLINEIK: { bSplineIKConstraint *data= con->data; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index c3693de4866..919c6d05740 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1536,6 +1536,18 @@ static void write_constraints(WriteData *wd, ListBase *conlist) break; } + case CONSTRAINT_TYPE_ARMATURE: + { + bArmatureConstraint *data = con->data; + bConstraintTarget *ct; + + /* write targets */ + for (ct = data->targets.first; ct; ct = ct->next) { + writestruct(wd, DATA, bConstraintTarget, 1, ct); + } + + break; + } case CONSTRAINT_TYPE_SPLINEIK: { bSplineIKConstraint *data = con->data; |