Fix Outliner allowing to enter Pose Mode on linked armature

If a different object was active, clicking on a linked armature's pose
in the Outliner would enter Pose Mode for it.
This would actually cause a failed assert, but in release builds the
armature would just enter pose mode.

Steps to reproduce were:
* Link in armature object
* Activate a different object
* In the Outliner, un-collapse the armature object
* Activate Pose Mode by clicking on its pose there
This commit is contained in:
Julian Eisel 2020-08-27 16:40:56 +02:00
parent 8a984ddd0f
commit 9b0ef34534
Notes: blender-bot 2023-02-14 05:12:59 +01:00
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 7 additions and 1 deletions

View File

@ -46,6 +46,7 @@
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_sequencer.h"
#include "BKE_workspace.h"
@ -193,12 +194,17 @@ static void do_outliner_item_posemode_toggle(
}
else {
bool ok = false;
if (ob->mode & OB_MODE_POSE) {
if (ID_IS_LINKED(ob)) {
BKE_report(CTX_wm_reports(C), RPT_WARNING, "Cannot pose libdata");
}
else if (ob->mode & OB_MODE_POSE) {
ok = ED_object_posemode_exit_ex(bmain, ob);
}
else {
ok = ED_object_posemode_enter_ex(bmain, ob);
}
if (ok) {
ED_object_base_select(base, (ob->mode & OB_MODE_POSE) ? BA_SELECT : BA_DESELECT);