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 {
....@@ -5673,10 +5796,12 @@
56735796 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
56745797
56755798 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5676
- (touched || (bRep != null && bRep.displaylist <= 0)))
5799
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5800
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched || (bRep != null && bRep.displaylist <= 0)))
56775801 {
56785802 Globals.lighttouched = true;
56795803 } // all panes...
5804
+
56805805 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
56815806 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
56825807 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5844,16 +5969,27 @@
58445969 tex = GetTextures();
58455970 }
58465971
5847
- boolean failed = false;
5972
+ boolean failedPigment = false;
5973
+ boolean failedBump = false;
58485974
58495975 try
58505976 {
5851
- display.BindTextures(tex, texres);
5977
+ display.BindPigmentTexture(tex, texres);
58525978 }
58535979 catch (Exception e)
58545980 {
58555981 System.err.println("FAILED: " + this);
5856
- 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;
58575993 }
58585994
58595995 if (!compiled)
....@@ -5876,8 +6012,11 @@
58766012 }
58776013 }
58786014
5879
- if (!failed)
5880
- display.ReleaseTextures(tex);
6015
+ if (!failedBump)
6016
+ display.ReleaseBumpTexture(tex);
6017
+
6018
+ if (!failedPigment)
6019
+ display.ReleasePigmentTexture(tex);
58816020
58826021 display.PopMaterial(this, selected);
58836022 }
....@@ -6250,6 +6389,11 @@
62506389 // dec 2012
62516390 new Exception().printStackTrace();
62526391 return;
6392
+ }
6393
+
6394
+ if (dontselect)
6395
+ {
6396
+ //bRep.GenerateNormalsMINE();
62536397 }
62546398
62556399 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7102,7 +7246,7 @@
71027246 spot.translate(32, 32);
71037247 spotw = spot.x + spot.width;
71047248 spoth = spot.y + spot.height;
7105
- info.g.setColor(Color.blue);
7249
+ info.g.setColor(Color.cyan);
71067250 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
71077251 // if (CameraPane.Xmin > spot.x)
71087252 // {
....@@ -7120,11 +7264,12 @@
71207264 // {
71217265 // CameraPane.Ymax = spoth;
71227266 // }
7123
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7124
- //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7267
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7268
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
71257269 spot.translate(0, -32);
7126
- info.g.setColor(Color.green);
7270
+ info.g.setColor(Color.yellow);
71277271 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7272
+ info.g.setColor(Color.green);
71287273 // if (CameraPane.Xmin > spot.x)
71297274 // {
71307275 // CameraPane.Xmin = spot.x;
....@@ -7442,19 +7587,20 @@
74427587 switch (info.pane.RenderCamera().viewCode)
74437588 {
74447589 case 3: // '\001'
7445
- if (modified)
7590
+ if (modified || opposite)
74467591 {
74477592 //LA.matScale(toParent, 1, hScale, vScale);
74487593 LA.matScale(toParent, totalScale, 1, 1);
74497594 } // vScale, 1);
74507595 else
74517596 {
7597
+ // EXCEPTION!
74527598 LA.matScale(toParent, totalScale, totalScale, totalScale);
74537599 } // vScale, 1);
74547600 break;
74557601
74567602 case 2: // '\002'
7457
- if (modified)
7603
+ if (modified || opposite)
74587604 {
74597605 //LA.matScale(toParent, hScale, 1, vScale);
74607606 LA.matScale(toParent, 1, totalScale, 1);
....@@ -7465,7 +7611,7 @@
74657611 break;
74667612
74677613 case 1: // '\003'
7468
- if (modified)
7614
+ if (modified || opposite)
74697615 {
74707616 //LA.matScale(toParent, hScale, vScale, 1);
74717617 LA.matScale(toParent, 1, 1, totalScale);
....@@ -7685,6 +7831,10 @@
76857831 editWindow = null;
76867832 } // ?
76877833 }
7834
+ else
7835
+ {
7836
+ //editWindow.closeUI();
7837
+ }
76887838 }
76897839
76907840 boolean root; // patch for edit windows
....@@ -7842,6 +7992,10 @@
78427992 }
78437993
78447994 transient ObjEditor editWindow;
7995
+ transient ObjEditor manipWindow;
7996
+
7997
+ transient boolean pinned;
7998
+
78457999 transient ObjectUI objectUI;
78468000 public static int povDepth = 0;
78478001 private static cVector tbMin = new cVector();