Normand Briere
2019-08-16 83d0c2fa0bd2e96448f776144e1a89cdb1bb6998
Object3D.java
....@@ -22,6 +22,7 @@
2222 //static final long serialVersionUID = -607422624994562685L;
2323 static final long serialVersionUID = 5022536242724664900L;
2424
25
+ // Use GetUUID for backward compatibility with null.
2526 private UUID uuid = UUID.randomUUID();
2627
2728 // TEMPORARY for mocap undo. No need to be transient.
....@@ -32,9 +33,11 @@
3233 String skyboxname;
3334 String skyboxext;
3435
35
- byte[] versions[];
36
+ Object3D versionlist[];
3637 int versionindex = -1;
3738
39
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>();
40
+
3841 ScriptNode scriptnode;
3942
4043 void InitOthers()
....@@ -222,7 +225,7 @@
222225 // o.bRep.support = null;
223226 // }
224227 o.selection = this.selection;
225
- o.versions = this.versions;
228
+ o.versionlist = this.versionlist;
226229 o.versionindex = this.versionindex;
227230
228231 if (this.support != null)
....@@ -245,6 +248,29 @@
245248 // this.support = null;
246249 // this.fileparent = null;
247250 }
251
+
252
+// Object3D GetObject(java.util.UUID uuid)
253
+// {
254
+// if (this.uuid.equals(uuid))
255
+// return this;
256
+//
257
+// if (blockloop)
258
+// return null;
259
+//
260
+// blockloop = true;
261
+//
262
+// for (int i=0; i<Size(); i++)
263
+// {
264
+// Object3D o = get(i).GetObject(uuid);
265
+//
266
+// if (o != null)
267
+// return o;
268
+// }
269
+//
270
+// blockloop = false;
271
+//
272
+// return null;
273
+// }
248274
249275 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
250276 {
....@@ -280,7 +306,7 @@
280306
281307 this.selection = o.selection;
282308
283
- this.versions = o.versions;
309
+ this.versionlist = o.versionlist;
284310 this.versionindex = o.versionindex;
285311 // July 2019 if (this.bRep != null)
286312 // this.bRep.support = o.transientrep;
....@@ -2444,6 +2470,11 @@
24442470 else
24452471 {
24462472 //((ObjEditor)editWindow).SetupUI2(null);
2473
+ if (objectUI != null)
2474
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2475
+ else
2476
+ //new Exception().printStackTrace();
2477
+ System.err.println("objectUI is null");
24472478 }
24482479 }
24492480
....@@ -5545,6 +5576,11 @@
55455576 if (fullname == null)
55465577 return "";
55475578
5579
+ if (fullname.pigment != null)
5580
+ {
5581
+ return fullname.pigment;
5582
+ }
5583
+
55485584 // System.out.println("Fullname = " + fullname);
55495585
55505586 // Does not work on Windows due to C:
....@@ -5557,7 +5593,7 @@
55575593
55585594 if (split.length == 0)
55595595 {
5560
- return "";
5596
+ return fullname.pigment = "";
55615597 }
55625598
55635599 if (split.length <= 2)
....@@ -5565,22 +5601,27 @@
55655601 if (fullname.name.endsWith(":"))
55665602 {
55675603 // Windows
5568
- return fullname.name.substring(0, fullname.name.length()-1);
5604
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55695605 }
55705606
5571
- return split[0];
5607
+ return fullname.pigment = split[0];
55725608 }
55735609
55745610 // Windows
55755611 assert(split.length == 4);
55765612
5577
- return split[0] + ":" + split[1];
5613
+ return fullname.pigment = split[0] + ":" + split[1];
55785614 }
55795615
55805616 static String GetBump(cTexture fullname)
55815617 {
55825618 if (fullname == null)
55835619 return "";
5620
+
5621
+ if (fullname.bump != null)
5622
+ {
5623
+ return fullname.bump;
5624
+ }
55845625
55855626 // System.out.println("Fullname = " + fullname);
55865627 // Does not work on Windows due to C:
....@@ -5592,12 +5633,12 @@
55925633
55935634 if (split.length == 0)
55945635 {
5595
- return "";
5636
+ return fullname.bump = "";
55965637 }
55975638
55985639 if (split.length == 1)
55995640 {
5600
- return "";
5641
+ return fullname.bump = "";
56015642 }
56025643
56035644 if (split.length == 2)
....@@ -5605,16 +5646,16 @@
56055646 if (fullname.name.endsWith(":"))
56065647 {
56075648 // Windows
5608
- return "";
5649
+ return fullname.bump = "";
56095650 }
56105651
5611
- return split[1];
5652
+ return fullname.bump = split[1];
56125653 }
56135654
56145655 // Windows
56155656 assert(split.length == 4);
56165657
5617
- return split[2] + ":" + split[3];
5658
+ return fullname.bump = split[2] + ":" + split[3];
56185659 }
56195660
56205661 String GetPigmentTexture()
....@@ -5697,6 +5738,9 @@
56975738 texname = "";
56985739
56995740 GetTextures().name = texname + ":" + GetBump(GetTextures());
5741
+
5742
+ GetTextures().pigment = null;
5743
+
57005744 Touch();
57015745 }
57025746
....@@ -5769,6 +5813,8 @@
57695813 texname = "";
57705814
57715815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5816
+
5817
+ GetTextures().bump = null;
57725818
57735819 Touch();
57745820 }
....@@ -7373,7 +7419,7 @@
73737419 boundary.y = spot.y - 30;
73747420 boundary.width = spot.width + 60;
73757421 boundary.height = spot.height + 60;
7376
- clickInfo.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
73777423 int spotw = spot.x + spot.width;
73787424 int spoth = spot.y + spot.height;
73797425 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7393,7 +7439,29 @@
73937439 // {
73947440 // CameraPane.Ymax = spoth;
73957441 // }
7396
- spot.translate(32, 32);
7442
+// if (CameraPane.Xmin > spot.x)
7443
+// {
7444
+// CameraPane.Xmin = spot.x;
7445
+// }
7446
+// if (CameraPane.Xmax < spotw)
7447
+// {
7448
+// CameraPane.Xmax = spotw;
7449
+// }
7450
+// if (CameraPane.Ymin > spot.y)
7451
+// {
7452
+// CameraPane.Ymin = spot.y;
7453
+// }
7454
+// if (CameraPane.Ymax < spoth)
7455
+// {
7456
+// CameraPane.Ymax = spoth;
7457
+// }
7458
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7459
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7460
+ spot.translate(32, 0);
7461
+ clickInfo.g.setColor(Color.yellow);
7462
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7463
+
7464
+ spot.translate(32, 64);
73977465 spotw = spot.x + spot.width;
73987466 spoth = spot.y + spot.height;
73997467 clickInfo.g.setColor(Color.cyan);
....@@ -7414,28 +7482,7 @@
74147482 // {
74157483 // CameraPane.Ymax = spoth;
74167484 // }
7417
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7418
- //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7419
- spot.translate(0, -32);
7420
- clickInfo.g.setColor(Color.yellow);
7421
- clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
74227485 clickInfo.g.setColor(Color.green);
7423
-// if (CameraPane.Xmin > spot.x)
7424
-// {
7425
-// CameraPane.Xmin = spot.x;
7426
-// }
7427
-// if (CameraPane.Xmax < spotw)
7428
-// {
7429
-// CameraPane.Xmax = spotw;
7430
-// }
7431
-// if (CameraPane.Ymin > spot.y)
7432
-// {
7433
-// CameraPane.Ymin = spot.y;
7434
-// }
7435
-// if (CameraPane.Ymax < spoth)
7436
-// {
7437
-// CameraPane.Ymax = spoth;
7438
-// }
74397486 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74407487 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74417488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7494,12 +7541,14 @@
74947541 retval = true;
74957542 }
74967543 spot.translate(0, 32);
7544
+ spot.translate(32, 0);
7545
+ spot.translate(0, 32);
74977546 if (spot.contains(clickInfo.x, clickInfo.y))
74987547 {
74997548 hitSomething = hitScale;
75007549
75017550 double scale = 0.005f * clickInfo.camera.Distance();
7502
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7551
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75037552 double sign = 1;
75047553 if (hScale < 0)
75057554 {
....@@ -7511,7 +7560,7 @@
75117560 //hScale = 0.01;
75127561 }
75137562
7514
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7563
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75157564 sign = 1;
75167565 if (vScale < 0)
75177566 {
....@@ -7726,7 +7775,7 @@
77267775 break;
77277776
77287777 case hitScale: // scale
7729
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77307779 double sign = 1;
77317780 if (hScale < 0)
77327781 {
....@@ -7738,7 +7787,7 @@
77387787 //hScale = 0.01;
77397788 }
77407789
7741
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77427791 sign = 1;
77437792 if (vScale < 0)
77447793 {
....@@ -7771,21 +7820,27 @@
77717820 case 3: // '\001'
77727821 if (modified || opposite)
77737822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
77747826 //LA.matScale(toParent, 1, hScale, vScale);
7775
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
77767828 } // vScale, 1);
77777829 else
77787830 {
77797831 // EXCEPTION!
7780
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
77817833 } // vScale, 1);
77827834 break;
77837835
77847836 case 2: // '\002'
77857837 if (modified || opposite)
77867838 {
7787
- //LA.matScale(toParent, hScale, 1, vScale);
7788
- LA.matScale(toParent, 1, totalScale, 1);
7839
+ if (modified && opposite)
7840
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7841
+ else
7842
+ //LA.matScale(toParent, hScale, 1, vScale);
7843
+ LA.matScale(toParent, 1, totalScale, 1);
77897844 } else
77907845 {
77917846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7795,8 +7850,11 @@
77957850 case 1: // '\003'
77967851 if (modified || opposite)
77977852 {
7798
- //LA.matScale(toParent, hScale, vScale, 1);
7799
- LA.matScale(toParent, 1, 1, totalScale);
7853
+ if (modified && opposite)
7854
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7855
+ else
7856
+ //LA.matScale(toParent, hScale, vScale, 1);
7857
+ LA.matScale(toParent, 1, 1, totalScale);
78007858 } else
78017859 {
78027860 LA.matScale(toParent, totalScale, totalScale, 1);