Normand Briere
2019-07-14 bc829f47837b5a001f911542140b0b8e63c2bb0c
Fix extract big data.
7 files modified
225 ■■■■■ changed files
CameraPane.java 53 ●●●● patch | view | raw | blame | history
Globals.java 2 ●●● patch | view | raw | blame | history
GroupEditor.java 36 ●●●● patch | view | raw | blame | history
Mocap.java 10 ●●●●● patch | view | raw | blame | history
ObjEditor.java 50 ●●●●● patch | view | raw | blame | history
Object3D.java 72 ●●●●● patch | view | raw | blame | history
cRadio.java 2 ●●● patch | view | raw | blame | history
CameraPane.java
....@@ -11028,9 +11028,9 @@
1102811028
1102911029 gl.glMatrixMode(GL.GL_MODELVIEW);
1103011030
11031
-//gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11032
-//gl.glEnable(gl.GL_POLYGON_SMOOTH);
11033
-//gl.glEnable(gl.GL_MULTISAMPLE);
11031
+gl.glEnable(gl.GL_POLYGON_SMOOTH);
11032
+gl.glHint(gl.GL_POLYGON_SMOOTH_HINT, gl.GL_NICEST);
11033
+gl.glEnable(gl.GL_MULTISAMPLE);
1103411034 } else
1103511035 {
1103611036 //gl.glDisable(GL.GL_TEXTURE_2D);
....@@ -11041,7 +11041,7 @@
1104111041 //System.out.println("BLENDING ON");
1104211042 gl.glEnable(GL.GL_BLEND);
1104311043 gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
11044
-
11044
+// gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATE, GL.GL_ONE);
1104511045 gl.glMatrixMode(gl.GL_PROJECTION);
1104611046 gl.glLoadIdentity();
1104711047
....@@ -14297,12 +14297,12 @@
1429714297 void GoDown(int mod)
1429814298 {
1429914299 MODIFIERS |= COMMAND;
14300
- /*
14300
+ /**/
1430114301 if((mod&SHIFT) == SHIFT)
1430214302 manipCamera.RotatePosition(0, -speed);
1430314303 else
14304
- manipCamera.BackForth(0, -speed*delta, getWidth());
14305
- */
14304
+ manipCamera.BackForth(0, -speed*delta, 0); // getWidth());
14305
+ /**/
1430614306 if ((mod & SHIFT) == SHIFT)
1430714307 {
1430814308 mouseMode = mouseMode; // VR??
....@@ -14318,12 +14318,12 @@
1431814318 void GoUp(int mod)
1431914319 {
1432014320 MODIFIERS |= COMMAND;
14321
- /*
14321
+ /**/
1432214322 if((mod&SHIFT) == SHIFT)
1432314323 manipCamera.RotatePosition(0, speed);
1432414324 else
14325
- manipCamera.BackForth(0, speed*delta, getWidth());
14326
- */
14325
+ manipCamera.BackForth(0, speed*delta, 0); // getWidth());
14326
+ /**/
1432714327 if ((mod & SHIFT) == SHIFT)
1432814328 {
1432914329 mouseMode = mouseMode;
....@@ -14339,12 +14339,12 @@
1433914339 void GoLeft(int mod)
1434014340 {
1434114341 MODIFIERS |= COMMAND;
14342
- /*
14342
+ /**/
1434314343 if((mod&SHIFT) == SHIFT)
14344
- manipCamera.RotatePosition(speed, 0);
14345
- else
1434614344 manipCamera.Translate(speed*delta, 0, getWidth());
14347
- */
14345
+ else
14346
+ manipCamera.RotatePosition(speed, 0);
14347
+ /**/
1434814348 if ((mod & SHIFT) == SHIFT)
1434914349 {
1435014350 mouseMode = mouseMode;
....@@ -14360,12 +14360,12 @@
1436014360 void GoRight(int mod)
1436114361 {
1436214362 MODIFIERS |= COMMAND;
14363
- /*
14363
+ /**/
1436414364 if((mod&SHIFT) == SHIFT)
14365
- manipCamera.RotatePosition(-speed, 0);
14366
- else
1436714365 manipCamera.Translate(-speed*delta, 0, getWidth());
14368
- */
14366
+ else
14367
+ manipCamera.RotatePosition(-speed, 0);
14368
+ /**/
1436914369 if ((mod & SHIFT) == SHIFT)
1437014370 {
1437114371 mouseMode = mouseMode;
....@@ -14946,7 +14946,9 @@
1494614946 case 'E' : COMPACT ^= true;
1494714947 repaint();
1494814948 break;
14949
- case 'W' : DEBUGHSB ^= true;
14949
+ case 'W' : // Wide Window (fullscreen)
14950
+ //DEBUGHSB ^= true;
14951
+ ObjEditor.theFrame.ToggleFullScreen();
1495014952 repaint();
1495114953 break;
1495214954 case 'u' : Udebug ^= true; Vdebug = false; NORMALdebug = false; programInitialized = false; repaint(); break;
....@@ -14972,13 +14974,7 @@
1497214974 repaint();
1497314975 break;
1497414976 case 'l':
14975
- lightMode ^= true;
14976
- Globals.lighttouched = true;
14977
- manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
14978
- targetLookAt.set(manipCamera.lookAt);
14979
- repaint();
14980
- break;
14981
- case 'L':
14977
+ //case 'L':
1498214978 if (lightMode)
1498314979 {
1498414980 lightMode = false;
....@@ -15125,7 +15121,10 @@
1512515121 // kompactbit = 6;
1512615122 // break;
1512715123 case ' ':
15128
- ObjEditor.theFrame.ToggleFullScreen();
15124
+ lightMode ^= true;
15125
+ Globals.lighttouched = true;
15126
+ manipCamera = renderCamera = lightMode ? lightCamera : eyeCamera;
15127
+ targetLookAt.set(manipCamera.lookAt);
1512915128 repaint();
1513015129 break;
1513115130 //case '`' :
Globals.java
....@@ -10,7 +10,7 @@
1010 public static boolean COMPUTESHADOWWHENLIVE = true;
1111 public static boolean RENDERSHADOW = true;
1212
13
- public static boolean SAVEONMAKE = false; // problems when auto-save (works with manual save)
13
+ public static boolean SAVEONMAKE = true; // problems when auto-save (works with manual save)
1414
1515 public static boolean MOUSEDRAGGED = false;
1616 public static boolean TIMERRUNNING = false;
GroupEditor.java
....@@ -84,6 +84,10 @@
8484
8585 void CloneSelection(boolean supports)
8686 {
87
+ if (Globals.SAVEONMAKE)
88
+ Save();
89
+ boolean keep = Globals.SAVEONMAKE;
90
+ Globals.SAVEONMAKE = false;
8791 // Object3D keep = GrafreeD.clipboard;
8892 //Object3D obj;
8993 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +98,7 @@
9498
9599 makeSomething(clone, i==group.selection.size()-1);
96100 }
101
+ Globals.SAVEONMAKE = keep;
97102 }
98103
99104 void CloneClipboard(boolean supports)
....@@ -380,14 +385,14 @@
380385 shadowYItem.addActionListener(this);
381386 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382387 shadowZItem.addActionListener(this);
388
+ attributeItem = menu.add(new MenuItem("Attribute"));
389
+ attributeItem.addActionListener(this);
383390
384391 if (Globals.ADVANCED)
385392 {
386393 menu.add("-");
387394 linkerItem = menu.add(new MenuItem("Linker"));
388395 linkerItem.addActionListener(this);
389
- attributeItem = menu.add(new MenuItem("Attribute"));
390
- attributeItem.addActionListener(this);
391396 templateItem = menu.add(new MenuItem("Template"));
392397 templateItem.addActionListener(this);
393398 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -971,7 +976,7 @@
971976 {
972977 cRadio radioButton = new cRadio(obj.name);
973978
974
- // Patch to avoid bug with transparency.
979
+ // June 2019. Patch to avoid bug with transparency.
975980 radioButton.hadMaterial = obj.material != null;
976981 if (!radioButton.hadMaterial)
977982 {
....@@ -1223,7 +1228,7 @@
12231228 // return;
12241229 // }
12251230
1226
- String string = (String) object;
1231
+ String string = object.toString();
12271232
12281233 // File path for Mac and Windows
12291234 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1488,6 +1493,8 @@
14881493 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14891494 reduce34MorphItem.addActionListener(this);
14901495 menu.add("-");
1496
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1497
+ memoryItem.addActionListener(this);
14911498 menu.add(computeAOItem = new MenuItem("Compute AO"));
14921499 computeAOItem.addActionListener(this);
14931500
....@@ -1496,8 +1503,6 @@
14961503 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14971504 mirrorItem.addActionListener(this);
14981505 menu.add("-");
1499
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1500
- memoryItem.addActionListener(this);
15011506 menu.add(analyzeItem = new MenuItem("Analyze"));
15021507 analyzeItem.addActionListener(this);
15031508 menu.add(dumpItem = new MenuItem("Print"));
....@@ -4833,8 +4838,8 @@
48334838
48344839 if (cut)
48354840 {
4836
- if (Globals.SAVEONMAKE)
4837
- Save();
4841
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
4842
+// Save();
48384843 //int indices[] = jList.getSelectedIndices();
48394844 //for (int i = indices.length - 1; i >= 0; i--)
48404845 //jList.remove(indices[i]);
....@@ -4937,6 +4942,10 @@
49374942
49384943 void paste(boolean expand)
49394944 {
4945
+ if (Globals.SAVEONMAKE)
4946
+ Save();
4947
+ boolean keep = Globals.SAVEONMAKE;
4948
+ Globals.SAVEONMAKE = false;
49404949 // if (GrafreeD.clipboard == null)
49414950 // return;
49424951 boolean first = true;
....@@ -4996,6 +5005,7 @@
49965005 Grafreed.clipboard.get(0).parent = keepparent;
49975006 }
49985007
5008
+ Globals.SAVEONMAKE = keep;
49995009 ResetModel();
50005010 refreshContents();
50015011 }
....@@ -5131,6 +5141,10 @@
51315141
51325142 void group(Object3D csg, boolean grab)
51335143 {
5144
+ if (Globals.SAVEONMAKE)
5145
+ Save();
5146
+ boolean keep = Globals.SAVEONMAKE;
5147
+ Globals.SAVEONMAKE = false;
51345148 if (//false) // why??
51355149 !group.selection.isEmpty())
51365150 {
....@@ -5244,10 +5258,15 @@
52445258 //node.add(csg);
52455259 //makeSomething(node);
52465260 makeSomething(csg);
5261
+ Globals.SAVEONMAKE = keep;
52475262 }
52485263
52495264 void Ungroup(Object3D g)
52505265 {
5266
+ if (Globals.SAVEONMAKE)
5267
+ Save();
5268
+ boolean keep = Globals.SAVEONMAKE;
5269
+ Globals.SAVEONMAKE = false;
52515270 if (g instanceof HiddenObject)
52525271 {
52535272 HiddenObject h = (HiddenObject) g;
....@@ -5264,6 +5283,7 @@
52645283 objEditor.makeSomething(g.get(i), false);
52655284 }
52665285 }
5286
+ Globals.SAVEONMAKE = keep;
52675287 }
52685288
52695289 void ungroup()
Mocap.java
....@@ -261,6 +261,8 @@
261261
262262 // LA.matConcat(toParent, hip.get(0).toParent, toParent);
263263
264
+ CameraPane.CreateSelectedPoint();
265
+
264266 CameraPane.debugpointG.toParent[3][0] = poship.x;
265267 CameraPane.debugpointG.toParent[3][1] = poship.y;
266268 CameraPane.debugpointG.toParent[3][2] = poship.z;
....@@ -649,8 +651,8 @@
649651 {
650652 super.ExtractBigData(o);
651653
652
- o.bvh = this.bvh;
653
- o.skeleton = this.skeleton;
654
+ o.savebvh = this.bvh;
655
+ o.saveskeleton = this.skeleton;
654656 this.bvh = null;
655657 this.skeleton = null;
656658 }
....@@ -659,8 +661,8 @@
659661 {
660662 super.RestoreBigData(o);
661663
662
- this.bvh = o.bvh;
663
- this.skeleton = o.skeleton;
664
+ this.bvh = o.savebvh;
665
+ this.skeleton = o.saveskeleton;
664666 }
665667
666668 boolean smoothed;
ObjEditor.java
....@@ -1174,10 +1174,11 @@
11741174 randomCB = AddCheckBox(setupPanel2, "Random", copy.random);
11751175 randomCB.setToolTipText("Randomly Rewind (or Go back and forth)");
11761176
1177
+ link2masterCB = AddCheckBox(setupPanel2, "Support", copy.link2master);
1178
+ link2masterCB.setToolTipText("Attach to support");
1179
+
11771180 if (Globals.ADVANCED)
11781181 {
1179
- link2masterCB = AddCheckBox(setupPanel2, "Supp", copy.link2master);
1180
- link2masterCB.setToolTipText("Attach to support");
11811182 speedupCB = AddCheckBox(setupPanel2, "Speed", copy.speedup);
11821183 speedupCB.setToolTipText("Option motion capture");
11831184 }
....@@ -3480,8 +3481,8 @@
34803481 try
34813482 {
34823483 ByteArrayOutputStream baos = new ByteArrayOutputStream();
3483
- java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3484
- ObjectOutputStream out = new ObjectOutputStream(zstream);
3484
+// java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos);
3485
+ ObjectOutputStream out = new ObjectOutputStream(baos); //zstream);
34853486
34863487 Object3D parent = o.parent;
34873488 o.parent = null;
....@@ -3492,10 +3493,14 @@
34923493
34933494 out.flush();
34943495
3495
- zstream.close();
3496
+ baos //zstream
3497
+ .close();
34963498 out.close();
34973499
3498
- return baos.toByteArray();
3500
+ byte[] bytes = baos.toByteArray();
3501
+
3502
+ System.out.println("save #bytes = " + bytes.length);
3503
+ return bytes;
34993504 } catch (Exception e)
35003505 {
35013506 System.err.println(e);
....@@ -3505,13 +3510,16 @@
35053510
35063511 static public Object Uncompress(byte[] bytes)
35073512 {
3508
- System.out.println("#bytes = " + bytes.length);
3513
+ System.out.println("restore #bytes = " + bytes.length);
35093514 try
35103515 {
35113516 ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
3512
- java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3513
- ObjectInputStream in = new ObjectInputStream(istream);
3517
+ //java.util.zip.GZIPInputStream istream = new java.util.zip.GZIPInputStream(bais);
3518
+ ObjectInputStream in = new ObjectInputStream(bais); // istream);
35143519 Object obj = in.readObject();
3520
+
3521
+ bais //istream
3522
+ .close();
35153523 in.close();
35163524
35173525 return obj;
....@@ -3570,7 +3578,6 @@
35703578
35713579 public void Save()
35723580 {
3573
- // Default reduces the probability of heuristics errors.
35743581 Save(true);
35753582 }
35763583
....@@ -3616,8 +3623,13 @@
36163623 //EditorFrame.m_MainFrame.requestFocusInWindow();
36173624 if (!thesame)
36183625 {
3619
- tab.user[tab.undoindex] = user;
3620
- tab.graphs[tab.undoindex++] = compress;
3626
+ //tab.user[tab.undoindex] = user;
3627
+ boolean increment = tab.graphs[tab.undoindex] == null;
3628
+
3629
+ tab.graphs[tab.undoindex] = compress;
3630
+
3631
+ if (increment)
3632
+ tab.undoindex++;
36213633 }
36223634
36233635 copy.RestoreBigData(hashtable);
....@@ -3626,8 +3638,8 @@
36263638
36273639 for (int i = tab.undoindex; i < tab.graphs.length; i++)
36283640 {
3629
- tab.user[i] = false;
3630
- tab.graphs[i] = null;
3641
+ //tab.user[i] = false;
3642
+ // tab.graphs[i] = null;
36313643 }
36323644
36333645 SetUndoStates();
....@@ -3720,7 +3732,7 @@
37203732 return false;
37213733 }
37223734
3723
- if (tab.graphs[tab.undoindex] == null || !tab.user[tab.undoindex])
3735
+ if (tab.graphs[tab.undoindex] == null) // || !tab.user[tab.undoindex])
37243736 {
37253737 if (Save(false))
37263738 tab.undoindex -= 1;
....@@ -3754,8 +3766,8 @@
37543766
37553767 CopyChanged((Object3D)Uncompress(tab.graphs[tab.undoindex]));
37563768
3757
- if (!tab.user[tab.undoindex])
3758
- tab.graphs[tab.undoindex] = null;
3769
+ //if (!tab.user[tab.undoindex])
3770
+ // tab.graphs[tab.undoindex] = null;
37593771 }
37603772
37613773 void ImportGFD()
....@@ -4718,8 +4730,8 @@
47184730
47194731 if (readobj != null)
47204732 {
4721
- if (Globals.SAVEONMAKE)
4722
- Save();
4733
+ //if (Globals.SAVEONMAKE) // A new object cannot share meshes
4734
+ // Save();
47234735 try
47244736 {
47254737 //readobj.deepCopySelf(copy);
Object3D.java
....@@ -24,9 +24,9 @@
2424
2525 private UUID uuid = UUID.randomUUID();
2626
27
- // TEMPORARY for mocap undo
28
- mocap.reader.BVHReader.BVHResult bvh;
29
- Object3D skeleton;
27
+ // TEMPORARY for mocap undo. No need to be transient.
28
+ mocap.reader.BVHReader.BVHResult savebvh;
29
+ Object3D saveskeleton;
3030 //
3131
3232 ScriptNode scriptnode;
....@@ -170,24 +170,35 @@
170170
171171 void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
172172 {
173
+ Object3D o;
174
+
173175 if (hashtable.containsKey(GetUUID()))
174176 {
175
- Object3D o = hashtable.get(GetUUID());
177
+ o = hashtable.get(GetUUID());
176178
177179 Grafreed.Assert(this.bRep == o.bRep);
178
- if (this.bRep != null)
179
- assert(this.bRep.support == o.transientrep);
180
+ //if (this.bRep != null)
181
+ // assert(this.bRep.support == o.transientrep);
182
+ if (this.support != null)
183
+ assert(this.support.bRep == o.transientrep);
184
+ }
185
+ else
186
+ {
187
+ o = new Object3D("copy of " + this.name);
180188
181
- return;
189
+ hashtable.put(GetUUID(), o);
182190 }
183191
184
- Object3D o = new Object3D("copy of " + this.name);
185
-
186
- hashtable.put(GetUUID(), o);
187
-
188
- for (int i=0; i<Size(); i++)
192
+ if (!blockloop)
189193 {
190
- get(i).ExtractBigData(hashtable);
194
+ blockloop = true;
195
+
196
+ for (int i=0; i<Size(); i++)
197
+ {
198
+ get(i).ExtractBigData(hashtable);
199
+ }
200
+
201
+ blockloop = false;
191202 }
192203
193204 ExtractBigData(o);
....@@ -195,11 +206,23 @@
195206
196207 void ExtractBigData(Object3D o)
197208 {
209
+ if (o.bRep != null)
210
+ Grafreed.Assert(o.bRep == this.bRep);
211
+
198212 o.bRep = this.bRep;
199
- if (this.bRep != null)
213
+// July 2019 if (this.bRep != null)
214
+// {
215
+// o.transientrep = this.bRep.support;
216
+// o.bRep.support = null;
217
+// }
218
+
219
+ if (this.support != null)
200220 {
201
- o.transientrep = this.bRep.support;
202
- o.bRep.support = null;
221
+ if (o.transientrep != null)
222
+ Grafreed.Assert(o.transientrep == this.support.bRep);
223
+
224
+ o.transientrep = this.support.bRep;
225
+ this.support.bRep = null;
203226 }
204227
205228 // o.support = this.support;
....@@ -219,14 +242,14 @@
219242 if (!hashtable.containsKey(GetUUID()))
220243 return;
221244
245
+ Object3D o = hashtable.get(GetUUID());
246
+
247
+ RestoreBigData(o);
248
+
222249 if (blockloop)
223250 return;
224251
225252 blockloop = true;
226
-
227
- Object3D o = hashtable.get(GetUUID());
228
-
229
- RestoreBigData(o);
230253
231254 //hashtable.remove(GetUUID());
232255
....@@ -241,8 +264,12 @@
241264 void RestoreBigData(Object3D o)
242265 {
243266 this.bRep = o.bRep;
244
- if (this.bRep != null)
245
- this.bRep.support = o.transientrep;
267
+ if (this.support != null && o.transientrep != null)
268
+ {
269
+ this.support.bRep = o.transientrep;
270
+ }
271
+// July 2019 if (this.bRep != null)
272
+// this.bRep.support = o.transientrep;
246273 // this.support = o.support;
247274 // this.fileparent = o.fileparent;
248275 }
....@@ -1374,6 +1401,7 @@
13741401 toParent = LA.newMatrix();
13751402 fromParent = LA.newMatrix();
13761403 }
1404
+
13771405 LA.matCopy(other.toParent, toParent);
13781406 LA.matCopy(other.fromParent, fromParent);
13791407
cRadio.java
....@@ -36,7 +36,7 @@
3636 }
3737
3838 byte[] graphs[] = new byte[100][];
39
- boolean[] user = new boolean[100];
39
+ //boolean[] user = new boolean[100];
4040
4141 int undoindex = 0;
4242