Normand Briere
2019-09-07 3e5c2d344e04e0adb6a210c5c6302bfbfd8af102
Fix file object.
6 files modified
69 ■■■■ changed files
CameraPane.java 2 ●●● patch | view | raw | blame | history
FileObject.java 27 ●●●●● patch | view | raw | blame | history
Grafreed.java 1 ●●●● patch | view | raw | blame | history
GroupEditor.java 7 ●●●● patch | view | raw | blame | history
ObjEditor.java 2 ●●● patch | view | raw | blame | history
Object3D.java 30 ●●●●● patch | view | raw | blame | history
CameraPane.java
....@@ -8461,7 +8461,7 @@
84618461 new Exception().printStackTrace();
84628462 } else
84638463 {
8464
- if (texname.startsWith("@"))
8464
+ if (texname.startsWith("@") && textureon)
84658465 {
84668466 // texturecache = textures.get(texname); // suspicious
84678467 if (texturecache == null)
FileObject.java
....@@ -19,15 +19,37 @@
1919
2020 boolean HasBigData()
2121 {
22
- return false;
22
+ return filecontent != null;
2323 }
2424
2525 void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
2626 {
27
+ Object3D o;
28
+
29
+ if (hashtable.containsKey(GetUUID()))
30
+ {
31
+ o = hashtable.get(GetUUID());
32
+
33
+ //Grafreed.Assert(this.filecontent == ((FileObject)o).filecontent);
34
+ }
35
+ else
36
+ {
37
+ o = new Object3D("copy of " + this.name);
38
+
39
+ hashtable.put(GetUUID(), o);
40
+ }
41
+
42
+ ExtractBigData(o);
2743 }
2844
2945 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
3046 {
47
+ if (!hashtable.containsKey(GetUUID()))
48
+ return;
49
+
50
+ Object3D o = hashtable.get(GetUUID());
51
+
52
+ RestoreBigData(o);
3153 }
3254
3355 boolean IsStatic()
....@@ -100,7 +122,8 @@
100122
101123 o.savefilecontent = this.filecontent;
102124
103
- // filecontent transient
125
+ // filecontent is transient
126
+ this.filecontent = null;
104127 }
105128
106129 void RestoreBigData(Object3D o)
Grafreed.java
....@@ -1033,6 +1033,7 @@
10331033 grafreed.universe.root = true;
10341034 grafreed.universe.openEditWindow(null, true); //, true);
10351035 grafreed.universe.editWindow.New();
1036
+ grafreed.universe.editWindow.DuplicateVersion();
10361037
10371038 //mon.stop();
10381039 //System.out.println(mon);
GroupEditor.java
....@@ -483,11 +483,16 @@
483483
484484 Object3D parent = obj.parent;
485485 obj.parent = null;
486
+
486487 // Object3D support = obj.support;
487488 // obj.support = null;
488489 if (!supports)
489490 obj.SaveSupports();
491
+
490492 Object3D clone = (Object3D)Grafreed.clone(obj);
493
+
494
+ clone.ResetUUIDs();
495
+
491496 obj.parent = parent;
492497 // obj.support = support;
493498 // clone.support = support; // aout 2013
....@@ -2843,7 +2848,7 @@
28432848 if (source == saveVersionButton)
28442849 {
28452850 // Save a new version
2846
- if (!Save(true))
2851
+ if (!DuplicateVersion()) //true))
28472852 java.awt.Toolkit.getDefaultToolkit().beep();
28482853 } else
28492854 if (source == deleteVersionButton)
ObjEditor.java
....@@ -4552,7 +4552,7 @@
45524552 SetCameras();
45534553 }
45544554
4555
- public boolean Save(boolean user)
4555
+ public boolean DuplicateVersion() // boolean user)
45564556 {
45574557 System.err.println("Save");
45584558 //Replace();
Object3D.java
....@@ -1318,6 +1318,30 @@
13181318 return false;
13191319 }
13201320
1321
+ void ResetUUIDs()
1322
+ {
1323
+ if (blockloop)
1324
+ {
1325
+ return;
1326
+ }
1327
+
1328
+ this.uuid = null;
1329
+
1330
+ blockloop = true;
1331
+
1332
+ for (int i = 0; i < Size(); i++)
1333
+ {
1334
+ Object3D obj = (Object3D) Children().get(i);
1335
+
1336
+ if (obj != null)
1337
+ {
1338
+ obj.ResetUUIDs();
1339
+ }
1340
+ }
1341
+
1342
+ blockloop = false;
1343
+ }
1344
+
13211345 boolean IsInfinite()
13221346 {
13231347 if (blockloop)
....@@ -8290,10 +8314,10 @@
82908314 } // + super.toString();
82918315 //return name + " (" + (SizeOf.deepSizeOf(this)/1024) + "K) " + this.getClass().getName();
82928316
8293
-// if (!Globals.ADVANCED)
8294
-// return objname;
8317
+ if (!Globals.ADVANCED)
8318
+ return objname;
82958319
8296
- return objname; // + " " + System.identityHashCode(this) + " " + GetUUID();
8320
+ return objname + " " + System.identityHashCode(this) + " " + GetUUID();
82978321 }
82988322
82998323 public int hashCode()