Normand Briere
2019-06-27 1807e7752960ac229cddd34b100e92cadbac9459
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;
....@@ -4921,6 +5043,7 @@
49215043
49225044 if (child == null)
49235045 continue;
5046
+
49245047 if (child.HasTransparency() && child.size() != 0)
49255048 {
49265049 cTreePath leaf = child.Select(indexcount, deselect);
....@@ -4930,9 +5053,10 @@
49305053 if (leaf != null)
49315054 {
49325055 cTreePath tp = new cTreePath(this, leaf);
4933
- if (editWindow != null)
5056
+ ObjEditor window = GetWindow();
5057
+ if (window != null)
49345058 {
4935
- editWindow.Select(tp, deselect, true);
5059
+ window.Select(tp, deselect, true);
49365060 }
49375061
49385062 return tp;
....@@ -5653,7 +5777,7 @@
56535777 support = support;
56545778
56555779 //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);
5780
+ boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
56575781
56585782 if (!usecalllists && bRep != null && bRep.displaylist > 0)
56595783 {
....@@ -5674,7 +5798,7 @@
56745798
56755799 if (!selectmode && //display.DrawMode() != display.SELECTION &&
56765800 //(touched || (bRep != null && bRep.displaylist <= 0)))
5677
- (Globals.isLIVE() || touched && (bRep != null && bRep.displaylist <= 0)))
5801
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
56785802 {
56795803 Globals.lighttouched = true;
56805804 } // all panes...
....@@ -5806,6 +5930,7 @@
58065930 if (GetBRep() != null)
58075931 {
58085932 display.NextIndex();
5933
+
58095934 // vertex color conflict : gl.glCallList(list);
58105935 DrawNode(display, root, selected);
58115936 if (this instanceof BezierPatch)
....@@ -5846,16 +5971,27 @@
58465971 tex = GetTextures();
58475972 }
58485973
5849
- boolean failed = false;
5974
+ boolean failedPigment = false;
5975
+ boolean failedBump = false;
58505976
58515977 try
58525978 {
5853
- display.BindTextures(tex, texres);
5979
+ display.BindPigmentTexture(tex, texres);
58545980 }
58555981 catch (Exception e)
58565982 {
58575983 System.err.println("FAILED: " + this);
5858
- failed = true;
5984
+ failedPigment = true;
5985
+ }
5986
+
5987
+ try
5988
+ {
5989
+ display.BindBumpTexture(tex, texres);
5990
+ }
5991
+ catch (Exception e)
5992
+ {
5993
+ //System.err.println("FAILED: " + this);
5994
+ failedBump = true;
58595995 }
58605996
58615997 if (!compiled)
....@@ -5878,8 +6014,11 @@
58786014 }
58796015 }
58806016
5881
- if (!failed)
5882
- display.ReleaseTextures(tex);
6017
+ if (!failedBump)
6018
+ display.ReleaseBumpTexture(tex);
6019
+
6020
+ if (!failedPigment)
6021
+ display.ReleasePigmentTexture(tex);
58836022
58846023 display.PopMaterial(this, selected);
58856024 }
....@@ -6252,6 +6391,11 @@
62526391 // dec 2012
62536392 new Exception().printStackTrace();
62546393 return;
6394
+ }
6395
+
6396
+ if (dontselect)
6397
+ {
6398
+ //bRep.GenerateNormalsMINE();
62556399 }
62566400
62576401 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7452,7 +7596,8 @@
74527596 } // vScale, 1);
74537597 else
74547598 {
7455
- LA.matScale(toParent, 1, totalScale, totalScale);
7599
+ // EXCEPTION!
7600
+ LA.matScale(toParent, totalScale, totalScale, totalScale);
74567601 } // vScale, 1);
74577602 break;
74587603
....@@ -7688,6 +7833,10 @@
76887833 editWindow = null;
76897834 } // ?
76907835 }
7836
+ else
7837
+ {
7838
+ //editWindow.closeUI();
7839
+ }
76917840 }
76927841
76937842 boolean root; // patch for edit windows
....@@ -7845,6 +7994,10 @@
78457994 }
78467995
78477996 transient ObjEditor editWindow;
7997
+ transient ObjEditor manipWindow;
7998
+
7999
+ transient boolean pinned;
8000
+
78488001 transient ObjectUI objectUI;
78498002 public static int povDepth = 0;
78508003 private static cVector tbMin = new cVector();