[Bf-blender-cvs] [0d768cca65c] blender2.8: Fix T55177: pose-mode manipulator placement w/ COW

Campbell Barton noreply at git.blender.org
Thu May 24 15:22:47 CEST 2018


Commit: 0d768cca65c065a8560ba6fd16af88aeee906eb8
Author: Campbell Barton
Date:   Thu May 24 15:12:40 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0d768cca65c065a8560ba6fd16af88aeee906eb8

Fix T55177: pose-mode manipulator placement w/ COW

===================================================================

M	source/blender/editors/transform/transform_manipulator_3d.c
M	source/blender/editors/transform/transform_orientations.c

===================================================================

diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c
index 891d9cf67f1..b94ccf42325 100644
--- a/source/blender/editors/transform/transform_manipulator_3d.c
+++ b/source/blender/editors/transform/transform_manipulator_3d.c
@@ -596,8 +596,8 @@ int ED_transform_calc_manipulator_stats(
 	RegionView3D *rv3d = ar->regiondata;
 	Base *base;
 	Object *ob = OBACT(view_layer);
-	const Object *ob_eval = NULL;
-	const Object *obedit_eval = NULL;
+	Object *ob_eval = NULL;
+	Object *obedit_eval = NULL;
 	bGPdata *gpd = CTX_data_gpencil_data(C);
 	const bool is_gp_edit = ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE));
 	int a, totsel = 0;
@@ -629,7 +629,7 @@ int ED_transform_calc_manipulator_stats(
 			case V3D_MANIP_GIMBAL:
 			{
 				float mat[3][3];
-				if (gimbal_axis(ob, mat)) {
+				if (gimbal_axis(ob_eval, mat)) {
 					copy_m4_m3(rv3d->twmat, mat);
 					break;
 				}
@@ -947,7 +947,7 @@ int ED_transform_calc_manipulator_stats(
 		int mode = TFM_ROTATION; // mislead counting bones... bah. We don't know the manipulator mode, could be mixed
 		bool ok = false;
 
-		if ((pivot_point == V3D_AROUND_ACTIVE) && (pchan = BKE_pose_channel_active(ob))) {
+		if ((pivot_point == V3D_AROUND_ACTIVE) && (pchan = BKE_pose_channel_active(ob_eval))) {
 			/* doesn't check selection or visibility intentionally */
 			Bone *bone = pchan->bone;
 			if (bone) {
@@ -958,11 +958,11 @@ int ED_transform_calc_manipulator_stats(
 			}
 		}
 		else {
-			totsel = count_set_pose_transflags(&mode, 0, ob);
+			totsel = count_set_pose_transflags(&mode, 0, ob_eval);
 
 			if (totsel) {
 				/* use channels to get stats */
-				for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+				for (pchan = ob_eval->pose->chanbase.first; pchan; pchan = pchan->next) {
 					Bone *bone = pchan->bone;
 					if (bone && (bone->flag & BONE_TRANSFORM)) {
 						calc_tw_center(tbounds, pchan->pose_head);
@@ -1018,7 +1018,7 @@ int ED_transform_calc_manipulator_stats(
 			if (!TESTBASELIB(base)) {
 				continue;
 			}
-			const Object *base_object_eval = DEG_get_evaluated_object(depsgraph, base->object);
+			Object *base_object_eval = DEG_get_evaluated_object(depsgraph, base->object);
 			if (ob == NULL) {
 				ob = base->object;
 				ob_eval = base_object_eval;
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 19df46455d7..3065007ea6b 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -56,6 +56,8 @@
 #include "BKE_scene.h"
 #include "BKE_workspace.h"
 
+#include "DEG_depsgraph_query.h"
+
 #include "BLT_translation.h"
 
 #include "ED_armature.h"
@@ -1014,12 +1016,14 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
 		}
 	}
 	else if (ob && (ob->mode & OB_MODE_POSE)) {
-		bArmature *arm = ob->data;
+		const Depsgraph *depsgraph = CTX_data_depsgraph(C);
+		Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
+		bArmature *arm = ob_eval->data;
 		bPoseChannel *pchan;
 		float imat[3][3], mat[3][3];
 		bool ok = false;
 
-		if (activeOnly && (pchan = BKE_pose_channel_active(ob))) {
+		if (activeOnly && (pchan = BKE_pose_channel_active(ob_eval))) {
 			add_v3_v3(normal, pchan->pose_mat[2]);
 			add_v3_v3(plane, pchan->pose_mat[1]);
 			ok = true;
@@ -1030,7 +1034,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
 			totsel = count_bone_select(arm, &arm->bonebase, true);
 			if (totsel) {
 				/* use channels to get stats */
-				for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
+				for (pchan = ob_eval->pose->chanbase.first; pchan; pchan = pchan->next) {
 					if (pchan->bone && pchan->bone->flag & BONE_TRANSFORM) {
 						add_v3_v3(normal, pchan->pose_mat[2]);
 						add_v3_v3(plane, pchan->pose_mat[1]);
@@ -1043,7 +1047,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
 		/* use for both active & all */
 		if (ok) {
 			/* we need the transpose of the inverse for a normal... */
-			copy_m3_m4(imat, ob->obmat);
+			copy_m3_m4(imat, ob_eval->obmat);
 
 			invert_m3_m3(mat, imat);
 			transpose_m3(mat);



More information about the Bf-blender-cvs mailing list