USD import: fix prim_path_mask storage.

Now accessing the prm_path_mask string property as
an allocated string, as the string is of arbitrary
length.
This commit is contained in:
Michael Kowalski 2022-12-14 12:18:08 -05:00
parent 27eea5e69e
commit edc59cefb6
3 changed files with 4 additions and 5 deletions

View File

@ -1119,8 +1119,7 @@ static int wm_usd_import_exec(bContext *C, wmOperator *op)
const bool create_collection = RNA_boolean_get(op->ptr, "create_collection");
char prim_path_mask[1024];
RNA_string_get(op->ptr, "prim_path_mask", prim_path_mask);
char *prim_path_mask = RNA_string_get_alloc(op->ptr, "prim_path_mask", NULL, 0, NULL);
const bool import_guide = RNA_boolean_get(op->ptr, "import_guide");
const bool import_proxy = RNA_boolean_get(op->ptr, "import_proxy");
@ -1198,8 +1197,6 @@ static int wm_usd_import_exec(bContext *C, wmOperator *op)
.import_shapes = import_shapes,
.import_defined_only = import_defined_only};
STRNCPY(params.prim_path_mask, prim_path_mask);
const bool ok = USD_import(C, filename, &params, as_background_job);
return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;

View File

@ -648,6 +648,8 @@ static void import_endjob(void *customdata)
break;
}
MEM_freeN(data->params.prim_path_mask);
WM_main_add_notifier(NC_SCENE | ND_FRAME, data->scene);
report_job_duration(data);
}

View File

@ -167,7 +167,7 @@ struct USDImportParams {
bool import_blendshapes;
bool import_volumes;
bool import_skeletons;
char prim_path_mask[1024];
char *prim_path_mask;
bool import_subdiv;
bool import_instance_proxies;
bool create_collection;