diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-02-10 18:27:01 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-02-10 18:32:46 +0300 |
commit | bdb83cc32cbd0997752420ef95c791f66dca54c8 (patch) | |
tree | faf31e7434a245d75e0435f98fe5079d1ff97cf0 /source/blender/editors/transform/transform_generics.c | |
parent | d9eeb7840f52d9fdbb6c4a5d3f1f2b2944fbcc6e (diff) |
Fix T85471: Wrong orientation in transforming objects in weight paint mode
The local orientation chosen was that of the active object, but as
confirmed in other parts of the code, the orientation of the selected
Bone has priority.
Diffstat (limited to 'source/blender/editors/transform/transform_generics.c')
-rw-r--r-- | source/blender/editors/transform/transform_generics.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 16fb9cc6eab..92719933afb 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -44,6 +44,7 @@ #include "BKE_context.h" #include "BKE_layer.h" #include "BKE_mask.h" +#include "BKE_modifier.h" #include "BKE_paint.h" #include "ED_clip.h" @@ -1454,3 +1455,23 @@ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot) copy_v3_v3(td->ext->rot, eul); } } + +Object *transform_object_deform_pose_armature_get(TransInfo *t, Object *ob) +{ + if (!(ob->mode & OB_MODE_ALL_WEIGHT_PAINT)) { + return NULL; + } + /* Important that ob_armature can be set even when its not selected T23412. + * Lines below just check is also visible. */ + Object *ob_armature = BKE_modifiers_is_deformed_by_armature(ob); + if (ob_armature && ob_armature->mode & OB_MODE_POSE) { + Base *base_arm = BKE_view_layer_base_find(t->view_layer, ob_armature); + if (base_arm) { + View3D *v3d = t->view; + if (BASE_VISIBLE(v3d, base_arm)) { + return ob_armature; + } + } + } + return NULL; +} |