Merge branch 'blender-v3.6-release'

This commit is contained in:
Campbell Barton 2023-05-31 12:42:01 +10:00
commit aa679b3e35
2 changed files with 11 additions and 7 deletions

View File

@ -2039,8 +2039,7 @@ static int arg_handle_python_file_run(int argc, const char **argv, void *data)
BPY_CTX_SETUP(ok = BPY_run_filepath(C, filepath, NULL));
if (!ok && app_state.exit_code_on_error.python) {
fprintf(stderr, "\nError: script failed, file: '%s', exiting.\n", argv[1]);
BPY_python_end();
exit(app_state.exit_code_on_error.python);
WM_exit(C, app_state.exit_code_on_error.python);
}
return 1;
}
@ -2079,8 +2078,7 @@ static int arg_handle_python_text_run(int argc, const char **argv, void *data)
if (!ok && app_state.exit_code_on_error.python) {
fprintf(stderr, "\nError: script failed, text: '%s', exiting.\n", argv[1]);
BPY_python_end();
exit(app_state.exit_code_on_error.python);
WM_exit(C, app_state.exit_code_on_error.python);
}
return 1;
@ -2109,8 +2107,7 @@ static int arg_handle_python_expr_run(int argc, const char **argv, void *data)
BPY_CTX_SETUP(ok = BPY_run_string_exec(C, NULL, argv[1]));
if (!ok && app_state.exit_code_on_error.python) {
fprintf(stderr, "\nError: script failed, expr: '%s', exiting.\n", argv[1]);
BPY_python_end();
exit(app_state.exit_code_on_error.python);
WM_exit(C, app_state.exit_code_on_error.python);
}
return 1;
}
@ -2549,6 +2546,8 @@ void main_args_setup(bContext *C, bArgs *ba, bool all)
BLI_args_add_case(ba, "-setaudio", 1, NULL, 0, CB(arg_handle_audio_set), NULL);
/* Pass: Processing Arguments. */
/* NOTE: Use #WM_exit for these callbacks, not `exit()`
* so temporary files are properly cleaned up. */
BLI_args_pass_set(ba, ARG_PASS_FINAL);
BLI_args_add(ba, "-f", "--render-frame", CB(arg_handle_render_frame), C);
BLI_args_add(ba, "-a", "--render-anim", CB(arg_handle_render_animation), C);

View File

@ -67,7 +67,12 @@ enum {
/** Currently use for audio devices. */
ARG_PASS_SETTINGS_FORCE = 4,
/** Actions & fall back to loading blend file. */
/**
* Actions & fall back to loading blend file.
*
* \note arguments in the final pass must use #WM_exit instead of `exit()` environment is
* properly shut-down (temporary directory deleted, etc).
*/
ARG_PASS_FINAL = 5,
};