MCPcopy Create free account
hub / github.com/Kitware/VTK / BuildMultiBlockDataSetFromScene

Function BuildMultiBlockDataSetFromScene

IO/Geometry/vtkGLTFReader.cxx:564–596  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

562
563//------------------------------------------------------------------------------
564bool BuildMultiBlockDataSetFromScene(vtkGLTFDocumentLoader::Model& m, vtkIdType sceneId,
565 vtkSmartPointer<vtkMultiBlockDataSet> dataSet, bool applyDeformations, int outputPointsPrecision)
566{
567 if (sceneId < 0 || sceneId >= static_cast<vtkIdType>(m.Scenes.size()))
568 {
569 vtkErrorWithObjectMacro(nullptr, "Invalid scene index " << sceneId);
570 return false;
571 }
572
573 vtkGLTFDocumentLoader::Scene scene = m.Scenes[sceneId];
574
575 bool createNewBlocks = (dataSet->GetNumberOfBlocks() == 0);
576
577 int blockId = 0;
578 for (int node : scene.Nodes)
579 {
580 std::string nodeDatasetName = "Node_" + vtk::to_string(node);
581 vtkSmartPointer<vtkMultiBlockDataSet> nodeDataset = nullptr;
582 if (!createNewBlocks)
583 {
584 // find existing child dataset for this node
585 nodeDataset = vtkMultiBlockDataSet::SafeDownCast(dataSet->GetBlock(blockId));
586 }
587 if (!BuildMultiBlockDataSetFromNode(
588 m, node, dataSet, nodeDataset, nodeDatasetName, applyDeformations, outputPointsPrecision))
589 {
590 vtkErrorWithObjectMacro(nullptr, "Could not build vtkMultiBlockDataSet from node " << node);
591 return false;
592 }
593 blockId++;
594 }
595 return true;
596}
597}
598
599//------------------------------------------------------------------------------

Callers 1

RequestDataMethod · 0.85

Calls 5

GetBlockMethod · 0.80
to_stringFunction · 0.50
sizeMethod · 0.45
GetNumberOfBlocksMethod · 0.45

Tested by

no test coverage detected