Cleanup: comments in main()

Clarify references to functions.
This commit is contained in:
Campbell Barton 2020-03-08 13:48:52 +11:00
parent 52dc1ddaa0
commit bc2343d5c3
1 changed files with 22 additions and 20 deletions

View File

@ -217,7 +217,7 @@ char **environ = NULL;
* - setup subsystems.
* - handle arguments.
* - run #WM_main() event loop,
* or exit immediately when running in background mode.
* or exit immediately when running in background-mode.
*/
int main(int argc,
#ifdef WIN32
@ -381,11 +381,11 @@ int main(int argc,
BKE_callback_global_init();
/* first test for background */
/* First test for background-mode (#Global.background) */
#ifndef WITH_PYTHON_MODULE
ba = BLI_argsInit(argc, (const char **)argv); /* skip binary path */
/* ensure we free on early exit */
/* Ensure we free on early exit. */
app_init_data.ba = ba;
main_args_setup(C, ba);
@ -395,7 +395,7 @@ int main(int argc,
main_signal_setup();
#else
/* using preferences or user startup makes no sense for py-as-module */
/* Using preferences or user startup makes no sense for #WITH_PYTHON_MODULE. */
G.factory_startup = true;
#endif
@ -403,7 +403,7 @@ int main(int argc,
IMB_ffmpeg_init();
#endif
/* after level 1 args, this is so playanim skips RNA init */
/* After level 1 arguments, this is so #WM_main_playanim skips #RNA_init. */
RNA_init();
RE_engines_init();
@ -412,14 +412,15 @@ int main(int argc,
/* end second init */
#if defined(WITH_PYTHON_MODULE) || defined(WITH_HEADLESS)
G.background = true; /* python module mode ALWAYS runs in background mode (for now) */
/* Python module mode ALWAYS runs in background-mode (for now). */
G.background = true;
#else
if (G.background) {
main_signal_setup_background();
}
#endif
/* background render uses this font too */
/* Background render uses this font too. */
BKE_vfont_builtin_register(datatoc_bfont_pfb, datatoc_bfont_pfb_size);
/* Initialize ffmpeg if built in, also needed for background-mode if videos are
@ -429,9 +430,8 @@ int main(int argc,
BKE_materials_init();
#ifdef WITH_USD
/* Tell USD which directory to search for its JSON files. If datafiles/usd
* does not exist, the USD library will not be able to read or write any files.
*/
/* Tell USD which directory to search for its JSON files. If 'datafiles/usd'
* does not exist, the USD library will not be able to read or write any files. */
usd_initialise_plugin_path(BKE_appdir_folder_id(BLENDER_DATAFILES, "usd"));
#endif
@ -442,8 +442,9 @@ int main(int argc,
#endif
WM_init(C, argc, (const char **)argv);
/* this is properly initialized with user defs, but this is default */
/* call after loading the startup.blend so we can read U.tempdir */
/* This is properly initialized with user-preferences,
* but this is default.
* Call after loading the #BLENDER_STARTUP_FILE so we can read #U.tempdir */
BKE_tempdir_init(U.tempdir);
}
else {
@ -453,15 +454,15 @@ int main(int argc,
WM_init(C, argc, (const char **)argv);
/* don't use user preferences temp dir */
/* Don't use user preferences #U.tempdir */
BKE_tempdir_init(NULL);
}
#ifdef WITH_PYTHON
/**
* NOTE: the U.pythondir string is NULL until WM_init() is executed,
* \note the #U.pythondir string is NULL until #WM_init() is executed,
* so we provide the BPY_ function below to append the user defined
* python-dir to Python's sys.path at this point. Simply putting
* WM_init() before #BPY_python_start() crashes Blender at startup.
* python-dir to Python's `sys.path` at this point. Simply putting
* #WM_init() before #BPY_python_start() crashes Blender at startup.
*/
/* TODO - U.pythondir */
@ -475,7 +476,7 @@ int main(int argc,
WM_keyconfig_init(C);
#ifdef WITH_FREESTYLE
/* initialize Freestyle */
/* Initialize Freestyle. */
FRS_initialize();
FRS_set_context(C);
#endif
@ -492,7 +493,7 @@ int main(int argc,
callback_main_atexit(&app_init_data);
BKE_blender_atexit_unregister(callback_main_atexit, &app_init_data);
/* paranoid, avoid accidental re-use */
/* Paranoid, avoid accidental re-use. */
#ifndef WITH_PYTHON_MODULE
ba = NULL;
(void)ba;
@ -504,11 +505,12 @@ int main(int argc,
#endif
#ifdef WITH_PYTHON_MODULE
return 0; /* keep blender in background mode running */
/* Keep blender in background-mode running. */
return 0;
#endif
if (G.background) {
/* Using window-manager API in background mode is a bit odd, but works fine. */
/* Using window-manager API in background-mode is a bit odd, but works fine. */
WM_exit(C);
}
else {