Normand Briere
2019-08-16 64e20f390e4b8e58bd0006dde8fa10fba1dac1d5
Object3D.java
....@@ -2468,7 +2468,11 @@
24682468 else
24692469 {
24702470 //((ObjEditor)editWindow).SetupUI2(null);
2471
- ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2471
+ if (objectUI != null)
2472
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2473
+ else
2474
+ //new Exception().printStackTrace();
2475
+ System.err.println("objectUI is null");
24722476 }
24732477 }
24742478
....@@ -5570,6 +5574,11 @@
55705574 if (fullname == null)
55715575 return "";
55725576
5577
+ if (fullname.pigment != null)
5578
+ {
5579
+ return fullname.pigment;
5580
+ }
5581
+
55735582 // System.out.println("Fullname = " + fullname);
55745583
55755584 // Does not work on Windows due to C:
....@@ -5582,7 +5591,7 @@
55825591
55835592 if (split.length == 0)
55845593 {
5585
- return "";
5594
+ return fullname.pigment = "";
55865595 }
55875596
55885597 if (split.length <= 2)
....@@ -5590,22 +5599,27 @@
55905599 if (fullname.name.endsWith(":"))
55915600 {
55925601 // Windows
5593
- return fullname.name.substring(0, fullname.name.length()-1);
5602
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55945603 }
55955604
5596
- return split[0];
5605
+ return fullname.pigment = split[0];
55975606 }
55985607
55995608 // Windows
56005609 assert(split.length == 4);
56015610
5602
- return split[0] + ":" + split[1];
5611
+ return fullname.pigment = split[0] + ":" + split[1];
56035612 }
56045613
56055614 static String GetBump(cTexture fullname)
56065615 {
56075616 if (fullname == null)
56085617 return "";
5618
+
5619
+ if (fullname.bump != null)
5620
+ {
5621
+ return fullname.bump;
5622
+ }
56095623
56105624 // System.out.println("Fullname = " + fullname);
56115625 // Does not work on Windows due to C:
....@@ -5617,12 +5631,12 @@
56175631
56185632 if (split.length == 0)
56195633 {
5620
- return "";
5634
+ return fullname.bump = "";
56215635 }
56225636
56235637 if (split.length == 1)
56245638 {
5625
- return "";
5639
+ return fullname.bump = "";
56265640 }
56275641
56285642 if (split.length == 2)
....@@ -5630,16 +5644,16 @@
56305644 if (fullname.name.endsWith(":"))
56315645 {
56325646 // Windows
5633
- return "";
5647
+ return fullname.bump = "";
56345648 }
56355649
5636
- return split[1];
5650
+ return fullname.bump = split[1];
56375651 }
56385652
56395653 // Windows
56405654 assert(split.length == 4);
56415655
5642
- return split[2] + ":" + split[3];
5656
+ return fullname.bump = split[2] + ":" + split[3];
56435657 }
56445658
56455659 String GetPigmentTexture()
....@@ -5722,6 +5736,9 @@
57225736 texname = "";
57235737
57245738 GetTextures().name = texname + ":" + GetBump(GetTextures());
5739
+
5740
+ GetTextures().pigment = null;
5741
+
57255742 Touch();
57265743 }
57275744
....@@ -5794,6 +5811,8 @@
57945811 texname = "";
57955812
57965813 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5814
+
5815
+ GetTextures().bump = null;
57975816
57985817 Touch();
57995818 }
....@@ -7398,7 +7417,7 @@
73987417 boundary.y = spot.y - 30;
73997418 boundary.width = spot.width + 60;
74007419 boundary.height = spot.height + 60;
7401
- clickInfo.g.setColor(Color.red);
7420
+ clickInfo.g.setColor(Color.white);
74027421 int spotw = spot.x + spot.width;
74037422 int spoth = spot.y + spot.height;
74047423 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7418,7 +7437,29 @@
74187437 // {
74197438 // CameraPane.Ymax = spoth;
74207439 // }
7421
- spot.translate(32, 32);
7440
+// if (CameraPane.Xmin > spot.x)
7441
+// {
7442
+// CameraPane.Xmin = spot.x;
7443
+// }
7444
+// if (CameraPane.Xmax < spotw)
7445
+// {
7446
+// CameraPane.Xmax = spotw;
7447
+// }
7448
+// if (CameraPane.Ymin > spot.y)
7449
+// {
7450
+// CameraPane.Ymin = spot.y;
7451
+// }
7452
+// if (CameraPane.Ymax < spoth)
7453
+// {
7454
+// CameraPane.Ymax = spoth;
7455
+// }
7456
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7457
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7458
+ spot.translate(32, 0);
7459
+ clickInfo.g.setColor(Color.yellow);
7460
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7461
+
7462
+ spot.translate(32, 64);
74227463 spotw = spot.x + spot.width;
74237464 spoth = spot.y + spot.height;
74247465 clickInfo.g.setColor(Color.cyan);
....@@ -7439,28 +7480,7 @@
74397480 // {
74407481 // CameraPane.Ymax = spoth;
74417482 // }
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);
74477483 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
-// }
74647484 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74657485 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74667486 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7519,12 +7539,14 @@
75197539 retval = true;
75207540 }
75217541 spot.translate(0, 32);
7542
+ spot.translate(32, 0);
7543
+ spot.translate(0, 32);
75227544 if (spot.contains(clickInfo.x, clickInfo.y))
75237545 {
75247546 hitSomething = hitScale;
75257547
75267548 double scale = 0.005f * clickInfo.camera.Distance();
7527
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7549
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75287550 double sign = 1;
75297551 if (hScale < 0)
75307552 {
....@@ -7536,7 +7558,7 @@
75367558 //hScale = 0.01;
75377559 }
75387560
7539
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7561
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75407562 sign = 1;
75417563 if (vScale < 0)
75427564 {
....@@ -7751,7 +7773,7 @@
77517773 break;
77527774
77537775 case hitScale: // scale
7754
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7776
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77557777 double sign = 1;
77567778 if (hScale < 0)
77577779 {
....@@ -7763,7 +7785,7 @@
77637785 //hScale = 0.01;
77647786 }
77657787
7766
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7788
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77677789 sign = 1;
77687790 if (vScale < 0)
77697791 {
....@@ -7796,21 +7818,27 @@
77967818 case 3: // '\001'
77977819 if (modified || opposite)
77987820 {
7821
+ if (modified && opposite)
7822
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7823
+ else
77997824 //LA.matScale(toParent, 1, hScale, vScale);
7800
- LA.matScale(toParent, totalScale, 1, 1);
7825
+ LA.matScale(toParent, totalScale, 1, 1);
78017826 } // vScale, 1);
78027827 else
78037828 {
78047829 // EXCEPTION!
7805
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7830
+ LA.matScale(toParent, 1, totalScale, totalScale);
78067831 } // vScale, 1);
78077832 break;
78087833
78097834 case 2: // '\002'
78107835 if (modified || opposite)
78117836 {
7812
- //LA.matScale(toParent, hScale, 1, vScale);
7813
- LA.matScale(toParent, 1, totalScale, 1);
7837
+ if (modified && opposite)
7838
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7839
+ else
7840
+ //LA.matScale(toParent, hScale, 1, vScale);
7841
+ LA.matScale(toParent, 1, totalScale, 1);
78147842 } else
78157843 {
78167844 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7820,8 +7848,11 @@
78207848 case 1: // '\003'
78217849 if (modified || opposite)
78227850 {
7823
- //LA.matScale(toParent, hScale, vScale, 1);
7824
- LA.matScale(toParent, 1, 1, totalScale);
7851
+ if (modified && opposite)
7852
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7853
+ else
7854
+ //LA.matScale(toParent, hScale, vScale, 1);
7855
+ LA.matScale(toParent, 1, 1, totalScale);
78257856 } else
78267857 {
78277858 LA.matScale(toParent, totalScale, totalScale, 1);