Normand Briere
2019-07-01 9079880942d022ee32fd3a543843e132e52deb1a
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 {
....@@ -5673,10 +5797,12 @@
56735797 boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
56745798
56755799 if (!selectmode && //display.DrawMode() != display.SELECTION &&
5676
- (touched || (bRep != null && bRep.displaylist <= 0)))
5800
+ //(touched || (bRep != null && bRep.displaylist <= 0)))
5801
+ (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0)))
56775802 {
56785803 Globals.lighttouched = true;
56795804 } // all panes...
5805
+
56805806 //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW &&
56815807 if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW &&
56825808 (touched || (bRep != null && bRep.displaylist <= 0)))
....@@ -5804,6 +5930,7 @@
58045930 if (GetBRep() != null)
58055931 {
58065932 display.NextIndex();
5933
+
58075934 // vertex color conflict : gl.glCallList(list);
58085935 DrawNode(display, root, selected);
58095936 if (this instanceof BezierPatch)
....@@ -5844,16 +5971,27 @@
58445971 tex = GetTextures();
58455972 }
58465973
5847
- boolean failed = false;
5974
+ boolean failedPigment = false;
5975
+ boolean failedBump = false;
58485976
58495977 try
58505978 {
5851
- display.BindTextures(tex, texres);
5979
+ display.BindPigmentTexture(tex, texres);
58525980 }
58535981 catch (Exception e)
58545982 {
58555983 System.err.println("FAILED: " + this);
5856
- 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;
58575995 }
58585996
58595997 if (!compiled)
....@@ -5876,8 +6014,11 @@
58766014 }
58776015 }
58786016
5879
- if (!failed)
5880
- display.ReleaseTextures(tex);
6017
+ if (!failedBump)
6018
+ display.ReleaseBumpTexture(tex);
6019
+
6020
+ if (!failedPigment)
6021
+ display.ReleasePigmentTexture(tex);
58816022
58826023 display.PopMaterial(this, selected);
58836024 }
....@@ -6250,6 +6391,11 @@
62506391 // dec 2012
62516392 new Exception().printStackTrace();
62526393 return;
6394
+ }
6395
+
6396
+ if (dontselect)
6397
+ {
6398
+ //bRep.GenerateNormalsMINE();
62536399 }
62546400
62556401 display.DrawGeometry(bRep, flipV, selectmode);
....@@ -7102,7 +7248,7 @@
71027248 spot.translate(32, 32);
71037249 spotw = spot.x + spot.width;
71047250 spoth = spot.y + spot.height;
7105
- info.g.setColor(Color.blue);
7251
+ info.g.setColor(Color.cyan);
71067252 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
71077253 // if (CameraPane.Xmin > spot.x)
71087254 // {
....@@ -7120,11 +7266,12 @@
71207266 // {
71217267 // CameraPane.Ymax = spoth;
71227268 // }
7123
- // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - 15);
7124
- //info.g.drawLine(spotw, spoth, spotw - 15, spoth);
7269
+ // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15
7270
+ //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15
71257271 spot.translate(0, -32);
7126
- info.g.setColor(Color.green);
7272
+ info.g.setColor(Color.yellow);
71277273 info.g.fillRect(spot.x, spot.y, spot.width, spot.height);
7274
+ info.g.setColor(Color.green);
71287275 // if (CameraPane.Xmin > spot.x)
71297276 // {
71307277 // CameraPane.Xmin = spot.x;
....@@ -7442,19 +7589,20 @@
74427589 switch (info.pane.RenderCamera().viewCode)
74437590 {
74447591 case 3: // '\001'
7445
- if (modified)
7592
+ if (modified || opposite)
74467593 {
74477594 //LA.matScale(toParent, 1, hScale, vScale);
74487595 LA.matScale(toParent, totalScale, 1, 1);
74497596 } // vScale, 1);
74507597 else
74517598 {
7599
+ // EXCEPTION!
74527600 LA.matScale(toParent, totalScale, totalScale, totalScale);
74537601 } // vScale, 1);
74547602 break;
74557603
74567604 case 2: // '\002'
7457
- if (modified)
7605
+ if (modified || opposite)
74587606 {
74597607 //LA.matScale(toParent, hScale, 1, vScale);
74607608 LA.matScale(toParent, 1, totalScale, 1);
....@@ -7465,7 +7613,7 @@
74657613 break;
74667614
74677615 case 1: // '\003'
7468
- if (modified)
7616
+ if (modified || opposite)
74697617 {
74707618 //LA.matScale(toParent, hScale, vScale, 1);
74717619 LA.matScale(toParent, 1, 1, totalScale);
....@@ -7685,6 +7833,10 @@
76857833 editWindow = null;
76867834 } // ?
76877835 }
7836
+ else
7837
+ {
7838
+ //editWindow.closeUI();
7839
+ }
76887840 }
76897841
76907842 boolean root; // patch for edit windows
....@@ -7842,6 +7994,10 @@
78427994 }
78437995
78447996 transient ObjEditor editWindow;
7997
+ transient ObjEditor manipWindow;
7998
+
7999
+ transient boolean pinned;
8000
+
78458001 transient ObjectUI objectUI;
78468002 public static int povDepth = 0;
78478003 private static cVector tbMin = new cVector();