Page MenuHome

Outliner Sync Selection: Use general update method
Open, NormalPublic

Description

Currently there is a callback to flag the wmWindowManager as needing selection to sync to the outliner ED_outliner_select_sync_from_object_tag.

Using this requires us to explicitly tag on any selection change. See: D5572: Outliner synced selection refinements.

We currently have 2x function calls used when objects have been selected.

DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);

This task is to solve selection tagging in a more general way.

Possible solutions could be:

  • Use the depsgraph tag or notifier to tag the outliner for selection syncing.
  • Add a function that calls DEG_id_tag_update, WM_event_add_notifier & ED_outliner_select_sync_from_object_tag so we don't need to duplicate the same lines of code in many places.

Note, object selection is used for the purpose of discussion. Selection of other types may use a similar method.

Details

Type
Design

Event Timeline

I think that using the depsgraph or notifiers would be the better route. A quick look through the code where ED_outliner_select_sync_from_ calls are made shows that the notifiers are more common than depsgraph tags (especially with bone selection).

Talked with @Sergey Sharybin (sergey) and this doesn't fit with the depsgraph either (since this is screen data and not something the depsgraph should be concerned with).

Neither of the existing systems are well suited to this, we agreed it would be best to add a function that wraps all 3 function in a single call, eg: ED_object_select_update

Would we also want general functions for bone and sequence selection to tag for syncing, depsgraph, and notifiers?

Yes, a function for each type seems reasonable.