Browse Source

*** empty log message ***

David Rose 25 years ago
parent
commit
366b4a0d2c
1 changed files with 14 additions and 13 deletions
  1. 14 13
      pandatool/src/flt/fltRecord.cxx

+ 14 - 13
pandatool/src/flt/fltRecord.cxx

@@ -710,14 +710,14 @@ write_record_and_children(FltRecordWriter &writer) const {
     }
   }
 
-  // Any subfaces?
-  if (!_subfaces.empty()) {
+  // Any extensions?
+  if (!_extensions.empty()) {
     result = writer.write_record(FO_push_face);
     if (result != FE_ok) {
       return result;
     }
 
-    for (ci = _subfaces.begin(); ci != _subfaces.end(); ++ci) {
+    for (ci = _extensions.begin(); ci != _extensions.end(); ++ci) {
       (*ci)->write_record_and_children(writer);
     }
 
@@ -727,35 +727,36 @@ write_record_and_children(FltRecordWriter &writer) const {
     }
   }
 
-  // Any extensions?
-  if (!_extensions.empty()) {
-    result = writer.write_record(FO_push_face);
+  // Finally, write all the children.
+  if (!_children.empty()) {
+    result = writer.write_record(FO_push);
     if (result != FE_ok) {
       return result;
     }
 
-    for (ci = _extensions.begin(); ci != _extensions.end(); ++ci) {
+    for (ci = _children.begin(); ci != _children.end(); ++ci) {
       (*ci)->write_record_and_children(writer);
     }
 
-    result = writer.write_record(FO_pop_face);
+    result = writer.write_record(FO_pop);
     if (result != FE_ok) {
       return result;
     }
   }
 
-  // Finally, write all the children.
-  if (!_children.empty()) {
-    result = writer.write_record(FO_push);
+  // We must write subfaces *after* the list of children, or Creator
+  // will crash trying to load the file.
+  if (!_subfaces.empty()) {
+    result = writer.write_record(FO_push_face);
     if (result != FE_ok) {
       return result;
     }
 
-    for (ci = _children.begin(); ci != _children.end(); ++ci) {
+    for (ci = _subfaces.begin(); ci != _subfaces.end(); ++ci) {
       (*ci)->write_record_and_children(writer);
     }
 
-    result = writer.write_record(FO_pop);
+    result = writer.write_record(FO_pop_face);
     if (result != FE_ok) {
       return result;
     }