Changeset View
Changeset View
Standalone View
Standalone View
source/creator/creator_args.c
| Context not available. | |||||
| #include "creator_intern.h" /* own include */ | #include "creator_intern.h" /* own include */ | ||||
| #define ERROR_NO_ARGS(arg_id) \ | |||||
| CLOG_ERROR(&LOG, "'%s' no args given.", arg_id); | |||||
| static CLG_LogRef LOG = { "creator.args" }; | |||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Utility String Parsing | /** \name Utility String Parsing | ||||
| Context not available. | |||||
| } | } | ||||
| else { | else { | ||||
| c_py->win = NULL; | c_py->win = NULL; | ||||
| fprintf(stderr, "Python script \"%s\" " | CLOG_WARN(&LOG, "Python script \"%s\" running with missing context data.", script_id); | ||||
| "running with missing context data.\n", script_id); | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| if (argc > 1) { | if (argc > 1) { | ||||
| const char *err_msg = NULL; | const char *err_msg = NULL; | ||||
| if (!parse_int_clamp(argv[1], NULL, -1, INT_MAX, &G.log.level, &err_msg)) { | if (!parse_int_clamp(argv[1], NULL, -1, INT_MAX, &G.log.level, &err_msg)) { | ||||
| printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]); | CLOG_ERROR(&LOG, "%s '%s %s'.", err_msg, arg_id, argv[1]); | ||||
| } | } | ||||
| else { | else { | ||||
| if (G.log.level == -1) { | if (G.log.level == -1) { | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: '%s' no args given.\n", arg_id); | ERROR_NO_ARGS(arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| FILE *fp = BLI_fopen(argv[1], "w"); | FILE *fp = BLI_fopen(argv[1], "w"); | ||||
| if (fp == NULL) { | if (fp == NULL) { | ||||
| const char *err_msg = errno ? strerror(errno) : "unknown"; | const char *err_msg = errno ? strerror(errno) : "unknown"; | ||||
| printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]); | CLOG_ERROR(&LOG, "%s '%s %s'.", err_msg, arg_id, argv[1]); | ||||
| } | } | ||||
| else { | else { | ||||
| if (UNLIKELY(G.log.file != NULL)) { | if (UNLIKELY(G.log.file != NULL)) { | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: '%s' no args given.\n", arg_id); | ERROR_NO_ARGS(arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: '%s' no args given.\n", arg_id); | ERROR_NO_ARGS(arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| static int arg_handle_debug_mode_cycles(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) | static int arg_handle_debug_mode_cycles(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data)) | ||||
| { | { | ||||
| CCL_start_debug_logging(); | CCL_start_debug_logging(); | ||||
| return 0; | return 0;f | ||||
| } | } | ||||
| #endif | #endif | ||||
| Context not available. | |||||
| const char *err_msg = NULL; | const char *err_msg = NULL; | ||||
| int value; | int value; | ||||
| if (!parse_int(argv[1], NULL, &value, &err_msg)) { | if (!parse_int(argv[1], NULL, &value, &err_msg)) { | ||||
| printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]); | CLOG_ERROR(&LOG, "%s '%s %s'.", err_msg, arg_id, argv[1]); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify debug value to set.\n"); | CLOG_STR_ERROR(&LOG, "you must specify debug value to set."); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: App template must follow '--app-template'.\n"); | CLOG_STR_ERROR(&LOG, "App template must follow '--app-template'."); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| const char *ch_src = argv[0] + 5; /* skip --env */ | const char *ch_src = argv[0] + 5; /* skip --env */ | ||||
| if (argc < 2) { | if (argc < 2) { | ||||
| printf("%s requires one argument\n", argv[0]); | CLOG_ERROR(&LOG, "%s requires one argument", argv[0]); | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| Context not available. | |||||
| int params[4], i; | int params[4], i; | ||||
| if (argc < 5) { | if (argc < 5) { | ||||
| fprintf(stderr, "Error: requires four arguments '%s'\n", arg_id); | CLOG_ERROR(&LOG, "requires four arguments '%s'", arg_id); | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| for (i = 0; i < 4; i++) { | for (i = 0; i < 4; i++) { | ||||
| const char *err_msg = NULL; | const char *err_msg = NULL; | ||||
| if (!parse_int(argv[i + 1], NULL, ¶ms[i], &err_msg)) { | if (!parse_int(argv[i + 1], NULL, ¶ms[i], &err_msg)) { | ||||
| printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]); | CLOG_ERROR(&LOG, "%s '%s %s'.", err_msg, arg_id, argv[1]); | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| static int arg_handle_audio_set(int argc, const char **argv, void *UNUSED(data)) | static int arg_handle_audio_set(int argc, const char **argv, void *UNUSED(data)) | ||||
| { | { | ||||
| if (argc < 1) { | if (argc < 1) { | ||||
| fprintf(stderr, "-setaudio require one argument\n"); | CLOG_STR_ERROR(&LOG, "-setaudio require one argument"); | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| Context not available. | |||||
| BLI_strncpy(scene->r.pic, argv[1], sizeof(scene->r.pic)); | BLI_strncpy(scene->r.pic, argv[1], sizeof(scene->r.pic)); | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: no blend loaded. cannot use '-o / --render-output'.\n"); | CLOG_STR_ERROR(&LOG, "no blend loaded. cannot use '-o / --render-output'."); | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify a path after '-o / --render-output'.\n"); | CLOG_STR_ERROR(&LOG, "you must specify a path after '-o / --render-output'."); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| BLI_strncpy_utf8(scene->r.engine, argv[1], sizeof(scene->r.engine)); | BLI_strncpy_utf8(scene->r.engine, argv[1], sizeof(scene->r.engine)); | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: engine not found '%s'\n", argv[1]); | CLOG_ERROR(&LOG, "engine not found '%s'", argv[1]); | ||||
| exit(1); | exit(1); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: no blend loaded. " | CLOG_STR_ERROR(&LOG, "no blend loaded. " | ||||
| "order the arguments so '-E / --engine ' is after a blend is loaded.\n"); | "order the arguments so '-E / --engine ' is after a blend is loaded."); | ||||
| } | } | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nEngine not specified, give 'help' for a list of available engines.\n"); | CLOG_STR_ERROR(&LOG, "Engine not specified, give 'help' for a list of available engines."); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| const char imtype_new = BKE_imtype_from_arg(imtype); | const char imtype_new = BKE_imtype_from_arg(imtype); | ||||
| if (imtype_new == R_IMF_IMTYPE_INVALID) { | if (imtype_new == R_IMF_IMTYPE_INVALID) { | ||||
| printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n"); | CLOG_STR_ERROR(&LOG, "Format from '-F / --render-format' not known or not compiled in this release."); | ||||
| } | } | ||||
| else { | else { | ||||
| scene->r.im_format.imtype = imtype_new; | scene->r.im_format.imtype = imtype_new; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: no blend loaded. " | CLOG_STR_ERROR(&LOG, "no blend loaded. " | ||||
| "order the arguments so '-F / --render-format' is after the blend is loaded.\n"); | "order the arguments so '-F / --render-format' is after the blend is loaded."); | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify a format after '-F / --render-foramt'.\n"); | CLOG_STR_ERROR(&LOG, "you must specify a format after '-F / --render-format'."); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| const char *err_msg = NULL; | const char *err_msg = NULL; | ||||
| int threads; | int threads; | ||||
| if (!parse_int_strict_range(argv[1], NULL, min, max, &threads, &err_msg)) { | if (!parse_int_strict_range(argv[1], NULL, min, max, &threads, &err_msg)) { | ||||
| printf("\nError: %s '%s %s', expected number in [%d..%d].\n", err_msg, arg_id, argv[1], min, max); | CLOG_ERROR(&LOG, "%s '%s %s', expected number in [%d..%d].", err_msg, arg_id, argv[1], min, max); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify a number of threads in [%d..%d] '%s'.\n", min, max, arg_id); | CLOG_ERROR(&LOG, "you must specify a number of threads in [%d..%d] '%s'.", min, max, arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| const char *err_msg = NULL; | const char *err_msg = NULL; | ||||
| int level; | int level; | ||||
| if (!parse_int(argv[1], NULL, &level, &err_msg)) { | if (!parse_int(argv[1], NULL, &level, &err_msg)) { | ||||
| printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]); | CLOG_ERROR(&LOG, "%s '%s %s'.", err_msg, arg_id, argv[1]); | ||||
| } | } | ||||
| #ifdef WITH_LIBMV | #ifdef WITH_LIBMV | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify a verbosity level.\n"); | CLOG_STR_ERROR(&LOG, "you must specify a verbosity level."); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| scene->r.scemode |= R_EXTENSION; | scene->r.scemode |= R_EXTENSION; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: Use '-x 1 / -x 0' To set the extension option or '--use-extension'\n"); | CLOG_STR_ERROR(&LOG, "Use '-x 1 / -x 0' To set the extension option or '--use-extension'"); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: no blend loaded. " | CLOG_STR_ERROR(&LOG, "no blend loaded. " | ||||
| "order the arguments so '-o ' is after '-x '.\n"); | "order the arguments so '-o ' is after '-x '."); | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify a path after '- '.\n"); | CLOG_STR_ERROR(&LOG, "you must specify a path after '- '."); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| argv[1], scene->r.sfra, scene->r.efra, MINAFRAME, MAXFRAME, | argv[1], scene->r.sfra, scene->r.efra, MINAFRAME, MAXFRAME, | ||||
| &frames_range_len, &err_msg)) == NULL) | &frames_range_len, &err_msg)) == NULL) | ||||
| { | { | ||||
| printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]); | CLOG_ERROR(&LOG, "%s '%s %s'.", err_msg, arg_id, argv[1]); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| Context not available. | |||||
| /* We could pass in frame ranges, | /* We could pass in frame ranges, | ||||
| * but prefer having exact behavior as passing in multiple frames */ | * but prefer having exact behavior as passing in multiple frames */ | ||||
| if ((frame_range_arr[i][0] <= frame_range_arr[i][1]) == 0) { | if ((frame_range_arr[i][0] <= frame_range_arr[i][1]) == 0) { | ||||
| printf("\nWarning: negative range ignored '%s %s'.\n", arg_id, argv[1]); | CLOG_WARN(&LOG, "negative range ignored '%s %s'.", arg_id, argv[1]); | ||||
| } | } | ||||
| for (int frame = frame_range_arr[i][0]; frame <= frame_range_arr[i][1]; frame++) { | for (int frame = frame_range_arr[i][0]; frame <= frame_range_arr[i][1]; frame++) { | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: frame number must follow '%s'.\n", arg_id); | CLOG_ERROR(&LOG, "frame number must follow '%s'.", arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); | CLOG_ERROR(&LOG, "no blend loaded. cannot use '%s'.", arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| BLI_threaded_malloc_end(); | BLI_threaded_malloc_end(); | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: no blend loaded. cannot use '-a'.\n"); | CLOG_STR_ERROR(&LOG, "no blend loaded. cannot use '-a'."); | ||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: Scene name must follow '-S / --scene'.\n"); | CLOG_STR_ERROR(&LOG, "Scene name must follow '-S / --scene'."); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| argv[1], NULL, scene->r.sfra, scene->r.sfra - 1, MINAFRAME, MAXFRAME, | argv[1], NULL, scene->r.sfra, scene->r.sfra - 1, MINAFRAME, MAXFRAME, | ||||
| &scene->r.sfra, &err_msg)) | &scene->r.sfra, &err_msg)) | ||||
| { | { | ||||
| printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]); | CLOG_ERROR(&LOG, "%s '%s %s'.", err_msg, arg_id, argv[1]); | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: frame number must follow '%s'.\n", arg_id); | CLOG_ERROR(&LOG, "frame number must follow '%s'.", arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); | CLOG_ERROR(&LOG, "no blend loaded. cannot use '%s'.", arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| argv[1], NULL, scene->r.efra, scene->r.efra - 1, MINAFRAME, MAXFRAME, | argv[1], NULL, scene->r.efra, scene->r.efra - 1, MINAFRAME, MAXFRAME, | ||||
| &scene->r.efra, &err_msg)) | &scene->r.efra, &err_msg)) | ||||
| { | { | ||||
| printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]); | CLOG_ERROR(&LOG, "%s '%s %s'.", err_msg, arg_id, argv[1]); | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: frame number must follow '%s'.\n", arg_id); | CLOG_ERROR(&LOG, "frame number must follow '%s'.", arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); | CLOG_ERROR(&LOG, "no blend loaded. cannot use '%s'.", arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| if (argc > 1) { | if (argc > 1) { | ||||
| const char *err_msg = NULL; | const char *err_msg = NULL; | ||||
| if (!parse_int_clamp(argv[1], NULL, 1, MAXFRAME, &scene->r.frame_step, &err_msg)) { | if (!parse_int_clamp(argv[1], NULL, 1, MAXFRAME, &scene->r.frame_step, &err_msg)) { | ||||
| printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]); | CLOG_ERROR(&LOG, "%s '%s %s'.", err_msg, arg_id, argv[1]); | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: number of frames to step must follow '%s'.\n", arg_id); | CLOG_ERROR(&LOG, "number of frames to step must follow '%s'.", arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id); | CLOG_ERROR(&LOG, "no blend loaded. cannot use '%s'.", arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| bool ok; | bool ok; | ||||
| BPY_CTX_SETUP(ok = BPY_execute_filepath(C, filename, NULL)); | BPY_CTX_SETUP(ok = BPY_execute_filepath(C, filename, NULL)); | ||||
| if (!ok && app_state.exit_code_on_error.python) { | if (!ok && app_state.exit_code_on_error.python) { | ||||
| printf("\nError: script failed, file: '%s', exiting.\n", argv[1]); | CLOG_ERROR(&LOG, "script failed, file: '%s', exiting.", argv[1]); | ||||
| BPY_python_end(); | BPY_python_end(); | ||||
| exit(app_state.exit_code_on_error.python); | exit(app_state.exit_code_on_error.python); | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify a filepath after '%s'.\n", argv[0]); | CLOG_ERROR(&LOG, "you must specify a filepath after '%s'.", argv[0]); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| #else | #else | ||||
| UNUSED_VARS(argc, argv, data); | UNUSED_VARS(argc, argv, data); | ||||
| printf("This Blender was built without Python support\n"); | CLOG_STR_WARN(&LOG, "This Blender was built without Python support"); | ||||
| return 0; | return 0; | ||||
| #endif /* WITH_PYTHON */ | #endif /* WITH_PYTHON */ | ||||
| } | } | ||||
| Context not available. | |||||
| BPY_CTX_SETUP(ok = BPY_execute_text(C, text, NULL, false)); | BPY_CTX_SETUP(ok = BPY_execute_text(C, text, NULL, false)); | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: text block not found %s.\n", argv[1]); | CLOG_ERROR(&LOG, "text block not found %s.", argv[1]); | ||||
| ok = false; | ok = false; | ||||
| } | } | ||||
| if (!ok && app_state.exit_code_on_error.python) { | if (!ok && app_state.exit_code_on_error.python) { | ||||
| printf("\nError: script failed, text: '%s', exiting.\n", argv[1]); | CLOG_ERROR(&LOG, "script failed, text: '%s', exiting.", argv[1]); | ||||
| BPY_python_end(); | BPY_python_end(); | ||||
| exit(app_state.exit_code_on_error.python); | exit(app_state.exit_code_on_error.python); | ||||
| } | } | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify a text block after '%s'.\n", argv[0]); | CLOG_ERROR(&LOG, "you must specify a text block after '%s'.", argv[0]); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| #else | #else | ||||
| UNUSED_VARS(argc, argv, data); | UNUSED_VARS(argc, argv, data); | ||||
| printf("This Blender was built without Python support\n"); | CLOG_STR_WARN(&LOG, "This Blender was built without Python support"); | ||||
| return 0; | return 0; | ||||
| #endif /* WITH_PYTHON */ | #endif /* WITH_PYTHON */ | ||||
| } | } | ||||
| Context not available. | |||||
| bool ok; | bool ok; | ||||
| BPY_CTX_SETUP(ok = BPY_execute_string_ex(C, NULL, argv[1], false)); | BPY_CTX_SETUP(ok = BPY_execute_string_ex(C, NULL, argv[1], false)); | ||||
| if (!ok && app_state.exit_code_on_error.python) { | if (!ok && app_state.exit_code_on_error.python) { | ||||
| printf("\nError: script failed, expr: '%s', exiting.\n", argv[1]); | CLOG_ERROR(&LOG, "script failed, expr: '%s', exiting.", argv[1]); | ||||
| BPY_python_end(); | BPY_python_end(); | ||||
| exit(app_state.exit_code_on_error.python); | exit(app_state.exit_code_on_error.python); | ||||
| } | } | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify a Python expression after '%s'.\n", argv[0]); | CLOG_ERROR(&LOG, "you must specify a Python expression after '%s'.", argv[0]); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| #else | #else | ||||
| UNUSED_VARS(argc, argv, data); | UNUSED_VARS(argc, argv, data); | ||||
| printf("This Blender was built without Python support\n"); | CLOG_STR_WARN(&LOG, "This Blender was built without Python support"); | ||||
| return 0; | return 0; | ||||
| #endif /* WITH_PYTHON */ | #endif /* WITH_PYTHON */ | ||||
| } | } | ||||
| Context not available. | |||||
| return 0; | return 0; | ||||
| #else | #else | ||||
| UNUSED_VARS(argv, data); | UNUSED_VARS(argv, data); | ||||
| printf("This Blender was built without python support\n"); | CLOG_STR_WARN(&LOG, "This Blender was built without Python support"); | ||||
| return 0; | return 0; | ||||
| #endif /* WITH_PYTHON */ | #endif /* WITH_PYTHON */ | ||||
| } | } | ||||
| Context not available. | |||||
| const int min = 0, max = 255; | const int min = 0, max = 255; | ||||
| int exit_code; | int exit_code; | ||||
| if (!parse_int_strict_range(argv[1], NULL, min, max, &exit_code, &err_msg)) { | if (!parse_int_strict_range(argv[1], NULL, min, max, &exit_code, &err_msg)) { | ||||
| printf("\nError: %s '%s %s', expected number in [%d..%d].\n", err_msg, arg_id, argv[1], min, max); | CLOG_ERROR(&LOG, "%s '%s %s', expected number in [%d..%d].", err_msg, arg_id, argv[1], min, max); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify an exit code number '%s'.\n", arg_id); | CLOG_ERROR(&LOG, "you must specify an exit code number '%s'.", arg_id); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify a comma separated list after '--addons'.\n"); | CLOG_STR_ERROR(&LOG, "you must specify a comma separated list after '--addons'."); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| /* note, we could skip these, but so far we always tried to load these files */ | /* note, we could skip these, but so far we always tried to load these files */ | ||||
| if (argv[0][0] == '-') { | if (argv[0][0] == '-') { | ||||
| fprintf(stderr, "unknown argument, loading as file: %s\n", argv[0]); | CLOG_WARN(&LOG, "unknown argument, loading as file: %s", argv[0]); | ||||
| } | } | ||||
| BLI_strncpy(filename, argv[0], sizeof(filename)); | BLI_strncpy(filename, argv[0], sizeof(filename)); | ||||
| Context not available. | |||||
| BLI_strncpy(G_MAIN->name, filename, FILE_MAX); | BLI_strncpy(G_MAIN->name, filename, FILE_MAX); | ||||
| G.relbase_valid = true; | G.relbase_valid = true; | ||||
| G.save_over = true; | G.save_over = true; | ||||
| printf("... opened default scene instead; saving will write to: %s\n", filename); | CLOG_WARN(&LOG, "... opened default scene instead; saving will write to: %s", filename); | ||||
| } | } | ||||
| else { | else { | ||||
| printf("Error: argument has no '.blend' file extension, not using as new file, exiting! %s\n", filename); | CLOG_ERROR(&LOG, "argument has no '.blend' file extension, not using as new file, exiting! %s", filename); | ||||
| G.is_break = true; | G.is_break = true; | ||||
| WM_exit(C); | WM_exit(C); | ||||
| } | } | ||||
| Context not available. | |||||