[Bf-blender-cvs] [0983d97ab92] blender2.8: Fix T55186: Circle and Lasso select were not working on Pose Bones

Joshua Leung noreply at git.blender.org
Thu May 24 19:15:29 CEST 2018


Commit: 0983d97ab92cb77c75e9ed700379efaa209b52b7
Author: Joshua Leung
Date:   Thu May 24 19:12:41 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0983d97ab92cb77c75e9ed700379efaa209b52b7

Fix T55186: Circle and Lasso select were not working on Pose Bones

These needed to be using the COW evaluated data, instead of the raw bone
positions.

All other datatypes still need converting to work with this though.

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

M	source/blender/editors/space_view3d/view3d_iterators.c
M	source/blender/editors/space_view3d/view3d_select.c

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

diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c
index 35127c7c8c6..145f57174fd 100644
--- a/source/blender/editors/space_view3d/view3d_iterators.c
+++ b/source/blender/editors/space_view3d/view3d_iterators.c
@@ -35,6 +35,7 @@
 #include "BLI_utildefines.h"
 #include "BLI_rect.h"
 
+#include "BKE_action.h"
 #include "BKE_armature.h"
 #include "BKE_curve.h"
 #include "BKE_DerivedMesh.h"
@@ -43,6 +44,7 @@
 #include "BKE_context.h"
 
 #include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
 
 #include "bmesh.h"
 
@@ -449,19 +451,21 @@ void pose_foreachScreenBone(
         void (*func)(void *userData, struct bPoseChannel *pchan, const float screen_co_a[2], const float screen_co_b[2]),
         void *userData, const eV3DProjTest clip_flag)
 {
-	bArmature *arm = vc->obact->data;
+	const Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph, vc->obact);
+	const bArmature *arm_eval = ob_eval->data;
 	bPose *pose = vc->obact->pose;
 	bPoseChannel *pchan;
 
 	ED_view3d_check_mats_rv3d(vc->rv3d);
 
 	for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
-		if (PBONE_VISIBLE(arm, pchan->bone)) {
+		if (PBONE_VISIBLE(arm_eval, pchan->bone)) {
+			bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan->name);
 			float screen_co_a[2], screen_co_b[2];
 			int points_proj_tot = 0;
 
 			/* project head location to screenspace */
-			if (ED_view3d_project_float_object(vc->ar, pchan->pose_head, screen_co_a, clip_flag) == V3D_PROJ_RET_OK) {
+			if (ED_view3d_project_float_object(vc->ar, pchan_eval->pose_head, screen_co_a, clip_flag) == V3D_PROJ_RET_OK) {
 				points_proj_tot++;
 			}
 			else {
@@ -470,7 +474,7 @@ void pose_foreachScreenBone(
 			}
 
 			/* project tail location to screenspace */
-			if (ED_view3d_project_float_object(vc->ar, pchan->pose_tail, screen_co_b, clip_flag) == V3D_PROJ_RET_OK) {
+			if (ED_view3d_project_float_object(vc->ar, pchan_eval->pose_tail, screen_co_b, clip_flag) == V3D_PROJ_RET_OK) {
 				points_proj_tot++;
 			}
 			else {
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 5bbb92c43cd..be5653a3021 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -2751,6 +2751,9 @@ static void pose_circle_select(ViewContext *vc, const bool select, const int mva
 			/* mask modifier ('armature' mode), etc. */
 			DEG_id_tag_update(&vc->obact->id, OB_RECALC_DATA);
 		}
+		
+		/* copy on write tag is needed (for the armature), or else no refresh happens */
+		DEG_id_tag_update(&arm->id, DEG_TAG_COPY_ON_WRITE);
 	}
 }



More information about the Bf-blender-cvs mailing list