From 3e5c2d344e04e0adb6a210c5c6302bfbfd8af102 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Fri, 06 Sep 2019 20:25:39 -0400 Subject: [PATCH] Fix file object. --- FileObject.java | 27 ++++++++++++- ObjEditor.java | 2 CameraPane.java | 2 GroupEditor.java | 7 +++ Object3D.java | 30 +++++++++++++- Grafreed.java | 1 6 files changed, 61 insertions(+), 8 deletions(-) diff --git a/CameraPane.java b/CameraPane.java index 706f7ec..a8ea6b4 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -8461,7 +8461,7 @@ new Exception().printStackTrace(); } else { - if (texname.startsWith("@")) + if (texname.startsWith("@") && textureon) { // texturecache = textures.get(texname); // suspicious if (texturecache == null) diff --git a/FileObject.java b/FileObject.java index b87554b..e899a71 100644 --- a/FileObject.java +++ b/FileObject.java @@ -19,15 +19,37 @@ boolean HasBigData() { - return false; + return filecontent != null; } void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) { + Object3D o; + + if (hashtable.containsKey(GetUUID())) + { + o = hashtable.get(GetUUID()); + + //Grafreed.Assert(this.filecontent == ((FileObject)o).filecontent); + } + else + { + o = new Object3D("copy of " + this.name); + + hashtable.put(GetUUID(), o); + } + + ExtractBigData(o); } void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) { + if (!hashtable.containsKey(GetUUID())) + return; + + Object3D o = hashtable.get(GetUUID()); + + RestoreBigData(o); } boolean IsStatic() @@ -100,7 +122,8 @@ o.savefilecontent = this.filecontent; - // filecontent transient + // filecontent is transient + this.filecontent = null; } void RestoreBigData(Object3D o) diff --git a/Grafreed.java b/Grafreed.java index 83452e7..1150da2 100644 --- a/Grafreed.java +++ b/Grafreed.java @@ -1033,6 +1033,7 @@ grafreed.universe.root = true; grafreed.universe.openEditWindow(null, true); //, true); grafreed.universe.editWindow.New(); + grafreed.universe.editWindow.DuplicateVersion(); //mon.stop(); //System.out.println(mon); diff --git a/GroupEditor.java b/GroupEditor.java index 5f68a81..0d46be5 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -483,11 +483,16 @@ Object3D parent = obj.parent; obj.parent = null; + // Object3D support = obj.support; // obj.support = null; if (!supports) obj.SaveSupports(); + Object3D clone = (Object3D)Grafreed.clone(obj); + + clone.ResetUUIDs(); + obj.parent = parent; // obj.support = support; // clone.support = support; // aout 2013 @@ -2843,7 +2848,7 @@ if (source == saveVersionButton) { // Save a new version - if (!Save(true)) + if (!DuplicateVersion()) //true)) java.awt.Toolkit.getDefaultToolkit().beep(); } else if (source == deleteVersionButton) diff --git a/ObjEditor.java b/ObjEditor.java index 3fc15f7..44ad97c 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -4552,7 +4552,7 @@ SetCameras(); } - public boolean Save(boolean user) + public boolean DuplicateVersion() // boolean user) { System.err.println("Save"); //Replace(); diff --git a/Object3D.java b/Object3D.java index a786677..ff18bbd 100644 --- a/Object3D.java +++ b/Object3D.java @@ -1318,6 +1318,30 @@ return false; } + void ResetUUIDs() + { + if (blockloop) + { + return; + } + + this.uuid = null; + + blockloop = true; + + for (int i = 0; i < Size(); i++) + { + Object3D obj = (Object3D) Children().get(i); + + if (obj != null) + { + obj.ResetUUIDs(); + } + } + + blockloop = false; + } + boolean IsInfinite() { if (blockloop) @@ -8290,10 +8314,10 @@ } // + super.toString(); //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName(); -// if (!Globals.ADVANCED) -// return objname; + if (!Globals.ADVANCED) + return objname; - return objname; // + " " + System.identityHashCode(this) + " " + GetUUID(); + return objname + " " + System.identityHashCode(this) + " " + GetUUID(); } public int hashCode() -- Gitblit v1.6.2