From cb93603fb33877fe17c9e3f8e77823a20a19334f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 26 Apr 2024 13:55:40 +1000 Subject: [PATCH] Cleanup: remove script-id for Python command line error message While additional context is typically useful to include, this is such a corner-case that it's not expected script authors would run into this during regular development. --- source/creator/creator_args.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/creator/creator_args.cc b/source/creator/creator_args.cc index 1c658034c31..1d7bbe8a26d 100644 --- a/source/creator/creator_args.cc +++ b/source/creator/creator_args.cc @@ -520,7 +520,7 @@ struct BlendePyContextStore { bool has_win; }; -static void arg_py_context_backup(bContext *C, BlendePyContextStore *c_py, const char *script_id) +static void arg_py_context_backup(bContext *C, BlendePyContextStore *c_py) { c_py->wm = CTX_wm_manager(C); c_py->scene = CTX_data_scene(C); @@ -530,11 +530,11 @@ static void arg_py_context_backup(bContext *C, BlendePyContextStore *c_py, const CTX_wm_window_set(C, static_cast(c_py->wm->windows.first)); } else { + /* NOTE: this should never happen, although it may be possible when loading + * `.blend` files without windowing data. Whatever the case, it shouldn't crash, + * although typical scripts that accesses the context is not expected to work usefully. */ c_py->win = nullptr; - fprintf(stderr, - "Python script \"%s\" " - "running with missing context data.\n", - script_id); + fprintf(stderr, "Python script running with missing context data.\n"); } } @@ -558,7 +558,7 @@ static void arg_py_context_restore(bContext *C, BlendePyContextStore *c_py) # define BPY_CTX_SETUP(_cmd) \ { \ BlendePyContextStore py_c; \ - arg_py_context_backup(C, &py_c, argv[1]); \ + arg_py_context_backup(C, &py_c); \ { \ _cmd; \ } \ @@ -2277,7 +2277,7 @@ static int arg_handle_python_expr_run(int argc, const char **argv, void *data) static const char arg_handle_python_console_run_doc[] = "\n\t" "Run Blender with an interactive console."; -static int arg_handle_python_console_run(int /*argc*/, const char **argv, void *data) +static int arg_handle_python_console_run(int /*argc*/, const char ** /*argv*/, void *data) { # ifdef WITH_PYTHON bContext *C = static_cast(data);