Normand Briere
2019-08-18 480ad70047e54b2b92f974e6c2ac5a6c0bdc5a5c
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,7 +2514,11 @@
24682514 else
24692515 {
24702516 //((ObjEditor)editWindow).SetupUI2(null);
2471
- ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2517
+ if (objectUI != null)
2518
+ ((ObjEditor)objectUI).pinButton.setSelected(pinned);
2519
+ else
2520
+ //new Exception().printStackTrace();
2521
+ System.err.println("objectUI is null");
24722522 }
24732523 }
24742524
....@@ -5570,6 +5620,11 @@
55705620 if (fullname == null)
55715621 return "";
55725622
5623
+ if (fullname.pigment != null)
5624
+ {
5625
+ return fullname.pigment;
5626
+ }
5627
+
55735628 // System.out.println("Fullname = " + fullname);
55745629
55755630 // Does not work on Windows due to C:
....@@ -5582,7 +5637,7 @@
55825637
55835638 if (split.length == 0)
55845639 {
5585
- return "";
5640
+ return fullname.pigment = "";
55865641 }
55875642
55885643 if (split.length <= 2)
....@@ -5590,22 +5645,27 @@
55905645 if (fullname.name.endsWith(":"))
55915646 {
55925647 // Windows
5593
- return fullname.name.substring(0, fullname.name.length()-1);
5648
+ return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1);
55945649 }
55955650
5596
- return split[0];
5651
+ return fullname.pigment = split[0];
55975652 }
55985653
55995654 // Windows
56005655 assert(split.length == 4);
56015656
5602
- return split[0] + ":" + split[1];
5657
+ return fullname.pigment = split[0] + ":" + split[1];
56035658 }
56045659
56055660 static String GetBump(cTexture fullname)
56065661 {
56075662 if (fullname == null)
56085663 return "";
5664
+
5665
+ if (fullname.bump != null)
5666
+ {
5667
+ return fullname.bump;
5668
+ }
56095669
56105670 // System.out.println("Fullname = " + fullname);
56115671 // Does not work on Windows due to C:
....@@ -5617,12 +5677,12 @@
56175677
56185678 if (split.length == 0)
56195679 {
5620
- return "";
5680
+ return fullname.bump = "";
56215681 }
56225682
56235683 if (split.length == 1)
56245684 {
5625
- return "";
5685
+ return fullname.bump = "";
56265686 }
56275687
56285688 if (split.length == 2)
....@@ -5630,16 +5690,16 @@
56305690 if (fullname.name.endsWith(":"))
56315691 {
56325692 // Windows
5633
- return "";
5693
+ return fullname.bump = "";
56345694 }
56355695
5636
- return split[1];
5696
+ return fullname.bump = split[1];
56375697 }
56385698
56395699 // Windows
56405700 assert(split.length == 4);
56415701
5642
- return split[2] + ":" + split[3];
5702
+ return fullname.bump = split[2] + ":" + split[3];
56435703 }
56445704
56455705 String GetPigmentTexture()
....@@ -5722,6 +5782,9 @@
57225782 texname = "";
57235783
57245784 GetTextures().name = texname + ":" + GetBump(GetTextures());
5785
+
5786
+ GetTextures().pigment = null;
5787
+
57255788 Touch();
57265789 }
57275790
....@@ -5794,6 +5857,8 @@
57945857 texname = "";
57955858
57965859 GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname;
5860
+
5861
+ GetTextures().bump = null;
57975862
57985863 Touch();
57995864 }
....@@ -7398,7 +7463,7 @@
73987463 boundary.y = spot.y - 30;
73997464 boundary.width = spot.width + 60;
74007465 boundary.height = spot.height + 60;
7401
- clickInfo.g.setColor(Color.red);
7466
+ clickInfo.g.setColor(Color.white);
74027467 int spotw = spot.x + spot.width;
74037468 int spoth = spot.y + spot.height;
74047469 clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height);
....@@ -7418,7 +7483,29 @@
74187483 // {
74197484 // CameraPane.Ymax = spoth;
74207485 // }
7421
- 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);
74227509 spotw = spot.x + spot.width;
74237510 spoth = spot.y + spot.height;
74247511 clickInfo.g.setColor(Color.cyan);
....@@ -7439,28 +7526,7 @@
74397526 // {
74407527 // CameraPane.Ymax = spoth;
74417528 // }
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);
74477529 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
-// }
74647530 clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY,
74657531 (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360);
74667532 //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360);
....@@ -7519,12 +7585,14 @@
75197585 retval = true;
75207586 }
75217587 spot.translate(0, 32);
7588
+ spot.translate(32, 0);
7589
+ spot.translate(0, 32);
75227590 if (spot.contains(clickInfo.x, clickInfo.y))
75237591 {
75247592 hitSomething = hitScale;
75257593
75267594 double scale = 0.005f * clickInfo.camera.Distance();
7527
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7595
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
75287596 double sign = 1;
75297597 if (hScale < 0)
75307598 {
....@@ -7536,7 +7604,7 @@
75367604 //hScale = 0.01;
75377605 }
75387606
7539
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7607
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
75407608 sign = 1;
75417609 if (vScale < 0)
75427610 {
....@@ -7751,7 +7819,7 @@
77517819 break;
77527820
77537821 case hitScale: // scale
7754
- double hScale = (double) (clickInfo.x - centerPt.x) / 32;
7822
+ double hScale = (double) (clickInfo.x - centerPt.x) / 64;
77557823 double sign = 1;
77567824 if (hScale < 0)
77577825 {
....@@ -7763,7 +7831,7 @@
77637831 //hScale = 0.01;
77647832 }
77657833
7766
- double vScale = (double) (clickInfo.y - centerPt.y) / 32;
7834
+ double vScale = (double) (clickInfo.y - centerPt.y) / 64;
77677835 sign = 1;
77687836 if (vScale < 0)
77697837 {
....@@ -7796,21 +7864,27 @@
77967864 case 3: // '\001'
77977865 if (modified || opposite)
77987866 {
7867
+ if (modified && opposite)
7868
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
7869
+ else
77997870 //LA.matScale(toParent, 1, hScale, vScale);
7800
- LA.matScale(toParent, totalScale, 1, 1);
7871
+ LA.matScale(toParent, totalScale, 1, 1);
78017872 } // vScale, 1);
78027873 else
78037874 {
78047875 // EXCEPTION!
7805
- LA.matScale(toParent, totalScale, totalScale, totalScale);
7876
+ LA.matScale(toParent, 1, totalScale, totalScale);
78067877 } // vScale, 1);
78077878 break;
78087879
78097880 case 2: // '\002'
78107881 if (modified || opposite)
78117882 {
7812
- //LA.matScale(toParent, hScale, 1, vScale);
7813
- 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);
78147888 } else
78157889 {
78167890 LA.matScale(toParent, totalScale, 1, totalScale);
....@@ -7820,8 +7894,11 @@
78207894 case 1: // '\003'
78217895 if (modified || opposite)
78227896 {
7823
- //LA.matScale(toParent, hScale, vScale, 1);
7824
- 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);
78257902 } else
78267903 {
78277904 LA.matScale(toParent, totalScale, totalScale, 1);