.. | .. |
---|
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. |
---|
.. | .. |
---|
32 | 33 | String skyboxname; |
---|
33 | 34 | String skyboxext; |
---|
34 | 35 | |
---|
35 | | - Object3D versions[]; |
---|
| 36 | + Object3D versionlist[]; |
---|
36 | 37 | int versionindex = -1; |
---|
37 | 38 | |
---|
| 39 | + java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); |
---|
| 40 | + |
---|
38 | 41 | ScriptNode scriptnode; |
---|
39 | 42 | |
---|
40 | 43 | void InitOthers() |
---|
.. | .. |
---|
222 | 225 | // o.bRep.support = null; |
---|
223 | 226 | // } |
---|
224 | 227 | o.selection = this.selection; |
---|
225 | | - o.versions = this.versions; |
---|
| 228 | + o.versionlist = this.versionlist; |
---|
226 | 229 | o.versionindex = this.versionindex; |
---|
227 | 230 | |
---|
228 | 231 | if (this.support != null) |
---|
.. | .. |
---|
244 | 247 | // this.bRep.support = null; |
---|
245 | 248 | // this.support = null; |
---|
246 | 249 | // this.fileparent = null; |
---|
| 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 | +// } |
---|
| 274 | + |
---|
| 275 | + transient boolean tag; |
---|
| 276 | + |
---|
| 277 | + void TagObjects(Object3D o, boolean tag) |
---|
| 278 | + { |
---|
| 279 | + if (blockloop) |
---|
| 280 | + return; |
---|
| 281 | + |
---|
| 282 | + o.tag = tag; |
---|
| 283 | + |
---|
| 284 | + if (o == this) |
---|
| 285 | + return; |
---|
| 286 | + |
---|
| 287 | + blockloop = true; |
---|
| 288 | + |
---|
| 289 | + for (int i=0; i<Size(); i++) |
---|
| 290 | + { |
---|
| 291 | + get(i).TagObjects(o, tag); |
---|
| 292 | + } |
---|
| 293 | + |
---|
| 294 | + blockloop = false; |
---|
| 295 | + } |
---|
| 296 | + |
---|
| 297 | + boolean HasTags() |
---|
| 298 | + { |
---|
| 299 | + if (blockloop) |
---|
| 300 | + return false; |
---|
| 301 | + |
---|
| 302 | + blockloop = true; |
---|
| 303 | + |
---|
| 304 | + boolean hasTags = false; |
---|
| 305 | + |
---|
| 306 | + for (int i=0; i<Size(); i++) |
---|
| 307 | + { |
---|
| 308 | + hasTags |= get(i).tag || get(i).HasTags(); |
---|
| 309 | + |
---|
| 310 | + if (hasTags) |
---|
| 311 | + break; |
---|
| 312 | + } |
---|
| 313 | + |
---|
| 314 | + blockloop = false; |
---|
| 315 | + |
---|
| 316 | + return hasTags; |
---|
247 | 317 | } |
---|
248 | 318 | |
---|
249 | 319 | void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) |
---|
.. | .. |
---|
280 | 350 | |
---|
281 | 351 | this.selection = o.selection; |
---|
282 | 352 | |
---|
283 | | - this.versions = o.versions; |
---|
| 353 | + this.versionlist = o.versionlist; |
---|
284 | 354 | this.versionindex = o.versionindex; |
---|
285 | 355 | // July 2019 if (this.bRep != null) |
---|
286 | 356 | // this.bRep.support = o.transientrep; |
---|
.. | .. |
---|
2444 | 2514 | else |
---|
2445 | 2515 | { |
---|
2446 | 2516 | //((ObjEditor)editWindow).SetupUI2(null); |
---|
| 2517 | + if (objectUI != null) |
---|
| 2518 | + ((ObjEditor)objectUI).pinButton.setSelected(pinned); |
---|
| 2519 | + else |
---|
| 2520 | + //new Exception().printStackTrace(); |
---|
| 2521 | + System.err.println("objectUI is null"); |
---|
2447 | 2522 | } |
---|
2448 | 2523 | } |
---|
2449 | 2524 | |
---|
.. | .. |
---|
3547 | 3622 | |
---|
3548 | 3623 | void ClearMaterials() |
---|
3549 | 3624 | { |
---|
| 3625 | + if (blockloop) |
---|
| 3626 | + return; |
---|
| 3627 | + |
---|
| 3628 | + blockloop = true; |
---|
| 3629 | + |
---|
3550 | 3630 | ClearMaterial(); |
---|
3551 | | - for (int i = 0; i < size(); i++) |
---|
| 3631 | + for (int i = 0; i < Size(); i++) |
---|
3552 | 3632 | { |
---|
3553 | | - Object3D child = (Object3D) reserve(i); |
---|
| 3633 | + Object3D child = (Object3D) get(i); |
---|
3554 | 3634 | if (child == null) |
---|
3555 | 3635 | continue; |
---|
3556 | 3636 | child.ClearMaterials(); |
---|
3557 | | - release(i); |
---|
3558 | 3637 | } |
---|
| 3638 | + |
---|
| 3639 | + blockloop = false; |
---|
| 3640 | + } |
---|
| 3641 | + |
---|
| 3642 | + void ClearVersionList() |
---|
| 3643 | + { |
---|
| 3644 | + this.versionlist = null; |
---|
| 3645 | + this.versionindex = -1; |
---|
| 3646 | + this.versiontable = null; |
---|
| 3647 | + } |
---|
| 3648 | + |
---|
| 3649 | + void ClearVersions() |
---|
| 3650 | + { |
---|
| 3651 | + if (blockloop) |
---|
| 3652 | + return; |
---|
| 3653 | + |
---|
| 3654 | + blockloop = true; |
---|
| 3655 | + |
---|
| 3656 | + ClearVersionList(); |
---|
| 3657 | + for (int i = 0; i < Size(); i++) |
---|
| 3658 | + { |
---|
| 3659 | + Object3D child = (Object3D) get(i); |
---|
| 3660 | + if (child == null) |
---|
| 3661 | + continue; |
---|
| 3662 | + child.ClearVersions(); |
---|
| 3663 | + } |
---|
| 3664 | + |
---|
| 3665 | + blockloop = false; |
---|
3559 | 3666 | } |
---|
3560 | 3667 | |
---|
3561 | 3668 | void FlipV(boolean flip) |
---|
.. | .. |
---|
5545 | 5652 | if (fullname == null) |
---|
5546 | 5653 | return ""; |
---|
5547 | 5654 | |
---|
| 5655 | + if (fullname.pigment != null) |
---|
| 5656 | + { |
---|
| 5657 | + return fullname.pigment; |
---|
| 5658 | + } |
---|
| 5659 | + |
---|
5548 | 5660 | // System.out.println("Fullname = " + fullname); |
---|
5549 | 5661 | |
---|
5550 | 5662 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5557 | 5669 | |
---|
5558 | 5670 | if (split.length == 0) |
---|
5559 | 5671 | { |
---|
5560 | | - return ""; |
---|
| 5672 | + return fullname.pigment = ""; |
---|
5561 | 5673 | } |
---|
5562 | 5674 | |
---|
5563 | 5675 | if (split.length <= 2) |
---|
.. | .. |
---|
5565 | 5677 | if (fullname.name.endsWith(":")) |
---|
5566 | 5678 | { |
---|
5567 | 5679 | // Windows |
---|
5568 | | - return fullname.name.substring(0, fullname.name.length()-1); |
---|
| 5680 | + return fullname.pigment = fullname.name.substring(0, fullname.name.length()-1); |
---|
5569 | 5681 | } |
---|
5570 | 5682 | |
---|
5571 | | - return split[0]; |
---|
| 5683 | + return fullname.pigment = split[0]; |
---|
5572 | 5684 | } |
---|
5573 | 5685 | |
---|
5574 | 5686 | // Windows |
---|
5575 | 5687 | assert(split.length == 4); |
---|
5576 | 5688 | |
---|
5577 | | - return split[0] + ":" + split[1]; |
---|
| 5689 | + return fullname.pigment = split[0] + ":" + split[1]; |
---|
5578 | 5690 | } |
---|
5579 | 5691 | |
---|
5580 | 5692 | static String GetBump(cTexture fullname) |
---|
5581 | 5693 | { |
---|
5582 | 5694 | if (fullname == null) |
---|
5583 | 5695 | return ""; |
---|
| 5696 | + |
---|
| 5697 | + if (fullname.bump != null) |
---|
| 5698 | + { |
---|
| 5699 | + return fullname.bump; |
---|
| 5700 | + } |
---|
5584 | 5701 | |
---|
5585 | 5702 | // System.out.println("Fullname = " + fullname); |
---|
5586 | 5703 | // Does not work on Windows due to C: |
---|
.. | .. |
---|
5592 | 5709 | |
---|
5593 | 5710 | if (split.length == 0) |
---|
5594 | 5711 | { |
---|
5595 | | - return ""; |
---|
| 5712 | + return fullname.bump = ""; |
---|
5596 | 5713 | } |
---|
5597 | 5714 | |
---|
5598 | 5715 | if (split.length == 1) |
---|
5599 | 5716 | { |
---|
5600 | | - return ""; |
---|
| 5717 | + return fullname.bump = ""; |
---|
5601 | 5718 | } |
---|
5602 | 5719 | |
---|
5603 | 5720 | if (split.length == 2) |
---|
.. | .. |
---|
5605 | 5722 | if (fullname.name.endsWith(":")) |
---|
5606 | 5723 | { |
---|
5607 | 5724 | // Windows |
---|
5608 | | - return ""; |
---|
| 5725 | + return fullname.bump = ""; |
---|
5609 | 5726 | } |
---|
5610 | 5727 | |
---|
5611 | | - return split[1]; |
---|
| 5728 | + return fullname.bump = split[1]; |
---|
5612 | 5729 | } |
---|
5613 | 5730 | |
---|
5614 | 5731 | // Windows |
---|
5615 | 5732 | assert(split.length == 4); |
---|
5616 | 5733 | |
---|
5617 | | - return split[2] + ":" + split[3]; |
---|
| 5734 | + return fullname.bump = split[2] + ":" + split[3]; |
---|
5618 | 5735 | } |
---|
5619 | 5736 | |
---|
5620 | 5737 | String GetPigmentTexture() |
---|
.. | .. |
---|
5697 | 5814 | texname = ""; |
---|
5698 | 5815 | |
---|
5699 | 5816 | GetTextures().name = texname + ":" + GetBump(GetTextures()); |
---|
| 5817 | + |
---|
| 5818 | + GetTextures().pigment = null; |
---|
| 5819 | + |
---|
5700 | 5820 | Touch(); |
---|
5701 | 5821 | } |
---|
5702 | 5822 | |
---|
.. | .. |
---|
5769 | 5889 | texname = ""; |
---|
5770 | 5890 | |
---|
5771 | 5891 | GetTextures().name = Object3D.GetPigment(GetTextures()) + ":" + texname; |
---|
| 5892 | + |
---|
| 5893 | + GetTextures().bump = null; |
---|
5772 | 5894 | |
---|
5773 | 5895 | Touch(); |
---|
5774 | 5896 | } |
---|
.. | .. |
---|
7373 | 7495 | boundary.y = spot.y - 30; |
---|
7374 | 7496 | boundary.width = spot.width + 60; |
---|
7375 | 7497 | boundary.height = spot.height + 60; |
---|
7376 | | - clickInfo.g.setColor(Color.red); |
---|
| 7498 | + clickInfo.g.setColor(Color.white); |
---|
7377 | 7499 | int spotw = spot.x + spot.width; |
---|
7378 | 7500 | int spoth = spot.y + spot.height; |
---|
7379 | 7501 | clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
.. | .. |
---|
7393 | 7515 | // { |
---|
7394 | 7516 | // CameraPane.Ymax = spoth; |
---|
7395 | 7517 | // } |
---|
7396 | | - spot.translate(32, 32); |
---|
| 7518 | +// if (CameraPane.Xmin > spot.x) |
---|
| 7519 | +// { |
---|
| 7520 | +// CameraPane.Xmin = spot.x; |
---|
| 7521 | +// } |
---|
| 7522 | +// if (CameraPane.Xmax < spotw) |
---|
| 7523 | +// { |
---|
| 7524 | +// CameraPane.Xmax = spotw; |
---|
| 7525 | +// } |
---|
| 7526 | +// if (CameraPane.Ymin > spot.y) |
---|
| 7527 | +// { |
---|
| 7528 | +// CameraPane.Ymin = spot.y; |
---|
| 7529 | +// } |
---|
| 7530 | +// if (CameraPane.Ymax < spoth) |
---|
| 7531 | +// { |
---|
| 7532 | +// CameraPane.Ymax = spoth; |
---|
| 7533 | +// } |
---|
| 7534 | + // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
| 7535 | + //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
| 7536 | + spot.translate(32, 0); |
---|
| 7537 | + clickInfo.g.setColor(Color.yellow); |
---|
| 7538 | + clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
| 7539 | + |
---|
| 7540 | + spot.translate(32, 64); |
---|
7397 | 7541 | spotw = spot.x + spot.width; |
---|
7398 | 7542 | spoth = spot.y + spot.height; |
---|
7399 | 7543 | clickInfo.g.setColor(Color.cyan); |
---|
.. | .. |
---|
7414 | 7558 | // { |
---|
7415 | 7559 | // CameraPane.Ymax = spoth; |
---|
7416 | 7560 | // } |
---|
7417 | | - // bonhommes info.g.drawLine(spotw, spoth, spotw, spoth - boundary.height/2); // 15 |
---|
7418 | | - //info.g.drawLine(spotw, spoth, spotw - boundary.width/2, spoth); // 15 |
---|
7419 | | - spot.translate(0, -32); |
---|
7420 | | - clickInfo.g.setColor(Color.yellow); |
---|
7421 | | - clickInfo.g.fillRect(spot.x, spot.y, spot.width, spot.height); |
---|
7422 | 7561 | clickInfo.g.setColor(Color.green); |
---|
7423 | | -// if (CameraPane.Xmin > spot.x) |
---|
7424 | | -// { |
---|
7425 | | -// CameraPane.Xmin = spot.x; |
---|
7426 | | -// } |
---|
7427 | | -// if (CameraPane.Xmax < spotw) |
---|
7428 | | -// { |
---|
7429 | | -// CameraPane.Xmax = spotw; |
---|
7430 | | -// } |
---|
7431 | | -// if (CameraPane.Ymin > spot.y) |
---|
7432 | | -// { |
---|
7433 | | -// CameraPane.Ymin = spot.y; |
---|
7434 | | -// } |
---|
7435 | | -// if (CameraPane.Ymax < spoth) |
---|
7436 | | -// { |
---|
7437 | | -// CameraPane.Ymax = spoth; |
---|
7438 | | -// } |
---|
7439 | 7562 | clickInfo.g.drawArc(boundary.x + clickInfo.DX, boundary.y + clickInfo.DY, |
---|
7440 | 7563 | (int)(boundary.width * clickInfo.W), (int)(boundary.height * clickInfo.W), 0, 360); |
---|
7441 | 7564 | //info.g.drawArc(spot.x, spotw, spot.width/2, boundary.height/2, 0, 360); |
---|
.. | .. |
---|
7494 | 7617 | retval = true; |
---|
7495 | 7618 | } |
---|
7496 | 7619 | spot.translate(0, 32); |
---|
| 7620 | + spot.translate(32, 0); |
---|
| 7621 | + spot.translate(0, 32); |
---|
7497 | 7622 | if (spot.contains(clickInfo.x, clickInfo.y)) |
---|
7498 | 7623 | { |
---|
7499 | 7624 | hitSomething = hitScale; |
---|
7500 | 7625 | |
---|
7501 | 7626 | double scale = 0.005f * clickInfo.camera.Distance(); |
---|
7502 | | - double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7627 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7503 | 7628 | double sign = 1; |
---|
7504 | 7629 | if (hScale < 0) |
---|
7505 | 7630 | { |
---|
.. | .. |
---|
7511 | 7636 | //hScale = 0.01; |
---|
7512 | 7637 | } |
---|
7513 | 7638 | |
---|
7514 | | - double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7639 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7515 | 7640 | sign = 1; |
---|
7516 | 7641 | if (vScale < 0) |
---|
7517 | 7642 | { |
---|
.. | .. |
---|
7726 | 7851 | break; |
---|
7727 | 7852 | |
---|
7728 | 7853 | case hitScale: // scale |
---|
7729 | | - double hScale = (double) (clickInfo.x - centerPt.x) / 32; |
---|
| 7854 | + double hScale = (double) (clickInfo.x - centerPt.x) / 64; |
---|
7730 | 7855 | double sign = 1; |
---|
7731 | 7856 | if (hScale < 0) |
---|
7732 | 7857 | { |
---|
.. | .. |
---|
7738 | 7863 | //hScale = 0.01; |
---|
7739 | 7864 | } |
---|
7740 | 7865 | |
---|
7741 | | - double vScale = (double) (clickInfo.y - centerPt.y) / 32; |
---|
| 7866 | + double vScale = (double) (clickInfo.y - centerPt.y) / 64; |
---|
7742 | 7867 | sign = 1; |
---|
7743 | 7868 | if (vScale < 0) |
---|
7744 | 7869 | { |
---|
.. | .. |
---|
7771 | 7896 | case 3: // '\001' |
---|
7772 | 7897 | if (modified || opposite) |
---|
7773 | 7898 | { |
---|
| 7899 | + if (modified && opposite) |
---|
| 7900 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7901 | + else |
---|
7774 | 7902 | //LA.matScale(toParent, 1, hScale, vScale); |
---|
7775 | | - LA.matScale(toParent, totalScale, 1, 1); |
---|
| 7903 | + LA.matScale(toParent, totalScale, 1, 1); |
---|
7776 | 7904 | } // vScale, 1); |
---|
7777 | 7905 | else |
---|
7778 | 7906 | { |
---|
7779 | 7907 | // EXCEPTION! |
---|
7780 | | - LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7908 | + LA.matScale(toParent, 1, totalScale, totalScale); |
---|
7781 | 7909 | } // vScale, 1); |
---|
7782 | 7910 | break; |
---|
7783 | 7911 | |
---|
7784 | 7912 | case 2: // '\002' |
---|
7785 | 7913 | if (modified || opposite) |
---|
7786 | 7914 | { |
---|
7787 | | - //LA.matScale(toParent, hScale, 1, vScale); |
---|
7788 | | - LA.matScale(toParent, 1, totalScale, 1); |
---|
| 7915 | + if (modified && opposite) |
---|
| 7916 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7917 | + else |
---|
| 7918 | + //LA.matScale(toParent, hScale, 1, vScale); |
---|
| 7919 | + LA.matScale(toParent, 1, totalScale, 1); |
---|
7789 | 7920 | } else |
---|
7790 | 7921 | { |
---|
7791 | 7922 | LA.matScale(toParent, totalScale, 1, totalScale); |
---|
.. | .. |
---|
7795 | 7926 | case 1: // '\003' |
---|
7796 | 7927 | if (modified || opposite) |
---|
7797 | 7928 | { |
---|
7798 | | - //LA.matScale(toParent, hScale, vScale, 1); |
---|
7799 | | - LA.matScale(toParent, 1, 1, totalScale); |
---|
| 7929 | + if (modified && opposite) |
---|
| 7930 | + LA.matScale(toParent, totalScale, totalScale, totalScale); |
---|
| 7931 | + else |
---|
| 7932 | + //LA.matScale(toParent, hScale, vScale, 1); |
---|
| 7933 | + LA.matScale(toParent, 1, 1, totalScale); |
---|
7800 | 7934 | } else |
---|
7801 | 7935 | { |
---|
7802 | 7936 | LA.matScale(toParent, totalScale, totalScale, 1); |
---|