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.
This commit is contained in:
Joshua Leung 2018-05-24 19:12:41 +02:00
parent 5db7f2c1ee
commit 0983d97ab9
Notes: blender-bot 2023-02-14 05:50:07 +01:00
Referenced by issue #55186, Circle select doesn't work at all in pose mode
2 changed files with 11 additions and 4 deletions

View File

@ -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 {

View File

@ -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);
}
}