diff options
author | Henrik Dick <weasel> | 2020-12-03 12:42:29 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-12-03 13:20:21 +0300 |
commit | a6c4e39876d8a0765290312f6d8c0175274114cd (patch) | |
tree | 98568a07fb46bb643cee07ea0ac08991f4f4db2e /source/blender/editors | |
parent | 899dcc5f60667a54d9628fcb5656f7e9db642068 (diff) |
Add Custom Object Space to Constraints
Add Custom Space to the list of space conversions for constraints.
Constraints can use World Space, Local Space, Pose Space, Local with
Parent, and now also Custom Space with a custom object to define the
evaluation space.
The Custom Space option uses the Local Space of an other
object/bone/vertex group. If selected on owner or target it will show a
box for object selection. If an armature is selected, then it will also
show a box for bone selection. If a mesh object is selected it will show
the option for using the local space of a vertex group.
Reviewed By: #animation_rigging, sybren, Severin, angavrilov
Differential Revision: https://developer.blender.org/D7437
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/armature/armature_add.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index fde062b8454..af323bf91e4 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -453,10 +453,13 @@ static void updateDuplicateActionConstraintSettings(EditBone *dup_bone, float mat[4][4]; + bConstraintOb cob = {.depsgraph = NULL, .scene = NULL, .ob = ob, .pchan = NULL}; + BKE_constraint_custom_object_space_get(cob.space_obj_world_matrix, curcon); + unit_m4(mat); bPoseChannel *target_pchan = BKE_pose_channel_find_name(ob->pose, act_con->subtarget); BKE_constraint_mat_convertspace( - ob, target_pchan, mat, curcon->tarspace, CONSTRAINT_SPACE_LOCAL, false); + ob, target_pchan, &cob, mat, curcon->tarspace, CONSTRAINT_SPACE_LOCAL, false); float max_axis_val = 0; int max_axis = 0; @@ -605,8 +608,11 @@ static void updateDuplicateLocRotConstraintSettings(Object *ob, unit_m4(local_mat); + bConstraintOb cob = {.depsgraph = NULL, .scene = NULL, .ob = ob, .pchan = pchan}; + BKE_constraint_custom_object_space_get(cob.space_obj_world_matrix, curcon); + BKE_constraint_mat_convertspace( - ob, pchan, local_mat, curcon->ownspace, CONSTRAINT_SPACE_LOCAL, false); + ob, pchan, &cob, local_mat, curcon->ownspace, CONSTRAINT_SPACE_LOCAL, false); if (curcon->type == CONSTRAINT_TYPE_ROTLIMIT) { /* Zero out any location translation */ @@ -657,9 +663,12 @@ static void updateDuplicateTransformConstraintSettings(Object *ob, float target_mat[4][4], own_mat[4][4], imat[4][4]; + bConstraintOb cob = {.depsgraph = NULL, .scene = NULL, .ob = ob, .pchan = pchan}; + BKE_constraint_custom_object_space_get(cob.space_obj_world_matrix, curcon); + unit_m4(own_mat); BKE_constraint_mat_convertspace( - ob, pchan, own_mat, curcon->ownspace, CONSTRAINT_SPACE_LOCAL, false); + ob, pchan, &cob, own_mat, curcon->ownspace, CONSTRAINT_SPACE_LOCAL, false); /* ###Source map mirroring### */ float old_min, old_max; @@ -717,7 +726,7 @@ static void updateDuplicateTransformConstraintSettings(Object *ob, bPoseChannel *target_pchan = BKE_pose_channel_find_name(ob->pose, trans->subtarget); unit_m4(target_mat); BKE_constraint_mat_convertspace( - ob, target_pchan, target_mat, curcon->tarspace, CONSTRAINT_SPACE_LOCAL, false); + ob, target_pchan, &cob, target_mat, curcon->tarspace, CONSTRAINT_SPACE_LOCAL, false); invert_m4_m4(imat, target_mat); /* convert values into local object space */ |