From bc829f47837b5a001f911542140b0b8e63c2bb0c Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 14 Jul 2019 19:47:03 -0400
Subject: [PATCH] Fix extract big data.

---
 ObjEditor.java |   50 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/ObjEditor.java b/ObjEditor.java
index 5d7d1bb..b1bbdf6 100644
--- a/ObjEditor.java
+++ b/ObjEditor.java
@@ -1174,10 +1174,11 @@
         randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
         randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
 
+        link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
+        link2masterCB.setToolTipText("Attach to support");
+        
         if (Globals.ADVANCED)
         {
-                link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
-                link2masterCB.setToolTipText("Attach to support");
                 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
                 speedupCB.setToolTipText("Option motion capture");
         }
@@ -3480,8 +3481,8 @@
         try
         {
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
-            ObjectOutputStream out = new ObjectOutputStream(zstream);
+//            java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
+            ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
 
         Object3D parent = o.parent;
         o.parent = null;
@@ -3492,10 +3493,14 @@
         
             out.flush();
 
-            zstream.close();
+            baos //zstream
+                    .close();
             out.close();
             
-            return baos.toByteArray();
+            byte[] bytes = baos.toByteArray();
+            
+        System.out.println("save #bytes = " + bytes.length);
+            return bytes;
         } catch (Exception e)
         {
             System.err.println(e);
@@ -3505,13 +3510,16 @@
 
     static public Object Uncompress(byte[] bytes)
     {
-        System.out.println("#bytes = " + bytes.length);
+        System.out.println("restore #bytes = " + bytes.length);
         try
         {
             ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-            java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
-            ObjectInputStream in = new ObjectInputStream(istream);
+            //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
+            ObjectInputStream in = new ObjectInputStream(bais); // istream);
             Object obj = in.readObject();
+            
+            bais //istream
+                    .close();
             in.close();
             
             return obj;
@@ -3570,7 +3578,6 @@
     
     public void Save()
     {
-        // Default reduces the probability of heuristics errors.
         Save(true);
     }
     
@@ -3616,8 +3623,13 @@
         //EditorFrame.m_MainFrame.requestFocusInWindow();
         if (!thesame)
         {
-            tab.user[tab.undoindex] = user;
-            tab.graphs[tab.undoindex++] = compress;
+            //tab.user[tab.undoindex] = user;
+            boolean increment = tab.graphs[tab.undoindex] == null;
+            
+            tab.graphs[tab.undoindex] = compress;
+            
+            if (increment)
+                tab.undoindex++;
         }
 
         copy.RestoreBigData(hashtable);
@@ -3626,8 +3638,8 @@
         
         for (int i = tab.undoindex; i < tab.graphs.length; i++)
         {
-            tab.user[i] = false;
-            tab.graphs[i] = null;
+            //tab.user[i] = false;
+        //    tab.graphs[i] = null;
         }
 
         SetUndoStates();
@@ -3720,7 +3732,7 @@
             return false;
         }
 
-        if (tab.graphs[tab.undoindex] == null || !tab.user[tab.undoindex])
+        if (tab.graphs[tab.undoindex] == null) // || !tab.user[tab.undoindex])
         {
             if (Save(false))
                 tab.undoindex -= 1;
@@ -3754,8 +3766,8 @@
 
         CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
         
-        if (!tab.user[tab.undoindex])
-            tab.graphs[tab.undoindex] = null;
+        //if (!tab.user[tab.undoindex])
+        //    tab.graphs[tab.undoindex] = null;
     }
 
         void ImportGFD()
@@ -4718,8 +4730,8 @@
         
         if (readobj != null)
         {
-        if (Globals.SAVEONMAKE)
-            Save();
+        //if (Globals.SAVEONMAKE) // A new object cannot share meshes
+        //    Save();
             try
             {
                 //readobj.deepCopySelf(copy);

--
Gitblit v1.6.2