diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-11-01 19:11:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-11-01 20:32:50 +0300 |
commit | 0dd9e55d211453a6571fb5d3838c7d736434c8ee (patch) | |
tree | 11a03a054fd6fa0bb96e67dfd88c1d1d1c2cf113 /source/blender/editors/space_outliner/outliner_utils.c | |
parent | 5840c17970a0ff746663069b46663e3f55dcc162 (diff) |
Fix T71247: Outliner pose toggle looses bone selection
The outliner didn't account for weight-paint + pose-mode,
making it consider all pose bones unselected.
When syncing selection, bones were unselected.
This adds a context argument to passed to drawing functions since
finding the weight-paint pose-object in the drawing loop isn't efficient.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_utils.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_utils.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c index 31d930ce2e6..c3984ab16fa 100644 --- a/source/blender/editors/space_outliner/outliner_utils.c +++ b/source/blender/editors/space_outliner/outliner_utils.c @@ -21,6 +21,8 @@ * \ingroup spoutliner */ +#include <string.h> + #include "BLI_utildefines.h" #include "DNA_action_types.h" @@ -30,6 +32,7 @@ #include "BKE_context.h" #include "BKE_outliner_treehash.h" #include "BKE_layer.h" +#include "BKE_object.h" #include "ED_armature.h" #include "ED_outliner.h" @@ -39,6 +42,33 @@ #include "outliner_intern.h" +/* -------------------------------------------------------------------- */ +/** \name Tree View Context + * \{ */ + +void outliner_viewcontext_init(const bContext *C, TreeViewContext *tvc) +{ + memset(tvc, 0, sizeof(*tvc)); + + /* Scene level. */ + tvc->scene = CTX_data_scene(C); + tvc->view_layer = CTX_data_view_layer(C); + + /* Objects. */ + tvc->obact = OBACT(tvc->view_layer); + if (tvc->obact != NULL) { + tvc->ob_edit = OBEDIT_FROM_OBACT(tvc->obact); + + if ((tvc->obact->type == OB_ARMATURE) || + /* This could be made into it's own function. */ + ((tvc->obact->type == OB_MESH) && tvc->obact->mode & OB_MODE_WEIGHT_PAINT)) { + tvc->ob_pose = BKE_object_pose_armature_get(tvc->obact); + } + } +} + +/** \} */ + /** * Try to find an item under y-coordinate \a view_co_y (view-space). * \note Recursive |