Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-11-13 11:43:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-12-04 12:42:34 +0300
commit7a8ac1b09b1cf321f259b8eb9b832424d2c7bf5b (patch)
tree5f9a861e234799149fc99f25e5df7bd96fb46cae /source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
parent5b6cfa705cb180d042f6f27e45331c12972be7ae (diff)
WM: message bus replacement for property notifiers
Use dynamically generated message publish/subscribe so buttons and manipulators update properly. This resolves common glitches where manipulators weren't updating as well as the UI when add-ons exposed properties which hard coded listeners weren't checking for. Python can also publish/scribe changes via `bpy.msgbus`. See D2917
Diffstat (limited to 'source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c')
-rw-r--r--source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
index a174d7720e3..5d9810272cc 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_map.c
@@ -305,6 +305,7 @@ static bool manipulator_prepare_drawing(
/* skip */
}
else {
+ /* Ensure we get RNA updates */
if (do_draw & WM_MANIPULATOR_IS_VISIBLE_UPDATE) {
/* hover manipulators need updating, even if we don't draw them */
wm_manipulator_update(mpr, C, (mmap->update_flag[drawstep] & MANIPULATORMAP_IS_PREPARE_DRAW) != 0);
@@ -953,6 +954,25 @@ ListBase *wm_manipulatormap_groups_get(wmManipulatorMap *mmap)
return &mmap->groups;
}
+void WM_manipulatormap_message_subscribe(
+ bContext *C, wmManipulatorMap *mmap, ARegion *ar, struct wmMsgBus *mbus)
+{
+ for (wmManipulatorGroup *mgroup = mmap->groups.first; mgroup; mgroup = mgroup->next) {
+ if (!wm_manipulatorgroup_is_visible(mgroup, C)) {
+ continue;
+ }
+ for (wmManipulator *mpr = mgroup->manipulators.first; mpr; mpr = mpr->next) {
+ if (mpr->flag & WM_MANIPULATOR_HIDDEN) {
+ continue;
+ }
+ WM_manipulator_target_property_subscribe_all(mpr, mbus, ar);
+ }
+ if (mgroup->type->message_subscribe != NULL) {
+ mgroup->type->message_subscribe(C, mgroup, mbus);
+ }
+ }
+}
+
/** \} */ /* wmManipulatorMap */