USD Import: Support multiple prim path masks.
Extended the Prim Path option to support multiple path entries, delimited by commas, spaces or semicolons.
This commit is contained in:
parent
4d8c634820
commit
90f1d1f4b6
|
@ -383,8 +383,21 @@ static void import_startjob(void *customdata, short *stop, short *do_update, flo
|
|||
*data->do_update = true;
|
||||
*data->progress = 0.1f;
|
||||
|
||||
pxr::UsdStageRefPtr stage = pxr::UsdStage::Open(data->filepath);
|
||||
std::string prim_path_mask(data->params.prim_path_mask);
|
||||
pxr::UsdStagePopulationMask pop_mask;
|
||||
if (!prim_path_mask.empty()) {
|
||||
const std::vector<std::string> mask_tokens = pxr::TfStringTokenize(prim_path_mask, " ,;");
|
||||
for (const std::string &tok : mask_tokens) {
|
||||
pxr::SdfPath prim_path(tok);
|
||||
if (!prim_path.IsEmpty()) {
|
||||
pop_mask.Add(prim_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pxr::UsdStageRefPtr stage = pop_mask.IsEmpty() ?
|
||||
pxr::UsdStage::Open(data->filepath) :
|
||||
pxr::UsdStage::OpenMasked(data->filepath, pop_mask);
|
||||
if (!stage) {
|
||||
WM_reportf(RPT_ERROR, "USD Import: unable to open stage to read %s", data->filepath);
|
||||
data->import_ok = false;
|
||||
|
|
|
@ -353,19 +353,6 @@ void USDStageReader::collect_readers(Main *bmain)
|
|||
/* Iterate through the stage. */
|
||||
pxr::UsdPrim root = stage_->GetPseudoRoot();
|
||||
|
||||
std::string prim_path_mask(params_.prim_path_mask);
|
||||
|
||||
if (!prim_path_mask.empty()) {
|
||||
pxr::UsdPrim prim = stage_->GetPrimAtPath(pxr::SdfPath(prim_path_mask));
|
||||
if (prim.IsValid()) {
|
||||
root = prim;
|
||||
}
|
||||
else {
|
||||
std::cerr << "WARNING: Prim Path Mask " << prim_path_mask
|
||||
<< " does not specify a valid prim.\n";
|
||||
}
|
||||
}
|
||||
|
||||
stage_->SetInterpolationType(pxr::UsdInterpolationType::UsdInterpolationTypeHeld);
|
||||
|
||||
pxr::UsdGeomXformCache xf_cache;
|
||||
|
|
Loading…
Reference in New Issue