1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0030409: Data Exchange - exception during VRML file export

VrmlData_ShapeConvert::addShape() - handle case when parent node is NULL.
This commit is contained in:
kgv 2018-12-13 10:45:14 +03:00 committed by apn
parent eeabb8f86a
commit 7803c28d96
2 changed files with 18 additions and 4 deletions

View File

@ -683,7 +683,7 @@ void VrmlData_ShapeConvert::addShape (const Handle(VrmlData_Group)& theParent,
aShapeNode->SetAppearance(makeMaterialFromColor(aColorL, aColorTool)); aShapeNode->SetAppearance(makeMaterialFromColor(aColorL, aColorTool));
} }
myScene.AddNode(aShapeNode, Standard_False); myScene.AddNode(aShapeNode, theParent.IsNull() && aGroup.IsNull());
aShapeNode->SetGeometry(aTShapeNode); aShapeNode->SetGeometry(aTShapeNode);
if (aLoc.IsIdentity()) if (aLoc.IsIdentity())
{ {
@ -692,7 +692,7 @@ void VrmlData_ShapeConvert::addShape (const Handle(VrmlData_Group)& theParent,
{ {
aGroup->AddNode(aShapeNode); aGroup->AddNode(aShapeNode);
} }
else else if (!theParent.IsNull())
{ {
theParent->AddNode(aShapeNode); theParent->AddNode(aShapeNode);
} }
@ -709,12 +709,12 @@ void VrmlData_ShapeConvert::addShape (const Handle(VrmlData_Group)& theParent,
aTrsf.SetTranslationPart(aTransl); aTrsf.SetTranslationPart(aTransl);
} }
aTrans->SetTransform(aTrsf); aTrans->SetTransform(aTrsf);
myScene.AddNode(aTrans, Standard_False); myScene.AddNode(aTrans, theParent.IsNull() && aGroup.IsNull());
if (!aGroup.IsNull()) if (!aGroup.IsNull())
{ {
aGroup->AddNode(aTrans); aGroup->AddNode(aTrans);
} }
else else if (!theParent.IsNull())
{ {
theParent->AddNode(aTrans); theParent->AddNode(aTrans);
} }

14
tests/bugs/xde/bug30409 Normal file
View File

@ -0,0 +1,14 @@
puts "================"
puts "0030409: Data Exchange - e x c e p t i o n during VRML file export"
puts "================"
puts ""
pload XDE MODELING VISUALIZATION
box b 1 2 3
incmesh b 1
explode b F
XNewDoc D
XAddShape D b_1 0
WriteVrml D $imagedir/${casename}.wrl
loadvrml w $imagedir/${casename}.wrl
checktrinfo w -tri 2 -nod 4