Outliner: Fix selection sync for various operators

Add missing outliner selection sync tagging for various non-outliner
operators.
* Curve separate
* Grease Pencil separate
* Mesh separate
* Make instances real
* 3D view paste
* Sequencer paste
* Armature delete, dissolve, separate, duplicate, subdivide, extrude,
  click extrude, primitive add
* Pose Group select, delete

Resolves T71404
This commit is contained in:
Nathan Craddock 2020-05-01 20:06:38 -06:00
parent bba11c68c4
commit c06a40006d
Notes: blender-bot 2023-12-22 20:14:11 +01:00
Referenced by issue #71404, 2.81 Outliner: selection not synced when editing armature
11 changed files with 35 additions and 2 deletions

View File

@ -53,6 +53,7 @@
#include "WM_types.h"
#include "ED_armature.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_view3d.h"
@ -222,6 +223,7 @@ static int armature_click_extrude_exec(bContext *C, wmOperator *UNUSED(op))
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
DEG_id_tag_update(&obedit->id, ID_RECALC_SELECT);
ED_outliner_select_sync_from_edit_bone_tag(C);
return OPERATOR_FINISHED;
}
@ -1049,6 +1051,8 @@ static int armature_duplicate_selected_exec(bContext *C, wmOperator *op)
}
MEM_freeN(objects);
ED_outliner_select_sync_from_edit_bone_tag(C);
return OPERATOR_FINISHED;
}
@ -1521,7 +1525,13 @@ static int armature_extrude_exec(bContext *C, wmOperator *op)
}
MEM_freeN(objects);
return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
if (!changed_multi) {
return OPERATOR_CANCELLED;
}
ED_outliner_select_sync_from_edit_bone_tag(C);
return OPERATOR_FINISHED;
}
void ARMATURE_OT_extrude(wmOperatorType *ot)
@ -1592,6 +1602,7 @@ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op)
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
DEG_id_tag_update(&obedit->id, ID_RECALC_SELECT);
ED_outliner_select_sync_from_edit_bone_tag(C);
return OPERATOR_FINISHED;
}
@ -1682,6 +1693,7 @@ static int armature_subdivide_exec(bContext *C, wmOperator *op)
/* note, notifier might evolve */
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
DEG_id_tag_update(&obedit->id, ID_RECALC_SELECT);
ED_outliner_select_sync_from_edit_bone_tag(C);
return OPERATOR_FINISHED;
}

View File

@ -54,6 +54,7 @@
#include "WM_types.h"
#include "ED_armature.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_view3d.h"
@ -1283,6 +1284,7 @@ static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
BKE_pose_tag_recalc(CTX_data_main(C), obedit->pose);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
DEG_id_tag_update(&arm->id, ID_RECALC_SELECT);
ED_outliner_select_sync_from_edit_bone_tag(C);
}
}
MEM_freeN(objects);
@ -1458,6 +1460,7 @@ static int armature_dissolve_selected_exec(bContext *C, wmOperator *UNUSED(op))
ED_armature_edit_refresh_layer_used(arm);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, obedit);
DEG_id_tag_update(&arm->id, ID_RECALC_SELECT);
ED_outliner_select_sync_from_edit_bone_tag(C);
}
}
MEM_freeN(objects);

View File

@ -58,6 +58,7 @@
#include "ED_armature.h"
#include "ED_object.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "UI_interface.h"
@ -707,6 +708,7 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
if (ok) {
BKE_report(op->reports, RPT_INFO, "Separated bones");
ED_outliner_select_sync_from_object_tag(C);
}
return OPERATOR_FINISHED;

View File

@ -44,6 +44,7 @@
#include "WM_types.h"
#include "ED_armature.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "UI_interface.h"
@ -484,6 +485,7 @@ static int pose_group_select_exec(bContext *C, wmOperator *UNUSED(op))
bArmature *arm = ob->data;
DEG_id_tag_update(&arm->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
ED_outliner_select_sync_from_pose_bone_tag(C);
return OPERATOR_FINISHED;
}
@ -518,6 +520,7 @@ static int pose_group_deselect_exec(bContext *C, wmOperator *UNUSED(op))
bArmature *arm = ob->data;
DEG_id_tag_update(&arm->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
ED_outliner_select_sync_from_pose_bone_tag(C);
return OPERATOR_FINISHED;
}

View File

@ -58,6 +58,7 @@
#include "ED_curve.h"
#include "ED_object.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "ED_transform_snap_object_context.h"
@ -1500,6 +1501,8 @@ static int separate_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
ED_outliner_select_sync_from_object_tag(C);
return OPERATOR_FINISHED;
}

View File

@ -77,6 +77,7 @@
#include "ED_gpencil.h"
#include "ED_object.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "ED_space_api.h"
@ -4365,6 +4366,7 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL);
ED_outliner_select_sync_from_object_tag(C);
return OPERATOR_FINISHED;
}

View File

@ -29,12 +29,13 @@ extern "C" {
struct ListBase;
struct bContext;
struct Base;
bool ED_outliner_collections_editor_poll(struct bContext *C);
void ED_outliner_selected_objects_get(const struct bContext *C, struct ListBase *objects);
Base *ED_outliner_give_base_under_cursor(struct bContext *C, const int mval[2]);
struct Base *ED_outliner_give_base_under_cursor(struct bContext *C, const int mval[2]);
void ED_outliner_select_sync_from_object_tag(struct bContext *C);
void ED_outliner_select_sync_from_edit_bone_tag(struct bContext *C);

View File

@ -69,6 +69,7 @@
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_transform.h"
#include "ED_uvedit.h"
@ -4404,6 +4405,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op)
/* delay depsgraph recalc until all objects are duplicated */
DEG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, NULL);
ED_outliner_select_sync_from_object_tag(C);
return OPERATOR_FINISHED;
}

View File

@ -2048,6 +2048,7 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SCENE, scene);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
ED_outliner_select_sync_from_object_tag(C);
return OPERATOR_FINISHED;
}

View File

@ -56,6 +56,7 @@
#include "ED_anim_api.h"
#include "ED_numinput.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_sequencer.h"
#include "ED_space_api.h"
@ -3561,6 +3562,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *UNUSED(op))
DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS);
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
ED_outliner_select_sync_from_sequence_tag(C);
return OPERATOR_FINISHED;
}

View File

@ -47,6 +47,7 @@
#include "WM_api.h"
#include "WM_types.h"
#include "ED_outliner.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "ED_transform.h"
@ -117,6 +118,7 @@ static int view3d_pastebuffer_exec(bContext *C, wmOperator *op)
}
WM_event_add_notifier(C, NC_WINDOW, NULL);
ED_outliner_select_sync_from_object_tag(C);
BKE_reportf(op->reports, RPT_INFO, "%d object(s) pasted", num_pasted);