Page MenuHome

Fix T84475: Outliner missing update when adding IDs to main via RNA
ClosedPublic

Authored by Philipp Oeser (lichtwerk) on Jan 7 2021, 2:09 PM.

Details

Summary

Was reported for meshes, but was true for any type.
Now add appropriate notifier torefresh the Outliner.

Diff Detail

Repository
rB Blender

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Jan 7 2021, 2:09 PM

It would be more consistent imho to add an NC_ID | NA_ADDED notifier, and add proper handling of this one in outliner?

Philipp Oeser (lichtwerk) planned changes to this revision.Jan 7 2021, 5:36 PM

It would be more consistent imho to add an NC_ID | NA_ADDED notifier, and add proper handling of this one in outliner?

Sounds good, will do

Philipp Oeser (lichtwerk) retitled this revision from Fix T84475: Outliner missing update when adding IDs to main via RNA to [WIP] Fix T84475: Outliner missing update when adding IDs to main via RNA.Jan 7 2021, 5:37 PM

use more specific 'NC_ID | NA_ADDED'

Philipp Oeser (lichtwerk) retitled this revision from [WIP] Fix T84475: Outliner missing update when adding IDs to main via RNA to Fix T84475: Outliner missing update when adding IDs to main via RNA.Jan 7 2021, 6:54 PM

It would be more consistent imho to add an NC_ID | NA_ADDED notifier, and add proper handling of this one in outliner?

I would expect that the same notification would also happen when removing items. Maybe I'm mistaken and this is handled somewhere else?

Thanks for looking into this so quickly. :)
I added a comment that would hopefully make the code a bit easier to maintain.

source/blender/makesrna/intern/rna_main_api.c
816

Since there is a lot of copy paste of this line of code, I think it would make sense to put this line in a function.
That would make this line more maintainable for the future.. For example if someone wants to modify the notification, and forgets to modify all similar lines, then that would become a bug in the codebase.

Personally i think a static function at the top of the file would do the trick nicely.

LGTM, besides note below.

source/blender/makesrna/intern/rna_main_api.c
551

Notifier should not be added before ID is actually created imho... It's not technically an issue here, but as a general logical principal it's not a good idea to notify of something that did not yet happen ;)

This revision is now accepted and ready to land.Jan 8 2021, 10:24 AM