From 989407a46041b80c71fd906bff6b97528e6f3350 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sat, 08 Jun 2019 23:58:21 -0400 Subject: [PATCH] Fix ZIP issue --- ObjEditor.java | 43 ++++++++++++++++++++++++++++++++++--------- 1 files changed, 34 insertions(+), 9 deletions(-) diff --git a/ObjEditor.java b/ObjEditor.java index cfefeab..00cc42b 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -784,6 +784,7 @@ // NumberSlider vDivsField; // JCheckBox endcaps; JCheckBox liveCB; + JCheckBox selectCB; JCheckBox hideCB; JCheckBox link2masterCB; JCheckBox markCB; @@ -986,9 +987,11 @@ liveCB = AddCheckBox(setupPanel, "Live", copy.live); liveCB.setToolTipText("Animate object"); + selectCB = AddCheckBox(setupPanel, "Select", !copy.dontselect); + selectCB.setToolTipText("Make object selectable"); +// Return(); hideCB = AddCheckBox(setupPanel, "Hide", copy.hide); hideCB.setToolTipText("Hide object"); -// Return(); markCB = AddCheckBox(setupPanel, "Mark", copy.marked); markCB.setToolTipText("Set the animation target transform"); @@ -1028,7 +1031,7 @@ oe.ctrlPanel.add(commandsPanel); oe.ctrlPanel.Return(); - pushPanel = AddSlider(oe.ctrlPanel, "Push", -10, 10, 0, 1); + pushPanel = AddSlider(oe.ctrlPanel, "Push", -1, 1, copy.NORMALPUSH, 1.1); // To have the buttons normalpushField = (cNumberSlider)pushPanel.getComponent(1); //Return(); @@ -3007,6 +3010,10 @@ { copy.live ^= true; return; + } else if (event.getSource() == selectCB) + { + copy.dontselect ^= true; + return; } else if (event.getSource() == hideCB) { copy.hide ^= true; @@ -3588,7 +3595,7 @@ } if (normalpushField != null) - copy.NORMALPUSH = (float)normalpushField.getFloat()/1000; + copy.NORMALPUSH = (float)normalpushField.getFloat()/100; } void SnapObject() @@ -4055,6 +4062,7 @@ } } } + LoadGFDThread loadGFDThread; void ReadGFD(String fullname, iCallBack cb) @@ -4075,7 +4083,8 @@ try { java.io.FileInputStream istream = new java.io.FileInputStream(fullname); - java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); + java.util.zip.GZIPInputStream zstream = new java.util.zip.GZIPInputStream(istream); + java.io.ObjectInputStream p = new java.io.ObjectInputStream(zstream); readobj = (Object3D) p.readObject(); istream.close(); @@ -4083,7 +4092,20 @@ readobj.ResetDisplayList(); } catch (Exception e) { - e.printStackTrace(); + //e.printStackTrace(); + try + { + java.io.FileInputStream istream = new java.io.FileInputStream(fullname); + java.io.ObjectInputStream p = new java.io.ObjectInputStream(istream); + + readobj = (Object3D) p.readObject(); + istream.close(); + + readobj.ResetDisplayList(); + } catch (Exception e2) + { + e2.printStackTrace(); + } } // catch(java.io.StreamCorruptedException e) { e.printStackTrace(); } // catch(java.io.IOException e) { System.out.println("IOexception"); e.printStackTrace(); } @@ -4287,11 +4309,13 @@ try { FileOutputStream ostream = new FileOutputStream(lastname); - ObjectOutputStream p = new ObjectOutputStream(ostream); + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); + ObjectOutputStream p = new ObjectOutputStream(zstream); p.writeObject(copy); p.flush(); + zstream.close(); ostream.close(); //FileOutputStream fos = new FileOutputStream(fullname); @@ -4301,6 +4325,7 @@ { } } + String lastname; void saveAs() @@ -4410,8 +4435,8 @@ try { FileOutputStream ostream = new FileOutputStream(filename); - // ?? java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); - ObjectOutputStream p = new ObjectOutputStream(/*z*/ostream); + java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(ostream); + ObjectOutputStream p = new ObjectOutputStream(zstream); Object3D objectparent = obj.parent; obj.parent = null; @@ -4428,8 +4453,8 @@ p.writeObject(object); p.flush(); + zstream.close(); ostream.close(); - // zstream.close(); // group.selection.get(0).parent = parent; //FileOutputStream fos = new FileOutputStream(fullname); -- Gitblit v1.6.2