diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-02-02 00:38:26 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-02-02 00:38:26 +0300 |
commit | ff5e8e6d535374891e09bc0e6ceb7059a22bdd53 (patch) | |
tree | d2a87fa9940d365e3b3ba4114a44713cbb1a65a6 /source/blender/editors/transform/transform_gizmo_3d.c | |
parent | 7aec5b062275e9cd26a75469c2dec6f43d2beea8 (diff) |
Cleanup: restructure 'transform_convert_pose_transflags_update'
Move the bones count and `has_translate_rotate` parameter out of the
function as they are not required in some places.
Diffstat (limited to 'source/blender/editors/transform/transform_gizmo_3d.c')
-rw-r--r-- | source/blender/editors/transform/transform_gizmo_3d.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 9bd55d78039..c1f36951f64 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -953,32 +953,27 @@ int ED_transform_calc_gizmo_stats(const bContext *C, for (uint ob_index = 0; ob_index < objects_len; ob_index++) { Object *ob_iter = objects[ob_index]; - const bool use_mat_local = (ob_iter != ob); + const bool use_mat_local = params->use_local_axis && (ob_iter != ob); bPoseChannel *pchan; /* mislead counting bones... bah. We don't know the gizmo mode, could be mixed */ const int mode = TFM_ROTATION; - const int totsel_iter = transform_convert_pose_transflags_update( - ob_iter, mode, V3D_AROUND_CENTER_BOUNDS, NULL); + transform_convert_pose_transflags_update(ob_iter, mode, V3D_AROUND_CENTER_BOUNDS); - if (totsel_iter) { - float mat_local[4][4]; - if (params->use_local_axis) { - if (use_mat_local) { - mul_m4_m4m4(mat_local, ob->imat, ob_iter->obmat); - } - } + float mat_local[4][4]; + if (use_mat_local) { + mul_m4_m4m4(mat_local, ob->imat, ob_iter->obmat); + } - /* use channels to get stats */ - for (pchan = ob_iter->pose->chanbase.first; pchan; pchan = pchan->next) { - Bone *bone = pchan->bone; - if (bone && (bone->flag & BONE_TRANSFORM)) { - calc_tw_center_with_matrix(tbounds, pchan->pose_head, use_mat_local, mat_local); - protectflag_to_drawflags_pchan(rv3d, pchan, orient_index); - } + /* Use channels to get stats. */ + LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) { + if (!(pchan->bone->flag & BONE_TRANSFORM)) { + continue; } - totsel += totsel_iter; + calc_tw_center_with_matrix(tbounds, pchan->pose_head, use_mat_local, mat_local); + protectflag_to_drawflags_pchan(rv3d, pchan, orient_index); + totsel++; } } MEM_freeN(objects); |