diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-02-13 10:44:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-02-13 10:45:35 +0300 |
commit | d8992192e5512380f57433df113f3e3f8b22f7cb (patch) | |
tree | 0e35aca3d4dd40061dbb971457f3ab0357131830 /source/blender/editors/space_outliner/outliner_select.c | |
parent | 2c6d079a903ff16e2ae7e50082ef08c081cd29bf (diff) |
Object Mode: pass edit-object to outliner drawing
Also add 'OBEDIT_FROM_EVAL_CTX' macro.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_select.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_select.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index df5f43978e6..16f3aeaf110 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -193,10 +193,10 @@ static eOLDrawState tree_element_set_active_object( WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } } - - if (ob != scene->obedit) + + if (CTX_data_edit_object(C)) { ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); - + } return OL_DRAWSEL_NORMAL; } @@ -547,7 +547,7 @@ static eOLDrawState tree_element_active_bone( /* ebones only draw in editmode armature */ -static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature *arm, EditBone *ebone, short sel) +static void tree_element_active_ebone__sel(bContext *C, Object *obedit, bArmature *arm, EditBone *ebone, short sel) { if (sel) { ebone->flag |= BONE_SELECTED | BONE_ROOTSEL | BONE_TIPSEL; @@ -561,34 +561,34 @@ static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature if (ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL; } - WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, scene->obedit); + WM_event_add_notifier(C, NC_OBJECT | ND_BONE_ACTIVE, obedit); } static eOLDrawState tree_element_active_ebone( - bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set, bool recursive) + bContext *C, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set, bool recursive) { - BLI_assert(scene->obedit != NULL); - - bArmature *arm = scene->obedit->data; + Object *obedit = CTX_data_edit_object(C); + BLI_assert(obedit != NULL); + bArmature *arm = obedit->data; EditBone *ebone = te->directdata; eOLDrawState status = OL_DRAWSEL_NONE; if (set != OL_SETSEL_NONE) { if (set == OL_SETSEL_NORMAL) { if (!(ebone->flag & BONE_HIDDEN_A)) { - ED_armature_deselect_all(scene->obedit); - tree_element_active_ebone__sel(C, scene, arm, ebone, true); + ED_armature_deselect_all(obedit); + tree_element_active_ebone__sel(C, obedit, arm, ebone, true); status = OL_DRAWSEL_NORMAL; } } else if (set == OL_SETSEL_EXTEND) { if (!(ebone->flag & BONE_HIDDEN_A)) { if (!(ebone->flag & BONE_SELECTED)) { - tree_element_active_ebone__sel(C, scene, arm, ebone, true); + tree_element_active_ebone__sel(C, obedit, arm, ebone, true); status = OL_DRAWSEL_NORMAL; } else { /* entirely selected, so de-select */ - tree_element_active_ebone__sel(C, scene, arm, ebone, false); + tree_element_active_ebone__sel(C, obedit, arm, ebone, false); status = OL_DRAWSEL_NONE; } } @@ -656,7 +656,7 @@ static eOLDrawState tree_element_active_text( } static eOLDrawState tree_element_active_pose( - bContext *C, Scene *scene, ViewLayer *view_layer, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set) + bContext *C, ViewLayer *view_layer, TreeElement *UNUSED(te), TreeStoreElem *tselem, const eOLSetState set) { const WorkSpace *workspace = CTX_wm_workspace(C); Object *ob = (Object *)tselem->id; @@ -668,7 +668,7 @@ static eOLDrawState tree_element_active_pose( } if (set != OL_SETSEL_NONE) { - if (scene->obedit) { + if (workspace->object_mode & OB_MODE_EDIT) { ED_object_editmode_exit(C, EM_FREEDATA | EM_FREEUNDO | EM_WAITCURSOR | EM_DO_UNDO); } if (workspace->object_mode & OB_MODE_POSE) { @@ -850,7 +850,7 @@ eOLDrawState tree_element_type_active( case TSE_BONE: return tree_element_active_bone(C, view_layer, te, tselem, set, recursive); case TSE_EBONE: - return tree_element_active_ebone(C, scene, te, tselem, set, recursive); + return tree_element_active_ebone(C, te, tselem, set, recursive); case TSE_MODIFIER: return tree_element_active_modifier(C, scene, view_layer, te, tselem, set); case TSE_LINKED_OB: @@ -864,7 +864,7 @@ eOLDrawState tree_element_type_active( case TSE_LINKED_PSYS: return tree_element_active_psys(C, scene, te, tselem, set); case TSE_POSE_BASE: - return tree_element_active_pose(C, scene, view_layer, te, tselem, set); + return tree_element_active_pose(C, view_layer, te, tselem, set); case TSE_POSE_CHANNEL: return tree_element_active_posechannel(C, scene, view_layer, te, tselem, set, recursive); case TSE_CONSTRAINT: |