Anim: add notifier ND_BONE_COLLECTION for bone collection changes

Send nodifier `NC_OBJECT | ND_BONE_COLLECTION` on bone collection changes.
This commit is contained in:
Sybren A. Stüvel
2023-09-08 15:15:34 +02:00
parent 7c9a02f138
commit 9d65214d5b
7 changed files with 11 additions and 10 deletions

View File

@@ -272,7 +272,7 @@ static void bone_collection_assign_editbones(bContext *C,
}
ED_armature_edit_sync_selection(arm->edbo);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_COLLECTION, ob);
DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
}
@@ -489,12 +489,7 @@ static void bone_collection_select(bContext *C,
}
DEG_id_tag_update(&armature->id, ID_RECALC_SELECT);
if (is_editmode) {
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_SELECT, ob);
}
else {
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
}
WM_event_add_notifier(C, NC_OBJECT | ND_BONE_COLLECTION, ob);
if (is_editmode) {
ED_outliner_select_sync_from_edit_bone_tag(C);

View File

@@ -428,6 +428,7 @@ static void action_main_region_listener(const wmRegionListenerParams *params)
break;
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_BONE_COLLECTION:
case ND_KEYS:
ED_region_tag_redraw(region);
break;

View File

@@ -694,6 +694,7 @@ static void buttons_area_listener(const wmSpaceTypeListenerParams *params)
case ND_POSE:
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_BONE_COLLECTION:
buttons_area_redraw(area, BCONTEXT_BONE);
buttons_area_redraw(area, BCONTEXT_BONE_CONSTRAINT);
buttons_area_redraw(area, BCONTEXT_DATA);

View File

@@ -156,6 +156,7 @@ static void outliner_main_region_listener(const wmRegionListenerParams *params)
break;
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_BONE_COLLECTION:
case ND_DRAW:
case ND_PARENT:
case ND_OB_SHADING:

View File

@@ -1227,6 +1227,7 @@ static void view3d_main_region_listener(const wmRegionListenerParams *params)
switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_BONE_COLLECTION:
case ND_TRANSFORM:
case ND_POSE:
case ND_DRAW:
@@ -1847,6 +1848,7 @@ static void view3d_buttons_region_listener(const wmRegionListenerParams *params)
switch (wmn->data) {
case ND_BONE_ACTIVE:
case ND_BONE_SELECT:
case ND_BONE_COLLECTION:
case ND_TRANSFORM:
case ND_POSE:
case ND_DRAW:

View File

@@ -196,7 +196,7 @@ static void rna_BoneCollections_active_index_set(PointerRNA *ptr, const int bone
bArmature *arm = (bArmature *)ptr->data;
ANIM_armature_bonecoll_active_index_set(arm, bone_collection_index);
// TODO: send notifiers?
WM_main_add_notifier(NC_OBJECT | ND_BONE_COLLECTION, ptr->data);
}
static void rna_BoneCollections_active_index_range(
@@ -219,7 +219,7 @@ static void rna_BoneCollections_move(bArmature *arm, ReportList *reports, int fr
BKE_reportf(reports, RPT_ERROR, "Cannot move collection from index '%d' to '%d'", from, to);
}
// TODO: notifiers.
WM_main_add_notifier(NC_OBJECT | ND_BONE_COLLECTION, &arm->id);
}
static void rna_BoneCollection_name_set(PointerRNA *ptr, const char *name)
@@ -228,7 +228,7 @@ static void rna_BoneCollection_name_set(PointerRNA *ptr, const char *name)
BoneCollection *bcoll = (BoneCollection *)ptr->data;
ANIM_armature_bonecoll_name_set(arm, bcoll, name);
// TODO: notifiers.
WM_main_add_notifier(NC_OBJECT | ND_BONE_COLLECTION, &arm->id);
}
static char *rna_BoneCollection_path(const PointerRNA *ptr)

View File

@@ -429,6 +429,7 @@ struct wmNotifier {
#define ND_SHADERFX (32 << 16)
/* For updating motion paths in 3dview. */
#define ND_DRAW_ANIMVIZ (33 << 16)
#define ND_BONE_COLLECTION (34 << 16)
/* NC_MATERIAL Material */
#define ND_SHADING (30 << 16)