diff --git a/src/RWGltf/RWGltf_GltfJsonParser.cxx b/src/RWGltf/RWGltf_GltfJsonParser.cxx
index a77903cc6c..3423ebaee1 100644
--- a/src/RWGltf/RWGltf_GltfJsonParser.cxx
+++ b/src/RWGltf/RWGltf_GltfJsonParser.cxx
@@ -1349,7 +1349,8 @@ bool RWGltf_GltfJsonParser::gltfParseSceneNode (TopoDS_Shape& theNodeShape,
     }
   }
 
-  if (aNbSubShapes == 1)
+  if (aChildShapes.IsEmpty()
+   && aNbSubShapes == 1)
   {
     theNodeShape = TopoDS_Iterator (aNodeShape).Value();
   }
diff --git a/src/XDEDRAW/XDEDRAW_Shapes.cxx b/src/XDEDRAW/XDEDRAW_Shapes.cxx
index 4096d6b784..e8614d8765 100644
--- a/src/XDEDRAW/XDEDRAW_Shapes.cxx
+++ b/src/XDEDRAW/XDEDRAW_Shapes.cxx
@@ -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);
 }
diff --git a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx
index b73ec8fbe8..e1e85d3151 100644
--- a/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx
+++ b/src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx
@@ -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);
       }
     }
diff --git a/tests/de_mesh/begin b/tests/de_mesh/begin
index 60847cd28b..9953ccecfa 100644
--- a/tests/de_mesh/begin
+++ b/tests/de_mesh/begin
@@ -1 +1,18 @@
 cpulimit 1000
+
+# Trims spaces and removed empty lines within multi-line string.
+proc trimmedDump { theDump } {
+  set aDump {}
+  foreach aLineIter [split $theDump "\n"] { set aLine [string trimright $aLineIter]; if { $aLine != "" } { lappend aDump $aLine } }
+  return [join $aDump "\n"]
+}
+
+# Check Xdump results with reference data.
+proc checkXDump { theDoc theRefDump } {
+  puts "===== DUMP===="
+  set aDump [trimmedDump [uplevel #0 Xdump $theDoc]]
+  puts "=============="
+  if { $aDump != [trimmedDump $theRefDump] } {
+    puts "Error: unexpected document '$theDoc' structure\n===REF DUMP===\n$theRefDump\n=============="
+  }
+}
diff --git a/tests/de_mesh/gltf_read/boxinterleaved b/tests/de_mesh/gltf_read/boxinterleaved
index d309473ba4..6d13c7f1ec 100644
--- a/tests/de_mesh/gltf_read/boxinterleaved
+++ b/tests/de_mesh/gltf_read/boxinterleaved
@@ -31,5 +31,15 @@ close $fd
 
 ReadGltf D ${imagedir}/${casename}.gltf
 XGetOneShape s D
-checknbshapes s -face 1 -compound 0
+checknbshapes s -face 1 -compound 1
 checktrinfo s -tri 12 -nod 24
+
+set THE_REF_DUMP {
+INSTANCE COMPOUND 0:1:1:1 (refers to 0:1:1:2) "Mesh"
+PART COMPOUND 0:1:1:2 "Mesh"
+	FACE 0:1:1:2:1
+
+Free Shapes: 1
+INSTANCE COMPOUND  0:1:1:1 (refers to 0:1:1:2) "Mesh"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_read/brainstem b/tests/de_mesh/gltf_read/brainstem
index b9722120ad..35c1ffce66 100644
--- a/tests/de_mesh/gltf_read/brainstem
+++ b/tests/de_mesh/gltf_read/brainstem
@@ -4,5 +4,75 @@ puts "========"
 
 ReadGltf D [locate_data_file bug30691_BrainStem.gltf]
 XGetOneShape s D
-checknbshapes s -face 59 -compound 1
+checknbshapes s -face 59 -compound 2
 checktrinfo s -tri 61666 -nod 34159
+
+set THE_REF_DUMP {
+INSTANCE COMPOUND 0:1:1:1 (refers to 0:1:1:2) "Figure_2_geometry"
+ASSEMBLY COMPOUND 0:1:1:2 "Figure_2_geometry"
+	INSTANCE COMPOUND 0:1:1:2:1 (refers to 0:1:1:3) "Figure_2_geometry"
+PART COMPOUND 0:1:1:3 "Figure_2_geometry"
+	FACE 0:1:1:3:1
+	FACE 0:1:1:3:2
+	FACE 0:1:1:3:3
+	FACE 0:1:1:3:4
+	FACE 0:1:1:3:5
+	FACE 0:1:1:3:6
+	FACE 0:1:1:3:7
+	FACE 0:1:1:3:8
+	FACE 0:1:1:3:9
+	FACE 0:1:1:3:10
+	FACE 0:1:1:3:11
+	FACE 0:1:1:3:12
+	FACE 0:1:1:3:13
+	FACE 0:1:1:3:14
+	FACE 0:1:1:3:15
+	FACE 0:1:1:3:16
+	FACE 0:1:1:3:17
+	FACE 0:1:1:3:18
+	FACE 0:1:1:3:19
+	FACE 0:1:1:3:20
+	FACE 0:1:1:3:21
+	FACE 0:1:1:3:22
+	FACE 0:1:1:3:23
+	FACE 0:1:1:3:24
+	FACE 0:1:1:3:25
+	FACE 0:1:1:3:26
+	FACE 0:1:1:3:27
+	FACE 0:1:1:3:28
+	FACE 0:1:1:3:29
+	FACE 0:1:1:3:30
+	FACE 0:1:1:3:31
+	FACE 0:1:1:3:32
+	FACE 0:1:1:3:33
+	FACE 0:1:1:3:34
+	FACE 0:1:1:3:35
+	FACE 0:1:1:3:36
+	FACE 0:1:1:3:37
+	FACE 0:1:1:3:38
+	FACE 0:1:1:3:39
+	FACE 0:1:1:3:40
+	FACE 0:1:1:3:41
+	FACE 0:1:1:3:42
+	FACE 0:1:1:3:43
+	FACE 0:1:1:3:44
+	FACE 0:1:1:3:45
+	FACE 0:1:1:3:46
+	FACE 0:1:1:3:47
+	FACE 0:1:1:3:48
+	FACE 0:1:1:3:49
+	FACE 0:1:1:3:50
+	FACE 0:1:1:3:51
+	FACE 0:1:1:3:52
+	FACE 0:1:1:3:53
+	FACE 0:1:1:3:54
+	FACE 0:1:1:3:55
+	FACE 0:1:1:3:56
+	FACE 0:1:1:3:57
+	FACE 0:1:1:3:58
+	FACE 0:1:1:3:59
+
+Free Shapes: 1
+INSTANCE COMPOUND  0:1:1:1 (refers to 0:1:1:2) "Figure_2_geometry"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_read/buggy b/tests/de_mesh/gltf_read/buggy
index 3b7c76c6e7..625d4cf6a6 100644
--- a/tests/de_mesh/gltf_read/buggy
+++ b/tests/de_mesh/gltf_read/buggy
@@ -6,3 +6,401 @@ ReadGltf D [locate_data_file bug30691_Buggy.glb]
 XGetOneShape s D
 checknbshapes s -face 148 -compound 48
 checktrinfo s -tri 531955 -nod 412855
+
+set THE_REF_DUMP {
+INSTANCE COMPOUND 0:1:1:1 (refers to 0:1:1:2) "bug30691_Buggy.glb"
+
+ASSEMBLY COMPOUND 0:1:1:2 "bug30691_Buggy.glb"
+	INSTANCE FACE 0:1:1:2:1 (refers to 0:1:1:3) "body_1"
+	INSTANCE FACE 0:1:1:2:2 (refers to 0:1:1:4) "body_3"
+	INSTANCE FACE 0:1:1:2:3 (refers to 0:1:1:5) "body_5"
+	INSTANCE FACE 0:1:1:2:4 (refers to 0:1:1:6) "body_7"
+	INSTANCE FACE 0:1:1:2:5 (refers to 0:1:1:7) "body_9"
+	INSTANCE FACE 0:1:1:2:6 (refers to 0:1:1:8) "body_11"
+	INSTANCE FACE 0:1:1:2:7 (refers to 0:1:1:9) "body_13"
+	INSTANCE FACE 0:1:1:2:8 (refers to 0:1:1:10) "body_15"
+	INSTANCE FACE 0:1:1:2:9 (refers to 0:1:1:11) "body_17"
+	INSTANCE FACE 0:1:1:2:10 (refers to 0:1:1:12) "body_19"
+	INSTANCE FACE 0:1:1:2:11 (refers to 0:1:1:13) "body_21"
+	INSTANCE FACE 0:1:1:2:12 (refers to 0:1:1:14) "body_23"
+	INSTANCE FACE 0:1:1:2:13 (refers to 0:1:1:15) "body_25"
+	INSTANCE FACE 0:1:1:2:14 (refers to 0:1:1:16) "body_27"
+	INSTANCE FACE 0:1:1:2:15 (refers to 0:1:1:17) "body_29"
+	INSTANCE FACE 0:1:1:2:16 (refers to 0:1:1:18) "body_31"
+	INSTANCE FACE 0:1:1:2:17 (refers to 0:1:1:19) "body_33"
+	INSTANCE FACE 0:1:1:2:18 (refers to 0:1:1:20) "body_35"
+	INSTANCE FACE 0:1:1:2:19 (refers to 0:1:1:21) "body_37"
+	INSTANCE FACE 0:1:1:2:20 (refers to 0:1:1:22) "body_39"
+	INSTANCE FACE 0:1:1:2:21 (refers to 0:1:1:23) "body_41"
+	INSTANCE FACE 0:1:1:2:22 (refers to 0:1:1:24) "body_43"
+	INSTANCE FACE 0:1:1:2:23 (refers to 0:1:1:25) "body_45"
+	INSTANCE FACE 0:1:1:2:24 (refers to 0:1:1:26) "body_47"
+	INSTANCE FACE 0:1:1:2:25 (refers to 0:1:1:27) "body_49"
+	INSTANCE FACE 0:1:1:2:26 (refers to 0:1:1:28) "body_51"
+	INSTANCE FACE 0:1:1:2:27 (refers to 0:1:1:29) "body_52"
+	INSTANCE FACE 0:1:1:2:28 (refers to 0:1:1:29) "body_52"
+	INSTANCE FACE 0:1:1:2:29 (refers to 0:1:1:29) "body_52"
+	INSTANCE FACE 0:1:1:2:30 (refers to 0:1:1:30) "body_53"
+	INSTANCE FACE 0:1:1:2:31 (refers to 0:1:1:30) "body_53"
+	INSTANCE COMPOUND 0:1:1:2:32 (refers to 0:1:1:31) "prt_1_12_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:33 (refers to 0:1:1:32) "prt_1_12_SOLIDS_3"
+	INSTANCE COMPOUND 0:1:1:2:34 (refers to 0:1:1:33) "prt_1_16_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:35 (refers to 0:1:1:34) "prt_1_16_SOLIDS_3"
+	INSTANCE FACE 0:1:1:2:36 (refers to 0:1:1:35) "body_54"
+	INSTANCE FACE 0:1:1:2:37 (refers to 0:1:1:35) "body_54"
+	INSTANCE FACE 0:1:1:2:38 (refers to 0:1:1:36) "body_55"
+	INSTANCE FACE 0:1:1:2:39 (refers to 0:1:1:36) "body_55"
+	INSTANCE FACE 0:1:1:2:40 (refers to 0:1:1:36) "body_55"
+	INSTANCE FACE 0:1:1:2:41 (refers to 0:1:1:36) "body_55"
+	INSTANCE FACE 0:1:1:2:42 (refers to 0:1:1:36) "body_55"
+	INSTANCE FACE 0:1:1:2:43 (refers to 0:1:1:36) "body_55"
+	INSTANCE FACE 0:1:1:2:44 (refers to 0:1:1:36) "body_55"
+	INSTANCE FACE 0:1:1:2:45 (refers to 0:1:1:36) "body_55"
+	INSTANCE FACE 0:1:1:2:46 (refers to 0:1:1:36) "body_55"
+	INSTANCE FACE 0:1:1:2:47 (refers to 0:1:1:36) "body_55"
+	INSTANCE FACE 0:1:1:2:48 (refers to 0:1:1:37) "body_56"
+	INSTANCE FACE 0:1:1:2:49 (refers to 0:1:1:38) "body_57"
+	INSTANCE FACE 0:1:1:2:50 (refers to 0:1:1:38) "body_57"
+	INSTANCE FACE 0:1:1:2:51 (refers to 0:1:1:38) "body_57"
+	INSTANCE FACE 0:1:1:2:52 (refers to 0:1:1:38) "body_57"
+	INSTANCE FACE 0:1:1:2:53 (refers to 0:1:1:39) "body_58"
+	INSTANCE FACE 0:1:1:2:54 (refers to 0:1:1:39) "body_58"
+	INSTANCE COMPOUND 0:1:1:2:55 (refers to 0:1:1:40) "prt_1_6_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:56 (refers to 0:1:1:41) "prt_1_6_SOLIDS_3"
+	INSTANCE FACE 0:1:1:2:57 (refers to 0:1:1:42) "body_59"
+	INSTANCE FACE 0:1:1:2:58 (refers to 0:1:1:42) "body_59"
+	INSTANCE FACE 0:1:1:2:59 (refers to 0:1:1:42) "body_59"
+	INSTANCE FACE 0:1:1:2:60 (refers to 0:1:1:42) "body_59"
+	INSTANCE FACE 0:1:1:2:61 (refers to 0:1:1:43) "body_60"
+	INSTANCE FACE 0:1:1:2:62 (refers to 0:1:1:44) "body_61"
+	INSTANCE FACE 0:1:1:2:63 (refers to 0:1:1:45) "body_62"
+	INSTANCE FACE 0:1:1:2:64 (refers to 0:1:1:45) "body_62"
+	INSTANCE FACE 0:1:1:2:65 (refers to 0:1:1:45) "body_62"
+	INSTANCE COMPOUND 0:1:1:2:66 (refers to 0:1:1:46) "prt_2_8_t_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:67 (refers to 0:1:1:46) "prt_2_8_t_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:68 (refers to 0:1:1:47) "prt_2_8_t_SOLIDS_4"
+	INSTANCE FACE 0:1:1:2:69 (refers to 0:1:1:48) "body_63"
+	INSTANCE FACE 0:1:1:2:70 (refers to 0:1:1:49) "body_64"
+	INSTANCE FACE 0:1:1:2:71 (refers to 0:1:1:49) "body_64"
+	INSTANCE FACE 0:1:1:2:72 (refers to 0:1:1:49) "body_64"
+	INSTANCE FACE 0:1:1:2:73 (refers to 0:1:1:49) "body_64"
+	INSTANCE FACE 0:1:1:2:74 (refers to 0:1:1:49) "body_64"
+	INSTANCE FACE 0:1:1:2:75 (refers to 0:1:1:49) "body_64"
+	INSTANCE FACE 0:1:1:2:76 (refers to 0:1:1:49) "body_64"
+	INSTANCE FACE 0:1:1:2:77 (refers to 0:1:1:49) "body_64"
+	INSTANCE FACE 0:1:1:2:78 (refers to 0:1:1:50) "body_65"
+	INSTANCE FACE 0:1:1:2:79 (refers to 0:1:1:51) "body_66"
+	INSTANCE FACE 0:1:1:2:80 (refers to 0:1:1:51) "body_66"
+	INSTANCE FACE 0:1:1:2:81 (refers to 0:1:1:51) "body_66"
+	INSTANCE COMPOUND 0:1:1:2:82 (refers to 0:1:1:52) "technic_1_1_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:83 (refers to 0:1:1:52) "technic_1_1_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:84 (refers to 0:1:1:52) "technic_1_1_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:85 (refers to 0:1:1:53) "technic_1_1_p_SOLIDS_5"
+	INSTANCE FACE 0:1:1:2:86 (refers to 0:1:1:54) "body_67"
+	INSTANCE COMPOUND 0:1:1:2:87 (refers to 0:1:1:55) "technic_1_2_side_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:88 (refers to 0:1:1:56) "technic_1_2_side_p_SOLIDS_3"
+	INSTANCE FACE 0:1:1:2:89 (refers to 0:1:1:57) "body_68"
+	INSTANCE FACE 0:1:1:2:90 (refers to 0:1:1:58) "body_69"
+	INSTANCE COMPOUND 0:1:1:2:91 (refers to 0:1:1:59) "technic_bump_support_p_SOLIDS_1"
+	INSTANCE FACE 0:1:1:2:92 (refers to 0:1:1:60) "body_70"
+	INSTANCE FACE 0:1:1:2:93 (refers to 0:1:1:60) "body_70"
+	INSTANCE FACE 0:1:1:2:94 (refers to 0:1:1:60) "body_70"
+	INSTANCE COMPOUND 0:1:1:2:95 (refers to 0:1:1:61) "technic_shaft_x10_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:96 (refers to 0:1:1:62) "technic_shaft_x4_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:97 (refers to 0:1:1:62) "technic_shaft_x4_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:98 (refers to 0:1:1:63) "technic_shaft_x4_SOLIDS_4"
+	INSTANCE COMPOUND 0:1:1:2:99 (refers to 0:1:1:64) "technic_shaft_x8_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:100 (refers to 0:1:1:65) "technic_shaft_x8_SOLIDS_3"
+	INSTANCE FACE 0:1:1:2:101 (refers to 0:1:1:66) "body_71"
+	INSTANCE FACE 0:1:1:2:102 (refers to 0:1:1:67) "body_72"
+	INSTANCE FACE 0:1:1:2:103 (refers to 0:1:1:67) "body_72"
+	INSTANCE FACE 0:1:1:2:104 (refers to 0:1:1:67) "body_72"
+	INSTANCE FACE 0:1:1:2:105 (refers to 0:1:1:67) "body_72"
+	INSTANCE FACE 0:1:1:2:106 (refers to 0:1:1:67) "body_72"
+	INSTANCE FACE 0:1:1:2:107 (refers to 0:1:1:68) "body_73"
+	INSTANCE FACE 0:1:1:2:108 (refers to 0:1:1:68) "body_73"
+	INSTANCE FACE 0:1:1:2:109 (refers to 0:1:1:68) "body_73"
+	INSTANCE FACE 0:1:1:2:110 (refers to 0:1:1:68) "body_73"
+	INSTANCE FACE 0:1:1:2:111 (refers to 0:1:1:68) "body_73"
+	INSTANCE FACE 0:1:1:2:112 (refers to 0:1:1:69) "body_74"
+	INSTANCE FACE 0:1:1:2:113 (refers to 0:1:1:69) "body_74"
+	INSTANCE FACE 0:1:1:2:114 (refers to 0:1:1:69) "body_74"
+	INSTANCE COMPOUND 0:1:1:2:115 (refers to 0:1:1:70) "x_prt_1_2_a_u_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:2:116 (refers to 0:1:1:71) "x_prt_1_2_a_u_SOLIDS_3"
+	INSTANCE COMPOUND 0:1:1:2:117 (refers to 0:1:1:72) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:118 (refers to 0:1:1:75) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:119 (refers to 0:1:1:78) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:120 (refers to 0:1:1:82) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:121 (refers to 0:1:1:86) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:122 (refers to 0:1:1:107) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:123 (refers to 0:1:1:108) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:124 (refers to 0:1:1:109) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:125 (refers to 0:1:1:110) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:126 (refers to 0:1:1:111) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:127 (refers to 0:1:1:112) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:128 (refers to 0:1:1:113) "Compound"
+	INSTANCE COMPOUND 0:1:1:2:129 (refers to 0:1:1:114) "Compound"
+PART FACE 0:1:1:3 "body_1"
+PART FACE 0:1:1:4 "body_3"
+PART FACE 0:1:1:5 "body_5"
+PART FACE 0:1:1:6 "body_7"
+PART FACE 0:1:1:7 "body_9"
+PART FACE 0:1:1:8 "body_11"
+PART FACE 0:1:1:9 "body_13"
+PART FACE 0:1:1:10 "body_15"
+PART FACE 0:1:1:11 "body_17"
+PART FACE 0:1:1:12 "body_19"
+PART FACE 0:1:1:13 "body_21"
+PART FACE 0:1:1:14 "body_23"
+PART FACE 0:1:1:15 "body_25"
+PART FACE 0:1:1:16 "body_27"
+PART FACE 0:1:1:17 "body_29"
+PART FACE 0:1:1:18 "body_31"
+PART FACE 0:1:1:19 "body_33"
+PART FACE 0:1:1:20 "body_35"
+PART FACE 0:1:1:21 "body_37"
+PART FACE 0:1:1:22 "body_39"
+PART FACE 0:1:1:23 "body_41"
+PART FACE 0:1:1:24 "body_43"
+PART FACE 0:1:1:25 "body_45"
+PART FACE 0:1:1:26 "body_47"
+PART FACE 0:1:1:27 "body_49"
+PART FACE 0:1:1:28 "body_51"
+PART FACE 0:1:1:29 "body_52"
+PART FACE 0:1:1:30 "body_53"
+PART COMPOUND 0:1:1:31 "prt_1_12_SOLIDS_1"
+	FACE 0:1:1:31:1
+	FACE 0:1:1:31:2
+	FACE 0:1:1:31:3
+PART COMPOUND 0:1:1:32 "prt_1_12_SOLIDS_3"
+	FACE 0:1:1:32:1
+	FACE 0:1:1:32:2
+	FACE 0:1:1:32:3
+PART COMPOUND 0:1:1:33 "prt_1_16_SOLIDS_1"
+	FACE 0:1:1:33:1
+	FACE 0:1:1:33:2
+	FACE 0:1:1:33:3
+PART COMPOUND 0:1:1:34 "prt_1_16_SOLIDS_3"
+	FACE 0:1:1:34:1
+	FACE 0:1:1:34:2
+	FACE 0:1:1:34:3
+PART FACE 0:1:1:35 "body_54"
+PART FACE 0:1:1:36 "body_55"
+PART FACE 0:1:1:37 "body_56"
+PART FACE 0:1:1:38 "body_57"
+PART FACE 0:1:1:39 "body_58"
+PART COMPOUND 0:1:1:40 "prt_1_6_SOLIDS_1"
+	FACE 0:1:1:40:1
+	FACE 0:1:1:40:2
+PART COMPOUND 0:1:1:41 "prt_1_6_SOLIDS_3"
+	FACE 0:1:1:41:1
+	FACE 0:1:1:41:2
+PART FACE 0:1:1:42 "body_59"
+PART FACE 0:1:1:43 "body_60"
+PART FACE 0:1:1:44 "body_61"
+PART FACE 0:1:1:45 "body_62"
+PART COMPOUND 0:1:1:46 "prt_2_8_t_SOLIDS_1"
+	FACE 0:1:1:46:1
+	FACE 0:1:1:46:2
+PART COMPOUND 0:1:1:47 "prt_2_8_t_SOLIDS_4"
+	FACE 0:1:1:47:1
+	FACE 0:1:1:47:2
+PART FACE 0:1:1:48 "body_63"
+PART FACE 0:1:1:49 "body_64"
+PART FACE 0:1:1:50 "body_65"
+PART FACE 0:1:1:51 "body_66"
+PART COMPOUND 0:1:1:52 "technic_1_1_p_SOLIDS_1"
+	FACE 0:1:1:52:1
+	FACE 0:1:1:52:2
+PART COMPOUND 0:1:1:53 "technic_1_1_p_SOLIDS_5"
+	FACE 0:1:1:53:1
+	FACE 0:1:1:53:2
+PART FACE 0:1:1:54 "body_67"
+PART COMPOUND 0:1:1:55 "technic_1_2_side_p_SOLIDS_1"
+	FACE 0:1:1:55:1
+	FACE 0:1:1:55:2
+PART COMPOUND 0:1:1:56 "technic_1_2_side_p_SOLIDS_3"
+	FACE 0:1:1:56:1
+	FACE 0:1:1:56:2
+PART FACE 0:1:1:57 "body_68"
+PART FACE 0:1:1:58 "body_69"
+PART COMPOUND 0:1:1:59 "technic_bump_support_p_SOLIDS_1"
+	FACE 0:1:1:59:1
+	FACE 0:1:1:59:2
+PART FACE 0:1:1:60 "body_70"
+PART COMPOUND 0:1:1:61 "technic_shaft_x10_SOLIDS_1"
+	FACE 0:1:1:61:1
+	FACE 0:1:1:61:2
+PART COMPOUND 0:1:1:62 "technic_shaft_x4_SOLIDS_1"
+	FACE 0:1:1:62:1
+	FACE 0:1:1:62:2
+PART COMPOUND 0:1:1:63 "technic_shaft_x4_SOLIDS_4"
+	FACE 0:1:1:63:1
+	FACE 0:1:1:63:2
+PART COMPOUND 0:1:1:64 "technic_shaft_x8_SOLIDS_1"
+	FACE 0:1:1:64:1
+	FACE 0:1:1:64:2
+PART COMPOUND 0:1:1:65 "technic_shaft_x8_SOLIDS_3"
+	FACE 0:1:1:65:1
+	FACE 0:1:1:65:2
+PART FACE 0:1:1:66 "body_71"
+PART FACE 0:1:1:67 "body_72"
+PART FACE 0:1:1:68 "body_73"
+PART FACE 0:1:1:69 "body_74"
+PART COMPOUND 0:1:1:70 "x_prt_1_2_a_u_SOLIDS_1"
+	FACE 0:1:1:70:1
+	FACE 0:1:1:70:2
+PART COMPOUND 0:1:1:71 "x_prt_1_2_a_u_SOLIDS_3"
+	FACE 0:1:1:71:1
+	FACE 0:1:1:71:2
+ASSEMBLY COMPOUND 0:1:1:72 "Compound"
+	INSTANCE COMPOUND 0:1:1:72:1 (refers to 0:1:1:73) "tech_light_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:72:2 (refers to 0:1:1:74) "technic_2_2_l_p_SOLIDS_1"
+PART COMPOUND 0:1:1:73 "tech_light_p_SOLIDS_1"
+	FACE 0:1:1:73:1
+	FACE 0:1:1:73:2
+PART COMPOUND 0:1:1:74 "technic_2_2_l_p_SOLIDS_1"
+	FACE 0:1:1:74:1
+	FACE 0:1:1:74:2
+ASSEMBLY COMPOUND 0:1:1:75 "Compound"
+	INSTANCE COMPOUND 0:1:1:75:1 (refers to 0:1:1:76) "tech_light_p_SOLIDS_3"
+	INSTANCE COMPOUND 0:1:1:75:2 (refers to 0:1:1:77) "technic_2_2_l_p_SOLIDS_3"
+PART COMPOUND 0:1:1:76 "tech_light_p_SOLIDS_3"
+	FACE 0:1:1:76:1
+	FACE 0:1:1:76:2
+PART COMPOUND 0:1:1:77 "technic_2_2_l_p_SOLIDS_3"
+	FACE 0:1:1:77:1
+	FACE 0:1:1:77:2
+ASSEMBLY COMPOUND 0:1:1:78 "Compound"
+	INSTANCE FACE 0:1:1:78:1 (refers to 0:1:1:79) "body_76"
+	INSTANCE FACE 0:1:1:78:2 (refers to 0:1:1:80) "body_78"
+	INSTANCE FACE 0:1:1:78:3 (refers to 0:1:1:81) "body_79"
+	INSTANCE COMPOUND 0:1:1:78:4 (refers to 0:1:1:64) "technic_shaft_x8_SOLIDS_1"
+PART FACE 0:1:1:79 "body_76"
+PART FACE 0:1:1:80 "body_78"
+PART FACE 0:1:1:81 "body_79"
+ASSEMBLY COMPOUND 0:1:1:82 "Compound"
+	INSTANCE FACE 0:1:1:82:1 (refers to 0:1:1:83) "body_81"
+	INSTANCE FACE 0:1:1:82:2 (refers to 0:1:1:84) "body_82"
+	INSTANCE COMPOUND 0:1:1:82:3 (refers to 0:1:1:85) "technic_shaft_x6_SOLIDS_1"
+	INSTANCE FACE 0:1:1:82:4 (refers to 0:1:1:66) "body_71"
+	INSTANCE FACE 0:1:1:82:5 (refers to 0:1:1:66) "body_71"
+	INSTANCE FACE 0:1:1:82:6 (refers to 0:1:1:66) "body_71"
+PART FACE 0:1:1:83 "body_81"
+PART FACE 0:1:1:84 "body_82"
+PART COMPOUND 0:1:1:85 "technic_shaft_x6_SOLIDS_1"
+	FACE 0:1:1:85:1
+	FACE 0:1:1:85:2
+ASSEMBLY COMPOUND 0:1:1:86 "Compound"
+	INSTANCE FACE 0:1:1:86:1 (refers to 0:1:1:87) "body_84"
+	INSTANCE FACE 0:1:1:86:2 (refers to 0:1:1:88) "body_86"
+	INSTANCE FACE 0:1:1:86:3 (refers to 0:1:1:89) "body_88"
+	INSTANCE FACE 0:1:1:86:4 (refers to 0:1:1:90) "body_90"
+	INSTANCE FACE 0:1:1:86:5 (refers to 0:1:1:91) "body_92"
+	INSTANCE FACE 0:1:1:86:6 (refers to 0:1:1:92) "body_94"
+	INSTANCE FACE 0:1:1:86:7 (refers to 0:1:1:93) "body_96"
+	INSTANCE COMPOUND 0:1:1:86:8 (refers to 0:1:1:94) "technic_driver_arm_joint_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:86:9 (refers to 0:1:1:94) "technic_driver_arm_joint_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:86:10 (refers to 0:1:1:94) "technic_driver_arm_joint_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:86:11 (refers to 0:1:1:95) "technic_driver_arm_joint_p_SOLIDS_5"
+	INSTANCE FACE 0:1:1:86:12 (refers to 0:1:1:96) "body_97"
+	INSTANCE FACE 0:1:1:86:13 (refers to 0:1:1:96) "body_97"
+	INSTANCE FACE 0:1:1:86:14 (refers to 0:1:1:96) "body_97"
+	INSTANCE FACE 0:1:1:86:15 (refers to 0:1:1:97) "body_98"
+	INSTANCE FACE 0:1:1:86:16 (refers to 0:1:1:97) "body_98"
+	INSTANCE FACE 0:1:1:86:17 (refers to 0:1:1:97) "body_98"
+	INSTANCE FACE 0:1:1:86:18 (refers to 0:1:1:98) "body_99"
+	INSTANCE FACE 0:1:1:86:19 (refers to 0:1:1:99) "body_100"
+	INSTANCE COMPOUND 0:1:1:86:20 (refers to 0:1:1:100) "technic_driver_head_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:86:21 (refers to 0:1:1:101) "technic_driver_helmet_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:86:22 (refers to 0:1:1:102) "technic_driver_hip_joint_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:86:23 (refers to 0:1:1:103) "technic_driver_shin_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:86:24 (refers to 0:1:1:104) "technic_driver_shin_p_SOLIDS_3"
+	INSTANCE COMPOUND 0:1:1:86:25 (refers to 0:1:1:105) "technic_driver_thigh_l_p_SOLIDS_1"
+	INSTANCE COMPOUND 0:1:1:86:26 (refers to 0:1:1:106) "technic_driver_torso_p_SOLIDS_1"
+PART FACE 0:1:1:87 "body_84"
+PART FACE 0:1:1:88 "body_86"
+PART FACE 0:1:1:89 "body_88"
+PART FACE 0:1:1:90 "body_90"
+PART FACE 0:1:1:91 "body_92"
+PART FACE 0:1:1:92 "body_94"
+PART FACE 0:1:1:93 "body_96"
+PART COMPOUND 0:1:1:94 "technic_driver_arm_joint_p_SOLIDS_1"
+	FACE 0:1:1:94:1
+	FACE 0:1:1:94:2
+PART COMPOUND 0:1:1:95 "technic_driver_arm_joint_p_SOLIDS_5"
+	FACE 0:1:1:95:1
+	FACE 0:1:1:95:2
+PART FACE 0:1:1:96 "body_97"
+PART FACE 0:1:1:97 "body_98"
+PART FACE 0:1:1:98 "body_99"
+PART FACE 0:1:1:99 "body_100"
+PART COMPOUND 0:1:1:100 "technic_driver_head_p_SOLIDS_1"
+	FACE 0:1:1:100:1
+	FACE 0:1:1:100:2
+	FACE 0:1:1:100:3
+PART COMPOUND 0:1:1:101 "technic_driver_helmet_p_SOLIDS_1"
+	FACE 0:1:1:101:1
+	FACE 0:1:1:101:2
+PART COMPOUND 0:1:1:102 "technic_driver_hip_joint_p_SOLIDS_1"
+	FACE 0:1:1:102:1
+	FACE 0:1:1:102:2
+PART COMPOUND 0:1:1:103 "technic_driver_shin_p_SOLIDS_1"
+	FACE 0:1:1:103:1
+	FACE 0:1:1:103:2
+PART COMPOUND 0:1:1:104 "technic_driver_shin_p_SOLIDS_3"
+	FACE 0:1:1:104:1
+	FACE 0:1:1:104:2
+PART COMPOUND 0:1:1:105 "technic_driver_thigh_l_p_SOLIDS_1"
+	FACE 0:1:1:105:1
+	FACE 0:1:1:105:2
+PART COMPOUND 0:1:1:106 "technic_driver_torso_p_SOLIDS_1"
+	FACE 0:1:1:106:1
+	FACE 0:1:1:106:2
+PART COMPOUND 0:1:1:107 "Compound"
+	FACE 0:1:1:107:1 "body_102"
+	FACE 0:1:1:107:2 "body_104"
+	FACE 0:1:1:107:3 "body_106"
+	FACE 0:1:1:107:4 "body_107"
+	FACE 0:1:1:107:5 "body_107"
+	FACE 0:1:1:107:6 "body_108"
+	FACE 0:1:1:107:7 "body_72"
+	FACE 0:1:1:107:8 "body_72"
+PART COMPOUND 0:1:1:108 "Compound"
+	FACE 0:1:1:108:1 "body_109"
+	FACE 0:1:1:108:2 "body_107"
+	FACE 0:1:1:108:3 "body_107"
+	FACE 0:1:1:108:4 "body_107"
+	FACE 0:1:1:108:5 "body_108"
+	FACE 0:1:1:108:6 "body_108"
+	FACE 0:1:1:108:7 "body_72"
+	FACE 0:1:1:108:8 "body_72"
+PART COMPOUND 0:1:1:109 "Compound"
+	FACE 0:1:1:109:1 "body_111"
+	FACE 0:1:1:109:2 "body_113"
+	FACE 0:1:1:109:3 "body_72"
+PART COMPOUND 0:1:1:110 "Compound"
+	FACE 0:1:1:110:1 "body_114"
+	FACE 0:1:1:110:2 "body_72"
+	FACE 0:1:1:110:3 "body_115"
+PART COMPOUND 0:1:1:111 "Compound"
+	FACE 0:1:1:111:1 "body_114"
+	FACE 0:1:1:111:2 "body_72"
+	FACE 0:1:1:111:3 "body_115"
+PART COMPOUND 0:1:1:112 "Compound"
+	FACE 0:1:1:112:1 "body_114"
+	FACE 0:1:1:112:2 "body_72"
+	FACE 0:1:1:112:3 "body_115"
+PART COMPOUND 0:1:1:113 "Compound"
+	FACE 0:1:1:113:1 "body_114"
+	FACE 0:1:1:113:2 "body_72"
+	FACE 0:1:1:113:3 "body_115"
+PART COMPOUND 0:1:1:114 "Compound"
+	FACE 0:1:1:114:1 "body_114"
+	FACE 0:1:1:114:2 "body_72"
+	FACE 0:1:1:114:3 "body_115"
+
+Free Shapes: 1
+INSTANCE COMPOUND  0:1:1:1 (refers to 0:1:1:2) "bug30691_Buggy.glb"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_read/cubeemb b/tests/de_mesh/gltf_read/cubeemb
index 67961d11cf..9a9cc0fe51 100644
--- a/tests/de_mesh/gltf_read/cubeemb
+++ b/tests/de_mesh/gltf_read/cubeemb
@@ -42,3 +42,12 @@ ReadGltf D ${imagedir}/${casename}.gltf
 XGetOneShape s D
 checknbshapes s -face 1 -compound 0
 checktrinfo s -tri 12 -nod 24
+
+set THE_REF_DUMP {
+INSTANCE FACE 0:1:1:1 (refers to 0:1:1:2) "Cube"
+PART FACE 0:1:1:2 "Cube"
+
+Free Shapes: 1
+INSTANCE FACE  0:1:1:1 (refers to 0:1:1:2) "Cube"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_read/engine b/tests/de_mesh/gltf_read/engine
index cd152b8e13..acd332ca20 100644
--- a/tests/de_mesh/gltf_read/engine
+++ b/tests/de_mesh/gltf_read/engine
@@ -6,3 +6,135 @@ ReadGltf D [locate_data_file bug30691_2CylinderEngine.glb]
 XGetOneShape s D
 checknbshapes s -face 34 -compound 18
 checktrinfo s -tri 121496 -nod 84657
+
+set THE_REF_DUMP {
+ASSEMBLY COMPOUND 0:1:1:1 "bug30691_2CylinderEngine.glb"
+	INSTANCE FACE 0:1:1:1:1 (refers to 0:1:1:2) "body"
+	INSTANCE FACE 0:1:1:1:2 (refers to 0:1:1:2) "body"
+	INSTANCE COMPOUND 0:1:1:1:3 (refers to 0:1:1:3) "Lifter_123-923_0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:1:4 (refers to 0:1:1:3) "Lifter_123-923_0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:1:5 (refers to 0:1:1:3) "Lifter_123-923_0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:1:6 (refers to 0:1:1:3) "Lifter_123-923_0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:1:7 (refers to 0:1:1:4) "rod_123-699_0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:1:8 (refers to 0:1:1:4) "rod_123-699_0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:1:9 (refers to 0:1:1:5) "Compound"
+	INSTANCE COMPOUND 0:1:1:1:10 (refers to 0:1:1:31) "Compound"
+	INSTANCE COMPOUND 0:1:1:1:11 (refers to 0:1:1:32) "Compound"
+	INSTANCE COMPOUND 0:1:1:1:12 (refers to 0:1:1:33) "Compound"
+	INSTANCE COMPOUND 0:1:1:1:13 (refers to 0:1:1:36) "Compound"
+PART FACE 0:1:1:2 "body"
+PART COMPOUND 0:1:1:3 "Lifter_123-923_0_Parts_1"
+	FACE 0:1:1:3:1
+	FACE 0:1:1:3:2
+PART COMPOUND 0:1:1:4 "rod_123-699_0_Parts_1"
+	FACE 0:1:1:4:1
+	FACE 0:1:1:4:2
+ASSEMBLY COMPOUND 0:1:1:5 "Compound"
+	INSTANCE FACE 0:1:1:5:1 (refers to 0:1:1:6) "Face"
+	INSTANCE FACE 0:1:1:5:2 (refers to 0:1:1:7) "body_2"
+	INSTANCE FACE 0:1:1:5:3 (refers to 0:1:1:8) "body_3"
+	INSTANCE FACE 0:1:1:5:4 (refers to 0:1:1:2) "body"
+	INSTANCE FACE 0:1:1:5:5 (refers to 0:1:1:2) "body"
+	INSTANCE FACE 0:1:1:5:6 (refers to 0:1:1:9) "body_4"
+	INSTANCE FACE 0:1:1:5:7 (refers to 0:1:1:10) "body_5"
+	INSTANCE FACE 0:1:1:5:8 (refers to 0:1:1:11) "body_6"
+	INSTANCE COMPOUND 0:1:1:5:9 (refers to 0:1:1:12) "Compound"
+PART FACE 0:1:1:6 "Face"
+PART FACE 0:1:1:7 "body_2"
+PART FACE 0:1:1:8 "body_3"
+PART FACE 0:1:1:9 "body_4"
+PART FACE 0:1:1:10 "body_5"
+PART FACE 0:1:1:11 "body_6"
+ASSEMBLY COMPOUND 0:1:1:12 "Compound"
+	INSTANCE FACE 0:1:1:12:1 (refers to 0:1:1:13) "body_7"
+	INSTANCE FACE 0:1:1:12:2 (refers to 0:1:1:13) "body_7"
+	INSTANCE FACE 0:1:1:12:3 (refers to 0:1:1:14) "body_8"
+	INSTANCE FACE 0:1:1:12:4 (refers to 0:1:1:15) "body_9"
+	INSTANCE FACE 0:1:1:12:5 (refers to 0:1:1:16) "body_10"
+	INSTANCE FACE 0:1:1:12:6 (refers to 0:1:1:17) "body_11"
+	INSTANCE FACE 0:1:1:12:7 (refers to 0:1:1:18) "body_12"
+	INSTANCE FACE 0:1:1:12:8 (refers to 0:1:1:19) "body_13"
+	INSTANCE FACE 0:1:1:12:9 (refers to 0:1:1:19) "body_13"
+	INSTANCE COMPOUND 0:1:1:12:10 (refers to 0:1:1:20) "Compound"
+	INSTANCE COMPOUND 0:1:1:12:11 (refers to 0:1:1:24) "Compound"
+	INSTANCE COMPOUND 0:1:1:12:12 (refers to 0:1:1:29) "Compound"
+PART FACE 0:1:1:13 "body_7"
+PART FACE 0:1:1:14 "body_8"
+PART FACE 0:1:1:15 "body_9"
+PART FACE 0:1:1:16 "body_10"
+PART FACE 0:1:1:17 "body_11"
+PART FACE 0:1:1:18 "body_12"
+PART FACE 0:1:1:19 "body_13"
+ASSEMBLY COMPOUND 0:1:1:20 "Compound"
+	INSTANCE FACE 0:1:1:20:1 (refers to 0:1:1:21) "body_14"
+	INSTANCE FACE 0:1:1:20:2 (refers to 0:1:1:21) "body_14"
+	INSTANCE COMPOUND 0:1:1:20:3 (refers to 0:1:1:22) "Compound"
+	INSTANCE COMPOUND 0:1:1:20:4 (refers to 0:1:1:23) "Compound"
+PART FACE 0:1:1:21 "body_14"
+PART COMPOUND 0:1:1:22 "Compound"
+	FACE 0:1:1:22:1 "body_15"
+	FACE 0:1:1:22:2 "body_15"
+	FACE 0:1:1:22:3 "body_16"
+	FACE 0:1:1:22:4 "body_17"
+PART COMPOUND 0:1:1:23 "Compound"
+	FACE 0:1:1:23:1 "body_15"
+	FACE 0:1:1:23:2 "body_15"
+	FACE 0:1:1:23:3 "body_16"
+	FACE 0:1:1:23:4 "body_17"
+ASSEMBLY COMPOUND 0:1:1:24 "Compound"
+	INSTANCE FACE 0:1:1:24:1 (refers to 0:1:1:25) "body_18"
+	INSTANCE FACE 0:1:1:24:2 (refers to 0:1:1:26) "body_19"
+	INSTANCE COMPOUND 0:1:1:24:3 (refers to 0:1:1:27) "Spring_Link__0_Parts_1"
+PART FACE 0:1:1:25 "body_18"
+PART FACE 0:1:1:26 "body_19"
+ASSEMBLY COMPOUND 0:1:1:27 "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:27:1 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:27:2 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:27:3 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:27:4 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:27:5 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:27:6 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:27:7 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:27:8 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:27:9 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:27:10 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+PART COMPOUND 0:1:1:28 "Spring_Link__0_Parts_1"
+	FACE 0:1:1:28:1
+	FACE 0:1:1:28:2
+	FACE 0:1:1:28:3
+ASSEMBLY COMPOUND 0:1:1:29 "Compound"
+	INSTANCE FACE 0:1:1:29:1 (refers to 0:1:1:25) "body_18"
+	INSTANCE FACE 0:1:1:29:2 (refers to 0:1:1:26) "body_19"
+	INSTANCE COMPOUND 0:1:1:29:3 (refers to 0:1:1:30) "Spring_Link__0_Parts_1"
+ASSEMBLY COMPOUND 0:1:1:30 "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:30:1 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:30:2 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:30:3 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:30:4 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:30:5 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:30:6 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:30:7 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:30:8 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:30:9 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+	INSTANCE COMPOUND 0:1:1:30:10 (refers to 0:1:1:28) "Spring_Link__0_Parts_1"
+PART COMPOUND 0:1:1:31 "Compound"
+	FACE 0:1:1:31:1 "body_20"
+	FACE 0:1:1:31:2 "body_21"
+PART COMPOUND 0:1:1:32 "Compound"
+	FACE 0:1:1:32:1 "body_22"
+	FACE 0:1:1:32:2 "body_23"
+ASSEMBLY COMPOUND 0:1:1:33 "Compound"
+	INSTANCE FACE 0:1:1:33:1 (refers to 0:1:1:34) "body_24"
+	INSTANCE COMPOUND 0:1:1:33:2 (refers to 0:1:1:35) "Piston_123-844_0_Parts_1"
+PART FACE 0:1:1:34 "body_24"
+PART COMPOUND 0:1:1:35 "Piston_123-844_0_Parts_1"
+	FACE 0:1:1:35:1
+	FACE 0:1:1:35:2
+ASSEMBLY COMPOUND 0:1:1:36 "Compound"
+	INSTANCE FACE 0:1:1:36:1 (refers to 0:1:1:34) "body_24"
+	INSTANCE COMPOUND 0:1:1:36:2 (refers to 0:1:1:35) "Piston_123-844_0_Parts_1"
+
+Free Shapes: 1
+ASSEMBLY COMPOUND  0:1:1:1 "bug30691_2CylinderEngine.glb"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_read/helmet b/tests/de_mesh/gltf_read/helmet
index e03aa51473..c54d675558 100644
--- a/tests/de_mesh/gltf_read/helmet
+++ b/tests/de_mesh/gltf_read/helmet
@@ -6,3 +6,12 @@ ReadGltf D [locate_data_file bug30691_DamagedHelmet.gltf]
 XGetOneShape s D
 checknbshapes s -face 1 -compound 0
 checktrinfo s -tri 15452 -nod 14556
+
+set THE_REF_DUMP {
+INSTANCE FACE 0:1:1:1 (refers to 0:1:1:2) "node_damagedHelmet_-6514"
+PART FACE 0:1:1:2 "mesh_helmet_LP_13930damagedHelmet"
+
+Free Shapes: 1
+INSTANCE FACE  0:1:1:1 (refers to 0:1:1:2) "node_damagedHelmet_-6514"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_read/lantern b/tests/de_mesh/gltf_read/lantern
index d9d1f791d2..e4f4158ded 100644
--- a/tests/de_mesh/gltf_read/lantern
+++ b/tests/de_mesh/gltf_read/lantern
@@ -6,3 +6,18 @@ ReadGltf D [locate_data_file bug30691_Lantern.glb]
 XGetOneShape s D
 checknbshapes s -face 3 -compound 1
 checktrinfo s -tri 5394 -nod 4145
+
+set THE_REF_DUMP {
+INSTANCE COMPOUND 0:1:1:1 (refers to 0:1:1:2) "Lantern"
+ASSEMBLY COMPOUND 0:1:1:2 "Lantern"
+	INSTANCE FACE 0:1:1:2:1 (refers to 0:1:1:3) "LanternPole_Body"
+	INSTANCE FACE 0:1:1:2:2 (refers to 0:1:1:4) "LanternPole_Chain"
+	INSTANCE FACE 0:1:1:2:3 (refers to 0:1:1:5) "LanternPole_Lantern"
+PART FACE 0:1:1:3 "LanternPole_Body"
+PART FACE 0:1:1:4 "LanternPole_Chain"
+PART FACE 0:1:1:5 "LanternPole_Lantern"
+
+Free Shapes: 1
+INSTANCE COMPOUND  0:1:1:1 (refers to 0:1:1:2) "Lantern"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_read/launchvehicle b/tests/de_mesh/gltf_read/launchvehicle
index 26b108fa9c..f3590ade28 100644
--- a/tests/de_mesh/gltf_read/launchvehicle
+++ b/tests/de_mesh/gltf_read/launchvehicle
@@ -4,12 +4,101 @@ puts "========"
 
 ReadGltf D [locate_data_file bug31706_launchvehicle.glb]
 XGetOneShape s D
-checknbshapes s -face 9 -compound 13
+checknbshapes s -face 9 -compound 22
 checktrinfo s -tri 47640 -nod 35270
 
-if { [XDumpLocation D 0:1:1:15:5] != "Transformation (3 rows * 4 columns matrix): (1,0,0,0) (0,1,0,-3350) (0,0,1,-2700)" } {
+if { [XDumpLocation D 0:1:1:22:5] != "Transformation (3 rows * 4 columns matrix): (1,0,0,0) (0,1,0,-3350) (0,0,1,-2700)" } {
   puts "Error: wrong location of D:Root/CentaurBody/Fairing1"
 }
-if { [XDumpLocation D 0:1:1:15:6] != "Transformation (3 rows * 4 columns matrix): (-1,-0,-1.50996e-07,0.000407689) (0,1,0,-3350) (1.50996e-07,0,-1,2700)" } {
+if { [XDumpLocation D 0:1:1:22:6] != "Transformation (3 rows * 4 columns matrix): (-1,-0,-1.50996e-07,0) (0,1,0,8000) (1.50996e-07,0,-1,0)" } {
   puts "Error: wrong location of D:Root/CentaurBody/FairingFlipper_180_Y"
 }
+if { [XDumpLocation D 0:1:1:29:1] != "Transformation (3 rows * 4 columns matrix): (1,0,0,0) (0,1,0,-11350) (0,0,1,-2700)" } {
+  puts "Error: wrong location of D:Root/CentaurBody/FairingFlipper_180_Y/Fairing2"
+}
+
+set THE_REF_DUMP {
+ASSEMBLY COMPOUND 0:1:1:1 "Root"
+	INSTANCE COMPOUND 0:1:1:1:1 (refers to 0:1:1:2) "Booster"
+	INSTANCE COMPOUND 0:1:1:1:2 (refers to 0:1:1:22) "CentaurBody"
+	INSTANCE FACE 0:1:1:1:3 (refers to 0:1:1:31) "InterstageAdapter"
+ASSEMBLY COMPOUND 0:1:1:2 "Booster"
+	INSTANCE COMPOUND 0:1:1:2:1 (refers to 0:1:1:3) "BoosterEng2_Parent"
+	INSTANCE COMPOUND 0:1:1:2:2 (refers to 0:1:1:7) "BoosterEngine1"
+	INSTANCE COMPOUND 0:1:1:2:3 (refers to 0:1:1:8) "SRB_1_Parent"
+	INSTANCE COMPOUND 0:1:1:2:4 (refers to 0:1:1:11) "SRB_2_Parent"
+	INSTANCE COMPOUND 0:1:1:2:5 (refers to 0:1:1:13) "SRB_3_Parent"
+	INSTANCE COMPOUND 0:1:1:2:6 (refers to 0:1:1:15) "SRB_4_Parent"
+	INSTANCE COMPOUND 0:1:1:2:7 (refers to 0:1:1:17) "SRB_5_Parent"
+	INSTANCE COMPOUND 0:1:1:2:8 (refers to 0:1:1:19) "SRB_6_Parent"
+	INSTANCE FACE 0:1:1:2:9 (refers to 0:1:1:21) "BoosterMesh"
+ASSEMBLY COMPOUND 0:1:1:3 "BoosterEng2_Parent"
+	INSTANCE COMPOUND 0:1:1:3:1 (refers to 0:1:1:4) "BoosterEngine2"
+ASSEMBLY COMPOUND 0:1:1:4 "BoosterEngine2"
+	INSTANCE FACE 0:1:1:4:1 (refers to 0:1:1:5) "Flame_Booster2"
+	INSTANCE FACE 0:1:1:4:2 (refers to 0:1:1:6) "BoosterEngineMesh"
+PART FACE 0:1:1:5 "LongFlameMesh"
+PART FACE 0:1:1:6 "BoosterEngineMesh"
+ASSEMBLY COMPOUND 0:1:1:7 "BoosterEngine1"
+	INSTANCE FACE 0:1:1:7:1 (refers to 0:1:1:5) "Flame_Booster1"
+	INSTANCE FACE 0:1:1:7:2 (refers to 0:1:1:6) "BoosterEngineMesh"
+ASSEMBLY COMPOUND 0:1:1:8 "SRB_1_Parent"
+	INSTANCE COMPOUND 0:1:1:8:1 (refers to 0:1:1:9) "SRB1"
+ASSEMBLY COMPOUND 0:1:1:9 "SRB1"
+	INSTANCE FACE 0:1:1:9:1 (refers to 0:1:1:5) "SRB_Flame1"
+	INSTANCE FACE 0:1:1:9:2 (refers to 0:1:1:10) "SRBMesh"
+PART FACE 0:1:1:10 "SRBMesh"
+ASSEMBLY COMPOUND 0:1:1:11 "SRB_2_Parent"
+	INSTANCE COMPOUND 0:1:1:11:1 (refers to 0:1:1:12) "SRB2"
+ASSEMBLY COMPOUND 0:1:1:12 "SRB2"
+	INSTANCE FACE 0:1:1:12:1 (refers to 0:1:1:5) "SRB_Flame2"
+	INSTANCE FACE 0:1:1:12:2 (refers to 0:1:1:10) "SRBMesh"
+ASSEMBLY COMPOUND 0:1:1:13 "SRB_3_Parent"
+	INSTANCE COMPOUND 0:1:1:13:1 (refers to 0:1:1:14) "SRB3"
+ASSEMBLY COMPOUND 0:1:1:14 "SRB3"
+	INSTANCE FACE 0:1:1:14:1 (refers to 0:1:1:5) "SRB_Flame3"
+	INSTANCE FACE 0:1:1:14:2 (refers to 0:1:1:10) "SRBMesh"
+ASSEMBLY COMPOUND 0:1:1:15 "SRB_4_Parent"
+	INSTANCE COMPOUND 0:1:1:15:1 (refers to 0:1:1:16) "SRB4"
+ASSEMBLY COMPOUND 0:1:1:16 "SRB4"
+	INSTANCE FACE 0:1:1:16:1 (refers to 0:1:1:5) "SRB_Flame4"
+	INSTANCE FACE 0:1:1:16:2 (refers to 0:1:1:10) "SRBMesh"
+ASSEMBLY COMPOUND 0:1:1:17 "SRB_5_Parent"
+	INSTANCE COMPOUND 0:1:1:17:1 (refers to 0:1:1:18) "SRB5"
+ASSEMBLY COMPOUND 0:1:1:18 "SRB5"
+	INSTANCE FACE 0:1:1:18:1 (refers to 0:1:1:5) "SRB_Flame5"
+	INSTANCE FACE 0:1:1:18:2 (refers to 0:1:1:10) "SRBMesh"
+ASSEMBLY COMPOUND 0:1:1:19 "SRB_6_Parent"
+	INSTANCE COMPOUND 0:1:1:19:1 (refers to 0:1:1:20) "SRB6"
+ASSEMBLY COMPOUND 0:1:1:20 "SRB6"
+	INSTANCE FACE 0:1:1:20:1 (refers to 0:1:1:5) "SRB_Flame6"
+	INSTANCE FACE 0:1:1:20:2 (refers to 0:1:1:10) "SRBMesh"
+PART FACE 0:1:1:21 "BoosterMesh"
+ASSEMBLY COMPOUND 0:1:1:22 "CentaurBody"
+	INSTANCE COMPOUND 0:1:1:22:1 (refers to 0:1:1:23) "CentaurEngine1"
+	INSTANCE COMPOUND 0:1:1:22:2 (refers to 0:1:1:25) "CentaurEngine2_Parent"
+	INSTANCE FACE 0:1:1:22:3 (refers to 0:1:1:27) "CentaurFuelPump1"
+	INSTANCE FACE 0:1:1:22:4 (refers to 0:1:1:27) "CentaurFuelPump2"
+	INSTANCE FACE 0:1:1:22:5 (refers to 0:1:1:28) "Fairing1"
+	INSTANCE COMPOUND 0:1:1:22:6 (refers to 0:1:1:29) "FairingFlipper_180_Y"
+	INSTANCE FACE 0:1:1:22:7 (refers to 0:1:1:30) "CentaurBodyMesh"
+ASSEMBLY COMPOUND 0:1:1:23 "CentaurEngine1"
+	INSTANCE FACE 0:1:1:23:1 (refers to 0:1:1:5) "Centaur_Flame1"
+	INSTANCE FACE 0:1:1:23:2 (refers to 0:1:1:24) "CentaurEngineMesh"
+PART FACE 0:1:1:24 "CentaurEngineMesh"
+ASSEMBLY COMPOUND 0:1:1:25 "CentaurEngine2_Parent"
+	INSTANCE COMPOUND 0:1:1:25:1 (refers to 0:1:1:26) "CentaurEngine2"
+ASSEMBLY COMPOUND 0:1:1:26 "CentaurEngine2"
+	INSTANCE FACE 0:1:1:26:1 (refers to 0:1:1:5) "Centaur_Flame2"
+	INSTANCE FACE 0:1:1:26:2 (refers to 0:1:1:24) "CentaurEngineMesh"
+PART FACE 0:1:1:27 "CentuarFuelPumpMesh"
+PART FACE 0:1:1:28 "FairingMesh"
+ASSEMBLY COMPOUND 0:1:1:29 "FairingFlipper_180_Y"
+	INSTANCE FACE 0:1:1:29:1 (refers to 0:1:1:28) "Fairing2"
+PART FACE 0:1:1:30 "CentaurBodyMesh"
+PART FACE 0:1:1:31 "AdapterMesh"
+
+Free Shapes: 1
+ASSEMBLY COMPOUND  0:1:1:1 "Root"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_read/orient b/tests/de_mesh/gltf_read/orient
index 42cdf870e2..d44be4571d 100644
--- a/tests/de_mesh/gltf_read/orient
+++ b/tests/de_mesh/gltf_read/orient
@@ -6,3 +6,48 @@ ReadGltf D [locate_data_file bug30691_OrientationTest.glb]
 XGetOneShape s D
 checknbshapes s -face 13 -compound 1
 checktrinfo s -tri 524 -nod 1048
+
+set THE_REF_DUMP {
+INSTANCE FACE 0:1:1:1 (refers to 0:1:1:2) "ArrowZ2"
+PART FACE 0:1:1:2 "ArrowMeshZ2"
+INSTANCE FACE 0:1:1:3 (refers to 0:1:1:4) "TargetZ2"
+PART FACE 0:1:1:4 "TargetMeshZ2"
+INSTANCE FACE 0:1:1:5 (refers to 0:1:1:6) "TargetY2"
+PART FACE 0:1:1:6 "TargetMeshY2"
+INSTANCE FACE 0:1:1:7 (refers to 0:1:1:8) "ArrowY2"
+PART FACE 0:1:1:8 "ArrowMeshY2"
+INSTANCE FACE 0:1:1:9 (refers to 0:1:1:10) "ArrowX2"
+PART FACE 0:1:1:10 "ArrowMeshX2"
+INSTANCE FACE 0:1:1:11 (refers to 0:1:1:12) "TargetX2"
+PART FACE 0:1:1:12 "TargetMeshX2"
+INSTANCE FACE 0:1:1:13 (refers to 0:1:1:14) "TargetZ1"
+PART FACE 0:1:1:14 "TargetMeshZ1"
+INSTANCE FACE 0:1:1:15 (refers to 0:1:1:16) "ArrowZ1"
+PART FACE 0:1:1:16 "ArrowMeshZ1"
+INSTANCE FACE 0:1:1:17 (refers to 0:1:1:18) "TargetX1"
+PART FACE 0:1:1:18 "TargetMeshX1"
+INSTANCE FACE 0:1:1:19 (refers to 0:1:1:20) "ArrowX1"
+PART FACE 0:1:1:20 "ArrowMeshX1"
+INSTANCE FACE 0:1:1:21 (refers to 0:1:1:22) "TargetY1"
+PART FACE 0:1:1:22 "TargetMeshY1"
+INSTANCE FACE 0:1:1:23 (refers to 0:1:1:24) "ArrowY1"
+PART FACE 0:1:1:24 "ArrowMeshY1"
+INSTANCE FACE 0:1:1:25 (refers to 0:1:1:26) "BaseCube"
+PART FACE 0:1:1:26 "BaseCubeMesh"
+
+Free Shapes: 13
+INSTANCE FACE  0:1:1:1 (refers to 0:1:1:2) "ArrowZ2"
+INSTANCE FACE  0:1:1:3 (refers to 0:1:1:4) "TargetZ2"
+INSTANCE FACE  0:1:1:5 (refers to 0:1:1:6) "TargetY2"
+INSTANCE FACE  0:1:1:7 (refers to 0:1:1:8) "ArrowY2"
+INSTANCE FACE  0:1:1:9 (refers to 0:1:1:10) "ArrowX2"
+INSTANCE FACE  0:1:1:11 (refers to 0:1:1:12) "TargetX2"
+INSTANCE FACE  0:1:1:13 (refers to 0:1:1:14) "TargetZ1"
+INSTANCE FACE  0:1:1:15 (refers to 0:1:1:16) "ArrowZ1"
+INSTANCE FACE  0:1:1:17 (refers to 0:1:1:18) "TargetX1"
+INSTANCE FACE  0:1:1:19 (refers to 0:1:1:20) "ArrowX1"
+INSTANCE FACE  0:1:1:21 (refers to 0:1:1:22) "TargetY1"
+INSTANCE FACE  0:1:1:23 (refers to 0:1:1:24) "ArrowY1"
+INSTANCE FACE  0:1:1:25 (refers to 0:1:1:26) "BaseCube"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_write/as1 b/tests/de_mesh/gltf_write/as1
index eda810ba4a..7abb91fae2 100644
--- a/tests/de_mesh/gltf_write/as1
+++ b/tests/de_mesh/gltf_write/as1
@@ -22,3 +22,274 @@ checknbshapes s1 -face 53 -compound 28
 ReadGltf D "$aTmpGltf2"
 XGetOneShape s2 D
 checknbshapes s2 -face 5 -compound 10
+
+set THE_REF_DUMP_D1 {
+ASSEMBLY COMPOUND 0:1:1:1 "as1"
+	INSTANCE COMPOUND 0:1:1:1:1 (refers to 0:1:1:2) "rod-assembly_1"
+	INSTANCE COMPOUND 0:1:1:1:2 (refers to 0:1:1:6) "l-bracket-assembly_1"
+	INSTANCE COMPOUND 0:1:1:1:3 (refers to 0:1:1:17) "plate_1"
+	INSTANCE COMPOUND 0:1:1:1:4 (refers to 0:1:1:18) "l-bracket-assembly_2"
+ASSEMBLY COMPOUND 0:1:1:2 "rod-assembly_1"
+	INSTANCE COMPOUND 0:1:1:2:1 (refers to 0:1:1:3) "nut_1"
+	INSTANCE COMPOUND 0:1:1:2:2 (refers to 0:1:1:4) "nut_2"
+	INSTANCE COMPOUND 0:1:1:2:3 (refers to 0:1:1:5) "rod_1"
+PART COMPOUND 0:1:1:3 "nut"
+	FACE 0:1:1:3:1
+	FACE 0:1:1:3:2
+	FACE 0:1:1:3:3
+	FACE 0:1:1:3:4
+	FACE 0:1:1:3:5
+	FACE 0:1:1:3:6
+	FACE 0:1:1:3:7
+	FACE 0:1:1:3:8
+PART COMPOUND 0:1:1:4 "nut"
+	FACE 0:1:1:4:1
+	FACE 0:1:1:4:2
+	FACE 0:1:1:4:3
+	FACE 0:1:1:4:4
+	FACE 0:1:1:4:5
+	FACE 0:1:1:4:6
+	FACE 0:1:1:4:7
+	FACE 0:1:1:4:8
+PART COMPOUND 0:1:1:5 "rod"
+	FACE 0:1:1:5:1
+	FACE 0:1:1:5:2
+	FACE 0:1:1:5:3
+	FACE 0:1:1:5:4
+ASSEMBLY COMPOUND 0:1:1:6 "l-bracket-assembly_1"
+	INSTANCE COMPOUND 0:1:1:6:1 (refers to 0:1:1:7) "nut-bolt-assembly_1"
+	INSTANCE COMPOUND 0:1:1:6:2 (refers to 0:1:1:10) "nut-bolt-assembly_2"
+	INSTANCE COMPOUND 0:1:1:6:3 (refers to 0:1:1:13) "nut-bolt-assembly_3"
+	INSTANCE COMPOUND 0:1:1:6:4 (refers to 0:1:1:16) "l-bracket_1"
+ASSEMBLY COMPOUND 0:1:1:7 "nut-bolt-assembly_1"
+	INSTANCE COMPOUND 0:1:1:7:1 (refers to 0:1:1:8) "bolt_1"
+	INSTANCE COMPOUND 0:1:1:7:2 (refers to 0:1:1:9) "nut_3"
+PART COMPOUND 0:1:1:8 "bolt"
+	FACE 0:1:1:8:1
+	FACE 0:1:1:8:2
+	FACE 0:1:1:8:3
+	FACE 0:1:1:8:4
+	FACE 0:1:1:8:5
+	FACE 0:1:1:8:6
+	FACE 0:1:1:8:7
+PART COMPOUND 0:1:1:9 "nut"
+	FACE 0:1:1:9:1
+	FACE 0:1:1:9:2
+	FACE 0:1:1:9:3
+	FACE 0:1:1:9:4
+	FACE 0:1:1:9:5
+	FACE 0:1:1:9:6
+	FACE 0:1:1:9:7
+	FACE 0:1:1:9:8
+ASSEMBLY COMPOUND 0:1:1:10 "nut-bolt-assembly_2"
+	INSTANCE COMPOUND 0:1:1:10:1 (refers to 0:1:1:11) "bolt_1"
+	INSTANCE COMPOUND 0:1:1:10:2 (refers to 0:1:1:12) "nut_3"
+PART COMPOUND 0:1:1:11 "bolt"
+	FACE 0:1:1:11:1
+	FACE 0:1:1:11:2
+	FACE 0:1:1:11:3
+	FACE 0:1:1:11:4
+	FACE 0:1:1:11:5
+	FACE 0:1:1:11:6
+	FACE 0:1:1:11:7
+PART COMPOUND 0:1:1:12 "nut"
+	FACE 0:1:1:12:1
+	FACE 0:1:1:12:2
+	FACE 0:1:1:12:3
+	FACE 0:1:1:12:4
+	FACE 0:1:1:12:5
+	FACE 0:1:1:12:6
+	FACE 0:1:1:12:7
+	FACE 0:1:1:12:8
+ASSEMBLY COMPOUND 0:1:1:13 "nut-bolt-assembly_3"
+	INSTANCE COMPOUND 0:1:1:13:1 (refers to 0:1:1:14) "bolt_1"
+	INSTANCE COMPOUND 0:1:1:13:2 (refers to 0:1:1:15) "nut_3"
+PART COMPOUND 0:1:1:14 "bolt"
+	FACE 0:1:1:14:1
+	FACE 0:1:1:14:2
+	FACE 0:1:1:14:3
+	FACE 0:1:1:14:4
+	FACE 0:1:1:14:5
+	FACE 0:1:1:14:6
+	FACE 0:1:1:14:7
+PART COMPOUND 0:1:1:15 "nut"
+	FACE 0:1:1:15:1
+	FACE 0:1:1:15:2
+	FACE 0:1:1:15:3
+	FACE 0:1:1:15:4
+	FACE 0:1:1:15:5
+	FACE 0:1:1:15:6
+	FACE 0:1:1:15:7
+	FACE 0:1:1:15:8
+PART COMPOUND 0:1:1:16 "l-bracket"
+	FACE 0:1:1:16:1
+	FACE 0:1:1:16:2
+	FACE 0:1:1:16:3
+	FACE 0:1:1:16:4
+	FACE 0:1:1:16:5
+	FACE 0:1:1:16:6
+	FACE 0:1:1:16:7
+	FACE 0:1:1:16:8
+	FACE 0:1:1:16:9
+	FACE 0:1:1:16:10
+	FACE 0:1:1:16:11
+	FACE 0:1:1:16:12
+	FACE 0:1:1:16:13
+	FACE 0:1:1:16:14
+	FACE 0:1:1:16:15
+	FACE 0:1:1:16:16
+PART COMPOUND 0:1:1:17 "plate"
+	FACE 0:1:1:17:1
+	FACE 0:1:1:17:2
+	FACE 0:1:1:17:3
+	FACE 0:1:1:17:4
+	FACE 0:1:1:17:5
+	FACE 0:1:1:17:6
+	FACE 0:1:1:17:7
+	FACE 0:1:1:17:8
+	FACE 0:1:1:17:9
+	FACE 0:1:1:17:10
+	FACE 0:1:1:17:11
+	FACE 0:1:1:17:12
+	FACE 0:1:1:17:13
+	FACE 0:1:1:17:14
+	FACE 0:1:1:17:15
+	FACE 0:1:1:17:16
+	FACE 0:1:1:17:17
+	FACE 0:1:1:17:18
+ASSEMBLY COMPOUND 0:1:1:18 "l-bracket-assembly_2"
+	INSTANCE COMPOUND 0:1:1:18:1 (refers to 0:1:1:19) "nut-bolt-assembly_1"
+	INSTANCE COMPOUND 0:1:1:18:2 (refers to 0:1:1:22) "nut-bolt-assembly_2"
+	INSTANCE COMPOUND 0:1:1:18:3 (refers to 0:1:1:25) "nut-bolt-assembly_3"
+	INSTANCE COMPOUND 0:1:1:18:4 (refers to 0:1:1:28) "l-bracket_1"
+ASSEMBLY COMPOUND 0:1:1:19 "nut-bolt-assembly_1"
+	INSTANCE COMPOUND 0:1:1:19:1 (refers to 0:1:1:20) "bolt_1"
+	INSTANCE COMPOUND 0:1:1:19:2 (refers to 0:1:1:21) "nut_3"
+PART COMPOUND 0:1:1:20 "bolt"
+	FACE 0:1:1:20:1
+	FACE 0:1:1:20:2
+	FACE 0:1:1:20:3
+	FACE 0:1:1:20:4
+	FACE 0:1:1:20:5
+	FACE 0:1:1:20:6
+	FACE 0:1:1:20:7
+PART COMPOUND 0:1:1:21 "nut"
+	FACE 0:1:1:21:1
+	FACE 0:1:1:21:2
+	FACE 0:1:1:21:3
+	FACE 0:1:1:21:4
+	FACE 0:1:1:21:5
+	FACE 0:1:1:21:6
+	FACE 0:1:1:21:7
+	FACE 0:1:1:21:8
+ASSEMBLY COMPOUND 0:1:1:22 "nut-bolt-assembly_2"
+	INSTANCE COMPOUND 0:1:1:22:1 (refers to 0:1:1:23) "bolt_1"
+	INSTANCE COMPOUND 0:1:1:22:2 (refers to 0:1:1:24) "nut_3"
+PART COMPOUND 0:1:1:23 "bolt"
+	FACE 0:1:1:23:1
+	FACE 0:1:1:23:2
+	FACE 0:1:1:23:3
+	FACE 0:1:1:23:4
+	FACE 0:1:1:23:5
+	FACE 0:1:1:23:6
+	FACE 0:1:1:23:7
+PART COMPOUND 0:1:1:24 "nut"
+	FACE 0:1:1:24:1
+	FACE 0:1:1:24:2
+	FACE 0:1:1:24:3
+	FACE 0:1:1:24:4
+	FACE 0:1:1:24:5
+	FACE 0:1:1:24:6
+	FACE 0:1:1:24:7
+	FACE 0:1:1:24:8
+ASSEMBLY COMPOUND 0:1:1:25 "nut-bolt-assembly_3"
+	INSTANCE COMPOUND 0:1:1:25:1 (refers to 0:1:1:26) "bolt_1"
+	INSTANCE COMPOUND 0:1:1:25:2 (refers to 0:1:1:27) "nut_3"
+PART COMPOUND 0:1:1:26 "bolt"
+	FACE 0:1:1:26:1
+	FACE 0:1:1:26:2
+	FACE 0:1:1:26:3
+	FACE 0:1:1:26:4
+	FACE 0:1:1:26:5
+	FACE 0:1:1:26:6
+	FACE 0:1:1:26:7
+PART COMPOUND 0:1:1:27 "nut"
+	FACE 0:1:1:27:1
+	FACE 0:1:1:27:2
+	FACE 0:1:1:27:3
+	FACE 0:1:1:27:4
+	FACE 0:1:1:27:5
+	FACE 0:1:1:27:6
+	FACE 0:1:1:27:7
+	FACE 0:1:1:27:8
+PART COMPOUND 0:1:1:28 "l-bracket"
+	FACE 0:1:1:28:1
+	FACE 0:1:1:28:2
+	FACE 0:1:1:28:3
+	FACE 0:1:1:28:4
+	FACE 0:1:1:28:5
+	FACE 0:1:1:28:6
+	FACE 0:1:1:28:7
+	FACE 0:1:1:28:8
+	FACE 0:1:1:28:9
+	FACE 0:1:1:28:10
+	FACE 0:1:1:28:11
+	FACE 0:1:1:28:12
+	FACE 0:1:1:28:13
+	FACE 0:1:1:28:14
+	FACE 0:1:1:28:15
+	FACE 0:1:1:28:16
+
+Free Shapes: 1
+ASSEMBLY COMPOUND  0:1:1:1 "as1"
+}
+checkXDump D1 $THE_REF_DUMP_D1
+
+set THE_REF_DUMP_D {
+ASSEMBLY COMPOUND 0:1:1:1 "as1"
+	INSTANCE COMPOUND 0:1:1:1:1 (refers to 0:1:1:2) "rod-assembly_1"
+	INSTANCE COMPOUND 0:1:1:1:2 (refers to 0:1:1:5) "l-bracket-assembly_1"
+	INSTANCE FACE 0:1:1:1:3 (refers to 0:1:1:11) "plate_1"
+	INSTANCE COMPOUND 0:1:1:1:4 (refers to 0:1:1:12) "l-bracket-assembly_2"
+ASSEMBLY COMPOUND 0:1:1:2 "rod-assembly_1"
+	INSTANCE FACE 0:1:1:2:1 (refers to 0:1:1:3) "nut_1"
+	INSTANCE FACE 0:1:1:2:2 (refers to 0:1:1:3) "nut_2"
+	INSTANCE FACE 0:1:1:2:3 (refers to 0:1:1:4) "rod_1"
+PART FACE 0:1:1:3 "nut"
+PART FACE 0:1:1:4 "rod"
+ASSEMBLY COMPOUND 0:1:1:5 "l-bracket-assembly_1"
+	INSTANCE COMPOUND 0:1:1:5:1 (refers to 0:1:1:6) "nut-bolt-assembly_1"
+	INSTANCE COMPOUND 0:1:1:5:2 (refers to 0:1:1:8) "nut-bolt-assembly_2"
+	INSTANCE COMPOUND 0:1:1:5:3 (refers to 0:1:1:9) "nut-bolt-assembly_3"
+	INSTANCE FACE 0:1:1:5:4 (refers to 0:1:1:10) "l-bracket_1"
+ASSEMBLY COMPOUND 0:1:1:6 "nut-bolt-assembly_1"
+	INSTANCE FACE 0:1:1:6:1 (refers to 0:1:1:7) "bolt_1"
+	INSTANCE FACE 0:1:1:6:2 (refers to 0:1:1:3) "nut_3"
+PART FACE 0:1:1:7 "bolt"
+ASSEMBLY COMPOUND 0:1:1:8 "nut-bolt-assembly_2"
+	INSTANCE FACE 0:1:1:8:1 (refers to 0:1:1:7) "bolt_1"
+	INSTANCE FACE 0:1:1:8:2 (refers to 0:1:1:3) "nut_3"
+ASSEMBLY COMPOUND 0:1:1:9 "nut-bolt-assembly_3"
+	INSTANCE FACE 0:1:1:9:1 (refers to 0:1:1:7) "bolt_1"
+	INSTANCE FACE 0:1:1:9:2 (refers to 0:1:1:3) "nut_3"
+PART FACE 0:1:1:10 "l-bracket"
+PART FACE 0:1:1:11 "plate"
+ASSEMBLY COMPOUND 0:1:1:12 "l-bracket-assembly_2"
+	INSTANCE COMPOUND 0:1:1:12:1 (refers to 0:1:1:13) "nut-bolt-assembly_1"
+	INSTANCE COMPOUND 0:1:1:12:2 (refers to 0:1:1:14) "nut-bolt-assembly_2"
+	INSTANCE COMPOUND 0:1:1:12:3 (refers to 0:1:1:15) "nut-bolt-assembly_3"
+	INSTANCE FACE 0:1:1:12:4 (refers to 0:1:1:10) "l-bracket_1"
+ASSEMBLY COMPOUND 0:1:1:13 "nut-bolt-assembly_1"
+	INSTANCE FACE 0:1:1:13:1 (refers to 0:1:1:7) "bolt_1"
+	INSTANCE FACE 0:1:1:13:2 (refers to 0:1:1:3) "nut_3"
+ASSEMBLY COMPOUND 0:1:1:14 "nut-bolt-assembly_2"
+	INSTANCE FACE 0:1:1:14:1 (refers to 0:1:1:7) "bolt_1"
+	INSTANCE FACE 0:1:1:14:2 (refers to 0:1:1:3) "nut_3"
+ASSEMBLY COMPOUND 0:1:1:15 "nut-bolt-assembly_3"
+	INSTANCE FACE 0:1:1:15:1 (refers to 0:1:1:7) "bolt_1"
+	INSTANCE FACE 0:1:1:15:2 (refers to 0:1:1:3) "nut_3"
+
+Free Shapes: 1
+ASSEMBLY COMPOUND  0:1:1:1 "as1"
+}
+checkXDump D  $THE_REF_DUMP_D
diff --git a/tests/de_mesh/gltf_write/ball b/tests/de_mesh/gltf_write/ball
index 9439bc6268..6e61bf060f 100644
--- a/tests/de_mesh/gltf_write/ball
+++ b/tests/de_mesh/gltf_write/ball
@@ -10,4 +10,20 @@ writegltf b "$aTmpGltf"
 
 ReadGltf D "$aTmpGltf"
 XGetOneShape s D
-checknbshapes s -face 17 -compound 3
+checknbshapes s -face 17 -compound 5
+
+set THE_REF_DUMP {
+ASSEMBLY COMPOUND 0:1:1:1 "ASSEMBLY"
+	INSTANCE COMPOUND 0:1:1:1:1 (refers to 0:1:1:2) "ASSEMBLY"
+	INSTANCE COMPOUND 0:1:1:1:2 (refers to 0:1:1:4) "ASSEMBLY"
+ASSEMBLY COMPOUND 0:1:1:2 "ASSEMBLY"
+	INSTANCE COMPOUND 0:1:1:2:1 (refers to 0:1:1:3) "SOLID"
+PART COMPOUND 0:1:1:3 "SOLID"
+ASSEMBLY COMPOUND 0:1:1:4 "ASSEMBLY"
+	INSTANCE COMPOUND 0:1:1:4:1 (refers to 0:1:1:5) "SOLID"
+PART COMPOUND 0:1:1:5 "SOLID"
+
+Free Shapes: 1
+ASSEMBLY COMPOUND  0:1:1:1 "ASSEMBLY"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_write/compound b/tests/de_mesh/gltf_write/compound
new file mode 100644
index 0000000000..dbe9b1d628
--- /dev/null
+++ b/tests/de_mesh/gltf_write/compound
@@ -0,0 +1,38 @@
+puts "========"
+puts "0032612: Data Exchange, RWGltf_CafReader - lost hierarchy of two nested compounds"
+puts "========"
+
+set aTmpGltf "${imagedir}/${casename}_tmp.glb"
+
+box b 1 2 3
+incmesh b 0.1
+compound b c
+compound c cc
+
+Close *
+XNewDoc D1
+XAddShape D1 cc
+SetName D1 [XFindShape D1 b]    "box"
+SetName D1 [XFindShape D1 c]    "comp1"
+SetName D1 [XFindShape D1 c]:1  "box_inst"
+SetName D1 [XFindShape D1 cc]   "comp2"
+SetName D1 [XFindShape D1 cc]:1 "comp1_inst"
+
+#XSave D1 "test.xbf"
+WriteGltf D1 "$aTmpGltf"
+
+ReadGltf D "$aTmpGltf"
+XGetOneShape s D
+checknbshapes s -face 6 -compound 3
+
+set THE_REF_DUMP {
+ASSEMBLY COMPOUND 0:1:1:1 "comp2"
+	INSTANCE COMPOUND 0:1:1:1:1 (refers to 0:1:1:2) "comp1_inst"
+ASSEMBLY COMPOUND 0:1:1:2 "comp1_inst"
+	INSTANCE COMPOUND 0:1:1:2:1 (refers to 0:1:1:3) "box_inst"
+PART COMPOUND 0:1:1:3 "box"
+
+Free Shapes: 1
+ASSEMBLY COMPOUND  0:1:1:1 "comp2"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_write/empty b/tests/de_mesh/gltf_write/empty
index e10954505a..50daa2f2e6 100644
--- a/tests/de_mesh/gltf_write/empty
+++ b/tests/de_mesh/gltf_write/empty
@@ -12,10 +12,21 @@ compound ce
 compound b1 b2 ce cc
 incmesh b2 1
 XNewDoc   DD
+XAutoNaming DD 0
 XAddShape DD cc 1
 WriteGltf DD "$aTmpGltf"
 Close     DD
 
 ReadGltf  D "$aTmpGltf"
 XGetOneShape s D
-checknbshapes s -face 6 -compound 1
+checknbshapes s -face 6 -compound 2
+
+set THE_REF_DUMP {
+ASSEMBLY COMPOUND 0:1:1:1 "empty_tmp.glb"
+	INSTANCE COMPOUND 0:1:1:1:1 (refers to 0:1:1:2) "Compound"
+PART COMPOUND 0:1:1:2 "Compound"
+
+Free Shapes: 1
+ASSEMBLY COMPOUND  0:1:1:1 "empty_tmp.glb"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_write/helmet b/tests/de_mesh/gltf_write/helmet
index 39d9854714..1c8508e929 100644
--- a/tests/de_mesh/gltf_write/helmet
+++ b/tests/de_mesh/gltf_write/helmet
@@ -32,3 +32,12 @@ regexp {Mass\s:\s*([0-9\.]+)} $aLProps2 dummy anArea2
 if {abs($anArea1 - $anArea2) > 1e-8 * $anArea1} {
   puts "Error: invalid area $anArea1 instead of $anArea2"
 }
+
+set THE_REF_DUMP {
+INSTANCE FACE 0:1:1:1 (refers to 0:1:1:2) "node_damagedHelmet_-6514"
+PART FACE 0:1:1:2 "mesh_helmet_LP_13930damagedHelmet"
+
+Free Shapes: 1
+INSTANCE FACE  0:1:1:1 (refers to 0:1:1:2) "node_damagedHelmet_-6514"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_write/helmetglb b/tests/de_mesh/gltf_write/helmetglb
index eda6d7867a..e7ecde8cd2 100644
--- a/tests/de_mesh/gltf_write/helmetglb
+++ b/tests/de_mesh/gltf_write/helmetglb
@@ -18,3 +18,12 @@ ReadGltf D "$aTmpGltf"
 XGetOneShape s D
 checknbshapes s -face 1 -compound 0
 checktrinfo s -tri 15452 -nod 14556
+
+set THE_REF_DUMP {
+INSTANCE FACE 0:1:1:1 (refers to 0:1:1:2) "node_damagedHelmet_-6514"
+PART FACE 0:1:1:2 "mesh_helmet_LP_13930damagedHelmet"
+
+Free Shapes: 1
+INSTANCE FACE  0:1:1:1 (refers to 0:1:1:2) "node_damagedHelmet_-6514"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_write/lantern b/tests/de_mesh/gltf_write/lantern
index e1bd11f066..5aa6287b60 100644
--- a/tests/de_mesh/gltf_write/lantern
+++ b/tests/de_mesh/gltf_write/lantern
@@ -17,3 +17,18 @@ ReadGltf D "$aTmpGltf"
 XGetOneShape s D
 checknbshapes s -face 3 -compound 1
 checktrinfo s -tri 5394 -nod 4145
+
+set THE_REF_DUMP {
+INSTANCE COMPOUND 0:1:1:1 (refers to 0:1:1:2) "Lantern"
+ASSEMBLY COMPOUND 0:1:1:2 "Lantern"
+	INSTANCE FACE 0:1:1:2:1 (refers to 0:1:1:3) "LanternPole_Body"
+	INSTANCE FACE 0:1:1:2:2 (refers to 0:1:1:4) "LanternPole_Chain"
+	INSTANCE FACE 0:1:1:2:3 (refers to 0:1:1:5) "LanternPole_Lantern"
+PART FACE 0:1:1:3 "LanternPole_Body"
+PART FACE 0:1:1:4 "LanternPole_Chain"
+PART FACE 0:1:1:5 "LanternPole_Lantern"
+
+Free Shapes: 1
+INSTANCE COMPOUND  0:1:1:1 (refers to 0:1:1:2) "Lantern"
+}
+checkXDump D $THE_REF_DUMP
diff --git a/tests/de_mesh/gltf_write/lanternglb b/tests/de_mesh/gltf_write/lanternglb
index 170fc3736e..ffaf419423 100644
--- a/tests/de_mesh/gltf_write/lanternglb
+++ b/tests/de_mesh/gltf_write/lanternglb
@@ -18,3 +18,18 @@ ReadGltf D "$aTmpGltf"
 XGetOneShape s D
 checknbshapes s -face 3 -compound 1
 checktrinfo s -tri 5394 -nod 4145
+
+set THE_REF_DUMP {
+INSTANCE COMPOUND 0:1:1:1 (refers to 0:1:1:2) "Lantern"
+ASSEMBLY COMPOUND 0:1:1:2 "Lantern"
+	INSTANCE FACE 0:1:1:2:1 (refers to 0:1:1:3) "LanternPole_Body"
+	INSTANCE FACE 0:1:1:2:2 (refers to 0:1:1:4) "LanternPole_Chain"
+	INSTANCE FACE 0:1:1:2:3 (refers to 0:1:1:5) "LanternPole_Lantern"
+PART FACE 0:1:1:3 "LanternPole_Body"
+PART FACE 0:1:1:4 "LanternPole_Chain"
+PART FACE 0:1:1:5 "LanternPole_Lantern"
+
+Free Shapes: 1
+INSTANCE COMPOUND  0:1:1:1 (refers to 0:1:1:2) "Lantern"
+}
+checkXDump D $THE_REF_DUMP