.. | .. |
---|
22 | 22 | //static final long serialVersionUID = -607422624994562685L; |
---|
23 | 23 | static final long serialVersionUID = 5022536242724664900L; |
---|
24 | 24 | |
---|
| 25 | + // Use GetUUID for backward compatibility with null. |
---|
25 | 26 | private UUID uuid = UUID.randomUUID(); |
---|
26 | 27 | |
---|
27 | 28 | // TEMPORARY for mocap undo. No need to be transient. |
---|
.. | .. |
---|
29 | 30 | Object3D saveskeleton; |
---|
30 | 31 | // |
---|
31 | 32 | |
---|
32 | | - byte[] versions[]; |
---|
| 33 | + String skyboxname; |
---|
| 34 | + String skyboxext; |
---|
| 35 | + |
---|
| 36 | + Object3D versionlist[]; |
---|
33 | 37 | int versionindex = -1; |
---|
34 | 38 | |
---|
| 39 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 40 | + |
---|
35 | 41 | ScriptNode scriptnode; |
---|
36 | 42 | |
---|
37 | 43 | void InitOthers() |
---|
.. | .. |
---|
219 | 225 | // o.bRep.support = null; |
---|
220 | 226 | // } |
---|
221 | 227 | o.selection = this.selection; |
---|
222 | | - o.versions = this.versions; |
---|
| 228 | + o.versionlist = this.versionlist; |
---|
223 | 229 | o.versionindex = this.versionindex; |
---|
224 | 230 | |
---|
225 | 231 | if (this.support != null) |
---|
.. | .. |
---|
242 | 248 | // this.support = null; |
---|
243 | 249 | // this.fileparent = null; |
---|
244 | 250 | } |
---|
| 251 | + |
---|
| 252 | +// Object3D GetObject(java.util.UUID uuid) |
---|
| 253 | +// { |
---|
| 254 | +// if (this.uuid.equals(uuid)) |
---|
| 255 | +// return this; |
---|
| 256 | +// |
---|
| 257 | +// if (blockloop) |
---|
| 258 | +// return null; |
---|
| 259 | +// |
---|
| 260 | +// blockloop = true; |
---|
| 261 | +// |
---|
| 262 | +// for (int i=0; i<Size(); i++) |
---|
| 263 | +// { |
---|
| 264 | +// Object3D o = get(i).GetObject(uuid); |
---|
| 265 | +// |
---|
| 266 | +// if (o != null) |
---|
| 267 | +// return o; |
---|
| 268 | +// } |
---|
| 269 | +// |
---|
| 270 | +// blockloop = false; |
---|
| 271 | +// |
---|
| 272 | +// return null; |
---|
| 273 | +// } |
---|
245 | 274 | |
---|
246 | 275 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
247 | 276 | { |
---|
.. | .. |
---|
277 | 306 | |
---|
278 | 307 | this.selection = o.selection; |
---|
279 | 308 | |
---|
280 | | - this.versions = o.versions; |
---|
| 309 | + this.versionlist = o.versionlist; |
---|
281 | 310 | this.versionindex = o.versionindex; |
---|
282 | 311 | // July 2019 if (this.bRep != null) |
---|
283 | 312 | // this.bRep.support = o.transientrep; |
---|
.. | .. |
---|
1011 | 1040 | |
---|
1012 | 1041 | if (material == null || material.multiply) |
---|
1013 | 1042 | return true; |
---|
| 1043 | + |
---|
| 1044 | + if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000) |
---|
| 1045 | + return false; |
---|
1014 | 1046 | |
---|
1015 | 1047 | // Transparent objects are dynamic because we have to sort the triangles. |
---|
1016 | 1048 | return material.opacity > 0.99; |
---|
.. | .. |
---|
2438 | 2470 | else |
---|
2439 | 2471 | { |
---|
2440 | 2472 | //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2473 | + if (objectUI != null) |
---|
| 2474 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2475 | + else |
---|
| 2476 | + //new Exception().printStackTrace(); |
---|
| 2477 | + System.err.println("objectUI is null"); |
---|
2441 | 2478 | } |
---|
2442 | 2479 | } |
---|
2443 | 2480 | |
---|
.. | .. |
---|
5539 | 5576 | if (fullname == null) |
---|
5540 | 5577 | return ""; |
---|
5541 | 5578 | |
---|
| 5579 | + if (fullname.pigment != null) |
---|
| 5580 | + { |
---|
| 5581 | + return fullname.pigment; |
---|
| 5582 | + } |
---|
| 5583 | + |
---|
5542 | 5584 | // System.out.println("Fullname = " + fullname); |
---|
5543 | 5585 | |
---|
5544 | 5586 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5551 | 5593 | |
---|
5552 | 5594 | if (split.length == 0) |
---|
5553 | 5595 | { |
---|
5554 | | - return ""; |
---|
| 5596 | + return fullname.pigment = ""; |
---|
5555 | 5597 | } |
---|
5556 | 5598 | |
---|
5557 | 5599 | if (split.length <= 2) |
---|
.. | .. |
---|
5559 | 5601 | if (fullname.name.endsWith(":")) |
---|
5560 | 5602 | { |
---|
5561 | 5603 | // Windows |
---|
5562 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5604 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5563 | 5605 | } |
---|
5564 | 5606 | |
---|
5565 | | - return split[0]; |
---|
| 5607 | + return fullname.pigment = split[0]; |
---|
5566 | 5608 | } |
---|
5567 | 5609 | |
---|
5568 | 5610 | // Windows |
---|
5569 | 5611 | assert(split.length == 4); |
---|
5570 | 5612 | |
---|
5571 | | - return split[0] + ":" + split[1]; |
---|
| 5613 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5572 | 5614 | } |
---|
5573 | 5615 | |
---|
5574 | 5616 | static String GetBump(cTexture fullname) |
---|
5575 | 5617 | { |
---|
5576 | 5618 | if (fullname == null) |
---|
5577 | 5619 | return ""; |
---|
| 5620 | + |
---|
| 5621 | + if (fullname.bump != null) |
---|
| 5622 | + { |
---|
| 5623 | + return fullname.bump; |
---|
| 5624 | + } |
---|
5578 | 5625 | |
---|
5579 | 5626 | // System.out.println("Fullname = " + fullname); |
---|
5580 | 5627 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5586 | 5633 | |
---|
5587 | 5634 | if (split.length == 0) |
---|
5588 | 5635 | { |
---|
5589 | | - return ""; |
---|
| 5636 | + return fullname.bump = ""; |
---|
5590 | 5637 | } |
---|
5591 | 5638 | |
---|
5592 | 5639 | if (split.length == 1) |
---|
5593 | 5640 | { |
---|
5594 | | - return ""; |
---|
| 5641 | + return fullname.bump = ""; |
---|
5595 | 5642 | } |
---|
5596 | 5643 | |
---|
5597 | 5644 | if (split.length == 2) |
---|
.. | .. |
---|
5599 | 5646 | if (fullname.name.endsWith(":")) |
---|
5600 | 5647 | { |
---|
5601 | 5648 | // Windows |
---|
5602 | | - return ""; |
---|
| 5649 | + return fullname.bump = ""; |
---|
5603 | 5650 | } |
---|
5604 | 5651 | |
---|
5605 | | - return split[1]; |
---|
| 5652 | + return fullname.bump = split[1]; |
---|
5606 | 5653 | } |
---|
5607 | 5654 | |
---|
5608 | 5655 | // Windows |
---|
5609 | 5656 | assert(split.length == 4); |
---|
5610 | 5657 | |
---|
5611 | | - return split[2] + ":" + split[3]; |
---|
| 5658 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5612 | 5659 | } |
---|
5613 | 5660 | |
---|
5614 | 5661 | String GetPigmentTexture() |
---|
.. | .. |
---|
5691 | 5738 | texname = ""; |
---|
5692 | 5739 | |
---|
5693 | 5740 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5741 | + |
---|
| 5742 | + GetTextures().pigment = null; |
---|
| 5743 | + |
---|
5694 | 5744 | Touch(); |
---|
5695 | 5745 | } |
---|
5696 | 5746 | |
---|
.. | .. |
---|
5763 | 5813 | texname = ""; |
---|
5764 | 5814 | |
---|
5765 | 5815 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
| 5816 | + |
---|
| 5817 | + GetTextures().bump = null; |
---|
5766 | 5818 | |
---|
5767 | 5819 | Touch(); |
---|
5768 | 5820 | } |
---|
.. | .. |
---|
5906 | 5958 | if (support != null) |
---|
5907 | 5959 | support = support; |
---|
5908 | 5960 | |
---|
5909 | | - //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
5910 | | - boolean usecalllists = !IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5961 | + boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5962 | + //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch); |
---|
| 5963 | + |
---|
| 5964 | + //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass. |
---|
5911 | 5965 | |
---|
5912 | 5966 | if (!usecalllists && bRep != null && bRep.displaylist > 0) |
---|
5913 | 5967 | { |
---|
.. | .. |
---|
5917 | 5971 | // usecalllists &= !(parent instanceof RandomNode); |
---|
5918 | 5972 | // usecalllists = false; |
---|
5919 | 5973 | |
---|
5920 | | - if (GetBRep() != null) |
---|
5921 | | - usecalllists = usecalllists; |
---|
| 5974 | + if (display.DrawMode() == display.SHADOW) |
---|
| 5975 | + //GetBRep() != null) |
---|
| 5976 | + usecalllists = !!usecalllists; |
---|
5922 | 5977 | //System.out.println("draw " + this); |
---|
5923 | 5978 | //new Exception().printStackTrace(); |
---|
5924 | 5979 | |
---|
.. | .. |
---|
5940 | 5995 | if (!(this instanceof Composite)) |
---|
5941 | 5996 | touched = false; |
---|
5942 | 5997 | //if (displaylist == -1 && usecalllists) |
---|
5943 | | - if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013 |
---|
| 5998 | + if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013 |
---|
5944 | 5999 | { |
---|
5945 | 6000 | bRep.displaylist = display.GenList(); |
---|
5946 | 6001 | assert(bRep.displaylist != 0); |
---|
.. | .. |
---|
5951 | 6006 | |
---|
5952 | 6007 | //System.out.println("\tnew list " + list); |
---|
5953 | 6008 | //gl.glDrawBuffer(gl.GL_NONE); |
---|
5954 | | - if (usecalllists) |
---|
| 6009 | + if (usecalllists && bRep.displaylist > 0) |
---|
5955 | 6010 | { |
---|
5956 | 6011 | // System.err.println("new list " + bRep.displaylist + " for " + this); |
---|
5957 | 6012 | display.NewList(bRep.displaylist); |
---|
.. | .. |
---|
5960 | 6015 | CallList(display, root, selected, blocked); |
---|
5961 | 6016 | |
---|
5962 | 6017 | // compiled = true; |
---|
5963 | | - if (usecalllists) |
---|
| 6018 | + if (usecalllists && bRep.displaylist > 0) |
---|
5964 | 6019 | { |
---|
5965 | 6020 | // System.err.println("end list " + bRep.displaylist + " for " + this); |
---|
5966 | 6021 | display.EndList(); |
---|
.. | .. |
---|
7364 | 7419 | boundary.y = spot.y - 30; |
---|
7365 | 7420 | boundary.width = spot.width + 60; |
---|
7366 | 7421 | boundary.height = spot.height + 60; |
---|
7367 | | - clickInfo.g.setColor(Color.red); |
---|
| 7422 | + clickInfo.g.setColor(Color.white); |
---|
7368 | 7423 | int spotw = spot.x + spot.width; |
---|
7369 | 7424 | int spoth = spot.y + spot.height; |
---|
7370 | 7425 | clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
7384 | 7439 | // { |
---|
7385 | 7440 | // CameraPane.Ymax = spoth; |
---|
7386 | 7441 | // } |
---|
7387 | | - spot.translate(32, 32); |
---|
| 7442 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7443 | +// { |
---|
| 7444 | +// CameraPane.Xmin = spot.x; |
---|
| 7445 | +// } |
---|
| 7446 | +// if (CameraPane.Xmax < spotw) |
---|
| 7447 | +// { |
---|
| 7448 | +// CameraPane.Xmax = spotw; |
---|
| 7449 | +// } |
---|
| 7450 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7451 | +// { |
---|
| 7452 | +// CameraPane.Ymin = spot.y; |
---|
| 7453 | +// } |
---|
| 7454 | +// if (CameraPane.Ymax < spoth) |
---|
| 7455 | +// { |
---|
| 7456 | +// CameraPane.Ymax = spoth; |
---|
| 7457 | +// } |
---|
| 7458 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7459 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
| 7460 | + spot.translate(32, 0); |
---|
| 7461 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7462 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7463 | + |
---|
| 7464 | + spot.translate(32, 64); |
---|
7388 | 7465 | spotw = spot.x + spot.width; |
---|
7389 | 7466 | spoth = spot.y + spot.height; |
---|
7390 | 7467 | clickInfo.g.setColor(Color.cyan); |
---|
.. | .. |
---|
7405 | 7482 | // { |
---|
7406 | 7483 | // CameraPane.Ymax = spoth; |
---|
7407 | 7484 | // } |
---|
7408 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7409 | | - //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7410 | | - spot.translate(0, -32); |
---|
7411 | | - clickInfo.g.setColor(Color.yellow); |
---|
7412 | | - clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7413 | 7485 | clickInfo.g.setColor(Color.green); |
---|
7414 | | -// if (CameraPane.Xmin > spot.x) |
---|
7415 | | -// { |
---|
7416 | | -// CameraPane.Xmin = spot.x; |
---|
7417 | | -// } |
---|
7418 | | -// if (CameraPane.Xmax < spotw) |
---|
7419 | | -// { |
---|
7420 | | -// CameraPane.Xmax = spotw; |
---|
7421 | | -// } |
---|
7422 | | -// if (CameraPane.Ymin > spot.y) |
---|
7423 | | -// { |
---|
7424 | | -// CameraPane.Ymin = spot.y; |
---|
7425 | | -// } |
---|
7426 | | -// if (CameraPane.Ymax < spoth) |
---|
7427 | | -// { |
---|
7428 | | -// CameraPane.Ymax = spoth; |
---|
7429 | | -// } |
---|
7430 | 7486 | clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
7431 | 7487 | (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7432 | 7488 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
.. | .. |
---|
7485 | 7541 | retval = true; |
---|
7486 | 7542 | } |
---|
7487 | 7543 | spot.translate(0, 32); |
---|
| 7544 | + spot.translate(32, 0); |
---|
| 7545 | + spot.translate(0, 32); |
---|
7488 | 7546 | if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7489 | 7547 | { |
---|
7490 | 7548 | hitSomething = hitScale; |
---|
7491 | 7549 | |
---|
7492 | 7550 | double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7493 | | - double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
| 7551 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7494 | 7552 | double sign = 1; |
---|
7495 | 7553 | if (hScale < 0) |
---|
7496 | 7554 | { |
---|
.. | .. |
---|
7502 | 7560 | //hScale = 0.01; |
---|
7503 | 7561 | } |
---|
7504 | 7562 | |
---|
7505 | | - double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
| 7563 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7506 | 7564 | sign = 1; |
---|
7507 | 7565 | if (vScale < 0) |
---|
7508 | 7566 | { |
---|
.. | .. |
---|
7717 | 7775 | break; |
---|
7718 | 7776 | |
---|
7719 | 7777 | case hitScale: // scale |
---|
7720 | | - double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32; |
---|
| 7778 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7721 | 7779 | double sign = 1; |
---|
7722 | 7780 | if (hScale < 0) |
---|
7723 | 7781 | { |
---|
.. | .. |
---|
7729 | 7787 | //hScale = 0.01; |
---|
7730 | 7788 | } |
---|
7731 | 7789 | |
---|
7732 | | - double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32; |
---|
| 7790 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7733 | 7791 | sign = 1; |
---|
7734 | 7792 | if (vScale < 0) |
---|
7735 | 7793 | { |
---|
.. | .. |
---|
7762 | 7820 | case 3: // '\001' |
---|
7763 | 7821 | if (modified || opposite) |
---|
7764 | 7822 | { |
---|
| 7823 | + if (modified && opposite) |
---|
| 7824 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7825 | + else |
---|
7765 | 7826 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7766 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 7827 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7767 | 7828 | } // vScale, 1); |
---|
7768 | 7829 | else |
---|
7769 | 7830 | { |
---|
7770 | 7831 | // EXCEPTION! |
---|
7771 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7832 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7772 | 7833 | } // vScale, 1); |
---|
7773 | 7834 | break; |
---|
7774 | 7835 | |
---|
7775 | 7836 | case 2: // '\002' |
---|
7776 | 7837 | if (modified || opposite) |
---|
7777 | 7838 | { |
---|
7778 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7779 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 7839 | + if (modified && opposite) |
---|
| 7840 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7841 | + else |
---|
| 7842 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 7843 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7780 | 7844 | } else |
---|
7781 | 7845 | { |
---|
7782 | 7846 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7786 | 7850 | case 1: // '\003' |
---|
7787 | 7851 | if (modified || opposite) |
---|
7788 | 7852 | { |
---|
7789 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7790 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 7853 | + if (modified && opposite) |
---|
| 7854 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7855 | + else |
---|
| 7856 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 7857 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7791 | 7858 | } else |
---|
7792 | 7859 | { |
---|
7793 | 7860 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|