diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-27 10:21:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-27 10:45:42 +0300 |
commit | 09139e41ed4eaf4d9b8943e92b8604d979dbbc92 (patch) | |
tree | ef89492e8a74c8f0867df47b2dc4b3b3f8d79be6 /source/creator/creator.c | |
parent | eebe274312864fdab98ba189494a88ce4dc31632 (diff) |
Cleanup: simplify order of initialization with argument parsing
Sub-systems that use directories from BKE_appdir needed to be
initialized after parsing '--env-system-datafiles'.
This meant the animation player needed to call IMB_init it's self.
Avoid this complication by having a pass that can be used to setup
the environment before Blender's resources are accessed.
This reverts the workaround from 9ea345d1cf82f
Diffstat (limited to 'source/creator/creator.c')
-rw-r--r-- | source/creator/creator.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c index 65610ea9b70..f9aea0af301 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -403,25 +403,30 @@ int main(int argc, * (such as '--version' & '--help') don't report leaks. */ MEM_use_memleak_detection(false); - BLI_argsParse(ba, 1, NULL, NULL); - - main_signal_setup(); + /* Parse environment handling arguments. */ + BLI_argsParse(ba, 0, NULL, NULL); #else /* Using preferences or user startup makes no sense for #WITH_PYTHON_MODULE. */ G.factory_startup = true; #endif - /* After parsing the first level of arguments as `--env-*` impact BKE_appdir behavior. */ + /* After parsing '0' level args such as `--env-*`, since they impact `BKE_appdir` behavior. */ BKE_appdir_init(); + /* Initialize sub-systems that use `BKE_appdir.h`. */ + IMB_init(); + +#ifndef WITH_PYTHON_MODULE + /* First test for background-mode (#Global.background) */ + BLI_argsParse(ba, 1, NULL, NULL); + + main_signal_setup(); +#endif + /* After parsing number of threads argument. */ BLI_task_scheduler_init(); - /* After parsing `--env-system-datafiles` which control where paths are searched - * (color-management) uses BKE_appdir to initialize. */ - IMB_init(); - #ifdef WITH_FFMPEG IMB_ffmpeg_init(); #endif |