Blender  V3.3
creator_args.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #ifndef WITH_PYTHON_MODULE
8 
9 # include <errno.h>
10 # include <stdlib.h>
11 # include <string.h>
12 
13 # include "MEM_guardedalloc.h"
14 
15 # include "CLG_log.h"
16 
17 # ifdef WIN32
18 # include "BLI_winstuff.h"
19 # endif
20 
21 # include "BLI_args.h"
22 # include "BLI_fileops.h"
23 # include "BLI_listbase.h"
24 # include "BLI_mempool.h"
25 # include "BLI_path_util.h"
26 # include "BLI_string.h"
27 # include "BLI_string_utf8.h"
28 # include "BLI_system.h"
29 # include "BLI_threads.h"
30 # include "BLI_utildefines.h"
31 
32 # include "BLO_readfile.h" /* only for BLO_has_bfile_extension */
33 
34 # include "BKE_blender_version.h"
35 # include "BKE_context.h"
36 
37 # include "BKE_global.h"
38 # include "BKE_image_format.h"
39 # include "BKE_lib_id.h"
40 # include "BKE_main.h"
41 # include "BKE_report.h"
42 # include "BKE_scene.h"
43 # include "BKE_sound.h"
44 
45 # ifdef WITH_FFMPEG
46 # include "IMB_imbuf.h"
47 # endif
48 
49 # ifdef WITH_PYTHON
50 # include "BPY_extern_python.h"
51 # include "BPY_extern_run.h"
52 # endif
53 
54 # include "RE_engine.h"
55 # include "RE_pipeline.h"
56 
57 # include "ED_datafiles.h"
58 
59 # include "WM_api.h"
60 
61 # ifdef WITH_LIBMV
62 # include "libmv-capi.h"
63 # endif
64 
65 # ifdef WITH_CYCLES_LOGGING
66 # include "CCL_api.h"
67 # endif
68 
69 # include "DEG_depsgraph.h"
70 # include "DEG_depsgraph_build.h"
71 # include "DEG_depsgraph_debug.h"
72 
73 # include "WM_types.h"
74 
75 # include "creator_intern.h" /* own include */
76 
77 /* -------------------------------------------------------------------- */
81 static bool parse_int_relative(const char *str,
82  const char *str_end_test,
83  int pos,
84  int neg,
85  int *r_value,
86  const char **r_err_msg)
87 {
88  char *str_end = NULL;
89  long value;
90 
91  errno = 0;
92 
93  switch (*str) {
94  case '+':
95  value = pos + strtol(str + 1, &str_end, 10);
96  break;
97  case '-':
98  value = (neg - strtol(str + 1, &str_end, 10)) + 1;
99  break;
100  default:
101  value = strtol(str, &str_end, 10);
102  break;
103  }
104 
105  if (*str_end != '\0' && (str_end != str_end_test)) {
106  static const char *msg = "not a number";
107  *r_err_msg = msg;
108  return false;
109  }
110  if ((errno == ERANGE) || ((value < INT_MIN) || (value > INT_MAX))) {
111  static const char *msg = "exceeds range";
112  *r_err_msg = msg;
113  return false;
114  }
115  *r_value = (int)value;
116  return true;
117 }
118 
119 static const char *parse_int_range_sep_search(const char *str, const char *str_end_test)
120 {
121  const char *str_end_range = NULL;
122  if (str_end_test) {
123  str_end_range = memchr(str, '.', (str_end_test - str) - 1);
124  if (str_end_range && (str_end_range[1] != '.')) {
125  str_end_range = NULL;
126  }
127  }
128  else {
129  str_end_range = strstr(str, "..");
130  if (str_end_range && (str_end_range[2] == '\0')) {
131  str_end_range = NULL;
132  }
133  }
134  return str_end_range;
135 }
136 
142 static bool parse_int_range_relative(const char *str,
143  const char *str_end_range,
144  const char *str_end_test,
145  int pos,
146  int neg,
147  int r_value_range[2],
148  const char **r_err_msg)
149 {
150  if (parse_int_relative(str, str_end_range, pos, neg, &r_value_range[0], r_err_msg) &&
152  str_end_range + 2, str_end_test, pos, neg, &r_value_range[1], r_err_msg)) {
153  return true;
154  }
155  return false;
156 }
157 
158 static bool parse_int_relative_clamp(const char *str,
159  const char *str_end_test,
160  int pos,
161  int neg,
162  int min,
163  int max,
164  int *r_value,
165  const char **r_err_msg)
166 {
167  if (parse_int_relative(str, str_end_test, pos, neg, r_value, r_err_msg)) {
168  CLAMP(*r_value, min, max);
169  return true;
170  }
171  return false;
172 }
173 
174 static bool parse_int_range_relative_clamp(const char *str,
175  const char *str_end_range,
176  const char *str_end_test,
177  int pos,
178  int neg,
179  int min,
180  int max,
181  int r_value_range[2],
182  const char **r_err_msg)
183 {
185  str, str_end_range, str_end_test, pos, neg, r_value_range, r_err_msg)) {
186  CLAMP(r_value_range[0], min, max);
187  CLAMP(r_value_range[1], min, max);
188  return true;
189  }
190  return false;
191 }
192 
196 static bool parse_int_strict_range(const char *str,
197  const char *str_end_test,
198  const int min,
199  const int max,
200  int *r_value,
201  const char **r_err_msg)
202 {
203  char *str_end = NULL;
204  long value;
205 
206  errno = 0;
207  value = strtol(str, &str_end, 10);
208 
209  if (*str_end != '\0' && (str_end != str_end_test)) {
210  static const char *msg = "not a number";
211  *r_err_msg = msg;
212  return false;
213  }
214  if ((errno == ERANGE) || ((value < min) || (value > max))) {
215  static const char *msg = "exceeds range";
216  *r_err_msg = msg;
217  return false;
218  }
219  *r_value = (int)value;
220  return true;
221 }
222 
223 static bool parse_int(const char *str,
224  const char *str_end_test,
225  int *r_value,
226  const char **r_err_msg)
227 {
228  return parse_int_strict_range(str, str_end_test, INT_MIN, INT_MAX, r_value, r_err_msg);
229 }
230 
231 static bool parse_int_clamp(const char *str,
232  const char *str_end_test,
233  int min,
234  int max,
235  int *r_value,
236  const char **r_err_msg)
237 {
238  if (parse_int(str, str_end_test, r_value, r_err_msg)) {
239  CLAMP(*r_value, min, max);
240  return true;
241  }
242  return false;
243 }
244 
245 # if 0
250 static int *parse_int_relative_clamp_n(
251  const char *str, int pos, int neg, int min, int max, int *r_value_len, const char **r_err_msg)
252 {
253  const char sep = ',';
254  int len = 1;
255  for (int i = 0; str[i]; i++) {
256  if (str[i] == sep) {
257  len++;
258  }
259  }
260 
261  int *values = MEM_mallocN(sizeof(*values) * len, __func__);
262  int i = 0;
263  while (true) {
264  const char *str_end = strchr(str, sep);
265  if (ELEM(*str, sep, '\0')) {
266  static const char *msg = "incorrect comma use";
267  *r_err_msg = msg;
268  goto fail;
269  }
270  else if (parse_int_relative_clamp(str, str_end, pos, neg, min, max, &values[i], r_err_msg)) {
271  i++;
272  }
273  else {
274  goto fail; /* error message already set */
275  }
276 
277  if (str_end) { /* next */
278  str = str_end + 1;
279  }
280  else { /* finished */
281  break;
282  }
283  }
284 
285  *r_value_len = i;
286  return values;
287 
288 fail:
289  MEM_freeN(values);
290  return NULL;
291 }
292 
293 # endif
294 
301 static int (*parse_int_range_relative_clamp_n(const char *str,
302  int pos,
303  int neg,
304  int min,
305  int max,
306  int *r_value_len,
307  const char **r_err_msg))[2]
308 {
309  const char sep = ',';
310  int len = 1;
311  for (int i = 0; str[i]; i++) {
312  if (str[i] == sep) {
313  len++;
314  }
315  }
316 
317  int(*values)[2] = MEM_mallocN(sizeof(*values) * len, __func__);
318  int i = 0;
319  while (true) {
320  const char *str_end_range;
321  const char *str_end = strchr(str, sep);
322  if (ELEM(*str, sep, '\0')) {
323  static const char *msg = "incorrect comma use";
324  *r_err_msg = msg;
325  goto fail;
326  }
327  else if ((str_end_range = parse_int_range_sep_search(str, str_end)) ?
329  str, str_end_range, str_end, pos, neg, min, max, values[i], r_err_msg) :
331  str, str_end, pos, neg, min, max, &values[i][0], r_err_msg)) {
332  if (str_end_range == NULL) {
333  values[i][1] = values[i][0];
334  }
335  i++;
336  }
337  else {
338  goto fail; /* error message already set */
339  }
340 
341  if (str_end) { /* next */
342  str = str_end + 1;
343  }
344  else { /* finished */
345  break;
346  }
347  }
348 
349  *r_value_len = i;
350  return values;
351 
352 fail:
353  MEM_freeN(values);
354  return NULL;
355 }
356 
359 /* -------------------------------------------------------------------- */
363 # ifdef WITH_PYTHON
364 
365 struct BlendePyContextStore {
366  wmWindowManager *wm;
367  Scene *scene;
368  wmWindow *win;
369  bool has_win;
370 };
371 
372 static void arg_py_context_backup(bContext *C,
373  struct BlendePyContextStore *c_py,
374  const char *script_id)
375 {
376  c_py->wm = CTX_wm_manager(C);
377  c_py->scene = CTX_data_scene(C);
378  c_py->has_win = !BLI_listbase_is_empty(&c_py->wm->windows);
379  if (c_py->has_win) {
380  c_py->win = CTX_wm_window(C);
381  CTX_wm_window_set(C, c_py->wm->windows.first);
382  }
383  else {
384  c_py->win = NULL;
385  fprintf(stderr,
386  "Python script \"%s\" "
387  "running with missing context data.\n",
388  script_id);
389  }
390 }
391 
392 static void arg_py_context_restore(bContext *C, struct BlendePyContextStore *c_py)
393 {
394  /* script may load a file, check old data is valid before using */
395  if (c_py->has_win) {
396  if ((c_py->win == NULL) || ((BLI_findindex(&G_MAIN->wm, c_py->wm) != -1) &&
397  (BLI_findindex(&c_py->wm->windows, c_py->win) != -1))) {
398  CTX_wm_window_set(C, c_py->win);
399  }
400  }
401 
402  if ((c_py->scene == NULL) || BLI_findindex(&G_MAIN->scenes, c_py->scene) != -1) {
403  CTX_data_scene_set(C, c_py->scene);
404  }
405 }
406 
407 /* macro for context setup/reset */
408 # define BPY_CTX_SETUP(_cmd) \
409  { \
410  struct BlendePyContextStore py_c; \
411  arg_py_context_backup(C, &py_c, argv[1]); \
412  { \
413  _cmd; \
414  } \
415  arg_py_context_restore(C, &py_c); \
416  } \
417  ((void)0)
418 
419 # endif /* WITH_PYTHON */
420 
423 /* -------------------------------------------------------------------- */
437 static void print_version_full(void)
438 {
439  printf("Blender %s\n", BKE_blender_version_string());
440 # ifdef BUILD_DATE
441  printf("\tbuild date: %s\n", build_date);
442  printf("\tbuild time: %s\n", build_time);
443  printf("\tbuild commit date: %s\n", build_commit_date);
444  printf("\tbuild commit time: %s\n", build_commit_time);
445  printf("\tbuild hash: %s\n", build_hash);
446  printf("\tbuild platform: %s\n", build_platform);
447  printf("\tbuild type: %s\n", build_type);
448  printf("\tbuild c flags: %s\n", build_cflags);
449  printf("\tbuild c++ flags: %s\n", build_cxxflags);
450  printf("\tbuild link flags: %s\n", build_linkflags);
451  printf("\tbuild system: %s\n", build_system);
452 # endif
453 }
454 
455 static void print_version_short(void)
456 {
457 # ifdef BUILD_DATE
458  /* NOTE: We include built time since sometimes we need to tell broken from
459  * working built of the same hash. */
460  printf("Blender %s (hash %s built %s %s)\n",
462  build_hash,
463  build_date,
464  build_time);
465 # else
466  printf("Blender %s\n", BKE_blender_version_string());
467 # endif
468 }
469 
470 static const char arg_handle_print_version_doc[] =
471  "\n\t"
472  "Print Blender version and exit.";
473 static int arg_handle_print_version(int UNUSED(argc),
474  const char **UNUSED(argv),
475  void *UNUSED(data))
476 {
478  exit(0);
479  return 0;
480 }
481 
482 static const char arg_handle_print_help_doc[] =
483  "\n\t"
484  "Print this help text and exit.";
485 static const char arg_handle_print_help_doc_win32[] =
486  "\n\t"
487  "Print this help text and exit (Windows only).";
488 static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
489 {
490  bArgs *ba = (bArgs *)data;
491 
492  printf("Blender %s\n", BKE_blender_version_string());
493  printf("Usage: blender [args ...] [file] [args ...]\n\n");
494 
495  printf("Render Options:\n");
496  BLI_args_print_arg_doc(ba, "--background");
497  BLI_args_print_arg_doc(ba, "--render-anim");
498  BLI_args_print_arg_doc(ba, "--scene");
499  BLI_args_print_arg_doc(ba, "--render-frame");
500  BLI_args_print_arg_doc(ba, "--frame-start");
501  BLI_args_print_arg_doc(ba, "--frame-end");
502  BLI_args_print_arg_doc(ba, "--frame-jump");
503  BLI_args_print_arg_doc(ba, "--render-output");
504  BLI_args_print_arg_doc(ba, "--engine");
505  BLI_args_print_arg_doc(ba, "--threads");
506 
507  printf("\n");
508  printf("Format Options:\n");
509  BLI_args_print_arg_doc(ba, "--render-format");
510  BLI_args_print_arg_doc(ba, "--use-extension");
511 
512  printf("\n");
513  printf("Animation Playback Options:\n");
514  BLI_args_print_arg_doc(ba, "-a");
515 
516  printf("\n");
517  printf("Window Options:\n");
518  BLI_args_print_arg_doc(ba, "--window-border");
519  BLI_args_print_arg_doc(ba, "--window-fullscreen");
520  BLI_args_print_arg_doc(ba, "--window-geometry");
521  BLI_args_print_arg_doc(ba, "--window-maximized");
522  BLI_args_print_arg_doc(ba, "--start-console");
523  BLI_args_print_arg_doc(ba, "--no-native-pixels");
524  BLI_args_print_arg_doc(ba, "--no-window-focus");
525 
526  printf("\n");
527  printf("Python Options:\n");
528  BLI_args_print_arg_doc(ba, "--enable-autoexec");
529  BLI_args_print_arg_doc(ba, "--disable-autoexec");
530 
531  printf("\n");
532 
533  BLI_args_print_arg_doc(ba, "--python");
534  BLI_args_print_arg_doc(ba, "--python-text");
535  BLI_args_print_arg_doc(ba, "--python-expr");
536  BLI_args_print_arg_doc(ba, "--python-console");
537  BLI_args_print_arg_doc(ba, "--python-exit-code");
538  BLI_args_print_arg_doc(ba, "--python-use-system-env");
539  BLI_args_print_arg_doc(ba, "--addons");
540 
541  printf("\n");
542  printf("Logging Options:\n");
543  BLI_args_print_arg_doc(ba, "--log");
544  BLI_args_print_arg_doc(ba, "--log-level");
545  BLI_args_print_arg_doc(ba, "--log-show-basename");
546  BLI_args_print_arg_doc(ba, "--log-show-backtrace");
547  BLI_args_print_arg_doc(ba, "--log-show-timestamp");
548  BLI_args_print_arg_doc(ba, "--log-file");
549 
550  printf("\n");
551  printf("Debug Options:\n");
552  BLI_args_print_arg_doc(ba, "--debug");
553  BLI_args_print_arg_doc(ba, "--debug-value");
554 
555  printf("\n");
556  BLI_args_print_arg_doc(ba, "--debug-events");
557 # ifdef WITH_FFMPEG
558  BLI_args_print_arg_doc(ba, "--debug-ffmpeg");
559 # endif
560  BLI_args_print_arg_doc(ba, "--debug-handlers");
561 # ifdef WITH_LIBMV
562  BLI_args_print_arg_doc(ba, "--debug-libmv");
563 # endif
564 # ifdef WITH_CYCLES_LOGGING
565  BLI_args_print_arg_doc(ba, "--debug-cycles");
566 # endif
567  BLI_args_print_arg_doc(ba, "--debug-memory");
568  BLI_args_print_arg_doc(ba, "--debug-jobs");
569  BLI_args_print_arg_doc(ba, "--debug-python");
570  BLI_args_print_arg_doc(ba, "--debug-depsgraph");
571  BLI_args_print_arg_doc(ba, "--debug-depsgraph-eval");
572  BLI_args_print_arg_doc(ba, "--debug-depsgraph-build");
573  BLI_args_print_arg_doc(ba, "--debug-depsgraph-tag");
574  BLI_args_print_arg_doc(ba, "--debug-depsgraph-no-threads");
575  BLI_args_print_arg_doc(ba, "--debug-depsgraph-time");
576  BLI_args_print_arg_doc(ba, "--debug-depsgraph-pretty");
577  BLI_args_print_arg_doc(ba, "--debug-depsgraph-uuid");
578  BLI_args_print_arg_doc(ba, "--debug-ghost");
579  BLI_args_print_arg_doc(ba, "--debug-wintab");
580  BLI_args_print_arg_doc(ba, "--debug-gpu");
581  BLI_args_print_arg_doc(ba, "--debug-gpu-force-workarounds");
582  BLI_args_print_arg_doc(ba, "--debug-wm");
583 # ifdef WITH_XR_OPENXR
584  BLI_args_print_arg_doc(ba, "--debug-xr");
585  BLI_args_print_arg_doc(ba, "--debug-xr-time");
586 # endif
587  BLI_args_print_arg_doc(ba, "--debug-all");
588  BLI_args_print_arg_doc(ba, "--debug-io");
589 
590  printf("\n");
591  BLI_args_print_arg_doc(ba, "--debug-fpe");
592  BLI_args_print_arg_doc(ba, "--debug-exit-on-error");
593  BLI_args_print_arg_doc(ba, "--disable-crash-handler");
594  BLI_args_print_arg_doc(ba, "--disable-abort-handler");
595 
596  BLI_args_print_arg_doc(ba, "--verbose");
597 
598  printf("\n");
599  printf("Misc Options:\n");
600  BLI_args_print_arg_doc(ba, "--open-last");
601  BLI_args_print_arg_doc(ba, "--app-template");
602  BLI_args_print_arg_doc(ba, "--factory-startup");
603  BLI_args_print_arg_doc(ba, "--enable-event-simulate");
604  printf("\n");
605  BLI_args_print_arg_doc(ba, "--env-system-datafiles");
606  BLI_args_print_arg_doc(ba, "--env-system-scripts");
607  BLI_args_print_arg_doc(ba, "--env-system-python");
608  printf("\n");
609  BLI_args_print_arg_doc(ba, "-noaudio");
610  BLI_args_print_arg_doc(ba, "-setaudio");
611 
612  printf("\n");
613 
614  BLI_args_print_arg_doc(ba, "--help");
615  BLI_args_print_arg_doc(ba, "/?");
616 
617  /* WIN32 only (ignored for non-win32) */
618  BLI_args_print_arg_doc(ba, "-R");
619  BLI_args_print_arg_doc(ba, "-r");
620 
621  BLI_args_print_arg_doc(ba, "--version");
622 
623  BLI_args_print_arg_doc(ba, "--");
624 
625  // printf("\n");
626  // printf("Experimental Features:\n");
627 
628  /* Other options _must_ be last (anything not handled will show here).
629  *
630  * Note that it's good practice for this to remain empty,
631  * nevertheless print if any exist. */
632  if (BLI_args_has_other_doc(ba)) {
633  printf("\n");
634  printf("Other Options:\n");
636  }
637 
638  printf("\n");
639  printf("Argument Parsing:\n");
640  printf("\tArguments must be separated by white space, eg:\n");
641  printf("\t# blender -ba test.blend\n");
642  printf("\t...will exit since '-ba' is an unknown argument.\n");
643 
644  printf("Argument Order:\n");
645  printf("\tArguments are executed in the order they are given. eg:\n");
646  printf("\t# blender --background test.blend --render-frame 1 --render-output '/tmp'\n");
647  printf(
648  "\t...will not render to '/tmp' because '--render-frame 1' renders before the output path "
649  "is set.\n");
650  printf("\t# blender --background --render-output /tmp test.blend --render-frame 1\n");
651  printf(
652  "\t...will not render to '/tmp' because loading the blend-file overwrites the render output "
653  "that was set.\n");
654  printf("\t# blender --background test.blend --render-output /tmp --render-frame 1\n");
655  printf("\t...works as expected.\n\n");
656 
657  printf("Environment Variables:\n");
658  printf(" $BLENDER_USER_CONFIG Directory for user configuration files.\n");
659  printf(" $BLENDER_USER_SCRIPTS Directory for user scripts.\n");
660  printf(" $BLENDER_SYSTEM_SCRIPTS Directory for system wide scripts.\n");
661  printf(" $BLENDER_USER_DATAFILES Directory for user data files (icons, translations, ..).\n");
662  printf(" $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.\n");
663  printf(" $BLENDER_SYSTEM_PYTHON Directory for system Python libraries.\n");
664 # ifdef WITH_OCIO
665  printf(" $OCIO Path to override the OpenColorIO config file.\n");
666 # endif
667 # ifdef WIN32
668  printf(" $TEMP Store temporary files here.\n");
669 # else
670  printf(" $TMP or $TMPDIR Store temporary files here.\n");
671 # endif
672 
673  exit(0);
674 
675  return 0;
676 }
677 
678 static const char arg_handle_arguments_end_doc[] =
679  "\n\t"
680  "End option processing, following arguments passed unchanged. Access via Python's "
681  "'sys.argv'.";
682 static int arg_handle_arguments_end(int UNUSED(argc),
683  const char **UNUSED(argv),
684  void *UNUSED(data))
685 {
686  return -1;
687 }
688 
689 /* only to give help message */
690 # ifndef WITH_PYTHON_SECURITY /* default */
691 # define PY_ENABLE_AUTO ", (default)"
692 # define PY_DISABLE_AUTO ""
693 # else
694 # define PY_ENABLE_AUTO ""
695 # define PY_DISABLE_AUTO ", (compiled as non-standard default)"
696 # endif
697 
698 static const char arg_handle_python_set_doc_enable[] =
699  "\n\t"
700  "Enable automatic Python script execution" PY_ENABLE_AUTO ".";
702  "\n\t"
703  "Disable automatic Python script execution (pydrivers & startup scripts)" PY_DISABLE_AUTO ".";
704 # undef PY_ENABLE_AUTO
705 # undef PY_DISABLE_AUTO
706 
707 static int arg_handle_python_set(int UNUSED(argc), const char **UNUSED(argv), void *data)
708 {
709  if ((bool)data) {
711  }
712  else {
714  }
716  return 0;
717 }
718 
720  "\n\t"
721  "Disable the crash handler.";
723  const char **UNUSED(argv),
724  void *UNUSED(data))
725 {
727  return 0;
728 }
729 
731  "\n\t"
732  "Disable the abort handler.";
734  const char **UNUSED(argv),
735  void *UNUSED(data))
736 {
738  return 0;
739 }
740 
741 static void clog_abort_on_error_callback(void *fp)
742 {
744  fflush(fp);
745  abort();
746 }
747 
749  "\n\t"
750  "Immediately exit when internal errors are detected.";
752  const char **UNUSED(argv),
753  void *UNUSED(data))
754 {
757  return 0;
758 }
759 
761  "\n\t"
762  "Run in background (often used for UI-less rendering).";
764  const char **UNUSED(argv),
765  void *UNUSED(data))
766 {
768  G.background = 1;
769  return 0;
770 }
771 
772 static const char arg_handle_log_level_set_doc[] =
773  "<level>\n"
774  "\tSet the logging verbosity level (higher for more details) defaults to 1,\n"
775  "\tuse -1 to log all levels.";
776 static int arg_handle_log_level_set(int argc, const char **argv, void *UNUSED(data))
777 {
778  const char *arg_id = "--log-level";
779  if (argc > 1) {
780  const char *err_msg = NULL;
781  if (!parse_int_clamp(argv[1], NULL, -1, INT_MAX, &G.log.level, &err_msg)) {
782  printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]);
783  }
784  else {
785  if (G.log.level == -1) {
786  G.log.level = INT_MAX;
787  }
788  CLG_level_set(G.log.level);
789  }
790  return 1;
791  }
792  printf("\nError: '%s' no args given.\n", arg_id);
793  return 0;
794 }
795 
797  "\n\t"
798  "Only show file name in output (not the leading path).";
800  const char **UNUSED(argv),
801  void *UNUSED(data))
802 {
804  return 0;
805 }
806 
808  "\n\t"
809  "Show a back trace for each log message (debug builds only).";
811  const char **UNUSED(argv),
812  void *UNUSED(data))
813 {
814  /* Ensure types don't become incompatible. */
815  void (*fn)(FILE * fp) = BLI_system_backtrace;
816  CLG_backtrace_fn_set((void (*)(void *))fn);
817  return 0;
818 }
819 
821  "\n\t"
822  "Show a timestamp for each log message in seconds since start.";
824  const char **UNUSED(argv),
825  void *UNUSED(data))
826 {
828  return 0;
829 }
830 
831 static const char arg_handle_log_file_set_doc[] =
832  "<filepath>\n"
833  "\tSet a file to output the log to.";
834 static int arg_handle_log_file_set(int argc, const char **argv, void *UNUSED(data))
835 {
836  const char *arg_id = "--log-file";
837  if (argc > 1) {
838  errno = 0;
839  FILE *fp = BLI_fopen(argv[1], "w");
840  if (fp == NULL) {
841  const char *err_msg = errno ? strerror(errno) : "unknown";
842  printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]);
843  }
844  else {
845  if (UNLIKELY(G.log.file != NULL)) {
846  fclose(G.log.file);
847  }
848  G.log.file = fp;
849  CLG_output_set(G.log.file);
850  }
851  return 1;
852  }
853  printf("\nError: '%s' no args given.\n", arg_id);
854  return 0;
855 }
856 
857 static const char arg_handle_log_set_doc[] =
858  "<match>\n"
859  "\tEnable logging categories, taking a single comma separated argument.\n"
860  "\tMultiple categories can be matched using a '.*' suffix,\n"
861  "\tso '--log \"wm.*\"' logs every kind of window-manager message.\n"
862  "\tSub-string can be matched using a '*' prefix and suffix,\n"
863  "\tso '--log \"*undo*\"' logs every kind of undo-related message.\n"
864  "\tUse \"^\" prefix to ignore, so '--log \"*,^wm.operator.*\"' logs all except for "
865  "'wm.operators.*'\n"
866  "\tUse \"*\" to log everything.";
867 static int arg_handle_log_set(int argc, const char **argv, void *UNUSED(data))
868 {
869  const char *arg_id = "--log";
870  if (argc > 1) {
871  const char *str_step = argv[1];
872  while (*str_step) {
873  const char *str_step_end = strchr(str_step, ',');
874  int str_step_len = str_step_end ? (str_step_end - str_step) : strlen(str_step);
875 
876  if (str_step[0] == '^') {
877  CLG_type_filter_exclude(str_step + 1, str_step_len - 1);
878  }
879  else {
880  CLG_type_filter_include(str_step, str_step_len);
881  }
882 
883  if (str_step_end) {
884  /* Typically only be one, but don't fail on multiple. */
885  while (*str_step_end == ',') {
886  str_step_end++;
887  }
888  str_step = str_step_end;
889  }
890  else {
891  break;
892  }
893  }
894  return 1;
895  }
896  printf("\nError: '%s' no args given.\n", arg_id);
897  return 0;
898 }
899 
900 static const char arg_handle_debug_mode_set_doc[] =
901  "\n"
902  "\tTurn debugging on.\n"
903  "\n"
904  "\t* Enables memory error detection\n"
905  "\t* Disables mouse grab (to interact with a debugger in some cases)\n"
906  "\t* Keeps Python's 'sys.stdin' rather than setting it to None";
907 static int arg_handle_debug_mode_set(int UNUSED(argc), const char **UNUSED(argv), void *data)
908 {
909  G.debug |= G_DEBUG; /* std output printf's */
910  printf("Blender %s\n", BKE_blender_version_string());
912 # ifndef NDEBUG
914 # endif
915 
916 # ifdef WITH_BUILDINFO
917  printf("Build: %s %s %s %s\n", build_date, build_time, build_platform, build_type);
918 # endif
919 
921  return 0;
922 }
923 
924 # ifdef WITH_FFMPEG
925 static const char arg_handle_debug_mode_generic_set_doc_ffmpeg[] =
926  "\n\t"
927  "Enable debug messages from FFmpeg library.";
928 # endif
929 # ifdef WITH_FREESTYLE
930 static const char arg_handle_debug_mode_generic_set_doc_freestyle[] =
931  "\n\t"
932  "Enable debug messages for Freestyle.";
933 # endif
935  "\n\t"
936  "Enable debug messages for Python.";
938  "\n\t"
939  "Enable debug messages for the event system.";
941  "\n\t"
942  "Enable debug messages for event handling.";
944  "\n\t"
945  "Enable debug messages for the window manager, shows all operators in search, shows "
946  "keymap errors.";
948  "\n\t"
949  "Enable debug messages for Ghost (Linux only).";
951  "\n\t"
952  "Enable debug messages for Wintab.";
953 # ifdef WITH_XR_OPENXR
954 static const char arg_handle_debug_mode_generic_set_doc_xr[] =
955  "\n\t"
956  "Enable debug messages for virtual reality contexts.\n"
957  "\tEnables the OpenXR API validation layer, (OpenXR) debug messages and general information "
958  "prints.";
959 static const char arg_handle_debug_mode_generic_set_doc_xr_time[] =
960  "\n\t"
961  "Enable debug messages for virtual reality frame rendering times.";
962 # endif
964  "\n\t"
965  "Enable time profiling for background jobs.";
967  "\n\t"
968  "Enable all debug messages from dependency graph.";
970  "\n\t"
971  "Enable debug messages from dependency graph related on graph construction.";
973  "\n\t"
974  "Enable debug messages from dependency graph related on tagging.";
976  "\n\t"
977  "Enable debug messages from dependency graph related on timing.";
979  "\n\t"
980  "Enable debug messages from dependency graph related on evaluation.";
982  "\n\t"
983  "Switch dependency graph to a single threaded evaluation.";
985  "\n\t"
986  "Enable colors for dependency graph debug messages.";
988  "\n\t"
989  "Verify validness of session-wide identifiers assigned to ID datablocks.";
991  "\n\t"
992  "Enable workarounds for typical GPU issues and disable all GPU extensions.";
993 
995  const char **UNUSED(argv),
996  void *data)
997 {
998  G.debug |= POINTER_AS_INT(data);
999  return 0;
1000 }
1001 
1002 static const char arg_handle_debug_mode_io_doc[] =
1003  "\n\t"
1004  "Enable debug messages for I/O (Collada, ...).";
1005 static int arg_handle_debug_mode_io(int UNUSED(argc),
1006  const char **UNUSED(argv),
1007  void *UNUSED(data))
1008 {
1009  G.debug |= G_DEBUG_IO;
1010  return 0;
1011 }
1012 
1013 static const char arg_handle_debug_mode_all_doc[] =
1014  "\n\t"
1015  "Enable all debug messages.";
1016 static int arg_handle_debug_mode_all(int UNUSED(argc),
1017  const char **UNUSED(argv),
1018  void *UNUSED(data))
1019 {
1020  G.debug |= G_DEBUG_ALL;
1021 # ifdef WITH_LIBMV
1023 # endif
1024 # ifdef WITH_CYCLES_LOGGING
1026 # endif
1027  return 0;
1028 }
1029 
1030 # ifdef WITH_LIBMV
1031 static const char arg_handle_debug_mode_libmv_doc[] =
1032  "\n\t"
1033  "Enable debug messages from libmv library.";
1034 static int arg_handle_debug_mode_libmv(int UNUSED(argc),
1035  const char **UNUSED(argv),
1036  void *UNUSED(data))
1037 {
1039 
1040  return 0;
1041 }
1042 # endif
1043 
1044 # ifdef WITH_CYCLES_LOGGING
1045 static const char arg_handle_debug_mode_cycles_doc[] =
1046  "\n\t"
1047  "Enable debug messages from Cycles.";
1048 static int arg_handle_debug_mode_cycles(int UNUSED(argc),
1049  const char **UNUSED(argv),
1050  void *UNUSED(data))
1051 {
1053  return 0;
1054 }
1055 # endif
1056 
1058  "\n\t"
1059  "Enable fully guarded memory allocation and debugging.";
1061  const char **UNUSED(argv),
1062  void *UNUSED(data))
1063 {
1065  return 0;
1066 }
1067 
1068 static const char arg_handle_debug_value_set_doc[] =
1069  "<value>\n"
1070  "\tSet debug value of <value> on startup.";
1071 static int arg_handle_debug_value_set(int argc, const char **argv, void *UNUSED(data))
1072 {
1073  const char *arg_id = "--debug-value";
1074  if (argc > 1) {
1075  const char *err_msg = NULL;
1076  int value;
1077  if (!parse_int(argv[1], NULL, &value, &err_msg)) {
1078  printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]);
1079  return 1;
1080  }
1081 
1082  G.debug_value = value;
1083 
1084  return 1;
1085  }
1086  printf("\nError: you must specify debug value to set.\n");
1087  return 0;
1088 }
1089 
1090 static const char arg_handle_debug_gpu_set_doc[] =
1091  "\n"
1092  "\tEnable GPU debug context and information for OpenGL 4.3+.";
1093 static int arg_handle_debug_gpu_set(int UNUSED(argc),
1094  const char **UNUSED(argv),
1095  void *UNUSED(data))
1096 {
1097  /* Also enable logging because that how gl errors are reported. */
1098  const char *gpu_filter = "gpu.*";
1099  CLG_type_filter_include(gpu_filter, strlen(gpu_filter));
1100  G.debug |= G_DEBUG_GPU;
1101  return 0;
1102 }
1103 
1104 static const char arg_handle_debug_fpe_set_doc[] =
1105  "\n\t"
1106  "Enable floating-point exceptions.";
1107 static int arg_handle_debug_fpe_set(int UNUSED(argc),
1108  const char **UNUSED(argv),
1109  void *UNUSED(data))
1110 {
1112  return 0;
1113 }
1114 
1115 static const char arg_handle_app_template_doc[] =
1116  "<template>\n"
1117  "\tSet the application template (matching the directory name), use 'default' for none.";
1118 static int arg_handle_app_template(int argc, const char **argv, void *UNUSED(data))
1119 {
1120  if (argc > 1) {
1121  const char *app_template = STREQ(argv[1], "default") ? "" : argv[1];
1123  return 1;
1124  }
1125  printf("\nError: App template must follow '--app-template'.\n");
1126  return 0;
1127 }
1128 
1130  "\n\t"
1131  "Skip reading the " STRINGIFY(BLENDER_STARTUP_FILE) " in the users home directory.";
1133  const char **UNUSED(argv),
1134  void *UNUSED(data))
1135 {
1136  G.factory_startup = 1;
1138  return 0;
1139 }
1140 
1142  "\n\t"
1143  "Enable event simulation testing feature 'bpy.types.Window.event_simulate'.";
1145  const char **UNUSED(argv),
1146  void *UNUSED(data))
1147 {
1148  G.f |= G_FLAG_EVENT_SIMULATE;
1149  return 0;
1150 }
1151 
1153  "\n\t"
1154  "Set the " STRINGIFY_ARG(BLENDER_SYSTEM_DATAFILES) " environment variable.";
1156  "\n\t"
1157  "Set the " STRINGIFY_ARG(BLENDER_SYSTEM_SCRIPTS) " environment variable.";
1159  "\n\t"
1160  "Set the " STRINGIFY_ARG(BLENDER_SYSTEM_PYTHON) " environment variable.";
1161 
1162 static int arg_handle_env_system_set(int argc, const char **argv, void *UNUSED(data))
1163 {
1164  /* `--env-system-scripts` -> `BLENDER_SYSTEM_SCRIPTS` */
1165 
1166  char env[64] = "BLENDER";
1167  char *ch_dst = env + 7; /* skip BLENDER */
1168  const char *ch_src = argv[0] + 5; /* skip --env */
1169 
1170  if (argc < 2) {
1171  printf("%s requires one argument\n", argv[0]);
1172  exit(1);
1173  }
1174 
1175  for (; *ch_src; ch_src++, ch_dst++) {
1176  *ch_dst = (*ch_src == '-') ? '_' : (*ch_src) - 32; /* Inline #toupper() */
1177  }
1178 
1179  *ch_dst = '\0';
1180  BLI_setenv(env, argv[1]);
1181  return 1;
1182 }
1183 
1184 static const char arg_handle_playback_mode_doc[] =
1185  "<options> <file(s)>\n"
1186  "\tInstead of showing Blender's user interface, this runs Blender as an animation player,\n"
1187  "\tto view movies and image sequences rendered in Blender (ignored if '-b' is set).\n"
1188  "\n"
1189  "\tPlayback Arguments:\n"
1190  "\n"
1191  "\t-p <sx> <sy>\n"
1192  "\t\tOpen with lower left corner at <sx>, <sy>.\n"
1193  "\t-m\n"
1194  "\t\tRead from disk (Do not buffer).\n"
1195  "\t-f <fps> <fps-base>\n"
1196  "\t\tSpecify FPS to start with.\n"
1197  "\t-j <frame>\n"
1198  "\t\tSet frame step to <frame>.\n"
1199  "\t-s <frame>\n"
1200  "\t\tPlay from <frame>.\n"
1201  "\t-e <frame>\n"
1202  "\t\tPlay until <frame>.\n"
1203  "\t-c <cache_memory>\n"
1204  "\t\tAmount of memory in megabytes to allow for caching images during playback.\n"
1205  "\t\tZero disables (clamping to a fixed number of frames instead).";
1206 static int arg_handle_playback_mode(int argc, const char **argv, void *UNUSED(data))
1207 {
1208  /* Ignore the animation player if `-b` was given first. */
1209  if (G.background == 0) {
1210 # ifdef WITH_FFMPEG
1211  /* Setup FFmpeg with current debug flags. */
1212  IMB_ffmpeg_init();
1213 # endif
1214 
1215  /* This function knows to skip this argument ('-a'). */
1216  WM_main_playanim(argc, argv);
1217 
1218  exit(0);
1219  }
1220 
1221  return -2;
1222 }
1223 
1224 static const char arg_handle_window_geometry_doc[] =
1225  "<sx> <sy> <w> <h>\n"
1226  "\tOpen with lower left corner at <sx>, <sy> and width and height as <w>, <h>.";
1227 static int arg_handle_window_geometry(int argc, const char **argv, void *UNUSED(data))
1228 {
1229  const char *arg_id = "-p / --window-geometry";
1230  int params[4], i;
1231 
1232  if (argc < 5) {
1233  fprintf(stderr, "Error: requires four arguments '%s'\n", arg_id);
1234  exit(1);
1235  }
1236 
1237  for (i = 0; i < 4; i++) {
1238  const char *err_msg = NULL;
1239  if (!parse_int(argv[i + 1], NULL, &params[i], &err_msg)) {
1240  printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]);
1241  exit(1);
1242  }
1243  }
1244 
1246 
1247  return 4;
1248 }
1249 
1251  "\n\t"
1252  "Do not use native pixel size, for high resolution displays (MacBook 'Retina').";
1254  const char **UNUSED(argv),
1255  void *UNUSED(data))
1256 {
1257  WM_init_native_pixels(false);
1258  return 0;
1259 }
1260 
1261 static const char arg_handle_with_borders_doc[] =
1262  "\n\t"
1263  "Force opening with borders.";
1264 static int arg_handle_with_borders(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
1265 {
1267  return 0;
1268 }
1269 
1270 static const char arg_handle_without_borders_doc[] =
1271  "\n\t"
1272  "Force opening in fullscreen mode.";
1273 static int arg_handle_without_borders(int UNUSED(argc),
1274  const char **UNUSED(argv),
1275  void *UNUSED(data))
1276 {
1278  return 0;
1279 }
1280 
1281 static const char arg_handle_window_maximized_doc[] =
1282  "\n\t"
1283  "Force opening maximized.";
1285  const char **UNUSED(argv),
1286  void *UNUSED(data))
1287 {
1289  return 0;
1290 }
1291 
1292 static const char arg_handle_no_window_focus_doc[] =
1293  "\n\t"
1294  "Open behind other windows and without taking focus.";
1295 static int arg_handle_no_window_focus(int UNUSED(argc),
1296  const char **UNUSED(argv),
1297  void *UNUSED(data))
1298 {
1299  WM_init_window_focus_set(false);
1300  return 0;
1301 }
1302 
1304  "\n\t"
1305  "Start with the console window open (ignored if '-b' is set), (Windows only).";
1307  const char **UNUSED(argv),
1308  void *UNUSED(data))
1309 {
1311  return 0;
1312 }
1313 
1315  "\n\t"
1316  "Register blend-file extension, then exit (Windows only).";
1318  "\n\t"
1319  "Silently register blend-file extension, then exit (Windows only).";
1320 static int arg_handle_register_extension(int UNUSED(argc), const char **UNUSED(argv), void *data)
1321 {
1322 # ifdef WIN32
1323  if (data) {
1324  G.background = 1;
1325  }
1327  TerminateProcess(GetCurrentProcess(), 0);
1328 # else
1329  (void)data; /* unused */
1330 # endif
1331  return 0;
1332 }
1333 
1334 static const char arg_handle_audio_disable_doc[] =
1335  "\n\t"
1336  "Force sound system to None.";
1337 static int arg_handle_audio_disable(int UNUSED(argc),
1338  const char **UNUSED(argv),
1339  void *UNUSED(data))
1340 {
1341  BKE_sound_force_device("None");
1342  return 0;
1343 }
1344 
1345 static const char arg_handle_audio_set_doc[] =
1346  "\n\t"
1347  "Force sound system to a specific device."
1348  "\n\t"
1349  "'None' 'SDL' 'OpenAL' 'CoreAudio' 'JACK' 'PulseAudio' 'WASAPI'.";
1350 static int arg_handle_audio_set(int argc, const char **argv, void *UNUSED(data))
1351 {
1352  if (argc < 1) {
1353  fprintf(stderr, "-setaudio require one argument\n");
1354  exit(1);
1355  }
1356 
1357  BKE_sound_force_device(argv[1]);
1358  return 1;
1359 }
1360 
1361 static const char arg_handle_output_set_doc[] =
1362  "<path>\n"
1363  "\tSet the render path and file name.\n"
1364  "\tUse '//' at the start of the path to render relative to the blend-file.\n"
1365  "\n"
1366  "\tThe '#' characters are replaced by the frame number, and used to define zero padding.\n"
1367  "\n"
1368  "\t* 'animation_##_test.png' becomes 'animation_01_test.png'\n"
1369  "\t* 'test-######.png' becomes 'test-000001.png'\n"
1370  "\n"
1371  "\tWhen the filename does not contain '#', The suffix '####' is added to the filename.\n"
1372  "\n"
1373  "\tThe frame number will be added at the end of the filename, eg:\n"
1374  "\t# blender -b animation.blend -o //render_ -F PNG -x 1 -a\n"
1375  "\t'//render_' becomes '//render_####', writing frames as '//render_0001.png'";
1376 static int arg_handle_output_set(int argc, const char **argv, void *data)
1377 {
1378  bContext *C = data;
1379  if (argc > 1) {
1381  if (scene) {
1382  BLI_strncpy(scene->r.pic, argv[1], sizeof(scene->r.pic));
1384  }
1385  else {
1386  printf("\nError: no blend loaded. cannot use '-o / --render-output'.\n");
1387  }
1388  return 1;
1389  }
1390  printf("\nError: you must specify a path after '-o / --render-output'.\n");
1391  return 0;
1392 }
1393 
1394 static const char arg_handle_engine_set_doc[] =
1395  "<engine>\n"
1396  "\tSpecify the render engine.\n"
1397  "\tUse '-E help' to list available engines.";
1398 static int arg_handle_engine_set(int argc, const char **argv, void *data)
1399 {
1400  bContext *C = data;
1401  if (argc >= 2) {
1402  if (STREQ(argv[1], "help")) {
1404  printf("Blender Engine Listing:\n");
1405  for (type = R_engines.first; type; type = type->next) {
1406  printf("\t%s\n", type->idname);
1407  }
1408  exit(0);
1409  }
1410  else {
1412  if (scene) {
1413  if (BLI_findstring(&R_engines, argv[1], offsetof(RenderEngineType, idname))) {
1414  BLI_strncpy_utf8(scene->r.engine, argv[1], sizeof(scene->r.engine));
1416  }
1417  else {
1418  printf("\nError: engine not found '%s'\n", argv[1]);
1419  exit(1);
1420  }
1421  }
1422  else {
1423  printf(
1424  "\nError: no blend loaded. "
1425  "order the arguments so '-E / --engine' is after a blend is loaded.\n");
1426  }
1427  }
1428 
1429  return 1;
1430  }
1431  printf("\nEngine not specified, give 'help' for a list of available engines.\n");
1432  return 0;
1433 }
1434 
1435 static const char arg_handle_image_type_set_doc[] =
1436  "<format>\n"
1437  "\tSet the render format.\n"
1438  "\tValid options are:\n"
1439  "\t'TGA' 'RAWTGA' 'JPEG' 'IRIS' 'IRIZ' 'AVIRAW' 'AVIJPEG' 'PNG' 'BMP'\n"
1440  "\n"
1441  "\tFormats that can be compiled into Blender, not available on all systems:\n"
1442  "\t'HDR' 'TIFF' 'OPEN_EXR' 'OPEN_EXR_MULTILAYER' 'MPEG' 'CINEON' 'DPX' 'DDS' 'JP2' 'WEBP'";
1443 static int arg_handle_image_type_set(int argc, const char **argv, void *data)
1444 {
1445  bContext *C = data;
1446  if (argc > 1) {
1447  const char *imtype = argv[1];
1449  if (scene) {
1450  const char imtype_new = BKE_imtype_from_arg(imtype);
1451 
1452  if (imtype_new == R_IMF_IMTYPE_INVALID) {
1453  printf(
1454  "\nError: Format from '-F / --render-format' not known or not compiled in this "
1455  "release.\n");
1456  }
1457  else {
1458  scene->r.im_format.imtype = imtype_new;
1460  }
1461  }
1462  else {
1463  printf(
1464  "\nError: no blend loaded. "
1465  "order the arguments so '-F / --render-format' is after the blend is loaded.\n");
1466  }
1467  return 1;
1468  }
1469  printf("\nError: you must specify a format after '-F / --render-format'.\n");
1470  return 0;
1471 }
1472 
1473 static const char arg_handle_threads_set_doc[] =
1474  "<threads>\n"
1475  "\tUse amount of <threads> for rendering and other operations\n"
1476  "\t[1-" STRINGIFY(BLENDER_MAX_THREADS) "], 0 for systems processor count.";
1477 static int arg_handle_threads_set(int argc, const char **argv, void *UNUSED(data))
1478 {
1479  const char *arg_id = "-t / --threads";
1480  const int min = 0, max = BLENDER_MAX_THREADS;
1481  if (argc > 1) {
1482  const char *err_msg = NULL;
1483  int threads;
1484  if (!parse_int_strict_range(argv[1], NULL, min, max, &threads, &err_msg)) {
1485  printf("\nError: %s '%s %s', expected number in [%d..%d].\n",
1486  err_msg,
1487  arg_id,
1488  argv[1],
1489  min,
1490  max);
1491  return 1;
1492  }
1493 
1495  return 1;
1496  }
1497  printf("\nError: you must specify a number of threads in [%d..%d] '%s'.\n", min, max, arg_id);
1498  return 0;
1499 }
1500 
1501 static const char arg_handle_verbosity_set_doc[] =
1502  "<verbose>\n"
1503  "\tSet the logging verbosity level for debug messages that support it.";
1504 static int arg_handle_verbosity_set(int argc, const char **argv, void *UNUSED(data))
1505 {
1506  const char *arg_id = "--verbose";
1507  if (argc > 1) {
1508  const char *err_msg = NULL;
1509  int level;
1510  if (!parse_int(argv[1], NULL, &level, &err_msg)) {
1511  printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]);
1512  }
1513 
1514 # ifdef WITH_LIBMV
1516 # elif defined(WITH_CYCLES_LOGGING)
1518 # else
1519  (void)level;
1520 # endif
1521 
1522  return 1;
1523  }
1524  printf("\nError: you must specify a verbosity level.\n");
1525  return 0;
1526 }
1527 
1528 static const char arg_handle_extension_set_doc[] =
1529  "<bool>\n"
1530  "\tSet option to add the file extension to the end of the file.";
1531 static int arg_handle_extension_set(int argc, const char **argv, void *data)
1532 {
1533  bContext *C = data;
1534  if (argc > 1) {
1536  if (scene) {
1537  if (argv[1][0] == '0') {
1538  scene->r.scemode &= ~R_EXTENSION;
1540  }
1541  else if (argv[1][0] == '1') {
1542  scene->r.scemode |= R_EXTENSION;
1544  }
1545  else {
1546  printf("\nError: Use '-x 1 / -x 0' To set the extension option or '--use-extension'\n");
1547  }
1548  }
1549  else {
1550  printf(
1551  "\nError: no blend loaded. "
1552  "order the arguments so '-o ' is after '-x '.\n");
1553  }
1554  return 1;
1555  }
1556  printf("\nError: you must specify a path after '- '.\n");
1557  return 0;
1558 }
1559 
1560 static const char arg_handle_render_frame_doc[] =
1561  "<frame>\n"
1562  "\tRender frame <frame> and save it.\n"
1563  "\n"
1564  "\t* +<frame> start frame relative, -<frame> end frame relative.\n"
1565  "\t* A comma separated list of frames can also be used (no spaces).\n"
1566  "\t* A range of frames can be expressed using '..' separator between the first and last "
1567  "frames (inclusive).\n";
1568 static int arg_handle_render_frame(int argc, const char **argv, void *data)
1569 {
1570  const char *arg_id = "-f / --render-frame";
1571  bContext *C = data;
1573  if (scene) {
1574  Main *bmain = CTX_data_main(C);
1575 
1576  if (argc > 1) {
1577  const char *err_msg = NULL;
1578  Render *re;
1579  ReportList reports;
1580 
1581  int(*frame_range_arr)[2], frames_range_len;
1582  if ((frame_range_arr = parse_int_range_relative_clamp_n(argv[1],
1583  scene->r.sfra,
1584  scene->r.efra,
1585  MINAFRAME,
1586  MAXFRAME,
1587  &frames_range_len,
1588  &err_msg)) == NULL) {
1589  printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]);
1590  return 1;
1591  }
1592 
1593  re = RE_NewSceneRender(scene);
1594  BKE_reports_init(&reports, RPT_STORE);
1595  RE_SetReports(re, &reports);
1596  for (int i = 0; i < frames_range_len; i++) {
1597  /* We could pass in frame ranges,
1598  * but prefer having exact behavior as passing in multiple frames */
1599  if ((frame_range_arr[i][0] <= frame_range_arr[i][1]) == 0) {
1600  printf("\nWarning: negative range ignored '%s %s'.\n", arg_id, argv[1]);
1601  }
1602 
1603  for (int frame = frame_range_arr[i][0]; frame <= frame_range_arr[i][1]; frame++) {
1604  RE_RenderAnim(re, bmain, scene, NULL, NULL, frame, frame, scene->r.frame_step);
1605  }
1606  }
1607  RE_SetReports(re, NULL);
1608  BKE_reports_clear(&reports);
1609  MEM_freeN(frame_range_arr);
1610  return 1;
1611  }
1612  printf("\nError: frame number must follow '%s'.\n", arg_id);
1613  return 0;
1614  }
1615  printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id);
1616  return 0;
1617 }
1618 
1619 static const char arg_handle_render_animation_doc[] =
1620  "\n\t"
1621  "Render frames from start to end (inclusive).";
1622 static int arg_handle_render_animation(int UNUSED(argc), const char **UNUSED(argv), void *data)
1623 {
1624  bContext *C = data;
1626  if (scene) {
1627  Main *bmain = CTX_data_main(C);
1629  ReportList reports;
1630  BKE_reports_init(&reports, RPT_STORE);
1631  RE_SetReports(re, &reports);
1633  RE_SetReports(re, NULL);
1634  BKE_reports_clear(&reports);
1635  }
1636  else {
1637  printf("\nError: no blend loaded. cannot use '-a'.\n");
1638  }
1639  return 0;
1640 }
1641 
1642 static const char arg_handle_scene_set_doc[] =
1643  "<name>\n"
1644  "\tSet the active scene <name> for rendering.";
1645 static int arg_handle_scene_set(int argc, const char **argv, void *data)
1646 {
1647  if (argc > 1) {
1648  bContext *C = data;
1650  if (scene) {
1652 
1653  /* Set the scene of the first window, see: T55991,
1654  * otherwise scripts that run later won't get this scene back from the context. */
1655  wmWindow *win = CTX_wm_window(C);
1656  if (win == NULL) {
1657  win = CTX_wm_manager(C)->windows.first;
1658  }
1659  if (win != NULL) {
1661  }
1662  }
1663  return 1;
1664  }
1665  printf("\nError: Scene name must follow '-S / --scene'.\n");
1666  return 0;
1667 }
1668 
1669 static const char arg_handle_frame_start_set_doc[] =
1670  "<frame>\n"
1671  "\tSet start to frame <frame>, supports +/- for relative frames too.";
1672 static int arg_handle_frame_start_set(int argc, const char **argv, void *data)
1673 {
1674  const char *arg_id = "-s / --frame-start";
1675  bContext *C = data;
1677  if (scene) {
1678  if (argc > 1) {
1679  const char *err_msg = NULL;
1680  if (!parse_int_relative_clamp(argv[1],
1681  NULL,
1682  scene->r.sfra,
1683  scene->r.sfra - 1,
1684  MINAFRAME,
1685  MAXFRAME,
1686  &scene->r.sfra,
1687  &err_msg)) {
1688  printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]);
1689  }
1690  else {
1692  }
1693  return 1;
1694  }
1695  printf("\nError: frame number must follow '%s'.\n", arg_id);
1696  return 0;
1697  }
1698  printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id);
1699  return 0;
1700 }
1701 
1702 static const char arg_handle_frame_end_set_doc[] =
1703  "<frame>\n"
1704  "\tSet end to frame <frame>, supports +/- for relative frames too.";
1705 static int arg_handle_frame_end_set(int argc, const char **argv, void *data)
1706 {
1707  const char *arg_id = "-e / --frame-end";
1708  bContext *C = data;
1710  if (scene) {
1711  if (argc > 1) {
1712  const char *err_msg = NULL;
1713  if (!parse_int_relative_clamp(argv[1],
1714  NULL,
1715  scene->r.efra,
1716  scene->r.efra - 1,
1717  MINAFRAME,
1718  MAXFRAME,
1719  &scene->r.efra,
1720  &err_msg)) {
1721  printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]);
1722  }
1723  else {
1725  }
1726  return 1;
1727  }
1728  printf("\nError: frame number must follow '%s'.\n", arg_id);
1729  return 0;
1730  }
1731  printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id);
1732  return 0;
1733 }
1734 
1735 static const char arg_handle_frame_skip_set_doc[] =
1736  "<frames>\n"
1737  "\tSet number of frames to step forward after each rendered frame.";
1738 static int arg_handle_frame_skip_set(int argc, const char **argv, void *data)
1739 {
1740  const char *arg_id = "-j / --frame-jump";
1741  bContext *C = data;
1743  if (scene) {
1744  if (argc > 1) {
1745  const char *err_msg = NULL;
1746  if (!parse_int_clamp(argv[1], NULL, 1, MAXFRAME, &scene->r.frame_step, &err_msg)) {
1747  printf("\nError: %s '%s %s'.\n", err_msg, arg_id, argv[1]);
1748  }
1749  else {
1751  }
1752  return 1;
1753  }
1754  printf("\nError: number of frames to step must follow '%s'.\n", arg_id);
1755  return 0;
1756  }
1757  printf("\nError: no blend loaded. cannot use '%s'.\n", arg_id);
1758  return 0;
1759 }
1760 
1761 static const char arg_handle_python_file_run_doc[] =
1762  "<filepath>\n"
1763  "\tRun the given Python script file.";
1764 static int arg_handle_python_file_run(int argc, const char **argv, void *data)
1765 {
1766 # ifdef WITH_PYTHON
1767  bContext *C = data;
1768 
1769  /* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */
1770  if (argc > 1) {
1771  /* Make the path absolute because its needed for relative linked blends to be found */
1772  char filepath[FILE_MAX];
1773  BLI_strncpy(filepath, argv[1], sizeof(filepath));
1774  BLI_path_abs_from_cwd(filepath, sizeof(filepath));
1775 
1776  bool ok;
1777  BPY_CTX_SETUP(ok = BPY_run_filepath(C, filepath, NULL));
1778  if (!ok && app_state.exit_code_on_error.python) {
1779  printf("\nError: script failed, file: '%s', exiting.\n", argv[1]);
1780  BPY_python_end();
1782  }
1783  return 1;
1784  }
1785  printf("\nError: you must specify a filepath after '%s'.\n", argv[0]);
1786  return 0;
1787 
1788 # else
1789  UNUSED_VARS(argc, argv, data);
1790  printf("This Blender was built without Python support\n");
1791  return 0;
1792 # endif /* WITH_PYTHON */
1793 }
1794 
1795 static const char arg_handle_python_text_run_doc[] =
1796  "<name>\n"
1797  "\tRun the given Python script text block.";
1798 static int arg_handle_python_text_run(int argc, const char **argv, void *data)
1799 {
1800 # ifdef WITH_PYTHON
1801  bContext *C = data;
1802 
1803  /* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */
1804  if (argc > 1) {
1805  Main *bmain = CTX_data_main(C);
1806  /* Make the path absolute because its needed for relative linked blends to be found */
1807  struct Text *text = (struct Text *)BKE_libblock_find_name(bmain, ID_TXT, argv[1]);
1808  bool ok;
1809 
1810  if (text) {
1811  BPY_CTX_SETUP(ok = BPY_run_text(C, text, NULL, false));
1812  }
1813  else {
1814  printf("\nError: text block not found %s.\n", argv[1]);
1815  ok = false;
1816  }
1817 
1818  if (!ok && app_state.exit_code_on_error.python) {
1819  printf("\nError: script failed, text: '%s', exiting.\n", argv[1]);
1820  BPY_python_end();
1822  }
1823 
1824  return 1;
1825  }
1826  printf("\nError: you must specify a text block after '%s'.\n", argv[0]);
1827  return 0;
1828 
1829 # else
1830  UNUSED_VARS(argc, argv, data);
1831  printf("This Blender was built without Python support\n");
1832  return 0;
1833 # endif /* WITH_PYTHON */
1834 }
1835 
1836 static const char arg_handle_python_expr_run_doc[] =
1837  "<expression>\n"
1838  "\tRun the given expression as a Python script.";
1839 static int arg_handle_python_expr_run(int argc, const char **argv, void *data)
1840 {
1841 # ifdef WITH_PYTHON
1842  bContext *C = data;
1843 
1844  /* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */
1845  if (argc > 1) {
1846  bool ok;
1847  BPY_CTX_SETUP(ok = BPY_run_string_exec(C, NULL, argv[1]));
1848  if (!ok && app_state.exit_code_on_error.python) {
1849  printf("\nError: script failed, expr: '%s', exiting.\n", argv[1]);
1850  BPY_python_end();
1852  }
1853  return 1;
1854  }
1855  printf("\nError: you must specify a Python expression after '%s'.\n", argv[0]);
1856  return 0;
1857 
1858 # else
1859  UNUSED_VARS(argc, argv, data);
1860  printf("This Blender was built without Python support\n");
1861  return 0;
1862 # endif /* WITH_PYTHON */
1863 }
1864 
1866  "\n\t"
1867  "Run Blender with an interactive console.";
1868 static int arg_handle_python_console_run(int UNUSED(argc), const char **argv, void *data)
1869 {
1870 # ifdef WITH_PYTHON
1871  bContext *C = data;
1872 
1873  BPY_CTX_SETUP(BPY_run_string_eval(C, (const char *[]){"code", NULL}, "code.interact()"));
1874 
1875  return 0;
1876 # else
1877  UNUSED_VARS(argv, data);
1878  printf("This Blender was built without python support\n");
1879  return 0;
1880 # endif /* WITH_PYTHON */
1881 }
1882 
1884  "<code>\n"
1885  "\tSet the exit-code in [0..255] to exit if a Python exception is raised\n"
1886  "\t(only for scripts executed from the command line), zero disables.";
1887 static int arg_handle_python_exit_code_set(int argc, const char **argv, void *UNUSED(data))
1888 {
1889  const char *arg_id = "--python-exit-code";
1890  if (argc > 1) {
1891  const char *err_msg = NULL;
1892  const int min = 0, max = 255;
1893  int exit_code;
1894  if (!parse_int_strict_range(argv[1], NULL, min, max, &exit_code, &err_msg)) {
1895  printf("\nError: %s '%s %s', expected number in [%d..%d].\n",
1896  err_msg,
1897  arg_id,
1898  argv[1],
1899  min,
1900  max);
1901  return 1;
1902  }
1903 
1904  app_state.exit_code_on_error.python = (unsigned char)exit_code;
1905  return 1;
1906  }
1907  printf("\nError: you must specify an exit code number '%s'.\n", arg_id);
1908  return 0;
1909 }
1910 
1912  "\n\t"
1913  "Allow Python to use system environment variables such as 'PYTHONPATH' and the user "
1914  "site-packages directory.";
1916  const char **UNUSED(argv),
1917  void *UNUSED(data))
1918 {
1919 # ifdef WITH_PYTHON
1921 # endif
1922  return 0;
1923 }
1924 
1925 static const char arg_handle_addons_set_doc[] =
1926  "<addon(s)>\n"
1927  "\tComma separated list (no spaces) of add-ons to enable in addition to any default add-ons.";
1928 static int arg_handle_addons_set(int argc, const char **argv, void *data)
1929 {
1930  /* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */
1931  if (argc > 1) {
1932 # ifdef WITH_PYTHON
1933  const char script_str[] =
1934  "from addon_utils import check, enable\n"
1935  "for m in '%s'.split(','):\n"
1936  " if check(m)[1] is False:\n"
1937  " enable(m, persistent=True)";
1938  const int slen = strlen(argv[1]) + (sizeof(script_str) - 2);
1939  char *str = malloc(slen);
1940  bContext *C = data;
1941  BLI_snprintf(str, slen, script_str, argv[1]);
1942 
1943  BLI_assert(strlen(str) + 1 == slen);
1944  BPY_CTX_SETUP(BPY_run_string_exec(C, NULL, str));
1945  free(str);
1946 # else
1947  UNUSED_VARS(argv, data);
1948 # endif /* WITH_PYTHON */
1949  return 1;
1950  }
1951  printf("\nError: you must specify a comma separated list after '--addons'.\n");
1952  return 0;
1953 }
1954 
1955 static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data)
1956 {
1957  bContext *C = data;
1958  ReportList reports;
1959  bool success;
1960 
1961  /* Make the path absolute because its needed for relative linked blends to be found */
1962  char filepath[FILE_MAX];
1963 
1964  /* NOTE: we could skip these, but so far we always tried to load these files. */
1965  if (argv[0][0] == '-') {
1966  fprintf(stderr, "unknown argument, loading as file: %s\n", argv[0]);
1967  }
1968 
1969  BLI_strncpy(filepath, argv[0], sizeof(filepath));
1973 
1974  /* load the file */
1975  BKE_reports_init(&reports, RPT_PRINT);
1977  success = WM_file_read(C, filepath, &reports);
1978  BKE_reports_clear(&reports);
1979 
1980  if (success) {
1981  if (G.background) {
1982  /* Ensure we use 'C->data.scene' for background render. */
1984  }
1985  }
1986  else {
1987  /* failed to load file, stop processing arguments if running in background mode */
1988  if (G.background) {
1989  /* Set is_break if running in the background mode so
1990  * blender will return non-zero exit code which then
1991  * could be used in automated script to control how
1992  * good or bad things are.
1993  */
1994  G.is_break = true;
1995  return -1;
1996  }
1997 
1999  /* Just pretend a file was loaded, so the user can press Save and it'll
2000  * save at the filepath from the CLI. */
2001  STRNCPY(G_MAIN->filepath, filepath);
2002  printf("... opened default scene instead; saving will write to: %s\n", filepath);
2003  }
2004  else {
2005  printf(
2006  "Error: argument has no '.blend' file extension, not using as new file, exiting! %s\n",
2007  filepath);
2008  G.is_break = true;
2009  WM_exit(C);
2010  }
2011  }
2012 
2013  return 0;
2014 }
2015 
2016 static const char arg_handle_load_last_file_doc[] =
2017  "\n\t"
2018  "Open the most recently opened blend file, instead of the default startup file.";
2019 static int arg_handle_load_last_file(int UNUSED(argc), const char **UNUSED(argv), void *data)
2020 {
2021  if (BLI_listbase_is_empty(&G.recent_files)) {
2022  printf("Warning: no recent files known, opening default startup file instead.\n");
2023  return -1;
2024  }
2025 
2026  const RecentFile *recent_file = G.recent_files.first;
2027  const char *fake_argv[] = {recent_file->filepath};
2028  return arg_handle_load_file(ARRAY_SIZE(fake_argv), fake_argv, data);
2029 }
2030 
2032 {
2033 
2034 # define CB(a) a##_doc, a
2035 # define CB_EX(a, b) a##_doc_##b, a
2036 
2037  /* end argument processing after -- */
2038  BLI_args_pass_set(ba, -1);
2040 
2041  /* Pass: Environment Setup
2042  *
2043  * It's important these run before any initialization is done, since they set up
2044  * the environment used to access data-files, which are be used when initializing
2045  * sub-systems such as color management. */
2047  BLI_args_add(
2048  ba, NULL, "--python-use-system-env", CB(arg_handle_python_use_system_env_set), NULL);
2049 
2050  /* Note that we could add used environment variables too. */
2051  BLI_args_add(
2052  ba, NULL, "--env-system-datafiles", CB_EX(arg_handle_env_system_set, datafiles), NULL);
2053  BLI_args_add(ba, NULL, "--env-system-scripts", CB_EX(arg_handle_env_system_set, scripts), NULL);
2054  BLI_args_add(ba, NULL, "--env-system-python", CB_EX(arg_handle_env_system_set, python), NULL);
2055 
2056  BLI_args_add(ba, "-t", "--threads", CB(arg_handle_threads_set), NULL);
2057 
2058  /* Include in the environment pass so it's possible display errors initializing subsystems,
2059  * especially `bpy.appdir` since it's useful to show errors finding paths on startup. */
2060  BLI_args_add(ba, NULL, "--log", CB(arg_handle_log_set), ba);
2061  BLI_args_add(ba, NULL, "--log-level", CB(arg_handle_log_level_set), ba);
2062  BLI_args_add(ba, NULL, "--log-show-basename", CB(arg_handle_log_show_basename_set), ba);
2063  BLI_args_add(ba, NULL, "--log-show-backtrace", CB(arg_handle_log_show_backtrace_set), ba);
2064  BLI_args_add(ba, NULL, "--log-show-timestamp", CB(arg_handle_log_show_timestamp_set), ba);
2065  BLI_args_add(ba, NULL, "--log-file", CB(arg_handle_log_file_set), ba);
2066 
2067  /* Pass: Background Mode & Settings
2068  *
2069  * Also and commands that exit after usage. */
2071  BLI_args_add(ba, "-h", "--help", CB(arg_handle_print_help), ba);
2072  /* Windows only */
2073  BLI_args_add(ba, "/?", NULL, CB_EX(arg_handle_print_help, win32), ba);
2074 
2075  BLI_args_add(ba, "-v", "--version", CB(arg_handle_print_version), NULL);
2076 
2077  BLI_args_add(ba, "-y", "--enable-autoexec", CB_EX(arg_handle_python_set, enable), (void *)true);
2078  BLI_args_add(
2079  ba, "-Y", "--disable-autoexec", CB_EX(arg_handle_python_set, disable), (void *)false);
2080 
2081  BLI_args_add(ba, NULL, "--disable-crash-handler", CB(arg_handle_crash_handler_disable), NULL);
2082  BLI_args_add(ba, NULL, "--disable-abort-handler", CB(arg_handle_abort_handler_disable), NULL);
2083 
2084  BLI_args_add(ba, "-b", "--background", CB(arg_handle_background_mode_set), NULL);
2085 
2087 
2088  BLI_args_add(ba, "-d", "--debug", CB(arg_handle_debug_mode_set), ba);
2089 
2090 # ifdef WITH_FFMPEG
2091  BLI_args_add(ba,
2092  NULL,
2093  "--debug-ffmpeg",
2095  (void *)G_DEBUG_FFMPEG);
2096 # endif
2097 
2098 # ifdef WITH_FREESTYLE
2099  BLI_args_add(ba,
2100 
2101  NULL,
2102  "--debug-freestyle",
2104  (void *)G_DEBUG_FREESTYLE);
2105 # endif
2106 
2107  BLI_args_add(ba,
2108 
2109  NULL,
2110  "--debug-python",
2112  (void *)G_DEBUG_PYTHON);
2113  BLI_args_add(ba,
2114 
2115  NULL,
2116  "--debug-events",
2118  (void *)G_DEBUG_EVENTS);
2119  BLI_args_add(ba,
2120 
2121  NULL,
2122  "--debug-handlers",
2124  (void *)G_DEBUG_HANDLERS);
2125  BLI_args_add(
2126  ba, NULL, "--debug-wm", CB_EX(arg_handle_debug_mode_generic_set, wm), (void *)G_DEBUG_WM);
2127 # ifdef WITH_XR_OPENXR
2128  BLI_args_add(
2129  ba, NULL, "--debug-xr", CB_EX(arg_handle_debug_mode_generic_set, xr), (void *)G_DEBUG_XR);
2130  BLI_args_add(ba,
2131 
2132  NULL,
2133  "--debug-xr-time",
2135  (void *)G_DEBUG_XR_TIME);
2136 # endif
2137  BLI_args_add(ba,
2138  NULL,
2139  "--debug-ghost",
2141  (void *)G_DEBUG_GHOST);
2142  BLI_args_add(ba,
2143  NULL,
2144  "--debug-wintab",
2146  (void *)G_DEBUG_WINTAB);
2147  BLI_args_add(ba, NULL, "--debug-all", CB(arg_handle_debug_mode_all), NULL);
2148 
2149  BLI_args_add(ba, NULL, "--debug-io", CB(arg_handle_debug_mode_io), NULL);
2150 
2151  BLI_args_add(ba, NULL, "--debug-fpe", CB(arg_handle_debug_fpe_set), NULL);
2152 
2153 # ifdef WITH_LIBMV
2154  BLI_args_add(ba, NULL, "--debug-libmv", CB(arg_handle_debug_mode_libmv), NULL);
2155 # endif
2156 # ifdef WITH_CYCLES_LOGGING
2157  BLI_args_add(ba, NULL, "--debug-cycles", CB(arg_handle_debug_mode_cycles), NULL);
2158 # endif
2159  BLI_args_add(ba, NULL, "--debug-memory", CB(arg_handle_debug_mode_memory_set), NULL);
2160 
2161  BLI_args_add(ba, NULL, "--debug-value", CB(arg_handle_debug_value_set), NULL);
2162  BLI_args_add(ba,
2163  NULL,
2164  "--debug-jobs",
2166  (void *)G_DEBUG_JOBS);
2167  BLI_args_add(ba, NULL, "--debug-gpu", CB(arg_handle_debug_gpu_set), NULL);
2168 
2169  BLI_args_add(ba,
2170  NULL,
2171  "--debug-depsgraph",
2173  (void *)G_DEBUG_DEPSGRAPH);
2174  BLI_args_add(ba,
2175  NULL,
2176  "--debug-depsgraph-build",
2177  CB_EX(arg_handle_debug_mode_generic_set, depsgraph_build),
2178  (void *)G_DEBUG_DEPSGRAPH_BUILD);
2179  BLI_args_add(ba,
2180  NULL,
2181  "--debug-depsgraph-eval",
2182  CB_EX(arg_handle_debug_mode_generic_set, depsgraph_eval),
2183  (void *)G_DEBUG_DEPSGRAPH_EVAL);
2184  BLI_args_add(ba,
2185  NULL,
2186  "--debug-depsgraph-tag",
2187  CB_EX(arg_handle_debug_mode_generic_set, depsgraph_tag),
2188  (void *)G_DEBUG_DEPSGRAPH_TAG);
2189  BLI_args_add(ba,
2190  NULL,
2191  "--debug-depsgraph-time",
2192  CB_EX(arg_handle_debug_mode_generic_set, depsgraph_time),
2193  (void *)G_DEBUG_DEPSGRAPH_TIME);
2194  BLI_args_add(ba,
2195 
2196  NULL,
2197  "--debug-depsgraph-no-threads",
2198  CB_EX(arg_handle_debug_mode_generic_set, depsgraph_no_threads),
2200  BLI_args_add(ba,
2201  NULL,
2202  "--debug-depsgraph-pretty",
2203  CB_EX(arg_handle_debug_mode_generic_set, depsgraph_pretty),
2204  (void *)G_DEBUG_DEPSGRAPH_PRETTY);
2205  BLI_args_add(ba,
2206  NULL,
2207  "--debug-depsgraph-uuid",
2208  CB_EX(arg_handle_debug_mode_generic_set, depsgraph_uuid),
2209  (void *)G_DEBUG_DEPSGRAPH_UUID);
2210  BLI_args_add(ba,
2211  NULL,
2212  "--debug-gpu-force-workarounds",
2213  CB_EX(arg_handle_debug_mode_generic_set, gpu_force_workarounds),
2215  BLI_args_add(ba, NULL, "--debug-exit-on-error", CB(arg_handle_debug_exit_on_error), NULL);
2216 
2217  BLI_args_add(ba, NULL, "--verbose", CB(arg_handle_verbosity_set), NULL);
2218 
2219  BLI_args_add(ba, NULL, "--app-template", CB(arg_handle_app_template), NULL);
2220  BLI_args_add(ba, NULL, "--factory-startup", CB(arg_handle_factory_startup_set), NULL);
2221  BLI_args_add(ba, NULL, "--enable-event-simulate", CB(arg_handle_enable_event_simulate), NULL);
2222 
2223  /* Pass: Custom Window Stuff. */
2225  BLI_args_add(ba, "-p", "--window-geometry", CB(arg_handle_window_geometry), NULL);
2226  BLI_args_add(ba, "-w", "--window-border", CB(arg_handle_with_borders), NULL);
2227  BLI_args_add(ba, "-W", "--window-fullscreen", CB(arg_handle_without_borders), NULL);
2228  BLI_args_add(ba, "-M", "--window-maximized", CB(arg_handle_window_maximized), NULL);
2229  BLI_args_add(ba, NULL, "--no-window-focus", CB(arg_handle_no_window_focus), NULL);
2230  BLI_args_add(ba, "-con", "--start-console", CB(arg_handle_start_with_console), NULL);
2232  BLI_args_add(ba, "-r", NULL, CB_EX(arg_handle_register_extension, silent), ba);
2233  BLI_args_add(ba, NULL, "--no-native-pixels", CB(arg_handle_native_pixels_set), ba);
2234 
2235  /* Pass: Disabling Things & Forcing Settings. */
2237  BLI_args_add_case(ba, "-noaudio", 1, NULL, 0, CB(arg_handle_audio_disable), NULL);
2238  BLI_args_add_case(ba, "-setaudio", 1, NULL, 0, CB(arg_handle_audio_set), NULL);
2239 
2240  /* Pass: Processing Arguments. */
2242  BLI_args_add(ba, "-f", "--render-frame", CB(arg_handle_render_frame), C);
2243  BLI_args_add(ba, "-a", "--render-anim", CB(arg_handle_render_animation), C);
2244  BLI_args_add(ba, "-S", "--scene", CB(arg_handle_scene_set), C);
2245  BLI_args_add(ba, "-s", "--frame-start", CB(arg_handle_frame_start_set), C);
2246  BLI_args_add(ba, "-e", "--frame-end", CB(arg_handle_frame_end_set), C);
2247  BLI_args_add(ba, "-j", "--frame-jump", CB(arg_handle_frame_skip_set), C);
2248  BLI_args_add(ba, "-P", "--python", CB(arg_handle_python_file_run), C);
2249  BLI_args_add(ba, NULL, "--python-text", CB(arg_handle_python_text_run), C);
2250  BLI_args_add(ba, NULL, "--python-expr", CB(arg_handle_python_expr_run), C);
2251  BLI_args_add(ba, NULL, "--python-console", CB(arg_handle_python_console_run), C);
2252  BLI_args_add(ba, NULL, "--python-exit-code", CB(arg_handle_python_exit_code_set), NULL);
2253  BLI_args_add(ba, NULL, "--addons", CB(arg_handle_addons_set), C);
2254 
2255  BLI_args_add(ba, "-o", "--render-output", CB(arg_handle_output_set), C);
2256  BLI_args_add(ba, "-E", "--engine", CB(arg_handle_engine_set), C);
2257 
2258  BLI_args_add(ba, "-F", "--render-format", CB(arg_handle_image_type_set), C);
2259  BLI_args_add(ba, "-x", "--use-extension", CB(arg_handle_extension_set), C);
2260 
2261  BLI_args_add(ba, NULL, "--open-last", CB(arg_handle_load_last_file), C);
2262 
2263 # undef CB
2264 # undef CB_EX
2265 }
2266 
2271 {
2273 }
2274 
2277 #endif /* WITH_PYTHON_MODULE */
#define BLENDER_STARTUP_FILE
Definition: BKE_appdir.h:175
@ BLENDER_SYSTEM_DATAFILES
Definition: BKE_appdir.h:163
@ BLENDER_SYSTEM_PYTHON
Definition: BKE_appdir.h:165
@ BLENDER_SYSTEM_SCRIPTS
Definition: BKE_appdir.h:164
const char * BKE_blender_version_string(void)
Definition: blender.c:124
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
void CTX_data_scene_set(bContext *C, struct Scene *scene)
Definition: context.c:1271
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
void CTX_wm_window_set(bContext *C, struct wmWindow *win)
Definition: context.c:966
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
#define G_MAIN
Definition: BKE_global.h:267
@ G_DEBUG
Definition: BKE_global.h:174
@ G_DEBUG_GPU
Definition: BKE_global.h:193
@ G_DEBUG_GHOST
Definition: BKE_global.h:199
@ G_DEBUG_XR
Definition: BKE_global.h:196
@ G_DEBUG_HANDLERS
Definition: BKE_global.h:178
@ G_DEBUG_FREESTYLE
Definition: BKE_global.h:181
@ G_DEBUG_IO
Definition: BKE_global.h:194
@ G_DEBUG_JOBS
Definition: BKE_global.h:180
@ G_DEBUG_GPU_FORCE_WORKAROUNDS
Definition: BKE_global.h:195
@ G_DEBUG_FFMPEG
Definition: BKE_global.h:175
@ G_DEBUG_DEPSGRAPH_PRETTY
Definition: BKE_global.h:187
@ G_DEBUG_XR_TIME
Definition: BKE_global.h:197
@ G_DEBUG_WINTAB
Definition: BKE_global.h:200
@ G_DEBUG_DEPSGRAPH_TIME
Definition: BKE_global.h:185
@ G_DEBUG_DEPSGRAPH
Definition: BKE_global.h:190
@ G_DEBUG_DEPSGRAPH_EVAL
Definition: BKE_global.h:183
@ G_DEBUG_DEPSGRAPH_NO_THREADS
Definition: BKE_global.h:186
@ G_DEBUG_DEPSGRAPH_TAG
Definition: BKE_global.h:184
@ G_DEBUG_WM
Definition: BKE_global.h:179
@ G_DEBUG_EVENTS
Definition: BKE_global.h:177
@ G_DEBUG_PYTHON
Definition: BKE_global.h:176
@ G_DEBUG_DEPSGRAPH_BUILD
Definition: BKE_global.h:182
@ G_DEBUG_DEPSGRAPH_UUID
Definition: BKE_global.h:188
#define G_DEBUG_ALL
Definition: BKE_global.h:203
@ G_FLAG_SCRIPT_OVERRIDE_PREF
Definition: BKE_global.h:156
@ G_FLAG_EVENT_SIMULATE
Definition: BKE_global.h:151
@ G_FLAG_USERPREF_NO_SAVE_ON_EXIT
Definition: BKE_global.h:152
@ G_FLAG_SCRIPT_AUTOEXEC
Definition: BKE_global.h:154
char BKE_imtype_from_arg(const char *arg)
struct ID * BKE_libblock_find_name(struct Main *bmain, short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: lib_id.c:1297
void BKE_reports_clear(ReportList *reports)
Definition: report.c:63
void BKE_reports_init(ReportList *reports, int flag)
Definition: report.c:50
struct Scene * BKE_scene_set_name(struct Main *bmain, const char *name)
Definition: scene.cc:2096
void BKE_sound_force_device(const char *device)
A general argument parsing module.
void BLI_args_parse(struct bArgs *ba, int pass, BA_ArgCallback default_cb, void *data)
Definition: BLI_args.c:273
void BLI_args_print(struct bArgs *ba)
Definition: BLI_args.c:128
void BLI_args_print_other_doc(struct bArgs *ba)
Definition: BLI_args.c:252
void BLI_args_print_arg_doc(struct bArgs *ba, const char *arg)
Definition: BLI_args.c:239
void BLI_args_add_case(struct bArgs *ba, const char *short_arg, int short_case, const char *long_arg, int long_case, const char *doc, BA_ArgCallback cb, void *data)
Definition: BLI_args.c:194
void BLI_args_pass_set(struct bArgs *ba, int current_pass)
Definition: BLI_args.c:122
void BLI_args_add(struct bArgs *ba, const char *short_arg, const char *long_arg, const char *doc, BA_ArgCallback cb, void *data)
Definition: BLI_args.c:214
bool BLI_args_has_other_doc(const struct bArgs *ba)
Definition: BLI_args.c:263
#define BLI_assert(a)
Definition: BLI_assert.h:46
File and directory operations.
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: fileops.c:906
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:102
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:269
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void void void void BLI_mempool_set_memory_debug(void)
Definition: BLI_mempool.c:719
#define FILE_MAX
void BLI_path_normalize(const char *relabase, char *path) ATTR_NONNULL(2)
Definition: path_util.c:131
void BLI_setenv(const char *env, const char *val) ATTR_NONNULL(1)
Definition: path_util.c:1143
bool BLI_path_abs_from_cwd(char *path, size_t maxlen) ATTR_NONNULL()
Definition: path_util.c:1015
void BLI_path_slash_native(char *path) ATTR_NONNULL()
Definition: path_util.c:1805
#define STRNCPY(dst, src)
Definition: BLI_string.h:483
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL(1
void BLI_system_backtrace(FILE *fp)
Definition: system.c:62
void BLI_system_num_threads_override_set(int num)
Definition: threads.cc:317
#define BLENDER_MAX_THREADS
Definition: BLI_threads.h:19
#define UNPACK4(a)
#define ARRAY_SIZE(arr)
#define UNUSED_VARS(...)
#define STRINGIFY(x)
#define STRINGIFY_ARG(x)
#define UNUSED(x)
#define POINTER_AS_INT(i)
#define UNLIKELY(x)
#define ELEM(...)
#define STREQ(a, b)
Compatibility-like things for windows.
bool BLI_windows_register_blend_extension(bool background)
external readfile function prototypes.
bool BLO_has_bfile_extension(const char *str)
Definition: readfile.c:1497
void BPY_python_use_system_env(void)
void BPY_python_end(void)
bool BPY_run_filepath(struct bContext *C, const char *filepath, struct ReportList *reports) ATTR_NONNULL(1
bool bool BPY_run_text(struct bContext *C, struct Text *text, struct ReportList *reports, bool do_jump) ATTR_NONNULL(1
bool BPY_run_string_eval(struct bContext *C, const char *imports[], const char *expr)
bool BPY_run_string_exec(struct bContext *C, const char *imports[], const char *expr)
void CCL_logging_verbosity_set(int verbosity)
Definition: logging.cpp:17
void CCL_start_debug_logging(void)
Definition: logging.cpp:12
void CLG_type_filter_include(const char *type_filter, int type_filter_len)
Definition: clog.c:743
void CLG_output_set(void *file_handle)
Definition: clog.c:708
void CLG_output_use_basename_set(int value)
Definition: clog.c:713
void CLG_error_fn_set(void(*error_fn)(void *file_handle))
Definition: clog.c:723
void CLG_backtrace_fn_set(void(*fatal_fn)(void *file_handle))
Definition: clog.c:733
void CLG_type_filter_exclude(const char *type_filter, int type_filter_len)
Definition: clog.c:738
void CLG_level_set(int level)
Definition: clog.c:748
void CLG_output_use_timestamp_set(int value)
Definition: clog.c:718
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_COPY_ON_WRITE
Definition: DNA_ID.h:834
@ ID_TXT
Definition: DNA_ID_enums.h:62
#define R_EXTENSION
#define MINAFRAME
#define R_IMF_IMTYPE_INVALID
#define MAXFRAME
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
void IMB_ffmpeg_init(void)
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
#define C
Definition: RandGen.cpp:25
char build_type[]
Definition: buildinfo.c:38
char build_cflags[]
Definition: buildinfo.c:46
char build_hash[]
Definition: buildinfo.c:31
char build_commit_date[]
Definition: buildinfo.c:33
char build_commit_time[]
Definition: buildinfo.c:34
char build_linkflags[]
Definition: buildinfo.c:48
char build_system[]
Definition: buildinfo.c:49
char build_date[]
Definition: buildinfo.c:29
char build_cxxflags[]
Definition: buildinfo.c:47
char build_time[]
Definition: buildinfo.c:30
char build_platform[]
Definition: buildinfo.c:37
struct ApplicationState app_state
Definition: creator.c:102
static int arg_handle_audio_set(int argc, const char **argv, void *UNUSED(data))
static const char arg_handle_engine_set_doc[]
static const char arg_handle_debug_mode_io_doc[]
static int arg_handle_debug_mode_set(int UNUSED(argc), const char **UNUSED(argv), void *data)
Definition: creator_args.c:907
static int arg_handle_threads_set(int argc, const char **argv, void *UNUSED(data))
static int arg_handle_audio_disable(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static const char arg_handle_factory_startup_set_doc[]
static int arg_handle_render_frame(int argc, const char **argv, void *data)
static const char arg_handle_scene_set_doc[]
static const char arg_handle_debug_mode_generic_set_doc_jobs[]
Definition: creator_args.c:963
static const char arg_handle_frame_start_set_doc[]
static bool parse_int_relative(const char *str, const char *str_end_test, int pos, int neg, int *r_value, const char **r_err_msg)
Definition: creator_args.c:81
static const char arg_handle_output_set_doc[]
static int arg_handle_register_extension(int UNUSED(argc), const char **UNUSED(argv), void *data)
static const char arg_handle_render_animation_doc[]
static const char arg_handle_debug_mode_generic_set_doc_wm[]
Definition: creator_args.c:943
static const char arg_handle_env_system_set_doc_datafiles[]
static const char arg_handle_verbosity_set_doc[]
static const char arg_handle_env_system_set_doc_python[]
static const char arg_handle_print_version_doc[]
Definition: creator_args.c:470
static const char arg_handle_debug_value_set_doc[]
static const char arg_handle_with_borders_doc[]
static const char arg_handle_debug_mode_generic_set_doc_ghost[]
Definition: creator_args.c:947
static int arg_handle_python_text_run(int argc, const char **argv, void *data)
static int arg_handle_output_set(int argc, const char **argv, void *data)
static int(* parse_int_range_relative_clamp_n(const char *str, int pos, int neg, int min, int max, int *r_value_len, const char **r_err_msg))[2]
Definition: creator_args.c:301
#define CB_EX(a, b)
static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data)
static bool parse_int_range_relative_clamp(const char *str, const char *str_end_range, const char *str_end_test, int pos, int neg, int min, int max, int r_value_range[2], const char **r_err_msg)
Definition: creator_args.c:174
static const char arg_handle_log_set_doc[]
Definition: creator_args.c:857
static void print_version_full(void)
Definition: creator_args.c:437
static bool parse_int_range_relative(const char *str, const char *str_end_range, const char *str_end_test, int pos, int neg, int r_value_range[2], const char **r_err_msg)
Definition: creator_args.c:142
static const char arg_handle_native_pixels_set_doc[]
static int arg_handle_native_pixels_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static const char arg_handle_debug_gpu_set_doc[]
static int arg_handle_enable_event_simulate(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static int arg_handle_debug_value_set(int argc, const char **argv, void *UNUSED(data))
static const char arg_handle_debug_mode_generic_set_doc_handlers[]
Definition: creator_args.c:940
static int arg_handle_crash_handler_disable(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
Definition: creator_args.c:722
static const char arg_handle_log_level_set_doc[]
Definition: creator_args.c:772
static const char arg_handle_python_console_run_doc[]
static int arg_handle_render_animation(int UNUSED(argc), const char **UNUSED(argv), void *data)
static int arg_handle_debug_gpu_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static const char arg_handle_debug_mode_set_doc[]
Definition: creator_args.c:900
static bool parse_int_clamp(const char *str, const char *str_end_test, int min, int max, int *r_value, const char **r_err_msg)
Definition: creator_args.c:231
static const char arg_handle_frame_end_set_doc[]
static const char arg_handle_register_extension_doc[]
static int arg_handle_window_geometry(int argc, const char **argv, void *UNUSED(data))
static const char arg_handle_debug_mode_generic_set_doc_depsgraph_no_threads[]
Definition: creator_args.c:981
static int arg_handle_extension_set(int argc, const char **argv, void *data)
static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
Definition: creator_args.c:488
static int arg_handle_python_expr_run(int argc, const char **argv, void *data)
static const char arg_handle_debug_mode_generic_set_doc_python[]
Definition: creator_args.c:934
static const char arg_handle_debug_mode_generic_set_doc_depsgraph_time[]
Definition: creator_args.c:975
static const char arg_handle_python_exit_code_set_doc[]
static int arg_handle_without_borders(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static const char arg_handle_register_extension_doc_silent[]
static int arg_handle_load_last_file(int UNUSED(argc), const char **UNUSED(argv), void *data)
static const char arg_handle_without_borders_doc[]
static const char arg_handle_python_expr_run_doc[]
void main_args_setup(bContext *C, bArgs *ba)
static int arg_handle_python_exit_code_set(int argc, const char **argv, void *UNUSED(data))
static const char arg_handle_frame_skip_set_doc[]
static const char arg_handle_python_set_doc_disable[]
Definition: creator_args.c:701
static const char arg_handle_debug_mode_generic_set_doc_depsgraph_eval[]
Definition: creator_args.c:978
#define PY_ENABLE_AUTO
Definition: creator_args.c:691
static int arg_handle_print_version(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
Definition: creator_args.c:473
#define CB(a)
static const char arg_handle_debug_mode_generic_set_doc_depsgraph_build[]
Definition: creator_args.c:969
static int arg_handle_playback_mode(int argc, const char **argv, void *UNUSED(data))
static const char arg_handle_env_system_set_doc_scripts[]
static const char arg_handle_window_maximized_doc[]
static const char arg_handle_python_text_run_doc[]
static int arg_handle_app_template(int argc, const char **argv, void *UNUSED(data))
static int arg_handle_scene_set(int argc, const char **argv, void *data)
static const char arg_handle_image_type_set_doc[]
static void clog_abort_on_error_callback(void *fp)
Definition: creator_args.c:741
static int arg_handle_env_system_set(int argc, const char **argv, void *UNUSED(data))
static const char arg_handle_render_frame_doc[]
static const char arg_handle_print_help_doc_win32[]
Definition: creator_args.c:485
static int arg_handle_debug_fpe_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static int arg_handle_background_mode_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
Definition: creator_args.c:763
static const char arg_handle_audio_disable_doc[]
static void print_version_short(void)
Definition: creator_args.c:455
static bool parse_int(const char *str, const char *str_end_test, int *r_value, const char **r_err_msg)
Definition: creator_args.c:223
static const char arg_handle_start_with_console_doc[]
static int arg_handle_log_set(int argc, const char **argv, void *UNUSED(data))
Definition: creator_args.c:867
static const char arg_handle_addons_set_doc[]
static int arg_handle_arguments_end(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
Definition: creator_args.c:682
static int arg_handle_addons_set(int argc, const char **argv, void *data)
static int arg_handle_image_type_set(int argc, const char **argv, void *data)
static const char arg_handle_print_help_doc[]
Definition: creator_args.c:482
static int arg_handle_abort_handler_disable(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
Definition: creator_args.c:733
static int arg_handle_python_use_system_env_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static const char arg_handle_log_show_basename_set_doc[]
Definition: creator_args.c:796
static int arg_handle_no_window_focus(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static const char arg_handle_extension_set_doc[]
static int arg_handle_debug_mode_memory_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static bool parse_int_relative_clamp(const char *str, const char *str_end_test, int pos, int neg, int min, int max, int *r_value, const char **r_err_msg)
Definition: creator_args.c:158
static const char * parse_int_range_sep_search(const char *str, const char *str_end_test)
Definition: creator_args.c:119
static const char arg_handle_debug_mode_memory_set_doc[]
static const char arg_handle_background_mode_set_doc[]
Definition: creator_args.c:760
static int arg_handle_python_console_run(int UNUSED(argc), const char **argv, void *data)
static int arg_handle_debug_mode_generic_set(int UNUSED(argc), const char **UNUSED(argv), void *data)
Definition: creator_args.c:994
static const char arg_handle_debug_mode_generic_set_doc_depsgraph_tag[]
Definition: creator_args.c:972
static int arg_handle_log_show_backtrace_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
Definition: creator_args.c:810
static const char arg_handle_log_show_backtrace_set_doc[]
Definition: creator_args.c:807
static int arg_handle_factory_startup_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static const char arg_handle_enable_event_simulate_doc[]
static bool parse_int_strict_range(const char *str, const char *str_end_test, const int min, const int max, int *r_value, const char **r_err_msg)
Definition: creator_args.c:196
static int arg_handle_python_set(int UNUSED(argc), const char **UNUSED(argv), void *data)
Definition: creator_args.c:707
static const char arg_handle_debug_mode_generic_set_doc_depsgraph[]
Definition: creator_args.c:966
static int arg_handle_start_with_console(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static int arg_handle_debug_mode_io(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static int arg_handle_with_borders(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static const char arg_handle_debug_fpe_set_doc[]
static int arg_handle_python_file_run(int argc, const char **argv, void *data)
static const char arg_handle_debug_mode_generic_set_doc_depsgraph_pretty[]
Definition: creator_args.c:984
void main_args_setup_post(bContext *C, bArgs *ba)
static int arg_handle_frame_end_set(int argc, const char **argv, void *data)
static int arg_handle_verbosity_set(int argc, const char **argv, void *UNUSED(data))
static const char arg_handle_log_file_set_doc[]
Definition: creator_args.c:831
static const char arg_handle_window_geometry_doc[]
static const char arg_handle_python_file_run_doc[]
static const char arg_handle_python_set_doc_enable[]
Definition: creator_args.c:698
#define PY_DISABLE_AUTO
Definition: creator_args.c:692
static const char arg_handle_arguments_end_doc[]
Definition: creator_args.c:678
static const char arg_handle_load_last_file_doc[]
static const char arg_handle_crash_handler_disable_doc[]
Definition: creator_args.c:719
static const char arg_handle_app_template_doc[]
static int arg_handle_log_show_timestamp_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
Definition: creator_args.c:823
static int arg_handle_log_show_basename_set(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
Definition: creator_args.c:799
static const char arg_handle_threads_set_doc[]
static const char arg_handle_python_use_system_env_set_doc[]
static const char arg_handle_log_show_timestamp_set_doc[]
Definition: creator_args.c:820
static int arg_handle_debug_mode_all(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static const char arg_handle_debug_mode_generic_set_doc_depsgraph_uuid[]
Definition: creator_args.c:987
static const char arg_handle_abort_handler_disable_doc[]
Definition: creator_args.c:730
static const char arg_handle_debug_exit_on_error_doc[]
Definition: creator_args.c:748
static const char arg_handle_playback_mode_doc[]
static const char arg_handle_debug_mode_generic_set_doc_events[]
Definition: creator_args.c:937
static int arg_handle_log_file_set(int argc, const char **argv, void *UNUSED(data))
Definition: creator_args.c:834
static int arg_handle_window_maximized(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
static const char arg_handle_debug_mode_generic_set_doc_wintab[]
Definition: creator_args.c:950
static const char arg_handle_debug_mode_generic_set_doc_gpu_force_workarounds[]
Definition: creator_args.c:990
static int arg_handle_frame_skip_set(int argc, const char **argv, void *data)
static int arg_handle_frame_start_set(int argc, const char **argv, void *data)
static int arg_handle_debug_exit_on_error(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
Definition: creator_args.c:751
static int arg_handle_log_level_set(int argc, const char **argv, void *UNUSED(data))
Definition: creator_args.c:776
static const char arg_handle_no_window_focus_doc[]
static int arg_handle_engine_set(int argc, const char **argv, void *data)
static const char arg_handle_debug_mode_all_doc[]
static const char arg_handle_audio_set_doc[]
void main_signal_setup_fpe(void)
@ ARG_PASS_ENVIRONMENT
@ ARG_PASS_SETTINGS_FORCE
@ ARG_PASS_SETTINGS_GUI
@ ARG_PASS_FINAL
@ ARG_PASS_SETTINGS
Scene scene
const Depsgraph * depsgraph
SyclQueue void void size_t num_bytes void
int len
Definition: draw_manager.c:108
ListBase R_engines
Definition: engine.c:57
#define str(s)
uint pos
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void MEM_enable_fail_on_memleak()
void libmv_setLoggingVerbosity(int verbosity)
Definition: logging.cc:41
void libmv_startDebugLogging(void)
Definition: logging.cc:31
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void(* MEM_set_memory_debug)(void)
Definition: mallocn.c:44
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
#define G(x, y, z)
ListBase threads
list of all thread for every CPUDevice in cpudevices a thread exists.
Render * RE_NewSceneRender(const Scene *scene)
Definition: pipeline.c:558
void RE_RenderAnim(Render *re, Main *bmain, Scene *scene, ViewLayer *single_layer, Object *camera_override, int sfra, int efra, int tfra)
Definition: pipeline.c:2142
void RE_SetReports(Render *re, ReportList *reports)
Definition: pipeline.c:1753
#define min(a, b)
Definition: sort.c:35
struct ApplicationState::@1221 signal
struct ApplicationState::@1222 exit_code_on_error
unsigned char python
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
char * filepath
Definition: WM_types.h:1271
char engine[32]
struct ImageFormatData im_format
char pic[1024]
struct RenderData r
char * filepath
Definition: BLI_args.c:45
float max
void WM_init_state_app_template_set(const char *app_template)
Definition: wm_files.c:1025
bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
Definition: wm_files.c:900
char app_template[64]
Definition: wm_files.c:1021
void WM_file_autoexec_init(const char *filepath)
Definition: wm_files.c:559
void WM_exit(bContext *C)
Main exit function to close Blender ordinarily.
Definition: wm_init_exit.c:646
void WM_init_state_start_with_console_set(bool value)
Definition: wm_init_exit.c:148
void WM_main_playanim(int argc, const char **argv)
Definition: wm_playanim.c:1846
void WM_window_set_active_scene(Main *bmain, bContext *C, wmWindow *win, Scene *scene)
Definition: wm_window.c:2188
void WM_init_state_normal_set(void)
Definition: wm_window.c:2006
void WM_init_native_pixels(bool do_it)
Definition: wm_window.c:2023
void WM_init_state_maximized_set(void)
Definition: wm_window.c:2012
void WM_init_state_size_set(int stax, int stay, int sizx, int sizy)
Definition: wm_window.c:1991
void WM_init_state_fullscreen_set(void)
Definition: wm_window.c:2000
void WM_init_window_focus_set(bool do_it)
Definition: wm_window.c:2018