Normand Briere
2019-06-26 89b25e7cc97f6fe221dfd41c4d463500f8a31bc1
Object3D.java
....@@ -181,7 +181,7 @@
181181 return;
182182 }
183183
184
- Object3D o = new Object3D();
184
+ Object3D o = new Object3D("copy of " + this.name);
185185
186186 hashtable.put(GetUUID(), o);
187187
....@@ -219,16 +219,23 @@
219219 if (!hashtable.containsKey(GetUUID()))
220220 return;
221221
222
+ if (blockloop)
223
+ return;
224
+
225
+ blockloop = true;
226
+
222227 Object3D o = hashtable.get(GetUUID());
223228
224229 RestoreBigData(o);
225230
226
- hashtable.remove(GetUUID());
231
+ //hashtable.remove(GetUUID());
227232
228233 for (int i=0; i<Size(); i++)
229234 {
230235 get(i).RestoreBigData(hashtable);
231236 }
237
+
238
+ blockloop = false;
232239 }
233240
234241 void RestoreBigData(Object3D o)
....@@ -881,7 +888,7 @@
881888
882889 if (marked && Globals.isLIVE() && live &&
883890 //TEMP21aug2018
884
- (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) &&
891
+ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) &&
885892 currentframe != Globals.framecount)
886893 {
887894 currentframe = Globals.framecount;
....@@ -893,7 +900,8 @@
893900
894901 boolean changedir = random && Math.random() < 0.01; // && !link2master;
895902
896
- if (transformcount*factor > maxcount || (step == 1 && changedir))
903
+ if (transformcount*factor >= maxcount && (rewind || random) ||
904
+ (step == 1 && changedir))
897905 {
898906 countdown = 1;
899907 delay = speedup?8:1;
....@@ -965,6 +973,7 @@
965973 if (material == null || material.multiply)
966974 return true;
967975
976
+ // Transparent objects are dynamic because we have to sort the triangles.
968977 return material.opacity > 0.99;
969978 }
970979
....@@ -2386,6 +2395,10 @@
23862395 }
23872396 */
23882397 }
2398
+ else
2399
+ {
2400
+ //((ObjEditor)editWindow).SetupUI2(null);
2401
+ }
23892402 }
23902403
23912404 void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root)
....@@ -2427,6 +2440,14 @@
24272440 {
24282441 editWindow.refreshContents();
24292442 }
2443
+ else
2444
+ {
2445
+ if (manipWindow != null)
2446
+ {
2447
+ manipWindow.refreshContents();
2448
+ }
2449
+ }
2450
+
24302451 //if (parent != null)
24312452 //parent.refreshEditWindow();
24322453 }
....@@ -3503,7 +3524,8 @@
35033524 if (blockloop)
35043525 return;
35053526
3506
- if (marked || (bRep != null && material != null)) // borderline...
3527
+ if (//marked || // does not make sense
3528
+ (bRep != null || material != null)) // borderline...
35073529 live = h;
35083530
35093531 for (int i = 0; i < Size(); i++)
....@@ -3524,7 +3546,8 @@
35243546 return;
35253547
35263548 //if (bRep != null)
3527
- if (marked || (bRep != null && material != null)) // borderline...
3549
+ if (//marked || // does not make sense
3550
+ (bRep != null || material != null)) // borderline...
35283551 link2master = h;
35293552
35303553 for (int i = 0; i < Size(); i++)
....@@ -3544,7 +3567,8 @@
35443567 if (blockloop)
35453568 return;
35463569
3547
- if (marked || (bRep != null && material != null)) // borderline...
3570
+ if (//marked || // does not make sense
3571
+ (bRep != null || material != null)) // borderline...
35483572 hide = h;
35493573
35503574 for (int i = 0; i < Size(); i++)
....@@ -3564,7 +3588,7 @@
35643588 if (blockloop)
35653589 return;
35663590
3567
- if (bRep != null && material != null) // borderline...
3591
+ if (bRep != null || material != null) // borderline...
35683592 marked = h;
35693593
35703594 for (int i = 0; i < Size(); i++)
....@@ -3574,6 +3598,46 @@
35743598 continue;
35753599 blockloop = true;
35763600 child.MarkLeaves(h);
3601
+ blockloop = false;
3602
+ // release(i);
3603
+ }
3604
+ }
3605
+
3606
+ void RewindLeaves(boolean h)
3607
+ {
3608
+ if (blockloop)
3609
+ return;
3610
+
3611
+ if (bRep != null || material != null) // borderline...
3612
+ rewind = h;
3613
+
3614
+ for (int i = 0; i < Size(); i++)
3615
+ {
3616
+ Object3D child = (Object3D) get(i); // reserve(i);
3617
+ if (child == null)
3618
+ continue;
3619
+ blockloop = true;
3620
+ child.RewindLeaves(h);
3621
+ blockloop = false;
3622
+ // release(i);
3623
+ }
3624
+ }
3625
+
3626
+ void RandomLeaves(boolean h)
3627
+ {
3628
+ if (blockloop)
3629
+ return;
3630
+
3631
+ if (bRep != null || material != null) // borderline...
3632
+ random = h;
3633
+
3634
+ for (int i = 0; i < Size(); i++)
3635
+ {
3636
+ Object3D child = (Object3D) get(i); // reserve(i);
3637
+ if (child == null)
3638
+ continue;
3639
+ blockloop = true;
3640
+ child.RandomLeaves(h);
35773641 blockloop = false;
35783642 // release(i);
35793643 }
....@@ -4351,6 +4415,55 @@
43514415 }
43524416 }
43534417
4418
+ void RepairSOV()
4419
+ {
4420
+ if (blockloop)
4421
+ return;
4422
+
4423
+ String texname = this.GetPigmentTexture();
4424
+
4425
+ if (texname.startsWith("sov"))
4426
+ {
4427
+ String[] s = texname.split("/");
4428
+
4429
+ String[] sname = s[1].split("Color.pn");
4430
+
4431
+ texname = sname[0];
4432
+
4433
+ if (sname.length > 1)
4434
+ {
4435
+ texname += "Color.jpg";
4436
+ }
4437
+
4438
+ this.SetPigmentTexture("sov/" + texname);
4439
+ }
4440
+
4441
+ texname = this.GetBumpTexture();
4442
+
4443
+ if (texname.startsWith("sov"))
4444
+ {
4445
+ String[] s = texname.split("/");
4446
+
4447
+ String[] sname = s[1].split("Bump.pn");
4448
+
4449
+ texname = sname[0];
4450
+
4451
+ if (sname.length > 1)
4452
+ {
4453
+ texname += "Bump.jpg";
4454
+ }
4455
+
4456
+ this.SetBumpTexture("sov/" + texname);
4457
+ }
4458
+
4459
+ for (int i=0; i<Size(); i++)
4460
+ {
4461
+ blockloop = true;
4462
+ get(i).RepairSOV();
4463
+ blockloop = false;
4464
+ }
4465
+ }
4466
+
43544467 void RepairTexture()
43554468 {
43564469 if (this instanceof FileObject || blockloop)
....@@ -4865,6 +4978,14 @@
48654978 }
48664979 }
48674980
4981
+ ObjEditor GetWindow()
4982
+ {
4983
+ if (editWindow != null)
4984
+ return editWindow;
4985
+
4986
+ return manipWindow;
4987
+ }
4988
+
48684989 cTreePath Select(int indexcount, boolean deselect)
48694990 {
48704991 if (hide || dontselect)
....@@ -4901,10 +5022,11 @@
49015022 if (leaf != null)
49025023 {
49035024 cTreePath tp = new cTreePath(this, leaf);
4904
- if (editWindow != null)
5025
+ ObjEditor window = GetWindow();
5026
+ if (window != null)
49055027 {
49065028 //System.out.println("editWindow = " + editWindow + " vs " + this);
4907
- editWindow.Select(tp, deselect, true);
5029
+ window.Select(tp, deselect, true);
49085030 }
49095031
49105032 return tp;
....@@ -4930,9 +5052,10 @@
49305052 if (leaf != null)
49315053 {
49325054 cTreePath tp = new cTreePath(this, leaf);
4933
- if (editWindow != null)
5055
+ ObjEditor window = GetWindow();
5056
+ if (window != null)
49345057 {
4935
- editWindow.Select(tp, deselect, true);
5058
+ window.Select(tp, deselect, true);
49365059 }
49375060
49385061 return tp;
....@@ -5653,7 +5776,7 @@
56535776 support = support;
56545777
56555778 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5656
- boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
5779
+ boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
56575780
56585781 if (!usecalllists && bRep != null && bRep.displaylist > 0)
56595782 {
....@@ -5674,7 +5797,7 @@
56745797
56755798 if (!selectmode && //display.DrawMode() != display.SELECTION &&
56765799 //(touched || (bRep != null && bRep.displaylist <= 0)))
5677
- (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
5800
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched || (bRep != null && bRep.displaylist <= 0)))
56785801 {
56795802 Globals.lighttouched = true;
56805803 } // all panes...
....@@ -5846,16 +5969,27 @@
58465969 tex = GetTextures();
58475970 }
58485971
5849
- boolean failed = false;
5972
+ boolean failedPigment = false;
5973
+ boolean failedBump = false;
58505974
58515975 try
58525976 {
5853
- display.BindTextures(tex, texres);
5977
+ display.BindPigmentTexture(tex, texres);
58545978 }
58555979 catch (Exception e)
58565980 {
58575981 System.err.println("FAILED: " + this);
5858
- failed = true;
5982
+ failedPigment = true;
5983
+ }
5984
+
5985
+ try
5986
+ {
5987
+ display.BindBumpTexture(tex, texres);
5988
+ }
5989
+ catch (Exception e)
5990
+ {
5991
+ //System.err.println("FAILED: " + this);
5992
+ failedBump = true;
58595993 }
58605994
58615995 if (!compiled)
....@@ -5878,8 +6012,11 @@
58786012 }
58796013 }
58806014
5881
- if (!failed)
5882
- display.ReleaseTextures(tex);
6015
+ if (!failedBump)
6016
+ display.ReleaseBumpTexture(tex);
6017
+
6018
+ if (!failedPigment)
6019
+ display.ReleasePigmentTexture(tex);
58836020
58846021 display.PopMaterial(this, selected);
58856022 }
....@@ -6252,6 +6389,11 @@
62526389 // dec 2012
62536390 new Exception().printStackTrace();
62546391 return;
6392
+ }
6393
+
6394
+ if (dontselect)
6395
+ {
6396
+ //bRep.GenerateNormalsMINE();
62556397 }
62566398
62576399 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7452,7 +7594,8 @@
74527594 } // vScale, 1);
74537595 else
74547596 {
7455
- LA.matScale(toParent, 1, totalScale, totalScale);
7597
+ // EXCEPTION!
7598
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
74567599 } // vScale, 1);
74577600 break;
74587601
....@@ -7688,6 +7831,10 @@
76887831 editWindow = null;
76897832 } // ?
76907833 }
7834
+ else
7835
+ {
7836
+ //editWindow.closeUI();
7837
+ }
76917838 }
76927839
76937840 boolean root; // patch for edit windows
....@@ -7845,6 +7992,10 @@
78457992 }
78467993
78477994 transient ObjEditor editWindow;
7995
+ transient ObjEditor manipWindow;
7996
+
7997
+ transient boolean pinned;
7998
+
78487999 transient ObjectUI objectUI;
78498000 public static int povDepth = 0;
78508001 private static cVector tbMin = new cVector();