Added verbosity command line argument. Currently used for libmv only.

Usage: ./blender --verbose <level>

Also fixed some crashes when not passing number to --threads argument
or not passing file format to -F argument.
This commit is contained in:
Sergey Sharybin 2012-05-11 17:33:48 +00:00
parent e8e1a7cb9e
commit 1c0c2f4d0b

@ -603,7 +603,7 @@ static int set_engine(int argc, const char **argv, void *data)
static int set_image_type(int argc, const char **argv, void *data)
{
bContext *C = data;
if (argc >= 1) {
if (argc > 1) {
const char *imtype = argv[1];
Scene *scene = CTX_data_scene(C);
if (scene) {
@ -629,7 +629,7 @@ static int set_image_type(int argc, const char **argv, void *data)
static int set_threads(int argc, const char **argv, void *UNUSED(data))
{
if (argc >= 1) {
if (argc > 1) {
if (G.background) {
RE_set_max_threads(atoi(argv[1]));
}
@ -644,6 +644,21 @@ static int set_threads(int argc, const char **argv, void *UNUSED(data))
}
}
static int set_verbosity(int argc, const char **argv, void *UNUSED(data))
{
if (argc > 1) {
int level = atoi(argv[1]);
libmv_setLoggingVerbosity(level);
return 1;
}
else {
printf("\nError: you must specify a verbosity level.\n");
return 0;
}
}
static int set_extension(int argc, const char **argv, void *data)
{
bContext *C = data;
@ -1112,6 +1127,8 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
BLI_argsAdd(ba, 1, NULL, "--debug-libmv", "\n\tEnable debug messages from libmv library", debug_mode_libmv, NULL);
#endif
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);
/* TODO, add user env vars? */