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
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2019-02-05 17:43:34 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2019-03-05 15:10:10 +0300
commit2894e75121d78956f23dfd0f78855fa1c1a8d615 (patch)
tree69399deabb339c4afbaca2e2bf8995a4fcfe37ee /source/blender/editors
parent76608f5ec5e9737c7ef680a2234b8e3347b61c7b (diff)
Fix parenting objects to bones/vertices causes offset
This reverts part of rBbc5482337669. Problem with above commit is that the evaluated object seems to not have partype, par1, par2, par3 copied from the original (yet). Using original object instead now. Second issue (when parenting to 'Bone Relative') is that the bones BONE_RELATIVE_PARENTING flag is set on the original, but not the evaluated bone (yet), setting this on both now. Fixes T60623 (and part of T59352) Reviewers: brecht, sergey Maniphest Tasks: T60623 Differential Revision: https://developer.blender.org/D4309
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/object/object_relations.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index a324f2acd39..a5159118196 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -89,6 +89,7 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
+#include "DEG_depsgraph_query.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -615,9 +616,11 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
Main *bmain = CTX_data_main(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
bPoseChannel *pchan = NULL;
+ bPoseChannel *pchan_eval = NULL;
const bool pararm = ELEM(partype, PAR_ARMATURE, PAR_ARMATURE_NAME, PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO);
+ Object *parent_eval = DEG_get_evaluated_object(depsgraph, par);
- DEG_id_tag_update(&par->id, ID_RECALC_TRANSFORM);
+ DEG_id_tag_update(&par->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
/* preconditions */
if (partype == PAR_FOLLOW || partype == PAR_PATH_CONST) {
@@ -653,6 +656,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
}
else if (ELEM(partype, PAR_BONE, PAR_BONE_RELATIVE)) {
pchan = BKE_pose_channel_active(par);
+ pchan_eval = BKE_pose_channel_active(parent_eval);
if (pchan == NULL) {
BKE_report(reports, RPT_ERROR, "No active bone");
@@ -680,6 +684,7 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
ob->parent = par;
/* Always clear parentinv matrix for sake of consistency, see T41950. */
unit_m4(ob->parentinv);
+ DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
}
/* handle types */
@@ -740,13 +745,17 @@ bool ED_object_parent_set(ReportList *reports, const bContext *C, Scene *scene,
}
else if (partype == PAR_BONE) {
ob->partype = PARBONE; /* note, dna define, not operator property */
- if (pchan->bone)
+ if (pchan->bone) {
pchan->bone->flag &= ~BONE_RELATIVE_PARENTING;
+ pchan_eval->bone->flag &= ~BONE_RELATIVE_PARENTING;
+ }
}
else if (partype == PAR_BONE_RELATIVE) {
ob->partype = PARBONE; /* note, dna define, not operator property */
- if (pchan->bone)
+ if (pchan->bone) {
pchan->bone->flag |= BONE_RELATIVE_PARENTING;
+ pchan_eval->bone->flag |= BONE_RELATIVE_PARENTING;
+ }
}
else if (partype == PAR_VERTEX) {
ob->partype = PARVERT1;