Normand Briere
2019-08-16 83d0c2fa0bd2e96448f776144e1a89cdb1bb6998
Object3D.java
....@@ -36,6 +36,8 @@
3636 Object3D versionlist[];
3737 int versionindex = -1;
3838
39
+ java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>();
40
+
3941 ScriptNode scriptnode;
4042
4143 void InitOthers()
....@@ -2468,7 +2470,11 @@
24682470 else
24692471 {
24702472 //((ObjEditor)editWindow).SetupUI2(null);
2471
- ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2473
+ if (objectUI != null)
2474
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2475
+ else
2476
+ //new Exception().printStackTrace();
2477
+ System.err.println("objectUI is null");
24722478 }
24732479 }
24742480
....@@ -5570,6 +5576,11 @@
55705576 if (fullname == null)
55715577 return "";
55725578
5579
+ if (fullname.pigment != null)
5580
+ {
5581
+ return fullname.pigment;
5582
+ }
5583
+
55735584 // System.out.println("Fullname = " + fullname);
55745585
55755586 // Does not work on Windows due to C:
....@@ -5582,7 +5593,7 @@
55825593
55835594 if (split.length == 0)
55845595 {
5585
- return "";
5596
+ return fullname.pigment = "";
55865597 }
55875598
55885599 if (split.length <= 2)
....@@ -5590,22 +5601,27 @@
55905601 if (fullname.name.endsWith(":"))
55915602 {
55925603 // Windows
5593
- return fullname.name.substring(0, fullname.name.length()-1);
5604
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55945605 }
55955606
5596
- return split[0];
5607
+ return fullname.pigment = split[0];
55975608 }
55985609
55995610 // Windows
56005611 assert(split.length == 4);
56015612
5602
- return split[0] + ":" + split[1];
5613
+ return fullname.pigment = split[0] + ":" + split[1];
56035614 }
56045615
56055616 static String GetBump(cTexture fullname)
56065617 {
56075618 if (fullname == null)
56085619 return "";
5620
+
5621
+ if (fullname.bump != null)
5622
+ {
5623
+ return fullname.bump;
5624
+ }
56095625
56105626 // System.out.println("Fullname = " + fullname);
56115627 // Does not work on Windows due to C:
....@@ -5617,12 +5633,12 @@
56175633
56185634 if (split.length == 0)
56195635 {
5620
- return "";
5636
+ return fullname.bump = "";
56215637 }
56225638
56235639 if (split.length == 1)
56245640 {
5625
- return "";
5641
+ return fullname.bump = "";
56265642 }
56275643
56285644 if (split.length == 2)
....@@ -5630,16 +5646,16 @@
56305646 if (fullname.name.endsWith(":"))
56315647 {
56325648 // Windows
5633
- return "";
5649
+ return fullname.bump = "";
56345650 }
56355651
5636
- return split[1];
5652
+ return fullname.bump = split[1];
56375653 }
56385654
56395655 // Windows
56405656 assert(split.length == 4);
56415657
5642
- return split[2] + ":" + split[3];
5658
+ return fullname.bump = split[2] + ":" + split[3];
56435659 }
56445660
56455661 String GetPigmentTexture()
....@@ -5722,6 +5738,9 @@
57225738 texname = "";
57235739
57245740 GetTextures().name = texname + ":" + GetBump(GetTextures());
5741
+
5742
+ GetTextures().pigment = null;
5743
+
57255744 Touch();
57265745 }
57275746
....@@ -5794,6 +5813,8 @@
57945813 texname = "";
57955814
57965815 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5816
+
5817
+ GetTextures().bump = null;
57975818
57985819 Touch();
57995820 }
....@@ -7398,7 +7419,7 @@
73987419 boundary.y = spot.y - 30;
73997420 boundary.width = spot.width + 60;
74007421 boundary.height = spot.height + 60;
7401
- clickInfo.g.setColor(Color.red);
7422
+ clickInfo.g.setColor(Color.white);
74027423 int spotw = spot.x + spot.width;
74037424 int spoth = spot.y + spot.height;
74047425 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7418,7 +7439,29 @@
74187439 // {
74197440 // CameraPane.Ymax = spoth;
74207441 // }
7421
- 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);
74227465 spotw = spot.x + spot.width;
74237466 spoth = spot.y + spot.height;
74247467 clickInfo.g.setColor(Color.cyan);
....@@ -7439,28 +7482,7 @@
74397482 // {
74407483 // CameraPane.Ymax = spoth;
74417484 // }
7442
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7443
- //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7444
- spot.translate(0, -32);
7445
- clickInfo.g.setColor(Color.yellow);
7446
- clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
74477485 clickInfo.g.setColor(Color.green);
7448
-// if (CameraPane.Xmin > spot.x)
7449
-// {
7450
-// CameraPane.Xmin = spot.x;
7451
-// }
7452
-// if (CameraPane.Xmax < spotw)
7453
-// {
7454
-// CameraPane.Xmax = spotw;
7455
-// }
7456
-// if (CameraPane.Ymin > spot.y)
7457
-// {
7458
-// CameraPane.Ymin = spot.y;
7459
-// }
7460
-// if (CameraPane.Ymax < spoth)
7461
-// {
7462
-// CameraPane.Ymax = spoth;
7463
-// }
74647486 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74657487 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74667488 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7519,12 +7541,14 @@
75197541 retval = true;
75207542 }
75217543 spot.translate(0, 32);
7544
+ spot.translate(32, 0);
7545
+ spot.translate(0, 32);
75227546 if (spot.contains(clickInfo.x, clickInfo.y))
75237547 {
75247548 hitSomething = hitScale;
75257549
75267550 double scale = 0.005f * clickInfo.camera.Distance();
7527
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7551
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75287552 double sign = 1;
75297553 if (hScale < 0)
75307554 {
....@@ -7536,7 +7560,7 @@
75367560 //hScale = 0.01;
75377561 }
75387562
7539
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7563
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75407564 sign = 1;
75417565 if (vScale < 0)
75427566 {
....@@ -7751,7 +7775,7 @@
77517775 break;
77527776
77537777 case hitScale: // scale
7754
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7778
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77557779 double sign = 1;
77567780 if (hScale < 0)
77577781 {
....@@ -7763,7 +7787,7 @@
77637787 //hScale = 0.01;
77647788 }
77657789
7766
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7790
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77677791 sign = 1;
77687792 if (vScale < 0)
77697793 {
....@@ -7796,21 +7820,27 @@
77967820 case 3: // '\001'
77977821 if (modified || opposite)
77987822 {
7823
+ if (modified && opposite)
7824
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7825
+ else
77997826 //LA.matScale(toParent, 1, hScale, vScale);
7800
- LA.matScale(toParent, totalScale, 1, 1);
7827
+ LA.matScale(toParent, totalScale, 1, 1);
78017828 } // vScale, 1);
78027829 else
78037830 {
78047831 // EXCEPTION!
7805
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7832
+ LA.matScale(toParent, 1, totalScale, totalScale);
78067833 } // vScale, 1);
78077834 break;
78087835
78097836 case 2: // '\002'
78107837 if (modified || opposite)
78117838 {
7812
- //LA.matScale(toParent, hScale, 1, vScale);
7813
- 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);
78147844 } else
78157845 {
78167846 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7820,8 +7850,11 @@
78207850 case 1: // '\003'
78217851 if (modified || opposite)
78227852 {
7823
- //LA.matScale(toParent, hScale, vScale, 1);
7824
- 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);
78257858 } else
78267859 {
78277860 LA.matScale(toParent, totalScale, totalScale, 1);