Page MenuHome

Fix T89046: Startup file with Python drivers crashes on load
ClosedPublic

Authored by Campbell Barton (campbellbarton) on Aug 10 2021, 1:41 PM.

Details

Summary

Resolve order of initialization error reading startup file,
support postponing running wm_file_read_post until Blender
has been initialized.

Deferring updates allows duplicate initialization to be removed from WM_init.


Even though moving Python initialization before reading the file would probably fix T89046,
there are other potential problems that could be caused by attempting to initialize the blend file
before blenders subsystems have been properly initialized.

For example: Evaluating the depsgraph and drivers before open-subdiv have been initialized.


Alternative solutions:

NOTE: from investiging some alternatives, I don't think either are better than the patch proposed.

Split Preference/Startup Loading P2317

In principle this is a cleaner design, however it doesn't work well because preferences loads the keymap and the keymap is stored in the window-manager which wont be created if the file data has not been loaded.

This could be made to work if the keymap was moved out of the window-manager, but that's a much bigger refactor.

Read Preference/Startup "Last" P2318

This is quite close to working, but has some drawbacks.

  • Making sure none of the initialization functions don't use U anywhere is error prone.
  • We may still end up with order of initialization problems where a sub system requires user preferences in order to initialize properly.
  • Delaying loading file data means there is no window-manager when Python initializes. This causes an exceptions as Python tools need to register their keymap. We could defer registering keymaps, or create a dummy window manager so a keymap can be setup, from looking into this neither are all that straightforward.

Diff Detail

Repository
rB Blender
Branch
T (branched from master)
Build Status
Buildable 16333
Build 16333: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested review of this revision.Aug 10 2021, 1:41 PM
Campbell Barton (campbellbarton) created this revision.
  • Remove calls made redundant by this script.
Julian Eisel (Severin) resigned from this revision.Aug 10 2021, 5:45 PM

This sounds very reasonable to me. But I'm not familiar enough with the initialization process to understand possible implications. Although I guess these are hard to estimate anyway.
So I'm fine with this, but I also better resign as reviewer and let it up to you I think.

A bit hard to be sure this won't break anything yes, but I do not see any reason why it would so far, and change makes sense to me, so think it's OK to put in master. We have enough time then to get basic reallife testing and address issues before 3.0 if any. ;)

This revision is now accepted and ready to land.Aug 11 2021, 10:12 AM

Various cleanups, updated comments, replace static variable with return argument (basic functionality remains unchanged).

Attempt to resolve issue updating.

Attempt to resolve issue updating.

  • Remove minor unintended edit.