message: Fix race condition for spherical volumes too
diff: @@ -40,19 +40,16 @@ void RawImporter::importScene()
  auto volumeTypeExt = fileName.base().substr(last, fileName.base().length());
  auto rootNode = createNode(rootName, "transform");
  - NodePtr volumeImport;
  + NodePtr volume;
  - if (volumeTypeExt == ".spherical") {
  - auto volume = createNode(nodeName, "structuredSpherical");
  - for (auto &c : volumeParams->children())
  - volume->add(c.second);
  + bool isSpherical = volumeTypeExt == ".spherical";
  - auto sphericalVolume =
  - std::static_pointer_cast<StructuredSpherical>(volume);
  - sphericalVolume->load(fileName);
  - volumeImport = sphericalVolume;
  + if (isSpherical) {
  + volume = createNode(nodeName, "structuredSpherical");
  } else {
  - auto volume = createNode(nodeName, "structuredRegular");
  + volume = createNode(nodeName, "structuredRegular");
  + }
  +
  for (auto &c : volumeParams->children()) {
  // Need to make a copy of the volume parameter here. If multiple threads
  // are using the same VolumeParams children objects, then because of the
  @@ -78,17 +75,21 @@ void RawImporter::importScene()
  volume->createChild(p->name(), p->subType(), p->description(), p->value());
  }
  + if (isSpherical) {
  + auto sphericalVolume =
  + std::static_pointer_cast<StructuredSpherical>(volume);
  + sphericalVolume->load(fileName);
  + } else {
  auto structuredVolume = std::static_pointer_cast<StructuredVolume>(volume);
  structuredVolume->load(fileName);
  - volumeImport = structuredVolume;
  }
  auto tf = createNode("transferFunction", "transfer_function_turbo");
  - auto valueRange = volumeImport->child("valueRange").valueAs<range1f>();
  + auto valueRange = volume->child("valueRange").valueAs<range1f>();
  tf->child("valueRange") = valueRange.toVec2();
  - volumeImport->add(tf);
  + volume->add(tf);
  - rootNode->add(volumeImport);
  + rootNode->add(volume);
  auto name = "add raw volume from "s + fileName.str() + " to scene"s;
  scheduler->ospray()->push(name, [&, self, rootNode](SchedulerPtr scheduler) {
  