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

0032612: Data Exchange, RWGltf_CafReader - lost hierarchy of two nested compounds

RWGltf_GltfJsonParser::gltfParseSceneNode() - prevent flattering of Scene nodes
(allow flattering only of Mesh nodes).

Added command XAutoNaming managing XCAFDoc_ShapeTool::SetAutoNaming().
Added comparisons with reference Xdump data to glTF tests.
This commit is contained in:
kgv
2021-10-11 22:05:58 +03:00
committed by smoskvin
parent 34043fc845
commit 16f9b46dbb
21 changed files with 1229 additions and 8 deletions

View File

@@ -1349,7 +1349,8 @@ bool RWGltf_GltfJsonParser::gltfParseSceneNode (TopoDS_Shape& theNodeShape,
}
}
if (aNbSubShapes == 1)
if (aChildShapes.IsEmpty()
&& aNbSubShapes == 1)
{
theNodeShape = TopoDS_Iterator (aNodeShape).Value();
}

View File

@@ -998,6 +998,42 @@ static Standard_Integer XGetProperties(Draw_Interpretor& di, Standard_Integer ar
return 0;
}
static Standard_Integer XAutoNaming (Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{
if (theNbArgs != 2 && theNbArgs != 3)
{
theDI << "Syntax error: wrong number of arguments";
return 1;
}
Handle(TDocStd_Document) aDoc;
DDocStd::GetDocument (theArgVec[1], aDoc);
if (aDoc.IsNull())
{
theDI << "Syntax error: '" << theArgVec[1] << "' is not a document";
return 1;
}
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
if (theNbArgs == 2)
{
theDI << (aShapeTool->AutoNaming() ? "1" : "0");
return 0;
}
bool toEnable = true;
if (!Draw::ParseOnOff (theArgVec[2], toEnable))
{
theDI << "Syntax error at '" << theArgVec[2] << "'";
return 1;
}
aShapeTool->SetAutoNaming (toEnable);
return 0;
}
//=======================================================================
//function : InitCommands
//purpose :
@@ -1113,4 +1149,7 @@ void XDEDRAW_Shapes::InitCommands(Draw_Interpretor& di)
di.Add("XGetProperties", "Doc Label \t: prints named properties assigned to the Label",
__FILE__, XGetProperties, g);
di.Add ("XAutoNaming","Doc [0|1]\t: Disable/enable autonaming to Document",
__FILE__, XAutoNaming, g);
}

View File

@@ -494,6 +494,9 @@ static Standard_Integer WriteGltf (Draw_Interpretor& theDI,
anApp->NewDocument (TCollection_ExtendedString ("BinXCAF"), aDoc);
Handle(XCAFDoc_ShapeTool) aShapeTool = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main());
// auto-naming doesn't generate meaningful instance names
//aShapeTool->SetAutoNaming (false);
aNodeNameFormat = RWMesh_NameFormat_Product;
aShapeTool->AddShape (aShape);
}
}