1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0030811: Data Exchange, RWGltf_CafReader - fix inaccessibility of properties

Added missing Standard_EXPORT and getters.
Fixed metadata loss.
This commit is contained in:
kgv
2019-06-26 11:26:31 +03:00
committed by apn
parent d9dd07545d
commit 82c59511b4
6 changed files with 58 additions and 67 deletions

View File

@@ -215,6 +215,7 @@ Standard_Boolean RWGltf_CafReader::performMesh (const TCollection_AsciiString& t
aDoc.SetFilePath (theFile);
aDoc.SetProbeHeader (theToProbe);
aDoc.SetExternalFiles (myExternalFiles);
aDoc.SetMetadata (myMetadata);
aDoc.SetErrorPrefix (anErrPrefix);
aDoc.SetCoordinateSystemConverter (myCoordSysConverter);
if (!theToProbe)

View File

@@ -250,18 +250,23 @@ void RWGltf_GltfJsonParser::gltfParseAsset()
}
}
if (myMetadata == NULL)
{
return;
}
if (const RWGltf_JsonValue* aGenerator = findObjectMember (*anAsset, "generator"))
{
if (aGenerator->IsString())
{
myMetadata.Add ("generator", aGenerator->GetString());
myMetadata->Add ("generator", aGenerator->GetString());
}
}
if (const RWGltf_JsonValue* aCopyRight = findObjectMember (*anAsset, "copyright"))
{
if (aCopyRight->IsString())
{
myMetadata.Add ("copyright", aCopyRight->GetString());
myMetadata->Add ("copyright", aCopyRight->GetString());
}
}
}

View File

@@ -87,6 +87,9 @@ public:
//! Set list for storing external files.
void SetExternalFiles (NCollection_IndexedMap<TCollection_AsciiString>& theExternalFiles) { myExternalFiles = &theExternalFiles; }
//! Set metadata map.
void SetMetadata (TColStd_IndexedDataMapOfStringString& theMetadata) { myMetadata = &theMetadata; }
//! Return transformation from glTF to OCCT coordinate system.
const RWMesh_CoordinateSystemConverter& CoordinateSystemConverter() const { return myCSTrsf; }
@@ -105,9 +108,6 @@ public:
//! Parse glTF document.
Standard_EXPORT bool Parse (const Handle(Message_ProgressIndicator)& theProgress);
//! Return metadata map.
const TColStd_IndexedDataMapOfStringString& Metadata() const { return myMetadata; }
//! Return face list for loading triangulation.
NCollection_Vector<TopoDS_Face>& FaceList() { return myFaceList; }
@@ -387,8 +387,8 @@ protected:
NCollection_IndexedMap<TCollection_AsciiString>*
myExternalFiles; //!< list of external file references
RWMesh_CoordinateSystemConverter myCSTrsf; //!< transformation from glTF to OCCT coordinate system
TColStd_IndexedDataMapOfStringString* myMetadata; //!< file metadata
TColStd_IndexedDataMapOfStringString myMetadata; //!< file metadata
NCollection_DataMap<TCollection_AsciiString, Handle(RWGltf_MaterialMetallicRoughness)> myMaterialsPbr;
NCollection_DataMap<TCollection_AsciiString, Handle(RWGltf_MaterialCommon)> myMaterialsCommon;
NCollection_DataMap<TCollection_AsciiString, TopoDS_Shape> myShapeMap[2];

View File

@@ -79,12 +79,15 @@ public:
//! Add primitive array data element.
Standard_EXPORT RWGltf_GltfPrimArrayData& AddPrimArrayData (RWGltf_GltfArrayType theType);
//! Return bounding box defined within glTF file, or VOID if not specified.
const Bnd_Box& BoundingBox() const { return myBox; }
//! This method sets input bounding box and assigns a FAKE data to underlying Poly_Triangulation
//! as Min/Max corners of bounding box, so that standard tools like BRepBndLib::Add()
//! can be used transparently for computing bounding box of this face.
Standard_EXPORT void SetBoundingBox (const Bnd_Box& theBox);
private:
protected:
NCollection_Sequence<RWGltf_GltfPrimArrayData> myData;
Handle(RWGltf_MaterialMetallicRoughness) myMaterialPbr; //!< PBR material