diff --git a/src/VrmlData/VrmlData_ShapeConvert.cxx b/src/VrmlData/VrmlData_ShapeConvert.cxx index eb717f0145..2b7373c201 100644 --- a/src/VrmlData/VrmlData_ShapeConvert.cxx +++ b/src/VrmlData/VrmlData_ShapeConvert.cxx @@ -683,7 +683,7 @@ void VrmlData_ShapeConvert::addShape (const Handle(VrmlData_Group)& theParent, aShapeNode->SetAppearance(makeMaterialFromColor(aColorL, aColorTool)); } - myScene.AddNode(aShapeNode, Standard_False); + myScene.AddNode(aShapeNode, theParent.IsNull() && aGroup.IsNull()); aShapeNode->SetGeometry(aTShapeNode); if (aLoc.IsIdentity()) { @@ -692,7 +692,7 @@ void VrmlData_ShapeConvert::addShape (const Handle(VrmlData_Group)& theParent, { aGroup->AddNode(aShapeNode); } - else + else if (!theParent.IsNull()) { theParent->AddNode(aShapeNode); } @@ -709,12 +709,12 @@ void VrmlData_ShapeConvert::addShape (const Handle(VrmlData_Group)& theParent, aTrsf.SetTranslationPart(aTransl); } aTrans->SetTransform(aTrsf); - myScene.AddNode(aTrans, Standard_False); + myScene.AddNode(aTrans, theParent.IsNull() && aGroup.IsNull()); if (!aGroup.IsNull()) { aGroup->AddNode(aTrans); } - else + else if (!theParent.IsNull()) { theParent->AddNode(aTrans); } diff --git a/tests/bugs/xde/bug30409 b/tests/bugs/xde/bug30409 new file mode 100644 index 0000000000..b37120f095 --- /dev/null +++ b/tests/bugs/xde/bug30409 @@ -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