.. | .. |
---|
181 | 181 | return; |
---|
182 | 182 | } |
---|
183 | 183 | |
---|
184 | | - Object3D o = new Object3D(); |
---|
| 184 | + Object3D o = new Object3D("copy of " + this.name); |
---|
185 | 185 | |
---|
186 | 186 | hashtable.put(GetUUID(), o); |
---|
187 | 187 | |
---|
.. | .. |
---|
219 | 219 | if (!hashtable.containsKey(GetUUID())) |
---|
220 | 220 | return; |
---|
221 | 221 | |
---|
| 222 | + if (blockloop) |
---|
| 223 | + return; |
---|
| 224 | + |
---|
| 225 | + blockloop = true; |
---|
| 226 | + |
---|
222 | 227 | Object3D o = hashtable.get(GetUUID()); |
---|
223 | 228 | |
---|
224 | 229 | RestoreBigData(o); |
---|
225 | 230 | |
---|
226 | | - hashtable.remove(GetUUID()); |
---|
| 231 | + //hashtable.remove(GetUUID()); |
---|
227 | 232 | |
---|
228 | 233 | for (int i=0; i<Size(); i++) |
---|
229 | 234 | { |
---|
230 | 235 | get(i).RestoreBigData(hashtable); |
---|
231 | 236 | } |
---|
| 237 | + |
---|
| 238 | + blockloop = false; |
---|
232 | 239 | } |
---|
233 | 240 | |
---|
234 | 241 | void RestoreBigData(Object3D o) |
---|
.. | .. |
---|
881 | 888 | |
---|
882 | 889 | if (marked && Globals.isLIVE() && live && |
---|
883 | 890 | //TEMP21aug2018 |
---|
884 | | - (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW) && |
---|
| 891 | + (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && |
---|
885 | 892 | currentframe != Globals.framecount) |
---|
886 | 893 | { |
---|
887 | 894 | currentframe = Globals.framecount; |
---|
.. | .. |
---|
893 | 900 | |
---|
894 | 901 | boolean changedir = random && Math.random() < 0.01; // && !link2master; |
---|
895 | 902 | |
---|
896 | | - if (transformcount*factor > maxcount || (step == 1 && changedir)) |
---|
| 903 | + if (transformcount*factor >= maxcount && (rewind || random) || |
---|
| 904 | + (step == 1 && changedir)) |
---|
897 | 905 | { |
---|
898 | 906 | countdown = 1; |
---|
899 | 907 | delay = speedup?8:1; |
---|
.. | .. |
---|
965 | 973 | if (material == null || material.multiply) |
---|
966 | 974 | return true; |
---|
967 | 975 | |
---|
| 976 | + // Transparent objects are dynamic because we have to sort the triangles. |
---|
968 | 977 | return material.opacity > 0.99; |
---|
969 | 978 | } |
---|
970 | 979 | |
---|
.. | .. |
---|
2386 | 2395 | } |
---|
2387 | 2396 | */ |
---|
2388 | 2397 | } |
---|
| 2398 | + else |
---|
| 2399 | + { |
---|
| 2400 | + //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2401 | + } |
---|
2389 | 2402 | } |
---|
2390 | 2403 | |
---|
2391 | 2404 | void createEditWindow(GroupEditor callee, boolean newWindow) //, boolean root) |
---|
.. | .. |
---|
2427 | 2440 | { |
---|
2428 | 2441 | editWindow.refreshContents(); |
---|
2429 | 2442 | } |
---|
| 2443 | + else |
---|
| 2444 | + { |
---|
| 2445 | + if (manipWindow != null) |
---|
| 2446 | + { |
---|
| 2447 | + manipWindow.refreshContents(); |
---|
| 2448 | + } |
---|
| 2449 | + } |
---|
| 2450 | + |
---|
2430 | 2451 | //if (parent != null) |
---|
2431 | 2452 | //parent.refreshEditWindow(); |
---|
2432 | 2453 | } |
---|
.. | .. |
---|
3503 | 3524 | if (blockloop) |
---|
3504 | 3525 | return; |
---|
3505 | 3526 | |
---|
3506 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3527 | + if (//marked || // does not make sense |
---|
| 3528 | + (bRep != null || material != null)) // borderline... |
---|
3507 | 3529 | live = h; |
---|
3508 | 3530 | |
---|
3509 | 3531 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3524 | 3546 | return; |
---|
3525 | 3547 | |
---|
3526 | 3548 | //if (bRep != null) |
---|
3527 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3549 | + if (//marked || // does not make sense |
---|
| 3550 | + (bRep != null || material != null)) // borderline... |
---|
3528 | 3551 | link2master = h; |
---|
3529 | 3552 | |
---|
3530 | 3553 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3544 | 3567 | if (blockloop) |
---|
3545 | 3568 | return; |
---|
3546 | 3569 | |
---|
3547 | | - if (marked || (bRep != null && material != null)) // borderline... |
---|
| 3570 | + if (//marked || // does not make sense |
---|
| 3571 | + (bRep != null || material != null)) // borderline... |
---|
3548 | 3572 | hide = h; |
---|
3549 | 3573 | |
---|
3550 | 3574 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3564 | 3588 | if (blockloop) |
---|
3565 | 3589 | return; |
---|
3566 | 3590 | |
---|
3567 | | - if (bRep != null && material != null) // borderline... |
---|
| 3591 | + if (bRep != null || material != null) // borderline... |
---|
3568 | 3592 | marked = h; |
---|
3569 | 3593 | |
---|
3570 | 3594 | for (int i = 0; i < Size(); i++) |
---|
.. | .. |
---|
3574 | 3598 | continue; |
---|
3575 | 3599 | blockloop = true; |
---|
3576 | 3600 | 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); |
---|
3577 | 3641 | blockloop = false; |
---|
3578 | 3642 | // release(i); |
---|
3579 | 3643 | } |
---|
.. | .. |
---|
4351 | 4415 | } |
---|
4352 | 4416 | } |
---|
4353 | 4417 | |
---|
| 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 | + |
---|
4354 | 4467 | void RepairTexture() |
---|
4355 | 4468 | { |
---|
4356 | 4469 | if (this instanceof FileObject || blockloop) |
---|
.. | .. |
---|
4865 | 4978 | } |
---|
4866 | 4979 | } |
---|
4867 | 4980 | |
---|
| 4981 | + ObjEditor GetWindow() |
---|
| 4982 | + { |
---|
| 4983 | + if (editWindow != null) |
---|
| 4984 | + return editWindow; |
---|
| 4985 | + |
---|
| 4986 | + return manipWindow; |
---|
| 4987 | + } |
---|
| 4988 | + |
---|
4868 | 4989 | cTreePath Select(int indexcount, boolean deselect) |
---|
4869 | 4990 | { |
---|
4870 | 4991 | if (hide || dontselect) |
---|
.. | .. |
---|
4901 | 5022 | if (leaf != null) |
---|
4902 | 5023 | { |
---|
4903 | 5024 | cTreePath tp = new cTreePath(this, leaf); |
---|
4904 | | - if (editWindow != null) |
---|
| 5025 | + ObjEditor window = GetWindow(); |
---|
| 5026 | + if (window != null) |
---|
4905 | 5027 | { |
---|
4906 | 5028 | //System.out.println("editWindow = " + editWindow + " vs " + this); |
---|
4907 | | - editWindow.Select(tp, deselect, true); |
---|
| 5029 | + window.Select(tp, deselect, true); |
---|
4908 | 5030 | } |
---|
4909 | 5031 | |
---|
4910 | 5032 | return tp; |
---|
.. | .. |
---|
4930 | 5052 | if (leaf != null) |
---|
4931 | 5053 | { |
---|
4932 | 5054 | cTreePath tp = new cTreePath(this, leaf); |
---|
4933 | | - if (editWindow != null) |
---|
| 5055 | + ObjEditor window = GetWindow(); |
---|
| 5056 | + if (window != null) |
---|
4934 | 5057 | { |
---|
4935 | | - editWindow.Select(tp, deselect, true); |
---|
| 5058 | + window.Select(tp, deselect, true); |
---|
4936 | 5059 | } |
---|
4937 | 5060 | |
---|
4938 | 5061 | return tp; |
---|
.. | .. |
---|
5653 | 5776 | support = support; |
---|
5654 | 5777 | |
---|
5655 | 5778 | //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); |
---|
5657 | 5780 | |
---|
5658 | 5781 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5659 | 5782 | { |
---|
.. | .. |
---|
5673 | 5796 | boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection(); |
---|
5674 | 5797 | |
---|
5675 | 5798 | 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))) |
---|
5677 | 5801 | { |
---|
5678 | 5802 | Globals.lighttouched = true; |
---|
5679 | 5803 | } // all panes... |
---|
| 5804 | + |
---|
5680 | 5805 | //if (usecalllists && display.DrawMode() != display.SELECTION && display.DrawMode() != display.SHADOW && |
---|
5681 | 5806 | if (bRep != null && usecalllists && !selectmode && // june 2013 display.DrawMode() != display.SHADOW && |
---|
5682 | 5807 | (touched || (bRep != null && bRep.displaylist <= 0))) |
---|
.. | .. |
---|
5844 | 5969 | tex = GetTextures(); |
---|
5845 | 5970 | } |
---|
5846 | 5971 | |
---|
5847 | | - boolean failed = false; |
---|
| 5972 | + boolean failedPigment = false; |
---|
| 5973 | + boolean failedBump = false; |
---|
5848 | 5974 | |
---|
5849 | 5975 | try |
---|
5850 | 5976 | { |
---|
5851 | | - display.BindTextures(tex, texres); |
---|
| 5977 | + display.BindPigmentTexture(tex, texres); |
---|
5852 | 5978 | } |
---|
5853 | 5979 | catch (Exception e) |
---|
5854 | 5980 | { |
---|
5855 | 5981 | 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; |
---|
5857 | 5993 | } |
---|
5858 | 5994 | |
---|
5859 | 5995 | if (!compiled) |
---|
.. | .. |
---|
5876 | 6012 | } |
---|
5877 | 6013 | } |
---|
5878 | 6014 | |
---|
5879 | | - if (!failed) |
---|
5880 | | - display.ReleaseTextures(tex); |
---|
| 6015 | + if (!failedBump) |
---|
| 6016 | + display.ReleaseBumpTexture(tex); |
---|
| 6017 | + |
---|
| 6018 | + if (!failedPigment) |
---|
| 6019 | + display.ReleasePigmentTexture(tex); |
---|
5881 | 6020 | |
---|
5882 | 6021 | display.PopMaterial(this, selected); |
---|
5883 | 6022 | } |
---|
.. | .. |
---|
6250 | 6389 | // dec 2012 |
---|
6251 | 6390 | new Exception().printStackTrace(); |
---|
6252 | 6391 | return; |
---|
| 6392 | + } |
---|
| 6393 | + |
---|
| 6394 | + if (dontselect) |
---|
| 6395 | + { |
---|
| 6396 | + //bRep.GenerateNormalsMINE(); |
---|
6253 | 6397 | } |
---|
6254 | 6398 | |
---|
6255 | 6399 | display.DrawGeometry(bRep, flipV, selectmode); |
---|
.. | .. |
---|
7102 | 7246 | spot.translate(32, 32); |
---|
7103 | 7247 | spotw = spot.x + spot.width; |
---|
7104 | 7248 | spoth = spot.y + spot.height; |
---|
7105 | | - info.g.setColor(Color.blue); |
---|
| 7249 | + info.g.setColor(Color.cyan); |
---|
7106 | 7250 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7107 | 7251 | // if (CameraPane.Xmin > spot.x) |
---|
7108 | 7252 | // { |
---|
.. | .. |
---|
7120 | 7264 | // { |
---|
7121 | 7265 | // CameraPane.Ymax = spoth; |
---|
7122 | 7266 | // } |
---|
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 |
---|
7125 | 7269 | spot.translate(0, -32); |
---|
7126 | | - info.g.setColor(Color.green); |
---|
| 7270 | + info.g.setColor(Color.yellow); |
---|
7127 | 7271 | info.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7272 | + info.g.setColor(Color.green); |
---|
7128 | 7273 | // if (CameraPane.Xmin > spot.x) |
---|
7129 | 7274 | // { |
---|
7130 | 7275 | // CameraPane.Xmin = spot.x; |
---|
.. | .. |
---|
7442 | 7587 | switch (info.pane.RenderCamera().viewCode) |
---|
7443 | 7588 | { |
---|
7444 | 7589 | case 3: // '\001' |
---|
7445 | | - if (modified) |
---|
| 7590 | + if (modified || opposite) |
---|
7446 | 7591 | { |
---|
7447 | 7592 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7448 | 7593 | LA.matScale(toParent, totalScale, 1, 1); |
---|
7449 | 7594 | } // vScale, 1); |
---|
7450 | 7595 | else |
---|
7451 | 7596 | { |
---|
| 7597 | + // EXCEPTION! |
---|
7452 | 7598 | LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
7453 | 7599 | } // vScale, 1); |
---|
7454 | 7600 | break; |
---|
7455 | 7601 | |
---|
7456 | 7602 | case 2: // '\002' |
---|
7457 | | - if (modified) |
---|
| 7603 | + if (modified || opposite) |
---|
7458 | 7604 | { |
---|
7459 | 7605 | //LA.matScale(toParent, hScale, 1, vScale); |
---|
7460 | 7606 | LA.matScale(toParent, 1, totalScale, 1); |
---|
.. | .. |
---|
7465 | 7611 | break; |
---|
7466 | 7612 | |
---|
7467 | 7613 | case 1: // '\003' |
---|
7468 | | - if (modified) |
---|
| 7614 | + if (modified || opposite) |
---|
7469 | 7615 | { |
---|
7470 | 7616 | //LA.matScale(toParent, hScale, vScale, 1); |
---|
7471 | 7617 | LA.matScale(toParent, 1, 1, totalScale); |
---|
.. | .. |
---|
7685 | 7831 | editWindow = null; |
---|
7686 | 7832 | } // ? |
---|
7687 | 7833 | } |
---|
| 7834 | + else |
---|
| 7835 | + { |
---|
| 7836 | + //editWindow.closeUI(); |
---|
| 7837 | + } |
---|
7688 | 7838 | } |
---|
7689 | 7839 | |
---|
7690 | 7840 | boolean root; // patch for edit windows |
---|
.. | .. |
---|
7842 | 7992 | } |
---|
7843 | 7993 | |
---|
7844 | 7994 | transient ObjEditor editWindow; |
---|
| 7995 | + transient ObjEditor manipWindow; |
---|
| 7996 | + |
---|
| 7997 | + transient boolean pinned; |
---|
| 7998 | + |
---|
7845 | 7999 | transient ObjectUI objectUI; |
---|
7846 | 8000 | public static int povDepth = 0; |
---|
7847 | 8001 | private static cVector tbMin = new cVector(); |
---|