Changeset View
Changeset View
Standalone View
Standalone View
source/creator/creator.c
| Show First 20 Lines • Show All 318 Lines • ▼ Show 20 Lines | #ifdef WITH_CYCLES_LOGGING | ||||
| BLI_argsPrintArgDoc(ba, "--debug-cycles"); | BLI_argsPrintArgDoc(ba, "--debug-cycles"); | ||||
| #endif | #endif | ||||
| BLI_argsPrintArgDoc(ba, "--debug-memory"); | BLI_argsPrintArgDoc(ba, "--debug-memory"); | ||||
| BLI_argsPrintArgDoc(ba, "--debug-jobs"); | BLI_argsPrintArgDoc(ba, "--debug-jobs"); | ||||
| BLI_argsPrintArgDoc(ba, "--debug-python"); | BLI_argsPrintArgDoc(ba, "--debug-python"); | ||||
| BLI_argsPrintArgDoc(ba, "--debug-depsgraph"); | BLI_argsPrintArgDoc(ba, "--debug-depsgraph"); | ||||
| BLI_argsPrintArgDoc(ba, "--debug-depsgraph-no-threads"); | BLI_argsPrintArgDoc(ba, "--debug-depsgraph-no-threads"); | ||||
| BLI_argsPrintArgDoc(ba, "--debug-gpumem"); | |||||
| BLI_argsPrintArgDoc(ba, "--debug-wm"); | BLI_argsPrintArgDoc(ba, "--debug-wm"); | ||||
| BLI_argsPrintArgDoc(ba, "--debug-all"); | BLI_argsPrintArgDoc(ba, "--debug-all"); | ||||
| printf("\n"); | printf("\n"); | ||||
| BLI_argsPrintArgDoc(ba, "--debug-fpe"); | BLI_argsPrintArgDoc(ba, "--debug-fpe"); | ||||
| BLI_argsPrintArgDoc(ba, "--disable-crash-handler"); | BLI_argsPrintArgDoc(ba, "--disable-crash-handler"); | ||||
| printf("\n"); | printf("\n"); | ||||
| printf("Misc Options:\n"); | printf("Misc Options:\n"); | ||||
| BLI_argsPrintArgDoc(ba, "--factory-startup"); | BLI_argsPrintArgDoc(ba, "--factory-startup"); | ||||
| printf("\n"); | printf("\n"); | ||||
| BLI_argsPrintArgDoc(ba, "--env-system-config"); | |||||
| BLI_argsPrintArgDoc(ba, "--env-system-datafiles"); | BLI_argsPrintArgDoc(ba, "--env-system-datafiles"); | ||||
| BLI_argsPrintArgDoc(ba, "--env-system-scripts"); | BLI_argsPrintArgDoc(ba, "--env-system-scripts"); | ||||
| BLI_argsPrintArgDoc(ba, "--env-system-python"); | BLI_argsPrintArgDoc(ba, "--env-system-python"); | ||||
| printf("\n"); | printf("\n"); | ||||
| BLI_argsPrintArgDoc(ba, "-nojoystick"); | BLI_argsPrintArgDoc(ba, "-nojoystick"); | ||||
| BLI_argsPrintArgDoc(ba, "-noglsl"); | BLI_argsPrintArgDoc(ba, "-noglsl"); | ||||
| BLI_argsPrintArgDoc(ba, "-noaudio"); | BLI_argsPrintArgDoc(ba, "-noaudio"); | ||||
| BLI_argsPrintArgDoc(ba, "-setaudio"); | BLI_argsPrintArgDoc(ba, "-setaudio"); | ||||
| ▲ Show 20 Lines • Show All 951 Lines • ▼ Show 20 Lines | |||||
| #endif /* WITH_PYTHON */ | #endif /* WITH_PYTHON */ | ||||
| } | } | ||||
| static int set_addons(int argc, const char **argv, void *data) | static int set_addons(int argc, const char **argv, void *data) | ||||
| { | { | ||||
| /* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */ | /* workaround for scripts not getting a bpy.context.scene, causes internal errors elsewhere */ | ||||
| if (argc > 1) { | if (argc > 1) { | ||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| const int slen = strlen(argv[1]) + 128; | const char script_str[] = | ||||
| "from addon_utils import check, enable\n" | |||||
| "for m in '%s'.split(','):\n" | |||||
| " if check(m)[1] is False:\n" | |||||
| " enable(m, persistent=True)"; | |||||
| const int slen = strlen(argv[1]) + (sizeof(script_str) - 2); | |||||
| char *str = malloc(slen); | char *str = malloc(slen); | ||||
| bContext *C = data; | bContext *C = data; | ||||
| BLI_snprintf(str, slen, "[__import__('addon_utils').enable(i, default_set=False) for i in '%s'.split(',')]", argv[1]); | BLI_snprintf(str, slen, script_str, argv[1]); | ||||
| BPY_CTX_SETUP(BPY_string_exec(C, str)); | |||||
| BLI_assert(strlen(str) + 1 == slen); | |||||
| BPY_CTX_SETUP(BPY_string_exec_ex(C, str, false)); | |||||
| free(str); | free(str); | ||||
| #else | #else | ||||
| UNUSED_VARS(argv, data); | UNUSED_VARS(argv, data); | ||||
| #endif /* WITH_PYTHON */ | #endif /* WITH_PYTHON */ | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| else { | else { | ||||
| printf("\nError: you must specify a comma separated list after '--addons'.\n"); | printf("\nError: you must specify a comma separated list after '--addons'.\n"); | ||||
| ▲ Show 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | #endif | ||||
| BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph", "\n\tEnable debug messages from dependency graph", debug_mode_generic, (void *)G_DEBUG_DEPSGRAPH); | BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph", "\n\tEnable debug messages from dependency graph", debug_mode_generic, (void *)G_DEBUG_DEPSGRAPH); | ||||
| BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph-no-threads", "\n\tSwitch dependency graph to a single threaded evlauation", debug_mode_generic, (void *)G_DEBUG_DEPSGRAPH_NO_THREADS); | BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph-no-threads", "\n\tSwitch dependency graph to a single threaded evlauation", debug_mode_generic, (void *)G_DEBUG_DEPSGRAPH_NO_THREADS); | ||||
| BLI_argsAdd(ba, 1, NULL, "--debug-gpumem", "\n\tEnable GPU memory stats in status bar", debug_mode_generic, (void *)G_DEBUG_GPU_MEM); | BLI_argsAdd(ba, 1, NULL, "--debug-gpumem", "\n\tEnable GPU memory stats in status bar", debug_mode_generic, (void *)G_DEBUG_GPU_MEM); | ||||
| BLI_argsAdd(ba, 1, NULL, "--enable-new-depsgraph", "\n\tUse new dependency graph", depsgraph_use_new, NULL); | BLI_argsAdd(ba, 1, NULL, "--enable-new-depsgraph", "\n\tUse new dependency graph", depsgraph_use_new, NULL); | ||||
| BLI_argsAdd(ba, 1, NULL, "--verbose", "<verbose>\n\tSet logging verbosity level.", set_verbosity, NULL); | BLI_argsAdd(ba, 1, NULL, "--verbose", "<verbose>\n\tSet logging verbosity level.", set_verbosity, NULL); | ||||
| BLI_argsAdd(ba, 1, NULL, "--factory-startup", "\n\tSkip reading the "STRINGIFY (BLENDER_STARTUP_FILE)" in the users home directory", set_factory_startup, NULL); | BLI_argsAdd(ba, 1, NULL, "--factory-startup", "\n\tSkip reading the " STRINGIFY(BLENDER_STARTUP_FILE) " in the users home directory", set_factory_startup, NULL); | ||||
| /* TODO, add user env vars? */ | /* TODO, add user env vars? */ | ||||
| BLI_argsAdd(ba, 1, NULL, "--env-system-datafiles", "\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_DATAFILES)" environment variable", set_env, NULL); | BLI_argsAdd(ba, 1, NULL, "--env-system-datafiles", "\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_DATAFILES)" environment variable", set_env, NULL); | ||||
| BLI_argsAdd(ba, 1, NULL, "--env-system-scripts", "\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_SCRIPTS)" environment variable", set_env, NULL); | BLI_argsAdd(ba, 1, NULL, "--env-system-scripts", "\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_SCRIPTS)" environment variable", set_env, NULL); | ||||
| BLI_argsAdd(ba, 1, NULL, "--env-system-python", "\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_PYTHON)" environment variable", set_env, NULL); | BLI_argsAdd(ba, 1, NULL, "--env-system-python", "\n\tSet the "STRINGIFY_ARG (BLENDER_SYSTEM_PYTHON)" environment variable", set_env, NULL); | ||||
| /* second pass: custom window stuff */ | /* second pass: custom window stuff */ | ||||
| BLI_argsAdd(ba, 2, "-p", "--window-geometry", "<sx> <sy> <w> <h>\n\tOpen with lower left corner at <sx>, <sy> and width and height as <w>, <h>", prefsize, NULL); | BLI_argsAdd(ba, 2, "-p", "--window-geometry", "<sx> <sy> <w> <h>\n\tOpen with lower left corner at <sx>, <sy> and width and height as <w>, <h>", prefsize, NULL); | ||||
| ▲ Show 20 Lines • Show All 382 Lines • Show Last 20 Lines | |||||