Normand Briere
2019-08-22 6a145f6c81dfcbe0653eda27d042efb48daa7512
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()
....@@ -269,6 +271,50 @@
269271 //
270272 // return null;
271273 // }
274
+
275
+ transient boolean tag;
276
+
277
+ void TagObjects(Object3D o, boolean tag)
278
+ {
279
+ if (blockloop)
280
+ return;
281
+
282
+ o.tag = tag;
283
+
284
+ if (o == this)
285
+ return;
286
+
287
+ blockloop = true;
288
+
289
+ for (int i=0; i<Size(); i++)
290
+ {
291
+ get(i).TagObjects(o, tag);
292
+ }
293
+
294
+ blockloop = false;
295
+ }
296
+
297
+ boolean HasTags()
298
+ {
299
+ if (blockloop)
300
+ return false;
301
+
302
+ blockloop = true;
303
+
304
+ boolean hasTags = false;
305
+
306
+ for (int i=0; i<Size(); i++)
307
+ {
308
+ hasTags |= get(i).tag || get(i).HasTags();
309
+
310
+ if (hasTags)
311
+ break;
312
+ }
313
+
314
+ blockloop = false;
315
+
316
+ return hasTags;
317
+ }
272318
273319 void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable)
274320 {
....@@ -2468,6 +2514,11 @@
24682514 else
24692515 {
24702516 //((ObjEditor)editWindow).SetupUI2(null);
2517
+ if (objectUI != null)
2518
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2519
+ else
2520
+ //new Exception().printStackTrace();
2521
+ System.err.println("objectUI is null");
24712522 }
24722523 }
24732524
....@@ -5569,6 +5620,11 @@
55695620 if (fullname == null)
55705621 return "";
55715622
5623
+ if (fullname.pigment != null)
5624
+ {
5625
+ return fullname.pigment;
5626
+ }
5627
+
55725628 // System.out.println("Fullname = " + fullname);
55735629
55745630 // Does not work on Windows due to C:
....@@ -5581,7 +5637,7 @@
55815637
55825638 if (split.length == 0)
55835639 {
5584
- return "";
5640
+ return fullname.pigment = "";
55855641 }
55865642
55875643 if (split.length <= 2)
....@@ -5589,22 +5645,27 @@
55895645 if (fullname.name.endsWith(":"))
55905646 {
55915647 // Windows
5592
- return fullname.name.substring(0, fullname.name.length()-1);
5648
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55935649 }
55945650
5595
- return split[0];
5651
+ return fullname.pigment = split[0];
55965652 }
55975653
55985654 // Windows
55995655 assert(split.length == 4);
56005656
5601
- return split[0] + ":" + split[1];
5657
+ return fullname.pigment = split[0] + ":" + split[1];
56025658 }
56035659
56045660 static String GetBump(cTexture fullname)
56055661 {
56065662 if (fullname == null)
56075663 return "";
5664
+
5665
+ if (fullname.bump != null)
5666
+ {
5667
+ return fullname.bump;
5668
+ }
56085669
56095670 // System.out.println("Fullname = " + fullname);
56105671 // Does not work on Windows due to C:
....@@ -5616,12 +5677,12 @@
56165677
56175678 if (split.length == 0)
56185679 {
5619
- return "";
5680
+ return fullname.bump = "";
56205681 }
56215682
56225683 if (split.length == 1)
56235684 {
5624
- return "";
5685
+ return fullname.bump = "";
56255686 }
56265687
56275688 if (split.length == 2)
....@@ -5629,16 +5690,16 @@
56295690 if (fullname.name.endsWith(":"))
56305691 {
56315692 // Windows
5632
- return "";
5693
+ return fullname.bump = "";
56335694 }
56345695
5635
- return split[1];
5696
+ return fullname.bump = split[1];
56365697 }
56375698
56385699 // Windows
56395700 assert(split.length == 4);
56405701
5641
- return split[2] + ":" + split[3];
5702
+ return fullname.bump = split[2] + ":" + split[3];
56425703 }
56435704
56445705 String GetPigmentTexture()
....@@ -5721,6 +5782,9 @@
57215782 texname = "";
57225783
57235784 GetTextures().name = texname + ":" + GetBump(GetTextures());
5785
+
5786
+ GetTextures().pigment = null;
5787
+
57245788 Touch();
57255789 }
57265790
....@@ -5793,6 +5857,8 @@
57935857 texname = "";
57945858
57955859 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5860
+
5861
+ GetTextures().bump = null;
57965862
57975863 Touch();
57985864 }
....@@ -7397,7 +7463,7 @@
73977463 boundary.y = spot.y - 30;
73987464 boundary.width = spot.width + 60;
73997465 boundary.height = spot.height + 60;
7400
- clickInfo.g.setColor(Color.red);
7466
+ clickInfo.g.setColor(Color.white);
74017467 int spotw = spot.x + spot.width;
74027468 int spoth = spot.y + spot.height;
74037469 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7417,7 +7483,29 @@
74177483 // {
74187484 // CameraPane.Ymax = spoth;
74197485 // }
7420
- spot.translate(32, 32);
7486
+// if (CameraPane.Xmin > spot.x)
7487
+// {
7488
+// CameraPane.Xmin = spot.x;
7489
+// }
7490
+// if (CameraPane.Xmax < spotw)
7491
+// {
7492
+// CameraPane.Xmax = spotw;
7493
+// }
7494
+// if (CameraPane.Ymin > spot.y)
7495
+// {
7496
+// CameraPane.Ymin = spot.y;
7497
+// }
7498
+// if (CameraPane.Ymax < spoth)
7499
+// {
7500
+// CameraPane.Ymax = spoth;
7501
+// }
7502
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7503
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7504
+ spot.translate(32, 0);
7505
+ clickInfo.g.setColor(Color.yellow);
7506
+ clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7507
+
7508
+ spot.translate(32, 64);
74217509 spotw = spot.x + spot.width;
74227510 spoth = spot.y + spot.height;
74237511 clickInfo.g.setColor(Color.cyan);
....@@ -7438,28 +7526,7 @@
74387526 // {
74397527 // CameraPane.Ymax = spoth;
74407528 // }
7441
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7442
- //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
7443
- spot.translate(0, -32);
7444
- clickInfo.g.setColor(Color.yellow);
7445
- clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
74467529 clickInfo.g.setColor(Color.green);
7447
-// if (CameraPane.Xmin > spot.x)
7448
-// {
7449
-// CameraPane.Xmin = spot.x;
7450
-// }
7451
-// if (CameraPane.Xmax < spotw)
7452
-// {
7453
-// CameraPane.Xmax = spotw;
7454
-// }
7455
-// if (CameraPane.Ymin > spot.y)
7456
-// {
7457
-// CameraPane.Ymin = spot.y;
7458
-// }
7459
-// if (CameraPane.Ymax < spoth)
7460
-// {
7461
-// CameraPane.Ymax = spoth;
7462
-// }
74637530 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74647531 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74657532 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7518,12 +7585,14 @@
75187585 retval = true;
75197586 }
75207587 spot.translate(0, 32);
7588
+ spot.translate(32, 0);
7589
+ spot.translate(0, 32);
75217590 if (spot.contains(clickInfo.x, clickInfo.y))
75227591 {
75237592 hitSomething = hitScale;
75247593
75257594 double scale = 0.005f * clickInfo.camera.Distance();
7526
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7595
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75277596 double sign = 1;
75287597 if (hScale < 0)
75297598 {
....@@ -7535,7 +7604,7 @@
75357604 //hScale = 0.01;
75367605 }
75377606
7538
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7607
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75397608 sign = 1;
75407609 if (vScale < 0)
75417610 {
....@@ -7750,7 +7819,7 @@
77507819 break;
77517820
77527821 case hitScale: // scale
7753
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7822
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77547823 double sign = 1;
77557824 if (hScale < 0)
77567825 {
....@@ -7762,7 +7831,7 @@
77627831 //hScale = 0.01;
77637832 }
77647833
7765
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7834
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77667835 sign = 1;
77677836 if (vScale < 0)
77687837 {
....@@ -7795,21 +7864,27 @@
77957864 case 3: // '\001'
77967865 if (modified || opposite)
77977866 {
7867
+ if (modified && opposite)
7868
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7869
+ else
77987870 //LA.matScale(toParent, 1, hScale, vScale);
7799
- LA.matScale(toParent, totalScale, 1, 1);
7871
+ LA.matScale(toParent, totalScale, 1, 1);
78007872 } // vScale, 1);
78017873 else
78027874 {
78037875 // EXCEPTION!
7804
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7876
+ LA.matScale(toParent, 1, totalScale, totalScale);
78057877 } // vScale, 1);
78067878 break;
78077879
78087880 case 2: // '\002'
78097881 if (modified || opposite)
78107882 {
7811
- //LA.matScale(toParent, hScale, 1, vScale);
7812
- LA.matScale(toParent, 1, totalScale, 1);
7883
+ if (modified && opposite)
7884
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7885
+ else
7886
+ //LA.matScale(toParent, hScale, 1, vScale);
7887
+ LA.matScale(toParent, 1, totalScale, 1);
78137888 } else
78147889 {
78157890 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7819,8 +7894,11 @@
78197894 case 1: // '\003'
78207895 if (modified || opposite)
78217896 {
7822
- //LA.matScale(toParent, hScale, vScale, 1);
7823
- LA.matScale(toParent, 1, 1, totalScale);
7897
+ if (modified && opposite)
7898
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7899
+ else
7900
+ //LA.matScale(toParent, hScale, vScale, 1);
7901
+ LA.matScale(toParent, 1, 1, totalScale);
78247902 } else
78257903 {
78267904 LA.matScale(toParent, totalScale, totalScale, 1);